2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
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">
31 // Bind first click of accordion header to load crm-accordion-body with snippet
32 // everything else is taken care of by crmAccordions()
33 $('.crm-search_criteria_basic-accordion .crm-accordion-header').addClass('active');
34 $('.crm-ajax-accordion').on('click', '.crm-accordion-header:not(.active)', function() {
35 loadPanes($(this).attr('id'));
37 $('.crm-ajax-accordion:not(.collapsed) .crm-accordion-header').each(function() {
38 loadPanes($(this).attr('id'));
40 $('.crm-ajax-accordion').on('click', '.crm-close-accordion', function() {
41 var header = $(this).parent();
42 header.next().html('');
43 header.removeClass('active');
44 header.parent('.crm-ajax-accordion:not(.collapsed)').crmAccordionToggle();
45 // Reset results-display mode if it depends on this pane
46 var mode = modes[$('#component_mode').val()] || null;
47 if (mode && header.attr('id') == mode) {
48 var oldMode = $('#component_mode :selected').text();
49 $('#component_mode').val('1');
51 var msg = '{ts escape="js"}Displaying results as "%1" is not available without search criteria from the pane you just closed.{/ts}';
52 msg = msg.replace('%1', oldMode);
53 CRM.alert(msg, '{ts escape="js"}Display Results have been Reset{/ts}');
59 // TODO: Why are the modes numeric? If they used the string there would be no need for this map
61 '2': 'CiviContribute',
68 // Handle change of results mode
69 $('#component_mode').change(function() {
70 // Reset task dropdown
72 var mode = modes[$('#component_mode').val()] || null;
74 $('.crm-' + mode + '-accordion.collapsed').crmAccordionToggle();
77 if ($('#component_mode').val() == '7') {
78 $('#crm-display_relationship_type').show();
81 $('#display_relationship_type').val('');
82 $('#crm-display_relationship_type').hide();
86 * Loads snippet based on id of crm-accordion-header
88 function loadPanes(id) {
89 var url = "{/literal}{crmURL p='civicrm/contact/search/advanced' q="snippet=1&qfKey=`$qfKey`&searchPane=" h=0}{literal}" + id;
90 var header = $('#' + id);
91 var body = $('.crm-accordion-body.' + id);
92 if (header.length > 0 && body.length > 0 && !body.html()) {
93 body.html('<div class="crm-loading-element"><span class="loading-text">{/literal}{ts escape='js'}Loading{/ts}{literal}...</span></div>');
94 header.append('{/literal}<a href="#" class="crm-close-accordion" title="{ts escape='js'}Remove from search criteria{/ts}"><span>{ts escape='js'}Reset{/ts}</span> <img src="{$config->resourceBase}i/close.png" /></a>{literal}');
95 header.addClass('active');
98 success: function(data) {
102 CRM.alert({/literal}'{ts escape="js"}Sorry, could not load the requested information from the server.{/ts}', '{ts escape="js"}Network Error{/ts}'{literal});
103 $('.crm-close-accordion', header).click();
112 {if $context EQ 'smog' || $context EQ 'amtg' || $savedSearch}
114 {if $context EQ 'smog'}{ts}Find Contacts within this Group{/ts}
115 {elseif $context EQ 'amtg'}{ts}Find Contacts to Add to this Group{/ts}
116 {elseif $savedSearch}{ts 1=$savedSearch.name}%1 Smart Group Criteria{/ts} {help id='id-advanced-smart'}
122 <div class="crm-accordion-wrapper crm-search_criteria_basic-accordion ">
123 <div class="crm-accordion-header">
124 {ts}Basic Criteria{/ts}
125 </div><!-- /.crm-accordion-header -->
126 <div class="crm-accordion-body">
127 {include file="CRM/Contact/Form/Search/Criteria/Basic.tpl"}
128 </div><!-- /.crm-accordion-body -->
129 </div><!-- /.crm-accordion-wrapper -->
131 {foreach from=$allPanes key=paneName item=paneValue}
132 <div class="crm-accordion-wrapper crm-ajax-accordion crm-{$paneValue.id}-accordion {if $paneValue.open eq 'true' and $openedPanes.$paneName} {else}collapsed{/if}">
133 <div class="crm-accordion-header" id="{$paneValue.id}">
136 <div class="crm-accordion-body {$paneValue.id}"></div>
139 <div class="spacer"></div>
141 <table class="form-layout">
143 <td>{$form.buttons.html}</td>