Setting up my convoluted web parsing structure... in short:
[glcas.git] / libglcas / web.php
diff --git a/libglcas/web.php b/libglcas/web.php
new file mode 100644 (file)
index 0000000..6c3723b
--- /dev/null
@@ -0,0 +1,68 @@
+<?php 
+
+// if i believed in name spacing in php, i'd use it.
+error_log("glcasweb loaded");
+
+class GLCASWeb {
+       
+       function __construct($config)
+       {
+               $this->config = $config;
+       }
+       
+       function go($urlhandlers)
+       {
+               $url = "/";
+               if(isset($_REQUEST["q"])) {
+                       $url = $_REQUEST["q"];
+               }
+               
+               // create a url parser
+               $urlparser = new GLCASUrlParser($urlhandlers, $this->config);
+               
+               // 
+               $call_class = $urlparser->getClass($url);
+               $call_class->go($url);
+       }
+       
+       private $config;
+       
+}
+
+function GLCASpageBuilder($bodyClass, $bodyFunction, $title="GLCAS")
+{
+       global $WEB_ROOT_FS;
+       
+       // TODO: load css
+       // TODO: load js
+       // header
+       echo "<html><title>$title</title><body>";
+       
+       // page top
+       echo "<h1>GLCAS</h1><br>";
+       echo "<table><tr><td>messages go here<td></tr><tr><td>";
+       
+       // menu, then body
+       echo "<table><tr><td>Menu goes here</td></tr><tr><td>";
+       // body
+       $url = "/";
+       if(isset($_REQUEST["q"])) {
+               $url = $_REQUEST["q"];
+       }
+       
+       if($bodyClass != null) {
+               $bodyClass->$bodyFunction($url);
+       } else $bodyFunction($url);
+       echo "</td></tr></table>";
+       
+       
+       // close the big wrap-around table
+       echo "</td></tr></table>";
+       
+       // footer
+       echo "<br><font size=\"-1\">Copyright 2011, PJR</font><br></body></html>";
+       
+}
+
+
+?>
\ No newline at end of file