2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2014 |
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 edit-icon"></div>{ts 1=$cd_edit.title}Edit %1{/ts}</span></a><br/><br/>
44 {assign var="showEdit" value=0}
45 <tr id="statusmessg_{$index}" class="hiddenElement">
46 <td><span class="success-status"></span></td>
49 <td id="{$cd_edit.name}_{$index}" class="section-shown form-item">
50 <div class="crm-accordion-wrapper {if $cd_edit.collapse_display eq 0 or $skipTitle} {else}collapsed{/if}">
52 <div class="crm-accordion-header">
56 <div class="crm-accordion-body">
57 {if $groupId and $cvID and $editCustomData}
58 <div class="crm-submit-buttons">
59 <a href="#" class="crm-hover-button crm-custom-value-del"
60 data-post='{ldelim}"valueID": "{$cvID}", "groupID": "{$customGroupId}", "contactId": "{$contactId}", "key": "{crmKey name='civicrm/ajax/customvalue'}"{rdelim}'
61 title="{ts 1=$cd_edit.title|cat:" `$rowCount`"}Delete %1{/ts}">
62 <span class="icon delete-icon"></span> {ts}Delete{/ts}
66 {foreach from=$cd_edit.fields item=element key=field_id}
67 <table class="crm-info-panel">
69 {if $element.options_per_line != 0}
70 <td class="label">{$element.field_title}</td>
71 <td class="html-adjust">
72 {* sort by fails for option per line. Added a variable to iterate through the element array*}
73 {foreach from=$element.field_value item=val}
79 <td class="label">{$element.field_title}</td>
80 {if $element.field_type == 'File'}
81 {if $element.field_value.displayURL}
82 <td class="html-adjust">
83 <a href="{$element.field_value.displayURL}" class='crm-image-popup'>
84 <img src="{$element.field_value.displayURL}" height="100" width="100">
88 <td class="html-adjust">
89 <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
93 {if $element.field_data_type == 'Money'}
94 {if $element.field_type == 'Text'}
95 <td class="html-adjust">{$element.field_value|crmMoney}</td>
97 <td class="html-adjust">{$element.field_value}</td>
100 <td class="html-adjust">
101 {if $element.contact_ref_id}
102 <a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
104 {if $element.field_data_type == 'Memo'}
105 {$element.field_value|nl2br}
107 {$element.field_value}
109 {if $element.contact_ref_id}
119 {assign var="rowCount" value=$rowCount+1}
122 <div class="clear"></div>
124 <!-- end of main accordian -->
129 {foreach from=$cd_edit.fields item=element key=field_id}
130 <div class="crm-section">
131 {if $element.options_per_line != 0}
132 <div class="label">{$element.field_title}</div>
133 <div class="content">
134 {* sort by fails for option per line. Added a variable to iterate through the element array*}
135 {foreach from=$element.field_value item=val}
141 <div class="label">{$element.field_title}</div>
142 {if $element.field_type == 'File'}
143 {if $element.field_value.displayURL}
144 <div class="content">
145 <a href="{$element.field_value.displayURL}" class='crm-image-popup'>
146 <img src="{$element.field_value.displayURL}" height="100" width="100">
150 <div class="content">
151 {if $element.field_value}
152 <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
159 {if $element.field_data_type == 'Money'}
160 {if $element.field_type == 'Text'}
161 <div class="content">{if $element.field_value}{$element.field_value|crmMoney}{else}<br/>{/if}</div>
163 <div class="content">{if $element.field_value}{$element.field_value}{else}<br/>{/if}</div>
166 <div class="content">
167 {if $element.contact_ref_id}
168 <a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
170 {if $element.field_data_type == 'Memo'}
171 {$element.field_value|nl2br}
173 {if $element.field_value}{$element.field_value} {else}<br/>{/if}
175 {if $element.contact_ref_id}
187 {*currently delete is available only for tab custom data*}
189 <script type="text/javascript">
192 // Handle delete of multi-record custom data
194 .off('.customValueDel')
195 .on('click.customValueDel', '.crm-custom-value-del', function(e) {
198 msg = '{/literal}{ts escape="js"}The record will be deleted immediately. This action cannot be undone.{/ts}{literal}';
199 CRM.confirm({title: $el.attr('title'), message: msg})
200 .on('crmConfirm:yes', function() {
201 var url = CRM.url('civicrm/ajax/customvalue');
202 var request = $.post(url, $el.data('post'))
203 .done(CRM.refreshParent($el));
204 CRM.status({success: '{/literal}{ts escape="js"}Record Deleted{/ts}{literal}'}, request);