home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2005 June
/
ccd0605.iso
/
Software
/
Freeware
/
Programare
/
paranoia
/
ParanoiaSetup.exe
/
Gui
/
Preferences.js
< prev
next >
Wrap
Text File
|
2005-04-03
|
28KB
|
1,081 lines
function OnloadPreferences(){
CommonOnload();
ClearStatusText();
LoadLocalSettings();
LoadNetworkSettings();
LoadFirewallSettings();
LoadConnectionSettings();
LoadPermHost();
LoadFilterHost();
LoadSearchSettings();
LoadFilterSearchWordList();
LoadBlockedHosts();
LoadShareSettings();
LoadSharedDirs();
LoadTransferSettings();
LoadBandwidthSettings();
LoadGeneralSettings();
ScreenID.innerHTML=LocalScreenID.innerHTML;
}
/*
* function: LoadLocalSettings
* Description: Loads all the settings of the Local Settings screen
*/
function LoadLocalSettings()
{
ExecuteCommand("GetForcedIP|SEPERATOR|ForcedIPID");
ExecuteCommand("GetForcedPort|SEPERATOR|ForcedPortID");
ExecuteCommand("GetTrayOnMim|SEPERATOR|TrayOnMimID");
ExecuteCommand("GetTrayOnClose|SEPERATOR|TrayOnCloseID");
ExecuteCommand("GetShowSplash|SEPERATOR|ShowSplashID");
ExecuteCommand("GetStartAtStatrup|SEPERATOR|StartAtStatrupID");
if(ForcedIPID.innerText != "0.0.0.0")
ForcedIPInput.value = ForcedIPID.innerText;
else
ForcedIPInput.value = "";
if(ForcedPortID.innerText != "0")
ForcedPortInput.value = ForcedPortID.innerText;
else
ForcedPortInput.value = "";
if(TrayOnMimID.innerText == "0")
TrayOnMinInput.checked = false;
else
TrayOnMinInput.checked = true;
if(TrayOnCloseID.innerText == "0")
TrayOnCloseInput.checked = false;
else
TrayOnCloseInput.checked = true;
if(ShowSplashID.innerText == "0")
ShowSplashInput.checked = false;
else
ShowSplashInput.checked = true;
if(StartAtStatrupID.innerText == "0")
StartAtStatrupInput.checked = false;
else
StartAtStatrupInput.checked = true;
}
/*
* function: LoadNetworkSettings
* Description: Loads all the settings of the Network Settings screen
*/
function LoadNetworkSettings()
{
ExecuteCommand("GetConnectToGnutella|SEPERATOR|ConnectToGnutellaID");
ExecuteCommand("GetConnectToGnutella2|SEPERATOR|ConnectToGnutella2ID");
ExecuteCommand("GetAbleUltraOrHub|SEPERATOR|AbleUltraOrHubID");
ExecuteCommand("GetMaxLeaf|SEPERATOR|MaxLeafID");
ExecuteCommand("GetForceUltraPeer|SEPERATOR|ForceUltraPeerID");
ExecuteCommand("GetForceG2Hub|SEPERATOR|ForceG2HubID");
MaxLeafInput.value = MaxLeafID.innerText;
if(ConnectToGnutellaID.innerText == "0")
ConnectToGnutellaInput.checked = false;
else
ConnectToGnutellaInput.checked = true;
if(ConnectToGnutella2ID.innerText == "0")
ConnectToGnutella2Input.checked = false;
else
ConnectToGnutella2Input.checked = true;
if(AbleUltraOrHubID.innerText == "0")
AbleUltraOrHubInput.checked = false;
else
AbleUltraOrHubInput.checked = true;
if(ForceUltraPeerID.innerText == "0")
ForceUltraPeerInput.checked = false;
else
ForceUltraPeerInput.checked = true;
if(ForceG2HubID.innerText == "0")
ForceG2HubInput.checked = false;
else
ForceG2HubInput.checked = true;
}
/*
* function: LoadFirewallSettings
* Description: Loads the firewall settings
*/
function LoadFirewallSettings()
{
ExecuteCommand("GetBehindFirewall|SEPERATOR|BehindFirewallID");
if(BehindFirewallID.innerText == "0")
BehindFirewallInput.checked = false;
else
BehindFirewallInput.checked = true;
}
/*
* function: LoadConnectionSettings
* Description: Loads the connection settings
*/
function LoadConnectionSettings()
{
ExecuteCommand("GetAutoConnect|SEPERATOR|AutoConnectID");
ExecuteCommand("GetChildKeepAtLeastConnections|SEPERATOR|ChildKeepAtLeastConnectionsID");
ExecuteCommand("GetUltraPeerKeepAtLeastConnections|SEPERATOR|UltraPeerKeepAtLeastConnectionsID");
ExecuteCommand("GetUltraPeerKeepMaxConnections|SEPERATOR|UltraPeerKeepMaxConnectionsID");
if(AutoConnectID.innerText == "0")
AutoConnectInput.checked = false;
else
AutoConnectInput.checked = true;
ChildKeepAtLeastConnectionsInput.value = ChildKeepAtLeastConnectionsID.innerText;
UltraPeerKeepAtLeastConnectionsInput.value = UltraPeerKeepAtLeastConnectionsID.innerText;
UltraPeerKeepMaxConnectionsInput.value = UltraPeerKeepMaxConnectionsID.innerText;
}
/*
* function: SaveFirewallSettings
* Description: Saves the firewall settings
*/
function SaveFirewallSettings()
{
if(PreferenceForm.BehindFirewallInput.checked == true)
ExecuteCommand("SaveBehindFirewall|SEPERATOR|1");
else
ExecuteCommand("SaveBehindFirewall|SEPERATOR|0");
LoadFirewallSettings();
SetStatusText("Data was saved successfully.");
}
/*
* function: SaveConnectionSettings
* Description: Saves the connection settings
*/
function SaveConnectionSettings()
{
var lsCommand = "";
if(PreferenceForm.AutoConnectInput.checked == true)
ExecuteCommand("SaveAutoConnect|SEPERATOR|1");
else
ExecuteCommand("SaveAutoConnect|SEPERATOR|0");
LoadConnectionSettings();
SetStatusText("Data was saved successfully.");
}
/*
* function: SaveNetworkSettings
* Description: Saves the Local Settings data
*/
function SaveNetworkSettings()
{
var lsCommand = "";
lsCommand = "SaveMaxLeaf|SEPERATOR|" + PreferenceForm.MaxLeafInput.value;
ExecuteCommand(lsCommand);
if(PreferenceForm.ForceG2HubInput.checked == true)
ExecuteCommand("SaveForceG2Hub|SEPERATOR|1");
else
ExecuteCommand("SaveForceG2Hub|SEPERATOR|0");
if(PreferenceForm.ForceUltraPeerInput.checked == true)
ExecuteCommand("SaveForceUltraPeer|SEPERATOR|1");
else
ExecuteCommand("SaveForceUltraPeer|SEPERATOR|0");
if(PreferenceForm.AbleUltraOrHubInput.checked == true)
ExecuteCommand("SaveAbleUltraOrHub|SEPERATOR|1");
else
ExecuteCommand("SaveAbleUltraOrHub|SEPERATOR|0");
if(PreferenceForm.ConnectToGnutella2Input.checked == true)
ExecuteCommand("SaveConnectToGnutella2|SEPERATOR|1");
else
ExecuteCommand("SaveConnectToGnutella2|SEPERATOR|0");
if(PreferenceForm.ConnectToGnutellaInput.checked == true)
ExecuteCommand("SaveConnectToGnutella|SEPERATOR|1");
else
ExecuteCommand("SaveConnectToGnutella|SEPERATOR|0");
LoadNetworkSettings();
SetStatusText("Data was saved successfully.");
}
/*
* function: SaveLocalSettings
* Description: Saves the Network Settings data
*/
function SaveLocalSettings()
{
var lsCommand = "";
lsCommand = "SaveForcedIP|SEPERATOR|" + PreferenceForm.ForcedIPInput.value;
ExecuteCommand(lsCommand);
lsCommand = "SaveForcedPort|SEPERATOR|" + PreferenceForm.ForcedPortInput.value;
ExecuteCommand(lsCommand);
if(PreferenceForm.TrayOnMinInput.checked == true)
ExecuteCommand("SaveTrayOnMim|SEPERATOR|1");
else
ExecuteCommand("SaveTrayOnMim|SEPERATOR|0");
if(PreferenceForm.TrayOnCloseInput.checked == true)
ExecuteCommand("SaveTrayOnClose|SEPERATOR|1");
else
ExecuteCommand("SaveTrayOnClose|SEPERATOR|0");
if(PreferenceForm.ShowSplashInput.checked == true)
ExecuteCommand("SaveShowSplash|SEPERATOR|1");
else
ExecuteCommand("SaveShowSplash|SEPERATOR|0");
if(PreferenceForm.StartAtStatrupInput.checked == true)
ExecuteCommand("SaveStartAtStatrup|SEPERATOR|1");
else
ExecuteCommand("SaveStartAtStatrup|SEPERATOR|0");
LoadLocalSettings();
SetStatusText("Data was saved successfully.");
}
/*
* function: SetStatusText
* Description: Prints the status text
*/
function SetStatusText(StatusText)
{
StatusTextID.innerText = StatusText;
StatusTextID.style.display = "inline";
}
/*
* function: ClearStatusText
* Description: Clears the status text
*/
function ClearStatusText()
{
SetStatusText("");
StatusTextID.style.display = "none";
}
/*
* function: ShowNetworkSettings
* Description: Show the network settings and make sure the enable/disable status is in order.
*/
function ShowNetworkSettings()
{
ScreenID.innerHTML=NetworkScreenID.innerHTML;
ClearStatusText();
DoUltraHubEnableDisable();
}
/*
* function: DoUltraHubEnableDisable
* Description: This function disables or enables MaxLeafInput/ForceUltraPeerInput/ForceG2HubInput
* according to its state
*/
function DoUltraHubEnableDisable()
{
if(PreferenceForm.AbleUltraOrHubInput.checked == true)
{
PreferenceForm.MaxLeafInput.disabled = false;
PreferenceForm.ForceUltraPeerInput.disabled = false;
PreferenceForm.ForceG2HubInput.disabled = false;
}else
{
PreferenceForm.MaxLeafInput.disabled = true;
PreferenceForm.ForceUltraPeerInput.disabled = true;
PreferenceForm.ForceG2HubInput.disabled = true;
}
}
/*
* function: AddPermHost
* Description: Adds a permanent host and update the GUI
*/
function AddPermHost()
{
if((PreferenceForm.PermHostNameInput.value.length >0) &&
(PreferenceForm.PermPortInput.value.length >0))
{
if(isNaN(PreferenceForm.PermPortInput.value))
return;
var oVisibleOption = document.createElement("OPTION");
var lsText = PreferenceForm.PermHostNameInput.value + ":" + PreferenceForm.PermPortInput.value;
var lsCmd = "AddPermHost|SEPERATOR|" + lsText;
ExecuteCommand(lsCmd);
oVisibleOption.text = lsText;
oVisibleOption.value= lsText;
PreferenceForm.HostsList.add(oVisibleOption);
var oHiddenOption = document.createElement("OPTION");
oHiddenOption.text = lsText;
oHiddenOption.value= lsText;
HostsList.options.add(oHiddenOption);
}
}
/*
* function: RemovePermHost
* Description: Removes a permanent host and update the GUI
*/
function RemovePermHost()
{
var lnSelectedIndex = PreferenceForm.HostsList.selectedIndex;
if(lnSelectedIndex>-1)
{
var lsCmd = "RemovePermHost|SEPERATOR|" + PreferenceForm.HostsList.value;
ExecuteCommand(lsCmd);
PreferenceForm.HostsList.options.remove(lnSelectedIndex);
HostsList.options.remove(lnSelectedIndex);
}
}
/*
* function: LoadPermHost
* Description: Get the hosts list.
* PermHostListFunction will be called with an array of hosts list
*/
function LoadPermHost()
{
ExecuteCommand("LoadPermHost|SEPERATOR|PermHostListFunction");
}
/*
* Function: PermHostListFunction
* Description: This function is called by the program (as set with LoadPermHost) with the array
* of permanent hosts
*/
function PermHostListFunction(ar)
{
var a = new VBArray(ar);
var b = a.toArray();
delete a;
for (i=0; i<b.length; i++)
{
var oOption = document.createElement("OPTION");
oOption.text = b[i];
oOption.value= b[i];
HostsList.add(oOption);
}
}
/*
* function: LoadFilterHost
* Description: Get the filtered hosts list.
* FilterHostListFunction will be called with an array of hosts list
*/
function LoadFilterHost()
{
ExecuteCommand("LoadFilterHost|SEPERATOR|FilterHostListFunction");
}
/*
* Function: FilterHostListFunction
* Description: This function is called by the program (as set with LoadFilterHost) with the array
* of filtered hosts
*/
function FilterHostListFunction(ar)
{
var a = new VBArray(ar);
var b = a.toArray();
delete a;
for (i=0; i<b.length; i++)
{
var oOption = document.createElement("OPTION");
oOption.text = b[i];
oOption.value= b[i];
FilterHostsList.add(oOption);
}
}
/*
* function: AddFilterHost
* Description: Adds a filtered host and update the GUI
*/
function AddFilterHost()
{
if((PreferenceForm.FilterHostNameInput.value.length >0))
{
/* Checking if its a valid IP */
lsTempIPParts = PreferenceForm.FilterHostNameInput.value.split(".");
if(lsTempIPParts.length != 4)
return;
for(i=0;i<4;i++)
{
if(lsTempIPParts[i] != "*")
{
if(isNaN(lsTempIPParts[i]))
return;
if(parseInt(lsTempIPParts[i]) <0 || parseInt(lsTempIPParts[i]) > 255)
return;
}
}
/* End of IP text */
var oVisibleOption = document.createElement("OPTION");
var lsText = PreferenceForm.FilterHostNameInput.value + ":" + PreferenceForm.FilterRulesList.value;
var lsCmd = "AddFilterHost|SEPERATOR|" + lsText;
ExecuteCommand(lsCmd);
oVisibleOption.text = lsText;
oVisibleOption.value= lsText;
PreferenceForm.FilterHostsList.add(oVisibleOption);
var oHiddenOption = document.createElement("OPTION");
oHiddenOption.text = lsText;
oHiddenOption.value= lsText;
FilterHostsList.options.add(oHiddenOption);
}
}
/*
* function: RemoveFilterHost
* Description: Removes a filtered host and update the GUI
*/
function RemoveFilterHost()
{
var lnSelectedIndex = PreferenceForm.FilterHostsList.selectedIndex;
if(lnSelectedIndex>-1)
{
var lsCmd = "RemoveFilterHost|SEPERATOR|" + PreferenceForm.FilterHostsList.value;
ExecuteCommand(lsCmd);
PreferenceForm.FilterHostsList.options.remove(lnSelectedIndex);
FilterHostsList.options.remove(lnSelectedIndex);
}
}
/*
* function: LoadSearchSettings
* Description: Loads the search settings
*/
function LoadSearchSettings()
{
ExecuteCommand("GetDoubleCheckResults|SEPERATOR|DoubleCheckResultsID");
if(DoubleCheckResultsID.innerText == "0")
DoubleCheckResultsInput.checked = false;
else
DoubleCheckResultsInput.checked = true;
ExecuteCommand("GetDontDisplayFiltered|SEPERATOR|DontDisplayFilteredID");
if(DontDisplayFilteredID.innerText == "0")
DontDisplayFilteredInput.checked = false;
else
DontDisplayFilteredInput.checked = true;
}
/*
* function: SaveSearchSettings
* Description: Saves the search settings
*/
function SaveSearchSettings()
{
if(PreferenceForm.DoubleCheckResultsInput.checked == true)
ExecuteCommand("SaveDoubleCheckResults|SEPERATOR|1");
else
ExecuteCommand("SaveDoubleCheckResults|SEPERATOR|0");
if(PreferenceForm.DontDisplayFilteredInput.checked == true)
ExecuteCommand("SaveDontDisplayFiltered|SEPERATOR|1");
else
ExecuteCommand("SaveDontDisplayFiltered|SEPERATOR|0");
LoadSearchSettings();
SetStatusText("Data was saved successfully.");
}
/*
* function: LoadFilterSearchWordList
* Description: Get the filtered search words list.
* FilterSearchWordListFunction will be called with an array of filtered words list
*/
function LoadFilterSearchWordList()
{
ExecuteCommand("LoadFilterSearchWordList|SEPERATOR|FilterSearchWordListFunction");
}
/*
* Function: FilterSearchWordListFunction
* Description: This function is called by the program (as set with LoadFilterSearchWordList) with the array
* of filtered search words
*/
function FilterSearchWordListFunction(ar)
{
var a = new VBArray(ar);
var b = a.toArray();
delete a;
for (i=0; i<b.length; i++)
{
var oOption = document.createElement("OPTION");
oOption.text = b[i];
oOption.value= b[i];
FilterSearchWordList.add(oOption);
}
}
/*
* function: AddFilterSearchWord
* Description: Adds a word to filter and update the GUI
*/
function AddFilterSearchWord()
{
if((PreferenceForm.FilterSearchWordInput.value.length >0))
{
var oVisibleOption = document.createElement("OPTION");
var lsCmd = "AddFilterSearchWord|SEPERATOR|" + PreferenceForm.FilterSearchWordInput.value;
ExecuteCommand(lsCmd);
oVisibleOption.text = PreferenceForm.FilterSearchWordInput.value;
oVisibleOption.value= PreferenceForm.FilterSearchWordInput.value;
PreferenceForm.FilterSearchWordList.add(oVisibleOption);
var oHiddenOption = document.createElement("OPTION");
oHiddenOption.text = PreferenceForm.FilterSearchWordInput.value;
oHiddenOption.value= PreferenceForm.FilterSearchWordInput.value;
FilterSearchWordList.options.add(oHiddenOption);
}
}
/*
* function: RemoveFilterSearchWord
* Description: Removes a filtered word and update the GUI
*/
function RemoveFilterSearchWord()
{
var lnSelectedIndex = PreferenceForm.FilterSearchWordList.selectedIndex;
if(lnSelectedIndex>-1)
{
var lsCmd = "RemoveFilterSearchWord|SEPERATOR|" + PreferenceForm.FilterSearchWordList.value;
ExecuteCommand(lsCmd);
PreferenceForm.FilterSearchWordList.options.remove(lnSelectedIndex);
FilterSearchWordList.options.remove(lnSelectedIndex);
}
}
/*
* function: LoadBlockedHosts
* Description: Get the blocked hosts list.
* BlockedHostListFunction will be called with an array of blocked hosts
*/
function LoadBlockedHosts()
{
ExecuteCommand("LoadBlockedHosts|SEPERATOR|BlockedHostListFunction");
}
/*
* Function: BlockedHostListFunction
* Description: This function is called by the program (as set with LoadBlockedHosts) with the array
* of blocked hosts
*/
function BlockedHostListFunction(ar)
{
var a = new VBArray(ar);
var b = a.toArray();
delete a;
var optStrings = new Array(b.length);
/* From:
PRB: CreateElement() for SELECT Options Is Slow in Internet Explorer 5
ID: Q255610.
*/
for (i=0; i<b.length; i++)
{
optStrings[i] = "<option value=\"" + b[i] + "\">" + b[i] + "</option>";
}
BlockHostsListID.innerHTML = "<select name='BlockHostsList' size='15' style='width:40ex' >" + optStrings.join() + "</select>";
}
/*
* function: AddBlockedHost
* Description: Adds a blocked host and update the GUI
*/
function AddBlockedHost()
{
if((PreferenceForm.HostRangeInput.value.length >0) &&
(PreferenceForm.HostBlockReasonInput.value.length >0))
{
var oVisibleOption = document.createElement("OPTION");
var lsTxt = PreferenceForm.HostRangeInput.value + ":" + PreferenceForm.HostBlockReasonInput.value;
var lsCmd = "AddBlockedHost|SEPERATOR|" + lsTxt;
ExecuteCommand(lsCmd);
oVisibleOption.text = lsTxt;
oVisibleOption.value= lsTxt;
PreferenceForm.BlockHostsList.add(oVisibleOption);
var oHiddenOption = document.createElement("OPTION");
oHiddenOption.text = lsTxt;
oHiddenOption.value= lsTxt;
BlockHostsList.options.add(oHiddenOption);
}
}
/*
* function: RemoveBlockedHost
* Description: Removes a blocked host
*/
function RemoveBlockedHost()
{
var lnSelectedIndex = PreferenceForm.BlockHostsList.selectedIndex;
if(lnSelectedIndex>-1)
{
var lsCmd = "RemoveBlockedHost|SEPERATOR|" + PreferenceForm.BlockHostsList.value;
ExecuteCommand(lsCmd);
PreferenceForm.BlockHostsList.options.remove(lnSelectedIndex);
BlockHostsList.options.remove(lnSelectedIndex);
}
}
/*
* function: LoadShareSettings
* Description: Loads the share settings
*/
function LoadShareSettings()
{
ExecuteCommand("GetMaxReply|SEPERATOR|MaxReplyID");
MaxReplyInput.value = MaxReplyID.innerText;
ExecuteCommand("GetSendResultsWhenAvailable|SEPERATOR|SendResultsWhenAvailableID");
if(SendResultsWhenAvailableID.innerText == "0")
SendResultsWhenAvailableInput.checked = false;
else
SendResultsWhenAvailableInput.checked = true;
ExecuteCommand("GetIncludePath|SEPERATOR|IncludePathID");
if(IncludePathID.innerText == "0")
IncludePathInput.checked = false;
else
IncludePathInput.checked = true;
ExecuteCommand("GetHashSpeed|SEPERATOR|HashSpeedID");
HashSpeedInput.value = HashSpeedID.innerText;
}
/*
* function: SaveSharingSettings
* Description: Saves the share Settings data
*/
function SaveSharingSettings()
{
var lsCommand = "";
lsCommand = "SaveMaxReply|SEPERATOR|" + PreferenceForm.MaxReplyInput.value;
ExecuteCommand(lsCommand);
lsCommand = "SaveHashSpeed|SEPERATOR|" + PreferenceForm.HashSpeedInput.value;
ExecuteCommand(lsCommand);
if(PreferenceForm.IncludePathInput.checked == true)
ExecuteCommand("SaveIncludePath|SEPERATOR|1");
else
ExecuteCommand("SaveIncludePath|SEPERATOR|0");
if(PreferenceForm.SendResultsWhenAvailableInput.checked == true)
ExecuteCommand("SaveSendResultsWhenAvailable|SEPERATOR|1");
else
ExecuteCommand("SaveSendResultsWhenAvailable|SEPERATOR|0");
LoadShareSettings();
SetStatusText("Data was saved successfully.");
}
/*
* function: LoadSharedDirs
* Description: Get the shared directories list.
* SharedDirsFunction will be called with an array of shared dirs
*/
function LoadSharedDirs()
{
ExecuteCommand("LoadSharedDirs|SEPERATOR|SharedDirsFunction");
}
/*
* Function: SharedDirsFunction
* Description: This function is called by the program (as set with LoadSharedDirs) with the array
* of shared dirs
*/
function SharedDirsFunction(ar)
{
var a = new VBArray(ar);
var b = a.toArray();
delete a;
for (i=0; i<b.length; i++)
{
var oOption = document.createElement("OPTION");
oOption.text = b[i];
oOption.value= b[i];
SharedDirList.add(oOption);
}
}
/*
* function: AddSharedDir
* Description: Adds a shared directory
*/
function AddSharedDir()
{
var lsCmd;
if(PreferenceForm.SubDirectoriesInput.checked == true)
lsCmd = "AddSharedDir|SEPERATOR|SharedDirID|SEPERATOR|1";
else
lsCmd = "AddSharedDir|SEPERATOR|SharedDirID|SEPERATOR|0";
ExecuteCommand(lsCmd);
if(SharedDirID.innerText.length>0)
{
var oOption = document.createElement("OPTION");
oOption.text = SharedDirID.innerText;
oOption.value= SharedDirID.innerText;
PreferenceForm.SharedDirList.add(oOption);
SharedDirID.innerText = "";
}
}
/*
* function: RemoveSharedDir
* Description: Removes a shared directory
*/
function RemoveSharedDir()
{
var lnSelectedIndex = PreferenceForm.SharedDirList.selectedIndex;
if(lnSelectedIndex>-1)
{
var lsCmd = "RemoveSharedDir|SEPERATOR|" + PreferenceForm.SharedDirList.value;
ExecuteCommand(lsCmd);
PreferenceForm.SharedDirList.options.remove(lnSelectedIndex);
SharedDirList.options.remove(lnSelectedIndex);
}
}
/*
* function: LoadTransferSettings
* Description: Loads the transfer settings
*/
function LoadTransferSettings()
{
ExecuteCommand("GetSaveDownloadsDir|SEPERATOR|SaveDownloadsDirID");
SaveDownloadsDirInput.value = SaveDownloadsDirID.innerText;
ExecuteCommand("GetSavePartialsDir|SEPERATOR|SavePartialsDirID");
SavePartialsDirInput.value = SavePartialsDirID.innerText;
ExecuteCommand("GetMaxSimDownloads|SEPERATOR|MaxSimDownloadsID");
MaxSimDownloadsInput.value = MaxSimDownloadsID.innerText;
ExecuteCommand("GetMaxSimUploads|SEPERATOR|MaxSimUploadsID");
MaxSimUploadsInput.value = MaxSimUploadsID.innerText;
ExecuteCommand("GetDisableMultiSource|SEPERATOR|DisableMultiSourceID");
if(DisableMultiSourceID.innerText == "0")
DisableMultiSourceInput.checked = false;
else
DisableMultiSourceInput.checked = true;
}
/*
* function: SaveTransferSettings
* Description: Saves the transfer Settings data
*/
function SaveTransferSettings()
{
var lsCommand = "";
lsCommand = "SaveSaveDownloadsDir|SEPERATOR|" + PreferenceForm.SaveDownloadsDirInput.value;
ExecuteCommand(lsCommand);
lsCommand = "SaveSavePartialsDir|SEPERATOR|" + PreferenceForm.SavePartialsDirInput.value;
ExecuteCommand(lsCommand);
lsCommand = "SaveMaxSimDownloads|SEPERATOR|" + PreferenceForm.MaxSimDownloadsInput.value;
ExecuteCommand(lsCommand);
lsCommand = "SaveMaxSimUploads|SEPERATOR|" + PreferenceForm.MaxSimUploadsInput.value;
ExecuteCommand(lsCommand);
if(PreferenceForm.DisableMultiSourceInput.checked == true)
ExecuteCommand("SaveDisableMultiSource|SEPERATOR|1");
else
ExecuteCommand("SaveDisableMultiSource|SEPERATOR|0");
LoadTransferSettings();
SetStatusText("Data was saved successfully.");
}
/*
* function: BrowseDownloadToDir
* Description: Shows the browse folder dialog and sets the value to
* SaveDownloadsDirInput
*/
function BrowseDownloadToDir()
{
ExecuteCommand("ShowBrowseDialog|SEPERATOR|SaveDownloadsDirID");
PreferenceForm.SaveDownloadsDirInput.value = SaveDownloadsDirID.innerText;
}
/*
* function: BrowsePartrialsDir
* Description: Shows the browse folder dialog and sets the value to
* SaveDownloadsDirInput
*/
function BrowsePartrialsDir()
{
ExecuteCommand("ShowBrowseDialog|SEPERATOR|SavePartialsDirID");
PreferenceForm.SavePartialsDirInput.value = SavePartialsDirID.innerText;
}
/*
* function: LoadBandwidthSettings
* Description: Loads the bandwidth settings
*/
function LoadBandwidthSettings()
{
ExecuteCommand("GetLimitDownload|SEPERATOR|LimitDownloadID");
LimitDownloadInput.value = LimitDownloadID.innerText;
ExecuteCommand("GetLimitUpload|SEPERATOR|LimitUploadID");
LimitUploadInput.value = LimitUploadID.innerText;
ExecuteCommand("GetDropDownloadsUnder|SEPERATOR|DropDownloadsUnderID");
DropDownloadsUnderInput.value = DropDownloadsUnderID.innerText;
ExecuteCommand("GetDropUploadsUnder|SEPERATOR|DropUploadsUnderID");
DropUploadsUnderInput.value = DropUploadsUnderID.innerText;
}
/*
* function: SaveBandWidthSettings
* Description: Saves the bandwidth Settings data
*/
function SaveBandWidthSettings()
{
var lsCommand = "";
lsCommand = "SaveLimitDownload|SEPERATOR|" + PreferenceForm.LimitDownloadInput.value;
ExecuteCommand(lsCommand);
lsCommand = "SaveLimitUpload|SEPERATOR|" + PreferenceForm.LimitUploadInput.value;
ExecuteCommand(lsCommand);
lsCommand = "SaveDropDownloadsUnder|SEPERATOR|" + PreferenceForm.DropDownloadsUnderInput.value;
ExecuteCommand(lsCommand);
lsCommand = "SaveDropUploadsUnder|SEPERATOR|" + PreferenceForm.DropUploadsUnderInput.value;
ExecuteCommand(lsCommand);
LoadBandwidthSettings();
SetStatusText("Data was saved successfully.");
}
/*
* function: LoadGeneralSettings
* Description: Loads the general settings
*/
function LoadGeneralSettings()
{
ExecuteCommand("GetSwitchToTransfer|SEPERATOR|SwitchToTransferID");
if(SwitchToTransferID.innerText == "0")
SwitchToTransferInput.checked = false;
else
SwitchToTransferInput.checked = true;
ExecuteCommand("GetOpenMagnetLinks|SEPERATOR|OpenMagnetLinksID");
if(OpenMagnetLinksID.innerText == "0")
OpenMagnetLinksInput.checked = false;
else
OpenMagnetLinksInput.checked = true;
ExecuteCommand("GetOpenGnutellaLinks|SEPERATOR|OpenGnutellaLinksID");
if(OpenGnutellaLinksID.innerText == "0")
OpenGnutellaLinksInput.checked = false;
else
OpenGnutellaLinksInput.checked = true;
ExecuteCommand("GetRecordsPerPage|SEPERATOR|RecordsPerPageID");
RecordsPerPageInput.value = RecordsPerPageID.innerText;
}
/*
* function: SaveGeneralSettings
* Description: Saves the general Settings data
*/
function SaveGeneralSettings()
{
var lsCommand = "";
if(PreferenceForm.SwitchToTransferInput.checked == true)
ExecuteCommand("SaveSwitchToTransfer|SEPERATOR|1");
else
ExecuteCommand("SaveSwitchToTransfer|SEPERATOR|0");
if(PreferenceForm.OpenMagnetLinksInput.checked == true)
ExecuteCommand("SaveOpenMagnetLinks|SEPERATOR|1");
else
ExecuteCommand("SaveOpenMagnetLinks|SEPERATOR|0");
if(PreferenceForm.OpenGnutellaLinksInput.checked == true)
ExecuteCommand("SaveOpenGnutellaLinks|SEPERATOR|1");
else
ExecuteCommand("SaveOpenGnutellaLinks|SEPERATOR|0");
lsCommand = "SaveRecordsPerPage|SEPERATOR|" + PreferenceForm.RecordsPerPageInput.value;
ExecuteCommand(lsCommand);
LoadGeneralSettings();
SetStatusText("Data was saved successfully.");
}