home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 9 / IOPROG_9.ISO / contrib / iis4 / iis4_03.cab / iiamaphd.asp < prev    next >
Encoding:
Text File  |  1997-09-05  |  7.6 KB  |  355 lines

  1. <%@ LANGUAGE=VBScript%>
  2. <% Option Explicit %>
  3.  
  4. <% 
  5. Const L_ENTERINTEGER_ERRORMESSAGE = "Please enter an integer"
  6. Const L_APPMAPP_TEXT = "Application Mappings"
  7. Const L_CACHEISAPI_TEXT = "Cache ISAPI Applications"
  8. Const L_EXTENSION_TEXT = "Ext"
  9. Const L_EXEPATH_TEXT = "Executable Path"
  10. Const L_EXCLUSIONS_TEXT = "Exclusions"
  11. Const L_SCRIPTENGINE_TEXT = "Script Engine"
  12. Const L_CHKFILE_TEXT = "Check that file exists" 
  13. Const L_SELECTITEM_TEXT="Select a application mapping to delete."
  14.  
  15. Const L_LOADED_TEXT = "Loaded"
  16. Const L_LOADING_TEXT = "Loading"
  17. Const L_UNLOADED_TEXT = "Unloaded"
  18. Const L_UNLOADING_TEXT = "Unloading"
  19.  
  20.  
  21.  
  22. On Error Resume Next 
  23.  
  24. dim path, currentobj
  25.  
  26. path = Session("dpath")
  27. Session("path") = path
  28. Set currentobj = GetObject(path)
  29.  
  30. Session("SpecObj")=""
  31. Session("SpecProps")=""
  32.  
  33. function heading(width,thestring)
  34.     dim i
  35.     width = width - len(thestring)
  36.     for i = width to 0 step -1
  37.         thestring = thestring & " "
  38.     Next
  39.     heading = thestring
  40. end function
  41.  
  42.  %>
  43.  
  44. <!--#include file="iiset.inc"-->
  45.  
  46. <HTML>
  47. <HEAD>
  48.     <TITLE></TITLE>
  49.     <FONT SIZE=1 FACE="Helv">
  50.  
  51. <SCRIPT LANGUAGE="JavaScript">
  52.     function loadHelp(){
  53.         top.head.Global.helpFileName="iipy_34";
  54.     }
  55.  
  56.  
  57.     function SetList(){
  58.         self.location.href = "iiapphd.asp"
  59.     }
  60.  
  61.     function isNum(txtcntrl) {
  62.         str = txtcntrl.value;
  63.         for (var i = 0; i < str.length; i++) {
  64.               var ch = str.substring(i, i + 1);
  65.               if ((ch < "0" || "9" < ch) && ch != ',') {
  66.                    alert("Please enter an integer.");
  67.                 txtcntrl.focus()
  68.             return false;
  69.               }
  70.          }
  71.         return true;
  72.     }
  73.     
  74.  
  75.  
  76.     function disableDefault(dir,fromCntrl, toCntrl){
  77.         if (!dir){
  78.             if (fromCntrl.value != ""){
  79.                 toCntrl.value = fromCntrl.value;
  80.                 fromCntrl.value = "";
  81.             }
  82.         }
  83.         else{
  84.             if (toCntrl.value != ""){
  85.                 fromCntrl.value = toCntrl.value;
  86.                 toCntrl.value = "";
  87.             }
  88.         }
  89.     }
  90.  
  91.     function enableDefault(chkCntrl){
  92.         chkCntrl.checked = true;
  93.     }
  94.  
  95. </SCRIPT>
  96. </HEAD>
  97.  
  98. <BODY BGCOLOR="#CCCCCC" TOPMARGIN=5 TEXT="#000000" onLoad="loadList();loadHelp();" LINK="#000000" VLINK="#000000" STYLE="font-face: Helv; font-size: 8pt;">
  99. <B><%= L_APPMAPP_TEXT %></B><P>
  100.  
  101. <FORM NAME="userform" onSubmit="return false"><FONT SIZE=1 FACE="Helv">
  102.  
  103. <%= L_CACHEISAPI_TEXT %><P>
  104.  
  105. <TABLE BORDER = 1 BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#CCCCCC" BORDERCOLORLIGHT="#CCCCCC"  CELLPADDING = 2 CELLSPACING = 0>
  106. <TR>
  107. <TD WIDTH = 25 BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000"><FONT SIZE=1 FACE='HELV'>
  108.     <A HREF = "javascript:sortList('ext');">
  109.         <%= heading(9,L_EXTENSION_TEXT) %>
  110.     </A>
  111. </TD>
  112. <TD WIDTH = 125 BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000"><FONT SIZE=1 FACE='HELV'>
  113.     <A HREF = "javascript:sortList('path');">
  114.         <%= heading(9,L_EXEPATH_TEXT) %>
  115.     </A>
  116. </TD>
  117. <TD WIDTH = 80 BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" ><FONT SIZE=1 FACE='HELV'>
  118.     <A HREF = "javascript:sortList('exclusions');">
  119.         <%= heading(15,L_EXCLUSIONS_TEXT) %>
  120.     </A>
  121. </TD>
  122. <TD WIDTH = 75 BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000"><FONT SIZE=1 FACE='HELV'>
  123.     <A HREF = "javascript:sortList('scripteng');">
  124.         <%= heading(10,L_SCRIPTENGINE_TEXT) %>
  125.     </A>
  126. </TD>
  127. <TD WIDTH = 125 BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000"><FONT SIZE=1 FACE='HELV'>
  128.     <A HREF = "javascript:sortList('checkfiles');">
  129.         <%= heading(10,L_CHKFILE_TEXT) %>
  130.     </A>
  131. </TD>
  132. </TR>
  133. </TABLE>
  134.  
  135. <SCRIPT LANGUAGE="JavaScript">
  136.  
  137.     function loadList(){
  138.     parent.list.location.href = "iiamapls.asp";
  139.     }
  140.  
  141.  
  142.     function sortList(sortby)
  143.         {
  144.         if (sortby != listFunc.sortby)
  145.             {
  146.             listFunc.sortby = sortby;
  147.             listFunc.sortAsc = true;
  148.             }
  149.         else
  150.             {
  151.             listFunc.sortAsc = !listFunc.sortAsc;
  152.             }
  153.  
  154.         var num = parseFloat(cachedList[sortby]);
  155.         if (isNaN(num))
  156.             {
  157.             cachedList.sort(sortOrder);
  158.             }
  159.         else
  160.             { 
  161.             cachedList.sort(numOrder);
  162.             }
  163.             
  164.         if (!listFunc.sortAsc)
  165.             {
  166.             cachedList.reverse();
  167.             }
  168.         loadList();
  169.         }
  170.  
  171.     function sortOrder(a,b)
  172.         {
  173.         if (a[listFunc.sortby] < b[listFunc.sortby])
  174.             {
  175.             return -1;
  176.             }
  177.         else
  178.             {
  179.             if (a[listFunc.sortby] > b[listFunc.sortby])
  180.                 {
  181.                 return 1;
  182.                 }
  183.             else
  184.                 {
  185.                 return 0;
  186.                 }
  187.             }
  188.         }
  189.  
  190.  
  191.     function addItem(){
  192.         i = cachedList.length   
  193.         cachedList[i] = new listObj("", "", 0, "");
  194.         cachedList[i].newitem = true;
  195.         cachedList[i].updated = true;
  196.         listFunc.sel = i;
  197.         loadList();
  198.     }
  199.  
  200.     function delItem(){
  201.         if (listFunc.sel >= 0){            
  202.             sel = eval(listFunc.sel);
  203.             cachedList[sel].deleted = true;
  204.             cachedList[sel].updated = true;
  205.             sel = sel-1;
  206.             
  207.             <% 'run through the list to find the Next non-deleted item %>
  208.             for (var j = sel; j >=0; j--) {
  209.                 if (cachedList[j].deleted){
  210.                 }
  211.                 else{
  212.                     break            
  213.                 }
  214.             }    
  215.             listFunc.sel = j;
  216.             loadList();
  217.         }
  218.         else{
  219.             alert("<%= L_SELECTITEM_TEXT %>");            
  220.         }
  221.     }
  222.     
  223.     function crop(thestring,size){
  224.         <% if Session("FONTSIZE") = "LARGE" then %>
  225.             size = size-10;
  226.         <% end if %>
  227.         if (thestring.length > size)
  228.             {
  229.             thestring = thestring.substring(0,size) + "...";
  230.             }
  231.         return thestring;
  232.         }        
  233.  
  234.     function buildListForm(){
  235.         numrows = 0;
  236.         for (var i = 0; i < cachedList.length; i++) {
  237.             if (!cachedList[i].deleted){        
  238.                 numrows = numrows + 1;
  239.             }
  240.         }
  241.         qstr = "numrows="+numrows;
  242.         qstr = qstr+"&cols=ScriptMaps";
  243.  
  244.         parent.parent.hlist.location.href = "iihdn.asp?"+qstr;
  245.         <% 'the list values will be grabbed by the hiddenlistform script... %>
  246.     }
  247.  
  248.     function SetListVals(){
  249.         listForm = parent.parent.hlist.document.hiddenlistform;    
  250.         j = 0;
  251.         for (var i = 0; i < cachedList.length; i++) {
  252.             sm = 0;
  253.             cf = 0;
  254.             if (!cachedList[i].deleted){
  255.                 str = cachedList[i].ext + ",";
  256.                 str += cachedList[i].path + ",";
  257.  
  258.                 if (cachedList[i].scripteng){
  259.                     sm = 1;
  260.                 }
  261.                 if (cachedList[i].checkfiles){
  262.                     cf = 4;
  263.                 }
  264.                 str += (sm + cf);
  265.                 
  266.                 if (cachedList[i].exclusions != ""){
  267.                     str +=  "," + cachedList[i].exclusions;
  268.                 }
  269.                 
  270.                 listForm.elements[j++].value = str;
  271.                 cachedList[i].updated = false;
  272.             }
  273.         }
  274.     }
  275.  
  276.     function listFuncs(){
  277.         this.sel = 0;
  278.         this.sortList = sortList;
  279.         this.sortby = "fname";
  280.         this.sortAsc = true;
  281.         this.addItem = addItem;
  282.         this.delItem = delItem;
  283.         this.writeList = buildListForm;
  284.         this.SetListVals = SetListVals;
  285.         this.mainframe = top.opener.top;        
  286.     }
  287.     
  288.  
  289.     function listObj(ext,p,f,e){
  290.         this.ext = ext;
  291.         this.displaypath = crop(p,18);
  292.         this.path = p;
  293.         this.exclusions=e;
  294.         
  295.         this.checkfiles = (f & 4) > 0;
  296.         this.scripteng = (f & 1) > 0;
  297.  
  298.         this.deleted = false;
  299.         this.newitem = false;
  300.         this.updated = false;
  301.         
  302.         this.crop = crop;
  303.     }
  304.  
  305. cachedList = new Array();
  306.  
  307. <% 
  308.  
  309.     dim i,Script,aScriptMap,aScript
  310.  
  311.     aScriptMap = currentobj.ScriptMaps
  312.     i = 0
  313.     For Each Script in aScriptMap
  314.         if Script <> "" then
  315.             aScript = GetScriptArray(Script)
  316.             %>cachedList[<%= i %>] = new listObj("<%= aScript(0) %>","<%= Replace(aScript(1),"\","\\") %>",<%= aScript(2) %>,"<%= aScript(3) %>");<% 
  317.             i = i+1
  318.         end if 
  319.     Next
  320.     
  321.     function GetScriptArray(ScriptStr)
  322.         dim a,b,c,d,one,two,three
  323.  
  324.         a = ""
  325.         b = ""
  326.         c = 0
  327.         d = ""
  328.  
  329.         one=Instr(ScriptStr,",")
  330.         two=Instr((one+1),ScriptStr,",")
  331.         three=Instr((two+1),ScriptStr,",")
  332.     
  333.  
  334.         if one > 0 then
  335.             a=Mid(ScriptStr,1,(one-1))
  336.             b=Mid(ScriptStr,(one+1),((two-one)-1))
  337.  
  338.             if three <> 0 then
  339.                 c=Mid(ScriptStr,(two+1),((three-two)-1))
  340.                 d=Mid(ScriptStr,(three+1))
  341.             else
  342.                 c=Mid(ScriptStr,(two+1))
  343.             end if
  344.         end if
  345.     
  346.         GetScriptArray=Array(a,b,c,d)
  347.     end function
  348.     
  349.  %>
  350. listFunc = new listFuncs();
  351.  
  352. </SCRIPT>
  353. </BODY>
  354. </HTML>
  355.