home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 2003 August
/
VPR0308.ISO
/
ANTI_VIR
/
NAV2003
/
NVJP30TD.EXE
/
NAV
/
SWPlugin.dll
/
HTML
/
SCANNERS.JS
< prev
next >
Wrap
Text File
|
2001-08-13
|
14KB
|
338 lines
/*********************************************************************************/
// message maps
window.onload=OnResizeBody;
/*********************************************************************************/
// Element positioning and sizing constants
var ScannerTableToBodyHeightDiff = 50;
var bWinNT = false;
function GetOS()
{
var ua = navigator.userAgent;
if(ua.indexOf("Windows NT") >= 1)
bWinNT = true;
if(bWinNT)
parent.NumberOfScanners = MAXIMUM_Scanners - 3;
else
parent.NumberOfScanners = MAXIMUM_Scanners;
}
/*********************************************************************************/
// Change the description of scanner
function Update_Description(Index, NewDescription)
{
var DescriptionElementID = "Scanner" + Index + "_Description";
var DescriptionElement = document.body.all.item(DescriptionElementID, 0);
if (DescriptionElement)
DescriptionElement.innerHTML = NewDescription;
// DescriptionElement.innerHTML = '<I>' + NewDescription + '</I>';
// sshirai
}
/*********************************************************************************/
// THIS FUNCTIONS IS USED TO CHANGE THE IMAGE IN THE PAGE BEFORE,DURING AND AFTER SCANNING
function Update_Image(Index,Gif_Number )
{
if (parent.images_coll.length>0)
parent.images_coll(parent.Images[Index]).src= parent.pict[Gif_Number];
}
/*********************************************************************************/
// THIS FUNCTION IS USED TO FORMAT THE DYNAMIC ERROR
function Update_Error(Index,ErrorString,ColorName,IsBold)
{
ErrorID = parent.ScannerErrors[Index];
ToolTipString = parent.GetString("TOOLTIP_MESSAGE", "", "");
if (IsBold)
document.body.all(ErrorID).innerHTML = "<B>" + ErrorString + "</B>";
else
document.body.all(ErrorID).innerHTML = ErrorString;
FontColorID = parent.ErrorColors[Index];
parent.font_coll(FontColorID).color = ColorName;
}
function LaunchPointProduct(WrapperIndex,ThisElement)
{
parent.object_coll(parent.Wrappers[WrapperIndex]).RunPointProduct();
ThisElement.className = 'classLink';
}
/*********************************************************************************/
// THIS FUNCTION IS USED TO DISPLAY ERROR COLOR, ERROR AND CHANGE IMAGE, UPDATE PROGRESSBAR
function Update_UI(bSuccessful)
{
var NewDescription = "";
var ErrorString;
var ImageNum;
var IsBold = false;
var Scanner_numErrors = parent.object_coll(parent.Wrappers[parent.ScannerNumber]).numErrors;
if (!bSuccessful)
{
// scan did not run (different from scan ran but errors were found!)
if ( parent.GetProductInstalledError(parent.ScannerNumber) )
NewDescription = parent.GetNoPointProductMsg(parent.ScannerNumber);
ErrorString = parent.GetString("SCAN_FAILED", "", "");
ErrorColor = "Red";
IsBold = true;
ImageNum = 0;
}
else if(Scanner_numErrors > 0)
{
if(Scanner_numErrors == 1)
ErrorString = Scanner_numErrors + parent.GetString("SINGLE_ERROR_FOUND", "", "");
else
ErrorString = Scanner_numErrors + parent.GetString("ERRORS_FOUND", "", "");
parent.Scanner_With_Errors[parent.TotalScanners_With_Errors++]= parent.ScannerNumber;
parent.TotalNumErrors += Scanner_numErrors;
IsBold = true;
ErrorColor = "Red";
ImageNum = 2;
}
else
{
ErrorString = parent.GetString("NO_ERRORS_FOUND", "", "");
ErrorColor = "Green";
ImageNum = 2;
}
Update_Image(parent.ScannerNumber, ImageNum);
Update_Error(parent.ScannerNumber,ErrorString,ErrorColor,IsBold);
if (NewDescription != "")
Update_Description(parent.ScannerNumber, NewDescription);
//parent.images_coll(parent.Images[parent.ScannerNumber]).scrollIntoView(true);
var ScannerTableRowID = "ScannerTableRow" + parent.ScannerNumber;
document.body.all.item(ScannerTableRowID).scrollIntoView(true);
}
/*********************************************************************************/
// THIS FUNCTION IS CALLED TO SET THE PAGE TO DEFAULTS
function Set_Defaults()
{
// set all images to defaults
for(i=0;i<parent.images_coll.length;i++)
Update_Image(i,0);
// set all errors strings to empty
for(i=0;i< parent.NumberOfScanners;i++)
Update_Error(i," ","Black",false);
for(i=0;i< parent.NumberOfScanners;i++)
parent.Scanner_With_Errors[i] = 0;
parent.TotalScanners_With_Error = 0;
parent.ScannersFixed = 0;
parent.TotalNumErrors = 0;
parent.NumFixedErrors = 0;
parent.Errors_before_another_scan = 0;
parent.ScannerIndex = 0;
parent.ScannerNumber = 0;
parent.IsOBCFinished = false;
parent.Update_ProgressBar(SCAN_Idle);
}
function WriteScannerTableRow(ScannerIndex, ScannerName, ScannerTip, ScannerDescription)
{
var i = ScannerIndex;
document.writeln('<TR ID=ScannerTableRow' + i + '>');
document.writeln(' <TD WIDTH="14" VALIGN="top"><IMG ID="Image' + i + '" BORDER="0" SRC="scanner.gif" WIDTH="14" HEIGHT="14"></TD>');
document.writeln(' <TD WIDTH="350" VALIGN="top">');
document.writeln(' <SPAN CLASS="classScannerName" TOOLTIP="' + ScannerTip + '" ONCLICK="ShowToolTip(this)" ONMOUSEOUT="HideToolTip(this)">' + ScannerName + '</SPAN><BR>');
document.writeln(' <SPAN ID="Scanner' + i + '_Description" CLASS="classScannerDescription">'+ ScannerDescription + '</SPAN>');
document.writeln(' </TD>');
document.writeln(' <TD WIDTH="179" VALIGN="top">');
document.writeln(' <FONT ID="ErrorColor' + i + '"><SPAN ID="Scanner' + i + '_Error"></SPAN></FONT>');
document.writeln(' </TD>');
document.writeln('</TR>');
}
function OnResizeBody()
{
// adjust height of the scanner table to maximum possible height
var ScannerTableHeight;
ScannerTableHeight = document.body.clientHeight - ScannerTableToBodyHeightDiff;
if (ScannerTableHeight < 0)
ScannerTableHeight = 0;
document.body.all.scanners_list.style.height = ScannerTableHeight;
}
// fire off or stop the visual cues that indicate OBC is busy
function SetBusy(bBusy)
{
var BackgroundImage;
if (bBusy)
BackgroundImage = parent.GetImage("BACKGROUND_BUSY", "");
else
BackgroundImage = parent.GetImage("BACKGROUND_IDLE", "");
document.body.style.backgroundImage = "url(" + BackgroundImage + ")";
}
/*********************************************************************************/
// Tool Tips
// Set the text, size and position of the tool tip and make it visible
// Note: A SPAN element was placed into the DIV block because in IE4
// the DIV tag does not automatically adjust to the content's
// size (but rather something ridiculously wide). The SPAN
// element will, however, size automatically and in effect we use
// it to figure out the size of the DIV. In IE5, the SPAN tag
// is not needed at all.
// Note: The custom attribute TOOLTIP stores the tooltip's text
// Note: After setting the text into the SPAN tag we need to give IE4
// a chance to calculate the size, thus we use set a timer to
// call the 2nd part of ShowToolTip.
function ShowToolTip(ThisElement)
{
// make sure no tool tip is already showing as we adjust it
HideToolTip(ThisElement);
// get the tool tip text from the custom TOOLTIP attribute
var ToolTipText = ThisElement.getAttribute("TOOLTIP");
if (ToolTipText == null)
return;
// get the tool tip elements
var ToolTipBoxElement = document.all.ToolTipDiv;
var ToolTipTextElement = document.all.ToolTipTextBox;
// set the text..
// but first reset the text height and width so they will be
// automatically calculated; the box must also be wide enough
// or else the text will wrap
ToolTipBoxElement.style.width = document.body.clientWidth;
ToolTipTextElement.style.height = "";
ToolTipTextElement.style.width = "";
ToolTipTextElement.innerHTML = ToolTipText;
// give a chance for IE4 to calculate text height and width
// then call second part of ShowToolTip
var x = event.clientX;
var y = event.clientY + 20;
var params = x + "," + y;
setTimeout("ShowToolTipPart2(" + params + ")", 1); // time out as fast as possible
}
function ShowToolTipPart2(x, y)
{
// get the tool tip elements
var ToolTipBoxElement = document.all.ToolTipDiv;
var ToolTipTextElement = document.all.ToolTipTextBox;
// calculate tool tip box position and size
var TotalWidthBorder = parseInt(ToolTipBoxElement.style.borderLeftWidth)
+ parseInt(ToolTipBoxElement.style.borderRightWidth);
var TotalWidthPadding = parseInt(ToolTipBoxElement.style.paddingLeft)
+ parseInt(ToolTipBoxElement.style.paddingRight);
var TotalHeightBorder = parseInt(ToolTipBoxElement.style.borderTopWidth)
+ parseInt(ToolTipBoxElement.style.borderBottomWidth);
var TotalHeightPadding = parseInt(ToolTipBoxElement.style.paddingTop)
+ parseInt(ToolTipBoxElement.style.paddingBottom);
var ToolTipHeight = ToolTipTextElement.offsetHeight + TotalHeightBorder + TotalHeightPadding;
var ToolTipWidth = ToolTipTextElement.offsetWidth + TotalWidthBorder + TotalWidthPadding;
var ToolTipTop = y;
var ToolTipLeft = x;
// adjust vertical position so it won't be off the client area
var tmpToolTipBottom = ToolTipTop + ToolTipHeight;
// STS 342381...Move the tooltip above the hand cursor instead
// if (tmpToolTipBottom > document.body.clientHeight)
// ToolTipTop = document.body.clientHeight - ToolTipHeight - 1;
if (tmpToolTipBottom > document.body.clientHeight)
ToolTipTop = y - 20 - ToolTipHeight - 1;
if (ToolTipTop < 0)
ToolTipTop = 0;
// adjust horizontal position so it won't be off the client area
var tmpToolTipRight = ToolTipLeft + ToolTipWidth;
if (tmpToolTipRight > document.body.clientWidth)
ToolTipLeft = document.body.clientWidth - ToolTipWidth - 1;
if (ToolTipLeft < 0)
ToolTipLeft = 0;
// set the position then size then visibility
ToolTipBoxElement.style.height = ToolTipHeight;
ToolTipBoxElement.style.width = ToolTipWidth;
ToolTipBoxElement.style.top = ToolTipTop;
ToolTipBoxElement.style.left = ToolTipLeft;
ToolTipBoxElement.style.visibility = "visible";
}
function HideToolTip(ThisElement)
{
var ToolTipElement = document.all.ToolTipDiv;
ToolTipElement.style.visibility = "hidden";
ToolTipElement.style.top = 0;
ToolTipElement.style.left = 0;
}
function LoadScanners()
{
var Index=0;
var ScannerName,ScanDesc,Tooltip;
parent.LoadResourceDoc();
GetOS();
ScannerName = parent.GetString("WIN_REG_SCAN", "", "");
ScanDesc = parent.GetString("WIN_REG_SCAN_DESC", "", "");
Tooltip = parent.GetString("WIN_REG_SCAN_TOOLTIP", "", "");
WriteScannerTableRow(Index++, ScannerName,Tooltip,ScanDesc);
ScannerName = parent.GetString("PROGRAM_INTEGRITY_SCAN", "", "");
ScanDesc = parent.GetString("PROGRAM_INTEGRITY_SCAN_DESC", "", "");
Tooltip = parent.GetString("PROGRAM_INTEGRITY_SCAN_TOOLTIP", "", "");
WriteScannerTableRow(Index++, ScannerName,Tooltip,ScanDesc);
ScannerName = parent.GetString("FREE_SPACE_CHECK", "", "");
ScanDesc = parent.GetString("FREE_SPACE_CHECK_DESC", "", "");
Tooltip = parent.GetString("FREE_SPACE_CHECK_TOOLTIP", "", "");
WriteScannerTableRow(Index++, ScannerName,Tooltip,ScanDesc);
ScannerName = parent.GetString("VIRUS_PROTECT_CHECK", "", "");
ScanDesc = parent.GetString("VIRUS_PROTECT_CHECK_DESC", "", "");
Tooltip = parent.GetString("VIRUS_PROTECT_CHECK_TOOLTIP", "", "");
WriteScannerTableRow(Index++, ScannerName,Tooltip,ScanDesc);
ScannerName = parent.GetString("AUTO_PROTECT_CHECK", "", "");
ScanDesc = parent.GetString("AUTO_PROTECT_CHECK_DESC", "", "");
Tooltip = parent.GetString("AUTO_PROTECT_CHECK_TOOLTIP", "", "");
WriteScannerTableRow(Index++, ScannerName,Tooltip,ScanDesc);
ScannerName = parent.GetString("LAST_VIRUS_SCAN", "", "");
ScanDesc = parent.GetString("LAST_VIRUS_SCAN_DESC", "", "");
Tooltip = parent.GetString("LAST_VIRUS_SCAN_TOOLTIP", "", "");
WriteScannerTableRow(Index++, ScannerName,Tooltip,ScanDesc);
ScannerName = parent.GetString("SHORTCUT_SCAN", "", "");
ScanDesc = parent.GetString("SHORTCUT_SCAN_DESC", "", "");
Tooltip = parent.GetString("SHORTCUT_SCAN_TOOLTIP", "", "");
WriteScannerTableRow(Index++, ScannerName,Tooltip,ScanDesc);
if(!bWinNT)
{
ScannerName = parent.GetString("DISK_DOCTOR", "", "");
ScanDesc = parent.GetString("DISK_DOCTOR_DESC", "", "");
Tooltip = parent.GetString("DISK_DOCTOR_TOOLTIP", "", "");
WriteScannerTableRow(Index++, ScannerName,Tooltip,ScanDesc);
ScannerName = parent.GetString("REG_DOCTOR", "", "");
ScanDesc = parent.GetString("REG_DOCTOR_DESC", "", "");
Tooltip = parent.GetString("REG_DOCTOR_TOOLTIP", "", "");
WriteScannerTableRow(Index++, ScannerName,Tooltip,ScanDesc);
ScannerName = parent.GetString("DISK_FRAG_SCAN", "", "");
ScanDesc = parent.GetString("DISK_FRAG_SCAN_DESC", "", "");
Tooltip = parent.GetString("DISK_FRAG_SCAN_TOOLTIP", "", "");
WriteScannerTableRow(Index++, ScannerName,Tooltip,ScanDesc);
}
}