[move directory listing to method
von@fugal.net**20071120181821] {
hunk ./webserver.rb 22
+ def fullpath_resource res
+ res.sub serv_root.to_s, ""
+ end
hunk ./webserver.rb 75
- r << <
-
- #{file.basename}
-
-
-
-
Directory listing:
-
#{file.basename}
-
-html
- for ent in file.entries
- next if ent.to_s == "."
- f = file + ent
- if f.directory?
- type = "directory"
- icon = "/icons/dir.png"
- else
- type = mimetype f
- icon = mime_icon type
- end
- r << <
- #{ent.basename}
- Type: #{type}
-
-html
- end
- r << <
-
-
-html
+ r << dir_html(file)
hunk ./webserver.rb 95
+ end
+
+ def dir_html file
+ r = fullpath_resource file
+ html = <
+
+ #{file.basename}
+
+
+
+
Directory listing:
+
#{file.basename}
+
+html
+ for ent in file.entries
+ next if ent.to_s == "."
+ f = file + ent
+ if f.directory?
+ type = "directory"
+ icon = "/icons/dir.png"
+ else
+ type = mimetype f
+ icon = mime_icon type
+ end
+ html << <
+ #{ent}
+ Type: #{type}
+
+html
+ end
+ html << <
+
+
+html
}