Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-07-14-13-42-39
[civicrm-core.git] / templates / CRM / Contact / Form / Task / SMSCommon.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
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 {*common template for compose sms*}
27
28 <div class="crm-accordion-wrapper crm-plaint_text_sms-accordion ">
29 <div class="crm-accordion-header">
30 {ts}Plain-Text Format{/ts}
31 </div><!-- /.crm-accordion-header -->
32 <div class="crm-accordion-body">
33 <div id='char-count-message'></div>
34 <div class="helpIcon" id="helptext">
35 <input class="crm-token-selector big" data-field="text_message" />
36 {help id="id-token-text" tplFile=$tplFile file="CRM/Contact/Form/Task/SMS.hlp"}
37 </div>
38 <div class='text'>
39 {$form.text_message.html}<br />
40 </div>
41 </div><!-- /.crm-accordion-body -->
42 </div><!-- /.crm-accordion-wrapper -->
43 <div id="editMessageDetails" class="section">
44 <div id="updateDetails" class="section" >
45 {$form.updateTemplate.html}&nbsp;{$form.updateTemplate.label}
46 </div>
47 <div class="section">
48 {$form.saveTemplate.html}&nbsp;{$form.saveTemplate.label}
49 </div>
50 </div>
51
52 <div id="saveDetails" class="section">
53 <div class="label">{$form.saveTemplateName.label}</div>
54 <div class="content">{$form.saveTemplateName.html|crmAddClass:huge}</div>
55 </div>
56
57 {include file="CRM/Mailing/Form/InsertTokens.tpl"}
58 {literal}
59 <script type="text/javascript">
60
61 {/literal}{if $max_sms_length}{literal}
62 maxCharInfoDisplay();
63
64 cj('#text_message').bind({
65 change: function() {
66 maxLengthMessage();
67 },
68 keyup: function() {
69 maxCharInfoDisplay();
70 }
71 });
72
73 function maxLengthMessage()
74 {
75 var len = cj('#text_message').val().length;
76 var maxLength = {/literal}{$max_sms_length}{literal};
77 if (len > maxLength) {
78 cj('#text_message').crmError({/literal}'{ts escape="js"}SMS body exceeding limit of 160 characters{/ts}'{literal});
79 return false;
80 }
81 return true;
82 }
83
84 function maxCharInfoDisplay(){
85 var maxLength = {/literal}{$max_sms_length}{literal};
86 var enteredCharLength = cj('#text_message').val().length;
87 var count = enteredCharLength;
88
89 if( count < 0 ) {
90 cj('#text_message').val(cj('#text_message').val().substring(0, maxLength));
91 count = 0;
92 }
93 cj('#char-count-message').text( "You can insert up to " + maxLength + " characters. You have entered " + count + " characters." );
94 }
95 {/literal}{/if}{literal}
96
97 </script>
98 {/literal}