Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
3 | | CiviCRM version 4.3 | | |
4 | +--------------------------------------------------------------------+ | |
5 | | Copyright CiviCRM LLC (c) 2004-2013 | | |
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 | {foreach from=$viewCustomData item=customValues key=customGroupId} | |
28 | {foreach from=$customValues item=cd_edit key=cvID} | |
29 | {assign var='index' value=$groupId|cat:"_$cvID"} | |
30 | <div id="{$cd_edit.name}" class="crm-accordion-wrapper {if $cd_edit.collapse_display neq 0}collapsed{/if}"> | |
31 | <div class="crm-accordion-header"> | |
32 | {$cd_edit.title} | |
33 | </div> | |
34 | <div class="crm-accordion-body"> | |
35 | {foreach from=$cd_edit.fields item=element key=field_id} | |
36 | <table class="crm-info-panel"> | |
37 | <tr> | |
38 | {if $element.options_per_line != 0} | |
39 | <td class="label">{$element.field_title}</td> | |
40 | <td class="html-adjust"> | |
41 | {* sort by fails for option per line. Added a variable to iterate through the element array*} | |
42 | {foreach from=$element.field_value item=val} | |
43 | {$val}<br/> | |
44 | {/foreach} | |
45 | </td> | |
46 | {else} | |
47 | <td class="label">{$element.field_title}</td> | |
48 | {if $element.field_type == 'File'} | |
49 | {if $element.field_value.displayURL} | |
50 | <td class="html-adjust"> | |
ebb9197b C |
51 | <a href="{$element.field_value.displayURL}" class='crm-image-popup'> |
52 | <img src="{$element.field_value.displayURL}" height = "100" width="100"> | |
6a488035 TO |
53 | </a> |
54 | </td> | |
55 | {else} | |
56 | <td class="html-adjust"> | |
57 | <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a> | |
58 | </td> | |
59 | {/if} | |
60 | {else} | |
61 | <td class="html-adjust">{$element.field_value}</td> | |
62 | {/if} | |
63 | {/if} | |
64 | </tr> | |
65 | </table> | |
66 | {/foreach} | |
67 | <div> | |
68 | <a href="#" class="button" style="margin-left: 6px;" | |
69 | onclick="updateCaseCustom({$caseID}, {$customGroupId}, {$contactID}, {$caseTypeID}); return false;"> | |
70 | <span><div class="icon edit-icon"></div>{ts}Edit{/ts}</span> | |
71 | </a> | |
72 | </div> | |
73 | <br/> | |
74 | </div> | |
75 | <div class="clear"></div> | |
76 | </div> | |
77 | ||
78 | {/foreach} | |
79 | {/foreach} | |
80 | <div id="case_custom_edit"></div> | |
81 | ||
82 | {literal} | |
83 | <script type="text/javascript"> | |
84 | cj(function() { | |
85 | cj().crmAccordions(); | |
86 | }); | |
87 | </script> | |
88 | {/literal} | |
89 | {*currently delete is available only for tab custom data*} | |
90 | {if $groupId} | |
91 | <script type="text/javascript"> | |
92 | {literal} | |
93 | function hideStatus(valueID, groupID) { | |
94 | cj('#statusmessg_' + groupID + '_' + valueID).hide( ); | |
95 | } | |
96 | ||
97 | function showDelete(valueID, elementID, groupID, contactID) { | |
b7054e52 | 98 | 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>'; |
6a488035 TO |
99 | cj('tr#statusmessg_' + groupID + '_' + valueID).show( ).children().find('span').html( confirmMsg ); |
100 | } | |
101 | ||
102 | function deleteCustomValue( valueID, elementID, groupID, contactID ) { | |
103 | var postUrl = {/literal}"{crmURL p='civicrm/ajax/customvalue' h=0 }"{literal}; | |
104 | cj.ajax({ | |
105 | type: "POST", | |
106 | data: "valueID=" + valueID + "&groupID=" + groupID +"&contactId=" + contactID + "&key={/literal}{crmKey name='civicrm/ajax/customvalue'}{literal}", | |
107 | url: postUrl, | |
108 | success: function(html){ | |
640c3933 CW |
109 | cj('#'+ elementID).hide(); |
110 | hideStatus(valueID, groupID); | |
111 | CRM.alert('', '{/literal}{ts escape="js"}Record Deleted{/ts}{literal}', 'success'); | |
6a488035 TO |
112 | var element = cj( '.ui-tabs-nav #tab_custom_' + groupID + ' a' ); |
113 | cj(element).html(cj(element).attr('title') + ' ('+ html+') '); | |
114 | } | |
115 | }); | |
116 | } | |
117 | {/literal} | |
118 | </script> | |
119 | {else} | |
120 | <script type="text/javascript"> | |
121 | {literal} | |
122 | function updateCaseCustom( entityID, groupID, contactID, subType ) { | |
123 | var dataURL = {/literal}"{crmURL p="civicrm/case/cd/edit" q="snippet=5&cgcount=1&action=update&reset=1" h=0}"{literal}; | |
124 | dataURL = dataURL + '&type=Case&entityID=' + entityID + '&groupID=' + groupID + '&cid=' + contactID + ( subType ? '&subType=' + subType : ''); | |
125 | ||
126 | cj.ajax({ | |
127 | url: dataURL, | |
128 | success: function(content) { | |
129 | cj('#case_custom_edit').show( ).html(content).dialog({ | |
3fc02b89 | 130 | title: "{/literal}{ts escape='js'}Update Case Information{/ts}{literal}", |
6a488035 TO |
131 | modal: true, |
132 | width: 680, | |
133 | overlay: { | |
134 | opacity: 0.5, | |
135 | background: "black" | |
136 | }, | |
3fc02b89 CW |
137 | open: function() { |
138 | var dialog = this; | |
139 | cj('#_qf_CustomData_cancel').click(function() { | |
140 | cj(dialog).dialog('close'); | |
141 | return false; | |
142 | }); | |
143 | }, | |
6a488035 | 144 | close: function(event, ui) { |
3fc02b89 | 145 | cj(this).dialog('destroy'); |
6a488035 TO |
146 | } |
147 | }); | |
148 | } | |
149 | }); | |
150 | } | |
151 | {/literal} | |
152 | </script> | |
153 | {/if} | |
154 |