};
this._proxy.setOption('data', {
- actionName: 'getList',
+ actionName: 'getSearchResultList',
className: this._className,
parameters: this._getParameters($parameters)
});
* @subpackage data
* @category Community Framework
*/
-abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction {
+abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, IDeleteAction {
/**
* pending action
* @var string
}
/**
- * Validates permissions and parameters.
+ * @see wcf\data\IDeleteAction::validateDelete()
*/
public function validateDelete() {
// validate permissions
}
/**
- * Deletes database object and returns the number of deleted objects.
- *
- * @return integer
+ * @see wcf\data\IDeleteAction::delete()
*/
public function delete() {
if (!count($this->objects)) {
--- /dev/null
+<?php
+namespace wcf\data;
+
+/**
+ * Every database object action whose objects represent a collapsible container
+ * 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 ICollapsibleContainerAction {
+ /**
+ * Toggles the container state of the relevant objects.
+ */
+ public function toggleContainer();
+
+ /**
+ * Validates the "toggleContainer" action.
+ */
+ public function validateToggleContainer();
+}
--- /dev/null
+<?php
+namespace wcf\data;
+
+/**
+ * Every database object action whose objects can be deleted (via AJAX) 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 IDeleteAction {
+ /**
+ * Deletes the relevant objects and returns the number of deleted objects.
+ *
+ * @return integer
+ */
+ public function delete();
+
+ /**
+ * Validates the "delete" action.
+ */
+ public function validateDelete();
+}
--- /dev/null
+<?php
+namespace wcf\data;
+
+/**
+ * Every database object action whose objects represent a collapsible container
+ * whose content can be loaded via AJAX 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 ILoadableCollapsibleContainerAction {
+ /**
+ * Toggles the container state of the relevant objects and loads their
+ * content if necessary.
+ */
+ public function loadContainer();
+
+ /**
+ * Validates the "loadContainer" action.
+ */
+ public function validateLoadContainer();
+}
\ No newline at end of file
--- /dev/null
+<?php
+namespace wcf\data;
+
+/**
+ * Every database object action whose objects can be positioned via AJAX 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 IPositionAction {
+ /**
+ * Updates the positions of the relevant objects.
+ */
+ public function updatePosition();
+
+ /**
+ * Validates the "updatePosition" action.
+ */
+ public function validateUpdatePosition();
+}
--- /dev/null
+<?php
+namespace wcf\data;
+
+/**
+ * Every database object action whose objects can be searched via AJAX 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 ISearchAction {
+ /**
+ * Returns a list with data of objects that match the given search criteria.
+ *
+ * @return array<array>
+ */
+ public function getSearchResultList();
+
+ /**
+ * Validates the "getSearchResultList" action.
+ */
+ public function validateGetSearchResultList();
+}
\ No newline at end of file
--- /dev/null
+<?php
+namespace wcf\data;
+
+/**
+ * Every database object action whose objects can be toggled 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 IToggleAction {
+ /**
+ * Toggles the "isDisabled" status of the relevant objects.
+ */
+ public function toggle();
+
+ /**
+ * Validates the "toggle" action.
+ */
+ public function validateToggle();
+}
<?php
namespace wcf\data\category;
use wcf\data\AbstractDatabaseObjectAction;
+use wcf\data\ICollapsibleContainerAction;
+use wcf\data\IPositionAction;
+use wcf\data\IToggleAction;
use wcf\system\category\CategoryHandler;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\exception\ValidateActionException;
* @subpackage data.category
* @category Community Framework
*/
-class CategoryAction extends AbstractDatabaseObjectAction {
+class CategoryAction extends AbstractDatabaseObjectAction implements ICollapsibleContainerAction, IPositionAction, IToggleAction {
/**
* categorized object type
* @var wcf\data\object\type\ObjectType
}
/**
- * Toggles the activity status of categories.
+ * @see wcf\data\IToggleAction::toggle()
*/
public function toggle() {
foreach ($this->objects as $categoryEditor) {
}
/**
- * Toggles the collapse status of categories.
+ * @see wcf\data\ICollapsibleContainerAction::toggleContainer()
*/
public function toggleContainer() {
$objectTypeID = UserCollapsibleContentHandler::getInstance()->getObjectTypeID($this->objects[0]->getCategoryType()->getCollapsibleObjectTypeName());
}
/**
- * Updates the position of categories.
+ * @see wcf\data\IPositionAction::updatePosition()
*/
public function updatePosition() {
$showOrders = array();
}
/**
- * Validates the 'toggle' action.
+ * @see wcf\data\IToggleAction::validateToggle()
*/
public function validateToggle() {
$this->validateUpdate();
}
/**
- * Validates the 'toggleContainer' action.
+ * @see wcf\data\ICollapsibleContainerAction::validateToggleContainer()
*/
public function validateToggleContainer() {
$this->validateUpdate();
}
/**
- * Validates the 'updatePosition' action.
+ * @see wcf\data\IPositionAction::validateUpdatePosition()
*/
public function validateUpdatePosition() {
// validate permissions
namespace wcf\data\cronjob;
use wcf\data\cronjob\log\CronjobLogEditor;
use wcf\data\AbstractDatabaseObjectAction;
+use wcf\data\IToggleAction;
use wcf\system\cronjob\CronjobScheduler;
use wcf\system\exception\ValidateActionException;
use wcf\system\WCF;
* @subpackage data.cronjob
* @category Community Framework
*/
-class CronjobAction extends AbstractDatabaseObjectAction {
+class CronjobAction extends AbstractDatabaseObjectAction implements IToggleAction {
/**
* @see wcf\data\AbstractDatabaseObjectAction::$className
*/
}
/**
- * Validates permissions and parameters
+ * @see wcf\data\IToggleAction::validateToggle()
*/
public function validateToggle() {
parent::validateUpdate();
}
/**
- * Toggles status.
+ * @see wcf\data\IToggleAction::toggle()
*/
public function toggle() {
foreach ($this->objects as $cronjob) {
<?php
namespace wcf\data\package\update\server;
use wcf\data\AbstractDatabaseObjectAction;
+use wcf\data\IToggleAction;
/**
* Executes package update server-related actions.
* @subpackage data.package.update.server
* @category Community Framework
*/
-class PackageUpdateServerAction extends AbstractDatabaseObjectAction {
+class PackageUpdateServerAction extends AbstractDatabaseObjectAction implements IToggleAction {
/**
* @see wcf\data\AbstractDatabaseObjectAction::$className
*/
protected $permissionsUpdate = array('admin.system.package.canEditServer');
/**
- * Validates permissions and parameters
+ * @see wcf\data\IToggleAction::validateToggle()
*/
public function validateToggle() {
parent::validateUpdate();
}
/**
- * Toggles status.
+ * @see wcf\data\IToggleAction::toggle()
*/
public function toggle() {
foreach ($this->objects as $server) {
namespace wcf\data\user;
use wcf\data\user\group\UserGroup;
use wcf\data\AbstractDatabaseObjectAction;
+use wcf\data\ISearchAction;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\exception\ValidateActionException;
* @subpackage data.user
* @category Community Framework
*/
-class UserAction extends AbstractDatabaseObjectAction {
+class UserAction extends AbstractDatabaseObjectAction implements ISearchAction {
/**
* @see wcf\data\AbstractDatabaseObjectAction::$className
*/
}
/**
- * Validates parameters to search for users and -groups.
+ * @see wcf\data\ISearchAction::validateGetSearchResultList()
*/
- public function validateGetList() {
+ public function validateGetSearchResultList() {
if (!isset($this->parameters['data']['searchString'])) {
throw new ValidateActionException("Missing parameter 'searchString'");
}
}
/**
- * Returns a list of users and -groups based upon given search criteria.
- *
- * @return array<array>
+ * @see wcf\data\ISearchAction::getSearchResultList()
*/
- public function getList() {
+ public function getSearchResultList() {
$searchString = $this->parameters['data']['searchString'];
$excludedSearchValues = array();
if (isset($this->parameters['data']['excludedSearchValues'])) {