Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
1188c7a8 | 3 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 4 | | | |
1188c7a8 TO |
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 | | |
6a488035 TO |
8 | +--------------------------------------------------------------------+ |
9 | *} | |
6a488035 TO |
10 | {literal} |
11 | <script type="text/javascript"> | |
9b177115 | 12 | (function($) { |
2fcb4a7f | 13 | CRM.buildCustomData = function (type, subType, subName, cgCount, groupID, isMultiple, onlySubtype, cid) { |
9b177115 CW |
14 | var dataUrl = CRM.url('civicrm/custom', {type: type}), |
15 | prevCount = 1, | |
a5511c4b | 16 | fname = '#customData', |
9b177115 | 17 | storage = {}; |
6a488035 | 18 | |
9b177115 CW |
19 | if (subType) { |
20 | dataUrl += '&subType=' + subType; | |
21 | } | |
6a488035 | 22 | |
4bd532e8 JP |
23 | if (onlySubtype) { |
24 | dataUrl += '&onlySubtype=' + onlySubtype; | |
25 | } | |
26 | ||
9b177115 CW |
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 | } | |
6a488035 | 37 | |
9b177115 | 38 | {/literal} |
8a76e0df | 39 | {if !empty($groupID)} |
9b177115 CW |
40 | dataUrl += '&groupID=' + '{$groupID}'; |
41 | {/if} | |
8a76e0df | 42 | {if !empty($entityID)} |
9b177115 CW |
43 | dataUrl += '&entityID=' + '{$entityID}'; |
44 | {/if} | |
8a76e0df | 45 | {if !empty($qfKey)} |
29a1df58 | 46 | dataUrl += '&qf=' + '{$qfKey}'; |
fb56e964 | 47 | {/if} |
8a76e0df | 48 | {if !empty($action)} |
2fcb4a7f | 49 | dataUrl += '&action=' + '{$action}'; |
25cdc89e | 50 | {/if} |
9b177115 | 51 | {literal} |
2fcb4a7f SL |
52 | if (cid) { |
53 | dataUrl += '&cid=' + cid; | |
54 | } | |
6a488035 | 55 | |
9b177115 CW |
56 | if (!cgCount) { |
57 | cgCount = 1; | |
58 | } | |
59 | else if (cgCount >= 1) { | |
60 | prevCount = cgCount; | |
61 | cgCount++; | |
62 | } | |
6a488035 | 63 | |
9b177115 | 64 | dataUrl += '&cgcount=' + cgCount; |
6a488035 TO |
65 | |
66 | ||
9b177115 CW |
67 | if (isMultiple) { |
68 | fname = '#custom_group_' + groupID + '_' + prevCount; | |
69 | if ($(".add-more-link-" + groupID + "-" + prevCount).length) { | |
70 | $(".add-more-link-" + groupID + "-" + prevCount).hide(); | |
6a488035 | 71 | } |
9b177115 CW |
72 | else { |
73 | $("#add-more-link-" + prevCount).hide(); | |
6a488035 | 74 | } |
9b177115 | 75 | } |
a5511c4b CW |
76 | else if (subName && subName != 'null') { |
77 | fname += subName; | |
9b177115 | 78 | } |
0816949d | 79 | |
594cfdad | 80 | return CRM.loadPage(dataUrl, {target: fname}); |
9b177115 CW |
81 | }; |
82 | })(CRM.$); | |
6a488035 TO |
83 | </script> |
84 | {/literal} |