echo "<table width=\"100%\">";
if(isset($_SESSION["message"])) {
- echo "<tr width=\"100%\"><td>";
+ echo "<tr width=\"100%\"><td colspan=\"2\">";
gwvp_MessageBuilder();
echo "</td></tr>";
}
- echo "<tr width=\"100%\"><td>";
+ echo "<tr width=\"100%\" bgcolor=\"#ddffdd\"><td>";
gwvp_MenuBuilder();
echo "</td><td align=\"right\">";
gwvp_LoginBuilder();
if(function_exists($bodyFunction)) {
$bodyFunction();
} else {
- error_log("Got called with non-existant body function");
+ error_log("Got called with non-existant body function, $bodyFunction");
gwvp_BodyBuilder();
}
}
// builds the menu structure
function gwvp_MenuBuilder()
{
- global $MENU_ITEMS;
+ global $MENU_ITEMS, $BASE_URL;
ksort($MENU_ITEMS);
- echo "<table border=\"1\"><tr><td>Menu</td>";
+ echo "<table border=\"1\"><tr><td><b><i>Menu</i></b></td>";
foreach($MENU_ITEMS as $key => $val) {
$link = $val["link"];
$text = $val["text"];
- echo "<td><a href=\"$link\">$text</a></td>";
+
+ // TODO: redo this bit with stristr to find urls - special case for home
+ $menucolor = "";
+ if(isset($_REQUEST["q"])) {
+ $extlink = str_replace("$BASE_URL/", "", $link);
+ error_log("trying to do replace of $BASE_URL in $link, got $extlink for ".$_REQUEST["q"]);
+ if(stristr($_REQUEST["q"], $extlink)!==false) {
+ $menucolor = " bgcolor=\"#ffdddd\"";
+
+ }
+ } else {
+ // special case for home
+ if($link == $BASE_URL) $menucolor = " bgcolor=\"#ffdddd\"";
+ }
+
+
+
+
+ if(isset($val["userlevel"])) {
+ if(gwvp_CheckAuthLevel($val["userlevel"])) {
+ echo "<td$menucolor><a href=\"$link\">$text</a></td>";
+ }
+
+ } else {
+ echo "<td$menucolor><a href=\"$link\">$text</a></td>";
+ }
}
echo "</tr></table>";
if($login === false) {
gwvp_SingleLineLoginForm();
} else {
- echo "Hello, ".gwvp_GetFullName($login);
+ echo "Hello, ".gwvp_GetFullName($login)." <a href=\"$BASE_URL/logout\">logout</a>";
}
}