file datastore work
[glcas.git] / lib / plugins / www.php
index 1738c23..d060677 100644 (file)
@@ -4,24 +4,32 @@ global $BASE_URLS;
 
 $BASE_URLS["wp"]["base"] = "";
 $BASE_URLS["wp"]["function"] = "wp_pageBuilder";
+$MENU_ITEMS["wp"]["title"] = "Home";
+$MENU_ITEMS["wp"]["link"] = "/";
 
 function goWebProcessor($calls)
 {
        if(isset($calls["needs_base_page"])) {
                if($calls["needs_base_page"] == true) {
                        // build page
-                       echo "here base\n";
+                       // echo "here base\n";
                        www_basePage($calls);
                } else {
                        $func = $calls["page_builder"];
                        $func();
                }
        } else {
-               echo "here base 2\n";
                www_basePage($calls);
        }
 }
 
+function wp_pageBuilder()
+{
+       $calls["needs_base_page"] = true;
+       
+       return $calls;
+}
+
 function www_basePage($calls)
 {
                
@@ -95,11 +103,14 @@ function www_top()
        echo "<h1>Welcome to GLCAS</h1>";
        echo "<table><tr>";
        
-       global $MENU_ITEMS;
+       global $MENU_ITEMS, $GLOBAL_BASE_URL;
        foreach($MENU_ITEMS as $mes) {
                $mtext = $mes["title"];
-               $mlink = $mes["link"];
-               echo "<td><a href=\"$mlink\">$mtext</a></td>";
+               $mlink = "$GLOBAL_BASE_URL/".$mes["link"];
+               // remove the excess /'s
+               $mlink2 = preg_replace("/\/[\/]+/", "/", $mlink);
+               //echo "went from $mlink to $mlink2\n";
+               echo "<td><a href=\"$mlink2\">$mtext</a></td>";
        }
        
        echo "</tr></table>";