$pager = new CRM_Utils_Pager($params);
$this->assign_by_ref('pager', $pager);
+ $this->ajaxResponse['totalRows'] = $this->_rowsFound;
}
}
<td>
{$form.logging.html}<br />
{if $validTriggerPermission}
- <p class="description">{ts}If enabled, all actions performed on non-cache tables will be logged (in the respective log_* tables).{/ts}</p>
- <div class="status message">{ts}Logging functionality is currently in beta. Please test this feature on a copy of your database prior to using it on a production site.{/ts}</div>
+ <p class="description">{ts}If enabled, all actions will be logged with a complete record of changes.{/ts}</p>
{else}
<p class="description">{ts}In order to use this functionality, the installation's database user must have privileges to create triggers (in MySQL 5.0 – and in MySQL 5.1 if binary logging is enabled – this means the SUPER privilege). This install either does not seem to have the required privilege enabled.{/ts} {ts}This functionality cannot be enabled on multilingual installations.{/ts}</p>
{/if}
<div class="bold">{ts}Change Log:{/ts} {$displayName}</div>
{if $useLogging}
<br />
- <div id='instance_data'><div class="crm-loading-element"></div></div>
+ <div class='instance_data'><div class="crm-loading-element"></div></div>
{else}
<div class="form-item">
{if $logCount > 0 }
{if $useLogging}
{literal}
<script type="text/javascript">
- CRM.reloadChangeLogTab = function() {
- cj('#changeLog #instance_data').load({/literal}"{$instanceUrl}"{literal});
- };
- cj(function () {
- CRM.reloadChangeLogTab();
+ cj(function ($) {
+ $('#changeLog .instance_data').on('crmLoad', function(e, data) {
+ CRM.tabHeader.updateCount('#tab_log', data.totalRows);
+ });
+ CRM.reloadChangeLogTab = function(url) {
+ if (url) {
+ $('#changeLog .instance_data').crmSnippet({url: url});
+ }
+ $('#changeLog .instance_data').crmSnippet('refresh');
+ };
+ CRM.reloadChangeLogTab({/literal}"{$instanceUrl}"{literal});
- cj('#changeLog').on('click', '.report-pager .crm-pager-nav a', function(e) {
- cj('#changeLog #instance_data').block().load(this.href + '&snippet=4§ion=2');
+ $('#changeLog').on('click', '.report-pager .crm-pager-nav a', function(e) {
+ CRM.reloadChangeLogTab(this.href + '§ion=2');
return false;
});
- cj('#changeLog').on('click', 'input[name="PagerBottomButton"], input[name="PagerTopButton"]', function(e) {
- var url = cj('#changeLog #instance_data .report-pager .crm-pager-nav a:first').attr('href') + '&snippet=4§ion=2';
- cj('#changeLog #instance_data').block().load(url + '&crmPID=' + cj(this).siblings('input[type=text]').val());
+ $('#changeLog').on('click', 'input[name="PagerBottomButton"], input[name="PagerTopButton"]', function(e) {
+ var url = $('#changeLog .instance_data .report-pager .crm-pager-nav a:first').attr('href') + '§ion=2';
+ CRM.reloadChangeLogTab(url + '&crmPID=' + $(this).siblings('input[type=text]').val());
return false;
});
});
CRM.tabHeader.updateCount('#tab_log', response.changeLog.count);
}
$("#crm-record-log").replaceWith(response.changeLog.markup);
- // Refresh tab contents - Advanced logging
- if (CRM.reloadChangeLogTab) {
- CRM.reloadChangeLogTab();
- }
- // Refresh tab contents - Simple logging
- else if ($('#changeLog').closest('.ui-tabs-panel').data('civiCrmSnippet')) {
+ // Refresh tab contents - Simple
+ if (!CRM.reloadChangeLogTab && $('#changeLog').closest('.ui-tabs-panel').data('civiCrmSnippet')) {
$('#changeLog').closest('.ui-tabs-panel').crmSnippet('destroy');
}
}
});
return false;
});
- // Actions menu
- $(document).on('click', function(e) {
- if ($(e.target).is('#crm-contact-actions-link, #crm-contact-actions-link *')) {
- $('#crm-contact-actions-list').show();
- return false;
- }
- $('#crm-contact-actions-list').hide();
- });
+ $(document)
+ // Actions menu
+ .on('click', function(e) {
+ if ($(e.target).is('#crm-contact-actions-link, #crm-contact-actions-link *')) {
+ $('#crm-contact-actions-list').show();
+ return false;
+ }
+ $('#crm-contact-actions-list').hide();
+ })
+ .on('crmFormSuccess', function(e) {
+ CRM.reloadChangeLogTab && CRM.reloadChangeLogTab();
+ });
$().crmAccordions();
});
})(cj);
<div class="crm-block crm-content-block crm-contact-page crm-inline-edit-container">
<div id="mainTabContainer">
<ul class="crm-contact-tabs-list">
- <li id="tab_summary" class="crm-tab-button">
+ <li id="tab_summary" class="crm-tab-button ui-corner-all">
<a href="#contact-summary" title="{ts}Summary{/ts}">
<span> </span> {ts}Summary{/ts}
- <em> </em>
+ <em></em>
</a>
</li>
{foreach from=$allTabs key=tabName item=tabValue}
});
// showing count of tags in summary tab
CRM.tabHeader && CRM.tabHeader.updateCount('#tab_tag', tags.length);
+ CRM.reloadChangeLogTab && CRM.reloadChangeLogTab();
// update summary tab
$("#tags").html(tags.join(', '));
};
// Utility functions
CRM.tabHeader = CRM.tabHeader || {};
CRM.tabHeader.updateCount = function(tab, count) {
+ var oldClass = $(tab).attr('class').match(/(crm-count-\d+)/);
+ if (oldClass) {
+ $(tab).removeClass(oldClass[0]);
+ }
$(tab)
- .removeClass($(tab).attr('class').match(/(crm-count-\d+)/)[0] || 'null')
.addClass('crm-count-' + count)
.find('a em').html('' + count);
}