From 849204bde59b42cbf11702b2d823d52e30f15ae0 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 1 May 2016 14:11:29 +0200 Subject: [PATCH] Updated edit history --- com.woltlab.wcf/templates/editHistory.tpl | 2 + com.woltlab.wcf/templates/header.tpl | 6 ++- .../files/lib/page/EditHistoryPage.class.php | 53 ++++++++++--------- .../edit/IHistorySavingObject.class.php | 20 +++---- .../files/style/ui/messageEditHistory.scss | 32 +++++++++++ wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 7 files changed, 79 insertions(+), 36 deletions(-) create mode 100644 wcfsetup/install/files/style/ui/messageEditHistory.scss diff --git a/com.woltlab.wcf/templates/editHistory.tpl b/com.woltlab.wcf/templates/editHistory.tpl index c6dd004669..7de9205e65 100644 --- a/com.woltlab.wcf/templates/editHistory.tpl +++ b/com.woltlab.wcf/templates/editHistory.tpl @@ -2,6 +2,8 @@ {capture assign='contentTitle'}{lang}wcf.edit.versions{/lang}: {$object->getTitle()}{/capture} +{capture assign='contentHeaderNavigation'}
  • {lang}wcf.edit.button.goToContent{/lang}
  • {/capture} + {include file='header'} {if $diff} diff --git a/com.woltlab.wcf/templates/header.tpl b/com.woltlab.wcf/templates/header.tpl index 04c2bbf71d..8b5b2ca6f4 100644 --- a/com.woltlab.wcf/templates/header.tpl +++ b/com.woltlab.wcf/templates/header.tpl @@ -101,7 +101,11 @@ {hascontent} {/hascontent} diff --git a/wcfsetup/install/files/lib/page/EditHistoryPage.class.php b/wcfsetup/install/files/lib/page/EditHistoryPage.class.php index f01596abda..be6d9241d0 100644 --- a/wcfsetup/install/files/lib/page/EditHistoryPage.class.php +++ b/wcfsetup/install/files/lib/page/EditHistoryPage.class.php @@ -1,8 +1,11 @@ * @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 - )); + ]); } } diff --git a/wcfsetup/install/files/lib/system/edit/IHistorySavingObject.class.php b/wcfsetup/install/files/lib/system/edit/IHistorySavingObject.class.php index 1d95d1dc0a..d995502e2d 100644 --- a/wcfsetup/install/files/lib/system/edit/IHistorySavingObject.class.php +++ b/wcfsetup/install/files/lib/system/edit/IHistorySavingObject.class.php @@ -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 * @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 index 0000000000..8bae5c6f47 --- /dev/null +++ b/wcfsetup/install/files/style/ui/messageEditHistory.scss @@ -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; + } + } +} diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 1fb6347d57..ed6e4075c9 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -2132,6 +2132,7 @@ Fehler sind beispielsweise: username} vom {$edit->time|plainTime} wirklich wiederherstellen?]]> username} vom {$edit->time|plainTime}]]> + time|plainTime} ({$old->username})]]> time|plainTime} ({$new->username})]]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 3583aa4247..055482a155 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -2141,6 +2141,7 @@ Errors are: time|plainTime}, created by {$edit->username}?]]> time|plainTime}, created by {$edit->username}]]> + time|plainTime} ({$old->username})]]> time|plainTime} ({$new->username})]]> -- 2.20.1