Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
819d0d41 | 3 | | CiviCRM version 4.5 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
819d0d41 | 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
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 | *} | |
7c20a3bd AW |
26 | {* include wysiwyg related files*} |
27 | {if !$includeWysiwygEditor} | |
28 | {include file="CRM/common/wysiwyg.tpl" includeWysiwygEditor=true} | |
29 | {/if} | |
6a488035 TO |
30 | {* Custom Data view mode*} |
31 | {foreach from=$viewCustomData item=customValues key=customGroupId} | |
32 | {foreach from=$customValues item=cd_edit key=cvID} | |
33 | {assign var='index' value=$groupId|cat:"_$cvID"} | |
34 | <div id="{$cd_edit.name}" class="crm-accordion-wrapper {if $cd_edit.collapse_display neq 0}collapsed{/if}"> | |
35 | <div class="crm-accordion-header"> | |
36 | {$cd_edit.title} | |
37 | </div> | |
38 | <div class="crm-accordion-body"> | |
39 | {foreach from=$cd_edit.fields item=element key=field_id} | |
40 | <table class="crm-info-panel"> | |
41 | <tr> | |
42 | {if $element.options_per_line != 0} | |
43 | <td class="label">{$element.field_title}</td> | |
44 | <td class="html-adjust"> | |
45 | {* sort by fails for option per line. Added a variable to iterate through the element array*} | |
46 | {foreach from=$element.field_value item=val} | |
47 | {$val}<br/> | |
48 | {/foreach} | |
49 | </td> | |
50 | {else} | |
51 | <td class="label">{$element.field_title}</td> | |
52 | {if $element.field_type == 'File'} | |
53 | {if $element.field_value.displayURL} | |
54 | <td class="html-adjust"> | |
ebb9197b C |
55 | <a href="{$element.field_value.displayURL}" class='crm-image-popup'> |
56 | <img src="{$element.field_value.displayURL}" height = "100" width="100"> | |
6a488035 TO |
57 | </a> |
58 | </td> | |
59 | {else} | |
60 | <td class="html-adjust"> | |
61 | <a href="{$element.field_value.fileURL}">{$element.field_value.fileName}</a> | |
62 | </td> | |
63 | {/if} | |
64 | {else} | |
65 | <td class="html-adjust">{$element.field_value}</td> | |
66 | {/if} | |
67 | {/if} | |
68 | </tr> | |
69 | </table> | |
70 | {/foreach} | |
71 | <div> | |
e08129f7 | 72 | <a href="{crmURL p="civicrm/case/cd/edit" q="cgcount=1&action=update&reset=1&type=Case&entityID=$caseID&groupID=$customGroupId&cid=$contactID&subType=$caseTypeID"}" class="button"> |
6a488035 TO |
73 | <span><div class="icon edit-icon"></div>{ts}Edit{/ts}</span> |
74 | </a> | |
75 | </div> | |
76 | <br/> | |
e08129f7 | 77 | <div class="clear"></div> |
6a488035 | 78 | </div> |
6a488035 TO |
79 | </div> |
80 | ||
81 | {/foreach} | |
82 | {/foreach} | |
83 | <div id="case_custom_edit"></div> | |
84 | ||
6a488035 TO |
85 | {*currently delete is available only for tab custom data*} |
86 | {if $groupId} | |
87 | <script type="text/javascript"> | |
88 | {literal} | |
89 | function hideStatus(valueID, groupID) { | |
90 | cj('#statusmessg_' + groupID + '_' + valueID).hide( ); | |
91 | } | |
92 | ||
93 | function showDelete(valueID, elementID, groupID, contactID) { | |
b7054e52 | 94 | 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 |
95 | cj('tr#statusmessg_' + groupID + '_' + valueID).show( ).children().find('span').html( confirmMsg ); |
96 | } | |
97 | ||
98 | function deleteCustomValue( valueID, elementID, groupID, contactID ) { | |
99 | var postUrl = {/literal}"{crmURL p='civicrm/ajax/customvalue' h=0 }"{literal}; | |
e11b84ce | 100 | var request = cj.ajax({ |
6a488035 TO |
101 | type: "POST", |
102 | data: "valueID=" + valueID + "&groupID=" + groupID +"&contactId=" + contactID + "&key={/literal}{crmKey name='civicrm/ajax/customvalue'}{literal}", | |
103 | url: postUrl, | |
104 | success: function(html){ | |
640c3933 CW |
105 | cj('#'+ elementID).hide(); |
106 | hideStatus(valueID, groupID); | |
6a488035 TO |
107 | var element = cj( '.ui-tabs-nav #tab_custom_' + groupID + ' a' ); |
108 | cj(element).html(cj(element).attr('title') + ' ('+ html+') '); | |
109 | } | |
110 | }); | |
e11b84ce | 111 | CRM.status({success: '{/literal}{ts escape="js"}Record Deleted{/ts}{literal}'}, request); |
6a488035 TO |
112 | } |
113 | {/literal} | |
6a488035 TO |
114 | </script> |
115 | {/if} | |
116 |