Ian province abbreviation patch - issue 724
[civicrm-core.git] / templates / CRM / Custom / Page / CustomDataView.tpl
... / ...
CommitLineData
1{*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2015 |
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{* 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)}
35 <tr>
36 <td>
37 <a
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/>
41 </td>
42 </tr>
43 {/if}
44 {assign var="showEdit" value=0}
45 <tr>
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}">
48 {if !$skipTitle}
49 <div class="crm-accordion-header">
50 {$cd_edit.title}
51 </div>
52 {/if}
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}
60 </a>
61 </div>
62 {/if}
63 {foreach from=$cd_edit.fields item=element key=field_id}
64 <table class="crm-info-panel">
65 <tr>
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}
71 {$val}
72 <br/>
73 {/foreach}
74 </td>
75 {else}
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">
82 </a>
83 </td>
84 {else}
85 <td class="html-adjust">
86 <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
87 </td>
88 {/if}
89 {else}
90 {if $element.field_data_type == 'Money'}
91 {if $element.field_type == 'Text'}
92 <td class="html-adjust">{$element.field_value|crmMoney}</td>
93 {else}
94 <td class="html-adjust">{$element.field_value}</td>
95 {/if}
96 {else}
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`"}'>
100 {/if}
101 {if $element.field_data_type == 'Memo'}
102 {$element.field_value|nl2br}
103 {else}
104 {$element.field_value}
105 {/if}
106 {if $element.contact_ref_id}
107 </a>
108 {/if}
109 </td>
110 {/if}
111 {/if}
112 {/if}
113 </tr>
114 </table>
115 {/foreach}
116 {assign var="rowCount" value=$rowCount+1}
117 </div>
118 <!-- end of body -->
119 <div class="clear"></div>
120 </div>
121 <!-- end of main accordion -->
122 </td>
123 </tr>
124 </table>
125{else}
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}
133 {$val}
134 <br/>
135 {/foreach}
136 </div>
137 {else}
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">
144 </a>
145 </div>
146 {else}
147 <div class="content">
148 {if $element.field_value}
149 <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a>
150 {else}
151 <br/>
152 {/if}
153 </div>
154 {/if}
155 {else}
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>
159 {else}
160 <div class="content">{if $element.field_value}{$element.field_value}{else}<br/>{/if}</div>
161 {/if}
162 {else}
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`"}'>
166 {/if}
167 {if $element.field_data_type == 'Memo'}
168 {$element.field_value|nl2br}
169 {else}
170 {if $element.field_value}{$element.field_value} {else}<br/>{/if}
171 {/if}
172 {if $element.contact_ref_id}
173 </a>
174 {/if}
175 </div>
176 {/if}
177 {/if}
178 {/if}
179 </div>
180 {/foreach}
181{/if}
182 {/foreach}
183{/foreach}
184{*currently delete is available only for tab custom data*}
185{if $groupId}
186 <script type="text/javascript">
187 {literal}
188 CRM.$(function($) {
189 // Handle delete of multi-record custom data
190 $('#crm-container')
191 .off('.customValueDel')
192 .on('click.customValueDel', '.crm-custom-value-del', function(e) {
193 e.preventDefault();
194 var $el = $(this),
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);
202 });
203 });
204 });
205 {/literal}
206 </script>
207{/if}
208