Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
232624b1 | 3 | | CiviCRM version 4.4 | |
6a488035 TO |
4 | +--------------------------------------------------------------------+ |
5 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
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 | *} | |
26 | ||
239f7a83 | 27 | <script type="text/javascript">var showTab = Array();</script> |
6a488035 | 28 | {foreach from=$groupTree item=cd_edit key=group_id} |
a3aa37bd | 29 | {if $cd_edit.is_multiple eq 1} |
30 | {assign var=tableID value=$cd_edit.table_id} | |
31 | {assign var=divName value=$group_id|cat:"_$tableID"} | |
32 | <div></div> | |
33 | <div id="{$cd_edit.name|cat:'_$divName'}" | |
34 | class="crm-accordion-wrapper crm-custom-accordion {if $cd_edit.collapse_display and !$skipTitle}collapsed{/if}"> | |
35 | {else} | |
36 | <div id="{$cd_edit.name}" | |
239f7a83 | 37 | class="crm-accordion-wrapper crm-custom-accordion {if $cd_edit.collapse_display}collapsed{/if}"> |
a3aa37bd | 38 | {/if} |
6a488035 TO |
39 | <div class="crm-accordion-header"> |
40 | {$cd_edit.title} | |
41 | </div> | |
42 | ||
239f7a83 KJ |
43 | <div id="customData{$group_id}" class="crm-accordion-body"> |
44 | {if $cd_edit.is_multiple eq 1} | |
45 | {if $cd_edit.table_id} | |
6a488035 | 46 | <table class="no-border"> |
239f7a83 KJ |
47 | <tr id="statusmessg_{$group_id|cat:"_$tableID"}" class="hiddenElement"> |
48 | <td><span class="success-status"></span></td> | |
49 | </tr> | |
50 | <tr> | |
51 | <div class="crm-submit-buttons"> | |
52 | <a href="#" | |
53 | onclick="showDelete( {$tableID}, '{$cd_edit.name}_{$group_id|cat:"_$tableID"}', {$group_id}, {$contactId} ); return false;" | |
54 | class="button delete-button" title="{ts 1=$cv_edit.title}Delete this %1 record{/ts}"> | |
55 | <span><div class="icon delete-icon"></div>{ts}Delete{/ts}</span> | |
56 | </a> | |
57 | </div> | |
58 | <!-- crm-submit-buttons --> | |
59 | </tr> | |
60 | </table> | |
61 | {/if} | |
62 | {/if} | |
63 | {include file="CRM/Custom/Form/CustomData.tpl" formEdit=true} | |
64 | </div> | |
65 | <!-- crm-accordion-body--> | |
66 | </div> | |
67 | <!-- crm-accordion-wrapper --> | |
68 | <div id="custom_group_{$group_id}_{$cgCount}"></div> | |
69 | {/foreach} | |
6a488035 | 70 | |
239f7a83 KJ |
71 | {include file="CRM/common/customData.tpl"} |
72 | <script type="text/javascript"> | |
73 | {literal} | |
6a488035 | 74 | |
239f7a83 KJ |
75 | function hideStatus(valueID, groupID) { |
76 | cj('#statusmessg_' + groupID + '_' + valueID).hide(); | |
77 | } | |
6a488035 | 78 | |
239f7a83 KJ |
79 | function showDelete(valueID, elementID, groupID, contactID) { |
80 | var confirmMsg = '{/literal}{ts escape='js'}Are you sure you want to delete this record?{/ts}{literal} <a href="#" onclick="deleteCustomValue( ' + valueID + ',\'' + elementID + '\',' + groupID + ',' + contactID + ' ); return false;" style="text-decoration: underline;">{/literal}{ts escape='js'}Yes{/ts}{literal}</a> <a href="#" onclick="hideStatus( ' + valueID + ', ' + groupID + ' ); return false;" style="text-decoration: underline;">{/literal}{ts escape='js'}No{/ts}{literal}</a>'; | |
81 | cj('tr#statusmessg_' + groupID + '_' + valueID).show().children().find('span').html(confirmMsg); | |
82 | } | |
6a488035 | 83 | |
239f7a83 KJ |
84 | function deleteCustomValue(valueID, elementID, groupID, contactID) { |
85 | var postUrl = {/literal}"{crmURL p='civicrm/ajax/customvalue' h=0 }"{literal}; | |
86 | cj.ajax({ | |
87 | type: "POST", | |
88 | data: "valueID=" + valueID + "&groupID=" + groupID + "&contactId=" + contactID + "&key={/literal}{crmKey name='civicrm/ajax/customvalue'}{literal}", | |
89 | url: postUrl, | |
90 | success: function (html) { | |
91 | cj('#' + elementID).hide(); | |
92 | hideStatus(valueID, groupID); | |
93 | CRM.alert('', '{/literal}{ts escape="js"}Record Deleted{/ts}{literal}', 'success'); | |
94 | var element = cj('.ui-tabs-nav #tab_custom_' + groupID + ' a'); | |
95 | cj(element).html(cj(element).attr('title') + ' (' + html + ') '); | |
96 | } | |
97 | }); | |
98 | } | |
6a488035 | 99 | |
239f7a83 KJ |
100 | {/literal} |
101 | </script> | |
cbe8b99c | 102 | |
239f7a83 | 103 | {include file="CRM/Form/attachmentjs.tpl"} |