home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 July / Chip_2000-07_cd.bin / servis / SPNT / sp6x86.exe / iimltihd.asp < prev    next >
Encoding:
Text File  |  1999-12-15  |  8.7 KB  |  368 lines

  1. <%@ LANGUAGE=VBScript %>
  2. <%'Option Explicit %>
  3. <% Response.Expires = 0 %>
  4.  
  5. <% if Session("FONTSIZE") = "" then %>
  6.     <!--#include file="iito.inc"-->
  7. <% else %>
  8.  
  9. <% 
  10. Const L_MULTIPLE_TEXT="Multiple identities for this web site."
  11. Const L_IPADDRESS_TEXT="IP Address"
  12. Const L_IPPORT_TEXT="TCP Port"
  13. Const L_SSLPORT_TEXT="SSL Port"
  14. Const L_HOST_TEXT="Host Header Name"
  15. Const L_ACCESSDENIED_TEXT="Access Denied"
  16. Const L_SELECTITEM_TEXT="Please select an item to delete."
  17. dim listSort
  18.  
  19. listSort = Session("ListSort")
  20.  
  21. function heading(width,thestring,sortstr)
  22.     dim i
  23.     width = width - len(thestring)
  24.     for i = width to 0 step -1
  25.         thestring = thestring & " "
  26.     Next
  27.  
  28.     if listSort and (sortstr <> "") then
  29.         thestring = "<A HREF = " & quote & "javascript:sortList('"& sortstr & "');" & quote & ">" & thestring & "</A>"
  30.     end if
  31.     
  32.     heading = thestring
  33. end function
  34. %>
  35.  
  36. <HTML>
  37. <HEAD>
  38.     <TITLE></TITLE>
  39. </HEAD>
  40.  
  41. <BODY BGCOLOR="#CCCCCC" LINK="#000000" VLINK="#000000" ALINK="navy" TOPMARGIN=10 TEXT="#000000" onLoad="loadList();loadHelp();">
  42. <FORM NAME="userform">
  43.  
  44. <TABLE WIDTH=490 BORDER=0>
  45.     <TR>
  46.         <TD COLSPAN=3 STYLE="font-face: Helv,Arial; font-size:10pt;">
  47.             <FONT FACE="Helv,Arial" SIZE=1>
  48.                 <%= L_MULTIPLE_TEXT %>
  49.                 <BR> 
  50.             </FONT>
  51.         </TD>
  52.     </TR>
  53. </TABLE>
  54.  
  55. <TABLE BORDER=1  BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#CCCCCC" BORDERCOLORLIGHT="#CCCCCC" CELLSPACING=0 CELLPADDING=2>
  56. <TR>
  57. <TD BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" STYLE="font-face: Helv,Arial; font-size:10pt;">
  58. <FONT FACE="Helv,Arial" SIZE=1>
  59.     <% if Session("FONTSIZE")="LARGE" then %>
  60.         <%= heading(36,L_IPADDRESS_TEXT, "ipaddress") %>
  61.     <% else %>
  62.         <%= heading(28,L_IPADDRESS_TEXT, "ipaddress") %>    
  63.     <% end if %>
  64.     </FONT>
  65. </TD>
  66. <TD  BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" STYLE="font-face: Helv,Arial; font-size:10pt;">
  67. <FONT FACE="Helv,Arial" SIZE=1>
  68.     <% if Session("FONTSIZE")="LARGE" then %>
  69.         <%= heading(8,L_IPPORT_TEXT, "ipport") %>
  70.     <% else %>
  71.         <%= heading(7,L_IPPORT_TEXT, "ipport") %>    
  72.     <% end if %>        
  73.     </FONT>
  74. </TD>
  75. <TD  BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" STYLE="font-face: Helv,Arial; font-size:10pt;">
  76. <FONT FACE="Helv,Arial" SIZE=1>
  77.     <% if Session("FONTSIZE")="LARGE" then %>
  78.         <%= heading(8,L_SSLPORT_TEXT, "sslport") %>
  79.     <% else %>
  80.         <%= heading(10,L_SSLPORT_TEXT, "sslport") %>    
  81.     <% end if %>
  82.     </FONT>    
  83. </TD>
  84. <TD  BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" STYLE="font-face: Helv,Arial; font-size:10pt;">
  85. <FONT FACE="Helv,Arial" SIZE=1>
  86.         <% if Session("FONTSIZE")="LARGE" then %>
  87.             <%= heading(40,L_HOST_TEXT, "host") %>
  88.         <% else %>
  89.             <%= heading(30,L_HOST_TEXT, "host") %>
  90.         <% end if %>
  91.     </FONT>    
  92. </TD>
  93. </TR>
  94. </TABLE>
  95. </FORM>
  96.  
  97. <FORM name="hiddenform">
  98.     <INPUT TYPE="hidden" NAME="index" VALUE=0>
  99.     <INPUT TYPE="hidden" NAME="MustDisplayFirstTime" VALUE=0>
  100. </FORM>
  101. </BODY>
  102. <SCRIPT LANGUAGE="JavaScript">
  103.  
  104.  
  105.     function loadHelp(){
  106.         top.title.Global.helpFileName="iipy_27";
  107.     }
  108.  
  109.     function loadList(){
  110.         parent.list.location.href="iimltils.asp";
  111.     }
  112.  
  113.     function addItem(){
  114.         i=cachedList.length
  115.         listFunc.noupdate = true;    
  116.         cachedList[i]=new listObj(i,"","","","");
  117.         cachedList[i].newitem=true;
  118.         cachedList[i].updated=true;
  119.         document.hiddenform.index.value=i;
  120.         document.hiddenform.MustDisplayFirstTime.value=1;
  121.         loadList();
  122.     }
  123.  
  124.     function delItem(){
  125.  
  126.         if (document.hiddenform.index.value >= 0){
  127.             i=eval(document.hiddenform.index.value);
  128.             listFunc.noupdate = true;                
  129.             cachedList[i].deleted=true;
  130.             cachedList[i].updated=true;
  131.              i=i-1;
  132.             <% 'run through the list to find the Next non-deleted item %>
  133.             for (var j=i; j >=0; j--) {
  134.  
  135.                 if (cachedList[j].deleted){
  136.                 }
  137.                 else{
  138.                     break            
  139.                 }
  140.             }    
  141.  
  142.             document.hiddenform.index.value=j;
  143.  
  144.             document.hiddenform.MustDisplayFirstTime.value=0;
  145.  
  146.             loadList();
  147.         }
  148.         else{
  149.             alert("<%= L_SELECTITEM_TEXT %>");
  150.         }
  151.     }
  152.     
  153.     function setLastSel(id){
  154.         for (var i=0; i < cachedList.length; i++) {
  155.             if (cachedList[i].id == id){
  156.                 document.hiddenform.index.value = i;
  157.                 return;
  158.             }
  159.         }
  160.         
  161.     }
  162.  
  163.     function sortList(sortby)
  164.         {
  165.         
  166.         i=eval(document.hiddenform.index.value);
  167.         if ( i != -1)
  168.         {
  169.             lastsel = cachedList[i].id
  170.         }
  171.         
  172.         if (sortby != listFunc.sortby)
  173.             {
  174.             listFunc.sortby = sortby;
  175.             listFunc.sortAsc = true;
  176.             }
  177.         else
  178.             {
  179.             listFunc.sortAsc = !listFunc.sortAsc;
  180.             }
  181.             
  182.         var num = parseFloat(cachedList[sortby]);
  183.         
  184.         if (isNaN(num))
  185.             {
  186.             cachedList.sort(sortOrder);
  187.             }
  188.         else
  189.             { 
  190.             cachedList.sort(numOrder);
  191.             }
  192.         if ( i != -1)
  193.         {
  194.             setLastSel(lastsel);
  195.         }
  196.         loadList();
  197.         }
  198.  
  199.     function sortOrder(a,b)
  200.     {
  201.  
  202.         
  203.         if (listFunc.sortAsc){
  204.             astr = a["isSecure"] + a[listFunc.sortby];
  205.             bstr = b["isSecure"] + b[listFunc.sortby];
  206.             
  207.             if (astr.toLowerCase() < bstr.toLowerCase()){
  208.                 return -1;
  209.             }
  210.             else{
  211.                 if (astr.toLowerCase() > bstr.toLowerCase()){
  212.                     return 1;
  213.                 }
  214.                 else{
  215.                     return 0;
  216.                 }
  217.             }            
  218.         }
  219.         else{
  220.             astr = !a["isSecure"] + a[listFunc.sortby];
  221.             bstr = !b["isSecure"] + b[listFunc.sortby];
  222.             
  223.             if (astr.toLowerCase() < bstr.toLowerCase()){
  224.                 return 1;
  225.             }
  226.             else{
  227.                 if (astr.toLowerCase() > bstr.toLowerCase()){
  228.                     return -1;
  229.                 }
  230.                 else{
  231.                     return 0;
  232.                 }
  233.             }
  234.         }
  235.     }
  236.     
  237.     function reSort(){
  238.         //set our sortAsc so we aren't just reversing the list...
  239.         listFunc.sortAsc = !listFunc.sortAsc;
  240.         sortList(listFunc.sortby);
  241.     }
  242.     
  243.     function buildListForm(){
  244.         numrows=0;
  245.         for (var i=0; i < cachedList.length; i++) {
  246.             numrows=numrows + 1;
  247.         }
  248.         qstr="numrows="+numrows;
  249.         qstr=qstr+"&cols=ServerBindings&cols=SecureBindings"
  250.  
  251.         top.hlist.location.href="iihdn.asp?"+qstr;
  252.         <% 'the list values will be grabbed by the hiddenlistform script... %>
  253.     }
  254.  
  255.     function SetListVals(){
  256.         listForm=top.hlist.document.hiddenlistform;
  257.         j=0;
  258.         var bindings = "";
  259.         first=true;
  260.         for (var i=0; i < cachedList.length; i++) {
  261.             if (!cachedList[i].deleted){
  262.                 if (first)
  263.                 {
  264.                     top.opener.document.userform.hdnPort.value= cachedList[i].ipport;
  265.                     top.opener.document.userform.hdnIPA.value= cachedList[i].ipaddress;
  266.                     top.opener.document.userform.hdnHost.value= cachedList[i].host;
  267.                     first = false;
  268.                 }
  269.                 if (cachedList[i].sslport != ""){    
  270.                     listForm.elements[j++].value="";
  271.                     listForm.elements[j++].value=cachedList[i].ipaddress+":"+cachedList[i].sslport +":"+cachedList[i].host;
  272.                 }
  273.                 else{
  274.                     bindings += (cachedList[i].ipaddress+":"+cachedList[i].ipport+":"+cachedList[i].host + ",");
  275.                     listForm.elements[j++].value=cachedList[i].ipaddress+":"+cachedList[i].ipport+":"+cachedList[i].host;
  276.                     listForm.elements[j++].value="";
  277.                 }
  278.             }
  279.             cachedList[i].updated=false; 
  280.         }
  281.         top.opener.document.userform.ServerBindings.value = bindings
  282.  
  283.     }
  284.  
  285.     function listFuncs(){
  286.         this.bHasList = true;
  287.         this.sortList = sortList;
  288.         this.reSort = reSort;        
  289.         this.sortby = "ipaddress";
  290.         this.sortAsc = true;
  291.         this.addItem=addItem;
  292.         this.delItem=delItem;
  293.         this.writeList=buildListForm;
  294.         this.SetListVals=SetListVals;
  295.         this.mainframe = top.opener.top;        
  296.         this.lastSel = 0;
  297.         this.noupdate = false;
  298.     }
  299.  
  300.     function listObj(id,ia,ip,sp,hn){
  301.         this.id = id;
  302.         this.isSecure = (sp != "");
  303.         this.ipaddress=ia;
  304.         this.ipport=ip;
  305.         this.sslport=sp;
  306.         this.host=hn;
  307.         this.deleted=false;
  308.         this.newitem=false;
  309.         this.updated=false;
  310.     }
  311.     listFunc=new listFuncs();
  312.     cachedList=new Array()
  313.  
  314. <!--#include file="iibind.inc"-->
  315.         
  316. <%  
  317.  
  318.     On Error Resume Next 
  319.  
  320.     Dim path, currentobj
  321.     Dim aBinding, ssl, arraybound, Binding, SecureBinding
  322.     Dim barraysize, added, i, j, nexti
  323.     
  324.     path=Session("spath")
  325.     Session("path")=path
  326.     Session("SpecObj")=path
  327.     Session("SpecProps")="ServerBindings"    
  328.     Set currentobj=GetObject(path)
  329.  
  330.  
  331.      Redim aBinding(UBound(currentobj.ServerBindings))
  332.      Redim ssl(UBound(currentobj.SecureBindings))    
  333.     
  334.     aBinding=currentobj.ServerBindings
  335.     ssl=currentobj.SecureBindings
  336.  
  337.     if not IsArray(ssl) then
  338.         ssl=Array(1)
  339.         ssl(0)=currentobj.SecureBindings
  340.     end if
  341.  
  342.     nexti=0
  343.     arraybound=UBound(aBinding)
  344.     if aBinding(0) = "" then
  345.         aBinding(0) = ":80:"
  346.     end if
  347.     for i=0 to arraybound
  348.         Binding=getBinding(aBinding(i))
  349.          %>cachedList[<%= i %>]=new listObj(<%= i %>,"<%= Binding(0) %>","<%= Binding(1) %>","","<%= Binding(2) %>");<%          
  350.     Next
  351.     nexti = i
  352.  
  353.     arraybound=UBound(ssl)
  354.     for each secitem in ssl
  355.         SecureBinding=getBinding(secitem)
  356.         %>cachedList[<%= nexti %>]=new listObj(<%= nexti %>,"<%= SecureBinding(0) %>","","<%= SecureBinding(1) %>","<%= SecureBinding(2) %>");<%  
  357.         nexti=nexti + 1    
  358.     Next
  359.  %>
  360.  
  361.  
  362.  
  363.  
  364. </SCRIPT>
  365.  
  366. </HTML>
  367.  
  368. <% end if %>