home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 2000 April
/
VPR0004B.BIN
/
DRIVER
/
COMPAQ
/
SP12255
/
sp12255.exe
/
DMWEBC1.CAB
/
COND.JS
< prev
next >
Wrap
Text File
|
1999-03-09
|
4KB
|
141 lines
// $Id: condition.js 2.0 1997/10/30 18:51:12 JEllis Development $
// Copyright (C) 1997 Compaq Computer Corporation
function setCondition( conditionIn )
{
if( null==conditionIn )
{
conditionIn = 1;
}
this.state = conditionIn;
}
function updateCondition( newCondition )
{
if( null==newCondition || ""==newCondition ) // error/problem data
{
newCondition = 1;
}
if(4 == this.state) // failed
{
// do nothing, we are already at the worst case
}
else if ( 3 == this.state) // degraded
{
if(4==newCondition)
this.state = 4;
}
else if ( 2 == this.state) // OK
{
if(2<newCondition)
this.state = newCondition;
}
else // unknown
{
this.state = newCondition;
}
}
function colorFromCondition()
{
if(4 == this.state) // failed
{
return "FF0000";
}
else if ( 3 == this.state) // degraded
{
return "FFFF00";
}
else if ( 2 == this.state) // OK
{
return "00CC00";
}
else // unknown
{
return "#0000FF";
}
}
function statusGraphic(alignment)
{
if(null==alignment)
{
alignment = "TOP";
}
if(5 == this.state) // non-recoverable
{
rc = "<IMG SRC=IMAGES/red_x_small.gif ALIGN=" + alignment + " WIDTH=25 HEIGHT=22 HSPACE=0 VSPACE=0 BORDER=0>";
}
else if(4 == this.state) // failed
{
rc = "<IMG SRC=IMAGES/orange_x_small.gif ALIGN=" + alignment + " WIDTH=25 HEIGHT=22 HSPACE=0 VSPACE=0 BORDER=0>";
}
else if ( 3 == this.state) // degraded
{
rc = "<IMG SRC=IMAGES/yellow_yield_small.gif ALIGN=" + alignment + " WIDTH=25 HEIGHT=22 HSPACE=0 VSPACE=0 BORDER=0>";
}
else if ( 2 == this.state) // OK
{
rc = "<IMG SRC=IMAGES/green_check_small.gif ALIGN=" + alignment + " WIDTH=25 HEIGHT=22 HSPACE=0 VSPACE=0 BORDER=0>";
}
else // unknown
{
rc = "<IMG SRC=IMAGES/blue_ball_small.gif ALIGN=" + alignment + " WIDTH=25 HEIGHT=22 HSPACE=0 VSPACE=0 BORDER=0>";
}
return rc;
}
function statusGraphicSmall(alignment)
{
if(null==alignment)
{
alignment = "TOP";
}
if(5 == this.state) // non-recoverable
{
rc = "<IMG SRC=IMAGES/red_x_small.gif ALIGN=" + alignment + " HSPACE=0 VSPACE=0 BORDER=0>";
}
else if(4 == this.state) // failed
{
rc = "<IMG SRC=IMAGES/orange_x_small.gif ALIGN="+ alignment + " HSPACE=0 VSPACE=0 BORDER=0>";
}
else if ( 3 == this.state) // degraded
{
rc = "<IMG SRC=IMAGES/yellow_yield_small.gif ALIGN="+ alignment + " HSPACE=0 VSPACE=0 BORDER=0>";
}
else if ( 2 == this.state) // OK
{
rc = "<IMG SRC=IMAGES/green_check_small.gif ALIGN="+ alignment + " HSPACE=0 VSPACE=0 BORDER=0>";
}
else // unknown
{
rc = "<IMG SRC=IMAGES/blue_ball_small.gif ALIGN="+ alignment + " HSPACE=0 VSPACE=0 BORDER=0>";
}
return rc;
}
function cpqCondition( startingCondition )
{
if( null == startingCondition )
{
startingCondition = 1; // unknown
}
this.state = startingCondition;
this.update = updateCondition;
this.color = colorFromCondition;
this.image = statusGraphic;
this.imageSmall = statusGraphicSmall;
this.set = setCondition;
}