Code cleanup in application selector. TODO: Application 'admin' needs to be excluded...
authorRoland Häder <roland@mxchange.org>
Sat, 1 Nov 2008 20:29:25 +0000 (20:29 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 1 Nov 2008 20:29:25 +0000 (20:29 +0000)
.gitattributes
application/admin/templates/de/html/selector_admin.tpl [new file with mode: 0644]
application/admin/templates/de/html/selector_ship-simu.tpl [deleted file]
application/selector/class_ApplicationSelector.php
application/selector/starter.php

index acf6931..e7f65a8 100644 (file)
@@ -48,7 +48,7 @@ application/admin/templates/de/emails/.htaccess -text
 application/admin/templates/de/emails/text_resend_link.tpl -text
 application/admin/templates/de/html/.htaccess -text
 application/admin/templates/de/html/nav_advert.tpl -text
-application/admin/templates/de/html/selector_ship-simu.tpl -text
+application/admin/templates/de/html/selector_admin.tpl -text
 application/admin/templates/images/.htaccess -text
 application/admin/templates/images/_cache/.htaccess -text
 application/admin/templates/images/de/.htaccess -text
diff --git a/application/admin/templates/de/html/selector_admin.tpl b/application/admin/templates/de/html/selector_admin.tpl
new file mode 100644 (file)
index 0000000..36f9cd1
--- /dev/null
@@ -0,0 +1,3 @@
+<div id="selector_content">
+       <strong>TODO:</strong> Diese Anwendung sollte eigentlich nicht ausw&auml;hlbar sein.
+</div>
diff --git a/application/admin/templates/de/html/selector_ship-simu.tpl b/application/admin/templates/de/html/selector_ship-simu.tpl
deleted file mode 100644 (file)
index b96640e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<div id="selector_content">
-       <div style="text-align: left; padding-top: 15px; padding-left: 10px; padding-right: 10px">
-               Gr&uuml;nden Sie eine virtuelle Reederei an den bedeutestens
-               Welth&auml;fen! Oder treten Sie einer Reederei als Angestellter bei und
-               arbeiten Sie sich bis in die Chef-Etagge hoch!
-       </div>
-
-       <div style="text-align: left; padding-top: 15px; padding-left: 10px; padding-right: 10px">
-               Oder fangen Sie als Matrose auf einem Passagierschiff (virtuell) an zu
-               arbeiten und werden Sie nach wenigen Kreuzfahrten bald Kapit&auml;n!
-       </div>
-
-       <div style="text-align: left; padding-top: 15px; padding-left: 10px; padding-right: 10px">
-               Oder buchen Sie eine virtuelle Kreuzfahrt durch die bekannten Meeren in
-               {!POINTS!} in einer Luxus-Suite!
-       </div>
-</div>
index f52b50a..3c4b256 100644 (file)
@@ -36,11 +36,6 @@ class ApplicationSelector extends BaseFrameworkSystem {
        private $loadedTemplates = null;
 
        /**
-        * The application selector's own template engine handler
-        */
-       private $selectorTplEngine = null;
-
-       /**
         * A list of items we shall ignore while reading from directories
         */
        private $dirIgnoreList = array(
@@ -124,30 +119,10 @@ class ApplicationSelector extends BaseFrameworkSystem {
 
                        // Add the current instance to the list
                        $this->foundApps->append($app);
-
                } // END - if ((is_file(...
        }
 
        /**
-        * Setter for the selector's template engine instance
-        *
-        * @param       $templateInstance       An instance of TemplateEngine
-        * @return      void
-        */
-       private final function setSelectorTemplateEngine (CompileableTemplate $templateInstance) {
-               $this->selectorTplEngine = $templateInstance;
-       }
-
-       /**
-        * Getter for the selector's template engine instance
-        *
-        * @return      $selectTplEngine        The selector's template engine
-        */
-       private final function getSelectorTemplateEngine () {
-               return $this->selectorTplEngine;
-       }
-
-       /**
         * Getter for the $loadedTemplates array object
         *
         * @return      $loadedTemplates        An array object holding all loaded
@@ -175,8 +150,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         */
        public function addDirIgnoreList ($ignoreItem) {
                // Cast and add it
-               $ignoreItem = (string) $ignoreItem;
-               $this->dirIgnoreList[] = $ignoreItem;
+               $this->dirIgnoreList[] = (string) $ignoreItem;
        }
 
        /**
@@ -195,10 +169,6 @@ class ApplicationSelector extends BaseFrameworkSystem {
                // Get a directory pointer for the application path
                $dirInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($appBasePath);
 
-               // Backup and remove the 'app' from local name space
-               /*$appBackup = $app;
-               unset($app);*/
-
                // Read all directories&files except some parts
                while ($appName = $dirInstance->readDirectoryExcept($this->dirIgnoreList)) {
                        // Generate FQFN for the application name (or better directory name)
@@ -217,9 +187,6 @@ class ApplicationSelector extends BaseFrameworkSystem {
 
                // Close directory pointer
                $dirInstance->closeDirectory();
-
-               // Restore old 'app' from backup
-               //$app = $appBackup;
        }
 
        /**
@@ -275,8 +242,8 @@ class ApplicationSelector extends BaseFrameworkSystem {
                // Load the selector's template
                $templateInstance->loadCodeTemplate($this->getConfigInstance()->readConfig('selector_main_tpl'));
 
-               // Now store it in the class
-               $this->setSelectorTemplateEngine($templateInstance);
+               // Now store it in the class, we need this later on final compilation of available applications
+               $this->setTemplateInstance($templateInstance);
        }
 
        /**
@@ -289,6 +256,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         *                                                                              unexpected count of elements
         * @throws      MissingArrayElementsException   If $curr is missing expected
         *                                                                                      array elements
+        * @todo        Finish handling all applications here
         */
        public function insertApplicationTemplates () {
                // First prepare the instance
@@ -317,8 +285,9 @@ class ApplicationSelector extends BaseFrameworkSystem {
                                // Expected entries missing
                                throw new MissingArrayElementsException(array($this, "curr", array("template_class", "app_instance")), self::EXCEPTION_ARRAY_ELEMENTS_MISSING);
                        }
-                       die("<pre>".print_r($curr, true)."</pre>");
 
+                       // Debug output
+                       die(__METHOD__."()<pre>".print_r($curr, true)."</pre>");
                } // END - for
        }
 }
index 7fd2509..dde690e 100644 (file)
@@ -50,7 +50,8 @@ if ((empty($app)) || (is_null($app))) {
 try {
        // Call user function
        call_user_func_array(array($app, FrameworkConfiguration::getInstance()->readConfig('entry_method')), array());
-} catch (FrameworkException  $e) {
+} catch (FrameworkException $e) {
+       die($e->getMessage());
        ApplicationEntryPoint::app_die(sprintf("[Main:] The application <span class=\"app_name\">%s</span> has been terminated due to a thrown exception: <strong>%s - %s</strong>",
                $application,
                $e->__toString(),