CRM-19723 - Add crmIconPicker widget
[civicrm-core.git] / templates / CRM / Admin / Form / MessageTemplates.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2016 |
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 {* this template is used for adding/editing/deleting Message Templates *}
27 {capture assign=tokenDocsRepeated}{docURL page="user/common-workflows/tokens-and-mail-merge" text="token documentation"}{/capture}
28
29 <h3>{if $action eq 1}{ts}New Message Template{/ts}{elseif $action eq 2}{ts}Edit Message Template{/ts}{else}{ts}Delete Message Template{/ts}{/if}</h3>
30 {if $action neq 8}
31 <div class="help">
32 {ts}Use this form to add or edit re-usable message templates.{/ts} {help id="id-intro" file="CRM/Admin/Page/MessageTemplates.hlp"}
33 </div>
34 {/if}
35
36 <div class="crm-block crm-form-block">
37 <div class="form-item" id="message_templates">
38 {if $action eq 8}
39 <div class="messages status no-popup">
40 <div class="icon inform-icon"></div>
41 {ts}Do you want to delete this message template?{/ts}
42 </div>
43 {else}
44 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
45 <table class="form-layout-compressed">
46 <tr>
47 <td class="label-left">{$form.msg_title.label}</td>
48 <td>{$form.msg_title.html}
49 <br /><span class="description html-adjust">{ts}Descriptive title of message - used for template selection.{/ts}</span>
50 </td>
51 </tr>
52 <tr>
53 <td class="label-left">{$form.file_type.label}</td>
54 <td>{$form.file_type.html}
55 <br /><span class="description html-adjust">{ts}Compose a message on-screen for general use in emails or document output, or upload a pre-composed document for mail-merge.{/ts}</span>
56 </td>
57 </tr>
58 <tr>
59 <td class="label-left">{$form.msg_subject.label}</td>
60 <td>
61 {$form.msg_subject.html|crmAddClass:huge}
62 <input class="crm-token-selector big" data-field="msg_subject" />
63 {help id="id-token-subject" tplFile=$tplFile isAdmin=$isAdmin file="CRM/Contact/Form/Task/Email.hlp"}
64 <br /><span class="description">{ts}Subject for email message.{/ts} {ts 1=$tokenDocsRepeated}Tokens may be included (%1).{/ts}</span>
65 </td>
66 </tr>
67 <tr>
68 <td class="label-left">{$form.file_id.label}</td>
69 <td>{$form.file_id.html}
70 {if $attachment}
71 {foreach from=$attachment key=attKey item=attVal}
72 <div class="crm-attachment-wrapper crm-entity" id="file_{$attVal.fileID}">
73 <strong><a class="crm-attachment" href="{$attVal.url}">{$attVal.cleanName}</a></strong>
74 {if $attVal.description}&nbsp;-&nbsp;{$attVal.description}{/if}
75 {if $attVal.deleteURLArgs}
76 <a href="#" class="crm-hover-button delete-attachment" data-mimetype="{$attVal.mime_type}" data-filename="{$attVal.cleanName}" data-args="{$attVal.deleteURLArgs}" title="{ts}Delete File{/ts}"><span class="icon delete-icon"></span></a>
77 {/if}
78 {include file="CRM/Form/attachmentjs.tpl" context='MessageTemplate'}
79 {/foreach}
80 {/if}
81 <br /><span class="description html-adjust">{ts}Upload the document in .docx or .odt format.{/ts}</span>
82 </td>
83 </tr>
84 <tr>
85 </table>
86
87 <div id="msg_html" class="crm-accordion-wrapper crm-html_email-accordion ">
88 <div class="crm-accordion-header">
89 {ts}HTML Format{/ts}
90 {help id="id-message-text" file="CRM/Contact/Form/Task/Email.hlp"}
91 </div><!-- /.crm-accordion-header -->
92 <div class="crm-accordion-body">
93 <div class="helpIcon" id="helphtml">
94 <input class="crm-token-selector big" data-field="msg_html" />
95 {help id="id-token-html" tplFile=$tplFile isAdmin=$isAdmin file="CRM/Contact/Form/Task/Email.hlp"}
96 </div>
97 <div class="clear"></div>
98 <div class='html'>
99 {$form.msg_html.html}
100 <div class="description">{ts}An HTML formatted version of this message will be sent to contacts whose Email Format preference is 'HTML' or 'Both'.{/ts} {ts 1=$tokenDocsRepeated}Tokens may be included (%1).{/ts}</div>
101 </div>
102 </div><!-- /.crm-accordion-body -->
103 </div><!-- /.crm-accordion-wrapper -->
104
105 <div id="msg_text" class="crm-accordion-wrapper crm-plaint_text_email-accordion ">
106 <div class="crm-accordion-header">
107 {ts}Plain-Text Format{/ts}
108 </div><!-- /.crm-accordion-header -->
109 <div class="crm-accordion-body">
110 <div class="helpIcon" id="helptext">
111 <input class="crm-token-selector big" data-field="msg_text" />
112 {help id="id-token-text" tplFile=$tplFile file="CRM/Contact/Form/Task/Email.hlp"}
113 </div>
114 <div class="clear"></div>
115 <div class='text'>
116 {$form.msg_text.html|crmAddClass:huge}
117 <div class="description">{ts}Text formatted message.{/ts} {ts 1=$tokenDocsRepeated}Tokens may be included (%1).{/ts}</div>
118 </div>
119 </div><!-- /.crm-accordion-body -->
120 </div><!-- /.crm-accordion-wrapper -->
121
122 <div id="pdf_format" class="crm-accordion-wrapper crm-html_email-accordion ">
123 <div class="crm-accordion-header">
124 {$form.pdf_format_id.label}
125 </div><!-- /.crm-accordion-header -->
126 <div class="crm-accordion-body">
127 <div class="spacer"></div>
128 <div class='html'>
129 {$form.pdf_format_id.html}
130 {help id="id-msg-template" file="CRM/Contact/Form/Task/PDFLetterCommon.hlp"}
131 <div class="description">{ts}Page format to use when creating PDF files using this template.{/ts}</div>
132 </div>
133 </div><!-- /.crm-accordion-body -->
134 </div><!-- /.crm-accordion-wrapper -->
135
136 {if !$workflow_id}
137 <table class="form-layout-compressed">
138 <tr>
139 <td class="label-left">{$form.is_active.label}</td>
140 <td>{$form.is_active.html}</td>
141 </tr>
142 </table>
143 {/if}
144 {/if}
145 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
146 <br clear="all" />
147 </div>
148 </div> <!-- end of crm-form-block -->
149 {include file="CRM/Mailing/Form/InsertTokens.tpl"}
150
151 {literal}
152 <script type='text/javascript'>
153 CRM.$(function($) {
154 var mimeType = null;
155 // if default file is selected then hide the file upload field
156 if ($('a.delete-attachment').length) {
157 $('#file_id').hide();
158 mimeType = $('a.delete-attachment').data('mimetype');
159 }
160
161 var selector = $("input[id$='_file_type']").attr('type') == 'radio' ? "input[id$='_file_type']:checked" : "input[id$='_file_type']";
162 showHideUpload($(selector).val());
163 $("input[id$='_file_type']").on('click', function(){
164 showHideUpload(this.value);
165 });
166 function showHideUpload(type) {
167 var show = (type == 1) ? false : true;
168 $("#msg_html").toggle(show);
169 $("#msg_text, #pdf_format").toggle(show);
170 $("#file_id").parent().parent().toggle(!show);
171
172 // auto file type validation
173 if (type) {
174 var validType = 'application/vnd.oasis.opendocument.text, application/vnd.openxmlformats-officedocument.wordprocessingml.document';
175 $("#file_id").attr('accept', validType);
176 }
177 }
178 });
179 </script>
180 {/literal}