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