home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 September / CHIPCD_9_99.iso / software / uaktualnienia / OptionPackPL / iis4_02.cab / JSBrwTre.asp < prev    next >
Encoding:
Text File  |  1998-04-27  |  5.3 KB  |  200 lines

  1. <%@ LANGUAGE=VBScript %>
  2. <%Option Explicit %>
  3.  
  4. <!-- Document that displays the tree-structured TOC-->
  5. <% 
  6. Const L_CACHE_TEXT="Expand to cache"
  7. Const L_CONNECTED_TEXT="(connected)"
  8. Const L_EXPAND_TEXT="Expand Node"
  9. Const L_COLLAPSE_TEXT="Collapse Node"
  10. %>
  11.  
  12. <HTML>
  13. <BODY BGCOLOR="#FFFFFF" LINK="#000000" VLINK="#000000" ALINK="#000000">
  14.  
  15.  
  16. <SCRIPT LANGUAGE="JavaScript">
  17.     var theList=top.head.nodeList;
  18.     var gVars=top.head.Global;
  19.     var listLength=theList.length; 
  20.     document.write("<TABLE  WIDTH='" + gVars.tblWdith + "' BORDER=0><TR><TD>");
  21.  
  22.     for (i=0; i < listLength; i++) {
  23.         theParent=theList[i].parent;
  24.         theLevel=theList[i].level;
  25.  
  26.         if (theParent==null) {
  27.             writeSelected(theList[i].selected);    
  28.         }
  29.         else{
  30.             curParent=theParent;
  31.             isOpen=true;
  32.             while(isOpen){
  33.                 if (theList[curParent].parent==null){
  34.                     isOpen=(theList[curParent].open);
  35.  
  36.                     break;
  37.                 }
  38.                 if (!theList[curParent].open){
  39.                     isOpen=false;
  40.                     break;
  41.                 }
  42.                 curParent=theList[curParent].parent;
  43.             }
  44.  
  45.             if (isOpen){    
  46.  
  47.                 writeSelected(theList[i].selected);    
  48.             }
  49.         }
  50.  
  51.         
  52.     }
  53.     document.write("</TD></TR></TABLE>");
  54.     <% if not Session("IsIE") then %>
  55.         self.location.href = "iisrvls.asp#here"
  56.     <% end if %>
  57.  
  58.     function writeSelected(isSelected){
  59.         writeStr = "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD>";
  60.  
  61.         for (x=1; x < theLevel; x++) {
  62.  
  63.             gParent=getGrandParent(i,theLevel-x)
  64.             if (theList[gParent].lastChild){
  65.                 writeStr += "<IMAGE SRC='"+gVars.spaceImg+"' WIDTH=16>";
  66.             }
  67.             else{        
  68.                 writeStr += "<IMAGE SRC='"+gVars.lineImg+"' WIDTH=16>";
  69.             }
  70.         }
  71.  
  72.         writeStr += "</TD><TD>";
  73.  
  74.         if (((i+1) < listLength) && (theList[i+1].parent==i) && (!theList[i+1].deleted) || (!theList[i].isCached)) {
  75.             if (theList[i].open){
  76.                 writeStr += "<A HREF='javascript:expand("+i+")'><IMAGE SRC='";
  77.                 if (!theList[i].lastChild){
  78.                     writeStr += gVars.minusImg;    
  79.                 }
  80.                 else{
  81.                     writeStr += gVars.minusImgLast;    
  82.                 }
  83.                 writeStr += "' WIDTH=16 HEIGHT=18 Border=0 ALT='<%= L_COLLAPSE_TEXT %>'></A>";
  84.             }
  85.             else{
  86.                 writeStr += "<A HREF='javascript:expand("+i+")'><IMAGE SRC='";
  87.                 if (!theList[i].lastChild){
  88.                 writeStr += gVars.plusImg;
  89.                 }
  90.                 else{
  91.                     writeStr += gVars.plusImgLast;
  92.                 }
  93.                 writeStr += "' WIDTH=16 HEIGHT=18  Border=0 ALT='<%= L_EXPAND_TEXT %>'></A>";
  94.             }
  95.         }
  96.         else{
  97.             writeStr += "<IMAGE SRC='";
  98.             if (theList[i].lastChild){
  99.                 writeStr += gVars.emptyImgLast;    
  100.             }
  101.             else{
  102.                 writeStr += gVars.emptyImg;    
  103.             }
  104.             writeStr += "' WIDTH=16 HEIGHT=18 Border=0>";            
  105.         }
  106.  
  107.         writeStr += "</TD>";
  108.  
  109.  
  110.         if (isSelected){
  111.             writeStr += "<TD><A NAME='here'></A><A HREF='javascript:editItem("+i+")'>";
  112.             if (theList[i].icon !=""){
  113.  
  114.                 if (theList[i].isCached){
  115.                     writeStr += "<IMAGE BORDER=0 SRC='"+theList[i].icon+theList[i].state+".gif'><IMAGE BORDER=0 SRC='"+gVars.spaceImg+"' HSPACE="+gVars.hSpace+"></TD>";
  116.                 }
  117.                 else{
  118.                     writeStr += "<IMAGE BORDER=0 SRC='"+theList[i].icon+theList[i].state+".gif' ALT='<%= L_CACHE_TEXT %>'><IMAGE BORDER=0 SRC='"+gVars.spaceImg+"' HSPACE="+gVars.hSpace+"></TD>";
  119.                 }
  120.             }
  121.             writeStr += "</A></TD>";        
  122.             writeStr +=  "<TD BGCOLOR='"+gVars.selTColor+"'>";
  123.             writeStr += "<FONT FACE="+gVars.face+" SIZE="+gVars.fSize+" COLOR='"+gVars.selFColor+"'>";
  124.             writeStr += "<A HREF='javascript:editItem("+i+")'>";
  125.             writeStr += theList[i].title;
  126.             if (theList[i].vtype == "server"){writeStr += " " + gVars.displaystate[theList[i].state];}
  127.             writeStr += "</A></TD>";
  128.         }
  129.         else{
  130.             writeStr += "<TD><A HREF='javascript:selectItem("+i+")'>";
  131.             if (theList[i].icon !=""){
  132.                 if (theList[i].isCached){
  133.                     writeStr += "<IMAGE BORDER=0 SRC='"+theList[i].icon+theList[i].state+".gif'><IMAGE BORDER=0 SRC='"+gVars.spaceImg+"' HSPACE="+gVars.hSpace+"></TD>";
  134.                 }
  135.                 else{
  136.                     writeStr += "<IMAGE BORDER=0 SRC='"+theList[i].icon+theList[i].state+".gif' ALT='<%= L_CACHE_TEXT %>'><IMAGE BORDER=0 SRC='"+gVars.spaceImg+"' HSPACE="+gVars.hSpace+"></TD>";
  137.                 }
  138.             }
  139.             writeStr += "</A></TD>";
  140.             
  141.             writeStr += "<TD>";
  142.             writeStr += "<FONT FACE="+gVars.face+" SIZE="+gVars.fSize+" COLOR='"+gVars.selFColor+"'>";
  143.             writeStr += "<A HREF='javascript:selectItem("+i+")'>";
  144.             writeStr += theList[i].title;
  145.             if (theList[i].vtype == "server"){writeStr += " " + gVars.displaystate[theList[i].state];}
  146.             writeStr += "</A></TD>";
  147.         }
  148.  
  149.  
  150.         writeStr += "</TR></TABLE>";
  151.         
  152.         document.write(writeStr);
  153.     }
  154.  
  155.     function getGrandParent(item,numLevels){
  156.         var theItem=item;
  157.         for (z=0; z < numLevels; z++) {
  158.             theItem=theList[theItem].parent;    
  159.         }
  160.         
  161.         return theItem;
  162.     }
  163.  
  164.     function expand(item){
  165.         if (theList[item].isCached){
  166.             theList[item].open=!(theList[item].open);
  167.             selectItem(item);
  168.             self.location.href=self.location.href;
  169.         }
  170.         else{
  171.             theList[gVars.selId].selected=false;
  172.             gVars.selId=item;
  173.             theList[item].selected=true;
  174.             theList[item].cache(item);
  175.         }
  176.         
  177.     }
  178.  
  179.     function selectItem(item){
  180.             
  181.             theList[gVars.selId].selected=false;
  182.             gVars.selId=item;
  183.             theList[item].selected=true;
  184.             
  185.             <% if Session("Browser") = "IE3" then %>        
  186.                 self.location.href="iisrvls.asp#here";
  187.             <% else %>
  188.                 self.location.href="iisrvls.asp";            
  189.             <% end if %>
  190.             
  191.     }
  192.  
  193.     function editItem(item){
  194.         theList[item].openLocation();
  195.     }
  196.     
  197. </SCRIPT>
  198. </BODY>
  199. </HTML>
  200.