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.
data: {
actionName: listItem.data('parameters').actionName,
className: listItem.data('parameters').className,
+ containerData: this._containerData[listItem.data('type')],
objectIDs: $objectIDs,
parameters: $parameters
},
--- /dev/null
+<?php
+namespace wcf\data;
+
+/**
+ * Every database object action class which belongs to database objects which support
+ * clipboard actions has to implement this interface.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2012 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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();
+}
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;
* @subpackage data.user
* @category Community Framework
*/
-class UserAction extends AbstractDatabaseObjectAction implements ISearchAction {
+class UserAction extends AbstractDatabaseObjectAction implements IClipboardAction, ISearchAction {
/**
* @see wcf\data\AbstractDatabaseObjectAction::$className
*/
}
/**
- * 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'));
}
// 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');