2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.3 |
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 {* Search form and results for voters *}
27 <div class="crm-block crm-form-block crm-search-form-block">
29 {assign var='searchForm' value='searchForm'}
31 {assign var='searchForm' value="search_form_$searchVoterFor"}
34 <div id="{$searchForm}" class="crm-accordion-wrapper crm-contribution_search_form-accordion {if $rows}collapsed{/if}">
35 <div class="crm-accordion-header crm-master-accordion-header">
36 {ts}Edit Search Criteria{/ts}
37 </div><!-- /.crm-accordion-header -->
39 <div class="crm-accordion-body">
41 <table class="form-layout">
43 <td class="font-size12pt">
44 {$form.campaign_survey_id.label}
47 {$form.campaign_survey_id.html}
51 <td class="font-size12pt">
52 {$form.survey_interviewer_name.label}
54 <td class="font-size12pt ">
55 {$form.survey_interviewer_name.html}
61 <td class="font-size12pt">
62 {$form.sort_name.label}
65 {$form.sort_name.html|crmAddClass:'twenty'}
67 <td><label>{ts}Contact Type(s){/ts}</label><br />
68 {$form.contact_type.html}
70 <script type="text/javascript">
71 cj("select#contact_type").crmasmSelect({
72 addItemTarget: 'bottom',
81 <td><label>{ts}Group(s){/ts}</label>
84 <script type="text/javascript">
85 cj("select#group").crmasmSelect({
86 addItemTarget: 'bottom',
91 selectClass:'campaignGroupsSelect'
98 <td class="font-size12pt">
99 {$form.street_address.label}
102 {$form.street_address.html}
104 <td class="font-size12pt">
105 {$form.street_name.label}
108 {$form.street_name.html}
112 <td class="font-size12pt">
113 {$form.street_unit.label}
116 {$form.street_unit.html}
118 <td class="font-size12pt">
126 <td class="font-size12pt">
127 {$form.street_number.label}
130 {$form.street_number.html}
133 <td class="font-size12pt">
134 {$form.postal_code.label}
137 {$form.postal_code.html}
140 {if $customSearchFields.ward || $customSearchFields.precinct}
142 {if $customSearchFields.ward}
143 {assign var='ward' value=$customSearchFields.ward}
144 <td class="font-size12pt">
152 {if $customSearchFields.precinct}
153 {assign var='precinct' value=$customSearchFields.precinct}
154 <td class="font-size12pt">
155 {$form.$precinct.label}
158 {$form.$precinct.html}
165 {if $context eq 'search'}
168 <a class="searchVoter button" style="float:left;" href="#" title={ts}Search{/ts} onClick="searchVoters( '{$qfKey}' );return false;">{ts}Search{/ts}</a>
180 <script type="text/javascript">
183 cj().crmAccordions();
186 {if !$isFormSubmitted}
187 buildCampaignGroups( );
192 //load interviewer autocomplete.
193 var interviewerDataUrl = "{/literal}{$dataUrl}{literal}";
194 var hintText = "{/literal}{ts escape='js'}Type in a partial or complete name of an existing contact.{/ts}{literal}";
195 cj( "#survey_interviewer_name" ).autocomplete( interviewerDataUrl,
202 ).result( function( event, data, formatted ) {
203 cj( "#survey_interviewer_id" ).val( data[1] );
204 }).bind( 'click', function( ) {
205 cj( "#survey_interviewer_id" ).val('');
209 function buildCampaignGroups( surveyId ) {
210 if ( !surveyId ) surveyId = cj("#campaign_survey_id").val( );
212 var operation = {/literal}'{$searchVoterFor}'{literal};
213 if ( !surveyId || operation != 'reserve' ) return;
215 var grpUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Campaign_Page_AJAX&fnName=campaignGroups'}"
219 {survey_id:surveyId},
221 if ( data.status != 'success' ) return;
223 var selectName = 'campaignGroupsSelect';
224 var groupSelect = cj("select[id^=" + selectName + "]");
225 var groupSelectCountId = cj( groupSelect ).attr( 'id' ).replace( selectName, '' );
227 //first remove all groups for given survey.
228 cj( "#group" ).find('option').remove( );
229 cj( groupSelect ).find('option').remove( );
230 cj( '#crmasmContainer' + groupSelectCountId ).find( 'span' ).remove( );
231 cj( '#crmasmList' + groupSelectCountId ).find( 'li' ).remove( );
233 var groups = data.groups;
235 //build the new group options.
237 for ( group in groups ) {
238 title = groups[group].title;
239 value = groups[group].value;
240 if ( !title ) continue;
241 var crmOptCount = 'asm' + groupSelectCountId + 'option' + optCount;
243 //add options to main group select.
244 cj( "#group" ).append( cj('<option></option>').val( value ).html( title ).attr( 'id', crmOptCount ) );
246 //add option to crm multi select ul.
247 cj( groupSelect ).append( cj('<option></option>').val(value).html(title).attr( 'rel', crmOptCount ) );