629a62e00a328ce0197108a2a1acac89baff2d69
[civicrm-core.git] / templates / CRM / Contact / Form / Inline / CommunicationPreferences.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.6 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
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.communication_style_id)}
76 <div class="crm-summary-row">
77 <div class="crm-label">
78 {$form.communication_style_id.label} {help id="id-communication_style" file="CRM/Contact/Form/Contact.hlp"}
79 </div>
80 <div class="crm-content">
81 {$form.communication_style_id.html}
82 </div>
83 </div>
84 {/if}
85
86 {if !empty($form.email_greeting_id)}
87 <div class="crm-summary-row">
88 <div class="crm-label">{$form.email_greeting_id.label}</div>
89 <div class="crm-content">
90 <span id="email_greeting" {if !empty($email_greeting_display)} class="hiddenElement"{/if}>
91 {$form.email_greeting_id.html|crmAddClass:big}
92 </span>
93 <span id="email_greeting_display" class="view-data">
94 {$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>
95 </span>
96 {if !empty($form.email_greeting_custom)}
97 <span id="email_greeting_id_html" class="hiddenElement">
98 <br/>{$form.email_greeting_custom.html|crmAddClass:big}
99 </span>
100 {/if}
101 </div>
102 </div>
103 {/if}
104
105
106 {if !empty($form.postal_greeting_id)}
107 <div class="crm-summary-row">
108 <div class="crm-label">{$form.postal_greeting_id.label}</div>
109 <div class="crm-content">
110 <span id="postal_greeting" {if !empty($postal_greeting_display)} class="hiddenElement"{/if}>
111 {$form.postal_greeting_id.html|crmAddClass:big}
112 </span>
113 <span id="postal_greeting_display" class="view-data">
114 {$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>
115 </span>
116 {if !empty($form.postal_greeting_custom)}
117 <span id="postal_greeting_id_html" class="hiddenElement">
118 <br/>{$form.postal_greeting_custom.html|crmAddClass:big}
119 </span>
120 {/if}
121 </div>
122 </div>
123 {/if}
124
125 {if !empty($form.addressee_id)}
126 <div class="crm-summary-row">
127 <div class="crm-label">{$form.addressee_id.label}</div>
128 <div class="crm-content">
129 <span id="addressee" {if !empty($addressee_display)} class="hiddenElement"{/if}>
130 {$form.addressee_id.html|crmAddClass:big}
131 </span>
132 <span id="addressee_display" class="view-data">
133 {$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>
134 </span>
135 {if !empty($form.addressee_custom)}
136 <span id="addressee_id_html" class="hiddenElement">
137 <br/>{$form.addressee_custom.html|crmAddClass:big}
138 </span>
139 {/if}
140 </div>
141 </div>
142 {/if}
143
144 </div>
145 </div>
146
147 {literal}
148 <script type="text/javascript">
149 CRM.$(function($) {
150 var fields = ['postal_greeting', 'addressee', 'email_greeting'];
151 for ( var i = 0; i < 3; i++ ) {
152 $( "#" + fields[i] + "_id").change( function( ) {
153 var fldName = $(this).attr( 'id' );
154 if ( $(this).val( ) == 4 ) {
155 $("#greetings1").show( );
156 $("#greetings2").show( );
157 $( "#" + fldName + "_html").show( );
158 $( "#" + fldName + "_label").show( );
159 } else {
160 $( "#" + fldName + "_html").hide( );
161 $( "#" + fldName + "_label").hide( );
162 $( "#" + fldName.slice(0, -3) + "_custom" ).val('');
163 }
164 });
165 }
166 });
167
168 function showGreeting( element ) {
169 cj("#" + element ).show( );
170 cj("#" + element + '_display' ).hide( );
171
172 // TO DO fix for custom greeting
173 var fldName = '#' + element + '_id';
174 if ( cj( fldName ).val( ) == 4 ) {
175 cj("#greetings1").show( );
176 cj("#greetings2").show( );
177 cj( fldName + "_html").show( );
178 cj( fldName + "_label").show( );
179 }
180 }
181
182 </script>
183 {/literal}