#29750 progress bar page show.
authorJagadedes <jagadees.pillai@zyxware.com>
Tue, 23 Sep 2014 09:46:27 +0000 (15:16 +0530)
committerJagadedes <jagadees.pillai@zyxware.com>
Tue, 23 Sep 2014 09:46:27 +0000 (15:16 +0530)
CRM/Wci/Form/CreateWidget.php
addmore.js
wci.civix.php
wci.php
xml/Menu/wci.xml

index 351446b805a6457c2b15c4d0295b9038a5f36d3b..24eedbb167d116a668954f039755f83f334336a9 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
 require_once 'CRM/Core/Form.php';
+require_once 'wci-helper-functions.php';
 
 /**
  * Form controller class
@@ -89,7 +90,7 @@ class CRM_Wci_Form_CreateWidget extends CRM_Core_Form {
     $this->add('text', 'title', ts('Title'),true);
     $this->add('text', 'logo_image', ts('Logo image'));
     $this->add('text', 'image', ts('Image'));
-    $this->add('select', 'button_link_to', ts('Contribution button'), $this->getContributionPageOptions());
+    $this->add('select', 'button_link_to', ts('Contribution button'), getContributionPageOptions());
     $this->add('text', 'button_title', ts('Contribution button title'));
     $this->add('select', 'progress_bar', ts('Progress bar'), array('' => '- select -'));
     $this->addWysiwyg('description', ts('Description'), '');
@@ -120,6 +121,7 @@ class CRM_Wci_Form_CreateWidget extends CRM_Core_Form {
   }
 
   function postProcess() {
+
     $values = $this->exportValues();
     
     parent::postProcess();
index 9d25e166b1b88606b86c5d5c61b25e0453e5ce20..32517c83e462e447ee87128534dbaa7589a78fd7 100644 (file)
@@ -1,71 +1,49 @@
 // Updated to wait until the document is loaded. addmore_link
 
-jQuery(document).ready(function () {
-//  var text = jQuery('h1').text();
-//  alert(text);
-
-});
-
 cj(function ( $ ) { 
 
-//  var text = jQuery('h1').text();
-//  alert(text);
-
-      $('#addmore_link').on('click', function( e ) {
-        e.preventDefault();
-//      $('#addmore_link').click(function () {
-      var count = parseInt($('input[name=contrib_count]').val());
-      count++;
-            
-      //$('#myDiv').append('<input type="text" id="p_scnt" size="20" name="p_scnt_' + count +'" value="" placeholder="Input Value" /><br>'); 
-
-      //$('#myDiv').append('<select id=\"selectId\" name=\"selectName\" />');
-//      $('select[name=contribution_page_1]').parent('div').append('<select name="selectName" />');
-//      var contr_name = "contribution_page_" + count.toString();
-      //$('input[name=percentage_1]').parent('div').parent('div').parent('div').append('<label>Contribution page</label>');
-//      $('#crm-container').append('<label>Contribution page</label>');
-      
-      var c_page = $('select[name=contribution_page_1]').clone().attr('id', 'choices_' + $(this).index());
-      c_page.attr("id", "contribution_page_" + count);
-      c_page.attr("name", "contribution_page_" + count);    
-      //.insertAfter("select[name=contribution_page_1]");
+    $('#addmore_link').on('click', function( e ) {
+    e.preventDefault();
+    var count = parseInt($('input[name=contrib_count]').val());
+    count++;
+
+    var c_page_sel = $('select[name=contribution_page_1]').clone().attr('id', 'choices_' + $(this).index());
+    c_page_sel.attr("id", "contribution_page_" + count);
+    c_page_sel.attr("name", "contribution_page_" + count);
+
+    var id_section = "crm-section-con-" + count;
+    var sect_tag = "<div class=\"crm-section\" id=" + id_section + "> <div class=\"label\"><label>Contribution Page</label>";
+    $('#addmore_link').parent().parent().before(sect_tag);
+
+    var id_content = "content_con-" + count;
+    $('#' + id_section).append("<div class=\"content\" id="+ id_content + ">");
+    $('#' + id_content).append(c_page_sel);
+    $('#' + id_content).append('<a id=\"remove_link\" class=\"form-link\" href=\"remove\" name=\"remove_link-' + count + '\"> Remove</a>');
+    $('#' + id_section).append("</div");
+
+    id_section = "crm-section-per-" + count;
+    sect_tag = "<div class=\"crm-section\" id=" + id_section + "> <div class=\"label\"><label>Percentage</label>";
+    $('#addmore_link').parent().parent().before(sect_tag);
+
+    id_content = "content_per-" + count;
+    $('#' + id_section).append("<div class=\"content\" id="+ id_content + ">");
+    $('#' + id_content).append('<input type="text" size="20" name="percentage_' + count +'" value="" />');
+    $('#' + id_section).append("</div");
+    
+    $('input[name=contrib_count]').val(count);
+});
 
+  $('#remove_link').live('click', function( e ) {
+    e.preventDefault();
+    
+    var rem_name = e.target.name;
+    //assuming that - is the delimiter. second string will be the count
+    var rem_name_ar = rem_name.split('-');
+    var contri_page = "\"#percentage_" + rem_name_ar[1] + "\"";
 
-      $('input[name=percentage_1]').parent().parent().append("<br>")
-      $('input[name=percentage_1]').parent().parent().append(c_page);
-//      $('input[name=percentage_1]').parent('div').append('<br><select name="contribution_page_' + count +'" />');
+    $('#crm-section-con-'+ rem_name_ar[1] +'').remove();
+    $('#crm-section-per-'+ rem_name_ar[1] +'').remove();
 
-      $('input[name=percentage_1]').parent().parent().append('<br><input type="text" size="20" name="percentage_' + count +'" value="" />');
-//      $('input[name=contribution_page_' + count + ']').text($('input[name=contribution_page_1]').text());
-      
-      $('input[name=percentage_1]').parent().parent().append('<a id="#remove_link" href="test" > Remove</a>');
-      
-      $('input[name=contrib_count]').val(count);
-      alert(count);
-      //alert(contr_sel);
-      //alert($('input[name=contrib_count]').val());
-      //alert($('select[name=contribution_page]').val());
-      //alert($("select[name=contribution_page] option:selected").text());
-      //alert($("#count").val());
-      //$('select[name=contribution_page]').
-      
-      
   });
-
-  $('#remove_link').on('click', function( e ) {
-    e.preventDefault();
-    alert("hi");
-  })
-/*  
-  $(function() {
-        var scntDiv = $('#p_scents');
-        var i = $('#p_scents p').size() + 1;
-        
-        $('#addmore_link').live('click', function() {
-                $('<p><label for="p_scnts"><input type="text" id="p_scnt" size="20" name="p_scnt_' + i +'" value="" placeholder="Input Value" /></label> <a href="#" id="remScnt">Remove</a></p>').appendTo(scntDiv);
-                i++;
-                return false;
-      });  
-  */
-  
 });
index 17361dbae827b9b6b29360152104fff8b9694bd3..86eba525dde4f42f609b81caa4d88ddc8318a6d2 100644 (file)
@@ -169,7 +169,7 @@ function _wci_civix_civicrm_managed(&$entities) {
     $es = include $file;
     foreach ($es as $e) {
       if (empty($e['module'])) {
-        $e['module'] = 'civicrm-wci';
+        $e['module'] = 'org.civicrm.wci';
       }
       $entities[] = $e;
     }
@@ -198,7 +198,7 @@ function _wci_civix_civicrm_caseTypes(&$caseTypes) {
       // throw new CRM_Core_Exception($errorMessage);
     }
     $caseTypes[$name] = array(
-      'module' => 'civicrm-wci',
+      'module' => 'org.civicrm.wci',
       'name' => $name,
       'file' => $file,
     );
diff --git a/wci.php b/wci.php
index 18d6a6ed34c84f6c7503a8f11e963873205801bd..3bb9596ab3a65c543f8186d25e5c2f04ff58b287 100644 (file)
--- a/wci.php
+++ b/wci.php
@@ -179,3 +179,5 @@ function wci_civicrm_navigationMenu( &$params ) {
               )
   );
 }
+
+
index e1c7def6d9d6e29cce319acd4d55c0a15ac87565..a3c9a8c5841e831f47270094425d4fda8cb0bf33 100644 (file)
@@ -6,4 +6,10 @@
     <title>Create Widget</title>
     <access_arguments>access CiviCRM</access_arguments>
   </item>
+  <item>
+    <path>civicrm/wci/progress-bar/add</path>
+    <page_callback>CRM_Wci_Form_ProgressBar</page_callback>
+    <title>ProgressBar</title>
+    <access_arguments>access CiviCRM</access_arguments>
+  </item>
 </menu>