CRM-13992 : custom data single record view handling, DELETE action handling, QA check...
[civicrm-core.git] / templates / CRM / Contact / Page / View / CustomData.tpl
CommitLineData
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{* template for custom data *}
27{if $action eq 0 or $action eq 1 or $action eq 2 or $recordActivity}
fe06c0fb 28 {include file="CRM/Contact/Form/CustomData.tpl" mainEdit=$mainEditForm}
6a488035 29{/if}
e41f4660 30{if $displayStyle eq 'tableOriented'}
eb2b4bdb
PJ
31 {include file='CRM/Profile/Page/MultipleRecordFieldsListing.tpl' showListing=1 dontShowTitle=1 pageViewType='customDataView'}
32 {literal}
33 <script type="text/javascript">
34 function showDeleteInDialog(valueID, groupID, contactID) {
35 var confirmText = '{/literal}{ts escape='js'}Are you sure you want to delete this record?{/ts}{literal}';
36 cj('#browseValues').after("<div id='delete-record'></div>");
37 cj('#delete-record').html(confirmText).dialog({
38 title: "{/literal}{ts escape='js'}Delete Record{/ts}{literal}",
39 modal: true,
40 width: 680,
41 overlay: {
42 opacity: 0.5,
43 background: "black"
44 },
45
46 buttons: {
47 {/literal}"{ts escape='js'}Cancel{/ts}"{literal}: function() {
48 cj(this).dialog("close");
49 cj('#delete-record').html('');
50 },
51 {/literal}"{ts escape='js'}OK{/ts}{literal}": function() {
52 deleteCustomValueRec(valueID, groupID, contactID);
53 window.setTimeout(function(){window.location.reload( )}, 1000);
54 }
55 }
56 });
57 }
58
59 function deleteCustomValueRec(valueID, groupID, contactID) {
60 var postUrl = {/literal}"{crmURL p='civicrm/ajax/customvalue' h=0 }"{literal};
61 cj.ajax({
62 type: "POST",
63 data: "valueID=" + valueID + "&groupID=" + groupID + "&contactId=" + contactID + "&key={/literal}{crmKey name='civicrm/ajax/customvalue'}{literal}",
64 url: postUrl,
65 success: function (html) {
66 CRM.alert('', '{/literal}{ts escape="js"}Record Deleted{/ts}{literal}', 'success');
67 }
68 });
69 }
70 </script>
71 {/literal}
e41f4660 72{else}
6a488035 73{strip}
fe06c0fb
KJ
74 {if $action eq 16 or $action eq 4} {* Browse or View actions *}
75 <div class="form-item">
76 {include file="CRM/Custom/Page/CustomDataView.tpl"}
77 </div>
78 {/if}
6a488035 79{/strip}
fe06c0fb 80
6a488035 81{if $mainEditForm}
fe06c0fb
KJ
82 <script type="text/javascript">
83 var showBlocks1 = new Array({$showBlocks1});
84 var hideBlocks1 = new Array({$hideBlocks1});
85
86 on_load_init_blocks(showBlocks1, hideBlocks1);
87 </script>
6a488035 88{else}
fe06c0fb 89 <script type="text/javascript">
6a488035
TO
90 var showBlocks = new Array({$showBlocks});
91 var hideBlocks = new Array({$hideBlocks});
92
93 {* hide and display the appropriate blocks as directed by the php code *}
fe06c0fb 94 on_load_init_blocks(showBlocks, hideBlocks);
6a488035
TO
95 </script>
96{/if}
e41f4660 97{/if}