Merge remote-tracking branch 'upstream/4.3' into 4.3-master-2013-08-28-20-20-34
[civicrm-core.git] / templates / CRM / Contact / Form / Inline / CommunicationPreferences.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 {* 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">&nbsp;</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
64 {if !empty($form.preferred_mail_format)}
65 <div class="crm-summary-row">
66 <div class="crm-label">
67 {$form.preferred_mail_format.label}
68 </div>
69 <div class="crm-content">
70 {$form.preferred_mail_format.html} {help id="id-emailFormat" file="CRM/Contact/Form/Contact.hlp"}
71 </div>
72 </div>
73 {/if}
74
75 {if !empty($form.email_greeting_id)}
76 <div class="crm-summary-row">
77 <div class="crm-label">{$form.email_greeting_id.label}</div>
78 <div class="crm-content">
79 <span id="email_greeting" {if !empty($email_greeting_display)} class="hiddenElement"{/if}>
80 {$form.email_greeting_id.html|crmAddClass:big}
81 </span>
82 <span id="email_greeting_display" class="view-data">
83 {$email_greeting_display}&nbsp;&nbsp;<a href="#" onclick="showGreeting('email_greeting');return false;"><img src="{$config->resourceBase}i/edit.png" border="0" title="{ts}Edit{/ts}"></a>
84 </span>
85 {if !empty($form.email_greeting_custom)}
86 <span id="email_greeting_id_html" class="hiddenElement">
87 <br/>{$form.email_greeting_custom.html|crmAddClass:big}
88 </span>
89 {/if}
90 </div>
91 </div>
92 {/if}
93
94
95 {if !empty($form.postal_greeting_id)}
96 <div class="crm-summary-row">
97 <div class="crm-label">{$form.postal_greeting_id.label}</div>
98 <div class="crm-content">
99 <span id="postal_greeting" {if !empty($postal_greeting_display)} class="hiddenElement"{/if}>
100 {$form.postal_greeting_id.html|crmAddClass:big}
101 </span>
102 <span id="postal_greeting_display" class="view-data">
103 {$postal_greeting_display}&nbsp;&nbsp;<a href="#" onclick="showGreeting('postal_greeting');return false;"><img src="{$config->resourceBase}i/edit.png" border="0" title="{ts}Edit{/ts}"></a>
104 </span>
105 {if !empty($form.postal_greeting_custom)}
106 <span id="postal_greeting_id_html" class="hiddenElement">
107 <br/>{$form.postal_greeting_custom.html|crmAddClass:big}
108 </span>
109 {/if}
110 </div>
111 </div>
112 {/if}
113
114 {if !empty($form.addressee_id)}
115 <div class="crm-summary-row">
116 <div class="crm-label">{$form.addressee_id.label}</div>
117 <div class="crm-content">
118 <span id="addressee" {if !empty($addressee_display)} class="hiddenElement"{/if}>
119 {$form.addressee_id.html|crmAddClass:big}
120 </span>
121 <span id="addressee_display" class="view-data">
122 {$addressee_display}&nbsp;&nbsp;<a href="#" onclick="showGreeting('addressee');return false;"><img src="{$config->resourceBase}i/edit.png" border="0" title="{ts}Edit{/ts}"></a>
123 </span>
124 {if !empty($form.addressee_custom)}
125 <span id="addressee_id_html" class="hiddenElement">
126 <br/>{$form.addressee_custom.html|crmAddClass:big}
127 </span>
128 {/if}
129 </div>
130 </div>
131 {/if}
132
133 </div>
134 </div>
135
136 {literal}
137 <script type="text/javascript">
138 cj( function( ) {
139 var fields = new Array( 'postal_greeting', 'addressee', 'email_greeting');
140 for ( var i = 0; i < 3; i++ ) {
141 cj( "#" + fields[i] + "_id").change( function( ) {
142 var fldName = cj(this).attr( 'id' );
143 if ( cj(this).val( ) == 4 ) {
144 cj("#greetings1").show( );
145 cj("#greetings2").show( );
146 cj( "#" + fldName + "_html").show( );
147 cj( "#" + fldName + "_label").show( );
148 } else {
149 cj( "#" + fldName + "_html").hide( );
150 cj( "#" + fldName + "_label").hide( );
151 cj( "#" + fldName.slice(0, -3) + "_custom" ).val('');
152 }
153 });
154 }
155 });
156
157 function showGreeting( element ) {
158 cj("#" + element ).show( );
159 cj("#" + element + '_display' ).hide( );
160
161 // TO DO fix for custom greeting
162 var fldName = '#' + element + '_id';
163 if ( cj( fldName ).val( ) == 4 ) {
164 cj("#greetings1").show( );
165 cj("#greetings2").show( );
166 cj( fldName + "_html").show( );
167 cj( fldName + "_label").show( );
168 }
169 }
170
171 </script>
172 {/literal}