home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 February
/
CHIP_2_98.iso
/
software
/
pelne
/
optionp
/
iis4_03.cab
/
iihd.asp
< prev
next >
Wrap
Text File
|
1997-11-12
|
18KB
|
716 lines
<%@ LANGUAGE=VBScript %>
<%'Option Explicit %>
<% Response.Expires = 0 %>
<%
' This script is the main container for the admin..
' It holds the client-cached tree list, stored in cachedList
' in addition to a variety of global functions & customization
' flags. This script gets loaded once for the admin and is
' persistant throughout.
%>
<%
' strings for localization
Const L_ISM_TEXT="Internet Service Manager"
Const L_ACCESSDENIED_TEXT="Access Denied"
Const L_HELP_TEXT="Help"
Const L_DOCS_TEXT="Documentation"
Const L_ABOUT_TEXT="About..."
Const L_MICROSOFT_TEXT="Go to www.microsoft.com"
Const L_NOHELP_ERRORMESSAGE="Sorry, the help file is unavailable."
Const L_NOTIMPLEMENTED_ERRORMESSAGE="This feature is not yet implemented."
Dim browser, bgcolor
if Instr(Request.ServerVariables("HTTP_USER_AGENT"),"MSIE") then
browser="ms"
bgcolor="#FFCC00"
else
browser="ns"
bgcolor="#000000"
end if
%>
<html>
<head>
<title><%= L_ISM_TEXT %></title>
<script language="JavaScript">
// Create an instance of our Global Variables for reference by other frames...
Global=new globalVars();
function helpBox(){
if (Global.helpFileName==null){
alert("<%= L_NOHELP_ERRORMESSAGE %>");
}
else{
thefile=Global.helpDir +Global.helpFileName+".htm";
window.open(thefile ,"Help","toolbar=no,scrollbars=yes,directories=no,menubar=no,width=375,height=500");
}
}
function aboutBox() {
popbox=window.open("iiabout.asp","about","toolbar=no,scrollbars=yes,directories=no,menubar=no,width="+525+",height="+300);
if(popbox !=null){
if (popbox.opener==null){
popbox.opener=self;
}
}
}
function popBox(title, width, height, filename){
thefile=(filename + ".asp");
thefile="iipop.asp?pg="+thefile;
<% if browser="ns" then %>
width=width +25;
height=height + 50;
<% end if %>
popbox=window.open(thefile,title,"toolbar=no,scrollbars=yes,directories=no,menubar=no,width="+width+",height="+height);
if(popbox !=null){
if (popbox.opener==null){
popbox.opener=self;
}
}
}
function globalVars(){
// Sets the global variables for the script.
// These may be changed to quickly customize the tree's apperance
// Fonts
this.face="Helv,Arial";
this.fSize=1;
// Spacing
this.vSpace=2;
this.hSpace=4;
this.tblWidth=500;
this.selTColor="#FFCC00";
this.selFColor="#000000";
this.selUColor="#CCCCCC";
// Images
this.imagedir="images/";
this.appIcon = "app";
this.spaceImg=this.imagedir + "space.gif";
this.lineImg=this.imagedir + "line.gif";
this.plusImg=this.imagedir + "plus.gif";
this.minusImg=this.imagedir + "minus.gif";
this.emptyImg=this.imagedir + "blank.gif";
this.plusImgLast=this.imagedir + "plusl.gif";
this.minusImgLast=this.imagedir + "minusl.gif";
this.emptyImgLast=this.imagedir + "blankl.gif";
this.stateImg=new Array();
this.stateImg[0]=this.imagedir + "stop.gif";
this.stateImg[1]=this.imagedir + "go.gif";
this.stateImg[2]=this.imagedir + "pause.gif";
// Instant State
this.displaystate=new Array();
this.displaystate[0]="";
this.displaystate[2]="";
this.displaystate[4]="(stopped)";
this.displaystate[6]="(paused)";
this.state=new Array();
this.state[4]="stopped";
this.state[2]="started";
this.state[1]="starting";
this.state[3]="stopping";
// ID of selected item
this.selId=0;
this.selName="";
this.selSType="";
this.selVType="";
//Help
this.helpFileName="iipxmain.htm";
this.helpDir="http://<%= Request.ServerVariables("SERVER_NAME") %>/iishelp/iis/htm/core/"
// Other Flags
this.showState=false;
this.dontAsk=false;
this.updated=false;
this.homeurl=top.location.href;
this.siteProperties = false;
this.working = false;
}
function openLocation(){
//opens the property sheet for the selected node,
//regardless of service type or node type. this
//script calls iiset.asp which sets the appropriate
//session variables for server side persistance throughout
//the property sheet
var path;
var sel=Global.selId;
Global.selName=nodeList[sel].title;
Global.selSType=nodeList[sel].stype;
Global.selVType=nodeList[sel].vtype;
top.body.iisstatus.location.href=("iistat.asp?thisState=Loading");
path="stype=" + Global.selSType;
path=path + "&vtype=" + Global.selVType;
path=path + "&title=" +escape(nodeList[sel].title);
if (nodeList[sel].vtype=="server"){
path=path + "&spath=" + escape(nodeList[sel].path);
path=path + "&dpath=" + escape(nodeList[sel].path) + "/Root";
}
else{
path=path + "&spath=";
path=path + "&dpath=" + escape(nodeList[sel].path);
}
page="iiset.asp?"+path;
//iiset.asp sets the serverside session variables...
top.connect.location.href=(page);
}
function sortOrder(a,b){
x=a.id - b.id
return x
}
function sortList(){
nodeList.sort(sortOrder);
}
function selectItem(item){
nodeList[Global.selId].selected=false;
Global.selId=item;
nodeList[item].selected=true;
}
function insertNode(title,caption,parent,vtype,stype){
//add a new node to the client-cached list
var nodepath;
var indexnum=nodeList.length;
var Nextid=parent+1;
if (nodeList[parent].vtype=="server"){
nodepath=nodeList[parent].path + "/Root/" + title;
}
else{
if (nodeList[parent].vtype=="comp"){
if (stype == "www"){
nodepath=nodeList[parent].path + "/W3SVC/" + title;
}
else{
nodepath=nodeList[parent].path + "/MSFTPSVC/" + title;
}
}
else{
nodepath=nodeList[parent].path + "/" + title;
}
}
title=title;
while ((nodeList.length > Nextid) && (nodeList[Nextid].parent >=parent)) {
if(nodeList[Nextid].parent==parent){
if(nodeList[Nextid].title > title){
break;
}
}
Nextid=Nextid +1;
}
if (nodeList.length <=Nextid){
var newid=nodeList.length;
}
else{
var newid=nodeList[Nextid].id;
}
nodeList[indexnum]=nodeList[parent].addNode(new listObj(indexnum,caption,nodepath,vtype,4));
nodeList[indexnum].isCached=true;
nodeList[indexnum].id=newid;
for (var i=newid; i < indexnum; i++) {
nodeList[i].id=nodeList[i].id + 1;
if (nodeList[i].parent >=nodeList[indexnum].id){
nodeList[i].parent=nodeList[i].parent +1;
}
}
nodeList[parent].open=true;
nodeList[0].sortList();
nodeList[0].markTerms();
selectItem(newid);
top.body.list.location.href="iisrvls.asp";
}
function browseItem() {
popBox('Browse',640,480, nodeList[Global.selId].loc);
}
function deleteItem() {
// marks items in the client cached list as deleted...
nodeList[Global.selId].deleted=true;
if (Global.selId+1 !=listLength){
deleteChildren(Global.selId);
}
markTerms();
top.body.list.location="iisrvls.asp";
}
function deleteChildren(item){
var z=item+1;
while (nodeList[z].parent >=item) {
nodeList[z].deleted=true;
z=z+1;
if(z >=nodeList.length){
break;
}
}
}
function deCache(){
//marks a node as uncached (forcing a recache when expanded)
//and marks all child nodes as deleted
sel=Global.selId;
nodeList[sel].isCached=false;
nodeList[sel].open=false;
if (sel+1 !=listLength){
deleteChildren(sel);
}
markTerms();
}
function markTerms(){
//marks cached list items as being a terminater (ie, having no siblings)
//this forces an "end" gif in the tree view...
var i
listLength=nodeList.length;
for (i=0; i < listLength; i++) {
nodeList[i].lastChild=isLast(i);
}
}
function isLast(item){
var i;
last=false;
if (item+1==listLength){
last=true;
}
else{
if (nodeList[item].parent==null){
last=true;
for (i=item+1; i < listLength; i++) {
if (nodeList[i].parent==null){
last=false;
break;
}
}
}
else{
last=true;
var y=item+1;
while(nodeList[y].parent >=nodeList[item].parent){
if(nodeList[y].parent==nodeList[item].parent){
if(!nodeList[y].deleted){
last=false;
break;
}
}
y=y+1;
if ((y)==listLength){
break;
}
}
}
}
return last;
}
function addNode(childNode){
//adds a new node to the tree, setting some default parameters
childNode.parent=this.id;
childNode.level=this.level +1;
dir="images/"
if (childNode.vtype=="vdir"){
childNode.loc=nodeList[this.id].loc + childNode.title+"/";
childNode.icon=dir+ "vdir";
}
else{
if (childNode.vtype=="dir"){
childNode.loc=nodeList[this.id].loc + childNode.title+"/";
childNode.icon=dir + "dir";
}
else{
if (childNode.stype=="www"){
childNode.loc="http://"+childNode.title+"/";
childNode.icon=dir +"www";
}
if (childNode.stype=="ftp"){
childNode.loc="ftp://"+childNode.title+"/";
childNode.icon=dir +"ftp";
}
}
}
return childNode;
}
function connect(){
serverurl=prompt("Please enter the URL of the server you wish to connect to:", "http://<%= Request.ServerVariables("SERVER_NAME") %>/iisadmin/")
if (serverurl !=""){
page="iicnct.asp";
top.body.iisstatus.location="iistat.asp?thisState=Loading";
top.connect.location=page;
}
}
function cache(item){
page="iicache.asp?sname="+escape(nodeList[item].path)+"&Nextid="+nodeList.length+"¤tid="+item;
<% if (browser<>"ns") then %>
top.body.iisstatus.location.href="iistat.asp?thisState=Loading";
<% end if %>
top.connect.location.href=page;
}
function loadPage(){
top.body.location.href='iibody.asp';
}
function inheritenceItem(property, path){
this.property = property;
this.path = path;
}
function iListsortOrder(a,b){
x=((a.property + a.path) - (b.property + b.path));
return x
}
function listObj(id, title, path,vtype,state){
// This is the object that represents each line item
// In the tree structure.
// ID is the id refered to by the parent property
// title is the text string that appears In the list
// parent is the ID of the parent list item
// level is the depth of the list item, 0 being the furthest left on the tree
// href is the location to open when selected
// open is a flag that determines whether children are displayed
// state is a flag to determine the state (4=stopped, 2=running)
// selected is an interenal flag
// openLocation is the function that opens the href file In a frame
//sortby will change to reflect the new sort order when a new item is added to the list.
this.id=id;
this.title=title;
this.path=path;
this.keytype="";
this.fspath="";
this.err="";
this.stype="";
if (path.indexOf("W3SVC") !=-1){
this.stype="www";
}
if (path.indexOf("FTPSVC") !=-1){
this.stype="ftp";
}
this.vtype=vtype;
this.open=false;
this.state=state;
this.displaystate = Global.displaystate[state];
this.isApp = false;
this.isCached=false;
this.isWorkingServer=false;
this.parent=null;
this.level=1;
this.loc="http://"+this.title;
dir="images/";
this.icon=dir +"comp";
this.href="blank.htm";
this.deleted=false;
this.selected=false;
this.lastChild=false;
//methods
this.openLocation=openLocation;
this.addNode=addNode;
this.insertNode=insertNode;
this.deleteItem=deleteItem;
this.deCache=deCache;
this.browseItem=browseItem;
this.markTerms=markTerms;
this.cache=cache;
this.connect=connect;
this.sortList=sortList;
}
// Create the nodeList array, and fill with the objects.
// The array items will be displayed In the id # order,
// as Jscript has limited array sorting capabilities.
// Children should always follow their parent item.
nodeList=new Array();
nodeList[0]="";
// Create a blank array for our set data path inheritence list
inheritenceList = new Array();
<%
On Error Resume Next
Dim newid, computer, thisinstance, currentADsObj, FileSystem
Dim thisname
computer="localhost"
thisinstance=Request.ServerVariables("INSTANCE_ID")
if Session("isAdmin") then
%>
//the localhost
nodeList[0]=new listObj(0,"<%= Request.ServerVariables("SERVER_NAME") %>","IIS://<%= computer %>", "comp",1);
nodeList[0].isCached=true;
nodeList[0].open=true;
nodeList[0].selected=true;
<%
newid=1
%>//FTPSVC<%
Set currentADsObj=GetObject("IIS://" & computer & "/MSFTPSVC")
addInstances currentADsObj,0,"server"
%>//W3SVC<%
Set currentADsObj=GetObject("IIS://" & computer & "/W3SVC")
addInstances currentADsObj,0,"server"
else
Set FileSystem=CreateObject("Scripting.FileSystemObject")
Set currentADsObj=GetObject("IIS://" & computer & "/W3SVC/" & thisInstance)
thisname=currentADsObj.ServerComment
if thisname="" then
thisname="[Web Site #" & currentADsObj.Name & "]"
end if
%>
//the instance
nodeList[0]=new listObj(0,"<%= thisname %>","IIS://<%= computer %>/W3SVC/<%= thisinstance %>", "server",2);
nodeList[0].isWorkingServer=false;
nodeList[0].isCached=true;
nodeList[0].open=true;
nodeList[0].icon="images/www";
nodeList[0].loc="http://<%= Request.ServerVariables("SERVER_NAME") %>/";
<%
newid=1
addNodes currentADsObj,0,"vdir"
end if
Sub addInstances(Container, parentid, vtype)
On Error Resume Next
Dim thisname, Child, thisid, thisstate
For Each Child In Container
if Instr(Child.KeyType,"Server") <> 0 then
thisid=newid
thisname=Child.Name
thisstate=""
thisname=Child.ServerComment
if thisname="" then
if Instr(Child.KeyType,"Ftp") <> 0 then
thisname="[FTP Site #" & Child.Name & "]"
else
thisname="[Web Site #" & Child.Name & "]"
end if
end if
thisstate=Child.ServerState
if err=0 then
SetJscriptObj thisname, Child.ADsPath,parentid, vtype, thisstate, false, "",False
if Child.Name=Request.ServerVariables("INSTANCE_ID") then
SetWorkingInstance thisid
end if
end if
end if
'this child may have err'd but we need to enum the rest anyway, so we clear our error...
err.Clear
Next
End Sub
Sub addNodes(Container, parentid, vtype)
On Error Resume Next
Dim thisname, isApp, thisid, thisstate, thisroot, approot
For Each Child In Container
if Instr(Child.KeyType, "VirtualDir") <> 0 then
thisid=newid
thisname=Child.Name
thisstate=2
isApp = False
approot=LCase(Child.AppRoot)
if len(approot) <> 0 then
thisroot = LCase(Child.ADsPath)
approot = Mid(approot,Instr(approot,"w3svc/")+1)
thisroot = Mid(thisroot,Instr(thisroot,"w3svc/")+1) & "/"
if thisroot=approot then
isApp = True
end if
end if
if UCase(thisname) <> "ROOT" then
SetJscriptObj thisname, Child.ADsPath, parentid, vtype, thisstate, true, Child.Path, isApp
addNodes Child, thisid, "vdir"
addDirs Child.Path, Child.ADsPath, thisid, "dir"
else
addNodes Child, parentid, "vdir"
addDirs Child.Path, Child.ADsPath, parentid, "dir"
end if
end if
Next
End Sub
Sub addDirs(path, adspath, parentid, vtype)
On Error Resume Next
Dim thisid,thisname,thisstate,i,f, thispath
if Instr(UCase(adspath),"W3SVC") <> 0 then
if path <> "" then
if Left(path,2) <> "\\" then
If FileSystem.FolderExists(path) Then
Set f=FileSystem.GetFolder(path)
For Each i In f.SubFolders
thisid=newid
thisstate=2
thispath=adspath & "/" & i.Name
SetJscriptObj i.Name,thispath, parentid, vtype, thisstate, true,i, false
if err=0 then
addDirs i, thispath, thisid, "dir"
end if
Next
End If
end if
end if
end if
End Sub
Sub SetJscriptObj(caption, path, parentid, vtype,state, cached,fspath,isApp)
%>
nodeList[<%= newid %>]=nodeList[<%= parentid %>].addNode(new top.title.listObj(<%= newid %>,"<%= caption %>","<%= path %>","<%= vtype %>",<%= state %>));
<% if cached then %>
nodeList[<%= newid %>].isCached=true;
<% else %>
nodeList[<%= newid %>].isCached=false;
<% end if %>
<% if isApp then %>
nodeList[<%= newid %>].icon = Global.imagedir + "app";
nodeList[<%= newid %>].isApp = true;
<% end if %>
nodeList[<%= newid %>].fspath="<%= replace(fspath,"\","\\") %>";
<%
newid=newid +1
End Sub
Sub SetWorkingInstance(thisid)
%>
nodeList[<%= thisid %>].isWorkingServer=true;
<%
End Sub
%>
markTerms();
</script>
</head>
<body text="#FFFFFF" bgcolor="<%= bgcolor %>" topmargin="0" leftmargin="0" onload="loadPage();">
<table width="100%" cellpadding="0" cellspacing="0" border="0" align="LEFT">
<tr>
<td bgcolor="#000000"> <img src="images/ismhd.gif" vspace="7" border="0" alt="<%= L_ISM_TEXT %>" width="285" height="15"></td>
<td align="right" bgcolor="#000000" valign="middle"><font color="#FFFFFF">
<a href="javascript:aboutBox()"><img height="16" width="16" src="images/about.gif" alt="<%= L_ABOUT_TEXT %>" border="0" vspace="3" hspace="4"></a>
<a href="http://<%= Request.ServerVariables("SERVER_NAME") %>/iishelp/iis/misc/" target="window"><img height="16" width="16" src="images/doc.gif" alt="<%= L_DOCS_TEXT %>" border="0" vspace="3" hspace="4"></a>
<a href="javascript:helpBox();"><img height="16" width="16" src="images/help.gif" border="0" vspace="3" hspace="4" alt="<%= L_HELP_TEXT %>"></a>
<a href="http://www.microsoft.com/" target="_parent"><img src="images/logo.gif" border="0" vspace="3" hspace="2" alt="<%= L_MICROSOFT_TEXT %>" width="80" height="15"></a></font>
</td>
</tr>
<% if (browser="ns") then %>
<tr>
<td bgcolor="#FFCC00" colspan="2"> </td>
</tr>
<% end if %>
</table>
<form name="hiddenform">
<input type="hidden" name="slash" value="\">
</form>
</body>
</html>