Merge branch '5.3'
[GitHub/WoltLab/com.woltlab.wcf.conversation.git] / templates / conversationList.tpl
1 {capture assign='pageTitle'}{if $filter}{lang}wcf.conversation.folder.{$filter}{/lang}{else}{$__wcf->getActivePage()->getTitle()}{/if}{if $pageNo > 1} - {lang}wcf.page.pageNo{/lang}{/if}{/capture}
2
3 {capture assign='contentHeader'}
4 <header class="contentHeader">
5 <div class="contentHeaderTitle">
6 <h1 class="contentTitle">{if $filter}{lang}wcf.conversation.folder.{$filter}{/lang}{else}{$__wcf->getActivePage()->getTitle()}{/if}</h1>
7 </div>
8
9 {hascontent}
10 <nav class="contentHeaderNavigation">
11 <ul>
12 {content}
13 {if $__wcf->session->getPermission('user.conversation.canStartConversation')}<li><a href="{link controller='ConversationAdd'}{/link}" title="{lang}wcf.conversation.add{/lang}" class="button"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.conversation.button.add{/lang}</span></a></li>{/if}
14 {event name='contentHeaderNavigation'}
15 {/content}
16 </ul>
17 </nav>
18 {/hascontent}
19 </header>
20 {/capture}
21
22 {capture assign='headContent'}
23 <link rel="alternate" type="application/rss+xml" title="{lang}wcf.global.button.rss{/lang}" href="{link controller='ConversationFeed'}at={@$__wcf->getUser()->userID}-{@$__wcf->getUser()->accessToken}{/link}">
24 {/capture}
25
26 {capture assign='sidebarRight'}
27 <section class="box">
28 <h2 class="boxTitle">{lang}wcf.conversation.folders{/lang}</h2>
29
30 <div class="boxContent">
31 <nav>
32 <ol class="boxMenu">
33 <li{if $filter == ''} class="active"{/if}>
34 <a class="boxMenuLink" href="{link controller='ConversationList'}{/link}"><span class="boxMenuLinkTitle">{lang}wcf.conversation.conversations{/lang}</span>{if $conversationCount} <span class="badge">{#$conversationCount}</span>{/if}</a>
35 </li>
36 <li{if $filter == 'draft'} class="active"{/if}>
37 <a class="boxMenuLink" href="{link controller='ConversationList'}filter=draft{/link}"><span class="boxMenuLinkTitle">{lang}wcf.conversation.folder.draft{/lang}</span>{if $draftCount} <span class="badge">{#$draftCount}</span>{/if}</a>
38 </li>
39 <li{if $filter == 'outbox'} class="active"{/if}>
40 <a class="boxMenuLink" href="{link controller='ConversationList'}filter=outbox{/link}"><span class="boxMenuLinkTitle">{lang}wcf.conversation.folder.outbox{/lang}</span>{if $outboxCount} <span class="badge">{#$outboxCount}</span>{/if}</a>
41 </li>
42 <li{if $filter == 'hidden'} class="active"{/if}>
43 <a class="boxMenuLink" href="{link controller='ConversationList'}filter=hidden{/link}"><span class="boxMenuLinkTitle">{lang}wcf.conversation.folder.hidden{/lang}</span>{if $hiddenCount} <span class="badge">{#$hiddenCount}</span>{/if}</a>
44 </li>
45 </ol>
46 </nav>
47 </div>
48 </section>
49
50 <section class="box">
51 <h2 class="boxTitle">{lang}wcf.conversation.filter.participants{/lang}</h2>
52
53 <div class="boxContent">
54 <form action="{link controller='ConversationList'}{if $filter}filter={@$filter}&{/if}sortField={$sortField}&sortOrder={$sortOrder}&pageNo={@$pageNo}{/link}" method="post">
55 <dl>
56 <dt></dt>
57 <dd><label><textarea id="participants" name="participants" class="long">{implode from=$participants item=participant glue=','}{$participant}{/implode}</textarea></label></dd>
58 </dl>
59
60 <div class="formSubmit">
61 <input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s">
62 {csrfToken}
63 </div>
64 </form>
65 </div>
66 </section>
67
68 <section class="box jsOnly">
69 <h2 class="boxTitle">{lang}wcf.conversation.label{/lang}</h2>
70
71 <div class="boxContent">
72 <div id="conversationLabelFilter" class="dropdown">
73 <div class="dropdownToggle" data-toggle="conversationLabelFilter">
74 {if $labelID}
75 {foreach from=$labelList item=label}
76 {if $label->labelID == $labelID}
77 <span class="badge label{if $label->cssClassName} {@$label->cssClassName}{/if}">{$label->label}</span>
78 {/if}
79 {/foreach}
80 {else}
81 <span class="badge">{lang}wcf.conversation.label.filter{/lang}</span>
82 {/if}
83 </div>
84
85 <div class="dropdownMenu">
86 <ul class="scrollableDropdownMenu">
87 {foreach from=$labelList item=label}
88 <li><a href="{link controller='ConversationList'}{if $filter}filter={@$filter}&{/if}{if !$participants|empty}participants={implode from=$participants item=participant}{$participant|rawurlencode}{/implode}&{/if}sortField={$sortField}&sortOrder={$sortOrder}&pageNo={@$pageNo}&labelID={@$label->labelID}{/link}"><span class="badge label{if $label->cssClassName} {@$label->cssClassName}{/if}" data-css-class-name="{if $label->cssClassName}{@$label->cssClassName}{/if}" data-label-id="{@$label->labelID}">{$label->label}</span></a></li>
89 {/foreach}
90 </ul>
91 <ul>
92 <li class="dropdownDivider"{if !$labelList|count} style="display: none;"{/if}></li>
93 <li><a href="{link controller='ConversationList'}{if $filter}filter={@$filter}&{/if}{if !$participants|empty}participants={implode from=$participants item=participant}{$participant|rawurlencode}{/implode}&{/if}sortField={$sortField}&sortOrder={$sortOrder}&pageNo={@$pageNo}{/link}"><span class="badge label">{lang}wcf.conversation.label.disableFilter{/lang}</span></a></li>
94 </ul>
95 </div>
96 </div>
97 </div>
98
99 <div class="boxContent">
100 <button id="manageLabel">{lang}wcf.conversation.label.management{/lang}</button>
101 </div>
102 </section>
103
104 {event name='beforeQuotaBox'}
105
106 <section class="box conversationQuota">
107 <h2 class="boxTitle">{lang}wcf.conversation.quota{/lang}</h2>
108
109 <div class="boxContent">
110 {assign var='conversationCount' value=$__wcf->getConversationHandler()->getConversationCount()}
111 {assign var='maxConversationCount' value=$__wcf->session->getPermission('user.conversation.maxConversations')}
112 <p class="conversationUsageBar{if $conversationCount/$maxConversationCount >= 1.0} red{elseif $conversationCount/$maxConversationCount > 0.9} yellow{/if}">
113 <span style="width: {if $conversationCount/$maxConversationCount < 1.0}{@$conversationCount/$maxConversationCount*100|round:0}{else}100{/if}%">{#$conversationCount/$maxConversationCount*100}%</span>
114 </p>
115 <p><small>{lang}wcf.conversation.quota.description{/lang}</small></p>
116 </div>
117 </section>
118
119 {event name='boxes'}
120 {/capture}
121
122 {capture assign='headerNavigation'}
123 <li><a rel="alternate" href="{link controller='ConversationFeed'}at={@$__wcf->getUser()->userID}-{@$__wcf->getUser()->accessToken}{/link}" title="{lang}wcf.global.button.rss{/lang}" class="jsTooltip"><span class="icon icon16 fa-rss"></span> <span class="invisible">{lang}wcf.global.button.rss{/lang}</span></a></li>
124 <li class="jsOnly"><a href="#" title="{lang}wcf.conversation.markAllAsRead{/lang}" class="markAllAsReadButton jsTooltip"><span class="icon icon16 fa-check"></span> <span class="invisible">{lang}wcf.conversation.markAllAsRead{/lang}</span></a></li>
125 {/capture}
126
127 {include file='header'}
128
129 {hascontent}
130 <div class="paginationTop">
131 {content}
132 {assign var='participantsParameter' value=''}
133 {if $participants}{capture assign='participantsParameter'}&participants={implode from=$participants item=participant}{$participant|rawurlencode}{/implode}{/capture}{/if}
134 {assign var='labelIDParameter' value=''}
135 {if $labelID}{assign var='labelIDParameter' value="&labelID=$labelID"}{/if}
136 {pages print=true assign=pagesLinks controller='ConversationList' link="filter=$filter$participantsParameter&pageNo=%d&sortField=$sortField&sortOrder=$sortOrder$labelIDParameter"}
137 {/content}
138 </div>
139 {/hascontent}
140
141 {if !$items}
142 <p class="info" role="status">{lang}wcf.conversation.noConversations{/lang}</p>
143 {else}
144 <div class="section tabularBox messageGroupList conversationList jsClipboardContainer" data-type="com.woltlab.wcf.conversation.conversation">
145 <ol class="tabularList">
146 <li class="tabularListRow tabularListRowHead">
147 <ol class="tabularListColumns">
148 <li class="columnMark jsOnly"><label><input type="checkbox" class="jsClipboardMarkAll"></label></li>
149
150 <li class="columnSort">
151 <ul class="inlineList">
152 <li>
153 <a rel="nofollow" href="{link controller='ConversationList'}{if $filter}filter={@$filter}&{/if}{if !$participants|empty}participants={implode from=$participants item=participant}{$participant|rawurlencode}{/implode}&{/if}pageNo={@$pageNo}&sortField={$sortField}&sortOrder={if $sortOrder == 'ASC'}DESC{else}ASC{/if}{if $labelID}&labelID={@$labelID}{/if}{/link}">
154 <span class="icon icon16 fa-sort-amount-{$sortOrder|strtolower} jsTooltip" title="{lang}wcf.global.sorting{/lang} ({lang}wcf.global.sortOrder.{if $sortOrder === 'ASC'}ascending{else}descending{/if}{/lang})"></span>
155 </a>
156 </li>
157 <li>
158 <div class="dropdown">
159 <span class="dropdownToggle">{if $sortField == 'subject'}{lang}wcf.global.subject{/lang}{else}{lang}wcf.conversation.{$sortField}{/lang}{/if}</span>
160
161 <ul class="dropdownMenu">
162 {foreach from=$validSortFields item=_sortField}
163 <li{if $_sortField === $sortField} class="active"{/if}><a rel="nofollow" href="{link controller='ConversationList'}{if $filter}filter={@$filter}&{/if}{if !$participants|empty}participants={implode from=$participants item=participant}{$participant|rawurlencode}{/implode}&{/if}pageNo={@$pageNo}&sortField={$_sortField}&sortOrder={if $sortField === $_sortField}{if $sortOrder === 'DESC'}ASC{else}DESC{/if}{else}{$sortOrder}{/if}{if $labelID}&labelID={@$labelID}{/if}{/link}">{if $_sortField == 'subject'}{lang}wcf.global.subject{/lang}{else}{lang}wcf.conversation.{$_sortField}{/lang}{/if}</a></li>
164 {/foreach}
165 </ul>
166 </div>
167 </li>
168 </ul>
169 </li>
170 </ol>
171 </li>
172
173 {foreach from=$objects item=conversation}
174 <li class="tabularListRow">
175 <ol class="tabularListColumns messageGroup conversation jsClipboardObject{if $conversation->isNew()} new{/if}" data-conversation-id="{@$conversation->conversationID}" data-label-ids="[ {implode from=$conversation->getAssignedLabels() item=label}{@$label->labelID}{/implode} ]" data-is-closed="{@$conversation->isClosed}" data-can-close-conversation="{if $conversation->userID == $__wcf->getUser()->userID}1{else}0{/if}" data-can-add-participants="{if $conversation->canAddParticipants()}1{else}0{/if}">
176 <li class="columnMark jsOnly">
177 <label><input type="checkbox" class="jsClipboardItem" data-object-id="{@$conversation->conversationID}"></label>
178 </li>
179 <li class="columnIcon columnAvatar">
180 {if $conversation->getUserProfile()->getAvatar()}
181 <div>
182 <p{if $conversation->isNew()} title="{lang}wcf.conversation.markAsRead.doubleClick{/lang}"{/if}>{@$conversation->getUserProfile()->getAvatar()->getImageTag(48)}</p>
183
184 {if $conversation->ownPosts && $conversation->userID != $__wcf->user->userID}
185 {if $__wcf->getUserProfileHandler()->getAvatar()}
186 <small class="myAvatar jsTooltip" title="{lang}wcf.conversation.ownPosts{/lang}">{@$__wcf->getUserProfileHandler()->getAvatar()->getImageTag(24)}</small>
187 {/if}
188 {/if}
189 </div>
190 {/if}
191 </li>
192 <li class="columnSubject">
193 {hascontent}
194 <ul class="labelList">
195 {content}
196 {foreach from=$conversation->getAssignedLabels() item=label}
197 <li><a href="{link controller='ConversationList'}{if $filter}filter={@$filter}&{/if}{if !$participants|empty}participants={implode from=$participants item=participant}{$participant|rawurlencode}{/implode}&{/if}sortField={$sortField}&sortOrder={$sortOrder}&pageNo={@$pageNo}&labelID={@$label->labelID}{/link}" class="badge label{if $label->cssClassName} {@$label->cssClassName}{/if}">{$label->label}</a></li>
198 {/foreach}
199 {/content}
200 </ul>
201 {/hascontent}
202
203 <h3>
204 <a href="{if $conversation->isNew()}{link controller='Conversation' object=$conversation}action=firstNew{/link}{else}{$conversation->getLink()}{/if}" class="conversationLink messageGroupLink" data-object-id="{@$conversation->conversationID}">{$conversation->subject}</a>
205 {if $conversation->replies}
206 <span class="badge messageGroupCounterMobile">{@$conversation->replies|shortUnit}</span>
207 {/if}
208 </h3>
209
210 <aside class="statusDisplay" role="presentation">
211 <ul class="statusIcons">
212 {if $conversation->isClosed}<li><span class="icon icon16 fa-lock jsIconLock jsTooltip" title="{lang}wcf.global.state.closed{/lang}"></span></li>{/if}
213 {if $conversation->attachments}<li><span class="icon icon16 fa-paperclip jsIconAttachment jsTooltip" title="{lang}wcf.conversation.attachments{/lang}"></span></li>{/if}
214 </ul>
215 </aside>
216
217 <ul class="inlineList dotSeparated small messageGroupInfo">
218 <li class="messageGroupAuthor">{if $conversation->userID}{user object=$conversation->getUserProfile()}{else}{$conversation->username}{/if}</li>
219 <li class="messageGroupTime">{@$conversation->time|time}</li>
220 <li class="messageGroupEditLink jsOnly"><a href="#" class="jsConversationInlineEditor">{lang}wcf.global.button.edit{/lang}</a></li>
221 {event name='messageGroupInfo'}
222 </ul>
223
224 <ul class="messageGroupInfoMobile">
225 <li class="messageGroupAuthorMobile">{$conversation->username}</li>
226 <li class="messageGroupLastPostTimeMobile">{@$conversation->lastPostTime|time}</li>
227 </ul>
228
229 {if $conversation->getParticipantSummary()|count}
230 <small class="conversationParticipantSummary">
231 {assign var='participantSummaryCount' value=$conversation->getParticipantSummary()|count}
232 {lang}wcf.conversation.participants{/lang}: {implode from=$conversation->getParticipantSummary() item=participant}<a href="{$participant->getLink()}" class="userLink{if $participant->hideConversation == 2} conversationLeft{/if}" data-object-id="{@$participant->userID}">{$participant->username}</a>{/implode}
233 {if $participantSummaryCount < $conversation->participants}{lang}wcf.conversation.participants.other{/lang}{/if}
234 </small>
235 {/if}
236
237 {event name='conversationData'}
238 </li>
239 <li class="columnStats">
240 <dl class="plain statsDataList">
241 <dt>{lang}wcf.conversation.replies{/lang}</dt>
242 <dd>{@$conversation->replies|shortUnit}</dd>
243 </dl>
244 <dl class="plain statsDataList">
245 <dt>{lang}wcf.conversation.participants{/lang}</dt>
246 <dd>{@$conversation->participants|shortUnit}</dd>
247 </dl>
248
249 <div class="messageGroupListStatsSimple">{if $conversation->replies}<span class="icon icon16 fa-comment-o" aria-label="{lang}wcf.conversation.replies{/lang}"></span> {@$conversation->replies|shortUnit}{/if}</div>
250 </li>
251 <li class="columnLastPost">
252 {if $conversation->replies != 0 && $conversation->lastPostTime}
253 <div class="box32">
254 <a href="{link controller='Conversation' object=$conversation}action=lastPost{/link}" class="jsTooltip" title="{lang}wcf.conversation.gotoLastPost{/lang}">{@$conversation->getLastPosterProfile()->getAvatar()->getImageTag(32)}</a>
255
256 <div>
257 <p>
258 {if $conversation->lastPosterID}
259 {user object=$conversation->getLastPosterProfile()}
260 {else}
261 {$conversation->lastPoster}
262 {/if}
263 </p>
264 <small>{@$conversation->lastPostTime|time}</small>
265 </div>
266 </div>
267 {/if}
268 </li>
269
270 {event name='columns'}
271 </ol>
272 </li>
273 {/foreach}
274 </ol>
275 </div>
276 {/if}
277
278 <footer class="contentFooter">
279 {hascontent}
280 <div class="paginationBottom">
281 {content}{@$pagesLinks}{/content}
282 </div>
283 {/hascontent}
284
285 {hascontent}
286 <nav class="contentFooterNavigation">
287 <ul>
288 {content}
289 {if $__wcf->session->getPermission('user.conversation.canStartConversation')}<li><a href="{link controller='ConversationAdd'}{/link}" title="{lang}wcf.conversation.add{/lang}" class="button"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.conversation.button.add{/lang}</span></a></li>{/if}
290 {event name='contentFooterNavigation'}
291 {/content}
292 </ul>
293 </nav>
294 {/hascontent}
295 </footer>
296
297 <script data-relocate="true" src="{@$__wcf->getPath()}js/WCF.Conversation{if !ENABLE_DEBUG_MODE}.min{/if}.js?v={@LAST_UPDATE_TIME}"></script>
298 <script data-relocate="true">
299 require(['Language', 'WoltLabSuite/Core/Controller/Popover', 'WoltLabSuite/Core/Ui/ItemList/User'], function(Language, ControllerPopover, UiItemListUser) {
300 Language.addObject({
301 'wcf.conversation.edit.addParticipants': '{jslang}wcf.conversation.edit.addParticipants{/jslang}',
302 'wcf.conversation.edit.assignLabel': '{jslang}wcf.conversation.edit.assignLabel{/jslang}',
303 'wcf.conversation.edit.close': '{jslang}wcf.conversation.edit.close{/jslang}',
304 'wcf.conversation.edit.leave': '{jslang}wcf.conversation.edit.leave{/jslang}',
305 'wcf.conversation.edit.open': '{jslang}wcf.conversation.edit.open{/jslang}',
306 'wcf.conversation.edit.subject': '{jslang}wcf.conversation.edit.subject{/jslang}',
307 'wcf.conversation.label.management': '{jslang}wcf.conversation.label.management{/jslang}',
308 'wcf.conversation.label.management.addLabel.success': '{jslang}wcf.conversation.label.management.addLabel.success{/jslang}',
309 'wcf.conversation.label.management.deleteLabel.confirmMessage': '{jslang}wcf.conversation.label.management.deleteLabel.confirmMessage{/jslang}',
310 'wcf.conversation.label.management.editLabel': '{jslang}wcf.conversation.label.management.editLabel{/jslang}',
311 'wcf.conversation.label.placeholder': '{jslang}wcf.conversation.label.placeholder{/jslang}',
312 'wcf.conversation.leave.title': '{jslang}wcf.conversation.leave.title{/jslang}',
313 'wcf.global.state.closed': '{jslang}wcf.global.state.closed{/jslang}',
314 'wcf.global.subject': '{jslang}wcf.global.subject{/jslang}',
315 'wcf.conversation.label.assignLabels': '{jslang}wcf.conversation.label.assignLabels{/jslang}'
316 });
317
318 WCF.Clipboard.init('wcf\\page\\ConversationListPage', {@$hasMarkedItems}, { });
319
320 var $editorHandler = new WCF.Conversation.EditorHandler();
321 var $inlineEditor = new WCF.Conversation.InlineEditor('.conversation');
322 $inlineEditor.setEditorHandler($editorHandler, 'list');
323
324 new WCF.Conversation.Clipboard($editorHandler);
325 new WCF.Conversation.Label.Manager('{link controller='ConversationList' encode=false}{if $filter}filter={@$filter}&{/if}{if !$participants|empty}participants={implode from=$participants item=participant}{$participant|rawurlencode}{/implode}&{/if}sortField={$sortField}&sortOrder={$sortOrder}&pageNo={@$pageNo}{/link}');
326 new WCF.Conversation.MarkAsRead();
327 new WCF.Conversation.MarkAllAsRead();
328
329 // mobile safari hover workaround
330 if ($(window).width() <= 800) {
331 $('.sidebar').addClass('mobileSidebar').hover(function() { });
332 }
333
334 UiItemListUser.init('participants', {
335 excludedSearchValues: ['{$__wcf->user->username|encodeJS}'],
336 maxItems: 20
337 });
338
339 ControllerPopover.init({
340 className: 'conversationLink',
341 dboAction: 'wcf\\data\\conversation\\ConversationAction',
342 identifier: 'com.woltlab.wcf.conversation'
343 });
344 });
345 </script>
346
347 {include file='footer'}