Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
1188c7a8 | 3 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 4 | | | |
1188c7a8 TO |
5 | | This work is published under the GNU AGPLv3 license with some | |
6 | | permitted exceptions and without any warranty. For full license | | |
7 | | and copyright information, see https://civicrm.org/licensing | | |
6a488035 TO |
8 | +--------------------------------------------------------------------+ |
9 | *} | |
10 | {* this template is used for adding/editing/deleting Message Templates *} | |
11 | {capture assign=tokenDocsRepeated}{docURL page="user/common-workflows/tokens-and-mail-merge" text="token documentation"}{/capture} | |
12 | ||
6a488035 | 13 | {if $action neq 8} |
f6eedce7 | 14 | <div class="help"> |
b1dfb588 | 15 | {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 |
16 | </div> |
17 | {/if} | |
18 | ||
c67e7149 MR |
19 | <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> |
20 | ||
6a488035 TO |
21 | <div class="crm-block crm-form-block"> |
22 | <div class="form-item" id="message_templates"> | |
23 | {if $action eq 8} | |
24 | <div class="messages status no-popup"> | |
34d6cec4 | 25 | {icon icon="fa-info-circle"}{/icon} |
015bb6dd | 26 | {ts 1=$msg_title|escape}Do you want to delete the message template '%1'?{/ts} |
6a488035 TO |
27 | </div> |
28 | {else} | |
29 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> | |
30 | <table class="form-layout-compressed"> | |
31 | <tr> | |
32 | <td class="label-left">{$form.msg_title.label}</td> | |
33 | <td>{$form.msg_title.html} | |
34 | <br /><span class="description html-adjust">{ts}Descriptive title of message - used for template selection.{/ts}</span> | |
35 | </td> | |
36 | </tr> | |
90a73810 | 37 | <tr> |
38 | <td class="label-left">{$form.file_type.label}</td> | |
39 | <td>{$form.file_type.html} | |
98f91a3e | 40 | <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 | 41 | </td> |
42 | </tr> | |
6a488035 TO |
43 | <tr> |
44 | <td class="label-left">{$form.msg_subject.label}</td> | |
45 | <td> | |
ac0a3db5 CW |
46 | {$form.msg_subject.html|crmAddClass:huge} |
47 | <input class="crm-token-selector big" data-field="msg_subject" /> | |
48 | {help id="id-token-subject" tplFile=$tplFile isAdmin=$isAdmin file="CRM/Contact/Form/Task/Email.hlp"} | |
6a488035 TO |
49 | <br /><span class="description">{ts}Subject for email message.{/ts} {ts 1=$tokenDocsRepeated}Tokens may be included (%1).{/ts}</span> |
50 | </td> | |
51 | </tr> | |
52 | <tr> | |
90a73810 | 53 | <td class="label-left">{$form.file_id.label}</td> |
54 | <td>{$form.file_id.html} | |
55 | {if $attachment} | |
56 | {foreach from=$attachment key=attKey item=attVal} | |
57 | <div class="crm-attachment-wrapper crm-entity" id="file_{$attVal.fileID}"> | |
58 | <strong><a class="crm-attachment" href="{$attVal.url}">{$attVal.cleanName}</a></strong> | |
59 | {if $attVal.description} - {$attVal.description}{/if} | |
60 | {if $attVal.deleteURLArgs} | |
61 | <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> | |
62 | {/if} | |
63 | {include file="CRM/Form/attachmentjs.tpl" context='MessageTemplate'} | |
64 | {/foreach} | |
65 | {/if} | |
98f91a3e | 66 | <br /><span class="description html-adjust">{ts}Upload the document in .docx or .odt format.{/ts}</span> |
90a73810 | 67 | </td> |
68 | </tr> | |
69 | <tr> | |
6a488035 TO |
70 | </table> |
71 | ||
ede7390a | 72 | <div id="msg_html_section" class="crm-accordion-wrapper crm-html_email-accordion "> |
6a488035 TO |
73 | <div class="crm-accordion-header"> |
74 | {ts}HTML Format{/ts} | |
75 | {help id="id-message-text" file="CRM/Contact/Form/Task/Email.hlp"} | |
76 | </div><!-- /.crm-accordion-header --> | |
77 | <div class="crm-accordion-body"> | |
ac0a3db5 | 78 | <div class="helpIcon" id="helphtml"> |
0980703c | 79 | <input class="crm-token-selector big" data-field="msg_html" /> |
13d9bc82 | 80 | {help id="id-token-html" tplFile=$tplFile isAdmin=$isAdmin file="CRM/Contact/Form/Task/Email.hlp"} |
ac0a3db5 | 81 | </div> |
6a488035 | 82 | <div class="clear"></div> |
77447093 | 83 | <div class='html'> |
e7562585 | 84 | {$form.msg_html.html|crmAddClass:huge} |
ef4a9bcd | 85 | <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 |
86 | </div> |
87 | </div><!-- /.crm-accordion-body --> | |
88 | </div><!-- /.crm-accordion-wrapper --> | |
89 | ||
ede7390a | 90 | <div id="msg_text_section" class="crm-accordion-wrapper crm-plaint_text_email-accordion "> |
ef4a9bcd | 91 | <div class="crm-accordion-header"> |
92 | {ts}Plain-Text Format{/ts} | |
93 | </div><!-- /.crm-accordion-header --> | |
94 | <div class="crm-accordion-body"> | |
95 | <div class="helpIcon" id="helptext"> | |
96 | <input class="crm-token-selector big" data-field="msg_text" /> | |
97 | {help id="id-token-text" tplFile=$tplFile file="CRM/Contact/Form/Task/Email.hlp"} | |
98 | </div> | |
99 | <div class="clear"></div> | |
100 | <div class='text'> | |
101 | {$form.msg_text.html|crmAddClass:huge} | |
102 | <div class="description">{ts}Text formatted message.{/ts} {ts 1=$tokenDocsRepeated}Tokens may be included (%1).{/ts}</div> | |
103 | </div> | |
104 | </div><!-- /.crm-accordion-body --> | |
105 | </div><!-- /.crm-accordion-wrapper --> | |
106 | ||
2c8a6e63 | 107 | <div id="pdf_format" class="crm-accordion-wrapper crm-html_email-accordion "> |
6a488035 TO |
108 | <div class="crm-accordion-header"> |
109 | {$form.pdf_format_id.label} | |
110 | </div><!-- /.crm-accordion-header --> | |
111 | <div class="crm-accordion-body"> | |
112 | <div class="spacer"></div> | |
113 | <div class='html'> | |
114 | {$form.pdf_format_id.html} | |
115 | {help id="id-msg-template" file="CRM/Contact/Form/Task/PDFLetterCommon.hlp"} | |
116 | <div class="description">{ts}Page format to use when creating PDF files using this template.{/ts}</div> | |
117 | </div> | |
118 | </div><!-- /.crm-accordion-body --> | |
119 | </div><!-- /.crm-accordion-wrapper --> | |
120 | ||
121 | {if !$workflow_id} | |
122 | <table class="form-layout-compressed"> | |
123 | <tr> | |
124 | <td class="label-left">{$form.is_active.label}</td> | |
125 | <td>{$form.is_active.html}</td> | |
126 | </tr> | |
127 | </table> | |
128 | {/if} | |
129 | {/if} | |
130 | <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div> | |
131 | <br clear="all" /> | |
132 | </div> | |
133 | </div> <!-- end of crm-form-block --> | |
134 | {include file="CRM/Mailing/Form/InsertTokens.tpl"} | |
90a73810 | 135 | |
136 | {literal} | |
137 | <script type='text/javascript'> | |
138 | CRM.$(function($) { | |
139 | var mimeType = null; | |
140 | // if default file is selected then hide the file upload field | |
141 | if ($('a.delete-attachment').length) { | |
142 | $('#file_id').hide(); | |
143 | mimeType = $('a.delete-attachment').data('mimetype'); | |
144 | } | |
145 | ||
100e363e | 146 | var selector = $("input[id$='_file_type']").attr('type') == 'radio' ? "input[id$='_file_type']:checked" : "input[id$='_file_type']"; |
147 | showHideUpload($(selector).val()); | |
a8cd772c | 148 | $("input[id$='_file_type']").on('click', function(){ |
149 | showHideUpload(this.value); | |
90a73810 | 150 | }); |
a8cd772c | 151 | function showHideUpload(type) { |
152 | var show = (type == 1) ? false : true; | |
5f1901e9 | 153 | $("#msg_html_section, #msg_text_section, #pdf_format").toggle(show); |
90a73810 | 154 | $("#file_id").parent().parent().toggle(!show); |
155 | ||
156 | // auto file type validation | |
a8cd772c | 157 | if (type) { |
158 | var validType = 'application/vnd.oasis.opendocument.text, application/vnd.openxmlformats-officedocument.wordprocessingml.document'; | |
90a73810 | 159 | $("#file_id").attr('accept', validType); |
160 | } | |
90a73810 | 161 | } |
162 | }); | |
163 | </script> | |
164 | {/literal} |