file_manager_example.anubis 1.84 KB

 *Project*                             The Anubis Project
   
 *Title*               
   
 *Copyright*                     Copyright (c) Alain Prouté 2005. 

   
 Not released. Must be finalized and debugged first. 
   
   
read web/making_a_web_site.anubis   
read web/multihost_http_server.anubis
read web/common.anubis   
read web/file_manager.anubis   
read web/mime.anubis   
   
define String site_dir = ".". 
   
   
   
type State:
   state(String curdir). 
   
   
define State 
   default 
     =
   state(site_dir). 
   
   
define HTML_Page
   compute_page
     (
       State s
     ) =
   if s is state(dir) then 
   html_page("",[],body([],center(
     file_manager
       (
       (State s1) |-> if s1 is state(d) then d, 
       (State s1) |-> short
       )(s)))). 
   
   
   
global define One
   web_file_manager
     (
       List(String) args
     ) =
  start_web_sites
    (
      0,
      1607,
      1609,
      "georges",
      [
      make_web_site_description
        (
        ["127.0.0.1"],
        site_dir,
        (One u) |-> u, 
        (HTTP_Info i) |-> default, 
        (State s, HTTP_Info i, List(Web_arg) l, Bool h) |-> s, 
        (HTTP_Info i, List(Web_arg) l, Bool h) |-> default, 
        file_manager_actions
          (
          site_dir,
          (State s) |-> true, 
          (State s) |-> if s is state(cd) then cd, 
          (State s, String d) |-> success(state(d)), 
          (State s, FileManagerLayout l) |-> s
          ), 
        compute_page,
        (State s) |-> [],    // additional HTTP headers
        360000, 
        [
        redirect("/","127.0.0.1","/fm.awp"),
        ],
        "ISO-8859-1",
        [".awp"],
        ["host","user-agent"],
        "jhoierfcneirnze", 
        known_mime_types, 
        (String a, List(Web_arg) l) |-> unique
        )
      ],
   
      var((Bool)false)
    ).