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