Merge pull request #6964 from colemanw/CRM-17176
[civicrm-core.git] / templates / CRM / Admin / Page / MessageTemplates.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2015 |
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 <div id='mainTabContainer'>
91 <ul>
92 <li id='tab_user'> <a href='#user' title='{ts}User-driven Messages{/ts}'> {ts}User-driven Messages{/ts} </a></li>
93 <li id='tab_workflow'><a href='#workflow' title='{ts}System Workflow Messages{/ts}'>{ts}System Workflow Messages{/ts}</a></li>
94 </ul>
95
96 {* create two selector tabs, first being the ‘user’ one, the second being the ‘workflow’ one *}
97 {include file="CRM/common/enableDisableApi.tpl"}
98 {include file="CRM/common/jsortable.tpl"}
99 {foreach from=$rows item=template_row key=type}
100 <div id="{if $type eq 'userTemplates'}user{else}workflow{/if}" class='ui-tabs-panel ui-widget-content ui-corner-bottom'>
101 <div class="help">
102 {if $type eq 'userTemplates'}
103 {capture assign=schedRemURL}{crmURL p='civicrm/admin/scheduleReminders' q="reset=1"}{/capture}
104 {ts 1=$schedRemURL}Message templates allow you to easily create similar emails or letters on a recurring basis. Messages used for membership renewal reminders, as well as event and activity related reminders should be created via <a href="%1">Schedule Reminders</a>.{/ts}
105 {if array_search('CiviMail', $config->enableComponents)}
106 {capture assign=automatedMsgURL}{crmURL p='civicrm/admin/component' q="reset=1"}{/capture}
107 {ts 1=$automatedMsgURL}You can also use message templates for CiviMail (bulk email) content. However, subscribe, unsubscribe and opt-out messages are configured at <a href="%1">Administer > CiviMail > Headers, Footers and Automated Messages</a>.{/ts}
108 {/if}
109 {help id="id-intro"}
110 {else}
111 {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"}
112 {/if}
113 </div>
114 <div>
115 <p></p>
116 {if !empty( $template_row) }
117 <table class="display">
118 <thead>
119 <tr>
120 <th class="sortable">{if $type eq 'userTemplates'}{ts}Message Title{/ts}{else}{ts}Workflow{/ts}{/if}</th>
121 {if $type eq 'userTemplates'}
122 <th>{ts}Message Subject{/ts}</th>
123 <th>{ts}Enabled?{/ts}</th>
124 {/if}
125 <th></th>
126 </tr>
127 </thead>
128 <tbody>
129 {foreach from=$template_row item=row}
130 <tr id="message_template-{$row.id}" class="crm-entity {$row.class}{if NOT $row.is_active} disabled{/if}">
131 <td>{$row.msg_title}</td>
132 {if $type eq 'userTemplates'}
133 <td>{$row.msg_subject}</td>
134 <td id="row_{$row.id}_status">{if $row.is_active eq 1} {ts}Yes{/ts} {else} {ts}No{/ts} {/if}</td>
135 {/if}
136 <td>{$row.action|replace:'xx':$row.id}</td>
137 </tr>
138 {/foreach}
139 </tbody>
140 </table>
141 {/if}
142
143 {if $action ne 1 and $action ne 2 and $type eq 'userTemplates'}
144 <div class="action-link">
145 {crmButton p='civicrm/admin/messageTemplates/add' q="action=add&reset=1" id="newMessageTemplates" icon="plus-circle"}{ts}Add Message Template{/ts}{/crmButton}
146 </div>
147 <div class="spacer"></div>
148 {/if}
149
150 {if empty( $template_row) }
151 <div class="messages status no-popup">
152 <div class="icon inform-icon"></div>&nbsp;
153 {ts 1=$crmURL}There are no User-driven Message Templates entered. You can <a href='%1'>add one</a>.{/ts}
154 </div>
155 {/if}
156 </div>
157 </div>
158 {/foreach}
159 </div>
160
161 <script type='text/javascript'>
162 var selectedTab = 'user';
163 {if $selectedChild}selectedTab = '{$selectedChild}';{/if}
164 {literal}
165 CRM.$(function($) {
166 var tabIndex = $('#tab_' + selectedTab).prevAll().length
167 $("#mainTabContainer").tabs( {active: tabIndex} );
168 });
169 {/literal}
170 </script>
171
172 {elseif $action ne 1 and $action ne 2 and $action ne 4 and $action ne 8}
173 <div class="messages status no-popup">
174 <img src="{$config->resourceBase}i/Inform.gif" alt="{ts}status{/ts}"/>
175 {ts 1=$crmURL}There are no Message Templates entered. You can <a href='%1'>add one</a>.{/ts}
176 </div>
177 {/if}