home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / ins.cab / nnadvls.asp < prev    next >
Text File  |  1997-10-12  |  8KB  |  310 lines

  1. <!-- Document that displays the tree-structured TOC-->
  2. <%
  3. L_CACHE_TEXT = "This server is not cached. Expand to load"
  4. L_CONNECTED_TEXT = "(connected)"
  5. L_EXPAND_TEXT = "Expand Node"
  6. L_COLLAPSE_TEXT = "Collapse Node"
  7. %>
  8.  
  9. <HTML>
  10. <HEAD>
  11. <script language="Javascript">
  12.  
  13.  
  14.     function writeSelected(isSelected)
  15.     {
  16.         document.write("<TABLE BORDER = 0 CELLPADDING = 0 CELLSPACING=0><TR><TD>");
  17.  
  18.         for (x=1; x < theLevel; x++)
  19.         {
  20.  
  21.             gParent = getGrandParent(i,theLevel-x)
  22.             if (theList[gParent].lastChild)
  23.             {
  24.                 document.write("<IMAGE SRC='"+gVars.spaceImg+"' WIDTH = 16>");
  25.             }
  26.             else
  27.             {        
  28.                 document.write("<IMAGE SRC='"+gVars.lineImg+"' WIDTH = 16>");
  29.             }
  30.         }
  31.  
  32.         document.write("</TD><TD>");
  33.  
  34.         if (((i+1) < listLength) && (theList[i+1].parent == i) && (!theList[i+1].deleted) || (!theList[i].isCached)) 
  35.         {
  36.             if (theList[i].open)
  37.             {
  38.                 document.write("<A HREF='javascript:expand("+i+")'><IMAGE SRC='");
  39.                 if (!theList[i].lastChild)
  40.                 {
  41.                     document.write(gVars.minusImg);    
  42.                 }
  43.                 else
  44.                 {
  45.                     document.write(gVars.minusImgLast);    
  46.                 }
  47.                 document.write("' WIDTH =16 HEIGHT=18 Border = 0 ALT='<%=L_COLLAPSE_TEXT%>'></A>");
  48.             }
  49.             else
  50.             {
  51.                 document.write("<A HREF='javascript:expand("+i+")'><IMAGE SRC='");
  52.                 if (!theList[i].lastChild)
  53.                 {
  54.                 document.write(gVars.plusImg);
  55.                 }
  56.                 else
  57.                 {
  58.                     document.write(gVars.plusImgLast);
  59.                 }
  60.                 document.write("' WIDTH =16 HEIGHT=18  Border = 0 ALT='<%=L_EXPAND_TEXT%>'></A>");
  61.             }
  62.         }
  63.         else{
  64.             if (theList[i].lastChild)
  65.             {
  66.                 document.write("<IMAGE SRC='");
  67.                 document.write(gVars.emptyImgLast);    
  68.                 document.write("' WIDTH =16 HEIGHT=18 Border = 0>");
  69.             }
  70.             else
  71.             {
  72.                 document.write("<IMAGE SRC='");
  73.                 document.write(gVars.emptyImg);    
  74.                 document.write("' WIDTH =16 HEIGHT=18 Border = 0>");
  75.             }
  76.         }
  77.  
  78.         document.write("</TD>");
  79.  
  80.     <% REM ##################################################### %>
  81.     
  82.     <% REM Builds the links and images for each node in the tree %>
  83.  
  84.     <% REM ##################################################### %>
  85.  
  86.         if (isSelected)
  87.         {
  88.             document.write("<TD><A HREF='javascript:editItem("+i+")'>");
  89.             if (theList[i].icon != "")
  90.             {
  91.                 if ((theList[i].icon == "images/slidroff") || (theList[i].icon == "images/slidersp") || (theList[i].icon == "images/slidrend") || (theList[i].icon == "images/slideron"))
  92.                 {
  93.                     thisImageState = "";
  94.                 }
  95.                 else
  96.                 {
  97.                     <% REM if the server state is paused ("6") then set the imagestate to 3 %>
  98.                     <% REM the gif name for paused is suffixed with a "3"                   %>
  99.  
  100.                     if(theList[i].state == 6)
  101.                     {
  102.                         thisImageState = 3;
  103.                     }
  104.                     else
  105.                     {
  106.                         thisImageState = theList[i].state;
  107.                     }
  108.                 }
  109.                 if (theList[i].isCached)
  110.                 {
  111.                     document.write("<IMAGE BORDER=0 SRC='"+theList[i].icon+thisImageState+".gif'><IMAGE BORDER = 0 SRC='"+gVars.spaceImg+"' HSPACE="+gVars.hSpace+"></TD>");
  112.                 }
  113.                 else
  114.                 {
  115.                     document.write("<IMAGE BORDER=0 SRC='"+theList[i].icon+thisImageState+".gif' ALT='<%=L_CACHE_TEXT%>'><IMAGE BORDER=0 SRC='"+gVars.spaceImg+"' HSPACE="+gVars.hSpace+"></TD>");
  116.                 }
  117.             }
  118.             document.write("</A></TD>");
  119.         
  120.             document.write("<TD BGCOLOR='"+gVars.selTColor+"'>");
  121.             document.write("<FONT FACE="+gVars.face+" SIZE="+gVars.fSize+" COLOR='"+gVars.selFColor+"'>");
  122.             document.write("<A HREF='javascript:editItem("+i+")'>");
  123.             document.write(theList[i].title);
  124.             if (theList[i].isWorkingServer)
  125.             {
  126.                 document.write(" <%=L_CONNECTED_TEXT%>");
  127.             }
  128.             document.write("</A></TD>");
  129.         }
  130.         else
  131.         {
  132.             document.write("<TD><A HREF='javascript:selectItem("+i+")'>");
  133.             if (theList[i].icon != "")
  134.             {
  135.                 if ((theList[i].icon == "images/slidroff") || (theList[i].icon == "images/slidersp") || (theList[i].icon == "images/slidrend") || (theList[i].icon == "images/slideron"))
  136.                 {
  137.                     thisImageState = "";
  138.                 }
  139.                 else
  140.                 {
  141.                     <% REM if the server state is paused ("6") then set the imagestate to 3 %>
  142.                     <% REM the gif name for paused is suffixed with a "3"                   %>
  143.  
  144.                     if(theList[i].state == 6)
  145.                     {
  146.                         thisImageState = 3;
  147.                     }
  148.                     else
  149.                     {
  150.                         thisImageState = theList[i].state;
  151.                     }
  152.                 }
  153.  
  154.                 if (theList[i].isCached)
  155.                 {
  156.                     document.write("<IMAGE BORDER = 0 SRC='"+ theList[i].icon + thisImageState + ".gif'><IMAGE BORDER=0 SRC='" + gVars.spaceImg + "' HSPACE=" + gVars.hSpace + "></TD>");
  157.                 }
  158.                 else
  159.                 {
  160.                     document.write("<IMAGE BORDER = 0 SRC='"+ theList[i].icon + thisImageState + ".gif' ALT = '<%=L_CACHE_TEXT%>'><IMAGE BORDER=0 SRC='" + gVars.spaceImg+"' HSPACE=" + gVars.hSpace + "></TD>");
  161.                 }
  162.             }
  163.             document.write("</A></TD>");
  164.             
  165.             document.write("<TD>");
  166.             document.write("<FONT FACE="+gVars.face+" SIZE="+gVars.fSize+" COLOR='"+gVars.selFColor+"'>");
  167.             document.write("<A HREF='javascript:selectItem("+i+")'>");
  168.             document.write(theList[i].title);
  169.             if (theList[i].isWorkingServer)
  170.             {
  171.                 document.write(" <%=L_CONNECTED_TEXT%>");
  172.             }
  173.             document.write("</A></TD>");
  174.         }
  175.  
  176.  
  177.         document.write("</TR></TABLE>");
  178.     }
  179.  
  180. function getGrandParent(item,numLevels)
  181. {
  182.     var theItem = item;
  183.     for (z=0; z < numLevels; z++) 
  184.     {
  185.         theItem = theList[theItem].parent;    
  186.     }
  187.         
  188.     return theItem;
  189. }
  190.  
  191. function expand(item)
  192. {
  193.     if (theList[item].isCached)
  194.     {
  195.         theList[item].open = !(theList[item].open);
  196.         selectItem(item);
  197.         self.location.href=self.location.href;
  198.     }
  199.     else
  200.     {
  201.  
  202.         theList[item].cache(item);
  203.     }
  204.         
  205. }
  206.  
  207.  
  208. function selectItem(item)
  209. {
  210.     if (theList[item].isCached)
  211.     {
  212.         theList[gVars.selId].selected = false;
  213.         gVars.selId = item;
  214.         theList[item].selected = true;
  215.         self.location.href=self.location.href;
  216.     }
  217.     else
  218.     {
  219.         theList[item].cache(item);
  220.     }
  221. }
  222.  
  223. function editItem(item)
  224. {
  225.     theList[item].openLocation();
  226. }
  227.  
  228.  
  229. function printList()
  230. {
  231.         document.write("<TABLE><TR>");
  232.         document.write("<TD>ID  ");
  233.         document.write("<TD>Title  ");
  234.         document.write("<TD>Parent  ");
  235.         document.write("<TD>Level  ");
  236.         document.write("<TD>isOpen  ");
  237.         document.write("<TD>lastChild  ");
  238.         document.write("</TR>");
  239.     for (var i = 0; i < theList.length; i++) 
  240.     {
  241.         document.write("<TR>")
  242.         document.write("<TD>"+theList[i].id + "  ");
  243.         document.write("<TD>"+theList[i].title+ "  ");
  244.         document.write("<TD>"+theList[i].parent+ "  ");
  245.         document.write("<TD>"+theList[i].level+ "  ");
  246.         document.write("<TD>"+theList[i].open+ "  ");
  247.         document.write("<TD>"+theList[i].lastChild+ "  <P>");
  248.         document.write("</TR>");
  249.     }
  250.     document.write("</TABLE>");
  251. }
  252.  
  253.  
  254. </script>
  255. <BODY BGCOLOR="#FFFFFF" LINK="#000000">
  256.  
  257. <SCRIPT LANGUAGE="JavaScript">
  258.     var theList = top.head.cList;
  259.     var gVars = top.head.Global;
  260.     var listLength = theList.length; 
  261.     document.write("<TABLE BORDER = 0 WIDTH ="+gVars.tblWidth+" ><TR><TD WIDTH =100%>");
  262.  
  263.     for (i=0; i < listLength; i++) 
  264.     {
  265.         if (!theList[i].deleted)
  266.         {
  267.             theParent = theList[i].parent;
  268.             theLevel = theList[i].level;
  269.     
  270.             if (theParent == null) 
  271.             {
  272.                 writeSelected(theList[i].selected);    
  273.             }
  274.             else{
  275.                 curParent = theParent;
  276.                 isOpen = true;
  277.                 while(isOpen)
  278.                 {
  279.                     if (theList[curParent].parent == null)
  280.                     {
  281.                         isOpen =  (theList[curParent].open);
  282.     
  283.                         break;
  284.                     }
  285.                     if (!theList[curParent].open)
  286.                     {
  287.                         isOpen = false;
  288.                         break;
  289.                     }
  290.                     curParent = theList[curParent].parent;
  291.                 }
  292.     
  293.                 if (isOpen)
  294.                 {    
  295.     
  296.                     writeSelected(theList[i].selected);    
  297.                 }
  298.             }
  299.         }
  300.  
  301.         
  302.     }
  303.  
  304.     document.write("</TD></TR></TABLE>");
  305.  
  306.  
  307. </SCRIPT>
  308. </BODY>
  309. </HTML>
  310.