Reflecting API changes
authorMarcel Werk <burntime@woltlab.com>
Fri, 1 Feb 2013 00:12:59 +0000 (01:12 +0100)
committerMarcel Werk <burntime@woltlab.com>
Fri, 1 Feb 2013 00:12:59 +0000 (01:12 +0100)
files/lib/data/conversation/message/ConversationMessage.class.php
files/lib/data/conversation/message/SearchResultConversationMessage.class.php
files/lib/system/search/ConversationMessageSearch.class.php
language/de.xml
templates/searchResultConversationMessage.tpl [deleted file]

index c4e678328013ebff82f6ff2ca3fcbf6852585db5..21caf4d75b043b507f6cd1c36824e4b909e1621a 100644 (file)
@@ -138,7 +138,7 @@ class ConversationMessage extends DatabaseObject implements IMessage {
        public function getLink() {
                return LinkHandler::getInstance()->getLink('Conversation', array(
                        'object' => $this->getConversation(),
-                       'messageID' => $this->messageID,
+                       'messageID' => $this->messageID
                ), '#message'.$this->messageID);
        }
        
index 3236cab0cce74e9e269f3296988fa732660174f3..d13388f85987ffa43edc874d2fb83d4d40e5156b 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 namespace wcf\data\conversation\message;
 use wcf\data\conversation\Conversation;
+use wcf\data\search\ISearchResultObject;
+use wcf\system\request\LinkHandler;
 use wcf\system\search\SearchResultTextParser;
 
 /**
@@ -13,7 +15,7 @@ use wcf\system\search\SearchResultTextParser;
  * @subpackage data.conversation.message
  * @category   Community Framework
  */
-class SearchResultConversationMessage extends ViewableConversationMessage {
+class SearchResultConversationMessage extends ViewableConversationMessage implements ISearchResultObject {
        /**
         * conversation object
         * @var wcf\data\conversation\Conversation
@@ -42,4 +44,54 @@ class SearchResultConversationMessage extends ViewableConversationMessage {
        public function getFormattedMessage() {
                return SearchResultTextParser::getInstance()->parse($this->getDecoratedObject()->getFormattedMessage());
        }
+       
+       /**
+        * @see wcf\data\search\ISearchResultObject::getSubject()
+        */
+       public function getSubject() {
+                return $this->subject;
+       }
+       
+       /**
+        * @see wcf\data\search\ISearchResultObject::getLink()
+        */
+       public function getLink($query = '') {
+               if ($query) {
+                       return LinkHandler::getInstance()->getLink('Conversation', array(
+                               'object' => $this->getConversation(),
+                               'messageID' => $this->messageID,
+                               'highlight' => urlencode($query)
+                       ), '#message'.$this->messageID);
+               }
+                       
+               return $this->getDecoratedObject()->getLink();
+       }
+       
+       /**
+        * @see wcf\data\search\ISearchResultObject::getTime()
+        */
+       public function getTime() {
+               return $this->time;
+       }
+       
+       /**
+        * @see wcf\data\search\ISearchResultObject::getObjectTypeName()
+        */
+       public function getObjectTypeName() {
+               return 'com.woltlab.wcf.conversation.message';
+       }
+       
+       /**
+        * @see wcf\data\search\ISearchResultObject::getContainerTitle()
+        */
+       public function getContainerTitle() {
+               return '';
+       }
+       
+       /**
+        * @see wcf\data\search\ISearchResultObject::getContainerLink()
+        */
+       public function getContainerLink() {
+               return '';
+       }
 }
index e48a39897ad72d5cb11e074c519ce26fb5bc2738..1dd20b61f1d8676c94223c7626ae932378dc49ac 100644 (file)
@@ -23,32 +23,25 @@ class ConversationMessageSearch extends AbstractSearchableObjectType {
        public $messageCache = array();
        
        /**
-        * @see wcf\system\search\ISearchableObjectType::cacheMessageData()
+        * @see wcf\system\search\ISearchableObjectType::cacheObjects()
         */
-       public function cacheMessageData(array $objectIDs, array $additionalData = null) {
+       public function cacheObjects(array $objectIDs, array $additionalData = null) {
                $messageList = new SearchResultConversationMessageList();
                $messageList->getConditionBuilder()->add('conversation_message.messageID IN (?)', array($objectIDs));
                $messageList->readObjects();
                foreach ($messageList->getObjects() as $message) {
-                       $this->messageCache[$message->messageID] = array('type' => 'com.woltlab.wcf.conversation.message', 'message' => $message);
+                       $this->messageCache[$message->messageID] = $message;
                }
        }
        
        /**
-        * @see wcf\system\search\ISearchableObjectType::cacheMessageData()
+        * @see wcf\system\search\ISearchableObjectType::getObject()
         */
-       public function getMessageData($objectID) {
+       public function getObject($objectID) {
                if (isset($this->messageCache[$objectID])) return $this->messageCache[$objectID];
                return null;
        }
        
-       /**
-        * @see wcf\system\search\ISearchableObjectType::getResultTemplateName()
-        */
-       public function getResultTemplateName() {
-               return 'searchResultConversationMessage';
-       }
-       
        /**
         * @see wcf\system\search\ISearchableObjectType::getJoins()
         */
index 5399207748ad369369b1f381df29af7252815735..8093d788e6325f923001092117ec29478ffad652 100644 (file)
                <item name="wcf.conversation.label.assignLabels"><![CDATA[Label zuweisen]]></item>
        </category>
        
+       <category name="wcf.search">
+               <item name="wcf.search.type.com.woltlab.wcf.conversation.message"><![CDATA[Konversationen]]></item>
+               <item name="wcf.search.object.com.woltlab.wcf.conversation.message"><![CDATA[Konversation]]></item>
+       </category>
+       
        <category name="wcf.user.notification">
                <item name="wcf.user.notification.conversation.message.output"><![CDATA[Hat auf die Konversation „<a href="{link controller='Conversation' object=$message->getConversation()}messageID={@$message->messageID}{/link}#message{@$message->messageID}">{$message->getTitle()}</a>“ geantwortet.]]></item>
                <item name="wcf.user.notification.conversation.message.shortOutput"><![CDATA[Neue Antwort auf Konversation]]></item>            
diff --git a/templates/searchResultConversationMessage.tpl b/templates/searchResultConversationMessage.tpl
deleted file mode 100644 (file)
index 9b33c86..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<article class="message messageReduced marginTop">
-       <div>
-               <section class="messageContent">
-                       <div>
-                               <header class="messageHeader">
-                                       <p class="messageCounter"><a href="{link controller='Conversation' object=$item[message]->getConversation()}messageID={@$item[message]->messageID}{/link}#message{@$item[message]->messageID}" title="{lang}wcf.conversation.message.permalink{/lang}" class="button jsTooltip">{#$startIndex}</a></p>
-                                       
-                                       <div class="box32">
-                                               <a href="{link controller='User' object=$item[message]->getUserProfile()}{/link}" class="framed">{@$item[message]->getUserProfile()->getAvatar()->getImageTag(32)}</a>
-                                               
-                                               <hgroup class="messageHeadline">
-                                                       <h1><a href="{link controller='Conversation' object=$item[message]->getConversation()}messageID={@$item[message]->messageID}&highlight={$query|urlencode}{/link}#message{@$item[message]->messageID}">{$item[message]->subject}</a></h1>
-                                                       <h2>
-                                                               <span class="username"><a href="{link controller='User' object=$item[message]->getUserProfile()}{/link}" class="userLink" data-user-id="{@$item[message]->userID}">{$item[message]->username}</a></span>
-                                                               {@$item[message]->time|time}
-                                                       </h2>
-                                               </hgroup>
-                                       </div>
-                               </header>
-                               
-                               <div class="messageBody">
-                                       <div>
-                                               {@$item[message]->getFormattedMessage()}
-                                       </div>
-                                       
-                                       <footer class="messageOptions">
-                                               <nav class="breadcrumbs marginTop">
-                                                       <ul>
-                                                               <li><a href="{link controller='Conversation' object=$item[message]->getConversation()}highlight={$query|urlencode}{/link}" title="{$item[message]->subject}"><span>{$item[message]->subject}</span></a> <span class="pointer"><span>&raquo;</span></span></li>
-                                                       </ul>
-                                               </nav>
-                                               
-                                               <nav>
-                                                       <ul class="smallButtons buttonGroup"><li class="toTopLink"><a href="{@$__wcf->getAnchor('top')}" title="{lang}wcf.global.scrollUp{/lang}" class="button jsTooltip"><span class="icon icon16 icon-arrow-up"></span> <span class="invisible">{lang}wcf.global.scrollUp{/lang}</span></a></li></ul>
-                                               </nav>
-                                       </footer>
-                               </div>
-                       </div>
-               </section>
-       </div>
-</article>