home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 September / CHIPCD_9_99.iso / software / uaktualnienia / OptionPackPL / iis4_02.cab / myfiles.asp < prev    next >
Encoding:
Text File  |  1998-04-27  |  4.2 KB  |  134 lines

  1. <%@ LANGUAGE="VBSCRIPT" %>
  2. <% Option Explicit %>
  3. <!-- VSS generated file data
  4. $Modtime: 10/24/97 10:24a $
  5. $Revision: 18 $
  6. $Workfile: myfiles.asp $
  7. -->
  8. <%
  9.  On Error Resume Next
  10.  
  11.  Dim f, strDisplay, conn, Description, fc, fl, y, FileName, _
  12.  posFile, g, rs, sql, machine
  13.  
  14. '----------Localization Variables-----------------
  15.  
  16.     Dim bckSlash, colon, semiColon, period, locMyPubFiles, locHome, _
  17.     locK, locSize, locDescription
  18.     
  19.     bckSlash = chr(92)
  20.     colon = chr(58)
  21.     semiColon = chr(59)
  22.     period = chr(46)
  23.     
  24.     locMyPubFiles = "Moje opublikowane pliki"
  25.     locHome = "Strona g│≤wna"
  26.     locK = " KB" 'File Size
  27.     locSize = "Rozmiar: "
  28.     
  29. '---------------Run Subs--------------
  30. setSysObj
  31. readDescriptions
  32.  
  33. '---------------Subs------------------
  34. Sub setSysObj
  35.  Set FileSystem=CreateObject("Scripting.FileSystemObject")
  36.     Dim root, FileSystem, g, sc
  37.  
  38.      root = server.mappath(bckSlash)
  39.     root = Trim(Left(root, instrRev(root, bckSlash)))
  40.     root = root + "webpub"
  41.     g = FileSystem.GetAbsolutePathName(root)
  42.      Set f=FileSystem.GetFolder(g)
  43.     Set sc = f.SubFolders
  44. End Sub
  45.  
  46. Sub readDescriptions 'Read all file descriptions in publish.mdb
  47.     Dim strProvider, sql, rs, n, i
  48.  
  49.     strProvider="DRIVER=Microsoft Access Driver (*.mdb); DBQ=" & Server.MapPath(bckSlash + "iisadmin") & bckSlash + "publish" + bckSlash + "publish.mdb" + semiColon
  50.     Set conn = Server.CreateObject("ADODB.Connection")
  51.         conn.open strProvider,"",""
  52.     sql = "SELECT FileList.FileName, FileList.FileDescription, FileList.FilePath FROM FileList ORDER BY FileList.FileName"
  53.     Set rs = Server.CreateObject("ADODB.Recordset")
  54.     rs.Open sql, conn, 3, 3
  55.     If not rs.EOF Then
  56.         rs.movelast 
  57.         n = rs.recordcount - 1
  58.         rs.movefirst
  59.         For i = 0 to n
  60.             strDisplay = strDisplay + rs.Fields("FileName").Value +  " " + rs.Fields("FileDescription").Value + semiColon
  61.             rs.movenext
  62.         Next
  63.     End If
  64. End Sub
  65. %>
  66. <HTML>
  67. <HEAD>
  68. <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
  69. <META HTTP-EQUIV="Content-Type" content="text/html; charset=windows-1250">
  70. <!--#include virtual ="/iissamples/homepage/sub.inc"-->
  71. <%
  72.  call stylesheet
  73.  Function writeFiles()
  74.     DIM strFiles, FileSize
  75.     'Read all file names in WebPub
  76.      Set fc = f.Files
  77.      strFiles =  "<TABLE BORDER=0 cellspacing=0 cellpadding=1 width=""" & "90%" & """ height=""" & "100%" & """ class=bg0>"
  78.     g = ".." + bckSlash + ".." + bckSlash + "webpub" + bckSlash
  79.      For Each fl in fc
  80.         y = y + 1
  81.          FileName=fl.name
  82.             If strDisplay <> "" Then
  83.                 posFile=instr(Ucase(strDisplay), Ucase(FileName))
  84.                 If posFile <> 0 Then
  85.                     Set rs = Server.CreateObject("ADODB.Recordset") 
  86.                     sql = "SELECT FileList.FileName, FileList.FileDescription, FileList.FilePath FROM FileList WHERE FileList.FileName ='" + FileName + "'"
  87.                     rs.Open sql, conn, 3, 3
  88.                     Description = rs.Fields("FileDescription").Value
  89.                 Else
  90.                     Description = ""
  91.                 End If
  92.             End If
  93.         If y Mod 2 <> 0 Then
  94.             strFiles = strFiles & "<TR>"
  95.         End If
  96.         FileSize = Int((fl.size/1024) + .5)
  97.         strFiles = strFiles & "<TD HEIGHT=10 WIDTH='50%'><IMG SRC='file.gif' WIDTH=13 HEIGHT=16 BORDER=0>  "
  98.         strFiles = strFiles & "<A HREF='" & g & fl.name & "'>" & fl.name & "<A/><BR>" & locSize & FileSize & locK & "<BR>" & Description & "</TD>"
  99.         If y Mod 2 = 0 Then
  100.             strFiles = strFiles & "</TR>"
  101.         End If
  102.      Next
  103.      strFiles = strFiles & "</TABLE>"
  104.      writeFiles = strFiles
  105.  End Function
  106. machine= Request.ServerVariables("SERVER_NAME") 
  107. %>
  108. </HEAD>
  109. <BODY BGCOLOR="#FFFFFF" TOPMARGIN="0" LEFTMARGIN="0">
  110. <TABLE BORDER=0 cellspacing=0 cellpadding=5 width="100%" height="100%" class=bg0>
  111.     <TR ALIGN="CENTER">
  112.         <TD Rowspan="3" Width="50" Height="100%" class=bg1>   </TD>
  113.         <TD Rowspan="3" Width="50" Height="100%" class=bg2>     </TD>
  114.         <TD Height=65 Colspan=3 class=bg3>
  115.             <FONT style='font-family:Arial;font-size:24pt'><%=locMyPubFiles%></Font>
  116.             <FORM NAME="frmHOME" METHOD="POST" ACTION="HTTP://<%=machine%>/default.asp">
  117.             <INPUT TYPE="SUBMIT" VALUE="               <%=locHome%>                ">
  118.         </FORM>
  119.         </TD>
  120.     </TR>
  121.     <TR ALIGN="CENTER"><TD>
  122. <%
  123.  response.write writeFiles()
  124. %>
  125.     </TD>
  126.     </TR>
  127.     <TR>
  128.     <TD WIDTH="100%" HEIGHT="25"> </TD>
  129.     </TR>
  130. </TABLE>
  131. </BODY>
  132. </HTML>
  133.  
  134.