]> git.mxchange.org Git - shipsimu.git/commitdiff
More fixes...
authorRoland Häder <roland@mxchange.org>
Sun, 20 Apr 2008 22:01:53 +0000 (22:01 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 20 Apr 2008 22:01:53 +0000 (22:01 +0000)
13 files changed:
.gitattributes
application/selector/templates/de/code/selector_main.ctp
application/ship-simu/templates/de/code/footer.ctp [new file with mode: 0644]
application/ship-simu/templates/de/code/shipsimu_main.ctp
application/ship-simu/templates/de/html/nav_advert.tpl [new file with mode: 0644]
inc/classes/main/class_BaseFrameworkSystem.php
inc/classes/main/extended/class_SerializationContainer.php
inc/classes/main/template/class_TemplateEngine.php
inc/classes/middleware/debug/class_DebugMiddleware.php
index.php
templates/de/code/emergency_exit.ctp
templates/de/code/footer_msg.ctp
templates/de/code/header.ctp

index ccc214ee6bd15d94971c9d095f92e25900c50445..8b50b1b28fa982528a88a4998e13319add242cd6 100644 (file)
@@ -115,9 +115,11 @@ application/ship-simu/main/structures/extended/upper/class_Bridge.php -text
 application/ship-simu/starter.php -text
 application/ship-simu/templates/.htaccess -text
 application/ship-simu/templates/de/.htaccess -text
+application/ship-simu/templates/de/code/footer.ctp -text
 application/ship-simu/templates/de/code/shipsimu_main.ctp -text
 application/ship-simu/templates/de/html/.htaccess -text
 application/ship-simu/templates/de/html/home.tpl -text
+application/ship-simu/templates/de/html/nav_advert.tpl -text
 application/ship-simu/templates/de/html/selector_ship-simu.tpl -text
 db/.htaccess -text
 devel/.htaccess -text
index ff75745e89baf8cab5ad457066b666cdb5d1d98f..77b5bf6f361e32f5eac79472f35abe15eb260a90 100644 (file)
@@ -2,7 +2,7 @@
 
 {?header:title=[WELCOME_APPLICATION_SELECTOR]?}
 
-{?navigation:nav_row=home;imprint;contact?}
+{?navigation?}
 
 <div id="main_header">
        [HEADER_APPLICATION_SELECTOR]
diff --git a/application/ship-simu/templates/de/code/footer.ctp b/application/ship-simu/templates/de/code/footer.ctp
new file mode 100644 (file)
index 0000000..aa82e68
--- /dev/null
@@ -0,0 +1,4 @@
+</div> <!-- masterbox //-->
+
+</body>
+</html>
index 7e0010844e9ecee03153fe7dd2af1ecaa182db0d..659c2bb43755f39bb54d8f7f1b77f7da2fdf488a 100644 (file)
@@ -2,20 +2,24 @@
 
 {?header:title=[WELCOME_SHIP_SIMU]?}
 
+<div id="main_header">
+[HEADER_SHIP_SIMU]
+</div>
+
 <div id="navigation">
-{?navigation:nav_row=home;imprint;contact?}
+{?navigation?}
 </div>
 
-<div id="main_header">
-       [HEADER_SHIP_SIMU]
+<div id="advert">
+{?nav_advert?}
 </div>
 
 <div id="main_content">
-       {?content?}
+{?content?}
 </div>
 
 <div id="main_footer">
-       [FOOTER_SHIP_SIMU]
+[FOOTER_SHIP_SIMU]
 </div>
 
-{?footer_msg:footer_msg=[FOOTER_SHIP_SIMU]?}
+{?footer?}
diff --git a/application/ship-simu/templates/de/html/nav_advert.tpl b/application/ship-simu/templates/de/html/nav_advert.tpl
new file mode 100644 (file)
index 0000000..22da43b
--- /dev/null
@@ -0,0 +1 @@
+<!-- Put your ads code here which shall be shown below the navigation //-->
index 6b4d81694fe6244d3b8f337363da3113f71f55cc..6cc7a20e038754b6e562b4d4856beab09024c668 100644 (file)
@@ -920,6 +920,19 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface {
                // Return the prepared instance
                return $tplEngine;
        }
+
+       /**
+        * Debugs this instance by putting out it's full content
+        *
+        * @return      void
+        */
+       public final function debugInstance () {
+               // Generate the output
+               $content = "<pre>".trim(print_r($this, true))."</pre>";
+
+               // Output it
+               ApplicationEntryPoint::app_die("<strong>Debug output:</strong>".$content);
+       }
 }
 
 // [EOF]
index 3987ad82981bd6467a686e33ae89490855a131fe..b07bfc9894fec44c805887d46c4a7f45d876e967 100644 (file)
@@ -70,7 +70,7 @@ class SerializationContainer extends FrameworkArrayObject {
                                ));
 
                                // Run it
-                               @eval($eval);
+                               eval($eval);
 
                                // Add this item to the container list
                                $containerInstance->append(array(
index 980f56c9426b1e6eab6b451a96240bf46f41f59c..16fbd3c8f567b500551e81c7cfaba0e9ffc84352 100644 (file)
@@ -254,8 +254,8 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
        private function addVariable ($var, $value) {
                // Add it to the stack
                $this->varStack->append(array(
-                       'name'  => $var,
-                       'value' => $value
+                       'name'  => trim($var),
+                       'value' => trim($value)
                ));
        }
 
@@ -812,7 +812,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                        if ((substr($varMatches[2][$key], 0, 1) == "\"") && (substr($varMatches[2][$key], -1, 1) == "\"")) {
                                // Free string detected! Which we can assign directly
                                $this->assignVariable($var, $varMatches[3][$key]);
-                       } else {
+                       } elseif (!empty($varMatches[2][$key])) {
                                // Non-string found so we need some deeper analysis...
                                // @TODO Unfinished work or don't die here.
                                die("Deeper analysis not yet implemented!");
@@ -864,6 +864,19 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                } // END - if (count($this->loadedRawData) ...
        }
 
+       /**
+        * Inserts all raw templates into their respective variables
+        *
+        * @return      void
+        */
+       private function insertRawTemplates () {
+               // Load all templates
+               foreach ($this->rawTemplates as $template=>$content) {
+                       // Set the template as a variable with the content
+                       $this->assignVariable($template, $content);
+               }
+       }
+
        /**
         * Getter for raw template data
         *
@@ -983,9 +996,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                        throw new UnexpectedTemplateTypeException(array($this, $this->getTemplateType(), $this->getConfigInstance()->readConfig("code_template_type")), self::EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED);
                }
 
-               // Get the raw data. Thanks to Flobee(R) for given me a hint using the
-               // modifier "m" in regular expressions. I had implemented a regex here
-               // like this: (\n|\r)
+               // Get the raw data.
                $rawData = $this->getRawTemplateData();
 
                // Remove double spaces and trim leading/trailing spaces
@@ -1003,6 +1014,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                        //
                        // The main analysis
                        $this->analyzeTemplate($templateMatches);
+                       $this->debugInstance();
 
                        // Compile raw template data
                        $this->compileRawTemplateData($templateMatches);
@@ -1012,8 +1024,10 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
 
                        // Are some raw templates found and loaded?
                        if (count($this->rawTemplates) > 0) {
-                               die("NOT YET IMPLEMENTED");
+                               // Insert all raw templates
+                               $this->insertRawTemplates();
                        }
+
                } // END - if($templateMatches ...
        }
 
@@ -1033,20 +1047,20 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                        break;
 
                default: // Unknown type found
+                       // Construct message
+                       $msg = sprintf("[%s:] Unknown/unsupported template type <strong>%s</strong> detected.",
+                               $this->__toString(),
+                               $this->getTemplateType()
+                       );
+
                        if ((is_object($this->getDebugInstance())) && (method_exists($this->getDebugInstance(), 'output'))) {
                                // Use debug output handler
-                               $this->getDebugInstance()->output(sprintf("[%s:] Unbekannter Template-Typ <strong>%s</strong> erkannt.",
-                                       $this->__toString(),
-                                       $this->getTemplateType()
-                               ));
+                               $this->getDebugInstance()->output($msg);
                                die();
                        } else {
                                // Put directly out
                                // DO NOT REWRITE THIS TO app_die() !!!
-                               die(sprintf("[%s:] Unbekannter Template-Typ <strong>%s</strong> erkannt.",
-                                       $this->__toString(),
-                                       $this->getTemplateType()
-                               ));
+                               die($msg);
                        }
                        break;
                }
@@ -1082,7 +1096,7 @@ class TemplateEngine extends BaseFrameworkSystem implements CompileableTemplate
                        );
 
                        // Run the code
-                       @eval($eval);
+                       eval($eval);
                }
 
                // Return the requested instance
index 37d4ed9eb0afab8b1ea31c71fe5ae9433a0f0cbe..f46dbb5e065e3d3353a9429bf531879a4d32cd59 100644 (file)
@@ -78,7 +78,7 @@ class DebugMiddleware extends BaseMiddleware {
                        );
 
                        // Run the constructed name
-                       @eval($eval);
+                       eval($eval);
 
                        // Was this successfull?
                        if ((is_object($debuggerClass)) && (method_exists($debuggerClass, "outputStream"))) {
index d0a0f08361ceff596a042e23541b363f29980150..9cabcb0a844cabeadea6e465976870f6ee4bf10d 100644 (file)
--- a/index.php
+++ b/index.php
@@ -8,10 +8,10 @@
  * But good little boys and girls would always initialize their variables... ;-)
  *
  * @author             Roland Haeder <webmaster@mxchange.org>
- * @version            0.3.0
+ * @version            0.0.0
  * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.mxchange.org
+ * @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
@@ -24,7 +24,7 @@
  * 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/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class ApplicationEntryPoint {
        /**
@@ -50,6 +50,15 @@ class ApplicationEntryPoint {
         * @return      void
         */
        public static function app_die ($message = "") {
+               // Is this method already called?
+               if (defined('EMERGENCY_EXIT_CALLED')) {
+                       // Then output the text directly
+                       die($message);
+               }
+
+               // This method shall not be called twice
+               define('EMERGENCY_EXIT_CALLED', true);
+
                // Is a message set?
                if (empty($message)) {
                        // No message provided
@@ -90,8 +99,19 @@ class ApplicationEntryPoint {
                                ));
                        }
 
-                       // Assign message
+                       // Backtrace holen und aufbereiten
+                       $backtraceArray = debug_backtrace();
+                       $backtrace = "";
+                       foreach ($backtraceArray as $key=>$trace) {
+                               if (!isset($trace['file'])) $trace['file'] = __FILE__;
+                               if (!isset($trace['line'])) $trace['line'] = 5;
+                               if (!isset($trace['args'])) $trace['args'] = array();
+                               $backtrace .= "<span class=\"backtrace_file\">".basename($trace['file'])."</span>:".$trace['line'].", <span class=\"backtrace_function\">".$trace['function']."(".count($trace['args']).")</span><br />";
+                       }
+
+                       // Assign variables
                        $tplEngine->assignVariable("message", $message);
+                       $tplEngine->assignVariable("backtrace", $backtrace);
 
                        // Load the template
                        $tplEngine->loadCodeTemplate("emergency_exit");
@@ -109,7 +129,7 @@ class ApplicationEntryPoint {
                        exit();
                } else {
                        // Output message and die
-                       die(sprintf("[Main:] Emergency exit reached: <strong>%s</strong>",
+                       die(sprintf("[Main:] Emergency exit reached: <span class=\"emergency_span\">%s</span>",
                                $message
                        ));
                }
index f747430f83e50cfcea5a600b852f004f92005943..4cd1cf9accd4078095cd12015310087dbb07821f 100644 (file)
@@ -4,15 +4,15 @@
 
 {?navigation:nav_row=home;imprint;contact?}
 
-       <div class="emergency_exit message_box">
+       <div id="emergency_exit message_box">
                $content[message]
        </div>
 
-       <div class="emergency_exit backtrace_box">
-               <div class="backtrace_header">
+       <div id="emergency_exit backtrace_box">
+               <div id="backtrace_header">
                        Backtrace:
                </div>
-               <div class="backtrace_content">
+               <div id="backtrace_content">
                        $content[backtrace]
                </div>
        </div>
index 309a0fddc6126b1661c83057140a806692581eda..c67ed0c1c4ba45aa9ca37b0fcffde6841a17d76c 100644 (file)
@@ -1,4 +1,4 @@
-       <div class="footer_message message_box">
+       <div id="footer_message message_box">
                $content[footer_msg]
        </div>
 
index 1faab5b6b5f029956cc4997f4a2fa6c04099d2ed..2b2457d15757b54963b5266ae5bcbc9716da03c4 100644 (file)
@@ -17,4 +17,4 @@
 </head>
 
 <body>
-<div class="masterbox">
+<div id="masterbox">