*}
<div id="recurring-dialog" class="hide-block">
- {ts}How would you like this change to affect other events in the repetition set?{/ts}<br/><br/>
+ {ts}How would you like this change to affect other {$entityType}s 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 Event{/ts}</button>
+ <button class="recurring-dialog-button only-this-event">{ts}Only this {$entityType}{/ts}</button>
</div>
- <div class="recurring-dialog-inner-right">{ts}All other events in the series will remain same.{/ts}</div>
+ <div class="recurring-dialog-inner-right">{ts}All other {$entityType}s 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 Events{/ts}</button>
+ <button class="recurring-dialog-button this-and-all-following-event">{ts}This and Following {$entityType}s{/ts}</button>
</div>
- <div class="recurring-dialog-inner-right">{ts}Change applies to this and all the following events.{/ts}</div>
+ <div class="recurring-dialog-inner-right">{ts}Change applies to this and all the following {$entityType}s.{/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 Events{/ts}</button>
+ <button class="recurring-dialog-button all-events">{ts}All the {$entityType}s{/ts}</button>
</div>
- <div class="recurring-dialog-inner-right">{ts}Change applies to all the events in the series.{/ts}</div>
+ <div class="recurring-dialog-inner-right">{ts}Change applies to all the {$entityType}s in the series.{/ts}</div>
</div>
</div>
</div>
<input type="hidden" value="" name="isRepeatingEvent" id="is-repeating-event"/>
-{if $isRepeat eq 'repeat'}
{literal}
-<script>
- CRM.$(function($) {
- //Tab and table mapper
- 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'
- };
-
- var form = '';
- $('#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: 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 type="text/javascript">
+ CRM.$(function($) {
+ var form = '';
+ form = $(this).parents('form:first').attr('class');
+
+ $(".only-this-event").click(function() {
+ updateMode(1);
+ });
- $(".only-this-event").click(function() {
- updateMode(1);
- });
-
- cj(".this-and-all-following-event").click(function() {
- updateMode(2);
- });
-
- cj(".all-events").click(function() {
- updateMode(3);
- });
-
- function updateMode(mode) {
- var eventID = {/literal}{$id}{literal};
- if (eventID != "" && mode && form != "") {
- var ajaxurl = CRM.url("civicrm/ajax/recurringentity/update-mode");
- var data = {mode: mode, entityId: eventID, entityTable:'civicrm_event', linkedEntityTable:mapper[form]};
- $.ajax({
- dataType: "json",
- data: data,
- url: ajaxurl,
- success: function (result) {
- if (result.status != "" && result.status == 'Done') {
- $("#recurring-dialog").dialog('close');
- $('#mainTabContainer div:visible 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) {
+ $(".this-and-all-following-event").click(function() {
+ updateMode(2);
+ });
+
+ $(".all-events").click(function() {
+ updateMode(3);
+ });
+
+ 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 !="") {
+ var ajaxurl = CRM.url("civicrm/ajax/recurringentity/update-mode");
+ var data = {mode: mode, entityId: entityID, entityTable: entityTable, linkedEntityTable:'{/literal}$mapper['{literal}+form+{/literal}']{literal}'};
+ $.ajax({
+ dataType: "json",
+ data: data,
+ url: ajaxurl,
+ success: function (result) {
+ if (result.status != "" && result.status == 'Done') {
$("#recurring-dialog").dialog('close');
$('#mainTabContainer div:visible Form').submit();
- } else {
- $("#recurring-dialog").dialog('close');
- return false;
+ } 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();
+ } else {
+ $("#recurring-dialog").dialog('close');
+ return false;
+ }
}
}
- }
- });
- }
- }
- });
-</script>
-{/literal}
-{/if}
+ });
+ }
+ }
+ });
+ </script>
+ {/literal}
\ No newline at end of file