CRM-14383 - Update cj closures
[civicrm-core.git] / templates / CRM / Admin / Form / WordReplacements.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
819d0d41 3 | CiviCRM version 4.5 |
6a488035 4 +--------------------------------------------------------------------+
819d0d41 5 | Copyright CiviCRM LLC (c) 2004-2014 |
6a488035
TO
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25*}
26
27{* add single row *}
28{if $soInstance}
29<tr id="string_override_row_{$soInstance}">
30 <td class="even-row checkbox">{$form.enabled.$soInstance.html}</td>
31 <td class="even-row">{$form.old.$soInstance.html}</td>
32 <td class="even-row">{$form.new.$soInstance.html}</td>
33 <td class="even-row checkbox">{$form.cb.$soInstance.html}</td>
34</tr>
35
36{else}
37{* this template is used for adding/editing string overrides *}
38<div class="crm-form crm-form-block crm-string_override-form-block">
39<div id="help">
40 {ts}Use <strong>Word Replacements</strong> to change all occurrences of a word or phrase in CiviCRM screens (e.g. replace all occurences of 'Contribution' with 'Donation').{/ts} {help id="id-word_replace"}
41</div>
42<table class="form-layout-compressed">
43 <tr>
44 <td>
45 <table>
46 <tr class="columnheader">
47 <td>{ts}Enabled{/ts}</td>
48 <td>{ts}Original{/ts}</td>
49 <td>{ts}Replacement{/ts}</td>
50 <td>{ts}Exact Match?{/ts}</td>
51 </tr>
52
53 {section name="numStrings" start=1 step=1 loop=$numStrings+1}
54 {assign var='soInstance' value=$smarty.section.numStrings.index}
55
56 <tr id="string_override_row_{$soInstance}">
57 <td class="even-row checkbox">{$form.enabled.$soInstance.html}</td>
58 <td class="even-row">{$form.old.$soInstance.html}</td>
59 <td class="even-row">{$form.new.$soInstance.html}</td>
60 <td class="even-row checkbox">{$form.cb.$soInstance.html}</td>
61 </tr>
62
63 {/section}
64 </table>
65 </td>
66 </tr>
67</table>
68 <div class="crm-submit-buttons" ><a class="button" onClick="Javascript:buildStringOverrideRow( false );return false;"><span><div class="icon add-icon"></div>{ts}Add row{/ts}</span></a>{include file="CRM/common/formButtons.tpl"} </div>
69
70</div>
71{/if}
72
73{literal}
74<script type="text/javascript">
75function buildStringOverrideRow( curInstance )
76{
77 var rowId = 'string_override_row_';
78
79 if ( curInstance ) {
80 if ( curInstance <= 10 ) return;
81 currentInstance = curInstance;
82 previousInstance = currentInstance - 1;
83 } else {
84 var previousInstance = cj( '[id^="'+ rowId +'"]:last' ).attr('id').slice( rowId.length );
85 var currentInstance = parseInt( previousInstance ) + 1;
86 }
87
88 var dataUrl = {/literal}"{crmURL q='snippet=4' h=0}"{literal} ;
89 dataUrl += "&instance="+currentInstance;
90
91 var prevInstRowId = '#string_override_row_' + previousInstance;
92
93 cj.ajax({ url : dataUrl,
94 async : false,
95 success : function( html ) {
96 cj( prevInstRowId ).after( html );
97 cj('#old_'+currentInstance).TextAreaResizer();
98 cj('#new_'+currentInstance).TextAreaResizer();
99 }
100 });
101}
102
3cc60a06 103CRM.$(function($) {
6a488035
TO
104 {/literal}
105 {if $stringOverrideInstances}
106 {foreach from=$stringOverrideInstances key="index" item="instance"}
107 buildStringOverrideRow( {$instance} );
108 {/foreach}
109 {/if}
110 {literal}
111});
112</script>
113{/literal}