commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-new / civicrm / templates / CRM / Contact / Form / Inline / Address.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 {* This file builds html for address block inline edit *}
27 {$form.oplock_ts.html}
28 <table class="form-layout crm-edit-address-form crm-inline-edit-form">
29 <tr>
30 <td>
31 <div class="crm-submit-buttons">
32 {include file="CRM/common/formButtons.tpl"}
33 {if $addressId}
34 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
35 <a class="button delete-button" href="#" style="display:inline-block;float:none;"><div class="icon delete-icon"></div> {ts}Delete{/ts}</a>
36 {/if}
37 </div>
38 </td>
39 </tr>
40 <tr>
41 <td>
42 <span class="crm-address-element location_type_id-address-element">
43 {$form.address.$blockId.location_type_id.label}&nbsp;{$form.address.$blockId.location_type_id.html}
44 </span>
45 </td>
46 </tr>
47 <tr>
48 <td>
49 <span class="crm-address-element is_primary-address-element">{$form.address.$blockId.is_primary.html}</span>
50 <span class="crm-address-element is_billing-address-element">{$form.address.$blockId.is_billing.html}</span>
51 </td>
52 </tr>
53
54 {* include shared address template *}
55 {include file="CRM/Contact/Form/ShareAddress.tpl"}
56
57 <tr>
58 <td>
59 <table id="address_table_{$blockId}" class="form-layout-compressed">
60 {* build address block w/ address sequence. *}
61 {foreach item=addressElement from=$addressSequence}
62 {include file=CRM/Contact/Form/Edit/Address/$addressElement.tpl}
63 {/foreach}
64 {include file=CRM/Contact/Form/Edit/Address/geo_code.tpl}
65 </table>
66 </td>
67 </tr>
68 </table>
69
70 <div class="crm-edit-address-custom_data crm-inline-edit-form crm-address-custom-set-block-{$blockId}">
71 {include file="CRM/Contact/Form/Edit/Address/CustomData.tpl"}
72 </div>
73 {literal}
74 <script type="text/javascript">
75 {/literal}{* // Enforce unique location_type_id fields *}{literal}
76 cj('#address_{/literal}{$blockId}{literal}_location_type_id').change(function() {
77 var ele = cj(this);
78 var lt = ele.val();
79 var container = ele.closest('div.crm-inline-edit.address');
80 container.data('location-type-id', '');
81 var ok = true;
82 if (lt != '') {
83 cj('.crm-inline-edit.address').each(function() {
84 if (ok && cj(this).data('location-type-id') == lt) {
85 var label = cj('option:selected', ele).text();
86 ele.select2('val', '');
87 ele.crmError(label + "{/literal} {ts escape='js'}has already been assigned to another address. Please select another location for this address.{/ts}"{literal});
88 ok = false;
89 }
90 });
91 if (ok) {
92 container.data('location-type-id', lt);
93 }
94 }
95 });
96 {/literal}{* // Enforce unique is_primary fields *}{literal}
97 cj(':checkbox[id*="[is_primary"]', 'form[name=Address_{/literal}{$blockId}{literal}]').change(function() {
98 if (this.defaultChecked) {
99 cj(this).crmError("{/literal} {ts escape='js'}Please choose another address to be primary before changing this one.{/ts}{literal}");
100 cj(this).prop('checked', true);
101 }
102 });
103 {/literal}{* // Reset location_type_id when cancel button pressed *}{literal}
104 cj(':submit[name$=cancel]', 'form[name=Address_{/literal}{$blockId}{literal}]').click(function() {
105 var container = cj(this).closest('div.crm-inline-edit.address');
106 var origValue = container.attr('data-location-type-id') || '';
107 container.data('location-type-id', origValue);
108 });
109 {/literal}
110 {if $masterAddress.$blockId}
111 CRM.alert('{ts escape="js" 1=$masterAddress.$blockId}This address is shared with %1 contact record(s). Modifying this address will automatically update the shared address for these contacts.{/ts}', '{ts escape="js"}Editing Master Address{/ts}', 'info', {ldelim}expires: 0{rdelim});
112 {/if}
113 </script>