Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
39de6fd5 | 3 | | CiviCRM version 4.6 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
e7112fa7 | 5 | | Copyright CiviCRM LLC (c) 2004-2015 | |
6a488035 TO |
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 | *} | |
6a488035 TO |
26 | {literal} |
27 | <script type="text/javascript"> | |
9b177115 CW |
28 | (function($) { |
29 | CRM.buildCustomData = function (type, subType, subName, cgCount, groupID, isMultiple) { | |
30 | var dataUrl = CRM.url('civicrm/custom', {type: type}), | |
31 | prevCount = 1, | |
32 | fname, | |
33 | storage = {}; | |
6a488035 | 34 | |
9b177115 CW |
35 | if (subType) { |
36 | dataUrl += '&subType=' + subType; | |
37 | } | |
6a488035 | 38 | |
9b177115 CW |
39 | if (subName) { |
40 | dataUrl += '&subName=' + subName; | |
41 | $('#customData' + subName).show(); | |
42 | } | |
43 | else { | |
44 | $('#customData').show(); | |
45 | } | |
46 | if (groupID) { | |
47 | dataUrl += '&groupID=' + groupID; | |
48 | } | |
6a488035 | 49 | |
9b177115 CW |
50 | {/literal} |
51 | {if $urlPathVar} | |
52 | dataUrl += '&' + '{$urlPathVar}'; | |
53 | {/if} | |
54 | {if $groupID} | |
55 | dataUrl += '&groupID=' + '{$groupID}'; | |
56 | {/if} | |
57 | {if $entityID} | |
58 | dataUrl += '&entityID=' + '{$entityID}'; | |
59 | {/if} | |
60 | {literal} | |
6a488035 | 61 | |
9b177115 CW |
62 | if (!cgCount) { |
63 | cgCount = 1; | |
64 | } | |
65 | else if (cgCount >= 1) { | |
66 | prevCount = cgCount; | |
67 | cgCount++; | |
68 | } | |
6a488035 | 69 | |
9b177115 | 70 | dataUrl += '&cgcount=' + cgCount; |
6a488035 TO |
71 | |
72 | ||
9b177115 CW |
73 | if (isMultiple) { |
74 | fname = '#custom_group_' + groupID + '_' + prevCount; | |
75 | if ($(".add-more-link-" + groupID + "-" + prevCount).length) { | |
76 | $(".add-more-link-" + groupID + "-" + prevCount).hide(); | |
6a488035 | 77 | } |
9b177115 CW |
78 | else { |
79 | $("#add-more-link-" + prevCount).hide(); | |
6a488035 | 80 | } |
9b177115 CW |
81 | } |
82 | else { | |
83 | fname = '#customData' + (subName && subName != 'null') ? subName : ''; | |
84 | } | |
85 | ||
86 | CRM.loadPage(dataUrl, {target: fname}); | |
87 | }; | |
88 | })(CRM.$); | |
6a488035 TO |
89 | </script> |
90 | {/literal} |