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 {* Custom Data view mode*}
27 {assign var="showEdit" value=1}
28 {foreach from=$viewCustomData item=customValues key=customGroupId}
29 {foreach from=$customValues item=cd_edit key=cvID}
30 <table class="no-border">
31 {assign var='index' value=$groupId|cat:"_$cvID"}
32 {if ($editOwnCustomData and $showEdit) or ($showEdit and $editCustomData and $groupId)}
36 href="{crmURL p="civicrm/contact/view/cd/edit" q="tableId=`$contactId`&cid=`$contactId`&groupID=`$groupId`&action=update&reset=1"}"
37 class="button" style="margin-left: 6px;"><span><div
38 class="icon edit-icon"></div>{ts 1=$cd_edit.title}Edit %1{/ts}</span></a><br/><br/>
42 {assign var="showEdit" value=0}
43 <tr id="statusmessg_{$index}" class="hiddenElement">
44 <td><span class="success-status"></span></td>
47 <td id="{$cd_edit.name}_{$index}" class="section-shown form-item">
48 <div class="crm-accordion-wrapper {if $cd_edit.collapse_display eq 0 or $skipTitle} {else}collapsed{/if}">
50 <div class="crm-accordion-header">
54 <div class="crm-accordion-body">
55 {if $groupId and $cvID and $editCustomData}
56 <div class="crm-submit-buttons">
58 onclick="showDelete( {$cvID}, '{$cd_edit.name}_{$index}', {$customGroupId}, {$contactId} ); return false;"
59 class="button delete-button" title="{ts 1=$cd_edit.title}Delete this %1 record{/ts}">
60 <span><div class="icon delete-icon"></div>{ts}Delete{/ts}</span>
64 {foreach from=$cd_edit.fields item=element key=field_id}
65 <table class="crm-info-panel">
67 {if $element.options_per_line != 0}
68 <td class="label">{$element.field_title}</td>
69 <td class="html-adjust">
70 {* sort by fails for option per line. Added a variable to iterate through the element array*}
71 {foreach from=$element.field_value item=val}
77 <td class="label">{$element.field_title}</td>
78 {if $element.field_type == 'File'}
79 {if $element.field_value.displayURL}
80 <td class="html-adjust">
81 <a href="{$element.field_value.displayURL}" class='crm-image-popup'>
82 <img src="{$element.field_value.displayURL}" height="100" width="100">
86 <td class="html-adjust">
87 <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
91 {if $element.field_data_type == 'Money'}
92 {if $element.field_type == 'Text'}
93 <td class="html-adjust">{$element.field_value|crmMoney}</td>
95 <td class="html-adjust">{$element.field_value}</td>
98 <td class="html-adjust">
99 {if $element.contact_ref_id}
100 <a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
102 {if $element.field_data_type == 'Memo'}
103 {$element.field_value|nl2br}
105 {$element.field_value}
107 {if $element.contact_ref_id}
119 <div class="clear"></div>
121 <!-- end of main accordian -->
128 <script type="text/javascript">
130 cj().crmAccordions();
134 {*currently delete is available only for tab custom data*}
136 <script type="text/javascript">
138 function hideStatus(valueID, groupID) {
139 cj('#statusmessg_' + groupID + '_' + valueID).hide();
141 function showDelete(valueID, elementID, groupID, contactID) {
142 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>';
143 cj('tr#statusmessg_' + groupID + '_' + valueID).show().children().find('span').html(confirmMsg);
145 function deleteCustomValue(valueID, elementID, groupID, contactID) {
146 var postUrl = {/literal}"{crmURL p='civicrm/ajax/customvalue' h=0 }"{literal};
149 data: "valueID=" + valueID + "&groupID=" + groupID + "&contactId=" + contactID + "&key={/literal}{crmKey name='civicrm/ajax/customvalue'}{literal}",
151 success: function (html) {
152 cj('#' + elementID).hide();
153 hideStatus(valueID, groupID);
154 CRM.alert('', '{/literal}{ts escape="js"}Record Deleted{/ts}{literal}', 'success');
155 var element = cj('.ui-tabs-nav #tab_custom_' + groupID + ' a');
156 cj(element).html(cj(element).attr('title') + ' (' + html + ') ');