2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
26 {* this template used to build location block *}
29 {ts}Use this form to configure the location and optional contact information for the event. This information will be displayed on the Event Information page. It will also be included in online registration pages and confirmation emails if these features are enabled.{/ts}
34 {include file="CRM/Contact/Form/Edit/$blockName.tpl"}
36 <div class="crm-block crm-form-block crm-event-manage-location-form-block">
37 <div class="crm-submit-buttons">
38 {include file="CRM/common/formButtons.tpl" location="top"}
41 <table class="form-layout-compressed">
42 <tr id="optionType" class="crm-event-manage-location-form-block-location_option">
44 {$form.location_option.label}
46 {foreach from=$form.location_option key=key item =item}
48 <td class="value"><strong>{$item.html}</strong></td>
52 <tr id="existingLoc" class="crm-event-manage-location-form-block-loc_event_id">
54 {$form.loc_event_id.label}
56 <td class="value" colspan="2">
57 {$form.loc_event_id.html|crmAddClass:huge}
61 <td id="locUsedMsg" colspan="3">
62 {assign var=locUsedMsgTxt value="<strong>Note:</strong> This location is used by multiple events. Modifying location information will change values for all events."}
71 <div id="newLocation">
73 {* Display the address block *}
74 {include file="CRM/Contact/Form/Edit/Address.tpl"}
75 <table class="form-layout-compressed">
76 {* Display the email block(s) *}
77 {include file="CRM/Contact/Form/Edit/Email.tpl"}
79 {* Display the phone block(s) *}
80 {include file="CRM/Contact/Form/Edit/Phone.tpl"}
82 <table class="form-layout-compressed">
83 <tr class="crm-event-is_show_location">
84 <td colspan="2">{$form.is_show_location.label}</td>
86 {$form.is_show_location.html}<br />
87 <span class="description">{ts}Uncheck this box if you want to HIDE the event Address on Event Information and Registration pages as well as on email confirmations.{/ts}
91 <div class="crm-submit-buttons">
92 {include file="CRM/common/formButtons.tpl" location="bottom"}
96 {* Include Javascript to hide and display the appropriate blocks as directed by the php code *}
97 {*include file="CRM/common/showHide.tpl"*}
99 {* include common additional blocks tpl *}
100 {include file="CRM/common/additionalBlocks.tpl"}
102 <script type="text/javascript">
104 var locUsedMsgTxt = {/literal}"{$locUsedMsgTxt}"{literal};
105 var locBlockId = {/literal}"{$form.loc_event_id.value.0}"{literal};
107 if ( {/literal}"{$locUsed}"{literal} ) {
108 displayMessage( true );
112 //FIX ME: by default load 2 blocks and hide add and delete links
113 //we should make additional block function more flexible to set max block limit
114 buildBlocks('Email');
115 buildBlocks('Phone');
117 // build blocks only if it is not built
118 function buildBlocks(element) {
119 if (!$('[id='+ element +'_Block_2]').length) {
120 buildAdditionalBlocks(element, 'CRM_Event_Form_ManageEvent_Location');
124 hideAddDeleteLinks('Email');
125 hideAddDeleteLinks('Phone');
126 function hideAddDeleteLinks(element) {
127 $('#add'+ element).hide();
128 $('[id='+ element +'_Block_2] a:last').hide();
131 $('#loc_event_id').change(function() {
133 url: CRM.url('civicrm/ajax/locBlock', 'reset=1'),
135 data: {'lbid': $(this).val()},
137 success: function(data) {
138 var selectLocBlockId = $('#loc_event_id').val();
140 if ( i == 'count_loc_used' ) {
141 if ( ((selectLocBlockId == locBlockId) && data['count_loc_used'] > 1) ||
142 ((selectLocBlockId != locBlockId) && data['count_loc_used'] > 0) ) {
143 displayMessage( true );
145 displayMessage( false );
148 if (i == 'phone_1_phone_type_id' || i == 'phone_2_phone_type_id') {
149 $('#'+i).select2('val', data[i]);
152 $('#'+i).val(data[i]);
162 function displayMessage( set ) {
165 $('#locUsedMsg').html( locUsedMsgTxt ).addClass('status');
167 $('#locUsedMsg').html( ' ' ).removeClass('status');
172 function showLocFields( ) {
173 var createNew = document.getElementsByName("location_option")[0].checked;
174 var useExisting = document.getElementsByName("location_option")[1].checked;
176 cj('#existingLoc').hide();
177 //clear all location fields values.
178 cj("input[id *= 'address_1_']").val("");
179 cj("input[id *= 'email_1_']").val("");
180 cj("input[id *= 'phone_1_']").val("");
181 //reset country/state.
182 cj("select[id *= 'address_1_']").val("");
183 displayMessage(false);
184 } else if ( useExisting ) {
185 cj('#existingLoc').show();
194 {/if} {* add block if end*}