messages and such
[glcas.git] / lib / plugins / www.php
index 7811bea..ab6bff9 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)
 {
                
@@ -43,7 +51,7 @@ function www_basePage($calls)
                www_top();
        }
        
-       echo "</td></tr><tr><td>";
+       echo "</td></tr><tr valign=\"top\"><td>";
        
        // left menu
        if(isset($calls["left_menu_function"])) {
@@ -92,12 +100,38 @@ function www_header()
 
 function www_top()
 {
-       echo "i be a top, yar";
+       echo "<h1>Welcome to GLCAS</h1>";
+       echo "<table><tr>";
+       
+       global $MENU_ITEMS, $GLOBAL_BASE_URL;
+       foreach($MENU_ITEMS as $mes) {
+               $mtext = $mes["title"];
+               $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>";
+       if(function_exists("msg_haveMessages")) if(msg_haveMessages()) {
+               echo "<table>";
+               $msgs = msg_getMessages();
+               
+               foreach($msgs as $msg) {
+                       $msgtime = msg_toDate($msg["time"]);
+                       $msgcol = $msg["colour"];
+                       $msgtxt = $msg["text"];
+                       
+                       echo "<tr><td><font color=\"$msgcol\">$msgtime - $msgtxt</font>";
+               }
+               echo "</table>";
+       }
 }
 
 function www_leftmenu()
 {
-       echo "i be a menu, yar";
+       echo "i be a left menu, yar";
 }
 
 function www_contentpane()
@@ -115,4 +149,17 @@ function www_pageend()
 {
        echo "</body></html>";
 }
+
+function urlCreate($from)
+{
+       global $MENU_ITEMS, $GLOBAL_BASE_URL;
+
+       $mlink = "$GLOBAL_BASE_URL/".$from;
+       $mlink = preg_replace("/\/[\/]+/", "/", $mlink);
+       
+       return $mlink;
+       
+}
+
+
 ?>
\ No newline at end of file