home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2003 November
/
Chip_2003-11_cd2.bin
/
nav2004
/
download
/
NAV
/
External
/
NORTON
/
APP
/
NAVOpts.dll
/
HTML
/
OPTIONSBTM.JS
< prev
next >
Wrap
Text File
|
2003-08-17
|
8KB
|
314 lines
// optionsbtm.js
g_ModuleID = 3023; // From ccModuleID.h
// Called by options.js::Load()
function Load ()
{
try
{
parent.g_btnDefaultPage = options_btnDefault;
}
catch(err)
{
parent.g_ErrorHandler.DisplayException (err);
}
}
function Save()
{
try
{
try
{
var bConfigure = parent.IsTrialValid
&& (parent.InitialLoadVxD != parent.NAVOptions.STARTUP.LoadVxD
|| (!parent.Is9x && parent.InitialDelayLoad != parent.NAVOptions.AUTOPROTECT.DelayLoad) );
}
catch(err)
{
// Don't configure AP if an error occurs
bConfigure = false;
parent.NAVOptions.NAVError.LogAndDisplay(parent.g_HWND);
}
try
{
var bSwitchAP = parent.IsTrialValid
&& parent.NAVAutoProtect.Enabled != parent.CurAPRunning;
}
catch(err)
{
// Don't switch AP if the state cannot be retrieved
bSwitchAP = false;
parent.NAVAutoProtect.NAVError.LogAndDisplay(parent.g_HWND);
}
var bSwitchProduct = false;
var bSwitchVirusdefs = false;
// Only switch the modes for ALU if the product reg catalog was available
// during this session of options and ALU was not hosed
try
{
if( !parent.NAVOptions.ALURunning && !parent.ALUhosed )
{
bSwitchProduct = parent.IsTrialValid
&& parent.InitialALUProduct != parent.NAVOptions.ALU.Product;
bSwitchVirusdefs = parent.IsTrialValid
&& parent.InitialALUVirusdefs != parent.NAVOptions.ALU.Virusdefs;
}
}
catch(err)
{
parent.NAVOptions.NAVError.LogAndDisplay(parent.g_HWND);
}
// Flush changes to disk
try
{
parent.NAVOptions.Save();
}
catch (NAVErr)
{
parent.NAVOptions.NAVError.LogAndDisplay(parent.g_HWND);
return;
}
// Set the satrtup configuration
if (bConfigure)
{
var APstartup = 0;
try
{
APstartup = parent.NAVOptions.STARTUP.LoadVxD;
try
{
parent.NAVAutoProtect.Configure(APstartup);
}
catch(err)
{
parent.NAVAutoProtect.NAVError.LogAndDisplay(parent.g_HWND);
}
try
{
var sww = new ActiveXObject('CcWebWnd.ccWebWindow');
}
catch (NAVErr)
{
parent.g_ErrorHandler.DisplayNAVError (document.frames("Errors").ERROR_CREATING_NAVWEBWINDOW_OBJECT.innerText,
document.frames("Errors").ERROR_CREATING_NAVWEBWINDOW_OBJECT_ID.innerText);
return;
}
// Display the message only if the option to Load at startup was changed, not if
// the delay load was changed
if( parent.InitialLoadVxD != parent.NAVOptions.STARTUP.LoadVxD )
{
sww.MsgBox(parent.NAVOptions.STARTUP.LoadVxD ? document.all.APWillStart.innerText : document.all.APWillStop.innerText, document.all.APMsgBoxTitle.innerText, 0);
delete sww;
}
}
catch(err)
{
parent.NAVOptions.NAVError.LogAndDisplay(parent.g_HWND);
}
}
// Set AP service if the state of AP is changed
if (bSwitchAP)
{
try
{
parent.NAVAutoProtect.Enabled = parent.CurAPRunning;
}
catch(err)
{
parent.NAVAutoProtect.NAVError.LogAndDisplay(parent.g_HWND);
}
}
try
{
// Change ALU Update modes for product patches if it changed
if (bSwitchProduct)
{
parent.NAVOptions.EnableALU(parent.NAVOptions.ALU.Product, true);
}
// Change ALU Update modes for Virus Def patches if it changed
if (bSwitchVirusdefs)
{
parent.NAVOptions.EnableALU(parent.NAVOptions.ALU.Virusdefs, false);
}
}
catch (NAVErr)
{
parent.NAVOptions.NAVError.LogAndDisplay(parent.g_HWND);
}
// Clear the password if necessary
if( parent.ClearPass )
{
try
{
var ccpass = new ActiveXObject("Symantec.CommonClient.ccPassword");
// Reset the ccPassword enabled flag to it's old state
try
{
ccpass.ProductID = parent.NAV_CONSUMER_PASSWORD_ID;
ccpass.Clear();
}
catch(err)
{
// Swallow error during save
}
}
catch(err)
{
// Swallow error during save
}
}
}
catch (err)
{
parent.g_ErrorHandler.DisplayException (err);
return;
}
}
// Save and close
function OK()
{
try
{
parent.bClosedWithX = false;
if (parent.CurrentPage.Validate())
{
// Update objects from previous page first.
parent.CurrentPage.Terminate();
Save();
parent.location.href = 'closeme.xyz';
}
}
catch (err)
{
parent.g_ErrorHandler.DisplayException (err);
return;
}
}
// Cancel and close
function Cancel()
{
/*
* Update objects from page first.
* This is done to set the IsDirty flag if the user made any changes.
* The IsDirty flag is checked when options.htm is closed and the user is
* prompted to save pending changes.
*/
try
{
parent.bClosedWithX = false;
if (parent.CurrentPage.Validate())
{
parent.CurrentPage.Terminate();
// Get the current state of AP
var APEnabled;
try
{
APEnabled = parent.NAVAutoProtect.Enabled;
}
catch(err)
{
APEnabled = false;
parent.NAVAutoProtect.NAVError.LogAndDisplay(parent.g_HWND);
}
if (parent.NAVOptions.IsDirty
|| parent.NAVOptions.IsPasswordDirty
|| (parent.IsTrialValid
&& APEnabled != parent.CurAPRunning))
{
try
{
var sww = new ActiveXObject('CcWebWnd.ccWebWindow');
}
catch (NAVErr)
{
parent.g_ErrorHandler.DisplayNAVError (document.frames("Errors").ERROR_CREATING_NAVWEBWINDOW_OBJECT.innerText,
document.frames("Errors").ERROR_CREATING_NAVWEBWINDOW_OBJECT_ID.innerText);
return;
}
if (6 == sww.MsgBox(document.all.CancelPromptLine1.innerText+ '\n' + document.all.CancelPromptLine2.innerText, parent.document.title, 36))
{
Save();
}
else if( parent.NAVOptions.IsPasswordDirty )
{
// If the password is dirty we need to undirty it on a cancel
try
{
var ccpass = new ActiveXObject("Symantec.CommonClient.ccPassword");
// Reset the ccPassword enabled flag to it's old state
try
{
ccpass.ProductID = parent.NAV_CONSUMER_PASSWORD_ID;
ccpass.Enabled = parent.InitialPassword;
// Remove the password set on cancel if it was not previously set
if( !ccpass.Enabled && parent.InitialPasswordSet != ccpass.UserPasswordSet )
ccpass.Clear();
}
catch(err)
{
// Swallow error during close
}
}
catch(err)
{
// Swallow error during close
}
}
delete sww;
}
parent.location.href = 'closeme.xyz';
}
}
catch (err)
{
parent.g_ErrorHandler.DisplayException (err);
return;
}
}
function ResetPage()
{
try
{
// Reset page defaults
parent.CurrentPage.Default();
}
catch(NAVerr)
{
parent.NAVOptions.NAVError.LogAndDisplay(parent.g_HWND);
}
try
{
parent.CurrentPage.Initialize();
}
catch (err)
{
parent.g_ErrorHandler.DisplayException (err);
return;
}
}