From: paulr Date: Thu, 18 Aug 2011 16:42:16 +0000 (+1000) Subject: not entirely sure, think its all the messaging components X-Git-Url: http://git.pjr.cc/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=glcas.git not entirely sure, think its all the messaging components --- diff --git a/libglcas/web.php b/libglcas/web.php index 157d293..41aa463 100644 --- a/libglcas/web.php +++ b/libglcas/web.php @@ -62,7 +62,7 @@ function GLCASMenuBuilder() ksort($MENU_ITEMS); ?> -
Menu + $val) { @@ -74,9 +74,75 @@ function GLCASMenuBuilder() echo "
Menu Home
"; } +// just a short one to call the long one +function gcam($m, $s) +{ + global $glconfig; + GLCASAddMessage($m, $s); +} + +function GLCASAddMessage($messagelev, $message) +{ + global $glconfig; + + $glconfig->addData("messages", time(), "$messagelev", $message); +} + function GLCASMessageBuilder() { - echo "Messages not implemented yet"; + global $glconfig; + $nm = 0; + $nml = null; + $msgs_v = $glconfig->getData("messages"); + + // create a form for setting messages + global $BASE_URL; + echo "
"; + echo "Send a message"; + echo ""; + echo ""; + echo ""; + echo "
"; + + if($msgs_v !== false) foreach($msgs_v as $msgs) { + + error_log("messages: ".$msgs["category"]. " - ".$msgs["val"]); + + $nml[$nm]["msg"] = glcas_tdiffToAgo(time()-$msgs["category"])." : ".$msgs["val"]; + $fontst = ""; + $fonten = ""; + switch($msgs["name"]) { + case "0": + $fontst = ""; + $fonten = ""; + break; + + case "1": + $fontst = ""; + $fonten = ""; + break; + case "2": + $fontst = ""; + $fonten = ""; + break; + + } + $nml[$nm]["font_start"] = $fontst; + $nml[$nm]["font_end"] = $fonten; + + $nm++; + } + if($nm > 0 ) { + echo "
"; + echo ""; + // we do it backwards + for($i = ($nm-1); $i >= 0; $i--) { + echo ""; + } + echo "
".$nml[$i]["font_start"]."".$nml[$i]["msg"]."".$nml[$i]["font_end"]."
"; + echo "
"; + } else echo "No Messages
"; } function GLCASpageBuilder($bodyClass, $bodyFunction, $bodycontent=null, $title="GLCAS") diff --git a/plugins/repo_admin.php b/plugins/repo_admin.php index e3dc5ce..04134f7 100644 --- a/plugins/repo_admin.php +++ b/plugins/repo_admin.php @@ -3,8 +3,8 @@ error_log("admin loaded"); global $BASE_URL, $MENU_ITEMS; -$MENU_ITEMS["30admin"]["name"] = "Repo Admin"; -$MENU_ITEMS["30admin"]["link"] = "$BASE_URL/repoadmin"; +$MENU_ITEMS["30repoadmin"]["name"] = "Repo Admin"; +$MENU_ITEMS["30repoadmin"]["link"] = "$BASE_URL/repoadmin"; global $URL_HANDLERS; $URL_HANDLERS["repoadmin.*"] = "GLCASRepoAdmin"; diff --git a/plugins/server_admin.php b/plugins/server_admin.php new file mode 100644 index 0000000..9b6887f --- /dev/null +++ b/plugins/server_admin.php @@ -0,0 +1,49 @@ +config = $config; + error_log("constructor for GLCASRepoAdmin"); + + } + + function go($url) + { + error_log("repo:go called"); + GLCASpageBuilder($this, "mainbody"); + + } + + function mainbody() + { + echo "

Server Admin

"; + global $SERVER_ADMIN_MENU; + echo ""; + foreach($SERVER_ADMIN_MENU as $val) { + $link = $val["link"]; + $name = $val["name"]; + echo ""; + } + echo "
$name
"; + + + } +} + +?> \ No newline at end of file diff --git a/www/index.php b/www/index.php index bf3bc2c..621c61d 100644 --- a/www/index.php +++ b/www/index.php @@ -31,11 +31,23 @@ if($configpath == false) { } $glconfig = new GLCASConfig(); +global $glconfig; $glconfig->loadConfig($configpath); + +// the global action handler +if(isset($_REQUEST["glcasbasesendmsg"])) { + GLCASAddMessage($_REQUEST["msglev"], $_REQUEST["message"]); + header("Location: ".$_SERVER["HTTP_REFERER"]); + return; +} + +// step up to the web responder $webResponder = new GLCASWeb($glconfig); $webResponder->go($URL_HANDLERS); + + /* echo "
";
 echo "BASEURL: $BASE_URL\n";