home *** CD-ROM | disk | FTP | other *** search
/ Total Network Tools 2002 / NextStepPublishing-TotalNetworkTools2002-Win95.iso / Archive / Web Server / Xitami Multithreaded Web Server.exe / HTTPDIR.GSL < prev    next >
Encoding:
Text File  |  2000-02-18  |  3.8 KB  |  101 lines

  1. .-----------------------------------------------------------------------------
  2. .-
  3. .-  httpdir.gsl - GSL script to format HTTP directory listings
  4. .-
  5. .-  Written:  1999/05/29  Xitami team
  6. .-  Revised:  2000/02/18  Xitami team
  7. .-
  8. .-  If you want to modify this script, copy it, and modify the copy.  Then
  9. .-  change the server:dir-script option to refer to your new script.
  10. .-
  11. .-  The data tree for the directory listing is:
  12. .-      <directory>
  13. .-          <file> 0 or more times
  14. .-
  15. .-  Directory has these attributes:
  16. .-      tempfile            name of temporary output file
  17. .-      date                current date, 'yyyy/mm/dd'
  18. .-      time                current time, 'hh:mm:ss'
  19. .-      files               number of files in directory
  20. .-      size                total size of files, in bytes
  21. .-      script              name of script
  22. .-      urlbase             base URL for directory
  23. .-    [ urlparent           base URL for parent directory, if any ]
  24. .-      order               sort order, e.g. 'nx'
  25. .-      server_software     name of the web server
  26. .-      server_version      the server version in use
  27. .-      server_name         the current host name
  28. .-      server_url          full url back to the server
  29. .-      server_port         port on which the web server is running
  30. .-      server_protocol     HTTP version in use (currently "HTTP/1.1").
  31. .-      remote_user         authorised username, if any, else "-"
  32. .-      remote_host         remote host name, "xxx.xxx.xxx.xxx"
  33. .-      Additionally, for each HTTP header field, an attribute HTTP_xxxx
  34. .-      where xxxx is the header field name. 
  35. .-
  36. .-  File has these attributes:
  37. .-      name                name of file with extension
  38. .-      nameurl             name of file escaped for use in URL
  39. .-      type                extension only
  40. .-      directory           1, if file is a directory  
  41. .-      size                file size, if not a directory
  42. .-      units               file size units, 'bytes', 'Kb', 'Mb', 'Gb'
  43. .-      date                file date, 'yyyy/mm/dd'
  44. .-      time                file time, 'hh:mm:ss'  
  45. .-      mimetime            file date/time in MIME format
  46. .-
  47. .-  To debug changes to this script, start Xitami in debug mode (server:debug
  48. .-  option) and show a directory listing.  This creates a file 'httpdir.xml'
  49. .-  that you can feed to gslgen by hand:
  50. .-
  51. .-      gslgen -script:templates/myfile.gsl httpdir.xml
  52. .-
  53. .-----------------------------------------------------------------------------
  54. .output "$(tempfile?httpdir.lst)"
  55. <HTML><TITLE>Directory listing of $(urlbase:)</TITLE><BODY>
  56. <H3>
  57. .if defined (urlparent)
  58. <A HREF="$(urlparent:)">
  59. <IMG SRC="/images/dir_up.gif" BORDER=0 ALT="Up to $(urlparent:)"></A>
  60. .endif
  61. $(urlbase:)</H3></TD>
  62. <HR>
  63. .-  We want the first character of the sort order
  64. .directory.order = substr (order,0,,1)
  65. .name_reorder = "nx"
  66. .size_reorder = "snx"
  67. .time_reorder = "Tnx"
  68. .if order = "n"
  69. .   name_reorder = "Nx"
  70. .elsif order = "s"
  71. .   size_reorder = "Snx"
  72. .elsif order = "T"
  73. .   time_reorder = "tnx"
  74. .endif
  75. .-
  76. <TABLE BORDER=0 WIDTH="700" CELLSPACING=0>
  77. <TR><TH ALIGN=LEFT><A HREF="$(urlbase:)?order=$(name_reorder:)">Name</A></TH>
  78.     <TH ALIGN=RIGHT><A HREF="$(urlbase:)?order=$(size_reorder:)">Size</A></TH>
  79.     <TH ALIGN=RIGHT><A HREF="$(urlbase:)?order=$(time_reorder:)">Modified</A></TH></TR>
  80. .for file
  81. <TR><TD>
  82. .   if defined (directory)
  83. .       icon = "/images/dir_dir.gif"
  84. .   elsif exists ("webpages/images/dir$(type?).gif")
  85. .       icon = "/images/dir$(type).gif"
  86. .   else
  87. .       icon = "/images/dir_any.gif"
  88. .   endif
  89. <A HREF="$(urlbase:)$(nameurl:)"><IMG SRC="$(icon)" BORDER=0>$(name:)</A></TD>
  90. .   if defined (directory)
  91.     <TD></TD>
  92. .   else
  93.     <TD ALIGN=RIGHT>$(size) $(units:)</TD>
  94. .   endif
  95.     <TD ALIGN=RIGHT>$(date) $(time)</TD></TR>
  96. .endfor
  97. </TABLE><HR>
  98. <P><I>Powered by <A HREF="http://www.xitami.com">Xitami!</A></I>
  99. </BODY></HTML>
  100.  
  101.