From 119ff89a509eaedb836fda860f49f584eac4434d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Sat, 1 Jun 2013 19:22:08 +0200 Subject: [PATCH] Add application filter to TemplateListPage Closes #1314 --- .../files/acp/templates/templateList.tpl | 12 +++++++++ .../lib/acp/page/TemplateListPage.class.php | 27 ++++++++++++++++++- wcfsetup/install/lang/de.xml | 2 ++ wcfsetup/install/lang/en.xml | 2 ++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/acp/templates/templateList.tpl b/wcfsetup/install/files/acp/templates/templateList.tpl index 88048c4453..a5dfec5eb4 100644 --- a/wcfsetup/install/files/acp/templates/templateList.tpl +++ b/wcfsetup/install/files/acp/templates/templateList.tpl @@ -29,6 +29,18 @@ +
+
+
+ +
+
+
diff --git a/wcfsetup/install/files/lib/acp/page/TemplateListPage.class.php b/wcfsetup/install/files/lib/acp/page/TemplateListPage.class.php index f99d46f162..484fa6e4b1 100644 --- a/wcfsetup/install/files/lib/acp/page/TemplateListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/TemplateListPage.class.php @@ -1,7 +1,9 @@ templateGroupID = intval($_REQUEST['templateGroupID']); if (isset($_REQUEST['searchTemplateName'])) $this->searchTemplateName = StringUtil::trim($_REQUEST['searchTemplateName']); + if (isset($_REQUEST['application'])) $this->application = StringUtil::trim($_REQUEST['application']); } /** @@ -84,6 +99,7 @@ class TemplateListPage extends SortablePage { else $this->objectList->getConditionBuilder()->add('template.templateGroupID IS NULL'); if ($this->searchTemplateName) $this->objectList->getConditionBuilder()->add('templateName LIKE ?', array($this->searchTemplateName.'%')); + if ($this->application) $this->objectList->getConditionBuilder()->add('application = ?', array($this->application)); } /** @@ -96,6 +112,13 @@ class TemplateListPage extends SortablePage { $templateGroupList = new TemplateGroupList(); $templateGroupList->readObjects(); $this->availableTemplateGroups = $templateGroupList->getObjects(); + + // get applications + $applications = ApplicationHandler::getInstance()->getApplications(); + foreach ($applications as $application) { + $package = PackageCache::getInstance()->getPackage($application->packageID); + $this->availableApplications[ApplicationHandler::getInstance()->getAbbreviation($package->packageID)] = $package; + } } /** @@ -107,7 +130,9 @@ class TemplateListPage extends SortablePage { WCF::getTPL()->assign(array( 'templateGroupID' => $this->templateGroupID, 'searchTemplateName' => $this->searchTemplateName, - 'availableTemplateGroups' => $this->availableTemplateGroups + 'application' => $this->application, + 'availableTemplateGroups' => $this->availableTemplateGroups, + 'availableApplications' => $this->availableApplications )); } } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 03aa3baca9..7448ac5ca0 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -1064,6 +1064,8 @@ + + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 2b7640e92d..c2d37a5230 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -1063,6 +1063,8 @@ Examples for medium ID detection: + + -- 2.20.1