Adjusted/unified html attributes for avatars
[GitHub/WoltLab/com.woltlab.wcf.conversation.git] / templates / conversation.tpl
index 0b6e3058127c9a26912a51fd0469641c16ed46e4..2c6956dabec9f0122420e0ad090e54c85880d278 100644 (file)
@@ -1,5 +1,7 @@
 {capture assign='pageTitle'}{$conversation->subject} {if $pageNo > 1} - {lang}wcf.page.pageNo{/lang}{/if}{/capture}
 
+{assign var='__pageCssClassName' value='mobileShowPaginationTop'}
+
 {capture assign='contentHeader'}
        <header class="contentHeader">
                <div class="contentHeaderIcon">
@@ -7,7 +9,7 @@
                </div>
                
                <div class="contentHeaderTitle">
-                       <h1 class="contentTitle">{$conversation->subject}</h1>
+                       <h1 class="contentTitle jsConversationSubject" data-conversation-id="{@$conversation->conversationID}">{$conversation->subject}</h1>
                        
                        <ul class="inlineList contentHeaderMetaData">
                                {hascontent}
@@ -16,7 +18,7 @@
                                                <ul class="labelList">
                                                        {content}
                                                                {foreach from=$conversation->getAssignedLabels() item=label}
-                                                                       <li><span class="label badge{if $label->cssClassName} {$label->cssClassName}{/if}">{lang}{$label->label}{/lang}</span></li>
+                                                                       <li><span class="label badge{if $label->cssClassName} {$label->cssClassName}{/if}">{$label->label}</span></li>
                                                                {/foreach}
                                                        {/content}
                                                </ul>
                                
                                <li>
                                        <span class="icon icon16 fa-user"></span>
-                                       {if $conversation->userID}
-                                               <a href="{link controller='User' object=$conversation->getUserProfile()->getDecoratedObject()}{/link}" class="userLink" data-user-id="{@$conversation->userID}">{$conversation->username}</a>
-                                       {else}
-                                               {$conversation->username}
-                                       {/if}
+                                       {user object=$conversation->getUserProfile()}
                                </li>
                                
                                <li>
                        </ul>
                </div>
                
-               {hascontent}
-                       <nav class="contentHeaderNavigation">
-                               <ul class="conversation jsConversationInlineEditorContainer" 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}">
-                                       <li class="jsOnly"><a href="#" class="button jsConversationInlineEditor"><span class="icon icon16 fa-pencil"></span> <span>{lang}wcf.global.button.edit{/lang}</span></a></li>
-                                       {if !$conversation->isClosed}<li><a href="{link controller='ConversationMessageAdd' id=$conversationID}{/link}" title="{lang}wcf.conversation.message.add{/lang}" class="button buttonPrimary jsQuickReply"><span class="icon icon16 fa-plus"></span> <span>{lang}wcf.conversation.message.button.add{/lang}</span></a></li>{/if}
-                                       {event name='contentHeaderNavigation'}
-                               </ul>
-                       </nav>
-               {/hascontent}
+               <nav class="contentHeaderNavigation">
+                       <ul class="conversation jsConversationInlineEditorContainer" 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}" data-is-draft="{if $conversation->isDraft}1{else}0{/if}">
+                               <li class="jsOnly"><a href="{if $conversation->isDraft}{link controller='ConversationDraftEdit' id=$conversation->conversationID}{/link}{else}#{/if}" class="button jsConversationInlineEditor"><span class="icon icon16 fa-pencil"></span> <span>{lang}wcf.global.button.edit{/lang}</span></a></li>
+                               {if $conversation->canReply()}<li class="jsOnly"><a href="#" class="button buttonPrimary jsQuickReply"><span class="icon icon16 fa-reply"></span> <span>{lang}wcf.conversation.message.button.add{/lang}</span></a></li>{/if}
+                               {event name='contentHeaderNavigation'}
+                       </ul>
+               </nav>
        </header>
 {/capture}
 
                
                <ul class="containerBoxList tripleColumned conversationParticipantList">
                        {foreach from=$participants item=participant}
-                               <li class="jsParticipant{if !$participant->userID || $participant->hideConversation == 2} conversationLeft{/if}">
+                               <li class="jsParticipant{if !$participant->userID || $participant->hideConversation == 2 || $participant->leftAt > 0} conversationLeft{/if}">
                                        <div class="box24">
-                                               {if $participant->userID}<a href="{link controller='User' object=$participant}{/link}">{@$participant->getAvatar()->getImageTag(24)}</a>{else}<span>{@$participant->getAvatar()->getImageTag(24)}</span>{/if}
+                                               {user object=$participant type='avatar24' ariaHidden='true' tabindex='-1'}
                                                <div>
                                                        <p>
-                                                               {if $participant->userID}<a href="{link controller='User' object=$participant}{/link}" class="userLink" data-user-id="{@$participant->userID}">{$participant->username}</a>{else}<span>{$participant->username}</span>{/if}
+                                                               {user object=$participant}
                                                                {if $participant->isInvisible}<small>({lang}wcf.conversation.invisible{/lang})</small>{/if}
-                                                               {if $participant->userID && ($conversation->userID == $__wcf->getUser()->userID) && ($participant->userID != $__wcf->getUser()->userID) && $participant->hideConversation != 2}
-                                                                       <a href="#" class="jsDeleteButton jsTooltip jsOnly" title="{lang}wcf.conversation.participants.removeParticipant{/lang}" data-confirm-message="{lang}wcf.conversation.participants.removeParticipant.confirmMessage{/lang}" data-object-id="{@$participant->userID}"><span class="icon icon16 fa-times"></span></a>
+                                                               {if $participant->userID && ($conversation->userID == $__wcf->getUser()->userID) && ($participant->userID != $__wcf->getUser()->userID) && $participant->hideConversation != 2 && $participant->leftAt == 0}
+                                                                       <a href="#" class="jsDeleteButton jsTooltip jsOnly" title="{lang}wcf.conversation.participants.removeParticipant{/lang}" data-confirm-message-html="{lang __encode=true}wcf.conversation.participants.removeParticipant.confirmMessage{/lang}" data-object-id="{@$participant->userID}"><span class="icon icon16 fa-times"></span></a>
                                                                {/if}
                                                        </p>
                                                        <dl class="plain inlineDataList small">
 
 <div class="section">
        <ul class="messageList">
+               {if $pageNo == 1 && !$conversation->joinedAt|empty}<li><p class="info" role="status">{lang}wcf.conversation.visibility.previousMessages{/lang}</p></li>{/if}
                {include file='conversationMessageList'}
-               {if !$conversation->isClosed}{include file='conversationQuickReply'}{/if}
+               {hascontent}
+                       <li class="messageListPagination">
+                               {content}{@$pagesLinks}{/content}
+                       </li>
+               {/hascontent}
+               {if $conversation->canReply()}{include file='conversationQuickReply'}{/if}
+               {if $pageNo == $pages && !$conversation->leftAt|empty}<li><p class="info" role="status">{lang}wcf.conversation.visibility.nextMessages{/lang}</p></li>{/if}
        </ul>
 </div>
 
-<footer class="contentFooter">
-       {hascontent}
-               <div class="paginationBottom">
-                       {content}{@$pagesLinks}{/content}
-               </div>
-       {/hascontent}
-       
-       {hascontent}
-               <nav class="contentFooterNavigation">
-                       <ul>
-                               {content}
-                                       {event name='contentFooterNavigation'}
-                               {/content}
-                       </ul>
-               </nav>
-       {/hascontent}
-</footer>
-
+{if !ENABLE_DEBUG_MODE}<script src="{@$__wcf->getPath()}js/WoltLabSuite.Core.Conversation.min.js?v={@LAST_UPDATE_TIME}"></script>{/if}
 <script data-relocate="true" src="{@$__wcf->getPath()}js/WCF.Conversation{if !ENABLE_DEBUG_MODE}.min{/if}.js?v={@LAST_UPDATE_TIME}"></script>
 <script data-relocate="true">
-       //<![CDATA[
        $(function() {
                WCF.Language.addObject({
-                       'wcf.conversation.edit.addParticipants': '{lang}wcf.conversation.edit.addParticipants{/lang}',
-                       'wcf.conversation.edit.assignLabel': '{lang}wcf.conversation.edit.assignLabel{/lang}',
-                       'wcf.conversation.edit.close': '{lang}wcf.conversation.edit.close{/lang}',
-                       'wcf.conversation.edit.leave': '{lang}wcf.conversation.edit.leave{/lang}',
-                       'wcf.conversation.edit.open': '{lang}wcf.conversation.edit.open{/lang}',
-                       'wcf.conversation.leave.title': '{lang}wcf.conversation.leave.title{/lang}',
-                       'wcf.global.state.closed': '{lang}wcf.global.state.closed{/lang}',
-                       'wcf.message.bbcode.code.copy': '{lang}wcf.message.bbcode.code.copy{/lang}',
-                       'wcf.message.error.editorAlreadyInUse': '{lang}wcf.message.error.editorAlreadyInUse{/lang}',
-                       'wcf.moderation.report.reportContent': '{lang}wcf.moderation.report.reportContent{/lang}',
-                       'wcf.moderation.report.success': '{lang}wcf.moderation.report.success{/lang}',
-                       'wcf.conversation.label.assignLabels': '{lang}wcf.conversation.label.assignLabels{/lang}'
+                       'wcf.conversation.edit.addParticipants': '{jslang}wcf.conversation.edit.addParticipants{/jslang}',
+                       'wcf.conversation.edit.assignLabel': '{jslang}wcf.conversation.edit.assignLabel{/jslang}',
+                       'wcf.conversation.edit.close': '{jslang}wcf.conversation.edit.close{/jslang}',
+                       'wcf.conversation.edit.leave': '{jslang}wcf.conversation.edit.leave{/jslang}',
+                       'wcf.conversation.edit.open': '{jslang}wcf.conversation.edit.open{/jslang}',
+                       'wcf.conversation.edit.subject': '{jslang}wcf.conversation.edit.subject{/jslang}',
+                       'wcf.conversation.leave.title': '{jslang}wcf.conversation.leave.title{/jslang}',
+                       'wcf.global.state.closed': '{jslang}wcf.global.state.closed{/jslang}',
+                       'wcf.global.subject': '{jslang}wcf.global.subject{/jslang}',
+                       'wcf.message.bbcode.code.copy': '{jslang}wcf.message.bbcode.code.copy{/jslang}',
+                       'wcf.message.error.editorAlreadyInUse': '{jslang}wcf.message.error.editorAlreadyInUse{/jslang}',
+                       'wcf.moderation.report.reportContent': '{jslang}wcf.moderation.report.reportContent{/jslang}',
+                       'wcf.moderation.report.success': '{jslang}wcf.moderation.report.success{/jslang}',
+                       'wcf.conversation.label.assignLabels': '{jslang}wcf.conversation.label.assignLabels{/jslang}'
                });
                
-               var $availableLabels = [ {implode from=$labelList item=label}{ cssClassName: '{if $label->cssClassName}{@$label->cssClassName}{/if}', labelID: {@$label->labelID}, label: '{$label->label}' }{/implode} ];
+               var $availableLabels = [ {implode from=$labelList item=label}{ cssClassName: '{if $label->cssClassName}{@$label->cssClassName}{/if}', labelID: {@$label->labelID}, label: '{$label->label|encodeJS}' }{/implode} ];
                var $editorHandler = new WCF.Conversation.EditorHandlerConversation($availableLabels);
                var $inlineEditor = new WCF.Conversation.InlineEditor('.conversation');
                $inlineEditor.setEditorHandler($editorHandler);
                
                {assign var=__supportPaste value=true}
-               {if $conversation->isClosed}{assign var=__supportPaste value=false}{/if}
+               {if !$conversation->canReply()}{assign var=__supportPaste value=false}{/if}
                {include file='__messageQuoteManager' wysiwygSelector='text' supportPaste=$__supportPaste}
                
                new WCF.Conversation.Message.InlineEditor({@$conversation->conversationID}, $quoteManager);
                new WCF.Conversation.Message.QuoteHandler($quoteManager);
-               {* if !$conversation->isClosed}new WCF.Conversation.QuickReply($quoteManager);{/if *}
+               
+               {if $conversation->canReply()}
+                       require(['WoltLabSuite/Core/Ui/Message/Reply'], function(UiMessageReply) {
+                               new UiMessageReply({
+                                       ajax: {
+                                               className: 'wcf\\data\\conversation\\message\\ConversationMessageAction'
+                                       },
+                                       quoteManager: $quoteManager
+                               });
+                       });
+               {/if}
                
                {if $__wcf->session->getPermission('user.profile.canReportContent')}
-               new WCF.Moderation.Report.Content('com.woltlab.wcf.conversation.message', '.jsReportConversationMessage');
+                       new WCF.Moderation.Report.Content('com.woltlab.wcf.conversation.message', '.jsReportConversationMessage');
                {/if}
                new WCF.Conversation.RemoveParticipant({@$conversation->conversationID});
-               new WCF.Message.BBCode.CodeViewer();
        });
-       //]]>
 </script>
 
 {include file='footer'}