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 {if $multiRecordDisplay neq 'single'}
31 <table class="no-border">
32 {assign var='index' value=$groupId|cat:"_$cvID"}
33 {if ($editOwnCustomData and $showEdit) or ($showEdit and $editCustomData and $groupId)}
37 href="{crmURL p="civicrm/contact/view/cd/edit" q="tableId=`$contactId`&cid=`$contactId`&groupID=`$groupId`&action=update&reset=1"}"
38 class="button" style="margin-left: 6px;"><span><div
39 class="icon edit-icon"></div>{ts 1=$cd_edit.title}Edit %1{/ts}</span></a><br/><br/>
43 {assign var="showEdit" value=0}
44 <tr id="statusmessg_{$index}" class="hiddenElement">
45 <td><span class="success-status"></span></td>
48 <td id="{$cd_edit.name}_{$index}" class="section-shown form-item">
49 <div class="crm-accordion-wrapper {if $cd_edit.collapse_display eq 0 or $skipTitle} {else}collapsed{/if}">
51 <div class="crm-accordion-header">
55 <div class="crm-accordion-body">
56 {if $groupId and $cvID and $editCustomData}
57 <div class="crm-submit-buttons">
59 onclick="showDelete( {$cvID}, '{$cd_edit.name}_{$index}', {$customGroupId}, {$contactId} ); return false;"
60 class="button delete-button" title="{ts 1=$cd_edit.title}Delete this %1 record{/ts}">
61 <span><div class="icon delete-icon"></div>{ts}Delete{/ts}</span>
65 {foreach from=$cd_edit.fields item=element key=field_id}
66 <table class="crm-info-panel">
68 {if $element.options_per_line != 0}
69 <td class="label">{$element.field_title}</td>
70 <td class="html-adjust">
71 {* sort by fails for option per line. Added a variable to iterate through the element array*}
72 {foreach from=$element.field_value item=val}
78 <td class="label">{$element.field_title}</td>
79 {if $element.field_type == 'File'}
80 {if $element.field_value.displayURL}
81 <td class="html-adjust">
82 <a href="{$element.field_value.displayURL}" class='crm-image-popup'>
83 <img src="{$element.field_value.displayURL}" height="100" width="100">
87 <td class="html-adjust">
88 <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
92 {if $element.field_data_type == 'Money'}
93 {if $element.field_type == 'Text'}
94 <td class="html-adjust">{$element.field_value|crmMoney}</td>
96 <td class="html-adjust">{$element.field_value}</td>
99 <td class="html-adjust">
100 {if $element.contact_ref_id}
101 <a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
103 {if $element.field_data_type == 'Memo'}
104 {$element.field_value|nl2br}
106 {$element.field_value}
108 {if $element.contact_ref_id}
120 <div class="clear"></div>
122 <!-- end of main accordian -->
127 {foreach from=$cd_edit.fields item=element key=field_id}
128 <div class="crm-section">
129 {if $element.options_per_line != 0}
130 <div class="label">{$element.field_title}</div>
131 <div class="content">
132 {* sort by fails for option per line. Added a variable to iterate through the element array*}
133 {foreach from=$element.field_value item=val}
139 <div class="label">{$element.field_title}</div>
140 {if $element.field_type == 'File'}
141 {if $element.field_value.displayURL}
142 <div class="content">
143 <a href="{$element.field_value.displayURL}" class='crm-image-popup'>
144 <img src="{$element.field_value.displayURL}" height="100" width="100">
148 <div class="content">
149 {if $element.field_value}
150 <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
157 {if $element.field_data_type == 'Money'}
158 {if $element.field_type == 'Text'}
159 <div class="content">{if $element.field_value}{$element.field_value|crmMoney}{else}<br/>{/if}</div>
161 <div class="content">{if $element.field_value}{$element.field_value}{else}<br/>{/if}</div>
164 <div class="content">
165 {if $element.contact_ref_id}
166 <a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
168 {if $element.field_data_type == 'Memo'}
169 {$element.field_value|nl2br}
171 {if $element.field_value}{$element.field_value} {else}<br/>{/if}
173 {if $element.contact_ref_id}
186 <script type="text/javascript">
188 cj().crmAccordions();
192 {*currently delete is available only for tab custom data*}
194 <script type="text/javascript">
196 function hideStatus(valueID, groupID) {
197 cj('#statusmessg_' + groupID + '_' + valueID).hide();
199 function showDelete(valueID, elementID, groupID, contactID) {
200 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>';
201 cj('tr#statusmessg_' + groupID + '_' + valueID).show().children().find('span').html(confirmMsg);
203 function deleteCustomValue(valueID, elementID, groupID, contactID) {
204 var postUrl = {/literal}"{crmURL p='civicrm/ajax/customvalue' h=0 }"{literal};
207 data: "valueID=" + valueID + "&groupID=" + groupID + "&contactId=" + contactID + "&key={/literal}{crmKey name='civicrm/ajax/customvalue'}{literal}",
209 success: function (html) {
210 cj('#' + elementID).hide();
211 hideStatus(valueID, groupID);
212 CRM.alert('', '{/literal}{ts escape="js"}Record Deleted{/ts}{literal}', 'success');
213 var element = cj('.ui-tabs-nav #tab_custom_' + groupID + ' a');
214 cj(element).html(cj(element).attr('title') + ' (' + html + ') ');