Merge pull request #16715 from mattwire/cancelsubscriptiongeneratetext
[civicrm-core.git] / templates / CRM / common / customData.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
4 | |
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
8 +--------------------------------------------------------------------+
9 *}
10 {literal}
11 <script type="text/javascript">
12 (function($) {
13 CRM.buildCustomData = function (type, subType, subName, cgCount, groupID, isMultiple, onlySubtype, cid) {
14 var dataUrl = CRM.url('civicrm/custom', {type: type}),
15 prevCount = 1,
16 fname = '#customData',
17 storage = {};
18
19 if (subType) {
20 dataUrl += '&subType=' + subType;
21 }
22
23 if (onlySubtype) {
24 dataUrl += '&onlySubtype=' + onlySubtype;
25 }
26
27 if (subName) {
28 dataUrl += '&subName=' + subName;
29 $('#customData' + subName).show();
30 }
31 else {
32 $('#customData').show();
33 }
34 if (groupID) {
35 dataUrl += '&groupID=' + groupID;
36 }
37
38 {/literal}
39 {if $groupID}
40 dataUrl += '&groupID=' + '{$groupID}';
41 {/if}
42 {if $entityID}
43 dataUrl += '&entityID=' + '{$entityID}';
44 {/if}
45 {if $qfKey}
46 dataUrl += '&qf=' + '{$qfKey}';
47 {/if}
48 {if $action}
49 dataUrl += '&action=' + '{$action}';
50 {/if}
51 {literal}
52 if (cid) {
53 dataUrl += '&cid=' + cid;
54 }
55
56 if (!cgCount) {
57 cgCount = 1;
58 }
59 else if (cgCount >= 1) {
60 prevCount = cgCount;
61 cgCount++;
62 }
63
64 dataUrl += '&cgcount=' + cgCount;
65
66
67 if (isMultiple) {
68 fname = '#custom_group_' + groupID + '_' + prevCount;
69 if ($(".add-more-link-" + groupID + "-" + prevCount).length) {
70 $(".add-more-link-" + groupID + "-" + prevCount).hide();
71 }
72 else {
73 $("#add-more-link-" + prevCount).hide();
74 }
75 }
76 else if (subName && subName != 'null') {
77 fname += subName;
78 }
79
80 return CRM.loadPage(dataUrl, {target: fname});
81 };
82 })(CRM.$);
83 </script>
84 {/literal}