* @static
*/
function browse($action = NULL) {
+ CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js');
// Get list of configured reminders
$reminderList = CRM_Core_BAO_ActionSchedule::getList();
}
CRM_Core_Session::setStatus(ts("'%1' information has been saved.",
- array(1 => ($subPage == 'friend') ? 'Friend' : $className)
+ array(1 => CRM_Utils_Array::value('title', CRM_Utils_Array::value($subPage, $this->get('tabHeader')), $className))
), ts('Saved'), 'success');
$config = CRM_Core_Config::singleton();
$this->postProcessHook();
if ($this->controller->getButtonName('submit') == "_qf_{$className}_upload_done") {
if ($this->_isTemplate) {
- CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/eventTemplate',
- 'reset=1'
- ));
+ CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/admin/eventTemplate', 'reset=1'));
}
else {
- CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/event/manage',
- 'reset=1'
- ));
+ CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url('civicrm/event/manage', 'reset=1'));
}
}
else {
- CRM_Utils_System::redirect(CRM_Utils_System::url("civicrm/event/manage/{$subPage}",
+ CRM_Core_Session::singleton()->pushUserContext(CRM_Utils_System::url("civicrm/event/manage/{$subPage}",
"action=update&reset=1&id={$this->_id}"
));
}
$field = 'event_template';
}
$reminderList = CRM_Core_BAO_ActionSchedule::getList(FALSE, $field, $this->_id );
- if (is_array($reminderList)) {
+ if ($reminderList && is_array($reminderList)) {
// Add action links to each of the reminders
foreach ($reminderList as & $format) {
$action = CRM_Core_Action::UPDATE + CRM_Core_Action::DELETE;
$this->_id
);
}
- $this->assign('rows', $reminderList);
}
+ else {
+ $reminderList = TRUE;
+ }
+ $this->assign('rows', $reminderList);
}
}
return NULL;
}
+ $default = array(
+ 'link' => NULL,
+ 'valid' => TRUE,
+ 'active' => TRUE,
+ 'current' => FALSE,
+ 'class' => 'ajaxForm',
+ );
+
$tabs = array(
- 'settings' => array('title' => ts('Info and Settings'),
- 'link' => NULL,
- 'valid' => TRUE,
- 'active' => TRUE,
- 'current' => FALSE,
- ),
- 'location' => array('title' => ts('Event Location'),
- 'link' => NULL,
- 'valid' => TRUE,
- 'active' => TRUE,
- 'current' => FALSE,
- ),
- 'fee' => array('title' => ts('Fees'),
- 'link' => NULL,
- 'valid' => TRUE,
- 'active' => TRUE,
- 'current' => FALSE,
- ),
- 'registration' => array('title' => ts('Online Registration'),
- 'link' => NULL,
- 'valid' => TRUE,
- 'active' => TRUE,
- 'current' => FALSE,
- ),
- 'reminder' => array('title' => ts('Schedule Reminders'),
- 'link' => NULL,
- 'valid' => TRUE,
- 'active' => TRUE,
- 'current' => FALSE,
- ),
- 'conference' => array('title' => ts('Conference Slots'),
- 'link' => NULL,
- 'valid' => TRUE,
- 'active' => TRUE,
- 'current' => FALSE,
- ),
- 'friend' => array('title' => ts('Tell a Friend'),
- 'link' => NULL,
- 'valid' => TRUE,
- 'active' => TRUE,
- 'current' => FALSE,
- ),
- 'pcp' => array('title' => ts('Personal Campaigns'),
- 'link' => NULL,
- 'valid' => TRUE,
- 'active' => TRUE,
- 'current' => FALSE,
- )
+ 'settings' => array('title' => ts('Info and Settings')) + $default,
+ 'location' => array('title' => ts('Event Location')) + $default,
+ 'fee' => array('title' => ts('Fees')) + $default,
+ 'registration' => array('title' => ts('Online Registration')) + $default,
+ 'reminder' => array('title' => ts('Schedule Reminders'), 'class' => 'livePage') + $default,
+ 'conference' => array('title' => ts('Conference Slots')) + $default,
+ 'friend' => array('title' => ts('Tell a Friend')) + $default,
+ 'pcp' => array('title' => ts('Personal Campaigns')) + $default,
);
// check if we're in shopping cart mode for events
}).fail(function() {
that._onFailure();
});
+ },
+ _destroy: function() {
+ this.element.removeClass('crm-ajax-container');
}
});
// Widgetize the content area
.crmSnippet()
// Open action links in a popup
- .on('click', 'a.button, a.action-item', function() {
+ .off('click.crmLivePage')
+ .on('click.crmLivePage', 'a.button, a.action-item', function() {
// only follow real links not javascript buttons
if ($(this).attr('href') === '#' || $(this).attr('onclick')) {
return;
{include file="CRM/Contact/Form/Task/EmailCommon.tpl" upload=1 noAttach=1}
</fieldset>
-{/if}
-
-<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
-</div>
-
{include file="CRM/common/showHideByFieldValue.tpl"
trigger_field_id = "is_repeat"
trigger_value = "true"
</script>
{/literal}
+
+{/if}
+
+ <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
+</div>
*}
{* this template is for configuring Scheduled Reminders Table*}
{strip}
- {include file="CRM/common/enableDisableApi.tpl"}
- {include file="CRM/common/crmeditable.tpl"}
- {include file="CRM/common/jsortable.tpl"}
+ {if $rows and is_array($rows)}
+ {include file="CRM/common/enableDisableApi.tpl"}
+ {include file="CRM/common/crmeditable.tpl"}
+ {include file="CRM/common/jsortable.tpl"}
+ {/if}
<table id="scheduleReminders" class="display">
<thead>
<tr id="options" class="columnheader">
<th ></th>
</tr>
</thead>
- {foreach from=$rows item=row}
- <tr id="action_schedule-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"} {$row.class}{if NOT $row.is_active} disabled{/if}">
- <td class="crm-scheduleReminders-title crm-editable" data-field="title">{$row.title}</td>
- <td class="crm-scheduleReminders-value">{$row.entity} - {$row.value}</td>
- <td class="crm-scheduleReminders-description">{if $row.absolute_date}{$row.absolute_date|crmDate}{else}{$row.start_action_offset} {$row.start_action_unit}{if $row.start_action_offset > 1}{ts}(s){/ts}{/if} {$row.start_action_condition} {$row.entityDate}{/if}</td>
- <td class="crm-scheduleReminders-title">{$row.status}</td>
- <td class="crm-scheduleReminders-is_repeat">{if $row.is_repeat eq 1}{ts}Yes{/ts}{else}{ts}No{/ts}{/if} </td>
- <td id="row_{$row.id}_status" class="crm-scheduleReminders-is_active">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
- <td>{$row.action|replace:'xx':$row.id}</td>
- <td class="hiddenElement"></td>
- </tr>
- {/foreach}
+ {if $rows and is_array($rows)}
+ {foreach from=$rows item=row}
+ <tr id="action_schedule-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"} {$row.class}{if NOT $row.is_active} disabled{/if}">
+ <td class="crm-scheduleReminders-title crm-editable" data-field="title">{$row.title}</td>
+ <td class="crm-scheduleReminders-value">{$row.entity} - {$row.value}</td>
+ <td class="crm-scheduleReminders-description">{if $row.absolute_date}{$row.absolute_date|crmDate}{else}{$row.start_action_offset} {$row.start_action_unit}{if $row.start_action_offset > 1}{ts}(s){/ts}{/if} {$row.start_action_condition} {$row.entityDate}{/if}</td>
+ <td class="crm-scheduleReminders-title">{$row.status}</td>
+ <td class="crm-scheduleReminders-is_repeat">{if $row.is_repeat eq 1}{ts}Yes{/ts}{else}{ts}No{/ts}{/if} </td>
+ <td id="row_{$row.id}_status" class="crm-scheduleReminders-is_active">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
+ <td>{$row.action|replace:'xx':$row.id}</td>
+ <td class="hiddenElement"></td>
+ </tr>
+ {/foreach}
+ {else}
+ <tr><td colspan="8">{ts}No Scheduled Reminders have been created.{/ts}</td></tr>
+ {/if}
</table>
{/strip}
{if $action eq 1 or $action eq 2 or $action eq 8 or $action eq 16384}
{include file="CRM/Admin/Form/ScheduleReminders.tpl"}
{else}
+{* include wysiwyg related files*}
+{include file="CRM/common/wysiwyg.tpl" includeWysiwygEditor=true}
{capture assign=schedRemindersDocLink}{docURL page="user/current/email/scheduled-reminders/"}{/capture}
<div class="help">
{ts}Scheduled reminders allow you to automatically send messages to contacts regarding their memberships, participation in events, or other activities.{/ts} {$schedRemindersDocLink}
{else}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>
- {capture assign=crmURL}{crmURL p='civicrm/admin/scheduleReminders' q="action=add&reset=1"}{/capture}
- {ts 1=$crmURL}There are no Scheduled Reminders configured. You can <a href='%1'>add one</a>.{/ts}
+ {capture assign=crmURL}href="{crmURL p='civicrm/admin/scheduleReminders' q="action=add&reset=1"}" class="action-item"{/capture}
+ {ts 1=$crmURL}There are no Scheduled Reminders configured. You can <a %1>add one</a>.{/ts}
</div>
{/if}
{/if}
CRM.reloadChangeLogTab();
}
// Refresh tab contents - Simple logging
- else if ($('#Change_Log div').length) {
- $('#Change_Log').load($("#tab_log a").attr('href'));
+ else if ($('#changeLog').closest('.ui-tabs-panel').data('civicrmCrmSnippet')) {
+ $('#changeLog').closest('.ui-tabs-panel').crmSnippet('destroy');
}
}
else {
</a>
</li>
{foreach from=$allTabs key=tabName item=tabValue}
- <li id="tab_{$tabValue.id}" class="crm-tab-button crm-count-{$tabValue.count}{if isset($tabValue.class)} {$tabValue.class}{/if}">
+ <li id="tab_{$tabValue.id}" class="crm-tab-button ui-corner-all crm-count-{$tabValue.count}{if isset($tabValue.class)} {$tabValue.class}{/if}">
<a href="{$tabValue.url}" title="{$tabValue.title}">
<span> </span> {$tabValue.title}
<em>{$tabValue.count}</em>
</table>
{include file="CRM/Contact/Form/Task/EmailCommon.tpl" upload=1 noAttach=1}
</fieldset>
- {/if}
- <div class="crm-submit-buttons">
- {include file="CRM/common/formButtons.tpl" location="bottom"}</div>
-</div>
-{/if}
-{include file="CRM/common/showHideByFieldValue.tpl"
-trigger_field_id = "is_repeat"
-trigger_value = "true"
-target_element_id = "repeatFields"
-target_element_type = "table-row"
-field_type = "radio"
-invert = "false"
-}
-
-{include file="CRM/common/showHideByFieldValue.tpl"
-trigger_field_id ="recipient"
-trigger_value = 'manual'
-target_element_id ="recipientManual"
-target_element_type ="table-row"
-field_type ="select"
-invert = 0
-}
-
-{include file="CRM/common/showHideByFieldValue.tpl"
-trigger_field_id ="recipient"
-trigger_value = 'group'
-target_element_id ="recipientGroup"
-target_element_type ="table-row"
-field_type ="select"
-invert = 0
-}
-
-{literal}
-<script type='text/javascript'>
- cj(function() {
- populateRecipient();
- cj('#recipient').click( function( ) {
- populateRecipient();
- });
- });
-
- function populateRecipient( ) {
- var recipientMapping = eval({/literal}{$recipientMapping}{literal});
- var recipient = cj("#recipient option:selected").val();
- var postUrl = "{/literal}{crmURL p='civicrm/ajax/populateRecipient' h=0}{literal}";
- if(recipientMapping[recipient] == 'Participant Status' || recipientMapping[recipient] == 'participant_role'){
- var elementID = '#recipient_listing';
- cj( elementID ).html('');
- cj.post(postUrl, {recipient: recipientMapping[recipient]},
- function ( response ) {
- response = eval( response );
- for (iota = 0; iota < response.length; iota++) {
- cj( elementID ).get(0).add(new Option(response[iota].name, response[iota].value), document.all ? iota : null);
- }
- }
- );
- cj("#recipientList").show();
- } else {
- cj("#recipientList").hide();
+ {include file="CRM/common/showHideByFieldValue.tpl"
+ trigger_field_id = "is_repeat"
+ trigger_value = "true"
+ target_element_id = "repeatFields"
+ target_element_type = "table-row"
+ field_type = "radio"
+ invert = "false"
+ }
+
+ {include file="CRM/common/showHideByFieldValue.tpl"
+ trigger_field_id ="recipient"
+ trigger_value = 'manual'
+ target_element_id ="recipientManual"
+ target_element_type ="table-row"
+ field_type ="select"
+ invert = 0
}
- }
- cj('#absolute_date_display').click( function( ) {
- if(cj('#absolute_date_display').val()) {
- cj('#relativeDate').hide();
- cj('#relativeDateRepeat').hide();
- cj('#repeatFields').hide();
- } else {
- cj('#relativeDate').show();
- cj('#relativeDateRepeat').show();
+ {include file="CRM/common/showHideByFieldValue.tpl"
+ trigger_field_id ="recipient"
+ trigger_value = 'group'
+ target_element_id ="recipientGroup"
+ target_element_type ="table-row"
+ field_type ="select"
+ invert = 0
}
- });
-</script>
-{/literal}
+ {literal}
+ <script type='text/javascript'>
+ cj(function() {
+ populateRecipient();
+ cj('#recipient').click( function( ) {
+ populateRecipient();
+ });
+ });
+
+ function populateRecipient( ) {
+ var recipientMapping = eval({/literal}{$recipientMapping}{literal});
+ var recipient = cj("#recipient option:selected").val();
+ var postUrl = "{/literal}{crmURL p='civicrm/ajax/populateRecipient' h=0}{literal}";
+ if(recipientMapping[recipient] == 'Participant Status' || recipientMapping[recipient] == 'participant_role'){
+ var elementID = '#recipient_listing';
+ cj( elementID ).html('');
+ cj.post(postUrl, {recipient: recipientMapping[recipient]},
+ function ( response ) {
+ response = eval( response );
+ for (iota = 0; iota < response.length; iota++) {
+ cj( elementID ).get(0).add(new Option(response[iota].name, response[iota].value), document.all ? iota : null);
+ }
+ }
+ );
+ cj("#recipientList").show();
+ } else {
+ cj("#recipientList").hide();
+ }
+ }
+
+ cj('#absolute_date_display').click( function( ) {
+ if(cj('#absolute_date_display').val()) {
+ cj('#relativeDate').hide();
+ cj('#relativeDateRepeat').hide();
+ cj('#repeatFields').hide();
+ } else {
+ cj('#relativeDate').show();
+ cj('#relativeDateRepeat').show();
+ }
+ });
+ </script>
+ {/literal}
+ {/if}
+ <div class="crm-submit-buttons">
+ {include file="CRM/common/formButtons.tpl" location="bottom"}</div>
+</div>
+{/if}
// https://civicrm.org/licensing
+/**
+ * By default this simply loads tabs via ajax CRM.loadPage method
+ * Tabs with class 'ajaxForm' will use CRM.loadForm instead, suitable for most forms
+ * Tabs with class 'livePage' will get popup action links, suitable for crud tables
+ */
cj(function($) {
var tabSettings = CRM.tabSettings || {};
tabSettings.active = tabSettings.active ? $('#tab_' + tabSettings.active).prevAll().length : 0;
})
});
}
+ if (ui.tab.hasClass('livePage')) {
+ ui.panel
+ .off('click.crmLivePage')
+ .on('click.crmLivePage', 'a.button, a.action-item', function() {
+ // only follow real links not javascript buttons
+ if ($(this).attr('href') === '#' || $(this).attr('onclick')) {
+ return;
+ }
+ CRM.loadForm($(this).attr('href'), {
+ openInline: 'a:not([href="#"])'
+ }).on('crmFormSuccess', function(e, data) {
+ // Refresh when form completes
+ ui.panel.crmSnippet('refresh');
+ });
+ return false;
+ });
+ }
CRM[method]($('a', ui.tab).attr('href'), params);
}
e.preventDefault();