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