From 75b61861b2a5642c3e51bc8169a0119c1317af53 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 6 Apr 2015 02:08:38 +0200 Subject: [PATCH] More fixes for HTML and console (daemon) + updated 'core'. Signed-off-by: Roland Haeder --- application/city/class_ApplicationHelper.php | 11 ++++- application/city/config.php | 14 ++++-- .../class_CityHtmlDefaultNewsController.php | 43 +------------------ .../html/class_CityHtmlControllerResolver.php | 4 +- core | 2 +- 5 files changed, 25 insertions(+), 49 deletions(-) diff --git a/application/city/class_ApplicationHelper.php b/application/city/class_ApplicationHelper.php index 943b3d8..fc1a3c9 100644 --- a/application/city/class_ApplicationHelper.php +++ b/application/city/class_ApplicationHelper.php @@ -184,8 +184,17 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica // Get default command $commandName = $responseInstance->getDefaultCommand(); + // Default is 'page' + $element = 'page'; + + // Is the request type console? + if ($responseType === 'console') { + // Console applications have only commands + $element = 'command'; + } // END - if + // Set it in request - $requestInstance->setRequestElement('command', $commandName); + $requestInstance->setRequestElement($element, $commandName); } // END - if // Get a controller resolver diff --git a/application/city/config.php b/application/city/config.php index 4c1275b..779e6fb 100644 --- a/application/city/config.php +++ b/application/city/config.php @@ -56,11 +56,11 @@ $cfg->setConfigEntry('default_html_command', 'home'); // CFG: DEFAULT-CITY-HTML-COMMAND $cfg->setConfigEntry('default_city_html_command', 'home'); -// CFG: HTML-CMD-HOME-RESOLVER-CLASS -$cfg->setConfigEntry('html_cmd_home_resolver_class', 'CityHtmlCommandResolver'); +// CFG: CITY-HTML-CMD-HOME-RESOLVER-CLASS +$cfg->setConfigEntry('city_html_cmd_home_resolver_class', 'CityHtmlCommandResolver'); -// CFG: HTML-CMD-REGISTER-RESOLVER-CLASS -$cfg->setConfigEntry('html_cmd_register_resolver_class', 'CityHtmlCommandResolver'); +// CFG: CITY-HTML-CMD-REGISTER-RESOLVER-CLASS +$cfg->setConfigEntry('city_html_cmd_register_resolver_class', 'CityHtmlCommandResolver'); // CFG: NEWS-READER-REGISTER-CLASS $cfg->setConfigEntry('news_reader_register_class', 'DefaultNewsReader'); @@ -84,6 +84,9 @@ $cfg->setConfigEntry('menu_template_extension', '.xml'); * Console client * ******************************************************************************/ +// CFG: DEFAULT-CONSOLE-COMMAND +$cfg->setConfigEntry('default_console_command', 'daemon'); + // CFG: DEFAULT-CITY-CONSOLE-COMMAND $cfg->setConfigEntry('default_city_console_command', 'daemon'); @@ -108,6 +111,9 @@ $cfg->setConfigEntry('city_shutdown_task_handler_filter', 'CityShutdownTaskHandl // CFG: CITY-SHUTDOWN-CITY-FILTER $cfg->setConfigEntry('city_shutdown_city_filter', 'CityShutdownCityFilter'); +// CFG: NEWS-READER-DAEMON-CLASS +$cfg->setConfigEntry('news_reader_daemon_class', 'ConsoleNewsReader'); + // CFG: NEWS-DAEMON-LIMIT $cfg->setConfigEntry('news_daemon_limit', 5); diff --git a/application/city/main/controller/html/class_CityHtmlDefaultNewsController.php b/application/city/main/controller/html/class_CityHtmlDefaultNewsController.php index 63071a9..9ec4914 100644 --- a/application/city/main/controller/html/class_CityHtmlDefaultNewsController.php +++ b/application/city/main/controller/html/class_CityHtmlDefaultNewsController.php @@ -66,47 +66,8 @@ class CityHtmlDefaultNewsController extends BaseController implements Controller * @return void */ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { - // Get the command instance from the resolver by sending a request instance to the resolver - $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); - - // Add more filters by the command - $commandInstance->addExtraFilters($this, $requestInstance); - - // Run the pre filters - $this->executePreFilters($requestInstance, $responseInstance); - - // This request was valid! :-D - $requestInstance->requestIsValid(); - - // Execute the command - $commandInstance->execute($requestInstance, $responseInstance); - - // Run the pre filters - $this->executePostFilters($requestInstance, $responseInstance); - - // Flush the response out - $responseInstance->flushBuffer(); - } - - /** - * Add a shutdown filter - * - * @param $filterInstance A Filterable class - * @return void - */ - public function addShutdownFilter (Filterable $filterInstance) { - $this->addFilter('shutdown', $filterInstance); - } - - /** - * Executes all shutdown filters - * - * @param $requestInstance A Requestable class - * @param $responseInstance A Responseable class - * @return void - */ - public function executeShutdownFilters (Requestable $requestInstance, Responseable $responseInstance) { - $this->executeFilters('shutdown', $requestInstance, $responseInstance); + // Generic pre-post command execution + $this->executeGenericPrePostCommand($requestInstance, $responseInstance); } } diff --git a/application/city/main/resolver/controller/html/class_CityHtmlControllerResolver.php b/application/city/main/resolver/controller/html/class_CityHtmlControllerResolver.php index 8611b80..4164595 100644 --- a/application/city/main/resolver/controller/html/class_CityHtmlControllerResolver.php +++ b/application/city/main/resolver/controller/html/class_CityHtmlControllerResolver.php @@ -31,8 +31,8 @@ class CityHtmlControllerResolver extends BaseControllerResolver implements Contr // Call parent constructor parent::__construct(__CLASS__); - // Set prefix to 'Html' - $this->setClassPrefix('html'); + // Set prefix to 'city_html' + $this->setClassPrefix('city_html'); } /** diff --git a/core b/core index 64d9752..b06a104 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 64d9752d26925eb4389f478362e84e77dee6057a +Subproject commit b06a10407c5515a96a2905f4cfffa5894d2862dc -- 2.39.5