$controller->reset();
$controller->set('cid', $this->_contactId);
$controller->set('crid', $this->_crid);
- $controller->set('context', 'contribution');
+ $controller->set('context', 'Search');
$controller->process();
$controller->run();
}
$href = $this->makeURL(self::PAGE_ID, 1);
- return sprintf('<a href="%s" title="%s">%s</a>',
+ return sprintf('<a class="crm-pager-link" href="%s" title="%s">%s</a>',
$href,
str_replace('%d', 1, $this->_altFirst),
$this->_firstPagePre . $this->_firstPageText . $this->_firstPagePost
}
$href = $this->makeURL(self::PAGE_ID, $this->_totalPages);
- return sprintf('<a href="%s" title="%s">%s</a>',
+ return sprintf('<a class="crm-pager-link" href="%s" title="%s">%s</a>',
$href,
str_replace('%d', $this->_totalPages, $this->_altLast),
$this->_lastPagePre . $this->_lastPageText . $this->_lastPagePost
function getBackPageLink() {
if ($this->_currentPage > 1) {
$href = $this->makeURL(self::PAGE_ID, $this->getPreviousPageID());
- return sprintf('<a href="%s" title="%s">%s</a>',
+ return sprintf('<a class="crm-pager-link" href="%s" title="%s">%s</a>',
$href,
$this->_altPrev, $this->_prevImg
) . $this->_spacesBefore . $this->_spacesAfter;
function getNextPageLink() {
if ($this->_currentPage < $this->_totalPages) {
$href = $this->makeURL(self::PAGE_ID, $this->getNextPageID());
- return $this->_spacesAfter . sprintf('<a href="%s" title="%s">%s</a>',
+ return $this->_spacesAfter . sprintf('<a class="crm-pager-link" href="%s" title="%s">%s</a>',
$href,
$this->_altNext, $this->_nextImg
) . $this->_spacesBefore . $this->_spacesAfter;
$qs['force'] = 1;
}
- unset($qs['snippet']);
- unset($qs['section']);
+ // Ok this is a big assumption but usually works
+ // If we are in snippet mode, retain the 'section' param, if not, get rid of it.
+ if (!empty($qs['snippet'])) {
+ unset($qs['snippet']);
+ }
+ else {
+ unset($qs['section']);
+ }
if ($skipUFVar) {
$config = CRM_Core_Config::singleton();
var formName = "{/literal}{$form.formName}{literal}";
on_load_init_checkboxes(formName);
}
+ return false;
}
</script>
params.name = name;
}
cj.getJSON(url, params, countSelections);
+ return false;
}
{/literal}
</script>
$('#changeLog .instance_data').crmSnippet('refresh');
};
CRM.reloadChangeLogTab({/literal}"{$instanceUrl}"{literal});
-
- $('#changeLog').on('click', '.report-pager .crm-pager-nav a', function(e) {
- CRM.reloadChangeLogTab(this.href + '§ion=2');
- return false;
- });
-
- $('#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;
- });
});
</script>
{/if}
{if $rows}
<div class="report-pager">
- {include file="CRM/common/pager.tpl" location="top" noForm=0}
+ {include file="CRM/common/pager.tpl" location="top"}
</div>
{* pre-compile section header here, rather than doing it every time under foreach *}
{/foreach}
<div class="report-pager">
- {include file="CRM/common/pager.tpl" noForm=0}
+ {include file="CRM/common/pager.tpl"}
</div>
<br />
{if $grandStat}
{if $events}
<div class="report-pager">
- {include file="CRM/common/pager.tpl" location="top" noForm=0}
+ {include file="CRM/common/pager.tpl" location="top"}
</div>
{foreach from=$events item=eventID}
<table class="report-layout">
{/foreach}
<div class="report-pager">
- {include file="CRM/common/pager.tpl" noForm=0}
+ {include file="CRM/common/pager.tpl"}
</div>
{if !$section }
{*Statistics at the bottom of the page*}
{if (!$chartEnabled || !$chartSupported )&& $rows}
{if $pager and $pager->_response and $pager->_response.numPages > 1}
<div class="report-pager">
- {include file="CRM/common/pager.tpl" location="top" noForm=0}
+ {include file="CRM/common/pager.tpl" location="top"}
</div>
{/if}
<div class="crm-report-overlay form-layout-compressed">
</div>
{if $pager and $pager->_response and $pager->_response.numPages > 1}
<div class="report-pager">
- {include file="CRM/common/pager.tpl" noForm=0}
+ {include file="CRM/common/pager.tpl" }
</div>
{/if}
{/if}
{if (!$chartEnabled || !$chartSupported )&& $rows}
{if $pager and $pager->_response and $pager->_response.numPages > 1}
<div class="report-pager">
- {include file="CRM/common/pager.tpl" location="top" noForm=0}
+ {include file="CRM/common/pager.tpl" location="top"}
</div>
{/if}
<table class="report-layout display">
</table>
{if $pager and $pager->_response and $pager->_response.numPages > 1}
<div class="report-pager">
- {include file="CRM/common/pager.tpl" noForm=0}
+ {include file="CRM/common/pager.tpl" }
</div>
{/if}
{/if}
{if $pager and $pager->_response}
{if $pager->_response.numPages > 1}
<div class="crm-pager">
- {if empty($noForm)}
<span class="element-right">
{if $location eq 'top'}
- {$pager->_response.titleTop} <input class="form-submit" name="{$pager->_response.buttonTop}" value="{ts}Go{/ts}" type="submit"/>
+ {$pager->_response.titleTop}
{else}
- {$pager->_response.titleBottom} <input class="form-submit" name="{$pager->_response.buttonBottom}" value="{ts}Go{/ts}" type="submit"/>
+ {$pager->_response.titleBottom}
{/if}
</span>
- {/if}
+ </span>
<span class="crm-pager-nav">
{$pager->_response.first}
{$pager->_response.back}
</span>
</div>
- {if empty($noForm) and $location neq 'top'}
- <script type="text/javascript">
- cj('input[name^=crmPID]', '#{$form.formName}').spinner({ldelim}
- min: 1,
- max: {$pager->_response.numPages}
- {rdelim});
- </script>
- {/if}
{/if}
{* Controller for 'Rows Per Page' *}
<div class="clear"></div>
{/if}
+ {if $location neq 'top'}
+ <script type="text/javascript">
+ {literal}
+ cj(function($) {
+ {/literal}
+ var $form = $('#{$form.formName}');
+ var numPages = {$pager->_response.numPages};
+ var currentPage = {$pager->_response.currentPage};
+ {literal}
+ function refresh(url) {
+ var options = url ? {url: url} : {};
+ $form.closest('.crm-ajax-container, #crm-main-content-wrapper').crmSnippet(options).crmSnippet('refresh');
+ }
+ function page(num) {
+ num = parseInt(num, 10);
+ if (isNaN(num) || num < 1 || num > numPages || num === currentPage) {
+ return;
+ }
+ var url = $('a.crm-pager-link', $form).attr('href');
+ refresh(url.replace(/crmPID=\d/, 'crmPID=' + num));
+ }
+ $('input[name^=crmPID]', $form).spinner({
+ min: 1,
+ max: numPages
+ })
+ .on('change', function() {
+ page($(this).spinner('value'));
+ });
+ $form
+ .on('click', 'a.ui-spinner-button', function(e) {
+ page($(this).siblings('input[name^=crmPID]').spinner('value'));
+ })
+ .on('click', 'a.crm-pager-link, #alpha-filter a', function() {
+ refresh($(this).attr('href'));
+ return false;
+ });
+ });
+ {/literal}
+ </script>
+ {/if}
+
{/if}