commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / civicrm / xml / templates / civicrm_msg_template.tpl
1 -- +--------------------------------------------------------------------+
2 -- | CiviCRM version 4.6 |
3 -- +--------------------------------------------------------------------+
4 -- | Copyright CiviCRM LLC (c) 2004-2015 |
5 -- +--------------------------------------------------------------------+
6 -- | This file is a part of CiviCRM. |
7 -- | |
8 -- | CiviCRM is free software; you can copy, modify, and distribute it |
9 -- | under the terms of the GNU Affero General Public License |
10 -- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
11 -- | |
12 -- | CiviCRM is distributed in the hope that it will be useful, but |
13 -- | WITHOUT ANY WARRANTY; without even the implied warranty of |
14 -- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
15 -- | See the GNU Affero General Public License for more details. |
16 -- | |
17 -- | You should have received a copy of the GNU Affero General Public |
18 -- | License and the CiviCRM Licensing Exception along |
19 -- | with this program; if not, contact CiviCRM LLC |
20 -- | at info[AT]civicrm[DOT]org. If you have questions about the |
21 -- | GNU Affero General Public License or the licensing of CiviCRM, |
22 -- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
23 -- +--------------------------------------------------------------------+
24 --
25 -- Generated from {$smarty.template}
26 -- {$generated}
27 --
28 {* not sure how to define the below in Smarty, so doing it in PHP instead *}
29 {php}
30 $ogNames = array(
31 'case' => ts('Message Template Workflow for Cases', array('escape' => 'sql')),
32 'contribution' => ts('Message Template Workflow for Contributions', array('escape' => 'sql')),
33 'event' => ts('Message Template Workflow for Events', array('escape' => 'sql')),
34 'friend' => ts('Message Template Workflow for Tell-a-Friend', array('escape' => 'sql')),
35 'membership' => ts('Message Template Workflow for Memberships', array('escape' => 'sql')),
36 'meta' => ts('Message Template Workflow for Meta Templates', array('escape' => 'sql')),
37 'pledge' => ts('Message Template Workflow for Pledges', array('escape' => 'sql')),
38 'uf' => ts('Message Template Workflow for Profiles', array('escape' => 'sql')),
39 'petition' => ts('Message Template Workflow for Petition', array('escape' => 'sql')),
40 );
41 $ovNames = array(
42 'case' => array(
43 'case_activity' => ts('Cases - Send Copy of an Activity', array('escape' => 'sql')),
44 ),
45 'contribution' => array(
46 'contribution_dupalert' => ts('Contributions - Duplicate Organization Alert', array('escape' => 'sql')),
47 'contribution_offline_receipt' => ts('Contributions - Receipt (off-line)', array('escape' => 'sql')),
48 'contribution_online_receipt' => ts('Contributions - Receipt (on-line)', array('escape' => 'sql')),
49 'contribution_invoice_receipt' => ts('Contributions - Invoice', array('escape' => 'sql')),
50 'contribution_recurring_notify' => ts('Contributions - Recurring Start and End Notification', array('escape' => 'sql')),
51 'contribution_recurring_cancelled' => ts('Contributions - Recurring Cancellation Notification', array('escape' => 'sql')),
52 'contribution_recurring_billing' => ts('Contributions - Recurring Billing Updates', array('escape' => 'sql')),
53 'contribution_recurring_edit' => ts('Contributions - Recurring Updates', array('escape' => 'sql')),
54 'pcp_notify' => ts('Personal Campaign Pages - Admin Notification', array('escape' => 'sql')),
55 'pcp_status_change' => ts('Personal Campaign Pages - Supporter Status Change Notification', array('escape' => 'sql')),
56 'pcp_supporter_notify' => ts('Personal Campaign Pages - Supporter Welcome', array('escape' => 'sql')),
57 'pcp_owner_notify' => ts('Personal Campaign Pages - Owner Notification', array('escape' => 'sql')),
58 'payment_or_refund_notification' => ts('Additional Payment Receipt or Refund Notification', array('escape' => 'sql')),
59 ),
60 'event' => array(
61 'event_offline_receipt' => ts('Events - Registration Confirmation and Receipt (off-line)', array('escape' => 'sql')),
62 'event_online_receipt' => ts('Events - Registration Confirmation and Receipt (on-line)', array('escape' => 'sql')),
63 'event_registration_receipt' => ts('Events - Receipt only', array('escape' => 'sql')),
64 'participant_cancelled' => ts('Events - Registration Cancellation Notice', array('escape' => 'sql')),
65 'participant_confirm' => ts('Events - Registration Confirmation Invite', array('escape' => 'sql')),
66 'participant_expired' => ts('Events - Pending Registration Expiration Notice', array('escape' => 'sql')),
67 ),
68 'friend' => array(
69 'friend' => ts('Tell-a-Friend Email', array('escape' => 'sql')),
70 ),
71 'membership' => array(
72 'membership_offline_receipt' => ts('Memberships - Signup and Renewal Receipts (off-line)', array('escape' => 'sql')),
73 'membership_online_receipt' => ts('Memberships - Receipt (on-line)', array('escape' => 'sql')),
74 'membership_autorenew_cancelled' => ts('Memberships - Auto-renew Cancellation Notification', array('escape' => 'sql')),
75 'membership_autorenew_billing' => ts('Memberships - Auto-renew Billing Updates', array('escape' => 'sql')),
76 ),
77 'meta' => array(
78 'test_preview' => ts('Test-drive - Receipt Header', array('escape' => 'sql')),
79 ),
80 'pledge' => array(
81 'pledge_acknowledge' => ts('Pledges - Acknowledgement', array('escape' => 'sql')),
82 'pledge_reminder' => ts('Pledges - Payment Reminder', array('escape' => 'sql')),
83 ),
84 'uf' => array(
85 'uf_notify' => ts('Profiles - Admin Notification', array('escape' => 'sql')),
86 ),
87 'petition' => array(
88 'petition_sign' => ts('Petition - signature added', array('escape' => 'sql')),
89 'petition_confirmation_needed' => ts('Petition - need verification', array('escape' => 'sql')),
90 ),
91 );
92 $this->assign('ogNames', $ogNames);
93 $this->assign('ovNames', $ovNames);
94 {/php}
95
96 INSERT INTO civicrm_option_group
97 (name, {localize field='title'}title{/localize}, {localize field='description'}description{/localize}, is_reserved, is_active) VALUES
98 {foreach from=$ogNames key=name item=description name=for_groups}
99 ('msg_tpl_workflow_{$name}', {localize}'{$description}'{/localize}, {localize}'{$description}'{/localize}, 1, 1) {if $smarty.foreach.for_groups.last};{else},{/if}
100 {/foreach}
101
102 {foreach from=$ogNames key=name item=description}
103 SELECT @tpl_ogid_{$name} := MAX(id) FROM civicrm_option_group WHERE name = 'msg_tpl_workflow_{$name}';
104 {/foreach}
105
106 INSERT INTO civicrm_option_value
107 (option_group_id, name, {localize field='label'}label{/localize}, value, weight) VALUES
108 {foreach from=$ovNames key=gName item=ovs name=for_groups}
109 {foreach from=$ovs key=vName item=label name=for_values}
110 (@tpl_ogid_{$gName}, '{$vName}', {localize}'{$label}'{/localize}, {$smarty.foreach.for_values.iteration}, {$smarty.foreach.for_values.iteration}) {if $smarty.foreach.for_groups.last and $smarty.foreach.for_values.last};{else},{/if}
111 {/foreach}
112 {/foreach}
113
114 {foreach from=$ovNames key=gName item=ovs}
115 {foreach from=$ovs key=vName item=label}
116 SELECT @tpl_ovid_{$vName} := MAX(id) FROM civicrm_option_value WHERE option_group_id = @tpl_ogid_{$gName} AND name = '{$vName}';
117 {/foreach}
118 {/foreach}
119
120 INSERT INTO civicrm_msg_template
121 (msg_title, msg_subject, msg_text, msg_html, workflow_id, is_default, is_reserved) VALUES
122 {foreach from=$ovNames key=gName item=ovs name=for_groups}
123 {foreach from=$ovs key=vName item=title name=for_values}
124 {fetch assign=subject file="`$smarty.const.SMARTY_DIR`/../../xml/templates/message_templates/`$vName`_subject.tpl"}
125 {fetch assign=text file="`$smarty.const.SMARTY_DIR`/../../xml/templates/message_templates/`$vName`_text.tpl"}
126 {fetch assign=html file="`$smarty.const.SMARTY_DIR`/../../xml/templates/message_templates/`$vName`_html.tpl"}
127 ('{$title}', '{$subject|escape:"quotes"}', '{$text|escape:"quotes"}', '{$html|escape:"quotes"}', @tpl_ovid_{$vName}, 1, 0),
128 ('{$title}', '{$subject|escape:"quotes"}', '{$text|escape:"quotes"}', '{$html|escape:"quotes"}', @tpl_ovid_{$vName}, 0, 1) {if $smarty.foreach.for_groups.last and $smarty.foreach.for_values.last};{else},{/if}
129 {/foreach}
130 {/foreach}
131
132 {php}
133 $dir = SMARTY_DIR . '/../../xml/templates/message_templates/sample';
134 $templates = array();
135 foreach (preg_grep('/\.tpl$/', scandir($dir)) as $filename) {
136 $templates[] = array('name' => basename($filename, '.tpl'), 'filename' => "$dir/$filename");
137 }
138 $this->assign('templates', $templates);
139 {/php}
140
141 {foreach from=$templates item=tpl}
142 {fetch assign=content file=$tpl.filename}
143 INSERT INTO civicrm_msg_template
144 (msg_title, msg_subject, msg_text, msg_html, workflow_id, is_default, is_reserved) VALUES
145 ('{$tpl.name} Template', '{$tpl.name}', '', '{$content|escape:"quotes"}' ,NULL, 1, 0);
146 {/foreach}