2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
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 {* include wysiwyg related files*}
27 {if !$includeWysiwygEditor}
28 {include file="CRM/common/wysiwyg.tpl" includeWysiwygEditor=true}
31 <script type="text/javascript">
32 CRM.buildCustomData = function( type, subType, subName, cgCount, groupID, isMultiple ) {
33 var dataUrl = {/literal}"{crmURL p=$urlPath h=0 q='snippet=4&type='}"{literal} + type;
36 dataUrl = dataUrl + '&subType=' + subType;
40 dataUrl = dataUrl + '&subName=' + subName;
41 cj('#customData' + subName ).show();
44 cj('#customData').show();
47 dataUrl = dataUrl + '&groupID=' + groupID;
52 dataUrl = dataUrl + '&' + '{$urlPathVar}'
55 dataUrl = dataUrl + '&groupID=' + '{$groupID}'
58 dataUrl = dataUrl + '&qfKey=' + '{$qfKey}'
61 dataUrl = dataUrl + '&entityID=' + '{$entityID}'
69 else if ( cgCount >= 1 ) {
70 var prevCount = cgCount;
74 dataUrl = dataUrl + '&cgcount=' + cgCount;
78 var fname = '#custom_group_' + groupID + '_' + prevCount;
79 if (cj(".add-more-link-" + groupID + "-" + prevCount ).length) {
80 cj(".add-more-link-" + groupID + "-" + prevCount).hide();
83 cj("#add-more-link-"+prevCount).hide();
87 if ( subName && subName != 'null' ) {
88 var fname = '#customData' + subName ;
91 var fname = '#customData';
99 success: function(response) {
100 var target = cj(fname);
102 target.children().each(function() {
103 var id = cj(this).attr('id');
105 // Help values survive storage
106 cj('textarea', this).each(function() {
107 cj(this).text(cj(this).val());
109 cj('option:selected', this).attr('selected', 'selected');
110 cj('option:not(:selected)', this).removeAttr('selected');
111 storage[id] = cj(this).detach();
114 target.html(response).trigger('crmLoad');
115 target.children().each(function() {
116 var id = cj(this).attr('id');
117 if (id && storage[id]) {
118 cj(this).replaceWith(storage[id]);