279 lines
7.2 KiB
HTML
279 lines
7.2 KiB
HTML
<!-- -*- Mode: HTML; tab-width: 2; indent-tabs-mode: nil -*-
|
|
|
|
The contents of this file are subject to the Netscape Public License
|
|
Version 1.0 (the "NPL"); you may not use this file except in
|
|
compliance with the NPL. You may obtain a copy of the NPL at
|
|
http://www.mozilla.org/NPL/
|
|
|
|
Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
for the specific language governing rights and limitations under the
|
|
NPL.
|
|
|
|
The Initial Developer of this code under the NPL is Netscape
|
|
Communications Corporation. Portions created by Netscape are
|
|
Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
Reserved.
|
|
-->
|
|
<HTML>
|
|
|
|
<HEAD>
|
|
<TITLE>Package Selection</TITLE>
|
|
<SCRIPT LANGUAGE="JavaScript" ID="edit100" ARCHIVE="edit.jar">
|
|
|
|
//globals
|
|
var thePlatform;
|
|
var pathFromKitToData = "../Dialup/"
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
|
|
enableExternalCapture(); // This requires UniversalBrowserWrite access
|
|
parent.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP | Event.DRAGDROP | Event.DBLCLICK);
|
|
parent.onmousedown=cancelEvent;
|
|
parent.onmouseup=cancelEvent;
|
|
parent.ondragdrop=cancelEvent;
|
|
|
|
function cancelEvent(e)
|
|
{
|
|
var retVal=false;
|
|
|
|
if ((e.which < 2) && (e.type != "dragdrop") && (e.type != "dblclick")) {
|
|
retVal=routeEvent(e);
|
|
}
|
|
return(retVal);
|
|
}
|
|
|
|
function baseName(fileRef)
|
|
{
|
|
//alert(fileRef);
|
|
fileRef = "" + fileRef;
|
|
fileRef=unescape(fileRef);
|
|
//alert(fileRef);
|
|
if (fileRef.substring(fileRef.length-1,fileRef.length) == '/') {
|
|
fileRef = fileRef.substring(0,fileRef.length-1);
|
|
var x = fileRef.lastIndexOf("/");
|
|
if (x>=0) {
|
|
fileRef = fileRef.substring(x+1,fileRef.length);
|
|
}
|
|
}
|
|
else {
|
|
fileRef="";
|
|
}
|
|
fileRef=unescape(fileRef);
|
|
return(fileRef);
|
|
}
|
|
|
|
|
|
function makeLocalPath(fileRef)
|
|
{
|
|
|
|
|
|
var filePath = new String(fileRef);
|
|
|
|
if(filePath.substring(0,8) == "file:///")
|
|
{
|
|
filePath = filePath.substring(8, filePath.length)
|
|
}
|
|
else if (filePath.substring(0,7) == "file://")
|
|
{
|
|
filePath = filePath.substring(7, filePath.length)
|
|
}
|
|
|
|
if (thePlatform == "Macintosh") { // Macintosh support
|
|
|
|
//var path=unescape(filePath);
|
|
var path = new String(filePath);
|
|
if ((x=path.lastIndexOf("/"))>0) {
|
|
path=path.substring(0,x+1);
|
|
}
|
|
var fileArray=path.split("/");
|
|
var newpath=fileArray.join(":");
|
|
if (newpath.charAt(0)==':') {
|
|
newpath=newpath.substring(1,newpath.length);
|
|
}
|
|
newpath=unescape(newpath);
|
|
}
|
|
else { // Windows support
|
|
|
|
// note: JavaScript returns path with '/' instead of '\'
|
|
|
|
//var path=unescape(theObject.location.pathname);
|
|
var path = unescape(filePath);
|
|
|
|
// gets the drive letter and directory path
|
|
|
|
var startIndex = 0;
|
|
|
|
if (path.charAt(0) == "/")
|
|
startIndex=1;
|
|
|
|
if ((x=path.lastIndexOf("|"))>0) {
|
|
var Drive = path.substring(startIndex, path.indexOf('|'));
|
|
var dirPath = path.substring(path.indexOf('|')+1, path.lastIndexOf('/')+1);
|
|
}
|
|
|
|
// construct newpath
|
|
|
|
newpath = Drive + ":" + dirPath;
|
|
}
|
|
|
|
return(newpath);
|
|
}
|
|
|
|
function getListing(thePlatform)
|
|
{
|
|
var theLoc;
|
|
|
|
if (thePlatform == "Macintosh")
|
|
theLoc = "../../Dialup/";
|
|
else
|
|
theLoc = "../Dialup/";
|
|
|
|
|
|
//parent.listing.location = theLoc;
|
|
|
|
//alert("listing set");
|
|
return theLoc;
|
|
}
|
|
|
|
|
|
function loadData()
|
|
{
|
|
|
|
//get the platform, just once, set the global
|
|
thePlatform = new String(navigator.userAgent);
|
|
var x=thePlatform.indexOf("(")+1;
|
|
var y=thePlatform.indexOf(";",x+1);
|
|
thePlatform=thePlatform.substring(x,y);
|
|
|
|
// Request privilege
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
|
|
compromisePrincipals();
|
|
|
|
//tell the parent frameset to load the correct folder listing into the invisible frame.
|
|
pathFromKitToData = getListing(thePlatform);
|
|
|
|
if (document.forms[0].packages)
|
|
{
|
|
var x;
|
|
var fileRef, baseFileRef, pathRef, acctsetFileRef, theFileContents;
|
|
|
|
for (x=document.forms[0].packages.length-1; x>=0; x--) {
|
|
document.forms[0].packages.options[x] = null;
|
|
}
|
|
x=0;
|
|
|
|
// Note: start y at 1 to skip "Up to higher level directory" link
|
|
|
|
for (var y=1; y<parent.listing.document.links.length; y++) {
|
|
fileRef = parent.listing.document.links[y];
|
|
baseFileRef = baseName(fileRef);
|
|
pathRef = makeLocalPath(fileRef);
|
|
|
|
if (baseFileRef != null && baseFileRef != "")
|
|
{
|
|
//do some more checking to see if this looks like a valid data folder
|
|
//the check is currently to see if the contents of the ACCTSET.INI file are non-null
|
|
if (thePlatform == "Macintosh")
|
|
acctsetFileRef = (pathRef + "Config:ACCTSET.INI");
|
|
else
|
|
acctsetFileRef = (pathRef + "Config/ACCTSET.INI");
|
|
|
|
theFileContents = "";
|
|
|
|
if (acctsetFileRef && acctsetFileRef != null && acctsetFileRef != "")
|
|
{
|
|
theFileContents = document.setupPlugin.GetNameValuePair(acctsetFileRef, null, null);
|
|
}
|
|
|
|
if (theFileContents != null && theFileContents != "")
|
|
{
|
|
document.forms[0].packages.options[x] = new Option(baseFileRef,pathRef,false,false);
|
|
x=x+1;
|
|
}
|
|
}
|
|
}
|
|
document.forms[0].packages.selectedIndex=0;
|
|
document.forms[0].packages.focus();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function customize()
|
|
{
|
|
|
|
// Request privilege
|
|
var thePlatform = new String(navigator.userAgent);
|
|
var x=thePlatform.indexOf("(")+1;
|
|
var y=thePlatform.indexOf(";",x+1);
|
|
thePlatform=thePlatform.substring(x,y);
|
|
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
|
|
compromisePrincipals();
|
|
|
|
if (document.forms[0].packages.selectedIndex<0) {
|
|
alert("Please select a package to customize.");
|
|
return(false);
|
|
}
|
|
|
|
var startFile = document.forms[0].packages.options[document.forms[0].packages.selectedIndex].text;
|
|
document.forms[0].packageRef.value = startFile;
|
|
|
|
//alert("../../" + startFile + "/start.htm");
|
|
|
|
var acctsetFile = document.forms[0].packages.options[document.forms[0].packages.selectedIndex].value;
|
|
|
|
//THE FOLLOWING IS RELATIVE PATH DEPENDENT (i.e. if the tools folder moves, it must be changed)
|
|
if (thePlatform == "Macintosh")
|
|
{
|
|
acctsetFile = (acctsetFile + "Config:ACCTSET.INI");
|
|
}
|
|
else
|
|
{
|
|
acctsetFile = (acctsetFile + "Config/ACCTSET.INI");
|
|
}
|
|
|
|
//alert("acctset.ini is: " + acctsetFile);
|
|
document.setupPlugin.SetNameValuePair(acctsetFile, "Mode Selection", "EditMode", "yes");
|
|
|
|
//clayer.js now takes care of opening this window when the time is right
|
|
//var configWindow = top.open("config.htm","Configurator","dependent=yes,alwaysraised=yes,width=400,height=65,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");
|
|
|
|
top.location = pathFromKitToData + startFile + "/start.htm";
|
|
|
|
return(true);
|
|
}
|
|
</SCRIPT>
|
|
|
|
</HEAD>
|
|
|
|
|
|
|
|
<BODY onLoad="loadData()" BGCOLOR="#CCCCFF" ID="edit101">
|
|
|
|
<EMBED NAME='setupPlugin' TYPE='application/x-netscape-autoconfigure-dialer' HIDDEN=true MAYSCRIPT></EMBED>
|
|
<FORM>
|
|
<CENTER>
|
|
<H2>Account Setup Editor</H2>
|
|
<P><P>
|
|
Please select a package to customize:
|
|
<P>
|
|
|
|
<INPUT NAME="packageRef" TYPE="hidden">
|
|
|
|
<SELECT NAME="packages" SIZE=6>
|
|
<OPTION>________________________________
|
|
</SELECT>
|
|
|
|
<P>
|
|
<INPUT TYPE="Button" VALUE="Customize" onClick="customize()" ID="edit102">
|
|
|
|
</CENTER>
|
|
</FORM>
|
|
|
|
</BODY>
|
|
|
|
</HTML>
|