Integrate UserExtendedClipboardAction into UserClipboardAction
authorMatthias Schmidt <gravatronics@live.com>
Fri, 22 May 2015 20:01:41 +0000 (22:01 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Fri, 22 May 2015 20:01:41 +0000 (22:01 +0200)
CHANGELOG.md
com.woltlab.wcf/clipboardAction.xml
wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php
wcfsetup/install/files/lib/system/clipboard/action/UserExtendedClipboardAction.class.php [deleted file]

index 46a5e31b5eec343a33a8dfc29696310e0ca75890..5bd41ca23d082dcae46d863a8cfd9a2303c3b9c0 100644 (file)
@@ -9,5 +9,6 @@
 * `permissions` and `options` support for template listeners.
 * `wcf\data\TDatabaseObjectOptions` and `wcf\data\TDatabaseObjectPermissions` for database object-bound options and permissions validation.
 * `wcf\system\cache\builder\EventListenerCacheBuilder` returns `wcf\data\event\listener\EventListener` objects instead of data arrays.
+* `wcf\system\clipboard\action\UserExtendedClipboardAction` removed.
 * `wcf\system\event\listener\PreParserAtUserListener` removed.
 
index 57ccaa70bcc4d3135ba6e74c84cbeebccb5c9eeb..2addad9f275e1c1fd9639fdba62956c7f920ccc9 100644 (file)
@@ -26,7 +26,7 @@
                </action>
                
                <action name="merge">
-                       <actionclassname><![CDATA[wcf\system\clipboard\action\UserExtendedClipboardAction]]></actionclassname>
+                       <actionclassname><![CDATA[wcf\system\clipboard\action\UserClipboardAction]]></actionclassname>
                        <showorder>4</showorder>
                        <pages>
                                <page><![CDATA[wcf\acp\page\UserListPage]]></page>
@@ -34,7 +34,7 @@
                </action>
                
                <action name="enable">
-                       <actionclassname><![CDATA[wcf\system\clipboard\action\UserExtendedClipboardAction]]></actionclassname>
+                       <actionclassname><![CDATA[wcf\system\clipboard\action\UserClipboardAction]]></actionclassname>
                        <showorder>5</showorder>
                        <pages>
                                <page><![CDATA[wcf\acp\page\UserListPage]]></page>
index 5b3d743665a4350c474423adb346fd7e952cbdbd..0c1ef8b141b5e8777b846e1a0edda4f40424560b 100644 (file)
@@ -25,7 +25,7 @@ class UserClipboardAction extends AbstractClipboardAction {
        /**
         * @see \wcf\system\clipboard\action\AbstractClipboardAction::$supportedActions
         */
-       protected $supportedActions = array('assignToGroup', 'ban', 'delete', 'exportMailAddress', 'sendMail', 'sendNewPassword');
+       protected $supportedActions = array('assignToGroup', 'ban', 'delete', 'enable', 'exportMailAddress', 'merge', 'sendMail', 'sendNewPassword');
        
        /**
         * @see \wcf\system\clipboard\action\IClipboardAction::execute()
@@ -53,6 +53,10 @@ class UserClipboardAction extends AbstractClipboardAction {
                                $item->setURL(LinkHandler::getInstance()->getLink('UserEmailAddressExport'));
                        break;
                        
+                       case 'merge':
+                               $item->setURL(LinkHandler::getInstance()->getLink('UserMerge'));
+                       break;
+                       
                        case 'sendMail':
                                $item->setURL(LinkHandler::getInstance()->getLink('UserMail'));
                        break;
@@ -168,4 +172,40 @@ class UserClipboardAction extends AbstractClipboardAction {
                
                return $this->__validateAccessibleGroups(array_keys($this->objects));
        }
+       
+       /**
+        * Returns the ids of the users which can be enabled.
+        * 
+        * @return      array<integer>
+        */
+       protected function validateEnable() {
+               // check permissions
+               if (!WCF::getSession()->getPermission('admin.user.canEnableUser')) {
+                       return array();
+               }
+               
+               $userIDs = array();
+               foreach ($this->objects as $user) {
+                       if ($user->activationCode) $userIDs[] = $user->userID;
+               }
+               
+               return $userIDs;
+       }
+       
+       /**
+        * Returns the ids of the users which can be merge.
+        * 
+        * @return      array<integer>
+        */
+       protected function validateMerge() {
+               // check permissions
+               if (!WCF::getSession()->getPermission('admin.user.canEditUser')) {
+                       return array();
+               }
+               
+               $userIDs = array_keys($this->objects);
+               if (count($userIDs) < 2) return array();
+               
+               return $userIDs;
+       }
 }
diff --git a/wcfsetup/install/files/lib/system/clipboard/action/UserExtendedClipboardAction.class.php b/wcfsetup/install/files/lib/system/clipboard/action/UserExtendedClipboardAction.class.php
deleted file mode 100644 (file)
index 1820ba1..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-namespace wcf\system\clipboard\action;
-use wcf\data\clipboard\action\ClipboardAction;
-use wcf\system\request\LinkHandler;
-use wcf\system\WCF;
-
-/**
- * Prepares clipboard editor items for user objects.
- * 
- * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
- * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package    com.woltlab.wcf
- * @subpackage system.clipboard.action
- * @category   Community Framework
- */
-class UserExtendedClipboardAction extends AbstractClipboardAction {
-       /**
-        * @see \wcf\system\clipboard\action\AbstractClipboardAction::$supportedActions
-        */
-       protected $supportedActions = array('merge', 'enable');
-       
-       /**
-        * @see \wcf\system\clipboard\action\IClipboardAction::execute()
-        */
-       public function execute(array $objects, ClipboardAction $action) {
-               $item = parent::execute($objects, $action);
-               
-               if ($item === null) {
-                       return null;
-               }
-               
-               // handle actions
-               switch ($action->actionName) {
-                       case 'merge':
-                               $item->setURL(LinkHandler::getInstance()->getLink('UserMerge'));
-                       break;
-               }
-               
-               return $item;
-       }
-       
-       /**
-        * @see \wcf\system\clipboard\action\IClipboardAction::getClassName()
-        */
-       public function getClassName() {
-               return 'wcf\data\user\UserAction';
-       }
-       
-       /**
-        * @see \wcf\system\clipboard\action\IClipboardAction::getTypeName()
-        */
-       public function getTypeName() {
-               return 'com.woltlab.wcf.user';
-       }
-       
-       /**
-        * Returns the ids of the users which can be enabled.
-        * 
-        * @return      array<integer>
-        */
-       protected function validateEnable() {
-               // check permissions
-               if (!WCF::getSession()->getPermission('admin.user.canEnableUser')) {
-                       return array();
-               }
-               
-               $userIDs = array();
-               foreach ($this->objects as $user) {
-                       if ($user->activationCode) $userIDs[] = $user->userID;
-               }
-               
-               return $userIDs;
-       }
-       
-       /**
-        * Returns the ids of the users which can be merge.
-        * 
-        * @return      array<integer>
-        */
-       protected function validateMerge() {
-               // check permissions
-               if (!WCF::getSession()->getPermission('admin.user.canEditUser')) {
-                       return array();
-               }
-               
-               $userIDs = array_keys($this->objects);
-               if (count($userIDs) < 2) return array();
-               
-               return $userIDs;
-       }
-}