Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
819d0d41 | 3 | | CiviCRM version 4.5 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
819d0d41 | 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
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 | {if !empty($form.address.$blockId.street_address)} | |
68eb38dc | 27 | <tr id="streetAddress_{$blockId}"> |
7f7fa13a EM |
28 | <td colspan="2"> |
29 | {$form.address.$blockId.street_address.label} {help id="id-street-address" file="CRM/Contact/Form/Contact.hlp"}<br /> | |
30 | {$form.address.$blockId.street_address.html} | |
31 | {if $parseStreetAddress eq 1 && ($action eq 1 || $action eq 2)} | |
68eb38dc DG |
32 | <a href="#" title="{ts}Edit Address Elements{/ts}" onClick="processAddressFields( 'addressElements' , '{$blockId}', 1 );return false;">{ts}Edit Address Elements{/ts}</a> |
33 | {help id="id-edit-street-elements" file="CRM/Contact/Form/Contact.hlp"} | |
34 | {/if} | |
7f7fa13a EM |
35 | </td> |
36 | </tr> | |
6a488035 | 37 | |
68eb38dc | 38 | {if $parseStreetAddress eq 1 && ($action eq 1 || $action eq 2)} |
7f7fa13a | 39 | <tr id="addressElements_{$blockId}" class=hiddenElement> |
68eb38dc DG |
40 | <td> |
41 | {$form.address.$blockId.street_number.label}<br /> | |
42 | {$form.address.$blockId.street_number.html} | |
43 | </td> | |
6a488035 | 44 | |
68eb38dc DG |
45 | <td> |
46 | {$form.address.$blockId.street_name.label}<br /> | |
47 | {$form.address.$blockId.street_name.html}<br /> | |
48 | </td> | |
6a488035 | 49 | |
68eb38dc | 50 | <td colspan="2"> |
7f7fa13a | 51 | {$form.address.$blockId.street_unit.label}<br /> |
68eb38dc DG |
52 | {$form.address.$blockId.street_unit.html} |
53 | <a href="#" title="{ts}Edit Street Address{/ts}" onClick="processAddressFields( 'streetAddress', '{$blockId}', 1 );return false;">{ts}Edit Complete Street Address{/ts}</a> | |
54 | {help id="id-edit-complete-street" file="CRM/Contact/Form/Contact.hlp"} | |
55 | </td> | |
56 | </tr> | |
7f7fa13a | 57 | {/if} |
6a488035 TO |
58 | |
59 | {if $parseStreetAddress eq 1} | |
60 | {literal} | |
61 | <script type="text/javascript"> | |
62 | function processAddressFields( name, blockId, loadData ) { | |
63 | ||
64 | if ( loadData ) { | |
65 | var allAddressValues = {/literal}{if $allAddressFieldValues}{$allAddressFieldValues}{else}''{/if}{literal}; | |
66 | ||
67 | var streetName = eval( "allAddressValues.street_name_" + blockId ); | |
68 | if (streetName === null) streetName = ''; | |
69 | var streetUnit = eval( "allAddressValues.street_unit_" + blockId ); | |
70 | if (streetUnit === null) streetUnit = ''; | |
71 | var streetNumber = eval( "allAddressValues.street_number_" + blockId ); | |
72 | if (streetNumber === null) streetNumber = ''; | |
73 | var streetAddress = eval( "allAddressValues.street_address_" + blockId ); | |
74 | if (streetAddress === null) streetAddress = ''; | |
75 | } | |
76 | ||
77 | if ( name == 'addressElements' ) { | |
78 | if ( loadData ) { | |
79 | streetAddress = ''; | |
80 | } | |
81 | ||
82 | cj('#addressElements_' + blockId).show(); | |
83 | cj('#streetAddress_' + blockId).hide(); | |
84 | } else { | |
85 | if ( loadData ) { | |
86 | streetNumber = streetName = streetUnit = ''; | |
87 | } | |
88 | ||
89 | cj('#streetAddress_' + blockId).show(); | |
90 | cj('#addressElements_'+ blockId).hide(); | |
91 | } | |
92 | ||
93 | // set the values. | |
94 | if ( loadData ) { | |
95 | cj( '#address_' + blockId +'_street_name' ).val( streetName ); | |
96 | cj( '#address_' + blockId +'_street_unit' ).val( streetUnit ); | |
97 | cj( '#address_' + blockId +'_street_number' ).val( streetNumber ); | |
98 | cj( '#address_' + blockId +'_street_address' ).val( streetAddress ); | |
99 | } | |
100 | } | |
101 | ||
102 | </script> | |
103 | {/literal} | |
104 | {/if} | |
105 | {/if} | |
106 |