copyright and version fixes
[civicrm-core.git] / templates / CRM / Contact / Form / CustomData.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 template is used for building tabbed custom data *}
27 {if $cdType || $postedInfo}
28 {include file="CRM/Custom/Form/CustomData.tpl"}
29 {if $multiRecordDisplay eq 'single'}
30 <div class="html-adjust">{$form.buttons.html}</div>
31 {* for form rule handling *}
32 {include file="CRM/Form/validate.tpl"}
33 {literal}
34 <script type='text/javascript'>
35 cj(function($) {
36 $('#custom-record-dialog .crm-container-snippet #CustomData').validate(CRM.validate.params);
37 var formOptions = {
38 success: checkResponse // post-submit callback
39 };
40
41 //binding the callback to snippet profile form
42 $('.crm-container-snippet #CustomData').ajaxForm(formOptions);
43 });
44
45 // post-submit callback
46 function checkResponse(responseText, statusText, xhr, $form) {
47 //if there is any form error show the dialog
48 //else redirect to post url
49 if (!cj(responseText).find('.crm-error').html()) {
50 window.location.href = '{/literal}{$backUrl}{literal}';
51 }
52 else {
53 var errorInfo = cj(responseText).find('div.crm-error').html();
54 cj('.crm-container-snippet #CustomData').prepend(errorInfo);
55 }
56 }
57 </script>
58 {/literal}
59 {/if}
60 {else}
61 <div id="customData"></div>
62 <div class="html-adjust">{$form.buttons.html}</div>
63
64 {*include custom data js file*}
65 {include file="CRM/common/customData.tpl"}
66
67 {if $customValueCount}
68 {literal}
69 <script type="text/javascript">
70 var customValueCount = {/literal}"{$customValueCount}"{literal};
71 var groupID = {/literal}"{$groupID}"{literal};
72 var contact_type = {/literal}"{$contact_type}"{literal};
73 var contact_subtype = {/literal}"{$contact_subtype}"{literal};
74 CRM.buildCustomData( contact_type, contact_subtype );
75 for ( var i = 1; i < customValueCount; i++ ) {
76 CRM.buildCustomData( contact_type, contact_subtype, null, i, groupID, true );
77 }
78 </script>
79 {/literal}
80 {/if}
81 {/if}
82
83 {include file="CRM/Form/attachmentjs.tpl"}