search within the hub network.
Signed-off-by: Roland Haeder <roland@mxchange.org>
$requestInstance->setRequestElement('command', $commandName);
} // END - if
+ // Is the responseType 'html' ?
+ if ($responseType == 'html') {
+ // The language system is needed for this
+ $languageInstance = ObjectFactory::createObjectByConfiguredName('language_system_class');
+
+ // And set it here
+ $this->setLanguageInstance($languageInstance);
+ } // END - if
+
// Get a controller resolver
$resolverClass = self::convertToClassName($this->getAppShortName() . '_' . $responseType . '_controller_resolver');
$resolverInstance = ObjectFactory::createObjectByName($resolverClass, array($commandName, $this));
// Launch the hub main routine here
$this->getControllerInstance()->handleRequest($requestInstance, $responseInstance);
- // -------------------------- Shutdown phase --------------------------
- // Shutting down the hub by saying "good bye" to all connected peers
- // and other hubs, flushing all queues and caches.
- self::createDebugInstance(__CLASS__)->debugOutput('MAIN: Shutdown in progress, main loop exited.');
- $this->getControllerInstance()->executeShutdownFilters($requestInstance, $responseInstance);
- self::createDebugInstance(__CLASS__)->debugOutput('MAIN: Shutdown completed. (This is the last line.)');
+ // Only for console requests as this is the actual daemon
+ if ($responseType == 'console') {
+ // -------------------------- Shutdown phase --------------------------
+ // Shutting down the hub by saying "good bye" to all connected peers
+ // and other hubs, flushing all queues and caches.
+ self::createDebugInstance(__CLASS__)->debugOutput('MAIN: Shutdown in progress, main loop exited.');
+ $this->getControllerInstance()->executeShutdownFilters($requestInstance, $responseInstance);
+ self::createDebugInstance(__CLASS__)->debugOutput('MAIN: Shutdown completed. (This is the last line.)');
+ } // END - if
}
/**
// CFG: DHT-PUBLISH-TEMPLATE-TYPE
$cfg->setConfigEntry('node_dht_publish_template_type', 'xml/dht_publish');
-// CFG: CODE-TEMPLATE-TYPE
-$cfg->setConfigEntry('code_template_type', 'xml');
-
// CFG: RAW-TEMPLATE-EXTENSION (to speed-up things)
$cfg->setConfigEntry('raw_template_extension', '.xml');
// CFG: CRAWLER-URL-LIST-COLUMN-SEPARATOR
$cfg->setConfigEntry('crawler_url_list_column_separator', ',');
-///////////////////////////////////////////////////////////////////////////////
-// HTTP Configuration
-///////////////////////////////////////////////////////////////////////////////
-
-// CFG: DEFAULT-WEB-COMMAND
-$cfg->setConfigEntry('default_web_command', 'home');
-
-// CFG: WEB-CMD-HOME-RESOLVER-CLASS
-$cfg->setConfigEntry('web_cmd_home_resolver_class', 'WebCommandResolver');
-
-// CFG: NEWS-HOME-LIMIT
-$cfg->setConfigEntry('news_home_limit', 10);
-
///////////////////////////////////////////////////////////////////////////////
// Apt-Proxy Configuration
///////////////////////////////////////////////////////////////////////////////
// CFG: TASK-APT-PROXY-LISTENER-MAX-RUNS
$cfg->setConfigEntry('task_apt_proxy_listener_max_runs', 0);
+///////////////////////////////////////////////////////////////////////////////
+// HTML interface //
+///////////////////////////////////////////////////////////////////////////////
+
+// CFG: DEFAULT-HUB-HTML-COMMAND
+$cfg->setConfigEntry('default_hub_html_command', 'index');
+
+// CFG: DEFAULT-HTML-CONTROLLER
+$cfg->setConfigEntry('default_html_controller', 'index');
+
+// CFG: HTML-CMD-INDEX-RESOLVER-CLASS
+$cfg->setConfigEntry('html_cmd_index_resolver_class', 'HubHtmlCommandResolver');
+
+// CFG: NEWS-READER-INDEX-CLASS
+$cfg->setConfigEntry('news_reader_index_class', 'DefaultNewsReader');
+
+// CFG: NEWS-INDEX-LIMIT
+$cfg->setConfigEntry('news_index_limit', 10);
+
+// CFG: HUB-INDEX-MENU-CLASS
+$cfg->setConfigEntry('hub_index_menu_class', 'HubIndexMenu');
+
// [EOF]
?>
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A command for the 'main' routine
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015 City Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class HubHtmlIndexCommand extends BaseCommand implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $commandInstance An instance a prepared command class
+ */
+ public static final function createHubHtmlIndexCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new HubHtmlIndexCommand();
+
+ // Set the application instance
+ $commandInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $commandInstance;
+ }
+
+ /**
+ * Executes the given command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // This command doesn't handle any POST requests, so only handle get request
+ if ($requestInstance->isPostRequestMethod()) {
+ // Don't handle this here
+ $response->sendRequestMethodNotAllowed();
+
+ // Bail out
+ exit();
+ } // END - if
+
+ /*
+ * This is a generic HTML request, this means that a regular page with
+ * header, menu, content and footer shall be send to the client.
+ */
+ $this->sendGenericGetResponse($requestInstance, $responseInstance);
+ }
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ * @todo 0% done
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Add pre filters
+ //$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('node_php_requirements_filter'));
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A ??? menu class for Ship-Simu
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class Hub???Menu extends BaseMenu implements RenderableMenu {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $menuInstance An instance of this class
+ */
+ public final static function createHub???Menu () {
+ // Get a new instance
+ $menuInstance = new Hub???Menu();
+
+ // Return the prepared instance
+ return $menuInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A menu class for Hub
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2015 2007 - 2008 Roland Haeder, 2009 - Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class HubIndexMenu extends BaseMenu implements RenderableMenu {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $menuInstance An instance of this class
+ */
+ public static final function createHubIndexMenu () {
+ // Get a new instance
+ $menuInstance = new HubIndexMenu();
+
+ // Return the prepared instance
+ return $menuInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A command resolver for HTML commands
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class HubHtmlCommandResolver extends BaseCommandResolver implements CommandResolver {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set prefix to "HubHtml"
+ $this->setClassPrefix('hub_html');
+ }
+
+ /**
+ * Creates an instance of a HubHtml command resolver with a given default command
+ *
+ * @param $commandName The default command we shall execute
+ * @param $applicationInstance An instance of a manageable application helper class
+ * @return $resolverInstance The prepared command resolver instance
+ * @throws EmptyVariableException Thrown if default command is not set
+ * @throws InvalidCommandException Thrown if default command is invalid
+ */
+ public static final function createHubHtmlCommandResolver ($commandName, ManageableApplication $applicationInstance) {
+ // Create the new instance
+ $resolverInstance = new HubHtmlCommandResolver();
+
+ // Is the variable $commandName set and the command is valid?
+ if (empty($commandName)) {
+ // Then thrown an exception here
+ throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif ($resolverInstance->isCommandValid($commandName) === FALSE) {
+ // Invalid command found
+ throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ }
+
+ // Set the application instance
+ $resolverInstance->setApplicationInstance($applicationInstance);
+
+ // Return the prepared instance
+ return $resolverInstance;
+ }
+}
+
+// [EOF]
+?>
// Call parent constructor
parent::__construct(__CLASS__);
- // Set prefix to 'Web'
- $this->setClassPrefix('Web');
+ // Set prefix to 'Html'
+ $this->setClassPrefix('Html');
}
/**
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+</div> <!-- masterbox //-->
+
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
+<head>
+ <title>
+ {?app_full_name?} - {?title?}
+ </title>
+
+ <meta name="author" content="{?meta_author?}" />
+ <meta name="publisher" content="{?meta_publisher?}" />
+ <meta name="keywords" content="{?meta_keywords?}" />
+ <meta name="robots" content="index,follow" />
+ <meta name="description" content="{?meta_description?}" />
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <meta http-equiv="content-style-type" content="text/css" />
+ <meta http-equiv="content-script-type" content="text/javascript" />
+ <meta http-equiv="language" content="de" />
+ {?header_extras_hook?}
+</head>
+
+<body>
+<div id="masterbox">
--- /dev/null
+<div id="content_header">
+ Willkommen zum <span class="app_name">{?app_full_name?}</span>
+</div>
+
+<div id="news_frame">
+ {?hub_news?}
+</div>
+
+<div id="welcome">
+ Hier kommt noch vieles dazu.
+</div>
--- /dev/null
+<div id="{?title_id?}" class="{?title_class?}">
+ {?title_text?}
+</div>
+
+<ul>
+{?block_content?}
+</ul>
+
+<div id="{?footer_id?}" class="{?footer_class?}">
+ {?footer_text?}
+</div>
--- /dev/null
+<li id="{?entry_id?}">
+ <a id="{?anchor_id?}" href="{?anchor_href?}" title="{?anchor_title?}">{?anchor_text?}</a>
+</li>
--- /dev/null
+{?header?}
+
+<div id="master">
+<div id="main_header">
+ {?hub_header?}
+</div>
+
+<div id="menu">
+ {?menu?}
+</div>
+
+<div id="advert">
+ {?nav_advert?}
+</div>
+
+<div id="language">
+ {?language_selector?}
+</div>
+
+<div id="main_content">
+ {?main_content?}
+</div>
+
+<div id="main_footer">
+ {?hub_footer?}
+</div>
+</div>
+
+{?footer?}
--- /dev/null
+Deny from all
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+Generic menu entries. You should not touch this template for smooth upgrades.
+
+@author Roland Haeder <webmaster@ship-simu.org>
+@version 0.0.0
+@copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
+@license GNU GPL 3.0 or any newer version
+@link http://www.ship-simu.org
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>
+//-->
+<menu>
+ <block-list block-count="{?block_count?}">
+ <block>
+ <block-header>
+ <title>
+ <title-id><![CDATA[index_menu_title]]></title-id>
+ <title-class><![CDATA[menu_title]]></title-class>
+ <title-text><![CDATA[Home:]]></title-text>
+ </title>
+ </block-header>
+
+ <entry-list entry-count="{?entry_count?}">
+ <entry>
+ <entry-id><![CDATA[index_entry]]></entry-id>
+ <anchor>
+ <anchor-id><![CDATA[menu_index]]></anchor-id>
+ <anchor-text><![CDATA[Home]]></anchor-text>
+ <anchor-title><![CDATA[Zur Startseite]]></anchor-title>
+ <anchor-href><![CDATA[index.php?app={?app_short_name?}]]></anchor-href>
+ </anchor>
+ </entry>
+ </entry-list>
+
+ <block-footer>
+ <footer-id><![CDATA[index_menu_footer]]></footer-id>
+ <footer-class><![CDATA[menu_footer]]></footer-class>
+ <footer-text><![CDATA[Unterhalb Hauptauswahl]]></footer-text>
+ </block-footer>
+ </block>
+ </block-list>
+</menu>
-Subproject commit 23aa45d4a6205e26184190ca446316d06a9b4648
+Subproject commit 993f346ece437f25fbdba2643f3011cbc1860611