2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
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">
33 CRM.buildCustomData = function( type, subType, subName, cgCount, groupID, isMultiple )
35 var dataUrl = {/literal}"{crmURL p=$urlPath h=0 q='snippet=4&type='}"{literal} + type;
38 dataUrl = dataUrl + '&subType=' + subType;
42 dataUrl = dataUrl + '&subName=' + subName;
43 cj('#customData' + subName ).show();
46 cj('#customData').show();
49 dataUrl = dataUrl + '&groupID=' + groupID;
54 dataUrl = dataUrl + '&' + '{$urlPathVar}'
57 dataUrl = dataUrl + '&groupID=' + '{$groupID}'
60 dataUrl = dataUrl + '&qfKey=' + '{$qfKey}'
63 dataUrl = dataUrl + '&entityID=' + '{$entityID}'
71 else if ( cgCount >= 1 ) {
72 var prevCount = cgCount;
76 dataUrl = dataUrl + '&cgcount=' + cgCount;
80 var fname = '#custom_group_' + groupID + '_' + prevCount;
81 if (cj(".add-more-link-" + groupID + "-" + prevCount ).length) {
82 cj(".add-more-link-" + groupID + "-" + prevCount).hide();
85 cj("#add-more-link-"+prevCount).hide();
89 if ( subName && subName != 'null' ) {
90 var fname = '#customData' + subName ;
93 var fname = '#customData';
101 success: function(response) {
102 var target = cj(fname);
104 target.children().each(function() {
105 var id = cj(this).attr('id');
107 // Help values survive storage
108 cj('textarea', this).each(function() {
109 cj(this).text(cj(this).val());
111 cj('option:selected', this).prop('selected', true);
112 cj('option:not(:selected)', this).prop('selected', false);
113 storage[id] = cj(this).detach();
116 target.html(response);
117 target.children().each(function() {
118 var id = cj(this).attr('id');
119 if (id && storage[id]) {
120 cj(this).replaceWith(storage[id]);