2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2015 |
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 {assign var="rowCount" value=1}
29 {foreach from=$viewCustomData item=customValues key=customGroupId}
30 {foreach from=$customValues item=cd_edit key=cvID}
31 {if $multiRecordDisplay neq 'single'}
32 <table class="no-border">
33 {assign var='index' value=$groupId|cat:"_$cvID"}
34 {if ($editOwnCustomData and $showEdit) or ($showEdit and $editCustomData and $groupId)}
38 href="{crmURL p="civicrm/contact/view/cd/edit" q="tableId=`$contactId`&cid=`$contactId`&groupID=`$groupId`&action=update&reset=1"}"
39 class="button" style="margin-left: 6px;"><span><div
40 class="icon ui-icon-pencil"></div>{ts 1=$cd_edit.title}Edit %1{/ts}</span></a><br/><br/>
44 {assign var="showEdit" value=0}
46 <td id="{$cd_edit.name}_{$index}" class="section-shown form-item">
47 <div class="crm-accordion-wrapper {if $cd_edit.collapse_display eq 0 or $skipTitle} {else}collapsed{/if}">
49 <div class="crm-accordion-header">
53 <div class="crm-accordion-body">
54 {if $groupId and $cvID and $editCustomData}
55 <div class="crm-submit-buttons">
56 <a href="#" class="crm-hover-button crm-custom-value-del"
57 data-post='{ldelim}"valueID": "{$cvID}", "groupID": "{$customGroupId}", "contactId": "{$contactId}", "key": "{crmKey name='civicrm/ajax/customvalue'}"{rdelim}'
58 title="{ts 1=$cd_edit.title|cat:" `$rowCount`"}Delete %1{/ts}">
59 <span class="icon delete-icon"></span> {ts}Delete{/ts}
63 {foreach from=$cd_edit.fields item=element key=field_id}
64 <table class="crm-info-panel">
66 {if $element.options_per_line != 0}
67 <td class="label">{$element.field_title}</td>
68 <td class="html-adjust">
69 {* sort by fails for option per line. Added a variable to iterate through the element array*}
70 {foreach from=$element.field_value item=val}
76 <td class="label">{$element.field_title}</td>
77 {if $element.field_type == 'File'}
78 {if $element.field_value.displayURL}
79 <td class="html-adjust">
80 <a href="{$element.field_value.displayURL}" class='crm-image-popup'>
81 <img src="{$element.field_value.displayURL}" height="100" width="100">
85 <td class="html-adjust">
86 <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
90 {if $element.field_data_type == 'Money'}
91 {if $element.field_type == 'Text'}
92 <td class="html-adjust">{$element.field_value|crmMoney}</td>
94 <td class="html-adjust">{$element.field_value}</td>
97 <td class="html-adjust">
98 {if $element.contact_ref_id}
99 <a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
101 {if $element.field_data_type == 'Memo'}
102 {$element.field_value|nl2br}
104 {$element.field_value}
106 {if $element.contact_ref_id}
116 {assign var="rowCount" value=$rowCount+1}
119 <div class="clear"></div>
121 <!-- end of main accordion -->
126 {foreach from=$cd_edit.fields item=element key=field_id}
127 <div class="crm-section">
128 {if $element.options_per_line != 0}
129 <div class="label">{$element.field_title}</div>
130 <div class="content">
131 {* sort by fails for option per line. Added a variable to iterate through the element array*}
132 {foreach from=$element.field_value item=val}
138 <div class="label">{$element.field_title}</div>
139 {if $element.field_type == 'File'}
140 {if $element.field_value.displayURL}
141 <div class="content">
142 <a href="{$element.field_value.displayURL}" class='crm-image-popup'>
143 <img src="{$element.field_value.displayURL}" height="100" width="100">
147 <div class="content">
148 {if $element.field_value}
149 <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
156 {if $element.field_data_type == 'Money'}
157 {if $element.field_type == 'Text'}
158 <div class="content">{if $element.field_value}{$element.field_value|crmMoney}{else}<br/>{/if}</div>
160 <div class="content">{if $element.field_value}{$element.field_value}{else}<br/>{/if}</div>
163 <div class="content">
164 {if $element.contact_ref_id}
165 <a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
167 {if $element.field_data_type == 'Memo'}
168 {$element.field_value|nl2br}
170 {if $element.field_value}{$element.field_value} {else}<br/>{/if}
172 {if $element.contact_ref_id}
184 {*currently delete is available only for tab custom data*}
186 <script type="text/javascript">
189 // Handle delete of multi-record custom data
191 .off('.customValueDel')
192 .on('click.customValueDel', '.crm-custom-value-del', function(e) {
195 msg = '{/literal}{ts escape="js"}The record will be deleted immediately. This action cannot be undone.{/ts}{literal}';
196 CRM.confirm({title: $el.attr('title'), message: msg})
197 .on('crmConfirm:yes', function() {
198 var url = CRM.url('civicrm/ajax/customvalue');
199 var request = $.post(url, $el.data('post'))
200 .done(CRM.refreshParent($el));
201 CRM.status({success: '{/literal}{ts escape="js"}Record Deleted{/ts}{literal}'}, request);