From d90e402ffbb24d4fc1e530e78d1a8f88f31c6b57 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 10 Dec 2009 10:35:08 +0000 Subject: [PATCH] Code rewritten to reflect latest changes in core --- .../ship-simu/class_ApplicationHelper.php | 10 ++- .../ship-simu/main/class_WorksContract.php | 6 +- .../main/companies/class_ShippingCompany.php | 2 +- .../ship-simu/main/ships/class_BaseShip.php | 2 +- .../code/action_ship_simu_login_company.ctp | 10 +-- docs/TODOs.txt | 65 ++++++++++++------- 6 files changed, 57 insertions(+), 38 deletions(-) diff --git a/application/ship-simu/class_ApplicationHelper.php b/application/ship-simu/class_ApplicationHelper.php index d85438a..150fa58 100644 --- a/application/ship-simu/class_ApplicationHelper.php +++ b/application/ship-simu/class_ApplicationHelper.php @@ -172,15 +172,19 @@ class ApplicationHelper extends BaseApplication implements ManageableApplication * @return void */ public final function entryPoint () { + // Analyze the environment for type of response/request + $type = ConsoleTools::analyzeEnvironmentForType(); + $classType = ConsoleTools::analyzeEnvironmentForClassType(); + // Create a new request object - $requestInstance = ObjectFactory::createObjectByName('HttpRequest'); + $requestInstance = ObjectFactory::createObjectByName(ucfirst($type) . 'Request'); // Remember request instance here $this->setRequestInstance($requestInstance); // Default response is HTTP (HTML page) and type is 'Web' - $response = 'http'; - $responseType = 'web'; + $response = $type; + $responseType = $classType; // Do we have another response? if ($requestInstance->isRequestElementSet('request')) { diff --git a/application/ship-simu/main/class_WorksContract.php b/application/ship-simu/main/class_WorksContract.php index ff4e019..48a3e35 100644 --- a/application/ship-simu/main/class_WorksContract.php +++ b/application/ship-simu/main/class_WorksContract.php @@ -61,7 +61,7 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { // Existiert die Klasse ueberhaupt? if (!class_exists($shipType)) { // Klasse nicht gefunden - throw new ClassNotFoundException ($shipType, self::EXCEPTION_CLASS_NOT_FOUND); + throw new NoClassException ($shipType, self::EXCEPTION_CLASS_NOT_FOUND); } // Schiff-Instanz temporaer erzeugen und in den Bauvertrag einfuegen @@ -140,9 +140,9 @@ class WorksContract extends BaseFrameworkSystem implements SignableContract { $this->getShipInstance()->getShipName() )); } - } catch (ClassNotFoundException $e) { + } catch (NoClassException $e) { // Throw it again... - throw new ClassNotFoundException($e->getMessage(), $e->getCode()); + throw new NoClassException($e->getMessage(), $e->getCode()); } // Get price for this item diff --git a/application/ship-simu/main/companies/class_ShippingCompany.php b/application/ship-simu/main/companies/class_ShippingCompany.php index 9ffb604..8891432 100644 --- a/application/ship-simu/main/companies/class_ShippingCompany.php +++ b/application/ship-simu/main/companies/class_ShippingCompany.php @@ -471,7 +471,7 @@ class ShippingCompany extends BaseSimulator implements Customer, ContractPartner // Is the class there? if (!class_exists($shipType)) { // Throw exception - throw new ClassNotFoundException($shipType, self::EXCEPTION_CLASS_NOT_FOUND); + throw new NoClassException($shipType, self::EXCEPTION_CLASS_NOT_FOUND); } // Create dummy ship diff --git a/application/ship-simu/main/ships/class_BaseShip.php b/application/ship-simu/main/ships/class_BaseShip.php index 14ed9d2..b57afd7 100644 --- a/application/ship-simu/main/ships/class_BaseShip.php +++ b/application/ship-simu/main/ships/class_BaseShip.php @@ -68,7 +68,7 @@ class BaseShip extends BaseSimulator { // Ist die gewuenschte Klasse vorhanden? if (!class_exists($partClass)) { // Nicht vorhanden, dann Ausnahme werfen! - throw new ClassNotFoundException($partClass, self::EXCEPTION_CLASS_NOT_FOUND); + throw new NoClassException($partClass, self::EXCEPTION_CLASS_NOT_FOUND); } // END - if // Get an instance back from our object factory diff --git a/application/ship-simu/templates/de/code/action_ship_simu_login_company.ctp b/application/ship-simu/templates/de/code/action_ship_simu_login_company.ctp index 680dc55..b9df5fc 100644 --- a/application/ship-simu/templates/de/code/action_ship_simu_login_company.ctp +++ b/application/ship-simu/templates/de/code/action_ship_simu_login_company.ctp @@ -6,7 +6,7 @@ $linkInstance = ObjectFactory::createObjectByConfiguredName('web_link_helper', a $linkInstance->prefetchValueInstance('user'); // Add link group for company founder -$linkInstance->addLinkGroup('company_founder', "Vielleicht willst du eine virtuelle Reederei gründen, um dich virtuell selbstständig zu machen?"); +$linkInstance->addLinkGroup('company_founder', "Vielleicht willst du eine Reederei gründen, um dich selbstständig zu machen?"); // Maximum of allowed companies reached? if ($linkInstance->getValueInstance()->ifUserCreatedMaximumAllowedCompanies()) { @@ -18,7 +18,7 @@ if ($linkInstance->getValueInstance()->ifUserCreatedMaximumAllowedCompanies()) { } // Add link group for government -$linkInstance->addLinkGroup('government', "Bewerbe dich bei anderen Firmen und hole dir eine Starthilfe vom virtuellen Staat ab wenn du nicht flüssig bist!"); +$linkInstance->addLinkGroup('government', "Bewerbe dich bei anderen Firmen und hole dir eine Starthilfe vom Staat ab wenn du nicht flüssig bist!"); if ($linkInstance->getValueInstance()->ifUserHasRequiredPoints('write_applications')) { // Enough money to write applications to other companies @@ -30,7 +30,7 @@ if ($linkInstance->getValueInstance()->ifUserHasRequiredPoints('write_applicatio // Can the government pay startup help? if ($linkInstance->getValueInstance()->ifGovernmentPaysStartupHelp()) { // Add link note - $linkInstance->addLinkNote('government_startup_help', "Virtuelle Starthilfe beantragen:"); + $linkInstance->addLinkNote('government_startup_help', "Starthilfe beantragen:"); // Display link to government for startup help $linkInstance->addActionLinkById('government_startup_help', 'apply_startup_help_government'); @@ -46,7 +46,7 @@ if ($linkInstance->getValueInstance()->ifUserHasRequiredPoints('write_applicatio // Checks wether the money bank has opened if ($linkInstance->getValueInstance()->ifMoneyBankHasOpened()) { // Add link group for money bank - $linkInstance->addLinkGroup('moneybank', "Leihe dir zu günstigen Zinsen virtuelles Geld aus, wenn du mehr brauchst!"); + $linkInstance->addLinkGroup('moneybank', "Leihe dir zu günstigen Zinsen Geld aus, wenn du mehr brauchst!"); // Add link to moneybank if ($linkInstance->getValueInstance()->ifUserAllowedTakeCreditsFromMoneyBank()) { @@ -67,7 +67,7 @@ if ($linkInstance->getValueInstance()->ifMoneyBankHasOpened()) { } // Add link group for refill page -$linkInstance->addLinkGroup('refill_page', "Hole dir virtuelles Geld von uns zu fairen Preisen!"); +$linkInstance->addLinkGroup('refill_page', "Hole dir Geld von uns zu fairen Preisen!"); if ($linkInstance->ifRefillPageActive()) { // Display link to refill page diff --git a/docs/TODOs.txt b/docs/TODOs.txt index 53cc954..2533ba6 100644 --- a/docs/TODOs.txt +++ b/docs/TODOs.txt @@ -76,16 +76,14 @@ ./application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php:111: * @todo Find an interface suitable for all types of companies ./application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php:121: * @todo Find an interface suitable for all types of companies ./application/ship-simu/main/wrapper/class_CompanyDatabaseWrapper.php:52: * @todo Find an interface which is suitable for all companies -./inc/classes/exceptions/io/class_FileNotFoundException.php:10: * @todo Rename this class to FileIoException -./inc/classes/exceptions/main/class_ClassNotFoundException.php:10: * @todo Rename this class to NoClassException -./inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php:10: * @todo Rename this class to NoFoundEntryException ./inc/classes/exceptions/main/class_MissingMethodException.php:13: * @todo Try to rewrite user/guest login classes and mark this exception as deprecated +./inc/classes/exceptions/main/class_NoConfigEntryException.php:10: * @todo Rename this class to NoFoundEntryException ./inc/classes/interfaces/class_FrameworkInterface.php:11: * @todo Find a better name for this interface -./inc/classes/main/class_BaseFrameworkSystem.php:1078: * @todo Write a logging mechanism for productive mode -./inc/classes/main/class_BaseFrameworkSystem.php:1092: // @TODO Finish this part! -./inc/classes/main/class_BaseFrameworkSystem.php:119: // @todo Try to clean these constants up -./inc/classes/main/class_BaseFrameworkSystem.php:200: * @todo This is old code. Do we still need this old lost code? -./inc/classes/main/class_BaseFrameworkSystem.php:268: * @todo SearchableResult and UpdateableResult shall have a super interface to use here +./inc/classes/main/class_BaseFrameworkSystem.php:1083: * @todo Write a logging mechanism for productive mode +./inc/classes/main/class_BaseFrameworkSystem.php:1097: // @TODO Finish this part! +./inc/classes/main/class_BaseFrameworkSystem.php:124: // @todo Try to clean these constants up +./inc/classes/main/class_BaseFrameworkSystem.php:205: * @todo This is old code. Do we still need this old lost code? +./inc/classes/main/class_BaseFrameworkSystem.php:273: * @todo SearchableResult and UpdateableResult shall have a super interface to use here ./inc/classes/main/commands/web/class_WebLoginAreaCommand.php:64: * @todo Add some stuff here: Some personal data, app/game related data ./inc/classes/main/commands/web/class_WebProblemCommand.php:58: * @todo 0% done ./inc/classes/main/commands/web/class_WebStatusCommand.php:58: * @todo 0% done @@ -149,28 +147,36 @@ ./inc/classes/main/result/class_DatabaseResult.php:379:4 * @todo Find a caching way without modifying the result array ./inc/classes/main/rng/class_RandomNumberGenerator.php:150: * @todo I had a better random number generator here but now it is somewhere lost :( ./inc/classes/main/rng/class_RandomNumberGenerator.php:83: * @todo Add site key for stronger salt! -./inc/classes/main/template/class_BaseTemplateEngine.php:810: * @todo Unfinished work or don't die here. -./inc/classes/main/template/class_BaseTemplateEngine.php:827: // @TODO Non-string found so we need some deeper analysis... -./inc/classes/main/template/class_BaseTemplateEngine.php:904: // @TODO Old behaviour, will become obsolete! -./inc/classes/main/template/class_BaseTemplateEngine.php:907: // @TODO Yet another old way -./inc/classes/main/template/class_BaseTemplateEngine.php:983: * @todo Make this code some nicer... +./inc/classes/main/template/class_BaseTemplateEngine.php:804: * @todo Unfinished work or don't die here. +./inc/classes/main/template/class_BaseTemplateEngine.php:821: // @TODO Non-string found so we need some deeper analysis... +./inc/classes/main/template/class_BaseTemplateEngine.php:898: // @TODO Old behaviour, will become obsolete! +./inc/classes/main/template/class_BaseTemplateEngine.php:901: // @TODO Yet another old way +./inc/classes/main/template/class_BaseTemplateEngine.php:977: * @todo Make this code some nicer... ./inc/classes/main/template/image/class_ImageTemplateEngine.php:224: * @todo Find something usefull with this! ./inc/classes/main/template/image/class_ImageTemplateEngine.php:244: * @todo Add cache creation here ./inc/classes/main/template/mail/class_MailTemplateEngine.php:234: * @todo Add cache creation here ./inc/classes/main/template/mail/class_MailTemplateEngine.php:244: * @todo Should we call back the mailer class here? ./inc/classes/main/template/mail/class_MailTemplateEngine.php:325: * @todo 0% done -./inc/classes/main/template/menu/class_MenuTemplateEngine.php:270: * @todo Find something useful with this! -./inc/classes/main/template/menu/class_MenuTemplateEngine.php:315: * @todo Add cache creation here +./inc/classes/main/template/menu/class_MenuTemplateEngine.php:276: * @todo Find something useful with this! +./inc/classes/main/template/menu/class_MenuTemplateEngine.php:322: * @todo Add cache creation here ./inc/classes/main/user/class_BaseUser.php:308: * @todo Try to make this method more generic so we can move it in BaseFrameworkSystem ./inc/classes/main/user/class_BaseUser.php:80: * @todo Find a way of casting here. "(int)" might destroy the user id > 32766 ./inc/classes/main/user/member/class_Member.php:84: * @todo Add more ways over creating user classes ./inc/classes/middleware/debug/class_DebugMiddleware.php:112: // @TODO Initialization phase +./inc/classes.php:10: * @todo We should minimize these includes ./inc/config/class_FrameworkConfiguration.php:172: * @todo We have to add some more entries from $_SERVER here -./inc/database.php:49:// @TODO Rewrite this -./inc/hooks.php:26:// @TODO This makes the core depending on the SPL. But it should be installed anyway. -./inc/includes.php:36:// @TODO Find a nicer OOP-ed way for this -./inc/language.php:31:// @TODO Rewrite this +./inc/database.php:11: * @todo We should minimize these includes +./inc/database.php:51:// @TODO Rewrite this +./inc/file_io.php:13: * @todo We should minimize these includes +./inc/hooks.php:11: * @todo We should minimize these includes +./inc/hooks.php:28:// @TODO This makes the core depending on the SPL. But it should be installed anyway. +./inc/includes.php:11: * @todo We should minimize these includes +./inc/includes.php:38:// @TODO Find a nicer OOP-ed way for this +./inc/language.php:10: * @todo We should minimize these includes +./inc/language.php:33:// @TODO Rewrite this ./inc/loader/class_ClassLoader.php:262: /* @todo: Do not die here. */ +./inc/output.php:11: * @todo We should minimize these includes +./inc/selector.php:11: * @todo We should minimize these includes ./application/ship-simu/templates/de/.xml:10:@todo Unfinished template ./application/ship-simu/templates/game/building/advanced_research_lab.xml:38: ./application/ship-simu/templates/game/contract/base_contract.xml:51: @@ -214,9 +220,18 @@ ### ### DEPRECATION FOLLOWS: ### ### ./application/ship-simu/main/personell/class_SimulatorPersonell.php:118: * @deprecated ./application/ship-simu/main/personell/class_SimulatorPersonell.php:319: * @deprecated -./inc/classes/exceptions/io/class_FileNotFoundException.php:11: * @deprecated -./inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php:10: * @deprecated -./inc/classes/exceptions/main/class_ClassNotFoundException.php:11: * @deprecated -./inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php:11: * @deprecated -./inc/classes/main/template/class_BaseTemplateEngine.php:1133: * @deprecated -./inc/classes/main/template/class_BaseTemplateEngine.php:953: * @deprecated +./inc/classes/exceptions/io/class_FileNotFoundException.php:2:// @DEPRECATED +./inc/classes/exceptions/io/class_FilePointerNotOpenedException.php:2:// @DEPRECATED +./inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php:2:// @DEPRECATED +./inc/classes/exceptions/main/class_ClassNotFoundException.php:2:// @DEPRECATED +./inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php:2:// @DEPRECATED +./inc/classes/main/template/class_BaseTemplateEngine.php:1127: * @deprecated +./inc/classes/main/template/class_BaseTemplateEngine.php:947: * @deprecated +./inc/classes.php:9: * @deprecated +./inc/database.php:10: * @deprecated +./inc/file_io.php:12: * @deprecated +./inc/hooks.php:10: * @deprecated +./inc/includes.php:10: * @deprecated +./inc/language.php:9: * @deprecated +./inc/output.php:10: * @deprecated +./inc/selector.php:10: * @deprecated -- 2.39.5