module RedmineDmsf module Webdav class BaseResource < DAV4Rack::Resource DIR_FILE = "%s%s%s%s" def initialize(public_path, path, request, response, options) super(public_path, path, request, response, options) end def accessor=(klass) @__proxy = klass end def long_name nil end def special_type nil end def html_display @response.body = "" Confict unless collection? entities = children.map{|child| DIR_FILE % [child.public_path.html_safe, child.long_name || child.name, "-", child.special_type || child.content_type, child.last_modified]} * "\n" @response.body << index_page % [ path.empty? ? "/" : path, path.empty? ? "/" : path , entities ] end def child(name, options = nil) @__proxy.child(name) end def index_page return <<-PAGE %s

%s


%s
Name Size Type Last Modified

PAGE end protected def Project return @Project unless @Project.nil? pinfo = @path.split('/').drop(1) if pinfo.length > 0 begin @project = Project.find(pinfo.first) rescue end end end end end end