From a3b7ac33fc3b34b5d9ce58070619e8cbc837c891 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 6 Apr 2015 00:00:31 +0200 Subject: [PATCH] Used sendGenericGetResponse() from latest 'core' commit. Signed-off-by: Roland Haeder --- application/city/class_ApplicationHelper.php | 2 +- application/city/config.php | 16 ++++- .../html/class_CityHtmlHomeCommand.php | 64 +++---------------- .../html/class_CityHtmlControllerResolver.php | 2 +- core | 2 +- 5 files changed, 27 insertions(+), 59 deletions(-) diff --git a/application/city/class_ApplicationHelper.php b/application/city/class_ApplicationHelper.php index da8b31b..943b3d8 100644 --- a/application/city/class_ApplicationHelper.php +++ b/application/city/class_ApplicationHelper.php @@ -177,7 +177,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica $this->setResponseInstance($responseInstance); // Get the parameter from the request - $commandName = $requestInstance->getRequestElement('command'); + $commandName = $requestInstance->getRequestElement('page'); // If it is null then get default command if (is_null($commandName)) { diff --git a/application/city/config.php b/application/city/config.php index 580273e..4c1275b 100644 --- a/application/city/config.php +++ b/application/city/config.php @@ -50,15 +50,27 @@ $cfg->setConfigEntry('city_init_state_class', 'CityInitState'); * HTML client * ******************************************************************************/ +// CFG: DEFAULT-HTML-COMMAND +$cfg->setConfigEntry('default_html_command', 'home'); + // CFG: DEFAULT-CITY-HTML-COMMAND $cfg->setConfigEntry('default_city_html_command', 'home'); -// CFG: CITY-HTML-CMD-HOME-RESOLVER-CLASS -$cfg->setConfigEntry('city_html_cmd_home_resolver_class', 'CityHtmlCommandResolver'); +// CFG: HTML-CMD-HOME-RESOLVER-CLASS +$cfg->setConfigEntry('html_cmd_home_resolver_class', 'CityHtmlCommandResolver'); + +// CFG: HTML-CMD-REGISTER-RESOLVER-CLASS +$cfg->setConfigEntry('html_cmd_register_resolver_class', 'CityHtmlCommandResolver'); + +// CFG: NEWS-READER-REGISTER-CLASS +$cfg->setConfigEntry('news_reader_register_class', 'DefaultNewsReader'); // CFG: NEWS-HOME-LIMIT $cfg->setConfigEntry('news_home_limit', 10); +// CFG: NEWS-REGISTER-LIMIT +$cfg->setConfigEntry('news_register_limit', 5); + // CFG: CITY-HOME-MENU-CLASS $cfg->setConfigEntry('city_home_menu_class', 'CityHomeMenu'); diff --git a/application/city/main/commands/html/class_CityHtmlHomeCommand.php b/application/city/main/commands/html/class_CityHtmlHomeCommand.php index de1ad29..8a7ef60 100644 --- a/application/city/main/commands/html/class_CityHtmlHomeCommand.php +++ b/application/city/main/commands/html/class_CityHtmlHomeCommand.php @@ -55,66 +55,22 @@ class CityHtmlHomeCommand extends BaseCommand implements Commandable { * @param $requestInstance An instance of a class with an Requestable interface * @param $responseInstance An instance of a class with an Responseable interface * @return void - * @todo ~10% done? */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Get the application instance - $applicationInstance = $this->getResolverInstance()->getApplicationInstance(); + // This command doesn't handle any POST requests, so only handle get request + if ($requestInstance->isPostRequestMethod()) { + // Don't handle this here + $response->sendRequestMethodNotAllowed(); - // Prepare a template instance - $templateInstance = $this->prepareTemplateInstance($applicationInstance); - - // Transfer application data - $templateInstance->assignApplicationData($applicationInstance); - - // Load the master template - $masterTemplate = $applicationInstance->buildMasterTemplateName(); - - // Load header template - $templateInstance->loadCodeTemplate('header'); - - // Compile and assign it with a variable - $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable('header', 'header'); - - // Load footer template - $templateInstance->loadCodeTemplate('footer'); - - // Compile and assign it with a variable - $templateInstance->compileTemplate(); - $templateInstance->assignTemplateWithVariable('footer', 'footer'); - - // Load the home template - $templateInstance->loadCodeTemplate('home'); - - // Assign the home template with the master template as a content ... ;) - $templateInstance->assignTemplateWithVariable('city_home', 'main_content'); - - // Load the master template - $templateInstance->loadCodeTemplate($masterTemplate); - - // Set title - $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_city_home_title')); - - // Construct the menu in every command. We could do this in BaseCommand class. But this means - // *every* command has a navigation system and that is want we don't want. - $menuInstance = ObjectFactory::createObjectByConfiguredName('city_home_menu_class', array($applicationInstance)); - - // Render the menu - $menuInstance->renderMenu(); - - // Transfer it to the template engine instance - $menuInstance->transferContentToTemplateEngine($templateInstance); + // Bail out + exit(); + } // END - if /* - * ... and all variables. This should be merged together in a pattern - * to make things easier. A cache mechanism should be added between - * these two calls to cache compiled templates. + * This is a generic HTML request, this means that a regular page with + * header, menu, content and footer shall be send to the client. */ - $templateInstance->compileVariables(); - - // Get the content back from the template engine and put it in response class - $templateInstance->transferToResponse($responseInstance); + $this->sendGenericGetResponse($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 d390856..8611b80 100644 --- a/application/city/main/resolver/controller/html/class_CityHtmlControllerResolver.php +++ b/application/city/main/resolver/controller/html/class_CityHtmlControllerResolver.php @@ -32,7 +32,7 @@ class CityHtmlControllerResolver extends BaseControllerResolver implements Contr parent::__construct(__CLASS__); // Set prefix to 'Html' - $this->setClassPrefix('city_html'); + $this->setClassPrefix('html'); } /** diff --git a/core b/core index 64959d4..261df39 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 64959d4352a0cc846da9951bb12f6ba86d3dab58 +Subproject commit 261df392e4c7aea59ce5be06f7b070db37d9da63 -- 2.39.5