From: Alexander Ebert Date: Sun, 4 Nov 2012 20:44:05 +0000 (+0100) Subject: Improved application management X-Git-Tag: 2.0.0_Beta_1~818^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b8c711fbfea0f6ece1a83e752b6bef9f5fbbfcc2;p=GitHub%2FWoltLab%2FWCF.git Improved application management --- diff --git a/wcfsetup/install/files/acp/templates/applicationGroupAdd.tpl b/wcfsetup/install/files/acp/templates/applicationGroupAdd.tpl index 873adf73ef..19276694c2 100644 --- a/wcfsetup/install/files/acp/templates/applicationGroupAdd.tpl +++ b/wcfsetup/install/files/acp/templates/applicationGroupAdd.tpl @@ -46,47 +46,52 @@ {lang}wcf.acp.application.group.availableApplications{/lang} -
- - - - - - - - - - - {event name='headColumns'} - - - - - {foreach from=$availableApplications item=application} - - - - - - - - + {if $availableApplications|count > 1} +
+
{lang}wcf.global.objectID{/lang}{lang}wcf.acp.package.name{/lang}{lang}wcf.acp.application.domainName{/lang}{lang}wcf.acp.application.domainPath{/lang}{lang}wcf.acp.application.cookieDomain{/lang}{lang}wcf.acp.application.cookiePath{/lang}
{#$application->packageID}{lang}{$application->packageName}{/lang}{$application->domainName}{$application->domainPath}{$application->cookieDomain}{$application->cookiePath}
+ + + + + + + + - {event name='columns'} + {event name='headColumns'} - {/foreach} - -
{lang}wcf.global.objectID{/lang}{lang}wcf.acp.package.name{/lang}{lang}wcf.acp.application.domainName{/lang}{lang}wcf.acp.application.domainPath{/lang}{lang}wcf.acp.application.cookieDomain{/lang}{lang}wcf.acp.application.cookiePath{/lang}
-
- - {if $errorField == 'applications'} - - {if $errorType == 'empty'} - {lang}wcf.global.form.error.empty{/lang} - {else} - {lang}wcf.acp.application.group.applications.error.{$errorType}{/lang} - {/if} - + + + + {foreach from=$availableApplications item=application} + + packageID|in_array:$applications} checked="checked"{/if} /> + + {#$application->packageID} + {lang}{$application->getPackage()->getName()}{/lang} + {$application->domainName} + {$application->domainPath} + {$application->cookieDomain} + {$application->cookiePath} + + {event name='columns'} + + {/foreach} + + + + + {if $errorField == 'applications'} + + {if $errorType == 'empty'} + {lang}wcf.global.form.error.empty{/lang} + {else} + {lang}wcf.acp.application.group.applications.error.{$errorType}{/lang} + {/if} + + {/if} + {else} +

{lang}wcf.acp.application.group.noAvailableApplications{/lang}

{/if} diff --git a/wcfsetup/install/files/acp/templates/applicationManagement.tpl b/wcfsetup/install/files/acp/templates/applicationManagement.tpl index 01d78b3e7a..31de66ab16 100644 --- a/wcfsetup/install/files/acp/templates/applicationManagement.tpl +++ b/wcfsetup/install/files/acp/templates/applicationManagement.tpl @@ -27,7 +27,7 @@ {#$application->packageID} - {lang}{$application->packageName}{/lang} + {lang}{$application->getPackage()->getName()}{/lang} {$application->domainName} {$application->domainPath} {$application->cookieDomain} @@ -76,7 +76,7 @@ {#$application->packageID} - {lang}{$application->packageName}{/lang} + {lang}{$application->getPackage()->getName()}{/lang} {$application->domainName} {$application->domainPath} {$application->cookieDomain} diff --git a/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php b/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php index 0ee6b20e3b..cf0303f159 100644 --- a/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php @@ -2,6 +2,7 @@ namespace wcf\acp\form; use wcf\data\application\Application; use wcf\data\application\ApplicationAction; +use wcf\data\application\ViewableApplication; use wcf\system\exception\IllegalLinkException; use wcf\system\exception\UserInputException; use wcf\system\Regex; @@ -26,8 +27,8 @@ class ApplicationEditForm extends ACPForm { public $activeMenuItem = 'wcf.acp.menu.link.application'; /** - * application object - * @var wcf\data\application\Application + * viewable application object + * @var wcf\data\application\ViewableApplication */ public $application = null; @@ -78,7 +79,7 @@ class ApplicationEditForm extends ACPForm { parent::readParameters(); if (isset($_REQUEST['id'])) $this->packageID = intval($_REQUEST['id']); - $this->application = new Application($this->packageID); + $this->application = new ViewableApplication(new Application($this->packageID)); if (!$this->application->packageID) { throw new IllegalLinkException(); } @@ -167,7 +168,7 @@ class ApplicationEditForm extends ACPForm { parent::save(); // save application - $this->objectAction = new ApplicationAction(array($this->application), 'update', array('data' => array( + $this->objectAction = new ApplicationAction(array($this->application->getDecoratedObject()), 'update', array('data' => array( 'cookieDomain' => $this->cookieDomain, 'cookiePath' => $this->cookiePath, 'domainName' => $this->domainName, diff --git a/wcfsetup/install/files/lib/acp/form/ApplicationGroupAddForm.class.php b/wcfsetup/install/files/lib/acp/form/ApplicationGroupAddForm.class.php index 749e38f298..762c53c1cc 100644 --- a/wcfsetup/install/files/lib/acp/form/ApplicationGroupAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/ApplicationGroupAddForm.class.php @@ -1,6 +1,6 @@ + * @var array */ public $availableApplications = array(); @@ -59,11 +59,8 @@ class ApplicationGroupAddForm extends ACPForm { * Reads the list of available applications. */ protected function readAvailableApplications() { - $applicationList = new ApplicationList(); - $applicationList->sqlSelects = "package.package, package.packageName"; - $applicationList->sqlJoins = "LEFT JOIN wcf".WCF_N."_package package ON (package.packageID = application.packageID)"; + $applicationList = new ViewableApplicationList(); $applicationList->getConditionBuilder()->add("application.groupID IS NULL"); - $applicationList->getConditionBuilder()->add("application.packageID <> ? ", array(1)); $applicationList->sqlLimit = 0; $applicationList->readObjects(); @@ -125,11 +122,11 @@ class ApplicationGroupAddForm extends ACPForm { $application = $this->availableApplications[$packageID]; // cannot group two or more applications of the same type - if (in_array($application->package, $packages)) { + if (in_array($application->getPackage()->package, $packages)) { throw new UserInputException('applications', 'duplicate'); } - $packages[] = $application->package; + $packages[] = $application->getPackage()->package; } } } @@ -154,6 +151,9 @@ class ApplicationGroupAddForm extends ACPForm { $this->applications = array(); $this->groupName = ''; + // reload available applications + $this->readAvailableApplications(); + // show success. WCF::getTPL()->assign(array( 'success' => true diff --git a/wcfsetup/install/files/lib/acp/page/ApplicationManagementPage.class.php b/wcfsetup/install/files/lib/acp/page/ApplicationManagementPage.class.php index a4a40703c7..d3e0dbe750 100644 --- a/wcfsetup/install/files/lib/acp/page/ApplicationManagementPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/ApplicationManagementPage.class.php @@ -1,6 +1,6 @@ sqlSelects = "package.packageName"; - $applicationList->sqlJoins = "LEFT JOIN wcf".WCF_N."_package package ON (package.packageID = application.packageID)"; - $applicationList->getConditionBuilder()->add("application.packageID <> ?", array(1)); // exclude WCF pseudo-application + $applicationList = new ViewableApplicationList(); $applicationList->sqlLimit = 0; $applicationList->readObjects(); diff --git a/wcfsetup/install/files/lib/data/application/ViewableApplication.class.php b/wcfsetup/install/files/lib/data/application/ViewableApplication.class.php new file mode 100644 index 0000000000..0a6981de98 --- /dev/null +++ b/wcfsetup/install/files/lib/data/application/ViewableApplication.class.php @@ -0,0 +1,40 @@ + + * @package com.woltlab.wcf + * @subpackage data.application + * @category Community Framework + */ +class ViewableApplication extends DatabaseObjectDecorator { + /** + * @see wcf\data\DatabaseObjectDecorator::$baseClass + */ + protected static $baseClass = 'wcf\data\application\Application'; + + /** + * package object + * @var wcf\data\package\Package + */ + protected $package = null; + + /** + * Returns package object. + * + * @return wcf\data\package\Package + */ + public function getPackage() { + if ($this->package === null) { + $this->package = PackageCache::getInstance()->getPackage($this->packageID); + } + + return $this->package; + } +} diff --git a/wcfsetup/install/files/lib/data/application/ViewableApplicationList.class.php b/wcfsetup/install/files/lib/data/application/ViewableApplicationList.class.php new file mode 100644 index 0000000000..b62671688f --- /dev/null +++ b/wcfsetup/install/files/lib/data/application/ViewableApplicationList.class.php @@ -0,0 +1,37 @@ + + * @package com.woltlab.wcf + * @subpackage data.application + * @category Community Framework + */ +class ViewableApplicationList extends ApplicationList { + /** + * @see wcf\data\DatabaseObjectList::__construct() + */ + public function __construct() { + parent::__construct(); + + // exclude WCF pseudo-application + $this->getConditionBuilder()->add("application.packageID <> ?", array(1)); + } + + /** + * @see wcf\data\DatabaseObjectList::readObjects() + */ + public function readObjects() { + parent::readObjects(); + + foreach ($this->objects as &$application) { + $application = new ViewableApplication($application); + } + unset($application); + } +} diff --git a/wcfsetup/install/files/lib/data/application/group/ViewableApplicationGroup.class.php b/wcfsetup/install/files/lib/data/application/group/ViewableApplicationGroup.class.php index d7b7a79d27..06633f0931 100644 --- a/wcfsetup/install/files/lib/data/application/group/ViewableApplicationGroup.class.php +++ b/wcfsetup/install/files/lib/data/application/group/ViewableApplicationGroup.class.php @@ -1,6 +1,6 @@ + * list of viewable applications + * @var array */ protected $applications = array(); @@ -34,9 +34,9 @@ class ViewableApplicationGroup extends DatabaseObjectDecorator implements \Count /** * Assigns an application to this group. * - * @param wcf\data\application\Application $application + * @param wcf\data\application\ViewableApplication $application */ - public function addApplication(Application $application) { + public function addApplication(ViewableApplication $application) { if ($this->groupID == $application->groupID) { $this->applications[] = $application; } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 5a0e2b0fcd..ef85012233 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -19,7 +19,7 @@ - + packageID}{/link}">{$application->getPackage()->getName()}“]]> @@ -30,6 +30,7 @@ + groupName}“]]>