home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_03.cab / iiadmhd.asp < prev    next >
Text File  |  1997-11-12  |  5KB  |  188 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_ADDWEBUSERS_TEXT = "Web Site Operators"
  11. Const L_ADDFTPUSERS_TEXT = "FTP Site Operators"
  12. Const L_LISTNAMES_TEXT = "Grant operator privileges on this site only to these Windows NT User Accounts:"
  13. Const L_BUILTIN_TEXT = "BUILTIN\"
  14. Const L_ENTERTRUSTEE_TEXT = "Enter a domain and user name."
  15. Const L_ADMINISTRATORS_TEXT = "Administrators"
  16. Const L_DELERROR_TEXT = "You may not delete local administrator privileges from this site."
  17. Const L_SAMPTRUSTEE_TEXT = "DOMAIN\\username"
  18. Const L_SELECTITEM_TEXT = "You must first choose a user from the list to remove."
  19. On Error Resume Next 
  20.  
  21. Dim path, currentobj
  22.  
  23. path=Session("spath")
  24. Session("path")=path
  25. Set currentobj=GetObject(path)
  26. Session("SpecObj")="Operators"
  27. Session("SpecProps")="Trustee"
  28. %>
  29.  
  30. <HTML>
  31. <HEAD>
  32. <TITLE></TITLE>
  33. </HEAD>
  34.  
  35. <BODY BGCOLOR="#CCCCCC" TOPMARGIN=5 TEXT="#000000" LINK="#FFFFFF" onLoad="loadList();" STYLE="font-face: Helv,Arial; font-size:10pt;">
  36.  
  37. <FONT SIZE=1 FACE="Helv,Arial">
  38. <% if Session("stype")="www" then %>
  39.     <B><%= L_ADDWEBUSERS_TEXT %></B><P>
  40. <% else %>
  41.     <B><%= L_ADDFTPUSERS_TEXT %></B><P>
  42. <% end if %>
  43. <%= L_LISTNAMES_TEXT %>
  44. </FONT>
  45.  
  46. <FORM NAME="userform"></FORM>
  47.  
  48.  
  49. <SCRIPT LANGUAGE="JavaScript">
  50.  
  51.     top.title.Global.helpFileName="iipy_29";
  52.     top.title.Global.siteProperties = true;    
  53.     
  54.     function loadList(){    
  55.         <% if Session("IsIE") then %>
  56.             parent.list.location.href = "iiadmls.asp";
  57.         <% else %>
  58.             parent.frames[1].location.href="iiadmls.asp";
  59.         <% end if %>
  60.     }
  61.  
  62.     function addItem(){
  63.         trustee=prompt("<%= L_ENTERTRUSTEE_TEXT %>","<%= L_SAMPTRUSTEE_TEXT %>");
  64.         if ((trustee != "") && (trustee != null)){    
  65.  
  66.             top.title.Global.updated=true;            
  67.             i=cachedList.length;    
  68.             cachedList[i]=new listObj(trustee);
  69.             cachedList[i].updated=true;    
  70.             cachedList[i].newitem=true;
  71.             loadList();
  72.         }
  73.     }
  74.  
  75.     function delItem(){
  76.         ndxnum=parent.list.document.userform.selTrustee.options.selectedIndex;
  77.         if (ndxnum != -1){
  78.         var i=parent.list.document.userform.selTrustee.options[ndxnum].value;
  79.             if (i != ""){
  80.                 if (cachedList[i].trustee != "<%= L_ADMINISTRATORS_TEXT %>"){
  81.                     cachedList[i].deleted=true;
  82.                     cachedList[i].updated=true;    
  83.                     top.title.Global.updated=true;                    
  84.                     loadList();
  85.                 }
  86.                 else{
  87.                     alert("<%= L_DELERROR_TEXT %>");
  88.                 }
  89.             }
  90.         }
  91.         else{
  92.             alert("<%= L_SELECTITEM_TEXT %>");
  93.         }
  94.     }
  95.  
  96.     function buildListForm(){
  97.         numrows=0;
  98.         for (var i=0; i < cachedList.length; i++) {
  99.             if ((!cachedList[i].deleted) && (cachedList[i].header !="")){
  100.                 numrows=numrows + 1;
  101.             }
  102.         }
  103.         qstr="numrows="+numrows;
  104.         qstr=qstr+"&cols=Trustee"
  105.  
  106.         top.body.hlist.location.href="iihdn.asp?"+qstr;
  107.         <% 'the list values will be grabbed by the hiddenlistform script... %>
  108.     }
  109.  
  110.     function SetListVals(){
  111.         listForm=parent.parent.hlist.document.hiddenlistform;    
  112.         j=0;
  113.         for (var i=0; i < cachedList.length; i++) {
  114.             if ((!cachedList[i].deleted) && (cachedList[i].trustee !="")){
  115.                 listForm.elements[j++].value=cachedList[i].trustee;
  116.                 //cachedList[i].updated=false;
  117.             }
  118.         }
  119.     }
  120.  
  121.     function popBox(title, width, height, filename){
  122.         thefile=(filename + ".asp");
  123.         thefile="iipop.asp?pg="+thefile;
  124.         <% if Session("Browser") <> "IE3" then %>
  125.             width=width +25;
  126.             height=height + 50;                
  127.         <% end if %>
  128.  
  129.         popbox=window.open(thefile,title,"toolbar=no,scrollbars=yes,directories=no,menubar=no,width="+width+",height="+height);
  130.         if(popbox !=null){
  131.             if (popbox.opener==null){
  132.                 popbox.opener=self;
  133.             }
  134.         }
  135.     }
  136.  
  137.     function listFuncs(){
  138.         this.loadList=loadList;
  139.         this.addItem=addItem;
  140.         this.delItem=delItem;
  141.         this.writeList=buildListForm;
  142.         this.popBox=popBox;
  143.         this.SetListVals=SetListVals;
  144.         this.ndx=0;        
  145.     }
  146.  
  147.  
  148.  
  149.     function listObj(trustee){
  150.         this.trustee=trustee;
  151.         this.deleted=false;
  152.         this.updated=false;
  153.         this.newitem=false;
  154.     }
  155.  
  156.     cachedList=new Array()
  157.  
  158. listFunc=new listFuncs();
  159.  
  160. <%  
  161.  
  162. Dim ACLs, dACLs, i, Ace, User
  163. set ACLs=currentobj.AdminACL
  164. set dACLs = ACLs.DiscretionaryACL
  165.  
  166. i = 0
  167. For Each Ace in dACLs
  168.     
  169.     User = Ace.Trustee    
  170.     if Ace.Trustee <> "\Everyone" then
  171.         if InStr(Ace.Trustee,"BUILTIN\") then
  172.             User = Mid(User,InStr(User,"L_BUILTIN_TEXT")+Len(L_BUILTIN_TEXT)+1)
  173.         end if
  174.         User = Replace(User,"\","\\")
  175.          %>cachedList[<%= i %>]=new listObj("<%= User %>");<% 
  176.          i = i+1
  177.     end if
  178. Next
  179.  
  180.  
  181. %>
  182.  
  183. </SCRIPT>
  184.  
  185. </FONT>
  186. </BODY>
  187. </HTML>
  188. <% end if %>