From 1a8d655f806401201abf2528dce353a45b6ff966 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 5 Nov 2012 00:00:48 +0100 Subject: [PATCH] Added ability to remove application groups --- wcfsetup/install/files/acp/js/WCF.ACP.js | 59 +++++++++++++++++++ .../acp/templates/applicationManagement.tpl | 14 ++++- .../group/ApplicationGroupAction.class.php | 27 +++++++++ wcfsetup/install/lang/de.xml | 2 + 4 files changed, 101 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index 2b2fcdcce5..f8b33b61d5 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -11,6 +11,65 @@ */ WCF.ACP = {}; +/** + * Namespace for ACP application management. + */ +WCF.ACP.Application = { }; + +/** + * Namespace for ACP application group management. + */ +WCF.ACP.Application.Group = { }; + +/** + * Provides the ability to remove application groups. + */ +WCF.ACP.Application.Group.Delete = Class.extend({ + /** + * Initializes the WCF.ACP.Application.Group.Delete class. + */ + init: function() { + $('.jsDeleteApplicationGroup').click($.proxy(this._click, this)); + }, + + /** + * Shows a confirmation dialog to remove an application group. + * + * @param object event + */ + _click: function(event) { + var $button = $(event.currentTarget); + + WCF.System.Confirmation.show($button.data('confirmMessage'), $.proxy(function(action) { + if (action === 'confirm') { + this._remove($button.data('groupID')); + } + }, this)); + }, + + /** + * Removes an application group. + * + * @param integer groupID + */ + _remove: function(groupID) { + new WCF.Action.Proxy({ + autoSend: true, + data: { + actionName: 'delete', + className: 'wcf\\data\\application\\group\\ApplicationGroupAction', + objectIDs: [ groupID ] + }, + success: $.proxy(function(data, textStatus, jqXHR) { + var $notification = new WCF.System.Notification(WCF.Language.get('wcf.acp.application.group.delete.success')); + $notification.show(function() { + window.location.reload(); + }); + }, this) + }); + } +}); + /** * Handles ACPMenu. * diff --git a/wcfsetup/install/files/acp/templates/applicationManagement.tpl b/wcfsetup/install/files/acp/templates/applicationManagement.tpl index 31de66ab16..a0efef1c43 100644 --- a/wcfsetup/install/files/acp/templates/applicationManagement.tpl +++ b/wcfsetup/install/files/acp/templates/applicationManagement.tpl @@ -1,5 +1,17 @@ {include file='header' pageTitle='wcf.acp.application.management'} + + {foreach from=$applicationGroups item=applicationGroup}
@@ -42,7 +54,7 @@ diff --git a/wcfsetup/install/files/lib/data/application/group/ApplicationGroupAction.class.php b/wcfsetup/install/files/lib/data/application/group/ApplicationGroupAction.class.php index dba0c9ba3c..3db19655c1 100644 --- a/wcfsetup/install/files/lib/data/application/group/ApplicationGroupAction.class.php +++ b/wcfsetup/install/files/lib/data/application/group/ApplicationGroupAction.class.php @@ -1,6 +1,7 @@ objects as $applicationGroup) { + $groupIDs[] = $applicationGroup->groupID; + } + + // read all applications associated by affected groups + $applicationList = new ApplicationList(); + $applicationList->getConditionBuilder()->add("application.groupID IN (?)", array($groupIDs)); + $applicationList->sqlLimit = 0; + $applicationList->readObjects(); + + $applicationAction = new ApplicationAction($applicationList->getObjects(), 'ungroup'); + $applicationAction->executeAction(); + + return parent::delete(); + } } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index ef85012233..83fab5c3bf 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -27,6 +27,8 @@ + groupName}“ wirklich löschen?]]> + -- 2.20.1