Updated edit history
authorAlexander Ebert <ebert@woltlab.com>
Sun, 1 May 2016 12:11:29 +0000 (14:11 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 1 May 2016 12:11:35 +0000 (14:11 +0200)
com.woltlab.wcf/templates/editHistory.tpl
com.woltlab.wcf/templates/header.tpl
wcfsetup/install/files/lib/page/EditHistoryPage.class.php
wcfsetup/install/files/lib/system/edit/IHistorySavingObject.class.php
wcfsetup/install/files/style/ui/messageEditHistory.scss [new file with mode: 0644]
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index c6dd004669785e74cfe90fef6b86dc9be21d9a2b..7de9205e65314694d830a5e9244d4f17dfd97682 100644 (file)
@@ -2,6 +2,8 @@
 
 {capture assign='contentTitle'}{lang}wcf.edit.versions{/lang}: {$object->getTitle()}{/capture}
 
+{capture assign='contentHeaderNavigation'}<li><a href="{$object->getLink()}" class="button">{lang}wcf.edit.button.goToContent{/lang}</a></li>{/capture}
+
 {include file='header'}
 
 {if $diff}
index 04c2bbf71db1bb18b2ee88048bbf968cf2737d7a..8b5b2ca6f4ae8bca193f54d93f26b8828fef0c48 100644 (file)
                                                {hascontent}
                                                        <nav class="contentHeaderNavigation">
                                                                <ul>
-                                                                       {content}{event name='contentHeaderNavigation'}{/content}
+                                                                       {content}
+                                                                               {if !$contentHeaderNavigation|empty}{@$contentHeaderNavigation}{/if}
+                                                                               
+                                                                               {event name='contentHeaderNavigation'}
+                                                                       {/content}
                                                                </ul>
                                                        </nav>
                                                {/hascontent}
index f01596abdaf72995a0fa4de9320ead7daf7001fb..be6d9241d0f3267b3fd5c38b5dcca70c8aa23fa0 100644 (file)
@@ -1,8 +1,11 @@
 <?php
 namespace wcf\page;
+use wcf\data\DatabaseObjectList;
 use wcf\data\edit\history\entry\EditHistoryEntry;
 use wcf\data\edit\history\entry\EditHistoryEntryList;
+use wcf\data\object\type\ObjectType;
 use wcf\data\object\type\ObjectTypeCache;
+use wcf\system\edit\IHistorySavingObject;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
@@ -14,7 +17,7 @@ use wcf\util\StringUtil;
  * Compares two templates.
  * 
  * @author     Tim Duesterhus
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage page
@@ -22,15 +25,15 @@ use wcf\util\StringUtil;
  */
 class EditHistoryPage extends AbstractPage {
        /**
-        * @see \wcf\page\AbstractPage::$neededModules
+        * @inheritDoc
         */
-       public $neededModules = array('MODULE_EDIT_HISTORY');
+       public $neededModules = ['MODULE_EDIT_HISTORY'];
        
        /**
         * DatabaseObjectList object
-        * @var \wcf\data\DatabaseObjectList
+        * @var DatabaseObjectList
         */
-       public $objectList = null;
+       public $objectList;
        
        /**
         * left / old version id
@@ -40,9 +43,9 @@ class EditHistoryPage extends AbstractPage {
        
        /**
         * left / old version
-        * @var \wcf\data\edit\history\entry\EditHistoryEntry
+        * @var EditHistoryEntry
         */
-       public $old = null;
+       public $old;
        
        /**
         * right / new version id
@@ -52,21 +55,21 @@ class EditHistoryPage extends AbstractPage {
        
        /**
         * right / new version
-        * @var \wcf\data\edit\history\entry\EditHistoryEntry
+        * @var EditHistoryEntry
         */
-       public $new = null;
+       public $new;
        
        /**
         * differences between both versions
-        * @var \wcf\util\Diff
+        * @var Diff
         */
-       public $diff = null;
+       public $diff;
        
        /**
         * object type of the requested object
-        * @var \wcf\data\object\type\ObjectType
+        * @var ObjectType
         */
-       public $objectType = null;
+       public $objectType;
        
        /**
         * id of the requested object
@@ -76,12 +79,12 @@ class EditHistoryPage extends AbstractPage {
        
        /**
         * requested object
-        * @var \wcf\system\edit\IHistorySavingObject
+        * @var IHistorySavingObject
         */
-       public $object = null;
+       public $object;
        
        /**
-        * @see \wcf\page\IPage::readParameters()
+        * @inheritDoc
         */
        public function readParameters() {
                parent::readParameters();
@@ -121,7 +124,7 @@ class EditHistoryPage extends AbstractPage {
                $this->object = $processor->getObjectByID($this->objectID);
                if (!$this->object->getObjectID()) throw new IllegalLinkException();
                $processor->checkPermissions($this->object);
-               $this->object->addBreadcrumbs();
+               $this->object->setLocation();
                
                if (isset($_REQUEST['newID']) && !$this->new) {
                        $this->new = $this->object;
@@ -129,26 +132,26 @@ class EditHistoryPage extends AbstractPage {
                }
                
                if (!empty($_POST)) {
-                       HeaderUtil::redirect(LinkHandler::getInstance()->getLink('EditHistory', array(
+                       HeaderUtil::redirect(LinkHandler::getInstance()->getLink('EditHistory', [
                                'objectID' => $this->objectID,
                                'objectType' => $this->objectType->objectType,
                                'newID' => $this->newID,
                                'oldID' => $this->oldID
-                       )));
+                       ]));
                        exit;
                }
        }
        
        /**
-        * @see \wcf\page\IPage::readData()
+        * @inheritDoc
         */
        public function readData() {
                parent::readData();
                
                $this->objectList = new EditHistoryEntryList();
                $this->objectList->sqlOrderBy = "time DESC, entryID DESC";
-               $this->objectList->getConditionBuilder()->add('objectTypeID = ?', array($this->objectType->objectTypeID));
-               $this->objectList->getConditionBuilder()->add('objectID = ?', array($this->objectID));
+               $this->objectList->getConditionBuilder()->add('objectTypeID = ?', [$this->objectType->objectTypeID]);
+               $this->objectList->getConditionBuilder()->add('objectID = ?', [$this->objectID]);
                $this->objectList->readObjects();
                
                // valid IDs were given, calculate diff
@@ -169,12 +172,12 @@ class EditHistoryPage extends AbstractPage {
        }
        
        /**
-        * @see \wcf\page\IPage::assignVariables()
+        * @inheritDoc
         */
        public function assignVariables() {
                parent::assignVariables();
                
-               WCF::getTPL()->assign(array(
+               WCF::getTPL()->assign([
                        'oldID' => $this->oldID,
                        'old' => $this->old,
                        'newID' => $this->newID,
@@ -184,6 +187,6 @@ class EditHistoryPage extends AbstractPage {
                        'objects' => $this->objectList,
                        'objectID' => $this->objectID,
                        'objectType' => $this->objectType
-               ));
+               ]);
        }
 }
index 1d95d1dc0a29f29876e336d5a704eca5a4b1bcf4..d995502e2d8c13d137697557a1482b15c5b9ab34 100644 (file)
@@ -8,20 +8,13 @@ use wcf\data\IUserContent;
  * Represents an object that saves it's edit history.
  * 
  * @author     Tim Duesterhus
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.edit
  * @category   Community Framework
  */
 interface IHistorySavingObject extends IDatabaseObjectProcessor, IUserContent {
-       /**
-        * Reverts the object's text to the given EditHistoryEntry.
-        * 
-        * @param       \wcf\data\edit\history\entry\EditHistoryEntry
-        */
-       public function revertVersion(EditHistoryEntry $edit);
-       
        /**
         * Returns the object's current edit reason.
         * 
@@ -37,7 +30,14 @@ interface IHistorySavingObject extends IDatabaseObjectProcessor, IUserContent {
        public function getMessage();
        
        /**
-        * Adds the object's breadcrumbs.
+        * Reverts the object's text to the given EditHistoryEntry.
+        * 
+        * @param       EditHistoryEntry        $edit
+        */
+       public function revertVersion(EditHistoryEntry $edit);
+       
+       /**
+        * Sets the page location data.
         */
-       public function addBreadcrumbs();
+       public function setLocation();
 }
diff --git a/wcfsetup/install/files/style/ui/messageEditHistory.scss b/wcfsetup/install/files/style/ui/messageEditHistory.scss
new file mode 100644 (file)
index 0000000..8bae5c6
--- /dev/null
@@ -0,0 +1,32 @@
+/* edit history */
+.editHistoryDiff {
+       > .sideBySide:first-child {
+               margin-bottom: 20px;
+               text-align: center;
+       }
+       
+       .sideBySide {
+               display: flex;
+               
+               > div {
+                       flex: 0 0 50%;
+                       
+                       &:first-child {
+                               padding-right: 10px;
+                       }
+                       
+                       &:last-child {
+                               padding-left: 10px;
+                       }
+               }
+       }
+}
+
+@include screen-sm-down {
+       .editHistoryVersionList {
+               .columnUser,
+               .columnEditReason {
+                       display: none;
+               }
+       }
+}
index 1fb6347d57f380dbcf906937b8c13614cc500a1c..ed6e4075c9cfea8d464de087c56ac299b1e72259 100644 (file)
@@ -2132,6 +2132,7 @@ Fehler sind beispielsweise:
                <item name="wcf.edit.revert.sure"><![CDATA[Möchten Sie die Version von {$edit->username} vom {$edit->time|plainTime} wirklich wiederherstellen?]]></item>
                <item name="wcf.edit.reverted"><![CDATA[Wiederhergestellt auf Version von {$edit->username} vom {$edit->time|plainTime}]]></item>
                <item name="wcf.edit.button.compare"><![CDATA[Vergleichen]]></item>
+               <item name="wcf.edit.button.goToContent"><![CDATA[Zum Inhalt gehen]]></item>
                <item name="wcf.edit.headline.old"><![CDATA[{if $oldID == 'current'}Aktuelle {/if}Version vom {@$old->time|plainTime} ({$old->username})]]></item>
                <item name="wcf.edit.headline.new"><![CDATA[{if $newID == 'current'}Aktuelle {/if}Version vom {@$new->time|plainTime} ({$new->username})]]></item>
        </category>
index 3583aa42476e99c0b4f69e5ce7dd09ba52c303d9..055482a155cfbc98a7d08b414bff7cba9c67c5ef 100644 (file)
@@ -2141,6 +2141,7 @@ Errors are:
                <item name="wcf.edit.revert.sure"><![CDATA[Do you really want to revert to the version at {$edit->time|plainTime}, created by {$edit->username}?]]></item>
                <item name="wcf.edit.reverted"><![CDATA[Reverted to the version at {$edit->time|plainTime}, created by {$edit->username}]]></item>
                <item name="wcf.edit.button.compare"><![CDATA[Compare]]></item>
+               <item name="wcf.edit.button.goToContent"><![CDATA[Go to Related Content]]></item>
                <item name="wcf.edit.headline.old"><![CDATA[{if $oldID == 'current'}Current version{else}Version{/if} as of {@$old->time|plainTime} ({$old->username})]]></item>
                <item name="wcf.edit.headline.new"><![CDATA[{if $newID == 'current'}Current version{else}Version{/if} as of {@$new->time|plainTime} ({$new->username})]]></item>
        </category>