First commit

This commit is contained in:
Theodotos Andreou 2018-01-14 13:10:16 +00:00
commit c6e2478c40
13918 changed files with 2303184 additions and 0 deletions

View file

@ -0,0 +1,120 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<div class="crm-block crm-form-block crm-campaign-form-block">
{if $action eq 8}
<table class="form-layout">
<tr>
<td colspan="2">
<div class="status"><div class="icon inform-icon"></div>&nbsp;{ts}Are you sure you want to delete this Campaign?{/ts}</div>
</td>
</tr>
</table>
{else}
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="top"}
</div>
<table class="form-layout-compressed">
<tr class="crm-campaign-form-block-title">
<td class="label">{$form.title.label}</td>
<td class="view-value">{$form.title.html}</td>
</tr>
<tr class="crm-campaign-form-block-campaign_type_id">
<td class="label">{$form.campaign_type_id.label}</td>
<td class="view-value">{$form.campaign_type_id.html}</td>
</tr>
<tr class="crm-campaign-form-block-description">
<td class="label">{$form.description.label}</td>
<td class="view-value">{$form.description.html}</td>
</tr>
<tr class="crm-campaign-form-block-includeGroups">
<td class="label">{$form.includeGroups.label}</td>
<td>{$form.includeGroups.html}</td>
</tr>
<tr class="crm-campaign-form-block-start_date">
<td class="label">{$form.start_date.label}</td>
<td class="view-value">{include file="CRM/common/jcalendar.tpl" elementName=start_date}
</td>
</tr>
<tr class="crm-campaign-form-block-end_date">
<td class="label">{$form.end_date.label}</td>
<td class="view-value">{include file="CRM/common/jcalendar.tpl" elementName=end_date}</td>
</tr>
<tr class="crm-campaign-form-block-status_id">
<td class="label">{$form.status_id.label}</td>
<td class="view-value">{$form.status_id.html}</td>
</tr>
<tr class="crm-campaign-form-block-goal_general">
<td class="label">{$form.goal_general.label}</td>
<td class="view-value">{$form.goal_general.html}</td>
</tr>
<tr class="crm-campaign-form-block-goal_revenue">
<td class="label">{$form.goal_revenue.label}</td>
<td class="view-value">{$form.goal_revenue.html}</td>
</tr>
<tr class="crm-campaign-form-block-external_identifier">
<td class="label">{$form.external_identifier.label}</td>
<td class="view-value">{$form.external_identifier.html}</td>
</tr>
{* Suppress parent-child feature for now. dgg *}
{*
<tr class="crm-campaign-form-block-parent_id">
<td class="label">{$form.parent_id.label}</td>
<td class="view-value">{$form.parent_id.html}</td>
</tr> *}
<tr class="crm-campaign-form-block-is_active">
<td class="label">{$form.is_active.label}</td>
<td class="view-value">{$form.is_active.html}</td>
</tr>
</table>
<div id="customData"></div>
{/if}
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="bottom"}
</div>
</div>
{* include custom data js *}
{include file="CRM/common/customData.tpl"}
{literal}
<script type="text/javascript">
CRM.$(function($) {
{/literal}{if $customDataSubType}
CRM.buildCustomData( '{$customDataType}', {$customDataSubType} );
{else}
CRM.buildCustomData( '{$customDataType}' );
{/if}
{literal}
});
</script>
{/literal}

View file

@ -0,0 +1,231 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{if $errorMessages}
<div class="messages status crm-error no-popup">
<div class="icon inform-icon"></div>
<ul>
{foreach from=$errorMessages item=errorMsg}
<li>{ts}{$errorMsg}{/ts}</li>
{/foreach}
</ul>
</div>
</div>
{elseif $buildSelector}
{* load voter selector for reserve/release *}
{literal}
<script type="text/javascript">
CRM.$(function($) {
loadVoterList( );
});
</script>
{/literal}
<table class="gotvVoterRecords">
<thead>
<tr class="columnheader">
<th></th>
<th>{ts}Name{/ts}</th>
<th>{ts}Street Address{/ts}</th>
<th>{ts}Street Name{/ts}</th>
<th>{ts}Street Number{/ts}</th>
<th>{ts}Street Unit{/ts}</th>
{if $searchVoterFor eq 'release'}
<th>{ts}Is Interview Conducted?{/ts}</th>
{elseif $searchVoterFor eq 'gotv'}
<th>{ts}Voted?{/ts}</th>
{else}
<th>{ts}Is Reserved?{/ts}</th>
{/if}
</tr>
</thead>
<tbody></tbody>
</table>
{else}
{* build search form *}
{include file='CRM/Campaign/Form/Search/Common.tpl' context='gotv'}
<div id='voterList'></div>
{/if} {* end of search form build *}
{literal}
<script type="text/javascript">
{/literal}
{* load selector when force *}
{if $force and !$buildSelector}
{literal}
CRM.$(function($) {
searchVoters( {/literal}'{$qfKey}'{literal} );
});
{/literal}
{/if}
{literal}
function searchVoters( qfKey )
{
var dataUrl = {/literal}"{crmURL h=0 q='search=1&snippet=4'}"{literal};
//carry survey and interviewer id,
//might be helpful if user jump from current tab to interview tab.
var surveyId = CRM.$( '#campaign_survey_id' ).val();
var interviewerId = CRM.$( '#survey_interviewer_id' ).val();
if ( surveyId ) dataUrl = dataUrl + '&sid=' + surveyId;
if ( interviewerId ) dataUrl = dataUrl + '&cid=' + interviewerId;
//lets carry qfKey to retain form session.
if ( qfKey ) dataUrl = dataUrl + '&qfKey=' + qfKey;
CRM.$.get( dataUrl, null, function( voterList ) {
CRM.$( '#voterList' ).html( voterList ).trigger('crmLoad');
//collapse the search form.
var searchFormName = '#search_form_' + {/literal}'{$searchVoterFor}'{literal};
CRM.$( searchFormName + '.crm-accordion-wrapper:not(.collapsed)').crmAccordionToggle();
}, 'html' );
}
function loadVoterList( )
{
var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q='snippet=4&className=CRM_Campaign_Page_AJAX&fnName=voterList' }"{literal};
var searchVoterFor = {/literal}'{$searchVoterFor}'{literal};
CRM.$( 'table.gotvVoterRecords', 'form.{/literal}{$form.formClass}{literal}').dataTable({
"bFilter" : false,
"bAutoWidth" : false,
"bProcessing": true,
"bJQueryUI" : true,
"aaSorting": [[0,''],[1,'asc'], [2,'asc'], [3,'asc'], [4,'asc'], [5,'asc'] ],
"aoColumns":[{bSortable:false},{sClass:""},{sClass:""},{sClass:""},{sClass:""},{sClass:""},{bSortable:false}],
"sPaginationType": "full_numbers",
"sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
"bServerSide": true,
"sAjaxSource": sourceUrl,
"fnServerData": function ( sSource, aoData, fnCallback ) {
var dataLength = aoData.length;
var count = 1;
var searchCriteria = ['campaign_search_voter_for'];
//get the search criteria.
var searchParams = {/literal}{$searchParams}{literal};
for ( param in searchParams ) {
if ( val = CRM.$( '#' + param ).val( ) ) {
aoData[dataLength++] = {name: param , value: val };
}
searchCriteria[count++] = param;
}
//do search to reserve voters.
aoData[dataLength++] = {name: 'campaign_search_voter_for', value: searchVoterFor};
//lets transfer search criteria.
aoData[dataLength++] = {name: 'searchCriteria', value:searchCriteria.join(',')};
CRM.$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} ); }
});
}
function processVoterData( element, operation )
{
var data = new Object;
if ( !operation ) return;
var data = new Object;
if ( operation == 'release' ) {
data['operation'] = operation;
data['activity_id'] = CRM.$( element ).val( );
data['isDelete'] = CRM.$( element ).prop('checked') ? 1:0;
} else if ( operation == 'reserve' ) {
var interviewerId = CRM.$( '#survey_interviewer_id' ).val( );
data['operation'] = operation;
data['source_record_id'] = CRM.$( '#campaign_survey_id' ).val( );
data['target_contact_id'] = CRM.$( element ).val( );
data['source_contact_id'] = interviewerId;
data['assignee_contact_id'] = interviewerId;
data['isReserved'] = CRM.$( element ).prop('checked') ? 1:0;
} else if ( operation == 'gotv' ) {
data['operation'] = operation;
data['activity_id'] = CRM.$( element ).val( );
data['hasVoted'] = CRM.$( element ).prop('checked') ? 1: 0;
}
data['surveyTitle'] = {/literal}'{$surveyTitle|escape:javascript}'{literal};
var actUrl = {/literal}
"{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Campaign_Page_AJAX&fnName=processVoterData'}"
{literal};
//post data to save voter as voted/non voted.
CRM.$.post( actUrl,
data,
function( response ) {
if ( response.status == 'success' ) {
var msgId = '#success_msg_' + CRM.$( element ).val( );
CRM.$( msgId ).fadeIn('slow').fadeOut('slow');
if ( operation == 'release' ) {
msg = '{/literal}{ts escape='js'}Save as voted.{/ts}{literal}';
var isDeleted = CRM.$( element ).prop('checked') ? 1:0;
if ( !isDeleted ) msg = '{/literal}{ts escape='js'}Save as non voted.{/ts}{literal}';
} else if ( operation == 'gotv' ) {
msg = '{/literal}{ts escape='js'}Vote Recorded.{/ts}{literal}';
var hasVoted = CRM.$( element ).prop('checked') ? 1:0;
var trObject = CRM.$( '[id^="survey_activity['+ CRM.$( element ).val() +']"]' ).parents('tr' );
var methodName = 'addClass';
if ( !hasVoted ) {
msg = '{/literal}{ts escape='js'}Vote Cancelled.{/ts}{literal}';
methodName = 'removeClass';
}
eval( 'trObject.' + methodName + "( 'name disabled' )" );
} else if ( operation == 'reserve' ) {
if ( CRM.$( element ).prop('checked') ) {
msg = '{/literal}{ts escape='js'}Reserved.{/ts}{literal}';
} else {
msg = '{/literal}{ts escape='js'}Released.{/ts}{literal}';
}
}
CRM.$( msgId ).html( msg );
}
}, 'json' );
}
</script>
{/literal}

View file

@ -0,0 +1,154 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<div class="crm-block crm-form-block crm-campaign-survey-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
{if $action eq 8}
<table class="form-layout">
<tr>
<td colspan="2">
<div class="status">
<div class="icon inform-icon"></div>
&nbsp;{ts}Are you sure you want to delete this Petition?{/ts}</div>
</td>
</tr>
</table>
{else}
{if $action eq 1}
<div class="help">
{ts}Use this form to Add new Survey. You can create a new Activity type, specific to this Survey or select an existing activity type for this Survey.{/ts}
</div>
{/if}
<table class="form-layout">
<tr class="crm-campaign-survey-form-block-title">
<td class="label">{$form.title.label}</td>
<td>{$form.title.html}
</tr>
<tr class="crm-campaign-survey-form-block-instructions">
<td class="label">{$form.instructions.label}</td>
<td class="view-value">{$form.instructions.html}
</tr>
<tr class="crm-campaign-survey-form-block-campaign_id">
<td class="label">{$form.campaign_id.label}</td>
<td>{$form.campaign_id.html}
</tr>
<tr class="crm-campaign-survey-form-block-activity_type_id">
<td class="label">{$form.activity_type_id.label}</td>
<td>{$form.activity_type_id.html}
</tr>
<tr class="crm-campaign-survey-form-block-profile_id">
<td class="label">{$form.contact_profile_id.label}</td>
<td>{$form.contact_profile_id.html}&nbsp;<span class="profile-links"></span>
<div class="description">{ts}Fields about the contact you want to collect.{/ts}</div>
</td>
</tr>
<tr class="crm-campaign-survey-form-block-profile_id">
<td class="label">{$form.profile_id.label}</td>
<td>{$form.profile_id.html}&nbsp;<span class="profile-links"></span>
<div class="description">{ts}Fields about the petition.{/ts}</div>
<div class="profile-create">
<a href="{crmURL p='civicrm/admin/uf/group/add' q='reset=1&action=add'}"
target="_blank">{ts}Click here for new profile{/ts}
</div>
</td>
</tr>
<tr class="crm-campaign-survey-form-block-thankyou_title">
<td
class="label">{$form.thankyou_title.label}{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_survey' field='thankyou_title' id=$surveyId}{/if}</td>
<td>{$form.thankyou_title.html}<br/>
<div class="description">{ts}This title will be displayed at the top of the thank-you page.{/ts}</div>
</td>
</tr>
<tr class="crm-campaign-survey-form-block-thankyou_text">
<td
class="label">{$form.thankyou_text.label}{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_survey' field='thankyou_text' id=$surveyId}{/if}</td>
<td>{$form.thankyou_text.html}<br/>
<div
class="description">{ts}Enter text (and optional HTML layout tags) for the thank-you message that will appear at the top of the thank-you page.{/ts}</div>
</td>
</tr>
<tr class="crm-campaign-survey-form-block-bypass_confirm">
<td class="label">{$form.bypass_confirm.label}</td>
<td>{$form.bypass_confirm.html}
<div class="description">{ts}Disable the email confirmation for unverified contacts?{/ts}</div>
</td>
</tr>
<tr class="crm-campaign-survey-form-block-is_share">
<td class="label">{$form.is_share.label}</td>
<td>{$form.is_share.html}
</tr>
<tr class="crm-campaign-survey-form-block-is_active">
<td class="label">{$form.is_active.label}</td>
<td>{$form.is_active.html}
<div class="description">{ts}Is this petition active?{/ts}</div>
</td>
</tr>
<tr class="crm-campaign-survey-form-block-is_default">
<td class="label">{$form.is_default.label}</td>
<td>{$form.is_default.html}
<div class="description">{ts}Is this the default petition?{/ts}</div>
</td>
</tr>
</table>
<div id="customData"></div>
{*include custom data js file*}
{include file="CRM/common/customData.tpl"}
{literal}
<script type="text/javascript">
CRM.$(function($) {
{/literal}
CRM.buildCustomData( 'Survey' );
{literal}
});
</script>
{/literal}
{/if}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>
{*include profile link function*}
{include file="CRM/common/buildProfileLink.tpl"}
{literal}
<script type="text/javascript">
//show edit profile field links
CRM.$(function($) {
// show edit for both contact and activity profile
$('select[id$="profile_id"]').change(function () {
buildLinks($(this), $(this).val());
});
// make sure we set edit links for both profiles when form loads
$('select[id$="profile_id"]').each(function (e) {
buildLinks($(this), $(this).val());
});
});
</script>
{/literal}

View file

@ -0,0 +1,69 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<script>
{literal}
if (typeof(cj) === 'undefined') cj = jQuery;
{/literal}
</script>
<div id="intro" class="crm-section">{$petition.instructions}</div>
<div class="crm-block crm-petition-form-block">
{if $duplicate == "confirmed"}
<p>
{ts}You have already signed this petition.{/ts}
</p>
{/if}
{if $duplicate == "unconfirmed"}
<p>{ts}You have already signed this petition but you still <b>need to verify your email address</b>.{/ts}</br> {ts}Please check your email inbox for the confirmation email. If you don't find it, verify if it isn't in your spam folder.{/ts}</p>
{/if}
{if $duplicate}
<p>{ts}Thank you for your support.{/ts}</p>
{if $is_share}
{include file="CRM/Campaign/Page/Petition/SocialNetwork.tpl" petition_id=$survey_id petitionTitle=$petitionTitle}
{/if}
{else}
<div class="crm-section crm-petition-contact-profile">
{include file="CRM/UF/Form/Block.tpl" fields=$petitionContactProfile hideFieldset=true}
</div>
<div class="crm-section crm-petition-activity-profile">
{include file="CRM/UF/Form/Block.tpl" fields=$petitionActivityProfile hideFieldset=true}
</div>
{if $isCaptcha}
{include file='CRM/common/ReCAPTCHA.tpl'}
{/if}
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="bottom"}
</div>
{/if}
</div>

View file

@ -0,0 +1,173 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<tr>
<td class="label">{$form.option_type.label}</td>
<td class="html-adjust">{$form.option_type.html}<br />
<span class="description">{ts}You can create new result options for this survey, or select an existing survey result set which you've already created for another survey.{/ts}</span>
</td>
</tr>
<tr id="option_group" {if !$form.option_group_id}class="hiddenElement"{/if}>
<td class="label">{$form.option_group_id.label}</td>
<td class="html-adjust">{$form.option_group_id.html}</td>
</tr>
<tr id="multiple">
<td colspan="2" class="html-adjust">
<fieldset><legend>{ts}Result Options{/ts}</legend>
<span class="description">
{ts}Enter up to ten (10) multiple choice options in this table (click 'another choice' for each additional choice).You can use existing result set options by selecting survey result set.{/ts}
</span>
<br />
{strip}
<table id="optionField">
<tr>
<th>&nbsp;</th>
<th> {ts}Default{/ts}</th>
<th> {ts}Label{/ts}</th>
<th> {ts}Value{/ts}</th>
<th> {ts}Recontact Interval{/ts}</th>
<th> {ts}Order{/ts}</th>
</tr>
{section name=rowLoop start=1 loop=12}
{assign var=index value=$smarty.section.rowLoop.index}
<tr id="optionField_{$index}" class="form-item {cycle values="odd-row,even-row"}">
<td>
{if $index GT 1}
<a onclick="showHideRow({$index}); return false;" name="optionField_{$index}" href="#" class="form-link"><i class="crm-i fa-trash" title="{ts}hide field or section{/ts}"></i></a>
{/if}
</td>
<td>
<div id="radio{$index}">
{$form.default_option[$index].html}
</div>
</td>
<td> {$form.option_label.$index.html}</td>
<td> {$form.option_value.$index.html}</td>
<td> {$form.option_interval.$index.html}</td>
<td> {$form.option_weight.$index.html}</td>
</tr>
{/section}
</table>
<div id="optionFieldLink" class="add-remove-link">
<a onclick="showHideRow(); return false;" name="optionFieldLink" href="#" class="form-link"><i class="crm-i fa-plus-circle"></i> {ts}add another choice{/ts}</a>
</div>
<span id="additionalOption" class="description">
{ts}If you need additional options - you can add them after you Save your current entries.{/ts}
</span>
{/strip}
</fieldset>
</td>
</tr>
<script type="text/javascript">
var showRows = [{$showBlocks}];
var hideBlocks = [{$hideBlocks}];
var rowcounter = 0;
var surveyId = {if $surveyId}{$surveyId}{else}''{/if};
{literal}
if (navigator.appName == "Microsoft Internet Explorer") {
for ( var count = 0; count < hideBlocks.length; count++ ) {
var r = document.getElementById(hideBlocks[count]);
r.style.display = 'none';
}
}
function showOptionSelect( ) {
if ( document.getElementsByName("option_type")[0].checked ) {
cj('#option_group').hide();
cj('#default_option').val('');
} else {
cj('#option_group').show();
loadOptionGroup( );
}
}
function resetResultSet( ) {
for( i=1; i<=11; i++ ) {
cj('#option_label_'+ i).val('');
cj('#option_value_'+ i).val('');
cj('#option_weight_'+ i).val('');
cj('#option_interval_'+ i).val('');
if ( i > 2 ) {
showHideRow(i);
}
}
}
function loadOptionGroup( ) {
var data = new Object;
resetResultSet( );
if ( cj('#option_group_id').val() ) {
data['option_group_id'] = cj('#option_group_id').val();
data['survey_id'] = surveyId;
} else {
return false;
}
var dataUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Campaign_Page_AJAX&fnName=loadOptionGroupDetails' }"{literal}
// build new options
cj.post( dataUrl, data, function( opGroup ) {
if ( opGroup.status == 'success' ) {
var result = opGroup.result;
var countRows = 1;
for( key in result ) {
cj('#option_label_'+ countRows).val( result[key].label);
cj('#option_value_'+ countRows).val( result[key].value);
cj('#option_weight_'+ countRows).val( result[key].weight);
if ( surveyId && result[key].interval ) {
cj('#option_interval_'+ countRows).val( result[key].interval);
}
if ( result[key].is_default == 1 ) {
cj('#radio'+countRows+' input').prop('checked', true);
}
if ( countRows > 1 ) {
showHideRow( );
}
countRows +=1;
}
}
}, "json" );
}
CRM.$(function($) {
showOptionSelect( );
});
{/literal}
on_load_init_blocks( showRows, hideBlocks, '' );
</script>

View file

@ -0,0 +1,55 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{* Search form and results for voters *}
{include file='CRM/Campaign/Form/Search/Common.tpl' context='search'}
{if $rowsEmpty || $rows}
<div class="crm-content-block">
{if $rowsEmpty}
{include file="CRM/Campaign/Form/Search/EmptyResults.tpl"}
{/if}
{if $rows}
{* Search request has returned 1 or more matching rows. Display results and collapse the search criteria fieldset. *}
{assign var="showBlock" value="'searchForm_show'"}
{assign var="hideBlock" value="'searchForm'"}
{* Search request has returned 1 or more matching rows. *}
<fieldset>
{* This section handles form elements for action task select and submit *}
{include file="CRM/common/searchResultTasks.tpl" context="Campaign"}
{* This section displays the rows along and includes the paging controls *}
<p></p>
{include file="CRM/Campaign/Form/Selector.tpl" context="Search"}
</fieldset>
{* END Actions/Results section *}
{/if}
</div>
{/if}

View file

@ -0,0 +1,287 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{if !$hasCampaigns}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>
&nbsp;
{ts}None found.{/ts}
</div>
<div class="action-link">
{crmButton p="civicrm/campaign/add" q="reset=1" icon="crm-i fa-plus-circle" h=0}{ts}Add Campaign{/ts}{/crmButton}
</div>
{elseif $buildSelector}
{* load campaign selector *}
{include file="CRM/common/enableDisableApi.tpl"}
{literal}
<script type="text/javascript">
CRM.$(function($) {
loadCampaignList();
});
</script>
{/literal}
<table class="campaigns">
<thead>
<tr class="columnheader">
<th>{ts}ID{/ts}</th>
<th class="hiddenElement">{ts}Campaign Name{/ts}</th>
<th>{ts}Title{/ts}</th>
<th>{ts}Description{/ts}</th>
<th>{ts}Start Date{/ts}</th>
<th>{ts}End Date{/ts}</th>
<th class="hiddenElement">{ts}Type ID{/ts}</th>
<th>{ts}Type{/ts}</th>
<th class="hiddenElement">{ts}Status ID{/ts}</th>
<th>{ts}Status{/ts}</th>
<th class="hiddenElement">{ts}Is Active?{/ts}</th>
<th>{ts}Active?{/ts}</th>
<th></th>
</tr>
</thead>
<tbody></tbody>
</table>
{else}
<div class="action-link">
{crmButton p="civicrm/campaign/add" q="reset=1" icon="crm-i fa-plus-circle" h=0}{ts}Add Campaign{/ts}{/crmButton}
</div>
{* build search form here *}
{* Search form and results for campaigns *}
<div class="crm-block crm-form-block crm-search-form-block">
{assign var='searchForm' value="search_form_$searchFor"}
<div id="{$searchForm}"
class="crm-accordion-wrapper crm-campaign_search_form-accordion {if $force and !$buildSelector}collapsed{/if}">
<div class="crm-accordion-header">
{ts}Search Campaigns{/ts}
</div>
<!-- /.crm-accordion-header -->
<div class="crm-accordion-body">
{strip}
<table class="form-layout-compressed">
<tr>
<td>{$form.campaign_title.label}<br/>
{$form.campaign_title.html} &nbsp;
</td>
<td>
{$form.description.label}<br/>
{$form.description.html|crmAddClass:huge}
</td>
</tr>
<tr>
<td>{$form.start_date.label}<br/>
{include file="CRM/common/jcalendar.tpl" elementName=start_date}
</td>
<td>{$form.end_date.label}<br/>
{include file="CRM/common/jcalendar.tpl" elementName=end_date}
</td>
</tr>
<tr>
<td>{$form.campaign_type_id.label}<br/>
{$form.campaign_type_id.html}
</td>
<td>{$form.status_id.label}<br/>
{$form.status_id.html}
</td>
<td>{$form.is_active.label}<br/>
{$form.is_active.html}
</td>
</tr>
<tr>
<td colspan="2">
{if $context eq 'search'}
{$form.buttons.html}
{else}
<a class="searchCampaign button" style="float:left;" href="#" title="{ts}Search{/ts}"
onClick="searchCampaigns( '{$qfKey}' );return false;">{ts}Search{/ts}</a>
{/if}
</td>
</tr>
</table>
{/strip}
</div>
</div>
</div>
{* search form ends here *}
<div id='campaignList'></div>
{/if} {* end of search form build *}
{literal}
<script type="text/javascript">
(function($) {
window.searchCampaigns = function searchCampaigns(qfKey) {
var dataUrl = {/literal}"{crmURL h=0 q='search=1&snippet=4&type=campaign'}"{literal};
//lets carry qfKey to retain form session.
if (qfKey) {
dataUrl = dataUrl + '&qfKey=' + qfKey;
}
$.get(dataUrl, null, function (campaignList) {
$('#campaignList').html(campaignList).trigger('crmLoad');
//collapse the search form.
var searchFormName = '#search_form_' + {/literal}'{$searchFor}'{literal};
$(searchFormName + '.crm-accordion-wrapper:not(.collapsed)').crmAccordionToggle();
}, 'html');
};
window.loadCampaignList = function() {
var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q='snippet=4&className=CRM_Campaign_Page_AJAX&fnName=campaignList' }"{literal};
//build the search qill.
//get the search criteria.
var searchParams = {/literal}{$searchParams}{literal};
var campaignTypes = {/literal}{$campaignTypes}{literal};
var campaignStatus = {/literal}{$campaignStatus}{literal};
var noRecordFoundMsg = '{/literal}{ts escape='js'}No matches found for:{/ts}{literal}';
noRecordFoundMsg += '<div class="qill">';
var count = 0;
var searchQill = [];
for (param in searchParams) {
if (val = $('#' + param).val()) {
if (param == 'status_id') {
val = campaignStatus[val];
}
if (param == 'campaign_type_id') {
val = campaignTypes[val];
}
searchQill[count++] = searchParams[param] + ' : ' + val;
}
}
noRecordFoundMsg += searchQill.join('<span class="font-italic"> ...AND... </span></div><div class="qill">');
$('table.campaigns', '#campaignList').dataTable({
"bFilter": false,
"bAutoWidth": false,
"bProcessing": false,
"bLengthChange": false,
"aaSorting": [],
"aoColumns": [
{sClass: 'crm-campaign-id' },
{sClass: 'crm-campaign-name hiddenElement' },
{sClass: 'crmf-title' },
{sClass: 'crmf-description' },
{sClass: 'crm-campaign-start_date' },
{sClass: 'crm-campaign-end_date' },
{sClass: 'crm-campaign-campaign-type_id hiddenElement' },
{sClass: 'crmf-campaign_type_id' },
{sClass: 'crm-campaign-campaign-status_id hiddenElement' },
{sClass: 'crmf-status_id' },
{sClass: 'crm-campaign-campaign-is_active hiddenElement' },
{sClass: 'crm-campaign-campaign-isAactive' },
{sClass: 'crm-campaign-action', bSortable: false}
],
"sPaginationType": "full_numbers",
"sDom": 'rt<"crm-datatable-pager-bottom"ip>',
"bServerSide": true,
"bJQueryUI": true,
"sAjaxSource": sourceUrl,
"asStripClasses": ["odd-row", "even-row"],
"oLanguage": {"sEmptyTable": noRecordFoundMsg,
"sZeroRecords": noRecordFoundMsg },
"fnDrawCallback": function () {
$(this).trigger('crmLoad');
},
"fnRowCallback": function (nRow, aData, iDisplayIndex) {
//insert the id for each row for enable/disable.
var rowId = 'campaign-' + aData[0];
$(nRow).attr('id', rowId).addClass('crm-entity');
//handled disabled rows.
var isActive = Boolean(Number(aData[10]));
if (!isActive) {
$(nRow).addClass('disabled');
}
// Crm-editable
$(nRow).children().eq(2).addClass('crm-editable');
$(nRow).children().eq(3).data('type', 'textarea').addClass('crm-editable');
$(nRow).children().eq(7).data('type', 'select').addClass('crm-editable');
$(nRow).children().eq(9).data({type: 'select', emptyOption: ''}).addClass('crm-editable');
return nRow;
},
"fnServerData": function (sSource, aoData, fnCallback) {
var dataLength = aoData.length;
var count = 1;
var searchCriteria = [];
//get the search criteria.
var searchParams = {/literal}{$searchParams}{literal};
for (param in searchParams) {
fldName = param;
if (param == 'campaign_title') {
fldName = 'title';
}
if (val = $('#' + param).val()) {
aoData[dataLength++] = {name: fldName, value: val};
}
searchCriteria[count++] = fldName;
}
//do search for campaigns.
aoData[dataLength++] = {name: 'search_for', value: 'campaign'};
//lets transfer search criteria.
aoData[dataLength++] = {name: 'searchCriteria', value: searchCriteria.join(',')};
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
}
});
};
{/literal}
{* load selector when force *}
{if $force and !$buildSelector}
{literal}
$(function($) {
searchCampaigns({/literal}'{$qfKey}'{literal});
});
{/literal}
{/if}
{literal}
})(CRM.$);
</script>
{/literal}

View file

@ -0,0 +1,204 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{* Search form and results for voters *}
<div class="crm-block crm-form-block crm-search-form-block">
{assign var='searchForm' value='searchForm'}
{if $searchVoterFor}
{assign var='searchForm' value="search_form_$searchVoterFor"}
{/if}
<div id="{$searchForm}" class="crm-accordion-wrapper crm-contribution_search_form-accordion {if $rows}collapsed{/if}">
<div class="crm-accordion-header crm-master-accordion-header">
{ts}Edit Search Criteria{/ts}
</div><!-- /.crm-accordion-header -->
<div class="crm-accordion-body">
{strip}
<table class="form-layout">
<tr>
<td class="font-size12pt">
{$form.campaign_survey_id.label}
</td>
<td>
{$form.campaign_survey_id.html}
</td>
{if $showInterviewer}
<td class="font-size12pt">
{$form.survey_interviewer_id.label}
</td>
<td class="font-size12pt ">
{$form.survey_interviewer_id.html}
</td>
{/if}
</tr>
<tr>
<td class="font-size12pt">
{$form.sort_name.label}
</td>
<td>
{$form.sort_name.html|crmAddClass:'twenty'}
</td>
<td><label>{ts}Contact Type(s){/ts}</label><br />
{$form.contact_type.html}
</td>
<td><label>{ts}Group(s){/ts}</label>
{$form.group.html}
</td>
</tr>
<tr>
<td class="font-size12pt">
{$form.street_address.label}
</td>
<td>
{$form.street_address.html}
</td>
<td class="font-size12pt">
{$form.street_name.label}
</td>
<td>
{$form.street_name.html}
</td>
</tr>
<tr>
<td class="font-size12pt">
{$form.street_unit.label}
</td>
<td>
{$form.street_unit.html}
</td>
<td class="font-size12pt">
{$form.city.label}
</td>
<td>
{$form.city.html}
</td>
</tr>
<tr>
<td class="font-size12pt">
{$form.street_number.label}
</td>
<td>
{$form.street_number.html}
</td>
<td class="font-size12pt">
{$form.postal_code.label}
</td>
<td>
{$form.postal_code.html}
</td>
</tr>
{if $customSearchFields.ward || $customSearchFields.precinct}
<tr>
{if $customSearchFields.ward}
{assign var='ward' value=$customSearchFields.ward}
<td class="font-size12pt">
{$form.$ward.label}
</td>
<td>
{$form.$ward.html}
</td>
{/if}
{if $customSearchFields.precinct}
{assign var='precinct' value=$customSearchFields.precinct}
<td class="font-size12pt">
{$form.$precinct.label}
</td>
<td>
{$form.$precinct.html}
</td>
{/if}
</tr>
{/if}
<tr>
<td colspan="2">
{if $context eq 'search'}
{$form.buttons.html}
{else}
<a class="searchVoter button" style="float:left;" href="#" title={ts}Search{/ts} onClick="searchVoters( '{$qfKey}' );return false;">{ts}Search{/ts}</a>
{/if}
</td>
</tr>
</table>
{/strip}
</div>
</div>
</div>
{literal}
<script type="text/javascript">
CRM.$(function($) {
{/literal}
{if !$isFormSubmitted}
buildCampaignGroups( );
{/if}
{literal}
});
function buildCampaignGroups( surveyId ) {
if ( !surveyId ) surveyId = cj("#campaign_survey_id").val( );
var operation = {/literal}'{$searchVoterFor}'{literal};
if ( !surveyId || operation != 'reserve' ) return;
var grpUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Campaign_Page_AJAX&fnName=campaignGroups'}"
{literal};
cj.post( grpUrl,
{survey_id:surveyId},
function( data ) {
if ( data.status != 'success' ) return;
//first remove all groups for given survey.
cj("#group").find('option').remove();
var groups = data.groups;
//build the new group options.
var optCount = 0;
for ( group in groups ) {
var title = groups[group].title;
var value = groups[group].value;
if ( !value ) continue;
//add options to main group select.
cj( "#group" ).append( cj('<option></option>').val( value ).html(title));
optCount++;
}
cj("#group").trigger('change');
},
'json');
}
</script>
{/literal}

View file

@ -0,0 +1,42 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{* No matches for submitted search request. *}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>
{if $qill}{ts}No matches found for:{/ts}
{include file="CRM/common/displaySearchCriteria.tpl"}
{else}
{ts}None found.{/ts}
{/if}
<br />
{ts}Suggestions:{/ts}
<ul>
<li>{ts}if you are searching by respondent name, check your spelling{/ts}</li>
<li>{ts}try a different spelling or use fewer letters{/ts}</li>
<li>{ts}if you are searching within a date or amount range, try a wider range of values{/ts}</li>
<li>{ts}make sure you have enough privileges in the access control system{/ts}</li>
</ul>
</div>

View file

@ -0,0 +1,256 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{if !$hasPetitions}
<div class="messages status no-popup">
<div class="icon inform-icon"></div> &nbsp;
{ts}None found.{/ts}
</div>
<div class="action-link">
{crmButton p='civicrm/petition/add' q='reset=1' h=0 icon="plus-circle"}{ts}Add Petition{/ts}{/crmButton}
</div>
{elseif $buildSelector}
{* use to display result set of petition *}
<div id="petition-result-set-dialog" class="hiddenElement"></div>
{* load petition selector *}
{include file="CRM/common/enableDisableApi.tpl"}
{literal}
<script type="text/javascript">
CRM.$(function($) {
loadPetitionList( );
});
</script>
{/literal}
<table class="petitions">
<thead>
<tr class="columnheader">
<th class="hiddenElement">{ts}Petition ID{/ts}</th>
<th>{ts}Title{/ts}</th>
<th class="hiddenElement">{ts}Campaign ID{/ts}</th>
<th>{ts}Campaign{/ts}</th>
<th class="hiddenElement">{ts}Petition Type ID{/ts}</th>
<th class="hiddenElement">{ts}Petition Type{/ts}</th>
<th>{ts}Default?{/ts}</th>
<th class="hiddenElement">{ts}Is Active?{/ts}</th>
<th>{ts}Active?{/ts}</th>
<th></th>
</tr>
</thead>
<tbody></tbody>
</table>
{else}
<div class="action-link">
{crmButton p='civicrm/petition/add' q='reset=1' h=0 icon="plus-circle"}{ts}Add Petition{/ts}{/crmButton}
</div>
{* build search form here *}
{* Search form and results for petitions *}
<div class="crm-block crm-form-block crm-search-form-block">
{assign var='searchForm' value="search_form_$searchFor"}
<div id="{$searchForm}" class="crm-accordion-wrapper crm-petition_search_form-accordion {if $force and !$buildSelector}collapsed{/if}">
<div class="crm-accordion-header">
{ts}Search Petitions{/ts}
</div><!-- /.crm-accordion-header -->
<div class="crm-accordion-body">
{strip}
<table class="form-layout-compressed">
<tr>
<td>{$form.petition_title.label}<br />
{$form.petition_title.html}
</td>
<td>{$form.petition_campaign_id.label}<br />
{$form.petition_campaign_id.html}
</td>
</tr>
<tr>
<td colspan="2">
{if $context eq 'search'}
{$form.buttons.html}
{else}
<a class="searchPetition button" style="float:left;" href="#" title={ts}Search{/ts} onClick="searchPetitions( '{$qfKey}' );return false;">{ts}Search{/ts}</a>
{/if}
</td>
</tr>
</table>
{/strip}
</div>
</div>
</div>
{* search form ends here *}
<div id='petitionList'></div>
{/if} {* end of search form build *}
{literal}
<script type="text/javascript">
{/literal}
{* load selector when force *}
{if $force and !$buildSelector}
{literal}
CRM.$(function($) {
searchPetitions( {/literal}'{$qfKey}'{literal} );
});
{/literal}
{/if}
{literal}
function searchPetitions( qfKey )
{
var dataUrl = {/literal}"{crmURL h=0 q='search=1&snippet=4&type=petition'}"{literal};
//lets carry qfKey to retain form session.
if ( qfKey ) dataUrl = dataUrl + '&qfKey=' + qfKey;
CRM.$.get( dataUrl, null, function( petitionList ) {
CRM.$( '#petitionList' ).html( petitionList ).trigger('crmLoad');
//collapse the search form.
var searchFormName = '#search_form_' + {/literal}'{$searchFor}'{literal};
CRM.$( searchFormName + '.crm-accordion-wrapper:not(.collapsed)').crmAccordionToggle();
}, 'html' );
}
function loadPetitionList( )
{
var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q='snippet=4&className=CRM_Campaign_Page_AJAX&fnName=petitionList' }"{literal};
//build the search qill.
//get the search criteria.
var searchParams = {/literal}{$searchParams}{literal};
var campaigns = {/literal}{$petitionCampaigns}{literal};
var noRecordFoundMsg = '{/literal}{ts escape='js'}No matches found for:{/ts}{literal}';
noRecordFoundMsg += '<div class="qill">';
var count = 0;
var searchQill = [];
for ( param in searchParams ) {
if ( val = CRM.$( '#' + param ).val( ) ) {
if ( param == 'petition_campaign_id' ) val = campaigns[val];
searchQill[count++] = searchParams[param] + ' : ' + val;
}
}
noRecordFoundMsg += searchQill.join( '<span class="font-italic"> ...AND... </span></div><div class="qill">' );
CRM.$( 'table.petitions', '#petitionList').dataTable({
"bFilter" : false,
"bAutoWidth" : false,
"bProcessing": false,
"bLengthChange": false,
"aaSorting": [],
"aoColumns":[
{sClass:'crm-petition-id hiddenElement' },
{sClass:'crmf-title' },
{sClass:'crm-petition-campaign_id hiddenElement' },
{sClass:'crmf-campaign_id' },
{sClass:'crm-petition-activity_type_id hiddenElement' },
{sClass:'crm-petition-activity_type hiddenElement' },
{sClass:'crm-petition-is_default' },
{sClass:'crm-petition-is_active hiddenElement' },
{sClass:'crm-petition-isActive' },
{sClass:'crm-petition-action', bSortable:false}
],
"sPaginationType": "full_numbers",
"sDom" : 'rt<"crm-datatable-pager-bottom"ip>',
"bServerSide": true,
"bJQueryUI": true,
"sAjaxSource": sourceUrl,
"asStripClasses" : [ "odd-row", "even-row" ],
"oLanguage":{"sEmptyTable" : noRecordFoundMsg,
"sZeroRecords" : noRecordFoundMsg },
"fnDrawCallback": function() {
$(this).trigger('crmLoad');
},
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
// Crm-editable
CRM.$(nRow).children().eq(1).addClass('crm-editable');
//insert the id for each row for enable/disable.
var rowId = 'survey-' + aData[0];
CRM.$(nRow).attr( 'id', rowId).addClass('crm-entity');
//handled disabled rows.
var isActive = Boolean(Number(aData[7]));
if ( !isActive ) CRM.$(nRow).addClass( 'disabled' );
//add id for yes/no column.
CRM.$(nRow).children().eq(8).attr( 'id', rowId + '_status' );
return nRow;
},
"fnServerData": function ( sSource, aoData, fnCallback ) {
var dataLength = aoData.length;
var count = 1;
var searchCriteria = [];
//get the search criteria.
var searchParams = {/literal}{$searchParams}{literal};
for ( param in searchParams ) {
fldName = param;
if ( param == 'petition_title' ) fldName = 'title';
if ( param == 'petition_campaign_id' ) fldName = 'campaign_id';
if ( val = CRM.$( '#' + param ).val( ) ) {
aoData[dataLength++] = {name: fldName, value: val};
}
searchCriteria[count++] = fldName;
}
//do search for petitions.
aoData[dataLength++] = {name: 'search_for', value: 'petition'};
//lets transfer search criteria.
aoData[dataLength++] = {name: 'searchCriteria', value:searchCriteria.join(',')};
CRM.$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} ); }
});
}
</script>
{/literal}

View file

@ -0,0 +1,305 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{if !$hasSurveys}
<div class="messages status no-popup">
<div class="icon inform-icon"></div> &nbsp;
{ts}None found.{/ts}
</div>
<div class="action-link">
{crmButton p='civicrm/survey/add' q='reset=1' h=0 icon="plus-circle"}{ts}Add Survey{/ts}{/crmButton}
</div>
{elseif $buildSelector}
{* use to display result set of survey *}
<div id="survey-result-set-dialog" class="hiddenElement"></div>
{* load survey selector *}
{include file="CRM/common/enableDisableApi.tpl"}
{literal}
<script type="text/javascript">
CRM.$(function($) {
loadSurveyList( );
});
</script>
{/literal}
<table class="surveys">
<thead>
<tr class="columnheader">
<th class="hiddenElement">{ts}Survey ID{/ts}</th>
<th>{ts}Title{/ts}</th>
<th class="hiddenElement">{ts}Campaign ID{/ts}</th>
<th>{ts}Campaign{/ts}</th>
<th class="hiddenElement">{ts}Survey Type ID{/ts}</th>
<th>{ts}Survey Type{/ts}</th>
<th>{ts}Release Frequency{/ts}</th>
<th>{ts}Reserve Each Time{/ts}</th>
<th>{ts}Total Reserve{/ts}</th>
<th>{ts}Default?{/ts}</th>
<th class="hiddenElement">{ts}Is Active?{/ts}</th>
<th>{ts}Active?{/ts}</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody></tbody>
</table>
{else}
<div class="action-link">
{crmButton p='civicrm/survey/add' q='reset=1' h=0 icon="plus-circle"}{ts}Add Survey{/ts}{/crmButton}
</div>
{* build search form here *}
{* Search form and results for surveys *}
<div class="crm-block crm-form-block crm-search-form-block">
{assign var='searchForm' value="search_form_$searchFor"}
<div id="{$searchForm}" class="crm-accordion-wrapper crm-survey_search_form-accordion{if $force and !$buildSelector} collapsed{/if}">
<div class="crm-accordion-header">
{ts}Search Surveys{/ts}
</div><!-- /.crm-accordion-header -->
<div class="crm-accordion-body">
{strip}
<table class="form-layout-compressed">
<tr>
<td>{$form.survey_title.label}<br />
{$form.survey_title.html}
</td>
</tr>
<tr>
<td>{$form.activity_type_id.label}<br />
{$form.activity_type_id.html}
</td>
<td>{$form.survey_campaign_id.label}<br />
{$form.survey_campaign_id.html}
</td>
</tr>
<tr>
<td colspan="2">
{if $context eq 'search'}
{$form.buttons.html}
{else}
<a class="searchSurvey button" style="float:left;" href="#" title="{ts}Search{/ts}" onClick="searchSurveys( '{$qfKey}' );return false;">{ts}Search{/ts}</a>
{/if}
</td>
</tr>
</table>
{/strip}
</div>
</div>
</div>
{* search form ends here *}
<div id='surveyList'></div>
{/if} {* end of search form build *}
{literal}
<script type="text/javascript">
{/literal}
{* load selector when force *}
{if $force and !$buildSelector}
{literal}
CRM.$(function($) {
searchSurveys( {/literal}'{$qfKey}'{literal} );
});
{/literal}
{/if}
{literal}
function searchSurveys( qfKey )
{
var dataUrl = {/literal}"{crmURL h=0 q='search=1&snippet=4&type=survey'}"{literal};
//lets carry qfKey to retain form session.
if ( qfKey ) dataUrl = dataUrl + '&qfKey=' + qfKey;
CRM.$.get( dataUrl, null, function( surveyList ) {
CRM.$( '#surveyList' ).html( surveyList ).trigger('crmLoad');
//collapse the search form.
var searchFormName = '#search_form_' + {/literal}'{$searchFor}'{literal};
CRM.$( searchFormName + '.crm-accordion-wrapper:not(.collapsed)').crmAccordionToggle();
}, 'html' );
}
function loadSurveyList( )
{
var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q='snippet=4&className=CRM_Campaign_Page_AJAX&fnName=surveyList' }"{literal};
//build the search qill.
//get the search criteria.
var searchParams = {/literal}{$searchParams}{literal};
var surveyTypes = {/literal}{$surveyTypes}{literal};
var surveyCampaigns = {/literal}{$surveyCampaigns}{literal};
var noRecordFoundMsg = "{/literal}{ts escape='js'}No matches found for:{/ts}{literal}";
noRecordFoundMsg += '<div class="qill">';
var count = 0;
var searchQill = [];
for ( param in searchParams ) {
if ( val = CRM.$( '#' + param ).val( ) ) {
if ( param == 'activity_type_id' ) val = surveyTypes[val];
if ( param == 'survey_campaign_id' ) val = surveyCampaigns[val];
searchQill[count++] = searchParams[param] + ' : ' + val;
}
}
noRecordFoundMsg += searchQill.join( '<span class="font-italic"> ...AND... </span></div><div class="qill">' );
CRM.$( 'table.surveys', '#surveyList').dataTable({
"bFilter" : false,
"bAutoWidth" : false,
"bProcessing": false,
"bLengthChange": false,
"aaSorting": [],
"aoColumns":[{sClass:'crm-survey-id hiddenElement' },
{sClass:'crmf-title' },
{sClass:'crm-survey-campaign_id hiddenElement' },
{sClass:'crm-survey-campaign' },
{sClass:'crm-survey-activity_type_id hiddenElement' },
{sClass:'crm-survey-activity_type' },
{sClass:'crm-survey-release_frequency' },
{sClass:'crm-survey-default_number_of_contacts' },
{sClass:'crm-survey-max_number_of_contacts' },
{sClass:'crm-survey-is_default' },
{sClass:'crm-survey-is_active hiddenElement' },
{sClass:'crm-survey-isActive' },
{sClass:'crm-survey-result_id', bSortable:false},
{sClass:'crm-survey-action', bSortable:false},
{sClass:'crm-campaign-voterLinks', bSortable:false}
],
"sPaginationType": "full_numbers",
"sDom" : 'rt<"crm-datatable-pager-bottom"ip>',
"bServerSide": true,
"bJQueryUI": true,
"sAjaxSource": sourceUrl,
"asStripClasses" : [ "odd-row", "even-row" ],
"oLanguage":{"sEmptyTable" : noRecordFoundMsg,
"sZeroRecords" : noRecordFoundMsg },
"fnDrawCallback": function() {
$(this).trigger('crmLoad');
},
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
// Crm-editable
CRM.$(nRow).children().eq(1).addClass('crm-editable');
//insert the id for each row for enable/disable.
var rowId = 'survey-' + aData[0];
CRM.$(nRow).attr( 'id', rowId).addClass('crm-entity');
//handled disabled rows.
var isActive = Boolean(Number(aData[10]));
if ( !isActive ) CRM.$(nRow).addClass( 'disabled' );
//add id for yes/no column.
CRM.$(nRow).children().eq(11).attr( 'id', rowId + '_status' );
return nRow;
},
"fnServerData": function ( sSource, aoData, fnCallback ) {
var dataLength = aoData.length;
var count = 1;
var searchCriteria = [];
//get the search criteria.
var searchParams = {/literal}{$searchParams}{literal};
for ( param in searchParams ) {
fldName = param;
if ( param == 'survey_title' ) fldName = 'title';
if ( param == 'survey_campaign_id' ) fldName = 'campaign_id';
if ( val = CRM.$( '#' + param ).val( ) ) {
aoData[dataLength++] = {name: fldName, value: val};
}
searchCriteria[count++] = fldName;
}
//do search for surveys.
aoData[dataLength++] = {name: 'search_for', value: 'survey'};
//lets transfer search criteria.
aoData[dataLength++] = {name: 'searchCriteria', value:searchCriteria.join(',')};
CRM.$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} ); }
});
}
function displayResultSet( surveyId, surveyTitle, OptionGroupId ) {
var data = new Object;
data['option_group_id'] = OptionGroupId;
data['survey_id'] = surveyId;
var dataUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Campaign_Page_AJAX&fnName=loadOptionGroupDetails' }"{literal};
var content = '<tr><th>{/literal}{ts escape='js'}Label{/ts}{literal}</th><th>{/literal}{ts escape='js'}Value{/ts}{literal}</th><th>{/literal}{ts escape='js'}Recontact Interval{/ts}{literal}</th><th>{/literal}{ts escape='js'}Order{/ts}{literal}</th></tr>';
var setTitle = '{/literal}{ts escape='js'}Result Set for{/ts} {literal}' + surveyTitle;
CRM.$.post( dataUrl, data, function( opGroup ) {
if ( opGroup.status == 'success' ) {
var result = opGroup.result;
for( key in result ) {
var interval = '';
if ( result[key].interval && result[key].interval != 'undefined' ) {
interval = result[key].interval;
}
content += '<tr><td>'+ result[key].label +'</td><td>'+ result[key].value +'</td><td>'+ interval +'</td><td>'+ result[key].weight +'</td></tr>';
}
CRM.$("#survey-result-set-dialog").show( ).html('<table>'+content+'</table>').dialog({
title: setTitle,
modal: true,
width: 480,
overlay: {
opacity: 0.5,
background: "black"
},
beforeclose: function(event, ui) {
CRM.$(this).dialog("destroy");
}
});
}
}, "json" );
}
</script>
{/literal}

View file

@ -0,0 +1,78 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{if $context EQ 'Search'}
{include file="CRM/common/pager.tpl" location="top"}
{/if}
{strip}
<table class="selector row-highlight">
<thead class="sticky">
<tr>
{if !$single and $context eq 'Search' }
<th scope="col" title="Select Rows">{$form.toggleSelect.html}</th>
{/if}
{foreach from=$columnHeaders item=header}
<th scope="col">
{if $header.sort}
{assign var='key' value=$header.sort}
{$sort->_response.$key.link}
{else}
{$header.name}
{/if}
</th>
{/foreach}
</tr>
</thead>
{counter start=0 skip=1 print=false}
{foreach from=$rows item=row}
<tr id='rowid{$row.contact_id}' class="{cycle values="odd-row,even-row"} crm-campaign">
{if !$single }
{if $context eq 'Search' }
{assign var=cbName value=$row.checkbox}
<td>{$form.$cbName.html}</td>
{/if}
<td>{$row.contact_type} &nbsp;<a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$row.contact_id`"}">{$row.sort_name}</a></td>
<td>{$row.street_number}</td>
<td>{$row.street_name}</td>
<td>{$row.street_address}</td>
<td>{$row.city}</td>
<td>{$row.postal_code}</td>
<td>{$row.state_province}</td>
<td>{$row.country}</td>
<td>{$row.email}</td>
<td>{$row.phone}</td>
{/if}
</tr>
{/foreach}
</table>
{/strip}
{if $context EQ 'Search'}
{include file="CRM/common/pager.tpl" location="bottom"}
{/if}

View file

@ -0,0 +1,35 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<div class="crm-block crm-form-block crm-campaign-survey-delete-form-block">
<table class="form-layout">
<tr>
<td colspan="2">
<div class="status"><div class="icon inform-icon"></div>&nbsp;{ts 1=$surveyTitle}Are you sure you want to delete the %1 survey?{/ts}</div>
</td>
</tr>
</table>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>

View file

@ -0,0 +1,127 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<div class="crm-block crm-form-block crm-campaign-survey-main-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
{if $action eq 1}
<div class="help">
{ts}Use this form to Add new Survey. You can create a new Activity type, specific to this Survey or select an existing activity type for this Survey.{/ts}
</div>
{/if}
<table class="form-layout-compressed">
<tr class="crm-campaign-survey-main-form-block-title">
<td class="label">{$form.title.label}</td>
<td class="view-value">{$form.title.html}
<div class="description">{ts}Title of the survey.{/ts}</div></td>
</tr>
<tr class="crm-campaign-survey-main-form-block-campaign_id">
<td class="label">{$form.campaign_id.label}</td>
<td class="view-value">{$form.campaign_id.html} &nbsp; <span class="action-link crm-campaign-survey-new_campaign_link"><a href="{crmURL p='civicrm/campaign/add' q='reset=1'}" target="_blank" title="{ts}Opens New Campaign form in a separate window{/ts}">{ts}new campaign{/ts}</a></span>
<div class="description">{ts}Select the campaign for which survey is created.{/ts}</div>
</td>
</tr>
<tr class="crm-campaign-survey-main-form-block-activity_type_id">
<td class="label">{$form.activity_type_id.label}</td>
<td class="view-value">{$form.activity_type_id.html}
<div class="description">{ts}Select the Activity Type.{/ts}</div></td>
</tr>
<tr class="crm-campaign-survey-main-form-block-instructions">
<td class="label">{$form.instructions.label}</td>
<td class="view-value">{$form.instructions.html}
</tr>
<tr class="crm-campaign-survey-main-form-block-default_number_of_contacts">
<td class="label">{$form.default_number_of_contacts.label}</td>
<td class="view-value">{$form.default_number_of_contacts.html}
<div class="description">{ts}Maximum number of contacts that can be reserved for an interviewer at one time.{/ts}</div></td>
</tr>
<tr class="crm-campaign-survey-main-form-block-max_number_of_contacts">
<td class="label">{$form.max_number_of_contacts.label}</td>
<td class="view-value">{$form.max_number_of_contacts.html}
<div class="description">{ts}Maximum total number of contacts that can be in a reserved state for an interviewer.{/ts}</div></td>
</tr>
<tr class="crm-campaign-survey-main-form-block-release_frequency">
<td class="label">{$form.release_frequency.label}</td>
<td class="view-value">{$form.release_frequency.html}
<div class="description">{ts}Reserved respondents are released if they haven't been surveyed within this number of days. The Respondent Processor script must be run periodically to release respondents.{/ts} {docURL page="Managing Scheduled Jobs" resource="wiki"}</div> </td>
</tr>
<tr class="crm-campaign-survey-main-form-block-is_active">
<td class="label">{$form.is_active.label}</td>
<td class="view-value">{$form.is_active.html}
<div class="description">{ts}Is this survey active?{/ts}</div></td>
</tr>
<tr class="crm-campaign-survey-main-form-block-is_default">
<td class="label">{$form.is_default.label}</td>
<td class="view-value">{$form.is_default.html}
<div class="description">{ts}Is this the default survey?{/ts}</div></td>
</tr>
<tr class="crm-campaign-form-block-custom_data">
<td colspan="2">
<div id="customData"></div>
</td>
</tr>
</table>
<div id="customData"></div>
{*include custom data js file*}
{include file="CRM/common/customData.tpl"}
{literal}
<script type="text/javascript">
CRM.$(function($) {
{/literal}
CRM.buildCustomData( 'Survey' );
{literal}
});
</script>
{/literal}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>
{*include profile link function*}
{include file="CRM/common/buildProfileLink.tpl"}
{literal}
<script type="text/javascript">
//show edit profile field links
CRM.$(function($) {
// show edit for profile
$('select[id="profile_id"]').change( function( ) {
buildLinks( $(this), $(this).val());
});
// show edit links on form loads
var profileField = $('select[id="profile_id"]');
buildLinks( profileField, profileField.val());
});
</script>
{/literal}
{literal}
<script type="text/javascript">
CRM.$(function($) {
{/literal}
CRM.buildCustomData( 'Survey' );
{literal}
});
</script>
{/literal}

View file

@ -0,0 +1,42 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<div class="crm-block crm-form-block crm-campaign-survey-questions-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout-compressed">
<tr class="crm-campaign-survey-questions-form-block-contact_profile_id">
<td class="label">{$form.contact_profile_id.label}</td>
<td class="view-value">{$form.contact_profile_id.html}</td>
</tr>
<tr class="crm-campaign-survey-questions-form-block-activity_profile_id">
<td class="label">{$form.activity_profile_id.label}</td>
<td class="view-value">{$form.activity_profile_id.html}</td>
</tr>
</table>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>

View file

@ -0,0 +1,63 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<div class="crm-block crm-form-block crm-campaign-survey-results-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout-compressed">
<tr id='showoption'>
<td colspan="2">
<table class="form-layout-compressed">
{* Conditionally show table for setting up selection options - for field types = radio, checkbox or select *}
{include file="CRM/Campaign/Form/ResultOptions.tpl"}
</table>
</td>
</tr>
{* Create Report *}
<tr id='showoption'>
<td colspan="2">
<div id="new-group" class="crm-accordion-wrapper ">
<div class="crm-accordion-header">
{ts}Create Report{/ts}
</div><!-- /.crm-accordion-header -->
<div class="crm-accordion-body">
<table class="form-layout-compressed">
<tr>
<td class="description label">{$form.create_report.label}</td>
<td>{$form.create_report.html}</td>
</tr>
<tr>
<td class="description label">{$form.report_title.label}</td>
<td>{$form.report_title.html|crmAddClass:big}</td>
</tr>
</table>
</div><!-- /.crm-accordion-body -->
</div><!-- /.crm-accordion-wrapper -->
</td>
</tr>
</table>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>

View file

@ -0,0 +1,27 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{include file="CRM/common/TabHeader.tpl"}

View file

@ -0,0 +1 @@
{include file="CRM/Admin/Form/Options.tpl" }

View file

@ -0,0 +1,403 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{if $votingTab and $errorMessages}
<div class='messages status'>
<div class="icon inform-icon"></div>
<ul>
{foreach from=$errorMessages item=errorMsg}
<li>{ts}{$errorMsg}{/ts}</li>
{/foreach}
</ul>
</div>
</div>
{elseif $voterDetails}
<div class="form-item">
<fieldset>
{if $surveyValues.instructions}
<div id='survey_instructions' class='help'>{ts 1=$surveyValues.instructions}%1{/ts}</div>
{/if}
<div id='responseErrors' class = "hiddenElement messages crm-error"></div>
<div id='help'>
{if $votingTab}
{ts}Click <strong>record response</strong> button to update values for each respondent as needed.{/ts}
{else}
{ts}Click <strong>record response</strong> button to update values for each respondent as needed. <br />Click <strong>Release Respondents >></strong> button below to release any respondents for whom you haven't recorded a response. <br />Click <strong>Reserve More Respondents >></strong> button if you need to get more respondents to interview.{/ts}
{/if}
</div>
{if $instanceId}
{capture assign=instanceURL}{crmURL p="civicrm/report/instance/$instanceId" q="reset=1"}{/capture}
<div class="float-right"><a href='{$instanceURL}' class="button">{ts}Survey Report{/ts}</a></div>
{/if}
<div id="order-by-elements" class="civireport-criteria">
<table id="optionField" class="form-layout-compressed">
<tr>
<th></th>
<th>{ts}Column{/ts}</th>
<th>{ts}Order{/ts}</th>
</tr>
{section name=rowLoop start=1 loop=5}
{assign var=index value=$smarty.section.rowLoop.index}
<tr id="optionField_{$index}" class="form-item {cycle values="odd-row,even-row"}">
<td>
{if $index GT 1}
<a onclick="hideRow({$index}); return false;" name="orderBy_{$index}" href="#" class="form-link"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="{ts}hide field or section{/ts}"/></a>
{/if}
</td>
<td> {$form.order_bys.$index.column.html}</td>
<td> {$form.order_bys.$index.order.html}</td>
<td>
{if $index eq 1}
{$form.buttons._qf_Interview_submit_orderBy.html}
{/if}
</td>
</tr>
{/section}
</table>
<div id="optionFieldLink" class="add-remove-link">
<a onclick="showHideRow(); return false;" name="optionFieldLink" href="#" class="form-link"><img src="{$config->resourceBase}i/TreePlus.gif" class="action-icon" alt="{ts}show field or section{/ts}"/>{ts}another column{/ts}</a>
</div>
<script type="text/javascript">
var showRows = new Array('optionField_1');
var hideBlocks = new Array('optionField_2','optionField_3','optionField_4');
var rowcounter = 0;
{literal}
if (navigator.appName == "Microsoft Internet Explorer") {
for ( var count = 0; count < hideBlocks.length; count++ ) {
var r = document.getElementById(hideBlocks[count]);
r.style.display = 'none';
}
}
// hide and display the appropriate blocks as directed by the php code
on_load_init_blocks( showRows, hideBlocks, '' );
if (CRM.$("#order_bys_2_column").val()){
CRM.$("#optionField_2").show();
}
if (CRM.$("#order_bys_3_column").val()){
CRM.$("#optionField_3").show();
}
if (CRM.$("#order_bys_4_column").val()){
CRM.$("#optionField_4").show();
}
function hideRow(i) {
showHideRow(i);
// clear values on hidden field, so they're not saved
CRM.$('select#order_by_column_'+ i).val('');
CRM.$('select#order_by_order_'+ i).val('ASC');
}
{/literal}
</script>
</div>
<table id="voterRecords-{$instanceId}" class="display crm-copy-fields">
<thead>
<tr class="columnheader">
{foreach from=$readOnlyFields item=fTitle key=fName}
<th {if $fName neq 'contact_type'} class="contact_details"{/if}>{$fTitle}</th>
{/foreach}
{* display headers for profile survey fields *}
{if $surveyFields}
{foreach from=$surveyFields item=field key=fieldName}
{if $field.skipDisplay}
{continue}
{/if}
<th><img src="{$config->resourceBase}i/copy.png" alt="{ts 1=$field.title}Click to copy %1 from row one to all rows.{/ts}" fname="{$field.name}" class="action-icon" title="{ts}Click here to copy the value in row one to ALL rows.{/ts}" />{$field.title}</th>
{/foreach}
{/if}
<th><img src="{$config->resourceBase}i/copy.png" alt="{ts 1=note}Click to copy %1 from row one to all rows.{/ts}" fname="note" class="action-icon" title="{ts}Click here to copy the value in row one to ALL rows.{/ts}" />{ts}Note{/ts}</th>
<th><img src="{$config->resourceBase}i/copy.png" alt="{ts 1=result}Click to copy %1 from row one to all rows.{/ts}" fname="result" class="action-icon" title="{ts}Click here to copy the value in row one to ALL rows.{/ts}" />{ts}Result{/ts}</th>
<th><a id="interview_voter_button" class='button' style="float:left;" href="#" title={ts}Vote{/ts} onclick="registerInterviewforall( ); return false;">{ts}Record Responses for All{/ts}</a></th>
</tr>
</thead>
<tbody>
{foreach from=$componentIds item=voterId}
<tr id="row_{$voterId}" class="{cycle values="odd-row,even-row"}" entity_id="{$voterId}">
{foreach from=$readOnlyFields item=fTitle key=fName}
<td {if $fName neq 'contact_type'} class="name"{/if}>{$voterDetails.$voterId.$fName}</td>
{/foreach}
{* here build the survey profile fields *}
{if $surveyFields}
{foreach from=$surveyFields item=field key=fieldName}
{if $field.skipDisplay}
{continue}
{/if}
<td class="compressed {$field.data_type} {$fieldName}">
{if ( ( $fieldName eq 'thankyou_date' ) or ( $fieldName eq 'cancel_date' ) or ( $fieldName eq 'receipt_date' ) or ( $fieldName eq 'activity_date_time') ) and $field.is_view neq 1 }
{include file="CRM/common/jcalendar.tpl" elementName=$fieldName elementIndex=$voterId batchUpdate=1}
{elseif $fieldName|substr:0:5 eq 'phone'}
{assign var="phone_ext_field" value=$fieldName|replace:'phone':'phone_ext'}
{$form.field.$voterId.$fieldName.html}
{if $form.field.$voterId.$phone_ext_field.html}
&nbsp;{$form.field.$voterId.$phone_ext_field.html}
{/if}
{else}
{$form.field.$voterId.$fieldName.html}
{/if}
</td>
{/foreach}
{/if}
<td class='note'>{$form.field.$voterId.note.html}</td>
<td class='result'>{$form.field.$voterId.result.html}</td>
<td>
<a id="interview_voter_button_{$voterId}" class='button' style="float:left;" href="#" title={ts}Vote{/ts} onclick="registerInterview( {$voterId} ); return false;">
{ts}record response{/ts}
</a>
{if $allowAjaxReleaseButton}
<a id="release_voter_button_{$voterId}" class='button' href="#" title={ts}Release{/ts} onclick="releaseOrReserveVoter( {$voterId} ); return false;">
{ts}release{/ts}
</a>
{/if}
<span id='restmsg_vote_{$voterId}' class="ok" style="display:none;float:right;">
{ts}Response Saved.{/ts}
</span>
<span id='restmsg_release_or_reserve_{$voterId}' class="ok" style="display:none;float:right;">
{ts}Released.{/ts}
</span>
</td>
</tr>
{/foreach}
</tbody>
</table>
{if !$votingTab}
<div class="spacer"></div>
<div class="crm-submit-buttons">{$form.buttons._qf_Interview_cancel_interview.html}&nbsp;{$form.buttons._qf_Interview_next_interviewToRelease.html}&nbsp;{$form.buttons._qf_Interview_done_interviewToReserve.html}</div>
{/if}
</fieldset>
</div>
{literal}
<script type="text/javascript">
var updateVote = "{/literal}{ts escape='js'}Update Response{/ts}{literal}";
var updateVoteforall = "{/literal}{ts escape='js'}Update Responses for All{/ts}{literal}";
CRM.$(function($) {
var count = 0; var columns='';
CRM.$('#voterRecords-{/literal}{$instanceId}{literal} th').each( function( ) {
if ( CRM.$(this).attr('class') == 'contact_details' ) {
columns += '{"sClass": "contact_details"},';
}
else {
columns += '{ "bSortable": false },';
}
count++;
});
columns = columns.substring(0, columns.length - 1 );
eval('columns =[' + columns + ']');
//load jQuery data table.
CRM.$('table#voterRecords-{/literal}{$instanceId}{literal}').dataTable( {
"sPaginationType": "full_numbers",
"bJQueryUI" : true,
"aoColumns" : columns
});
});
function registerInterview( voterId ) {
//reset all errors.
CRM.$( '#responseErrors' ).hide( ).html( '' );
//collect all submitted data.
var data = new Object;
//get the values for common elements.
var fieldName = 'field_' + voterId + '_custom_';
var specialFieldType = new Array( 'radio', 'checkbox', 'select' );
CRM.$( '[id^="'+ fieldName +'"]' ).each( function( ) {
fieldType = CRM.$( this ).attr( 'type' );
if ( specialFieldType.indexOf( fieldType ) == -1 ) {
data[CRM.$(this).attr( 'id' )] = CRM.$( this ).val( );
}
});
//get the values for select.
CRM.$('select[id^="'+ fieldName +'"]').each( function( ) {
value = CRM.$(this).val( );
if (CRM.$(this).attr( 'multiple')) {
values = value;
value = '';
if ( values ) {
submittedValues = values.toString().split(",");
value = new Object;
for (val in submittedValues) {
currentVal = submittedValues[val];
value[currentVal] = currentVal;
}
}
}
data[CRM.$(this).attr('id')] = value;
});
var checkBoxField = 'field['+ voterId +'][custom_';
CRM.$('input:checkbox[name^="'+ checkBoxField +'"]').each( function( ) {
value = '';
if (CRM.$(this).is(':checked') == true) value = 1;
data[CRM.$(this).attr( 'name' )] = value;
});
var allRadios = new Object;
var radioField = 'field['+ voterId +'][custom_';
CRM.$('input:radio[name^="'+ radioField +'"]').each( function( ) {
radioName = CRM.$(this).attr( 'name' );
if (CRM.$(this).is(':checked') == true) {
data[radioName] = CRM.$(this).val();
}
allRadios[radioName] = radioName;
});
for (radioName in allRadios) {
if (!data.hasOwnProperty(radioName)) data[radioName] = '';
}
//carry contact related profile field data.
var fieldName = 'field_' + voterId;
var checkBoxFieldName = 'field[' + voterId + ']';
CRM.$('[id^="'+ fieldName +'"], [id^="'+ checkBoxFieldName +'"]').each(function( ) {
fldId = CRM.$(this).attr('id');
if (fldId.indexOf('_custom_') == -1 &&
fldId.indexOf('_result') == -1 &&
fldId.indexOf('_note') == -1 ) {
data[fldId] = CRM.$(this).val( );
}
});
var surveyActivityIds = {/literal}{$surveyActivityIds}{literal};
activityId = eval("surveyActivityIds.activity_id_" + voterId);
if (!activityId) return;
data['voter_id'] = voterId;
data['interviewer_id'] = {/literal}{$interviewerId}{literal};
data['activity_type_id'] = {/literal}{$surveyTypeId}{literal};
data['activity_id'] = activityId;
data['result'] = CRM.$( '#field_' + voterId + '_result' ).val( );
data['note'] = CRM.$( '#field_' + voterId + '_note' ).val( );
data['surveyTitle'] = {/literal}'{$surveyValues.title|escape:javascript}'{literal};
data['survey_id'] = {/literal}'{$surveyValues.id}'{literal};
var dataUrl = {/literal}"{crmURL p='civicrm/campaign/registerInterview' h=0}"{literal}
//post data to create interview.
CRM.$.post(dataUrl, data, function(interview) {
if ( interview.status == 'success' ) {
CRM.$("#row_"+voterId+' td.name').attr('class', 'name strikethrough' );
CRM.$('#restmsg_vote_' + voterId).fadeIn("slow").fadeOut("slow");
CRM.$('#interview_voter_button_' + voterId).html(updateVote);
CRM.$('#release_voter_button_' + voterId).hide( );
}
else if (interview.status == 'fail' && interview.errors) {
var errorList = '';
for (error in interview.errors) {
if (interview.errors[error]) errorList = errorList + '<li>' + interview.errors[error] + '</li>';
}
if ( errorList ) {
var allErrors = '<i class="crm-i fa-exclamation-triangle crm-i-red"></i> {/literal}{ts}Please correct the following errors in the survey fields below:{/ts}{literal}<ul>' + errorList + '</ul>';
CRM.$('#responseErrors').show( ).html(allErrors);
}
}
}, 'json');
}
function releaseOrReserveVoter(voterId) {
if (!voterId) return;
var surveyActivityIds = {/literal}{$surveyActivityIds}{literal};
activityId = eval("surveyActivityIds.activity_id_" + voterId);
if ( !activityId ) return;
var operation = 'release';
var isReleaseOrReserve = CRM.$('#field_' + voterId + '_is_release_or_reserve').val( );
if (isReleaseOrReserve == 1) {
operation = 'reserve';
isReleaseOrReserve = 0;
}
else {
isReleaseOrReserve = 1;
}
var data = new Object;
data['operation'] = operation;
data['isDelete'] = (operation == 'release') ? 1 : 0;
data['activity_id'] = activityId;
var actUrl = {/literal}
"{crmURL p='civicrm/ajax/rest' h=0 q='className=CRM_Campaign_Page_AJAX&fnName=processVoterData'}"
{literal};
//post data to release / reserve voter.
CRM.$.post( actUrl,
data,
function( response ) {
if (response.status == 'success') {
if ( operation == 'release' ) {
CRM.$( '#interview_voter_button_' + voterId ).hide( );
CRM.$( '#restmsg_release_or_reserve' + voterId ).fadeIn( 'slow' ).fadeOut( 'slow' );
CRM.$( '#row_' + voterId + ' td.name' ).addClass( 'disabled' );
CRM.$( '#release_voter_button_'+ voterId ).html( "{/literal}{ts escape='js'}reserve{/ts}{literal}" );
CRM.$( '#release_voter_button_' + voterId ).attr('title',"{/literal}{ts escape='js'}Reserve{/ts}{literal}");
}
else {
CRM.$( '#interview_voter_button_' + voterId ).show( );
CRM.$( '#restmsg_release_or_reserve' + voterId ).fadeIn( 'slow' ).fadeOut( 'slow' );
CRM.$( '#row_' + voterId + ' td.name' ).removeClass( 'disabled' );
CRM.$( '#release_voter_button_'+ voterId ).html( "{/literal}{ts escape='js'}release{/ts}{literal}" );
CRM.$( '#release_voter_button_' + voterId ).attr('title',"{/literal}{ts escape='js'}Release{/ts}{literal}");
}
CRM.$( '#field_' + voterId + '_is_release_or_reserve' ).val( isReleaseOrReserve );
}
},
'json');
}
function registerInterviewforall( ) {
var Ids = {/literal}{$componentIdsJson}{literal};
for (var contactid in Ids) {
if (CRM.$('#field_'+ Ids[contactid] +'_result').val()) {
registerInterview(Ids[contactid]);
CRM.$('#interview_voter_button').html(updateVoteforall);
}
}
}
</script>
{/literal}
{*include batch copy js js file*}
{include file="CRM/common/batchCopy.tpl"}
{/if}

View file

@ -0,0 +1,43 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<div class="form-item">
<span class="element-right">{$form.buttons.html}</span>
</div>
{if $rows }
<p></p>
{include file="CRM/Campaign/Form/Selector.tpl"}
<div class="form-item">
<span class="element-right">{$form.buttons.html}</span>
</div>
{else}
<div class="messages status no-popup">
<div class="icon inform-icon"/>
{ts}There are no records selected for Print.{/ts}
</div>
{/if}

View file

@ -0,0 +1,43 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<h3>
{ts}Release Respondents{/ts}
</h3>
<div class="crm-form-block crm-block crm-campaign-task-release-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout-compressed">
<tr class="crm-campaign-task-release-form-block-surveytitle">
<td colspan=2>
<div class="status">
<div class="icon inform-icon"></div>&nbsp;{ts 1=$surveyTitle}Do you want to release respondents for '%1' ?{/ts}
</div>
</td>
</tr>
<tr><td colspan=2>{include file="CRM/Contact/Form/Task.tpl"}</td></tr>
</table>
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>

View file

@ -0,0 +1,99 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<h3>
{ts}Add Respondent Reservation(s){/ts}
</h3>
<div class="crm-form-block crm-block crm-campaign-task-reserve-form-block">
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
<table class="form-layout-compressed">
<tr class="crm-campaign-task-reserve-form-block-surveytitle">
<td colspan=2>
<div class="status">
<div class="icon inform-icon"></div>&nbsp;{ts 1=$surveyTitle}Do you want to reserve respondents for '%1' ?{/ts}
</div>
</td>
</tr>
<tr><td colspan=2>{include file="CRM/Contact/Form/Task.tpl"}</td></tr>
</table>
{* Group options *}
{* New Group *}
<div id="new-group" class="crm-accordion-wrapper collapsed">
<div class="crm-accordion-header">
{ts}Add respondent(s) to a new group{/ts}
</div><!-- /.crm-accordion-header -->
<div class="crm-accordion-body">
<table class="form-layout-compressed">
<tr>
<td class="description label">{$form.newGroupName.label}</td>
<td>{$form.newGroupName.html}</td>
</tr>
<tr>
<td class="description label">{$form.newGroupDesc.label}</td>
<td>{$form.newGroupDesc.html}</td>
</tr>
</table>
</div><!-- /.crm-accordion-body -->
</div><!-- /.crm-accordion-wrapper -->
{* Existing Group *}
<div class="crm-accordion-wrapper crm-existing_group-accordion {if $hasExistingGroups} {else}collapsed{/if}">
<div class="crm-accordion-header">
{ts}Add respondent(s) to existing group(s){/ts}
</div><!-- /.crm-accordion-header -->
<div class="crm-accordion-body">
<div class="form-item">
<table><tr><td style="width: 14em;"></td><td>{$form.groups.html}</td></tr></table>
</div>
</div><!-- /.crm-accordion-body -->
</div><!-- /.crm-accordion-wrapper -->
{* End of group options *}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>
{literal}
<script type="text/javascript">
CRM.$(function($) {
setDefaultGroup( );
});
function setDefaultGroup( )
{
var invalidGroupName = {/literal}'{$invalidGroupName}'{literal};
if ( invalidGroupName ) {
cj("#new-group.collapsed").crmAccordionToggle();
} else {
cj("#newGroupName").val( '' );
cj("#newGroupDesc").val( '' );
}
}
</script>
{/literal}

View file

@ -0,0 +1,32 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<div class='spacer'></div>
<div class="form-item crm-block crm-form-block crm-campaign-form-block">
<p>
{$form.buttons.html}
</p>
</div>

View file

@ -0,0 +1,31 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{htxt id="id-campaign_id-title"}
{ts}Campaigns{/ts}
{/htxt}
{htxt id="id-campaign_id"}
{ts}Your organization can use Campaigns to track all constituent interactions related to a particular fund-raising or engagement effort. You can link activities, contributions, event participation, mailings, membership signups, and pledges to a particular campaign.{/ts}
{/htxt}

View file

@ -0,0 +1,84 @@
{* add campaigns to various components CRM-7362 *}
{if $campaignContext eq 'componentSearch'}
{* add campaign in component search *}
<tr class="{$campaignTrClass}">
{assign var=elementName value=$campaignInfo.elementName}
<td class="{$campaignTdClass}">{$form.$elementName.label}<br />
<div class="crm-select-container">{$form.$elementName.html}</div>
</td>
</tr>
{else}
{if $campaignInfo.showAddCampaign}
<tr class="{$campaignTrClass}">
<td class="label">{$form.campaign_id.label} {help id="id-campaign_id" file="CRM/Campaign/Form/addCampaignToComponent.hlp"}</td>
<td class="view-value">
{* lets take a call, either show campaign select drop-down or show add campaign link *}
{if $campaignInfo.hasCampaigns}
{$form.campaign_id.html|crmAddClass:huge}
{* show for add and edit actions *}
{if ( $action eq 1 or $action eq 2 )
and !$campaignInfo.alreadyIncludedPastCampaigns and $campaignInfo.includePastCampaignURL}
<br />
<a id='include-past-campaigns' href='#' onClick='includePastCampaigns( "campaign_id" ); return false;'>
&raquo;
{ts}Show past campaign(s) in this select list.{/ts}
</a>
{/if}
{else}
<div class="status">
{ts}There are currently no active Campaigns.{/ts}
{if $campaignInfo.addCampaignURL}
{capture assign="link"}href="{$campaignInfo.addCampaignURL}" class="action-item"{/capture}
{ts 1=$link}If you want to associate this record with a campaign, you can <a %1>create a campaign here</a>.{/ts}
{/if} {help id="id-campaign_id" file="CRM/Campaign/Form/addCampaignToComponent.hlp"}
</div>
{/if}
</td>
</tr>
{literal}
<script type="text/javascript">
function includePastCampaigns()
{
//hide past campaign link.
cj( "#include-past-campaigns" ).hide( );
var campaignUrl = {/literal}'{$campaignInfo.includePastCampaignURL}'{literal};
cj.post( campaignUrl,
null,
function( data ) {
if ( data.status != 'success' ) return;
//first reset all select options.
cj( "#campaign_id" ).val( '' );
cj( "#campaign_id" ).html( '' );
cj('input[name="included_past_campaigns"]').val( 1 );
var campaigns = data.campaigns;
//build the new options.
for ( campaign in campaigns ) {
title = campaigns[campaign].title;
value = campaigns[campaign].value;
className = campaigns[campaign].class;
if ( !title ) continue;
cj('#campaign_id').append( cj('<option></option>').val(value).html(title).addClass(className) );
}
},
'json');
}
</script>
{/literal}
{/if}{* add campaign to component if closed. *}
{/if}{* add campaign to component search if closed. *}

View file

@ -0,0 +1,39 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{* CiviCampaign DashBoard (launch page) *}
{if !empty($subPageType)}
{* load campaign/survey/petition tab *}
{include file="CRM/Campaign/Form/Search/$subPageType.tpl"}
{else}
{include file="CRM/common/TabHeader.tpl"}
<div class="clear"></div>
{/if}

View file

@ -0,0 +1,76 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{* this template is used for displaying survey information *}
{if $surveys}
<div class="action-link">
<a href="{$addSurveyUrl}" class="button">
<span><i class="crm-i fa-plus-circle"></i> {ts}Add Survey{/ts}</span>
</a>
</div>
{include file="CRM/common/enableDisableApi.tpl"}
{include file="CRM/common/jsortable.tpl"}
<div id="surveyList">
<table id="options" class="display">
<thead>
<tr>
<th>{ts}Survey{/ts}</th>
<th>{ts}Campaign{/ts}</th>
<th>{ts}Survey Type{/ts}</th>
<th>{ts}Release Frequency{/ts}</th>
<th>{ts}Max Number Of Contacts{/ts}</th>
<th>{ts}Default Number Of Contacts{/ts}</th>
<th>{ts}Default?{/ts}</th>
<th>{ts}Active?{/ts}</th>
<th id="nosort"></th>
</tr>
</thead>
{foreach from=$surveys item=survey}
<tr id="survey-{$survey.id}" class="crm-entity {if $survey.is_active neq 1} disabled{/if}">
<td>{$survey.title}</td>
<td>{$survey.campaign_id}</td>
<td>{$survey.activity_type_id}</td>
<td>{$survey.release_frequency}</td>
<td>{$survey.max_number_of_contacts}</td>
<td>{$survey.default_number_of_contacts}</td>
<td>{if $survey.is_default}<img src="{$config->resourceBase}i/check.gif" alt="{ts}Default{/ts}" /> {/if}</td>
<td id="row_{$survey.id}_status">{if $survey.is_active}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}</td>
<td class="crm-report-optionList-action">{$survey.action}</td>
</tr>
{/foreach}
</table>
</div>
{else}
<div class="status">
<div class="icon inform-icon"></div>&nbsp;{ts}None found.{/ts}
</div>
{/if}
<div class="action-link">
<a href="{$addSurveyUrl}" class="button">
<span><i class="crm-i fa-plus-circle"></i> {ts}Add Survey{/ts}</span>
</a>
</div>

View file

@ -0,0 +1,46 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>&nbsp;
{if $success}
{ts 1=$display_name 2=$email}<strong>%1 - your email address '%2' has been successfully verified.</strong>{/ts}
{else}
{ts}Oops. We encountered a problem in processing your email verification. Please contact the site administrator.{/ts}
{/if}
</div>
{if $success}
<div id="thankyou_text" class="crm-section thankyou_text-section">
{if $thankyou_text}
{$thankyou_text}
{else}
<p><div class="bold">{ts}Thank you for signing the petition.{/ts}</div></p>
{/if}
</div>
{if $is_share}
{include file="CRM/Campaign/Page/Petition/SocialNetwork.tpl"}
{/if}
{/if}

View file

@ -0,0 +1,112 @@
{literal}
<script>
if (FB != undefined) { // reprocess the XFBML tags if called in ajax (otherwise, that's done by the init)
FB.XFBML.parse(document.getElementById('socialnetwork'));
}
</script>
{/literal}
{*
You might have a specific page that displays more information that the form.
This is an example (taken from http://www.etownhall.eu) that assumes that there is a Drupal node
that contains a cck field 'petitionid'.
This node is going to be used for the social networks promotion instead of the form.
This is an example of how to fetch content from a Drupal node (that contains a cck field 'petitionid')
You will want to customise it based on your configuration.
How to install ?
Create a custom template folder and copy this file into CRM/Campaign/Page/Petition/SocialNetwork.tpl
This assumes you are on Drupal, have installed the fb module (drupal.org/project/fb),
and in general, is very unlikely to work directly. Please consider this as an example,
and modify to fit your specific configuration.
*}
{php}
/**
* Function to get Petition Drupal Node Path/Alias
*
* @param int $surveyId
* @static
*/
function &getPetitionDrupalNodeData( $surveyId ) {
/*
Other approach: using the view
$view=views_get_view("node_petition"); //replace with the name of your view
$view->set_arguments(array($surveyId));
$view->build('default'); //use "default" if you want to retrieve the default display of your view, if not, the name of the specific display
$view->execute();
foreach($view->result as $result) { //$result
// Do something with $result here. Each result is an object, so for example you can access the nid using $result->nid
}
*/
$config = CRM_Core_Config::singleton( );
$surveyId = (int)$surveyId;// sql injection protection
// if Drupal node uses cck integer field petitionid
// there will be a 'content_field_petitionid' table in the Drupal database
// that stores field_petitionid_value against nid (node id)
$result = db_query("SELECT * FROM content_type_petition WHERE field_petitionid_value = " . $surveyId);
global $base_url;
$petition = array();
$data = db_fetch_array ($result);
if (!$data) {
return null;
}
$petition_node = node_load ($data['nid']);
$petition_node->url = $base_url . "/" . drupal_get_path_alias("node/".$data['nid']);
$petition_node->title = node_page_title(node_load($data['nid']));
return array_merge ((array)$petition_node,(array)$data);
}
global $base_url;
$this->assign('base_url', $base_url);
$email = $this->get_template_vars('email');
$noscript = $this->get_template_vars('noscript');
$petition_id = $this->get_template_vars('petition_id');
$node = getPetitionDrupalNodeData($petition_id);
$this->assign_by_ref('node', $node);
{/php}
{if $node.nid}
{* print additional thank you email text from Drupal petition node if there is a cck text field 'email' *}
{if $email}
<br />{$node.field_email.0.value}
{/if}
<!-- Social Networking -->
<h2>Help spread the word about "{$node.title}"</h2>
Please help us and let your friends, colleagues and followers know about our campaign.
<h3>Do you use Facebook or Twitter ?</h3>
<div class="socialnetwork">
{if $noscript}
<p>Share it on Facebook or tweet it on Twitter.</p>
<a href="http://www.facebook.com/sharer.php?u={$node.url}&amp;t={$node.title}">
<img src="{$base_url}/sites/all/modules/civicrm/i/fbshare.png" width="70px" height="28px" title="Facebook Share Button">
</a>
&nbsp;
&nbsp;
&nbsp;
&nbsp;
<a href="http://twitter.com/share?url={$node.url}&amp;text=Sign this, I did: {$node.title}">
<img src="{$base_url}/sites/all/modules/civicrm/i/tweet.png" width="55px" height="20px" title="Tweet Button"">
</a>
{else}
<p>Like it on Facebook or tweet it on Twitter.</p>
<fb:like href="{$node.url}"></fb:like>
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<a href="http://twitter.com/share?url={$node.url}&text=Sign this, I did: {$node.title}" class="twitter-share-button" title="tweet about this petition">Tweet</a>
{/if}
</div>
<h3>Do you have a website for your organisation or yourself?</h3>
You can write a story about it - don't forget to add the link to <a href="{$node.url}">{$node.url}.</a>
{/if}

View file

@ -0,0 +1,7 @@
{*
Default Thank-you page for verified signers.
You might have a specific page that displays more information that the form.
Check SocialNetwork.drupal as an example
*}
{capture assign=petitionURL}{crmURL p='civicrm/petition/sign' q="sid=`$petition_id`" a=1 fe=1 h=1}{/capture}
{include file="CRM/common/SocialNetwork.tpl" url=$petitionURL title=$petitionTitle pageURL=$petitionURL}

View file

@ -0,0 +1,60 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{if $status_id eq 2} {* Signer needs to confirm signature. *}
<h2>{ts}STEP 2: Please Check Your Email{/ts}</h2>
<p>{ts}To complete and confirm your signature, please follow the activation instructions sent to the email address you provided.{/ts}</p>
<p>
<strong>{ts}IMPORTANT{/ts}</strong>: {ts}Before we can add your signature, you must validate your email address by clicking on the activation link in the confirmation e-mail. Sometimes our confirmation emails get flagged as spam and are moved to your bulk folder.{/ts}
<br/>
{ts}If you haven't received an email within a few minutes, please check your spam folder.{/ts}
</p>
{/if}
{if $status_id eq 4}
<p>{ts}You have already signed this petition but we<strong>need to confirm your email address</strong>.{/ts}</p>
<b>{ts}IMPORTANT{/ts}</b>
: {ts}Before we can add your signature, you must validate your email address by clicking on the activation link in the confirmation e-mail. Sometimes our confirmation emails get flagged as spam and are moved to your spam folder.{/ts}
<br/>
{ts}If you haven't received an email from us, check your spam folder, it might have been wrongly classified.{/ts}
<br/>
{/if}
{if $status_id eq 5}
<p>{ts}You have already signed this petition.{/ts}</p>
{/if}
{if $status_id neq 2}{* if asked to confirm the email, focus on that and don't put additional messages *}
{if $thankyou_text}
<div id="thankyou_text" class="crm-section thankyou_text-section">
{$thankyou_text}
</div>
{/if}
{if $is_share}
{include file="CRM/Campaign/Page/Petition/SocialNetwork.tpl" petition_id=$survey_id petitionTitle=$petitionTitle}
{/if}
{/if}

View file

@ -0,0 +1,55 @@
<div class="crm-content-block crm-block">
{if ($action eq 1) or ($action eq 2) or ($action eq 8) }
{include file="CRM/Campaign/Form/SurveyType.tpl" }
{else}
{if $rows}
<div class="action-link">
{crmButton p=$addSurveyType.0 q=$addSurveyType.1 icon="crm-i fa-plus-circle"}{ts 1=$GName}Add %1{/ts}{/crmButton}
</div>
<div id={$gName}>
{strip}
{* handle enable/disable actions*}
{include file="CRM/common/enableDisableApi.tpl"}
<table class="row-highlight">
<thead>
<tr>
<th>
{ts}Label{/ts}
</th>
<th>
{ts}Value{/ts}
</th>
<th>{ts}Description{/ts}</th>
<th>{ts}Order{/ts}</th>
<th>{ts}Reserved{/ts}</th>
<th>{ts}Enabled?{/ts}</th>
<th></th>
</tr>
</thead>
{foreach from=$rows item=row}
<tr id="option_value-{$row.id}" class="crm-entity crm-admin-options_{$row.id} {if NOT $row.is_active} disabled{/if}">
<td class="crm-admin-options-label crm-editable" data-field="label">{$row.label}</td>
<td class="crm-admin-options-value">{$row.value}</td>
<td class="crm-admin-options-description">{$row.description}</td>
<td class="nowrap crm-admin-options-order">{$row.weight}</td>
<td class="crm-admin-options-is_reserved">{if $row.is_reserved eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td class="crm-admin-options-is_active" id="row_{$row.id}_status">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td>{$row.action|replace:'xx':$row.id}</td>
</tr>
{/foreach}
</table>
{/strip}
<div class="action-link">
{crmButton p=$addSurveyType.0 q=$addSurveyType.1 icon="crm-i fa-plus-circle"}{ts 1=$GName}Add %1{/ts}{/crmButton}
</div>
</div>
{else}
<div class="messages status no-popup">
<div class="icon inform-icon"> &nbsp;
{ts p=$addSurveyType.0 q=$addSurveyType.1}There are no survey types entered. You can <a href='%1'>add one</a>.{/ts}</div>
</div>
{/if}
{/if}
</div>

View file

@ -0,0 +1,55 @@
{*
+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*}
{* Voting Tab Interface - Easy way to get the voter Interview. *}
{if $subPageType eq 'interview'}
{* build the voter interview grid here *}
{include file='CRM/Campaign/Form/Task/Interview.tpl'}
{elseif $subPageType eq 'reserve'}
{* build the ajax search and voters reserve interface here *}
{include file='CRM/Campaign/Form/Gotv.tpl'}
{elseif $tabHeader}
{include file="CRM/common/TabHeader.tpl"}
<script type="text/javascript">
{* very crude refresh of tabs - fixme: use datatable native refresh method *}
{literal}
CRM.$(function($) {
$('#mainTabContainer').on('tabsbeforeactivate', function(e, ui) {
// fixme - can't search more than once! Uncomment this code, switching tabs gives qfkey error.
//if (ui.newTab.is('#tab_reserve')) {
//$('.searchVoter.button').click();
ui.oldPanel.data('civiCrmSnippet') && ui.oldPanel.crmSnippet('destroy');
//}
});
});
{/literal}
</script>
{else}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>
{ts}You are not authorized to access this page.{/ts}
</div>
{/if}