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