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,192 @@
{*
+--------------------------------------------------------------------+
| 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 |
+--------------------------------------------------------------------+
*}
{* Custom Data view mode*}
{assign var="showEdit" value=1}
{assign var="rowCount" value=1}
{foreach from=$viewCustomData item=customValues key=customGroupId}
{foreach from=$customValues item=cd_edit key=cvID}
{crmRegion name="custom-data-view-`$cd_edit.name`"}
{if $cd_edit.help_pre}
<div class="messages help">{$cd_edit.help_pre}</div>
{/if}
{if $multiRecordDisplay neq 'single'}
<table class="no-border">
{assign var='index' value=$groupId|cat:"_$cvID"}
{if ($showEdit && $cd_edit.editable && $groupId) && ($editOwnCustomData or $editCustomData)}
<tr>
<td>
<a
href="{crmURL p="civicrm/contact/view/cd/edit" q="tableId=`$contactId`&cid=`$contactId`&groupID=`$groupId`&action=update&reset=1"}"
class="button" style="margin-left: 6px;"><span><i class="crm-i fa-pencil"></i> {ts 1=$cd_edit.title}Edit %1{/ts}</span></a><br/><br/>
</td>
</tr>
{/if}
{assign var="showEdit" value=0}
<tr>
<td id="{$cd_edit.name}_{$index}" class="section-shown form-item">
<div class="crm-accordion-wrapper {if $cd_edit.collapse_display eq 0 or $skipTitle} {else}collapsed{/if}">
{if !$skipTitle}
<div class="crm-accordion-header">
{$cd_edit.title}
</div>
{/if}
<div class="crm-accordion-body">
{if $groupId and $cvID and $editCustomData and $cd_edit.editable}
<div class="crm-submit-buttons">
<a href="#" class="crm-hover-button crm-custom-value-del"
data-post='{ldelim}"valueID": "{$cvID}", "groupID": "{$customGroupId}", "contactId": "{$contactId}", "key": "{crmKey name='civicrm/ajax/customvalue'}"{rdelim}'
title="{ts 1=$cd_edit.title|cat:" `$rowCount`"}Delete %1{/ts}">
<i class="crm-i fa-trash"></i> {ts}Delete{/ts}
</a>
</div>
{/if}
{foreach from=$cd_edit.fields item=element key=field_id}
<table class="crm-info-panel">
<tr>
{if $element.options_per_line != 0}
<td class="label">{$element.field_title}</td>
<td class="html-adjust">
{* sort by fails for option per line. Added a variable to iterate through the element array*}
{foreach from=$element.field_value item=val}
{$val}
<br/>
{/foreach}
</td>
{else}
<td class="label">{$element.field_title}</td>
{if $element.field_data_type == 'Money'}
{if $element.field_type == 'Text'}
<td class="html-adjust">{$element.field_value|crmMoney}</td>
{else}
<td class="html-adjust">{$element.field_value}</td>
{/if}
{else}
<td class="html-adjust">
{if $element.contact_ref_id}
<a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
{/if}
{if $element.field_data_type == 'Memo'}
{$element.field_value|nl2br}
{else}
{$element.field_value}
{/if}
{if $element.contact_ref_id}
</a>
{/if}
</td>
{/if}
{/if}
</tr>
</table>
{/foreach}
{assign var="rowCount" value=$rowCount+1}
</div>
<!-- end of body -->
<div class="clear"></div>
</div>
<!-- end of main accordion -->
</td>
</tr>
</table>
{else}
{foreach from=$cd_edit.fields item=element key=field_id}
<div class="crm-section">
{if $element.options_per_line != 0}
<div class="label">{$element.field_title}</div>
<div class="content">
{* sort by fails for option per line. Added a variable to iterate through the element array*}
{foreach from=$element.field_value item=val}
{$val}
<br/>
{/foreach}
</div>
{else}
<div class="label">{$element.field_title}</div>
{if $element.field_type == 'File'}
<div class="content">
{if $element.field_value}
{$element.field_value}
{else}
<br/>
{/if}
</div>
{else}
{if $element.field_data_type == 'Money'}
{if $element.field_type == 'Text'}
<div class="content">{if $element.field_value}{$element.field_value|crmMoney}{else}<br/>{/if}</div>
{else}
<div class="content">{if $element.field_value}{$element.field_value}{else}<br/>{/if}</div>
{/if}
{else}
<div class="content">
{if $element.contact_ref_id}
<a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
{/if}
{if $element.field_data_type == 'Memo'}
{$element.field_value|nl2br}
{else}
{if $element.field_value}{$element.field_value} {else}<br/>{/if}
{/if}
{if $element.contact_ref_id}
</a>
{/if}
</div>
{/if}
{/if}
{/if}
</div>
{/foreach}
{/if}
{if $cd_edit.help_post}
<div class="messages help">{$cd_edit.help_post}</div>
{/if}
{/crmRegion}
{/foreach}
{/foreach}
{*currently delete is available only for tab custom data*}
{if $groupId}
<script type="text/javascript">
{literal}
CRM.$(function($) {
// Handle delete of multi-record custom data
$('#crm-container')
.off('.customValueDel')
.on('click.customValueDel', '.crm-custom-value-del', function(e) {
e.preventDefault();
var $el = $(this),
msg = '{/literal}{ts escape="js"}The record will be deleted immediately. This action cannot be undone.{/ts}{literal}';
CRM.confirm({title: $el.attr('title'), message: msg})
.on('crmConfirm:yes', function() {
var url = CRM.url('civicrm/ajax/customvalue');
var request = $.post(url, $el.data('post'))
.done(CRM.refreshParent($el));
CRM.status({success: '{/literal}{ts escape="js"}Record Deleted{/ts}{literal}'}, request);
});
});
});
{/literal}
</script>
{/if}

View file

@ -0,0 +1,83 @@
{*
+--------------------------------------------------------------------+
| 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 $action eq 1 or $action eq 2 or $action eq 4}
{include file="CRM/Custom/Form/Field.tpl"}
{elseif $action eq 8}
{include file="CRM/Custom/Form/DeleteField.tpl"}
{elseif $action eq 1024 }
{include file="CRM/Custom/Form/Preview.tpl"}
{else}
{if $customField}
<div id="field_page">
{strip}
{* handle enable/disable actions*}
{include file="CRM/common/enableDisableApi.tpl"}
<table id="options" class="row-highlight">
<thead>
<tr>
<th>{ts}Field Label{/ts}</th>
<th>{ts}Data Type{/ts}</th>
<th>{ts}Field Type{/ts}</th>
<th>{ts}Order{/ts}</th>
<th>{ts}Req?{/ts}</th>
<th>{ts}Searchable?{/ts}</th>
<th>{ts}Enabled?{/ts}</th>
<th></th>
</tr>
</thead>
<tbody>
{foreach from=$customField item=row}
<tr id="CustomField-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"}{if NOT $row.is_active} disabled{/if}">
<td class="crm-editable" data-field="label">{$row.label}</td>
<td>{$row.data_type}</td>
<td>{$row.html_type}</td>
<td class="nowrap">{$row.weight}</td>
<td class="crm-editable" data-type="boolean" data-field="is_required">{if $row.is_required eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td class="crm-editable" data-type="boolean" data-field="is_searchable">{if $row.is_searchable eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td>{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}
</tbody>
</table>
{/strip}
</div>
{else}
{if $action eq 16}
<div class="messages status no-popup crm-empty-table">
<img src="{$config->resourceBase}i/Inform.gif" alt="{ts}status{/ts}"/>
{ts}None found.{/ts}
</div>
{/if}
{/if}
<div class="action-link">
{crmButton p='civicrm/admin/custom/group/field/add' q="reset=1&action=add&gid=$gid" id="newCustomField" class="action-item" icon="plus-circle"}{ts}Add Custom Field{/ts}{/crmButton}
{crmButton p="civicrm/admin/custom/group" q="reset=1" class="cancel" icon="times"}{ts}Done{/ts}{/crmButton}
</div>
{/if}

View file

@ -0,0 +1,115 @@
{*
+--------------------------------------------------------------------+
| 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-group_intro-title"}
{ts}Custom Fields{/ts}
{/htxt}
{htxt id="id-group_intro"}
{ts}Use this form to set the title, the type of record the fields will be used for, and set-level help. You will then be able to add any number of fields to the set.{/ts} {docURL page="user/organising-your-data/custom-fields"}
{/htxt}
{htxt id="id-title-title"}
{ts}Title{/ts}
{/htxt}
{htxt id="id-title"}
{ts}For 'inline' display custom sets, this title will appear as the fieldset legend. If you choose the 'tab' display style (which is available for Contact record custom fields), the title will be used for the navigation tab.{/ts}
{/htxt}
{htxt id="id-display_style-title"}
{ts}Display Style{/ts}
{/htxt}
{htxt id="id-display_style"}
{ts}Select 'Inline' to include this set of fields in the main contact Add/Edit form and Contact Summary screens. Select 'Tab' or 'Tab with Table' to create a separate navigation tab for display and editing these values (generally for less frequently accessed and/or larger sets of fields). 'Tab with Table' is recommended for customs data sets which allow multiple records.{/ts}
<p class="font-italic">{ts}NOTE: This setting applies only to custom sets used for Contact records (e.g. Individuals, Households, Organizations, or ALL contact types).{/ts}</p>
{/htxt}
{htxt id="id-extends-title"}
{ts}Entity Type{/ts}
{/htxt}
{htxt id="id-extends"}
{ts}Select the type of record that this set of custom fields is applicable for. You can configure custom data for a specific type of contact (e.g. Individuals but NOT Organizations), ANY type of contact, or other record types such as activities, contributions, memberships and event participants.{/ts}
<p>{ts}EXAMPLE: If you are using CiviEvent, and you want to collect information from people registering for your events, select "Participants". If the information is specific to one type of participant (e.g. event volunteers), select "Participants (role)" and then select the role (e.g. 'Volunteer').{/ts}</p>
<p>{ts}If your site uses Contact Subtypes, you can assign this set of custom fields to a specific subtype (e.g. 'Student'), OR you can select '- Any -' which makes the fields available to contacts of the parent type (e.g. 'Individual') as well as to any subtypes.{/ts}</p>
{/htxt}
{capture assign=importMultipleURL}{crmURL p="civicrm/import/custom" q="reset=1"}{/capture}
{htxt id=id-is_multiple-title"}
{ts}Allow Multiple Records{/ts}
{/htxt}
{htxt id=id-is_multiple"}
<p>{ts}Checking this box allows you to enter multiple sets of values for a given contact.{/ts}</p>
<p>{ts}<strong>EXAMPLE:</strong> When creating a set of custom fields used to collect <strong>Employment History</strong> - you might have fields for Job Title, Start Date, End Date, and Reason for Leaving. Checking the "multiple records" box allows you to collect information for multiple jobs.{/ts}</p>
<p>{ts}You can also set the maximum number of records which can be recorded per contact. Using the previous example, you might only want data for the three most recent jobs.{/ts}</p>
<p>{ts 1=$importMultipleURL}Use the <a href="%1">Multi-value Custom Data Import tool</a> to import data into multiple record custom fields (contact records must already exist).{/ts}</p>
<p>
{ts}CAUTION: The following features are NOT available for custom fields in 'multiple record' custom set:{/ts}
<ul>
<li>{ts}They can not be Exported{/ts}</li>
<li>{ts}If they are included in a report as a display column, only the first set of values are shown.{/ts}</li>
</ul>
</p>
{/htxt}
{htxt id=id-max_multiple-title"}
{ts}Maximum Records{/ts}
{/htxt}
{htxt id=id-max_multiple"}
{ts}If you want to set a specific limit on the maximum number of records, enter that number. Otherwise leave this field blank.{/ts}
{/htxt}
{htxt id="id-weight-title"}
{ts}Weight{/ts}
{/htxt}
{htxt id="id-weight"}
{ts}Weight controls the order in which custom field sets are presented when there are more than one. Enter a positive or negative integer - lower numbers are displayed ahead of higher numbers.{/ts}
{/htxt}
{htxt id="id-collapse-title"}
{ts}Collapsed on Page{/ts}
{/htxt}
{htxt id="id-collapse"}
{ts}Check this box if you want only the title for this fieldset to be displayed when the page is initially loaded (fields are hidden).{/ts}
{/htxt}
{htxt id="id-collapse-adv-title"}
{ts}Collapsed on Search{/ts}
{/htxt}
{htxt id="id-collapse-adv"}
{ts}Check this box if you want only the title for this fieldset to be displayed when the page is initially loaded (fields are hidden) on advanced search.{/ts}
{/htxt}
{htxt id="id-help_pre-title"}
{ts}Pre Help{/ts}
{/htxt}
{htxt id="id-help_pre"}
{ts}Explanatory text displayed at the beginning of this sets of fields.{/ts}
{/htxt}
{htxt id="id-help_post-title"}
{ts}Post Help{/ts}
{/htxt}
{htxt id="id-help_post"}
{ts}Explanatory text displayed below this set of fields.{/ts}
{/htxt}

View file

@ -0,0 +1,89 @@
{*
+--------------------------------------------------------------------+
| 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 |
+--------------------------------------------------------------------+
*}
{* The name "custom data group" is replaced by "custom data set" *}
{if $action eq 1 or $action eq 2 or $action eq 4}
{include file="CRM/Custom/Form/Group.tpl"}
{elseif $action eq 1024}
{include file="CRM/Custom/Form/Preview.tpl"}
{elseif $action eq 8}
{include file="CRM/Custom/Form/DeleteGroup.tpl"}
{else}
<div class="help">
{ts}Custom data is stored in custom fields. Custom fields are organized into logically related custom data sets (e.g. Volunteer Info). Use custom fields to collect and store custom data which are not included in the standard CiviCRM forms. You can create one or many sets of custom fields.{/ts} {docURL page="user/organising-your-data/custom-fields"}
</div>
{if $rows}
<div class="crm-content-block crm-block">
<div id="custom_group">
{strip}
{* handle enable/disable actions*}
{include file="CRM/common/enableDisableApi.tpl"}
<table id="options" class="row-highlight">
<thead>
<tr>
<th>{ts}Set{/ts}</th>
<th>{ts}Enabled?{/ts}</th>
<th>{ts}Used For{/ts}</th>
<th>{ts}Type{/ts}</th>
<th>{ts}Order{/ts}</th>
<th>{ts}Style{/ts}</th>
<th></th>
</tr>
</thead>
<tbody>
{foreach from=$rows item=row}
<tr id="CustomGroup-{$row.id}" data-action="setvalue" class="crm-entity {cycle values="odd-row,even-row"} {$row.class}{if NOT $row.is_active} disabled{/if}">
<td class="crmf-title crm-editable">{$row.title}</td>
<td id="row_{$row.id}_status">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
<td>{if $row.extends eq 'Contact'}{ts}All Contact Types{/ts}{else}{$row.extends_display}{/if}</td>
<td>{$row.extends_entity_column_value}</td>
<td class="nowrap">{$row.weight}</td>
<td>{$row.style_display}</td>
<td>{$row.action|replace:'xx':$row.id}</td>
</tr>
{/foreach}
</tbody>
</table>
{if NOT ($action eq 1 or $action eq 2) }
<div class="action-link">
{crmButton p='civicrm/admin/custom/group' q="action=add&reset=1" id="newCustomDataGroup" icon="plus-circle"}{ts}Add Set of Custom Fields{/ts}{/crmButton}
</div>
{/if}
{/strip}
</div>
</div>
{else}
{if $action ne 1} {* When we are adding an item, we should not display this message *}
<div class="messages status no-popup">
<img src="{$config->resourceBase}i/Inform.gif" alt="{ts}status{/ts}"/> &nbsp;
{capture assign=crmURL}{crmURL p='civicrm/admin/custom/group' q='action=add&reset=1'}{/capture}
{ts 1=$crmURL}No custom data groups have been created yet. You can <a id="newCustomDataGroup" href='%1'>add one</a>.{/ts}
</div>
{/if}
{/if}
{/if}

View file

@ -0,0 +1,166 @@
{*
+--------------------------------------------------------------------+
| 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 $action eq 1 or $action eq 2 or $action eq 4 or $action eq 8}
{include file="CRM/Custom/Form/Option.tpl"}
{else}
{if $reusedNames}
<div class="message status">
<div class="icon inform-icon"></div> &nbsp; {ts 1=$reusedNames}These Multiple Choice Options are shared by the following custom fields: %1{/ts}
</div>
{/if}
<div id="field_page">
<p></p>
<div class="form-item">
{* handle enable/disable actions*}
{include file="CRM/common/enableDisableApi.tpl"}
<table class="crm-option-selector">
<thead>
<tr class="columnheader">
<th class='crm-custom_option-label'>{ts}Label{/ts}</th>
<th class='crm-custom_option-value'>{ts}Value{/ts}</th>
<th class='crm-custom_option-default_value'>{ts}Default{/ts}</th>
<th class='crm-custom_option-is_active'>{ts}Enabled?{/ts}</th>
<th class='crm-custom_option-links'>&nbsp;</th>
<th class='hiddenElement'>&nbsp;</th>
</tr>
</thead>
</table>
{literal}
<script type="text/javascript">
CRM.$(function($) {
var crmOptionSelector;
buildOptions();
function buildOptions() {
var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/optionlist" h=0 q="snippet=4&fid=$fid&gid=$gid"}'{literal};
var $context = $('.crm-container');
var ZeroRecordText = {/literal}'{ts escape="js"}None found.{/ts}'{literal};
crmOptionSelector = $('table.crm-option-selector', $context).dataTable({
"destroy" : true,
"bFilter" : false,
"bAutoWidth" : false,
"aaSorting" : [],
"aoColumns" : [
{sClass:'crm-custom_option-label'},
{sClass:'crm-custom_option-value'},
{sClass:'crm-custom_option-default_value'},
{sClass:'crm-custom_option-is_active'},
{sClass:'crm-custom_option-links'},
{sClass:'hiddenElement'}
],
"bProcessing": true,
"asStripClasses" : [ "odd-row", "even-row" ],
"sPaginationType": "full_numbers",
"sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
"bServerSide": true,
"bJQueryUI": true,
"bSort" : false,
"sAjaxSource": sourceUrl,
"iDisplayLength": 10,
"oLanguage": {
"sZeroRecords": ZeroRecordText,
"sProcessing": {/literal}"{ts escape='js'}Processing...{/ts}"{literal},
"sLengthMenu": {/literal}"{ts escape='js'}Show _MENU_ entries{/ts}"{literal},
"sInfo": {/literal}"{ts escape='js'}Showing _START_ to _END_ of _TOTAL_ entries{/ts}"{literal},
"oPaginate": {
"sFirst": {/literal}"{ts escape='js'}First{/ts}"{literal},
"sPrevious": {/literal}"{ts escape='js'}Previous{/ts}"{literal},
"sNext": {/literal}"{ts escape='js'}Next{/ts}"{literal},
"sLast": {/literal}"{ts escape='js'}Last{/ts}"{literal}
}
},
"fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
var id = $('td:last', nRow).text().split(',')[0];
var cl = $('td:last', nRow).text().split(',')[1];
$(nRow).addClass(cl).attr({id: 'OptionValue-' + id});
$('td:eq(0)', nRow).wrapInner('<span class="crm-editable crmf-label" />');
$('td:eq(0)', nRow).prepend('<span class="crm-i fa-arrows crm-grip" />');
$('td:eq(2)', nRow).addClass('crmf-default_value');
return nRow;
},
"fnDrawCallback": function() {
$(this).trigger('crmLoad');
},
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
} );
}
});
}
var startPosition;
var endPosition;
var gid = {/literal}'{$optionGroupID}'{literal};
$("table.crm-option-selector tbody").sortable({
handle: ".fa-arrows",
cursor: "move",
start:function(event, ui) {
var oSettings = $('table.crm-option-selector').dataTable().fnSettings();
var index = oSettings._iDisplayStart;
startPosition = index + ui.item.prevAll().length + 1;
},
update: function(event, ui) {
var oSettings = $('table.crm-option-selector').dataTable().fnSettings();
var index = oSettings._iDisplayStart;
endPosition = index + ui.item.prevAll().length + 1;
CRM.status({}, $.getJSON(CRM.url('civicrm/ajax/reorder'), {
returnFormat:'JSON',
start:startPosition,
end: endPosition,
gid: gid
}))
.success(function() {
$("table.crm-option-selector tbody tr").each(function(i) {
$(this).removeClass('odd even').addClass(i % 2 ? 'even' : 'odd');
});
});
}
});
});
</script>
{/literal}
<div class="action-link">
{crmButton q="reset=1&action=map&fid=$fid&gid=$gid" class="action-item open-inline-noreturn" icon="sort-alpha-asc"}{ts}Alphabetize Options{/ts}{/crmButton}
{crmButton q="reset=1&action=add&fid=$fid&gid=$gid" class="action-item" icon="plus-circle"}{ts}Add Option{/ts}{/crmButton}
{crmButton p="civicrm/admin/custom/group/field" q="reset=1&action=browse&gid=$gid" class="action-item cancel" icon="times"}{ts}Done{/ts}{/crmButton}
</div>
</div>
</div>
{/if}