commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-new / civicrm / templates / CRM / Contact / Form / Edit / CommunicationPreferences.js.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.6 |
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 {literal}
27 <script type="text/javascript">
28 CRM.$(function($) {
29 var $form = $('form.{/literal}{$form.formClass}{literal}');
30 $('#postal_greeting_id, #addressee_id, #email_greeting_id', $form).change(function() {
31 var fldName = $(this).attr('id');
32 if ($(this).val() == 4) {
33 $("#greetings1, #greetings2", $form).show();
34 $("#" + fldName + "_html, #" + fldName + "_label", $form).show();
35 } else {
36 $("#" + fldName + "_html, #" + fldName + "_label", $form).hide();
37 $("#" + fldName.slice(0, -3) + "_custom", $form).val('');
38 }
39 });
40
41 $('.replace-plain[data-id]', $form).click(function() {
42 var element = $(this).data('id');
43 $(this).hide();
44 $('#' + element, $form).show();
45 var fldName = '#' + element + '_id';
46 if ($(fldName, $form).val() == 4) {
47 $("#greetings1, #greetings2", $form).show();
48 $(fldName + "_html, " + fldName + "_label", $form).show();
49 }
50 });
51 });
52 </script>
53 {/literal}