* Provides a flexible conversation preview.
*
* @see WCF.Popover
+ * @deprecated 5.3 handled via `WoltLabSuite/Core/Controller/Popover`
*/
WCF.Conversation.Preview = WCF.Popover.extend({
/**
*/
_getCurrentValue: function () {
var value = '';
- elBySelAll('.jsConversationSubject[data-conversation-id="' + _objectId + '"], .conversationLink[data-conversation-id="' + _objectId + '"]', undefined, function (subject) {
+ elBySelAll('.jsConversationSubject[data-conversation-id="' + _objectId + '"], .conversationLink[data-object-id="' + _objectId + '"]', undefined, function (subject) {
value = subject.textContent;
});
_ajaxSuccess: function (data) {
UiDialog.close(this);
- elBySelAll('.jsConversationSubject[data-conversation-id="' + _objectId + '"], .conversationLink[data-conversation-id="' + _objectId + '"]', undefined, function (subject) {
+ elBySelAll('.jsConversationSubject[data-conversation-id="' + _objectId + '"], .conversationLink[data-object-id="' + _objectId + '"]', undefined, function (subject) {
subject.textContent = data.returnValues.subject;
});
<?php
namespace wcf\data\conversation;
use wcf\data\conversation\message\ConversationMessage;
+use wcf\data\IPopoverObject;
use wcf\data\user\group\UserGroup;
use wcf\data\user\UserProfile;
use wcf\data\DatabaseObject;
-use wcf\data\ITitledLinkObject;
use wcf\system\cache\runtime\UserProfileRuntimeCache;
use wcf\system\conversation\ConversationHandler;
use wcf\system\database\util\PreparedStatementConditionBuilder;
* @property-read integer|null $leftAt timestamp at which the user left the conversation or `0` if they did not leave the conversation; is `null` if the conversation has not been fetched via `UserConversationList`
* @property-read integer|null $lastMessageID id of the last message written before the user left the conversation or `0` if they did not leave the conversation; is `null` if the conversation has not been fetched via `UserConversationList`
*/
-class Conversation extends DatabaseObject implements IRouteController, ITitledLinkObject {
+class Conversation extends DatabaseObject implements IPopoverObject, IRouteController {
/**
* default participation state
* @var integer
return $this->isActiveParticipant;
}
+ /**
+ * @inheritDoc
+ */
+ public function getPopoverLinkClass() {
+ return 'conversationLink';
+ }
+
/**
* Returns true if the given user id (default: current user) is participant
* of all given conversation ids.
use wcf\data\conversation\message\SimplifiedViewableConversationMessageList;
use wcf\data\AbstractDatabaseObjectAction;
use wcf\data\IClipboardAction;
+use wcf\data\IPopoverAction;
use wcf\data\IVisitableObjectAction;
use wcf\system\clipboard\ClipboardHandler;
use wcf\system\conversation\ConversationHandler;
* @method ConversationEditor[] getObjects()
* @method ConversationEditor getSingleObject()
*/
-class ConversationAction extends AbstractDatabaseObjectAction implements IClipboardAction, IVisitableObjectAction {
+class ConversationAction extends AbstractDatabaseObjectAction implements IClipboardAction, IPopoverAction, IVisitableObjectAction {
/**
* @inheritDoc
*/
}
/**
- * Validates the get message preview action.
- *
- * @throws PermissionDeniedException
+ * @inheritDoc
*/
- public function validateGetMessagePreview() {
+ public function validateGetPopover() {
$this->conversation = $this->getSingleObject();
if (!Conversation::isParticipant([$this->conversation->conversationID])) {
throw new PermissionDeniedException();
}
/**
- * Returns a preview of a message in a specific conversation.
- *
- * @return string[]
+ * @inheritDoc
*/
- public function getMessagePreview() {
+ public function getPopover() {
$messageList = new SimplifiedViewableConversationMessageList();
-
$messageList->getConditionBuilder()->add("conversation_message.messageID = ?", [$this->conversation->firstMessageID]);
$messageList->readObjects();
- $messages = $messageList->getObjects();
- WCF::getTPL()->assign([
- 'message' => reset($messages)
- ]);
return [
- 'template' => WCF::getTPL()->fetch('conversationMessagePreview')
+ 'template' => WCF::getTPL()->fetch('conversationMessagePreview', 'wcf', [
+ 'message' => $messageList->getSingleObject(),
+ ]),
];
}
+ /**
+ * Validates the get message preview action.
+ *
+ * @throws PermissionDeniedException
+ * @deprecated 5.3 Use `validateGetPopover()` instead.
+ */
+ public function validateGetMessagePreview() {
+ $this->validateGetPopover();
+ }
+
+ /**
+ * Returns a preview of a message in a specific conversation.
+ *
+ * @return string[]
+ * @deprecated 5.3 Use `getPopover()` instead.
+ */
+ public function getMessagePreview() {
+ return $this->getPopover();
+ }
+
/**
* Validates parameters to close conversations.
*
<item name="wcf.moderation.type.com.woltlab.wcf.conversation.message"><![CDATA[Konversation]]></item>
</category>
<category name="wcf.page">
- <item name="wcf.page.onlineLocation.com.woltlab.wcf.conversation.Conversation"><![CDATA[Konversation <a href="{link controller='Conversation' object=$conversation}{/link}" class="conversationLink" data-conversation-id="{@$conversation->conversationID}">{$conversation->subject}</a>]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.conversation.Conversation"><![CDATA[Konversation {anchor object=$conversation class='conversationLink'}]]></item>
</category>
<category name="wcf.search">
<item name="wcf.search.type.com.woltlab.wcf.conversation"><![CDATA[Diese Konversation]]></item>
<item name="wcf.moderation.type.com.woltlab.wcf.conversation.message"><![CDATA[Conversation]]></item>
</category>
<category name="wcf.page">
- <item name="wcf.page.onlineLocation.com.woltlab.wcf.conversation.Conversation"><![CDATA[Conversation <a href="{link controller='Conversation' object=$conversation}{/link}" class="conversationLink" data-conversation-id="{@$conversation->conversationID}">{$conversation->subject}</a>]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.conversation.Conversation"><![CDATA[Conversation {anchor object=$conversation class='conversationLink'}]]></item>
</category>
<category name="wcf.search">
<item name="wcf.search.type.com.woltlab.wcf.conversation"><![CDATA[This Conversation]]></item>
{/hascontent}
<h3>
- <a href="{if $conversation->isNew()}{link controller='Conversation' object=$conversation}action=firstNew{/link}{else}{link controller='Conversation' object=$conversation}{/link}{/if}" class="conversationLink messageGroupLink" data-conversation-id="{@$conversation->conversationID}">{$conversation->subject}</a>
+ <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>
{if $conversation->replies}
<span class="badge messageGroupCounterMobile">{@$conversation->replies|shortUnit}</span>
{/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">
- require(['Language', 'WoltLabSuite/Core/Ui/ItemList/User'], function(Language, UiItemListUser) {
+ require(['Language', 'WoltLabSuite/Core/Controller/Popover', 'WoltLabSuite/Core/Ui/ItemList/User'], function(Language, ControllerPopover, UiItemListUser) {
Language.addObject({
'wcf.conversation.edit.addParticipants': '{lang}wcf.conversation.edit.addParticipants{/lang}',
'wcf.conversation.edit.assignLabel': '{lang}wcf.conversation.edit.assignLabel{/lang}',
new WCF.Conversation.Clipboard($editorHandler);
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}');
- new WCF.Conversation.Preview();
new WCF.Conversation.MarkAsRead();
new WCF.Conversation.MarkAllAsRead();
excludedSearchValues: ['{$__wcf->user->username|encodeJS}'],
maxItems: 20
});
+
+ ControllerPopover.init({
+ className: 'conversationLink',
+ dboAction: 'wcf\\data\\conversation\\ConversationAction',
+ identifier: 'com.woltlab.wcf.conversation'
+ });
});
</script>