Add breadcrumbs to EditHistoryPage
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 25 Jun 2014 17:57:44 +0000 (19:57 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 9 Jul 2014 19:51:08 +0000 (21:51 +0200)
wcfsetup/install/files/lib/page/EditHistoryPage.class.php
wcfsetup/install/files/lib/system/edit/IHistorySavingObject.class.php

index ee623a32ba9ddb523a65292dc8506114bf9a3a01..ae2e5f904353e044d3f893762ffd91d014154461 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 namespace wcf\page;
 use wcf\data\edit\history\entry\EditHistoryEntry;
+use wcf\data\edit\history\entry\EditHistoryEntryList;
 use wcf\data\object\type\ObjectTypeCache;
-use wcf\page\AbstractPage;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\WCF;
 use wcf\util\Diff;
@@ -19,6 +19,12 @@ use wcf\util\StringUtil;
  * @category   Community Framework
  */
 class EditHistoryPage extends AbstractPage {
+       /**
+        * DatabaseObjectList object
+        * @var \wcf\data\DatabaseObjectList
+        */
+       public $objectList = null;
+
        /**
         * left / old version id
         * @var integer
@@ -74,8 +80,8 @@ class EditHistoryPage extends AbstractPage {
        public $object = null;
        
        /**
-       * @see  \wcf\page\IPage::readParameters()
-       */
+        * @see \wcf\page\IPage::readParameters()
+        */
        public function readParameters() {
                parent::readParameters();
                
@@ -114,6 +120,7 @@ class EditHistoryPage extends AbstractPage {
                $this->object = $processor->getObjectByID($this->objectID);
                $processor->checkPermissions($this->object);
                $this->activeMenuItem = $processor->getActivePageMenuItem();
+               $this->object->addBreadcrumbs();
                
                if (!$this->new) {
                        $this->new = $this->object;
@@ -126,6 +133,12 @@ class EditHistoryPage extends AbstractPage {
        public function readData() {
                parent::readData();
                
+               $this->objectList = new EditHistoryEntryList();
+               $this->objectList->sqlOrderBy = "time DESC";
+               $this->objectList->getConditionBuilder()->add('objectTypeID = ?', array($this->objectTypeID));
+               $this->objectList->getConditionBuilder()->add('objectID = ?', array($this->objectID));
+               $this->objectList->readObjects();
+               
                // valid IDs were given, calculate diff
                if ($this->old) {
                        $a = explode("\n", StringUtil::unifyNewlines($this->old->getMessage()));
@@ -146,7 +159,8 @@ class EditHistoryPage extends AbstractPage {
                        'newID' => $this->newID,
                        'new' => $this->new,
                        'object' => $this->object,
-                       'diff' => $this->diff
+                       'diff' => $this->diff,
+                       'objects' => $this->objectList
                ));
        }
 }
index b676b984726a81e99ac9b85705175680b244ecd1..7ce69c2849fd3357eb0180150138fbcf175d99f3 100644 (file)
@@ -35,4 +35,9 @@ interface IHistorySavingObject extends IDatabaseObjectProcessor, IUserContent {
         * @return      string
         */
        public function getMessage();
+       
+       /**
+        * Adds the object's breadcrumbs.
+        */
+       public function addBreadcrumbs();
 }