|
<script language="javascript" type="text/javascript">
dmbAPI_Init();
// Since the DynAPI does not support items that have been disabled form within
DHTML Menu Builder, // we need to disable them here, using the API.
dmbAPI_setItemState(dmbAPI_getItemByCaption("UserName"),
false);
dmbAPI_setItemState(dmbAPI_getItemByCaption("|"),
false);
var n;
// Because we are going to be working with the UserName
toolbar item it is a good idea
// to store its id in a variable so, every time we need to reference it we
can just
// use the value in the variable.
var c = dmbAPI_getItemByCaption("UserName");
// So, let's see if the server-side variable $UserName
contains any data
<? if(!isset($UserName) || ($UserName=="")) { ?>
// The variable contained no data, which means
that no one has logged in,
// so we're going to disable the Utilities menu.
n = dmbAPI_getItemByCaption("Utilities");
dmbAPI_removeTBItem(n);
<? } ?>
// Let's check now if the user "root" has logged in
<? if($UserName != "root") { ?>
// The user name variable does not match "root" so the root user is not logged in.
// In this case, we need to disable the "DHTML Menu Builder" menu.
n = dmbAPI_getItemByCaption("DHTML
Menu Builder");
dmbAPI_setItemState(n,
false);
dmbAPI_setColor(n, "#C8C8C8");
<? } ?>
// Finally, let's display the current;y logged in user
name
n = dmbAPI_getItemByCaption("UserName");
dmbAPI_setCaption(n, "<?
echo (isset($UserName) && $UserName!="")?$UserName:"(not logged in)"; ?>");
</script>
|