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