CRM-14258 - Use select2 for inserting tokens
[civicrm-core.git] / templates / CRM / Admin / Page / MessageTemplates.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
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 {capture assign=crmURL}{crmURL p='civicrm/admin/messageTemplates/add' q="action=add&reset=1"}{/capture}
27 {if $action eq 1 or $action eq 2 or $action eq 8}
28 {include file="CRM/Admin/Form/MessageTemplates.tpl"}
29
30 {elseif $action eq 4}
31 {* View a system default workflow template *}
32
33 <div id="help">
34 {ts}You are viewing the default message template for this system workflow.{/ts} {help id="id-view_system_default"}
35 </div>
36
37 <fieldset>
38 <div class="crm-section msg_title-section">
39 <div class="bold">{$form.msg_title.value}</div>
40 </div>
41 <div class="crm-section msg_subject-section">
42 <h3 class="header-dark">{$form.msg_subject.label}</h3>
43 <div class="text">
44 <textarea name="msg-subject" id="msg_subject" style="height: 6em; width: 45em;">{$form.msg_subject.value}</textarea>
45 <div class='spacer'></div>
46 <div class="section">
47 <a href='#' onclick='MessageTemplates.msg_subject.select(); return false;' class='button'><span>Select Subject</span></a>
48 <div class='spacer'></div>
49 </div>
50 </div>
51 </div>
52
53 <div class="crm-section msg_txt-section">
54 <h3 class="header-dark">{$form.msg_text.label}</h3>
55 <div class="text">
56 <textarea class="huge" name='msg_text' id='msg_text'>{$form.msg_text.value|htmlentities}</textarea>
57 <div class='spacer'></div>
58 <div class="section">
59 <a href='#' onclick='MessageTemplates.msg_text.select(); return false;' class='button'><span>Select Text Message</span></a>
60 <div class='spacer'></div>
61 </div>
62 </div>
63 </div>
64
65 <div class="crm-section msg_html-section">
66 <h3 class="header-dark">{$form.msg_html.label}</h3>
67 <div class='text'>
68 <textarea class="huge" name='msg_html' id='msg_html'>{$form.msg_html.value|htmlentities}</textarea>
69 <div class='spacer'></div>
70 <div class="section">
71 <a href='#' onclick='MessageTemplates.msg_html.select(); return false;' class='button'><span>Select HTML Message</span></a>
72 <div class='spacer'></div>
73 </div>
74 </div>
75 </div>
76
77 <div class="crm-section msg_html-section">
78 <h3 class="header-dark">{$form.pdf_format_id.label}</h3>
79 <div class='text'>
80 {$form.pdf_format_id.html}
81 </div>
82 </div>
83
84 <div id="crm-submit-buttons">{$form.buttons.html}</div>
85 </fieldset>
86 {/if}
87
88 {if $rows and $action ne 2 and $action ne 4}
89
90 {* include wysiwyg related files*}
91 {include file="CRM/common/wysiwyg.tpl" includeWysiwygEditor=true}
92
93 <div id='mainTabContainer'>
94 <ul>
95 <li id='tab_user'> <a href='#user' title='{ts}User-driven Messages{/ts}'> {ts}User-driven Messages{/ts} </a></li>
96 <li id='tab_workflow'><a href='#workflow' title='{ts}System Workflow Messages{/ts}'>{ts}System Workflow Messages{/ts}</a></li>
97 </ul>
98
99 {* create two selector tabs, first being the ‘user’ one, the second being the ‘workflow’ one *}
100 {include file="CRM/common/enableDisableApi.tpl"}
101 {include file="CRM/common/crmeditable.tpl"}
102 {include file="CRM/common/jsortable.tpl"}
103 {foreach from=$rows item=template_row key=type}
104 <div id="{if $type eq 'userTemplates'}user{else}workflow{/if}" class='ui-tabs-panel ui-widget-content ui-corner-bottom'>
105 <div class="help">
106 {if $type eq 'userTemplates'}
107 {capture assign=schedRemURL}{crmURL p='civicrm/admin/scheduleReminders' q="reset=1"}{/capture}
108 {ts 1=$schedRemURL}User-driven message templates allow you to save and re-use messages with layouts. They are useful if you need to send similar emails or letters to contacts on a recurring basis. You can also use them in CiviMail mailings. Messages used for membership renewal reminders, as well as event and activity related reminders should be created via <a href="%1">Scheduled Reminders</a>.{/ts} {help id="id-intro"}
109 {else}
110 {ts}System workflow message templates are used to generate the emails sent to constituents and administrators for contribution receipts, event confirmations and many other workflows. You can customize the style and wording of these messages here.{/ts} {help id="id-system-workflow"}
111 {/if}
112 </div>
113 <div>
114 <p></p>
115 {if !empty( $template_row) }
116 <table class="display">
117 <thead>
118 <tr>
119 <th class="sortable">{if $type eq 'userTemplates'}{ts}Message Title{/ts}{else}{ts}Workflow{/ts}{/if}</th>
120 {if $type eq 'userTemplates'}
121 <th>{ts}Message Subject{/ts}</th>
122 <th>{ts}Enabled?{/ts}</th>
123 {/if}
124 <th></th>
125 </tr>
126 </thead>
127 <tbody>
128 {foreach from=$template_row item=row}
129 <tr id="message_template-{$row.id}" class="crm-entity {$row.class}{if NOT $row.is_active} disabled{/if}">
130 <td>{$row.msg_title}</td>
131 {if $type eq 'userTemplates'}
132 <td>{$row.msg_subject}</td>
133 <td id="row_{$row.id}_status">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
134 {/if}
135 <td>{$row.action|replace:'xx':$row.id}</td>
136 </tr>
137 {/foreach}
138 </tbody>
139 </table>
140 {/if}
141
142 {if $action ne 1 and $action ne 2 and $type eq 'userTemplates'}
143 <div class="action-link">
144 <a href="{crmURL p='civicrm/admin/messageTemplates/add' q="action=add&reset=1"}" id="newMessageTemplates" class="button"><span><div class="icon add-icon"></div>{ts}Add Message Template{/ts}</span></a>
145 </div>
146 <div class="spacer"></div>
147 {/if}
148
149 {if empty( $template_row) }
150 <div class="messages status no-popup">
151 <div class="icon inform-icon"></div>&nbsp;
152 {ts 1=$crmURL}There are no User-driven Message Templates entered. You can <a href='%1'>add one</a>.{/ts}
153 </div>
154 {/if}
155 </div>
156 </div>
157 {/foreach}
158 </div>
159
160 <script type='text/javascript'>
161 var selectedTab = 'user';
162 {if $selectedChild}selectedTab = '{$selectedChild}';{/if}
163 {literal}
164 cj( function() {
165 var tabIndex = cj('#tab_' + selectedTab).prevAll().length
166 cj("#mainTabContainer").tabs( {active: tabIndex} );
167 });
168 {/literal}
169 </script>
170
171 {elseif $action ne 1 and $action ne 2 and $action ne 4 and $action ne 8}
172 <div class="messages status no-popup">
173 <img src="{$config->resourceBase}i/Inform.gif" alt="{ts}status{/ts}"/>
174 {ts 1=$crmURL}There are no Message Templates entered. You can <a href='%1'>add one</a>.{/ts}
175 </div>
176 {/if}