towards dialog and propagation dialog and code
authorunknown <priyanka.karan26@gmail.com>
Fri, 10 Oct 2014 13:43:39 +0000 (14:43 +0100)
committerunknown <priyanka.karan26@gmail.com>
Fri, 10 Oct 2014 13:43:39 +0000 (14:43 +0100)
CRM/Activity/Form/Activity.php
templates/CRM/Activity/Form/Activity.tpl
templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl
templates/CRM/Event/Form/ManageEvent/Tab.tpl

index 4d3b90c42548df10d5f2c15cf382bcb619a90f63..5935166d9beafe0c9edb331f26f5f3d49e8d1a24 100644 (file)
@@ -505,8 +505,6 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
     }
     
     if ($this->_action & CRM_Core_Action::UPDATE) {
-      $mapper = array('CRM_Activity_Form_Activity' => '');
-      $this->assign('mapper', json_encode($mapper));
       CRM_Core_Form_RecurringEntity::preProcess('activity');
     }
   }
index bfcb5eb37df222dc86bc1715544a537696600a41..20b712d3350ff9792f5f3452d830a3d0598542da 100644 (file)
   {/if}
   </div>{* end of form block*}
 {/if} {* end of snippet if*}
-{literal}
-<script type="text/javascript">
-  CRM.$(function($) {
-    var mapper = {'CRM_Activity_Form_Activity': ''};
-    var form = '';
-    $('#_qf_Activity_upload-top, #_qf_Activity_upload-bottom').click( function () {      
-        form = $(this).parents('form:first').attr('class');
-        if (form != "" && mapper.hasOwnProperty(form)) {
-          $("#recurring-dialog").dialog({
-            title: ts('How does this change affect other repeating events in the set?'),
-            modal: true,
-            width: '650',
-            buttons: {
-              Cancel: function() { //cancel
-                $( this ).dialog( "close" );
-              }
-            }
-          }).dialog('open');
-          return false;
-        }
-    }); 
-  });
-</script>
-{/literal}
-{foreach from=$mapper key=k item=item}
-  {$k} {$item}
-{/foreach}
-{include file="CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl" entityType="activity" entityID=$activityId entityTable="civicrm_activity" mapper=$mapper}
\ No newline at end of file
+{include file="CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl" entityID=$activityId entityTable="civicrm_activity"}
\ No newline at end of file
index 7a9955b7858b861c4cbf0ccea27b6d4a8ec41bc0..67ff59d8db234e0d3403a70d132eb7905b5edc3c 100644 (file)
 *}
 
 <div id="recurring-dialog" class="hide-block">
-    {ts}How would you like this change to affect other {$entityType}s in the repetition set?{/ts}<br/><br/>
+    {ts}How would you like this change to affect other entities in the repetition set?{/ts}<br/><br/>
     <div class="show-block">
         <div class="recurring-dialog-inner-wrapper">
             <div class="recurring-dialog-inner-left">
-                <button class="recurring-dialog-button only-this-event">{ts}Only this {$entityType}{/ts}</button>
+                <button class="recurring-dialog-button only-this-event">{ts}Only this entity{/ts}</button>
             </div>
-          <div class="recurring-dialog-inner-right">{ts}All other {$entityType}s in the series will remain same.{/ts}</div>
+          <div class="recurring-dialog-inner-right">{ts}All other entities in the series will remain same.{/ts}</div>
         </div>
         <div class="recurring-dialog-inner-wrapper">
             <div class="recurring-dialog-inner-left">
-                <button class="recurring-dialog-button this-and-all-following-event">{ts}This and Following {$entityType}s{/ts}</button>
+                <button class="recurring-dialog-button this-and-all-following-event">{ts}This and Following entities{/ts}</button>
             </div>
-            <div class="recurring-dialog-inner-right">{ts}Change applies to this and all the following {$entityType}s.{/ts}</div>
+            <div class="recurring-dialog-inner-right">{ts}Change applies to this and all the following entities.{/ts}</div>
         </div>
         <div class="recurring-dialog-inner-wrapper">
             <div class="recurring-dialog-inner-left">
-                <button class="recurring-dialog-button all-events">{ts}All the {$entityType}s{/ts}</button>
+                <button class="recurring-dialog-button all-events">{ts}All the entities{/ts}</button>
             </div>
-            <div class="recurring-dialog-inner-right">{ts}Change applies to all the {$entityType}s in the series.{/ts}</div>
+            <div class="recurring-dialog-inner-right">{ts}Change applies to all the entities in the series.{/ts}</div>
         </div>
     </div>
 </div>
-<input type="hidden" value="" name="isRepeatingEvent" id="is-repeating-event"/>
 {literal}
   <script type="text/javascript">
     CRM.$(function($) {  
+      /** Add your linked entity mapper here **/
+      var mapper = {'CRM_Event_Form_ManageEvent_EventInfo': '',
+                'CRM_Event_Form_ManageEvent_Location': '',
+                'CRM_Event_Form_ManageEvent_Fee': '',
+                'CRM_Event_Form_ManageEvent_Registration': '',
+                'CRM_Friend_Form_Event': 'civicrm_tell_friend',
+                'CRM_PCP_Form_Event': 'civicrm_pcp_block',
+                'CRM_Activity_Form_Activity': ''
+                };
       var form = '';
-      form = $(this).parents('form:first').attr('class');
+      $('#crm-main-content-wrapper').on('click', 'div.crm-submit-buttons span.crm-button input[value="Save"], div.crm-submit-buttons span.crm-button input[value="Save and Done"]', function() {
+          form = $(this).parents('form:first').attr('class');
+          if( form != "" && mapper.hasOwnProperty(form) ){
+            $("#recurring-dialog").dialog({
+              title: 'How does this change affect other repeating entities in the set?',
+              modal: true,
+              width: '650',
+              buttons: {
+                Cancel: function() { //cancel
+                  $( this ).dialog( "close" );
+                }
+              }
+            }).dialog('open');
+            return false;
+          }
+      }); 
+
+      
+      $("#_qf_Activity_upload-top, #_qf_Activity_upload-bottom").click(function() {
+          form = $(this).parents('form:first').attr('class');
+          if( form != "" && mapper.hasOwnProperty(form) ){
+            $("#recurring-dialog").dialog({
+              title: 'How does this change affect other repeating entities in the set?',
+              modal: true,
+              width: '650',
+              buttons: {
+                Cancel: function() { //cancel
+                  $( this ).dialog( "close" );
+                }
+              }
+            }).dialog('open');
+            return false;
+          }
+      });
       
       $(".only-this-event").click(function() {
         updateMode(1);
       function updateMode(mode) {
         var entityID = parseInt('{/literal}{$entityID}{literal}');
         var entityTable = '{/literal}{$entityTable}{literal}';
-        var testmapper = '{/literal}$mapper['{literal}+form+{/literal}']{literal}';
-        alert(testmapper);
-        if (entityID != "" && mode && form != "" && entityTable !="") {
+        if (entityID != "" && mode && mapper.hasOwnProperty(form) && entityTable !="") {
           var ajaxurl = CRM.url("civicrm/ajax/recurringentity/update-mode");
-          var data    = {mode: mode, entityId: entityID, entityTable: entityTable, linkedEntityTable:'{/literal}$mapper['{literal}+form+{/literal}']{literal}'};
+          var data    = {mode: mode, entityId: entityID, entityTable: entityTable, linkedEntityTable: mapper[form]};
           $.ajax({
             dataType: "json",
             data: data,
             success: function (result) {
               if (result.status != "" && result.status == 'Done') {
                 $("#recurring-dialog").dialog('close');
-                $('#mainTabContainer div:visible Form').submit();
+                $('#mainTabContainer div:visible Form, form.'+form).submit();
               } else if (result.status != "" && result.status == 'Error') {
                 var errorBox = confirm(ts("Mode could not be updated, save only this event?"));
                 if (errorBox == true) {
                   $("#recurring-dialog").dialog('close');
-                  $('#mainTabContainer div:visible Form').submit();
+                  $('#mainTabContainer div:visible Form, form.'+form).submit();
                 } else {
                   $("#recurring-dialog").dialog('close');
                   return false;
index 36b790fbe73e9afa23f20d5fac6b1745e4652d84..1f1a1e08c7ae20a46bb160529992514d3075374d 100644 (file)
@@ -106,5 +106,4 @@ CRM.$(function($) {
 });
 </script>
 {/literal}
-
-{include file="CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl" entityType="event"}
+{include file="CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl" entityID=$id entityTable="civicrm_event"}