</nav>
</div>
-<div class="container containerPadding marginTop">
- <form method="post" action="{if $action == 'add'}{link controller='ApplicationGroupAdd'}{/link}{else}{link controller='ApplicationGroupEdit' id=$applicationGroup->groupID}{/link}{/if}">
- <fieldset>
- <legend>{lang}wcf.acp.application.group.data{/lang}</legend>
- <dl{if $errorField == 'groupName'} class="formError"{/if}>
- <dt><label for="groupName">{lang}wcf.acp.application.group.groupName{/lang}</label></dt>
- <dd>
- <input type="text" name="groupName" id="groupName" value="{$groupName}" class="long" required="required" />
- {if $errorField == 'groupName'}
- <small class="innerError">
- {if $errorType == 'empty'}
- {lang}wcf.global.form.error.empty{/lang}
- {else}
- {lang}wcf.acp.application.group.groupName.error.{$errorType}{/lang}
- {/if}
- </small>
- {/if}
- </dd>
- </dl>
- </fieldset>
-
- <fieldset{if $errorField == 'applications'} class="formError"{/if}>
- <legend>{lang}wcf.acp.application.group.availableApplications{/lang}</legend>
+{if $availableApplications|count > 1}
+ <div class="container containerPadding marginTop">
+ <form method="post" action="{if $action == 'add'}{link controller='ApplicationGroupAdd'}{/link}{else}{link controller='ApplicationGroupEdit' id=$applicationGroup->groupID}{/link}{/if}">
+ <fieldset>
+ <legend>{lang}wcf.acp.application.group.data{/lang}</legend>
+
+ <dl{if $errorField == 'groupName'} class="formError"{/if}>
+ <dt><label for="groupName">{lang}wcf.acp.application.group.groupName{/lang}</label></dt>
+ <dd>
+ <input type="text" name="groupName" id="groupName" value="{$groupName}" class="long" required="required" />
+ {if $errorField == 'groupName'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.application.group.groupName.error.{$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ </dd>
+ </dl>
+ </fieldset>
- {if $availableApplications|count > 1}
+ <fieldset{if $errorField == 'applications'} class="formError"{/if}>
+ <legend>{lang}wcf.acp.application.group.availableApplications{/lang}</legend>
+
<div class="tabularBox">
<table class="table">
<thead>
{/if}
</small>
{/if}
- {else}
- <p class="info">{lang}wcf.acp.application.group.noAvailableApplications{/lang}</p>
- {/if}
- </fieldset>
-
- <div class="formSubmit">
- <input type="submit" value="{lang}wcf.global.button.submit{/lang}" />
- </div>
- </form>
-</div>
-
-<div class="contentNavigation">
- <nav>
- <ul>
- <li><a href="{link controller='ApplicationManagement'}{/link}" class="button"><img src="{@RELATIVE_WCF_DIR}icon/list.svg" alt="" /> <span>{lang}wcf.acp.application.management{/lang}</span></a></li>
- </ul>
- </nav>
-</div>
+ </fieldset>
+
+ <div class="formSubmit">
+ <input type="submit" value="{lang}wcf.global.button.submit{/lang}" />
+ </div>
+ </form>
+ </div>
+
+ <div class="contentNavigation">
+ <nav>
+ <ul>
+ <li><a href="{link controller='ApplicationManagement'}{/link}" class="button"><img src="{@RELATIVE_WCF_DIR}icon/list.svg" alt="" /> <span>{lang}wcf.acp.application.management{/lang}</span></a></li>
+ </ul>
+ </nav>
+ </div>
+{else}
+ <p class="error">{lang}wcf.acp.application.group.noAvailableApplications{/lang}</p>
+{/if}
{include file='footer'}
use wcf\data\application\ViewableApplicationList;
use wcf\data\application\group\ApplicationGroupAction;
use wcf\system\exception\UserInputException;
+use wcf\system\request\LinkHandler;
use wcf\system\WCF;
use wcf\util\ArrayUtil;
+use wcf\util\HeaderUtil;
use wcf\util\StringUtil;
/**
// reload available applications
$this->readAvailableApplications();
- // show success.
+ if (count($this->availableApplications) <= 1) {
+ HeaderUtil::redirect(LinkHandler::getInstance()->getLink('ApplicationManagement'));
+ }
+
+ // show success
WCF::getTPL()->assign(array(
'success' => true
));
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage acp.page
- * @category Community Framework
+ * @category Community Framework
*/
class ApplicationManagementPage extends AbstractPage {
/**
*/
public $applicationGroups = null;
+ /**
+ * indicates if an application group can be created
+ * @var boolean
+ */
+ public $canAddApplicationGroup = true;
+
/**
* number of ungrouped applications
* @var integer
*/
public $ungroupedApplications = 0;
+ /**
+ * @see wcf\page\AbstractPage::$neededPermissions
+ */
+ public $neededPermissions = array('admin.system.canManageApplication');
+
/**
* @see wcf\page\IPage::readData()
*/
$this->applicationGroups[$application->groupID]->addApplication($application);
}
}
+
+ $this->canAddApplicationGroup = count($applicationList) > 1 && count($this->applications) > 0;
}
/**
WCF::getTPL()->assign(array(
'applications' => $this->applications,
- 'applicationGroups' => $this->applicationGroups
+ 'applicationGroups' => $this->applicationGroups,
+ 'canAddApplicationGroup' => $this->canAddApplicationGroup
));
}
public function show() {
// enable menu item
ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.application.management');
-
+
parent::show();
}
}