3 // if i believed in name spacing in php, i'd use it.
4 error_log("glcasweb loaded");
8 function __construct($config)
10 $this->config = $config;
13 function go($urlhandlers)
16 if(isset($_REQUEST["q"])) {
17 $url = $_REQUEST["q"];
20 // create a url parser
21 $urlparser = new GLCASUrlParser($urlhandlers, $this->config);
24 $call_class = $urlparser->getClass($url);
25 $call_class->go($url);
32 function GLCASMenuBuilder()
36 <a href="<?php echo $BASE_URL ?>">Home</a>
37 <a href="<?php echo $BASE_URL."/admin/"?>">Admin</a>
41 function GLCASMessageBuilder()
43 echo "<i>Messages not implemented yet</i>";
46 function GLCASpageBuilder($bodyClass, $bodyFunction, $title="GLCAS")
48 global $WEB_ROOT_FS, $BASE_URL;
52 echo "<html><head><title>$title</title>";
55 if(file_exists("$WEB_ROOT_FS/css")) {
56 $dh = opendir("$WEB_ROOT_FS/css");
58 while(($file = readdir($dh))!==false) {
59 $mt = preg_match("/.*.css$/", $file);
61 error_log("loading css $file");
62 echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$BASE_URL/css/$file\">";
63 //echo "required $basedir/$file\n";
70 if(file_exists("$WEB_ROOT_FS/js")) {
71 $dh = opendir("$WEB_ROOT_FS/js");
73 while(($file = readdir($dh))!==false) {
74 $mt = preg_match("/.*.js$/", $file);
76 error_log("loading js $file");
77 echo "<script type=\"text/javascript\" src=\"$BASE_URL/css/$file\"></script>";
78 //echo "required $basedir/$file\n";
89 echo "<h1>GLCAS</h1><br>";
90 echo "<table><tr><td>";
91 GLCASMessageBuilder();
92 echo "<td></tr><tr><td>";
95 echo "<table><tr><td>";
97 echo "</td></tr><tr><td>";
100 if(isset($_REQUEST["q"])) {
101 $url = $_REQUEST["q"];
104 if($bodyClass != null) {
105 $bodyClass->$bodyFunction($url);
106 } else $bodyFunction($url);
107 echo "</td></tr></table>";
110 // close the big wrap-around table
111 echo "</td></tr></table>";
114 echo "<br><font size=\"-1\">Copyright 2011, PJR</font><br></body></html>";