Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-07-14-13-42-39
[civicrm-core.git] / templates / CRM / Contact / Form / Edit / Address.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
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 Address block *}
27 {* @var $form Contains the array for the form elements and other form associated information assigned to the template by the controller*}
28 {* @var $blockId Contains the current address block id, and assigned in the CRM/Contact/Form/Location.php file *}
29
30 {if $title and $className eq 'CRM_Contact_Form_Contact'}
31 <div id="addressBlockId" class="crm-accordion-wrapper crm-address-accordion collapsed">
32 <div class="crm-accordion-header">
33 {$title}
34 </div><!-- /.crm-accordion-header -->
35 <div class="crm-accordion-body" id="addressBlock">
36 {/if}
37
38 <div id="Address_Block_{$blockId}" {if $className eq 'CRM_Contact_Form_Contact'} class="boxBlock crm-edit-address-block crm-address_{$blockId}"{/if}>
39 {if $blockId gt 1}<fieldset><legend>{ts}Supplemental Address{/ts}</legend>{/if}
40 <table class="form-layout-compressed crm-edit-address-form">
41 {if $masterAddress.$blockId gt 0 }
42 <tr><td><div class="message status"><div class="icon inform-icon"></div>&nbsp; {ts 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}</div></td></tr>
43 {/if}
44
45 {if $className eq 'CRM_Contact_Form_Contact'}
46 <tr>
47 <td id='Address-Primary-html' colspan="2">
48 <span class="crm-address-element location_type_id-address-element">{$form.address.$blockId.location_type_id.label}
49 {$form.address.$blockId.location_type_id.html}</span>
50 <span class="crm-address-element is_primary-address-element">{$form.address.$blockId.is_primary.html}</span>
51 <span class="crm-address-element is_billing-address-element">{$form.address.$blockId.is_billing.html}</span>
52 </td>
53 {if $blockId gt 0}
54 <td>
55 <a href="#" title="{ts}Delete Address Block{/ts}" onClick="removeBlock( 'Address', '{$blockId}' ); return false;">{ts}Delete this address{/ts}</a>
56 </td>
57 {/if}
58 </tr>
59
60 {* include shared address template *}
61 {include file="CRM/Contact/Form/ShareAddress.tpl"}
62
63 {/if}
64 <tr>
65 <td>
66 <table id="address_{$blockId}" style="display:block" class="form-layout-compressed">
67 {* build address block w/ address sequence. *}
68 {foreach item=addressElement from=$addressSequence}
69 {include file=CRM/Contact/Form/Edit/Address/$addressElement.tpl}
70 {/foreach}
71 {include file=CRM/Contact/Form/Edit/Address/geo_code.tpl}
72 </table>
73 </td>
74 <td colspan="2">
75 <div class="crm-edit-address-custom_data crm-address-custom-set-block-{$blockId}">
76 {include file="CRM/Contact/Form/Edit/Address/CustomData.tpl"}
77 </div>
78 </td>
79 </tr>
80 </table>
81
82 {if $className eq 'CRM_Contact_Form_Contact'}
83 <div id="addMoreAddress{$blockId}" class="crm-add-address-wrapper">
84 <a href="#" class="button" onclick="buildAdditionalBlocks( 'Address', '{$className}' );return false;"><span><div class="icon add-icon"></div>{ts}Another Address{/ts}</span></a>
85 </div>
86 {/if}
87
88 {if $title and $className eq 'CRM_Contact_Form_Contact'}
89 </div>
90 </div><!-- /.crm-accordion-body -->
91 </div><!-- /.crm-accordion-wrapper -->
92 {/if}
93 {literal}
94 <script type="text/javascript">
95 //to check if same location type is already selected.
96 function checkLocation( object, noAlert ) {
97 var ele = cj('#' + object);
98 var selectedText = cj(':selected', ele).text();
99 cj('td#Address-Primary-html select').each( function() {
100 element = cj(this).attr('id');
101 if ( cj(this).val() && element != object && selectedText == cj(':selected', this).text() ) {
102 if ( !noAlert ) {
103 var alertText = selectedText + {/literal}" {ts escape='js'}has already been assigned to another address. Please select another location for this address.{/ts}"{literal};
104 ele.crmError(alertText);
105 }
106 cj( '#' + object ).val('');
107 }
108 });
109 }
110 </script>
111 {/literal}