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 acf693100feac10b8637615bd62d72d7afcc19e5..e7f65a8b32f1e87e73e7741112038bbb2b3de429 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/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
 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 f52b50a8fe16b3debf369defca694a9318e0fbc5..3c4b256b9ac1d6d7ee935dded207a5a89a5b0739 100644 (file)
@@ -35,11 +35,6 @@ class ApplicationSelector extends BaseFrameworkSystem {
         */
        private $loadedTemplates = null;
 
         */
        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
         */
        /**
         * A list of items we shall ignore while reading from directories
         */
@@ -124,29 +119,9 @@ class ApplicationSelector extends BaseFrameworkSystem {
 
                        // Add the current instance to the list
                        $this->foundApps->append($app);
 
                        // Add the current instance to the list
                        $this->foundApps->append($app);
-
                } // END - if ((is_file(...
        }
 
                } // 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
         *
        /**
         * Getter for the $loadedTemplates array object
         *
@@ -175,8 +150,7 @@ class ApplicationSelector extends BaseFrameworkSystem {
         */
        public function addDirIgnoreList ($ignoreItem) {
                // Cast and add it
         */
        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);
 
                // 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)
                // 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();
 
                // 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'));
 
                // 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
         *                                                                              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
         */
        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);
                        }
                                // 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
        }
 }
                } // END - for
        }
 }
index 7fd2509c381aea8e170a2f1c11190687717b56d0..dde690e85cea772656dbd443f3edcd612810461b 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());
 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(),
        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(),