2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
26 {* Advanced Search Criteria Fieldset *}
28 <script type="text/javascript">
30 // Bind first click of accordion header to load crm-accordion-body with snippet
31 // everything else is taken care of by crmAccordions()
32 $('.crm-search_criteria_basic-accordion .crm-accordion-header').addClass('active');
33 $('.crm-ajax-accordion').on('click', '.crm-accordion-header:not(.active)', function() {
34 loadPanes($(this).attr('id'));
36 $('.crm-ajax-accordion:not(.collapsed) .crm-accordion-header').each(function() {
37 loadPanes($(this).attr('id'));
39 $('.crm-ajax-accordion').on('click', '.crm-close-accordion', function() {
40 var header = $(this).parent();
41 header.next().html('');
42 header.removeClass('active');
43 header.parent('.crm-ajax-accordion:not(.collapsed)').crmAccordionToggle();
44 // Reset results-display mode if it depends on this pane
45 var mode = modes[$('#component_mode').val()] || null;
46 if (mode && header.attr('id') == mode) {
47 var oldMode = $('#component_mode :selected').text();
48 $('#component_mode').val('1');
50 var msg = '{ts escape="js"}Displaying results as "%1" is not available without search criteria from the pane you just closed.{/ts}';
51 msg = msg.replace('%1', oldMode);
52 CRM.alert(msg, '{ts escape="js"}Display Results have been Reset{/ts}');
58 // TODO: Why are the modes numeric? If they used the string there would be no need for this map
60 '2': 'CiviContribute',
67 // Handle change of results mode
68 $('#component_mode').change(function() {
69 // Reset task dropdown
71 var mode = modes[$('#component_mode').val()] || null;
73 $('.crm-' + mode + '-accordion.collapsed').crmAccordionToggle();
76 if ($('#component_mode').val() == '7') {
77 $('#crm-display_relationship_type').show();
80 $('#display_relationship_type').val('');
81 $('#crm-display_relationship_type').hide();
85 * Loads snippet based on id of crm-accordion-header
87 function loadPanes(id) {
88 var url = "{/literal}{crmURL p='civicrm/contact/search/advanced' q="qfKey=`$qfKey`&searchPane=" h=0}{literal}" + id;
89 var header = $('#' + id);
90 var body = $('.crm-accordion-body.' + id);
91 if (header.length > 0 && body.length > 0 && !body.html()) {
92 body.html('<div class="crm-loading-element"><span class="loading-text">{/literal}{ts escape='js'}Loading{/ts}{literal}...</span></div>');
93 header.append('{/literal}<a href="#" class="crm-close-accordion crm-hover-button css_right" title="{ts escape='js'}Remove from search criteria{/ts}"><span class="icon close-icon"></span></a>{literal}');
94 header.addClass('active');
95 CRM.loadPage(url, {target: body, block: false});
102 {if $context EQ 'smog' || $context EQ 'amtg' || $savedSearch}
104 {if $context EQ 'smog'}{ts}Find Contacts within this Group{/ts}
105 {elseif $context EQ 'amtg'}{ts}Find Contacts to Add to this Group{/ts}
106 {elseif $savedSearch}{ts 1=$savedSearch.name}%1 Smart Group Criteria{/ts} {help id='id-advanced-smart'}
112 <div class="crm-accordion-wrapper crm-search_criteria_basic-accordion ">
113 <div class="crm-accordion-header">
114 {ts}Basic Criteria{/ts}
115 </div><!-- /.crm-accordion-header -->
116 <div class="crm-accordion-body">
117 {include file="CRM/Contact/Form/Search/Criteria/Basic.tpl"}
118 </div><!-- /.crm-accordion-body -->
119 </div><!-- /.crm-accordion-wrapper -->
121 {foreach from=$allPanes key=paneName item=paneValue}
122 <div class="crm-accordion-wrapper crm-ajax-accordion crm-{$paneValue.id}-accordion {if $paneValue.open eq 'true' and $openedPanes.$paneName} {else}collapsed{/if}">
123 <div class="crm-accordion-header" id="{$paneValue.id}">
126 <div class="crm-accordion-body {$paneValue.id}"></div>
129 <div class="spacer"></div>
131 <table class="form-layout">
133 <td>{$form.buttons.html}</td>