CRM-16415 Replacing plus-circle icon
[civicrm-core.git] / templates / CRM / Contact / Page / View / Note.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
2c4c49ca 3 | CiviCRM version 4.7 |
6a488035 4 +--------------------------------------------------------------------+
e7112fa7 5 | Copyright CiviCRM LLC (c) 2004-2015 |
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*}
26<div class="view-content">
27{if $action eq 4}{* when action is view *}
28 {if $notes}
6a488035
TO
29 <div class="crm-block crm-content-block crm-note-view-block">
30 <table class="crm-info-panel">
31 <tr><td class="label">{ts}Subject{/ts}</td><td>{$note.subject}</td></tr>
32 <tr><td class="label">{ts}Date:{/ts}</td><td>{$note.modified_date|crmDate}</td></tr>
33 <tr><td class="label">{ts}Privacy:{/ts}</td><td>{$note.privacy}</td></tr>
34 <tr><td class="label"></td><td>{$note.note|nl2br}</td></tr>
35
36 {if $currentAttachmentInfo}
37 {include file="CRM/Form/attachment.tpl"}
38 {/if}
39 </table>
71b47fcd 40 <div class="crm-submit-buttons">
80bc2820 41 {crmButton class="cancel" icon="times" p='civicrm/contact/view' q="selectedChild=note&reset=1&cid=`$contactId`"}{ts}Done{/ts}{/crmButton}
71b47fcd 42 </div>
6a488035
TO
43
44 {if $comments}
45 <fieldset>
46 <legend>{ts}Comments{/ts}</legend>
47 <table class="display">
48 <thead>
49 <tr><th>{ts}Comment{/ts}</th><th>{ts}Created By{/ts}</th><th>{ts}Date{/ts}</th></tr>
50 </thead>
51 {foreach from=$comments item=comment}
52 <tr class="{cycle values='odd-row,even-row'}"><td>{$comment.note}</td><td>{$comment.createdBy}</td><td>{$comment.modified_date}</td></tr>
53 {/foreach}
54 </table>
55 </fieldset>
56 {/if}
57
58 </div>
59 {/if}
60{elseif $action eq 1 or $action eq 2} {* action is add or update *}
6a488035
TO
61 <div class="crm-block crm-form-block crm-note-form-block">
62 <div class="content crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
63 <table class="form-layout">
64 <tr>
65 <td class="label">{$form.subject.label}</td>
66 <td>
67 {$form.subject.html}
68 </td>
69 </tr>
70 <tr>
71 <td class="label">{$form.privacy.label}</td>
72 <td>
73 {$form.privacy.html}
74 </td>
75 </tr>
76 <tr>
77 <td class="label">{$form.note.label}</td>
78 <td>
79 {$form.note.html}
80 </td>
81 </tr>
82 <tr class="crm-activity-form-block-attachment">
83 <td colspan="2">
84 {include file="CRM/Form/attachment.tpl"}
85 </td>
86 </tr>
87 </table>
88
89 <div class="crm-section note-buttons-section no-label">
90 <div class="content crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
91 <div class="clear"></div>
92 </div>
93 </div>
6a488035
TO
94{/if}
95{if ($action eq 8)}
6a488035
TO
96<div class=status>{ts 1=$notes.$id.note}Are you sure you want to delete the note '%1'?{/ts}</div>
97<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl"}</div>
6a488035
TO
98
99{/if}
100
4e8065a9 101{if $permission EQ 'edit' AND ($action eq 16)}
6a488035 102 <div class="action-link">
a2c70872 103 <a accesskey="N" href="{crmURL p='civicrm/contact/view/note' q="cid=`$contactId`&action=add"}" class="button medium-popup"><span><i class="crm-i fa-comment"></i> {ts}Add Note{/ts}</span></a>
6a488035
TO
104 </div>
105 <div class="clear"></div>
106{/if}
107<div class="crm-content-block">
108
4e8065a9 109{if $notes and $action eq 16}
6a488035
TO
110
111<script type="text/javascript">
112 var commentAction = '{$commentAction|escape:quotes}'
113
114 {literal}
115 var commentRows = {};
116
117 function showHideComments( noteId ) {
118
119 elRow = cj('tr#cnote_'+ noteId)
120
121 if (elRow.hasClass('view-comments')) {
122 cj('tr.note-comment_'+ noteId).remove()
123 commentRows['cnote_'+ noteId] = {};
124 cj('tr#cnote_'+ noteId +' span.icon_comments_show').show();
125 cj('tr#cnote_'+ noteId +' span.icon_comments_hide').hide();
126 elRow.removeClass('view-comments');
127 } else {
128 var getUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0}"{literal};
129 cj.post(getUrl, { fnName: 'civicrm/note/tree_get', json: 1, id: noteId, sequential: 1 }, showComments, 'json' );
130 }
131
132 }
133
134 function showComments (response) {
135 var urlTemplate = '{/literal}{crmURL p='civicrm/contact/view' q="reset=1&cid=" h=0 }{literal}'
136 if (response['values'][0] && response['values'][0].entity_id) {
137 var noteId = response['values'][0].entity_id
138 var row = cj('tr#cnote_'+ noteId);
139
140 row.addClass('view-comments');
141
142 if (row.hasClass('odd') ) {
143 var rowClassOddEven = 'odd'
144 } else {
145 var rowClassOddEven = 'even'
146 }
147
148 if ( commentRows['cnote_'+ noteId] ) {
149 for ( var i in commentRows['cnote_'+ noteId] ) {
150 return false;
151 }
152 } else {
153 commentRows['cnote_'+ noteId] = {};
154 }
155 for (i in response['values']) {
156 if ( response['values'][i].id ) {
157 if ( commentRows['cnote_'+ noteId] &&
158 commentRows['cnote_'+ noteId][response['values'][i].id] ) {
159 continue;
160 }
161 str = '<tr id="cnote_'+ response['values'][i].id +'" class="'+ rowClassOddEven +' note-comment_'+ noteId +'">'
162 + '<td></td>'
163 + '<td style="padding-left: 2em">'
164 + response['values'][i].note
165 + '</td><td>'
166 + response['values'][i].subject
167 + '</td><td>'
168 + response['values'][i].modified_date
169 + '</td><td>'
170 + '<a href="'+ urlTemplate + response['values'][i].createdById +'">'+ response['values'][i].createdBy +'</a>'
9a042a42 171 + '</td><td>'
46f9b197 172 + response['values'][i].attachment
6a488035
TO
173 + '</td><td>'+ commentAction.replace(/{cid}/g, response['values'][i].createdById).replace(/{id}/g, response['values'][i].id) +'</td></tr>'
174
175 commentRows['cnote_'+ noteId][response['values'][i].id] = str;
176 }
177 }
178 drawCommentRows('cnote_'+ noteId);
179
180 cj('tr#cnote_'+ noteId +' span.icon_comments_show').hide();
181 cj('tr#cnote_'+ noteId +' span.icon_comments_hide').show();
182 } else {
183 CRM.alert('{/literal}{ts escape="js"}There are no comments for this note{/ts}{literal}', '{/literal}{ts escape="js"}None Found{/ts}{literal}', 'alert');
184 }
185
186 }
187
188 function drawCommentRows(rowId) {
73bc3675 189 if (rowId) {
6a488035
TO
190 row = cj('tr#'+ rowId)
191 for (i in commentRows[rowId]) {
192 row.after(commentRows[rowId][i]);
193 row = cj('tr#cnote_'+ i);
194 }
73bc3675 195 }
6a488035
TO
196 }
197
198 {/literal}
199</script>
200
201<div class="crm-results-block">
202{* show browse table for any action *}
203<div id="notes">
204 {strip}
bff3913a 205 <table id="options" class="display crm-sortable" data-order='[[3,"desc"]]'>
6a488035
TO
206 <thead>
207 <tr>
bff3913a 208 <th data-orderable="false"></th>
6a488035
TO
209 <th>{ts}Note{/ts}</th>
210 <th>{ts}Subject{/ts}</th>
211 <th>{ts}Date{/ts}</th>
212 <th>{ts}Created By{/ts}</th>
bff3913a
JL
213 <th data-orderable="false">{ts}Attachment(s){/ts}</th>
214 <th data-orderable="false"></th>
6a488035
TO
215 </tr>
216 </thead>
217
218 {foreach from=$notes item=note}
219 <tr id="cnote_{$note.id}" class="{cycle values="odd-row,even-row"} crm-note">
220 <td class="crm-note-comment">
221 {if $note.comment_count}
222 <span id="{$note.id}_show" style="display:block" class="icon_comments_show">
a2c70872 223 <a href="#" onclick="showHideComments({$note.id}); return false;" title="{ts}Show comments for this note.{/ts}"><i class="crm-i fa-caret-right"></i></span></a>
6a488035
TO
224 </span>
225 <span id="{$note.id}_hide" style="display:none" class="icon_comments_hide">
a2c70872 226 <a href="#" onclick="showHideComments({$note.id}); return false;" title="{ts}Hide comments for this note.{/ts}"><i class="crm-i fa-caret-down"></i></span></a>
6a488035
TO
227 </span>
228 {else}
a2c70872 229 <span class="crm-i fa-caret-right" id="{$note.id}_hide" style="display:none"></span>
6a488035
TO
230 {/if}
231 </td>
232 <td class="crm-note-note">
233 {$note.note|mb_truncate:80:"...":false|nl2br}
234 {* Include '(more)' link to view entire note if it has been truncated *}
235 {assign var="noteSize" value=$note.note|count_characters:true}
236 {if $noteSize GT 80}
71b47fcd 237 <a class="crm-popup" href="{crmURL p='civicrm/contact/view/note' q="action=view&selectedChild=note&reset=1&cid=`$contactId`&id=`$note.id`"}">{ts}(more){/ts}</a>
6a488035
TO
238 {/if}
239 </td>
240 <td class="crm-note-subject">{$note.subject}</td>
21f96d9b 241 <td class="crm-note-modified_date" data-order="{$note.modified_date}">{$note.modified_date|crmDate}</td>
6a488035
TO
242 <td class="crm-note-createdBy">
243 <a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$note.contact_id`"}">{$note.createdBy}</a>
244 </td>
34f51a07
N
245 <td class="crm-note-attachment">
246 {foreach from=$note.attachment item=fileinfo}
247 {$fileinfo}
248 {/foreach}
249 </td>
6a488035
TO
250 <td class="nowrap">{$note.action|replace:'xx':$note.id}</td>
251 </tr>
252 {/foreach}
253 </table>
254 {/strip}
255 </div>
256</div>
4e8065a9 257{elseif ($action eq 16)}
6a488035 258 <div class="messages status no-popup">
5eb09d8f
DG
259 <div class="icon inform-icon"></div>
260 {ts}There are no Notes for this contact.{/ts}
6a488035
TO
261 </div>
262{/if}
263</div>
264</div>