Replace breadcrumbs with page locations
authorMatthias Schmidt <gravatronics@live.com>
Sat, 7 May 2016 22:07:15 +0000 (00:07 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 7 May 2016 22:07:15 +0000 (00:07 +0200)
files/lib/data/conversation/Conversation.class.php
files/lib/form/ConversationAddForm.class.php
files/lib/form/ConversationMessageAddForm.class.php
files/lib/form/ConversationMessageEditForm.class.php
files/lib/page/ConversationListPage.class.php
files/lib/page/ConversationPage.class.php

index c7375876c7a637e98f7d6dc038b4a62cf3f64443..a5a1124f987f8651aeafbea2b019295f5c1100c2 100644 (file)
@@ -1,10 +1,9 @@
 <?php
 namespace wcf\data\conversation;
 use wcf\data\conversation\message\ConversationMessage;
+use wcf\data\ITitledLinkObject;
 use wcf\data\user\UserProfile;
 use wcf\data\DatabaseObject;
-use wcf\system\breadcrumb\Breadcrumb;
-use wcf\system\breadcrumb\IBreadcrumbProvider;
 use wcf\system\conversation\ConversationHandler;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\UserInputException;
@@ -42,7 +41,7 @@ use wcf\util\ArrayUtil;
  * @property-read      integer         $isDraft
  * @property-read      string          $draftData
  */
-class Conversation extends DatabaseObject implements IBreadcrumbProvider, IRouteController {
+class Conversation extends DatabaseObject implements IRouteController, ITitledLinkObject {
        /**
         * @inheritDoc
         */
@@ -87,10 +86,8 @@ class Conversation extends DatabaseObject implements IBreadcrumbProvider, IRoute
        /**
         * @inheritDoc
         */
-       public function getBreadcrumb() {
-               return new Breadcrumb($this->subject, LinkHandler::getInstance()->getLink('Conversation', [
-                       'object' => $this
-               ]));
+       public function getLink() {
+               return LinkHandler::getInstance()->getLink('Conversation', ['object' => $this]);
        }
        
        /**
index c3abb095aa38f3f757ff79d9bdf6854a65a3d0e4..09c4c7f81db4360a33d2b31c325e265842455805 100644 (file)
@@ -3,12 +3,12 @@ namespace wcf\form;
 use wcf\data\conversation\Conversation;
 use wcf\data\conversation\ConversationAction;
 use wcf\data\user\UserProfile;
-use wcf\system\breadcrumb\Breadcrumb;
 use wcf\system\conversation\ConversationHandler;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\NamedUserException;
 use wcf\system\exception\UserInputException;
 use wcf\system\message\quote\MessageQuoteManager;
+use wcf\system\page\PageLocationManager;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 use wcf\util\HeaderUtil;
@@ -235,7 +235,7 @@ class ConversationAddForm extends MessageForm {
                parent::readData();
                
                // add breadcrumbs
-               WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('wcf.conversation.conversations'), LinkHandler::getInstance()->getLink('ConversationList')));
+               PageLocationManager::getInstance()->addParentLocation('com.woltlab.wcf.conversation.ConversationList');
        }
        
        /**
index 5f4e737b7b634367caf3a1ed0a2fa5eba532c5c7..22943c3ad8e6158ec55d7ff9b21e33349f1798de 100644 (file)
@@ -4,11 +4,11 @@ use wcf\data\conversation\message\ConversationMessage;
 use wcf\data\conversation\message\ConversationMessageAction;
 use wcf\data\conversation\message\ViewableConversationMessageList;
 use wcf\data\conversation\Conversation;
-use wcf\system\breadcrumb\Breadcrumb;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\PermissionDeniedException;
 use wcf\system\message\quote\MessageQuoteManager;
 use wcf\system\message\QuickReplyManager;
+use wcf\system\page\PageLocationManager;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 use wcf\util\HeaderUtil;
@@ -141,8 +141,8 @@ class ConversationMessageAddForm extends MessageForm {
                }
                
                // add breadcrumbs
-               WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('wcf.conversation.conversations'), LinkHandler::getInstance()->getLink('ConversationList')));
-               WCF::getBreadcrumbs()->add($this->conversation->getBreadcrumb());
+               PageLocationManager::getInstance()->addParentLocation('com.woltlab.wcf.conversation.Conversation', $this->conversation->conversationID, $this->conversation);
+               PageLocationManager::getInstance()->addParentLocation('com.woltlab.wcf.conversation.ConversationList');
                
                // get message list
                $this->messageList = new ViewableConversationMessageList();
index 966171a8cacd939d4b8deb9efa4ca5d6b62a493f..e7cca48bb86659025e77295bfd50b0d000cbf53d 100644 (file)
@@ -5,9 +5,9 @@ use wcf\data\conversation\message\ConversationMessageAction;
 use wcf\data\conversation\message\ViewableConversationMessageList;
 use wcf\data\conversation\ConversationAction;
 use wcf\data\user\UserProfile;
-use wcf\system\breadcrumb\Breadcrumb;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\PermissionDeniedException;
+use wcf\system\page\PageLocationManager;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 use wcf\util\HeaderUtil;
@@ -211,8 +211,8 @@ class ConversationMessageEditForm extends ConversationAddForm {
                }
                
                // add breadcrumbs
-               WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('wcf.conversation.conversations'), LinkHandler::getInstance()->getLink('ConversationList')));
-               WCF::getBreadcrumbs()->add($this->conversation->getBreadcrumb());
+               PageLocationManager::getInstance()->addParentLocation('com.woltlab.wcf.conversation.Conversation', $this->conversation->conversationID, $this->conversation);
+               PageLocationManager::getInstance()->addParentLocation('com.woltlab.wcf.conversation.ConversationList');
                
                // get message list
                $this->messageList = new ViewableConversationMessageList();
index 82db17ac0b70ccb9c6d6fed931ce907a94246295..0a310e9ea5c1f600598e7a9306e2c5b7c19e0c1e 100644 (file)
@@ -6,7 +6,7 @@ use wcf\data\conversation\UserConversationList;
 use wcf\system\breadcrumb\Breadcrumb;
 use wcf\system\clipboard\ClipboardHandler;
 use wcf\system\exception\IllegalLinkException;
-use wcf\system\request\LinkHandler;
+use wcf\system\page\PageLocationManager;
 use wcf\system\WCF;
 use wcf\util\ArrayUtil;
 
@@ -165,7 +165,8 @@ class ConversationListPage extends SortablePage {
                
                if ($this->filter != '') {
                        // add breadcrumbs
-                       WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('wcf.conversation.conversations'), LinkHandler::getInstance()->getLink('ConversationList')));
+                       // TODO: this is not working at the moment as PageLocationManager already sets this as the current page based on request data which is later discarded 
+                       PageLocationManager::getInstance()->addParentLocation('com.woltlab.wcf.conversation.ConversationList');
                }
                
                // read stats
index ed0689668f906464c842ccc26da93c4c1280ce3e..8d0d8d5afaabb44bb332e68882e768b27548affe 100644 (file)
@@ -12,10 +12,10 @@ use wcf\data\modification\log\ConversationLogModificationLogList;
 use wcf\data\smiley\SmileyCache;
 use wcf\system\attachment\AttachmentHandler;
 use wcf\system\bbcode\BBCodeHandler;
-use wcf\system\breadcrumb\Breadcrumb;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\PermissionDeniedException;
 use wcf\system\message\quote\MessageQuoteManager;
+use wcf\system\page\PageLocationManager;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 use wcf\util\HeaderUtil;
@@ -167,11 +167,13 @@ class ConversationPage extends MultipleLinkPage {
                parent::readData();
                
                // add breadcrumbs
-               WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('wcf.conversation.conversations'), LinkHandler::getInstance()->getLink('ConversationList')));
+               PageLocationManager::getInstance()->addParentLocation('com.woltlab.wcf.conversation.ConversationList');
                if ($this->conversation->isDraft) {
+                       /* TODO
                        WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('wcf.conversation.folder.draft'), LinkHandler::getInstance()->getLink('ConversationList', [
                                'filter' => 'draft'
                        ])));
+                       */
                }
                
                // update last visit time count