From: Matthias Schmidt Date: Sat, 27 Oct 2012 18:34:10 +0000 (+0200) Subject: Enhances new clipboard's unmark all action X-Git-Tag: 2.0.0_Beta_1~830^2^2^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7918ddba05d926183634807c8d552ed1ce66aa67;p=GitHub%2FWoltLab%2FWCF.git Enhances new clipboard's unmark all action The action class now **has to** implement the new `wcf\data\IClipboardAction` interface and the AJAX call to unmark all items includes the container data now. --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index d0df0e1750..bffcec1b33 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -1261,6 +1261,7 @@ WCF.Clipboard = { data: { actionName: listItem.data('parameters').actionName, className: listItem.data('parameters').className, + containerData: this._containerData[listItem.data('type')], objectIDs: $objectIDs, parameters: $parameters }, diff --git a/wcfsetup/install/files/lib/data/IClipboardAction.class.php b/wcfsetup/install/files/lib/data/IClipboardAction.class.php new file mode 100644 index 0000000000..3ed3206822 --- /dev/null +++ b/wcfsetup/install/files/lib/data/IClipboardAction.class.php @@ -0,0 +1,25 @@ + + * @package com.woltlab.wcf + * @subpackage data + * @category Community Framework + */ +interface IClipboardAction { + /** + * Unmarks all marked objects. + */ + public function unmarkAll(); + + /** + * Validates the 'unmarkAll' action. + */ + public function validateUnmarkAll(); +} diff --git a/wcfsetup/install/files/lib/data/user/UserAction.class.php b/wcfsetup/install/files/lib/data/user/UserAction.class.php index d4b6f19258..aadde72010 100644 --- a/wcfsetup/install/files/lib/data/user/UserAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserAction.class.php @@ -2,6 +2,7 @@ namespace wcf\data\user; use wcf\data\user\group\UserGroup; use wcf\data\AbstractDatabaseObjectAction; +use wcf\data\IClipboardAction; use wcf\data\ISearchAction; use wcf\system\clipboard\ClipboardHandler; use wcf\system\database\util\PreparedStatementConditionBuilder; @@ -20,7 +21,7 @@ use wcf\util\StringUtil; * @subpackage data.user * @category Community Framework */ -class UserAction extends AbstractDatabaseObjectAction implements ISearchAction { +class UserAction extends AbstractDatabaseObjectAction implements IClipboardAction, ISearchAction { /** * @see wcf\data\AbstractDatabaseObjectAction::$className */ @@ -265,12 +266,12 @@ class UserAction extends AbstractDatabaseObjectAction implements ISearchAction { } /** - * Does nothing. + * @see wcf\data\IClipboardAction::validateUnmarkAll() */ public function validateUnmarkAll() { } /** - * Unmarks all users. + * @see wcf\data\IClipboardAction::unmarkAll() */ public function unmarkAll() { ClipboardHandler::getInstance()->removeItems(ClipboardHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.user')); diff --git a/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php b/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php index e338d333e0..2d41ced066 100644 --- a/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php +++ b/wcfsetup/install/files/lib/system/clipboard/ClipboardHandler.class.php @@ -286,6 +286,10 @@ class ClipboardHandler extends SingletonFactory { } // append 'unmark all' item + if (!ClassUtil::isInstanceOf($actionData['object']->getClassName(), 'wcf\data\IClipboardAction')) { + throw new SystemException("'".$actionData['object']->getClassName()."' has to implement 'wcf\data\IClipboardAction'."); + } + $unmarkAll = new ClipboardEditorItem(); $unmarkAll->setName('unmarkAll'); $unmarkAll->addParameter('actionName', 'unmarkAll');