2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.6 |
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 {* add/update/view custom data group *}
27 <div class="crm-block crm-form-block">
28 <div id="help">{ts}Use Custom Field Sets to add logically related fields for a specific type of CiviCRM record (e.g. contact records, contribution records, etc.).{/ts} {help id="id-group_intro"}</div>
29 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
30 <table class="form-layout">
32 <td class="label">{$form.title.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_custom_group' field='title' id=$gid}{/if}</td>
33 <td class="html-adjust">{$form.title.html} {help id="id-title"}</td>
36 <td class="label">{$form.extends.label}</td>
37 <td>{$form.extends.html} {help id="id-extends"}</td>
40 <td class="label">{$form.weight.label}</td>
41 <td>{$form.weight.html} {help id="id-weight"}</td>
43 <tr id="is_multiple" class="hiddenElement"> {* This section shown only when Used For = Contact, Individ, Org or Household. *}
45 <td class="html-adjust">{$form.is_multiple.html} {$form.is_multiple.label} {help id="id-is_multiple"}</td>
47 <tr id="multiple" class="hiddenElement">
48 {*<dt>{$form.min_multiple.label}</dt><dd>{$form.min_multiple.html}</dd>*}
49 <td class="label">{$form.max_multiple.label}</td>
50 <td>{$form.max_multiple.html} {help id="id-max_multiple"}</td>
52 <tr id="style" class="hiddenElement">
53 <td class="label">{$form.style.label}</td>
54 <td>{$form.style.html} {help id="id-display_style"}</td>
56 <tr class="html-adjust">
58 <td>{$form.collapse_display.html} {$form.collapse_display.label} {help id="id-collapse"}</td>
62 <td>{$form.collapse_adv_display.html} {$form.collapse_adv_display.label} {help id="id-collapse-adv"}</td>
66 <td>{$form.is_active.html} {$form.is_active.label}</td>
68 <tr class="html-adjust">
69 <td class="label">{$form.help_pre.label} <!--{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_custom_group' field='help_pre' id=$gid}{/if}-->{help id="id-help_pre"}</td>
70 <td>{$form.help_pre.html}</td>
72 <tr class="html-adjust">
73 <td class="label">{$form.help_post.label} <!--{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_custom_group' field='help_post' id=$gid}{/if}-->{help id="id-help_post"}</td>
74 <td>{$form.help_post.html}</td>
77 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
79 {if $action eq 2 or $action eq 4} {* Update or View*}
81 <div class="action-link">
82 <a href="{crmURL p='civicrm/admin/custom/group/field' q="action=browse&reset=1&gid=$gid"}" class="button"><span>{ts}Custom Fields for this Set{/ts}</span></a>
87 <script type="text/Javascript">
91 $('#extends_0').change(function() {
95 var isGroupEmpty = "{/literal}{$isGroupEmpty}{literal}";
99 $('#is_multiple').click(function() {
103 function showHideStyle() {
105 var extend = $('#extends_0').val();
107 var contactTypes = {/literal}{$contactTypes}{literal};
108 var showStyle = "{/literal}{$showStyle}{literal}";
109 var showMultiple = "{/literal}{$showMultiple}{literal}";
110 var showMaxMultiple = "{/literal}{$showMaxMultiple}{literal}";
112 if ($.inArray(extend, contactTypes) >= 0) {
117 $("tr#style").show();
118 $("tr#is_multiple").show();
119 if ($('#is_multiple :checked').length) {
120 $("tr#multiple").show();
124 $("tr#style").hide();
125 $("tr#is_multiple").hide();
126 $("tr#multiple").hide();
130 $("tr#style").show();
134 $("tr#style").show();
135 $("tr#is_multiple").show();
138 if (!showMaxMultiple) {
139 $("tr#multiple").hide();
141 else if($( '#is_multiple').prop('checked')) {
142 $("tr#multiple").show();
146 function showRange(onFormLoad) {
147 if($("#is_multiple :checked").length) {
148 $("tr#multiple").show();
149 $('#collapse_display').prop('checked', '');
150 $("select#style option[value='Tab with table']").prop("selected", true);
153 $('#collapse_display').prop('checked', 'checked');
154 $("tr#multiple").hide();
156 $("select#style option[value='Inline']").prop("selected", true);
161 // In update mode, when 'extends' is set to an option which doesn't have
162 // any options in 2nd selector (for subtypes) -
163 var subtypes = document.getElementById('extends_1');
165 if (subtypes.options.length <= 0) {
166 subtypes.style.display = 'none';
169 subtypes.style.display = 'inline';
174 function warnDataLoss() {
175 var submittedSubtypes = cj('#extends_1').val();
176 var defaultSubtypes = {/literal}{$defaultSubtypes}{literal};
179 cj.each(defaultSubtypes, function(index, subtype) {
180 if (cj.inArray(subtype, submittedSubtypes) < 0) {
186 return confirm( 'One or more subtypes has been un-selected from the list. Any custom data associated with un-selected subtype would be removed. Click OK to proceed.' );