Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
3 | | CiviCRM version 4.3 | | |
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 | {* This file provides the plugin for the communication preferences in all the three types of contact *} | |
27 | {* @var $form Contains the array for the form elements and other form associated information assigned to the template by the controller *} | |
28 | {$form.oplock_ts.html} | |
29 | ||
30 | <div class="crm-inline-edit-form"> | |
31 | <div class="crm-inline-button"> | |
32 | {include file="CRM/common/formButtons.tpl"} | |
33 | </div> | |
34 | <div class="crm-clear"> | |
35 | {foreach key=key item=item from=$commPreference} | |
36 | <div class="crm-summary-row"> | |
37 | <div class="crm-label">{$form.$key.label} | |
38 | {help id="id-$key" file="CRM/Contact/Form/Contact.hlp"} | |
39 | </div> | |
40 | <div class="crm-content"> | |
41 | {foreach key=k item=i from=$item} | |
42 | {$form.$key.$k.html}<br/> | |
43 | {/foreach} | |
44 | </div> | |
45 | </div> | |
46 | {if $key eq 'privacy'} | |
47 | <div class="crm-summary-row"> | |
48 | <div class="crm-label"> </div> | |
49 | <div class="crm-content">{ | |
50 | $form.is_opt_out.html} {$form.is_opt_out.label} {help id="id-optOut" file="CRM/Contact/Form/Contact.hlp"} | |
51 | </div> | |
52 | </div> | |
53 | {/if} | |
54 | {/foreach} | |
55 | <div class="crm-summary-row"> | |
56 | <div class="crm-label"> | |
57 | {$form.preferred_language.label} | |
58 | </div> | |
59 | <div class="crm-content"> | |
60 | {$form.preferred_language.html} | |
61 | </div> | |
62 | </div> | |
63 | <div class="crm-summary-row"> | |
64 | <div class="crm-label"> | |
65 | {$form.preferred_mail_format.label} | |
66 | </div> | |
67 | <div class="crm-content"> | |
68 | {$form.preferred_mail_format.html} {help id="id-emailFormat" file="CRM/Contact/Form/Contact.hlp"} | |
69 | </div> | |
70 | </div> | |
71 | ||
72 | {if !empty($form.email_greeting_id)} | |
73 | <div class="crm-summary-row"> | |
74 | <div class="crm-label">{$form.email_greeting_id.label}</div> | |
75 | <div class="crm-content"> | |
76 | <span id="email_greeting" {if !empty($email_greeting_display)} class="hiddenElement"{/if}> | |
77 | {$form.email_greeting_id.html|crmAddClass:big} | |
78 | </span> | |
79 | <span id="email_greeting_display" class="view-data"> | |
80 | {$email_greeting_display} <a href="#" onclick="showGreeting('email_greeting');return false;"><img src="{$config->resourceBase}i/edit.png" border="0" title="{ts}Edit{/ts}"></a> | |
81 | </span> | |
82 | {if !empty($form.email_greeting_custom)} | |
83 | <span id="email_greeting_id_html" class="hiddenElement"> | |
84 | <br/>{$form.email_greeting_custom.html|crmAddClass:big} | |
85 | </span> | |
86 | {/if} | |
87 | </div> | |
88 | </div> | |
89 | {/if} | |
90 | ||
91 | ||
92 | {if !empty($form.postal_greeting_id)} | |
93 | <div class="crm-summary-row"> | |
94 | <div class="crm-label">{$form.postal_greeting_id.label}</div> | |
95 | <div class="crm-content"> | |
96 | <span id="postal_greeting" {if !empty($postal_greeting_display)} class="hiddenElement"{/if}> | |
97 | {$form.postal_greeting_id.html|crmAddClass:big} | |
98 | </span> | |
99 | <span id="postal_greeting_display" class="view-data"> | |
100 | {$postal_greeting_display} <a href="#" onclick="showGreeting('postal_greeting');return false;"><img src="{$config->resourceBase}i/edit.png" border="0" title="{ts}Edit{/ts}"></a> | |
101 | </span> | |
102 | {if !empty($form.postal_greeting_custom)} | |
103 | <span id="postal_greeting_id_html" class="hiddenElement"> | |
104 | <br/>{$form.postal_greeting_custom.html|crmAddClass:big} | |
105 | </span> | |
106 | {/if} | |
107 | </div> | |
108 | </div> | |
109 | {/if} | |
110 | ||
111 | {if !empty($form.addressee_id)} | |
112 | <div class="crm-summary-row"> | |
113 | <div class="crm-label">{$form.addressee_id.label}</div> | |
114 | <div class="crm-content"> | |
115 | <span id="addressee" {if !empty($addressee_display)} class="hiddenElement"{/if}> | |
116 | {$form.addressee_id.html|crmAddClass:big} | |
117 | </span> | |
118 | <span id="addressee_display" class="view-data"> | |
119 | {$addressee_display} <a href="#" onclick="showGreeting('addressee');return false;"><img src="{$config->resourceBase}i/edit.png" border="0" title="{ts}Edit{/ts}"></a> | |
120 | </span> | |
121 | {if !empty($form.addressee_custom)} | |
122 | <span id="addressee_id_html" class="hiddenElement"> | |
123 | <br/>{$form.addressee_custom.html|crmAddClass:big} | |
124 | </span> | |
125 | {/if} | |
126 | </div> | |
127 | </div> | |
128 | {/if} | |
129 | ||
130 | </div> | |
131 | </div> | |
132 | ||
133 | {literal} | |
134 | <script type="text/javascript"> | |
135 | cj( function( ) { | |
136 | var fields = new Array( 'postal_greeting', 'addressee', 'email_greeting'); | |
137 | for ( var i = 0; i < 3; i++ ) { | |
138 | cj( "#" + fields[i] + "_id").change( function( ) { | |
139 | var fldName = cj(this).attr( 'id' ); | |
140 | if ( cj(this).val( ) == 4 ) { | |
141 | cj("#greetings1").show( ); | |
142 | cj("#greetings2").show( ); | |
143 | cj( "#" + fldName + "_html").show( ); | |
144 | cj( "#" + fldName + "_label").show( ); | |
145 | } else { | |
146 | cj( "#" + fldName + "_html").hide( ); | |
147 | cj( "#" + fldName + "_label").hide( ); | |
148 | cj( "#" + fldName.slice(0, -3) + "_custom" ).val(''); | |
149 | } | |
150 | }); | |
151 | } | |
152 | }); | |
153 | ||
154 | function showGreeting( element ) { | |
155 | cj("#" + element ).show( ); | |
156 | cj("#" + element + '_display' ).hide( ); | |
157 | ||
158 | // TO DO fix for custom greeting | |
159 | var fldName = '#' + element + '_id'; | |
160 | if ( cj( fldName ).val( ) == 4 ) { | |
161 | cj("#greetings1").show( ); | |
162 | cj("#greetings2").show( ); | |
163 | cj( fldName + "_html").show( ); | |
164 | cj( fldName + "_label").show( ); | |
165 | } | |
166 | } | |
167 | ||
168 | </script> | |
169 | {/literal} |