*/
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.
*
{include file='header' pageTitle='wcf.acp.application.management'}
+<script type="text/javascript">
+ //<![CDATA[
+ $(function() {
+ new WCF.ACP.Application.Group.Delete();
+
+ WCF.Language.addObject({
+ 'wcf.acp.application.group.delete.success': '{lang}wcf.acp.application.group.delete.success{/lang}'
+ });
+ });
+ //]]>
+</script>
+
{foreach from=$applicationGroups item=applicationGroup}
<header class="boxHeadline">
<hgroup>
<nav>
<ul>
<li><a href="{link controller='ApplicationGroupEdit' id=$applicationGroup->groupID}{/link}" class="button"><img src="{@RELATIVE_WCF_DIR}icon/edit.svg" class="icon24" /> <span>{lang}wcf.acp.application.group.edit{/lang}</span></a></li>
- <li><a href="{link controller='ApplicationGroupDelete' id=$applicationGroup->groupID}{/link}" class="button"><img src="{@RELATIVE_WCF_DIR}icon/delete.svg" class="icon24" /> <span>{lang}wcf.acp.application.group.delete{/lang}</span></a></li>
+ <li><a class="button jsDeleteApplicationGroup" data-confirm-message="{lang}wcf.acp.application.group.delete.confirmMessage{/lang}" data-group-id="{@$applicationGroup->groupID}"><img src="{@RELATIVE_WCF_DIR}icon/delete.svg" class="icon24" /> <span>{lang}wcf.acp.application.group.delete{/lang}</span></a></li>
</ul>
</nav>
</div>
<?php
namespace wcf\data\application\group;
use wcf\data\application\ApplicationAction;
+use wcf\data\application\ApplicationList;
use wcf\data\AbstractDatabaseObjectAction;
/**
*/
protected $className = 'wcf\data\application\group\ApplicationGroupEditor';
+ /**
+ * @see wcf\data\AbstractDatabaseObjectAction::$permissionsDelete
+ */
+ protected $permissionsDelete = array('admin.system.canManageApplication');
+
/**
* @see wcf\data\AbstractDatabaseObjectAction::create()
*/
return $applicationGroup;
}
+
+ /**
+ * @see wcf\data\AbstractDatabaseObjectAction::delete()
+ */
+ public function delete() {
+ $groupIDs = array();
+ foreach ($this->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();
+ }
}
<item name="wcf.acp.application.group.availableApplications"><![CDATA[Verfügbare Anwendungen]]></item>
<item name="wcf.acp.application.group.data"><![CDATA[Allgemein]]></item>
<item name="wcf.acp.application.group.delete"><![CDATA[Anwendungsgruppe löschen]]></item>
+ <item name="wcf.acp.application.group.delete.confirmMessage"><![CDATA[Wollen Sie die Anwendungsgruppe „{$applicationGroup->groupName}“ wirklich löschen?]]></item>
+ <item name="wcf.acp.application.group.delete.success"><![CDATA[Anwendungsgruppe erfolgreich gelöscht]]></item>
<item name="wcf.acp.application.group.edit"><![CDATA[Anwendungsgruppe bearbeiten]]></item>
<item name="wcf.acp.application.group.groupName"><![CDATA[Name]]></item>
<item name="wcf.acp.application.group.groupName.error.notUnique"><![CDATA[Der Gruppenname muss einzigartig sein.]]></item>