diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2011-02-07 10:56:56 +0100 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2011-02-07 10:56:56 +0100 |
commit | a5f5d53881645d42d27ea9b46d10a2442676e271 (patch) | |
tree | 25bdee516695c15534a53f06e988d98f19895ada /dudle.rb | |
parent | d0ca62d9347ceee09ebff2fb13b333a45bcab271 (diff) |
Attempt to fix relative path bug with error pages
Diffstat (limited to 'dudle.rb')
-rw-r--r-- | dudle.rb | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -74,7 +74,7 @@ class Dudle when "" ret += "<li class='separator_tab'></li>" else - ret += "<li class='nonactive_tab' ><a href='#{file}'> #{tab} </a></li> " + ret += "<li class='nonactive_tab' ><a href='#{@html.relative_dir}#{file}'> #{tab} </a></li> " end } ret += "</ul></div>" @@ -83,7 +83,7 @@ class Dudle def inittabs @customizetab = [_("Customize"),"customize.cgi"] - if $is_poll + if is_poll? # set-up tabs @usertabs = [ [_("Poll"),"."], @@ -102,36 +102,35 @@ class Dudle @requested_revision || VCS.revno end - def initialize(params = {:revision => nil, :title => nil, :hide_lang_chooser => nil}) + def initialize(params = {:revision => nil, :title => nil, :hide_lang_chooser => nil, :relative_dir => ""}) @requested_revision = params[:revision] @hide_lang_chooser = params[:hide_lang_chooser] @cgi = $cgi @tab = File.basename($0) @tab = "." if @tab == "index.cgi" - if $is_poll + inittabs + + if is_poll? # log last read acces manually (no need to grep server logfiles) File.open("last_read_access","w").close - $is_poll = true @basedir = ".." @table = YAML::load(VCS.cat(self.revision, "data.yaml")) @urlsuffix = File.basename(File.expand_path(".")) @title = @table.name - inittabs configfiles = @configtabs.collect{|name,file| file} @is_config = configfiles.include?(@tab) @wizzardindex = configfiles.index(@tab) if @is_config @tabtitle = (@usertabs + @configtabs + [@deletetab] + [@customizetab]).collect{|title,file| title if file == @tab}.compact[0] - @html = HTML.new("dudle - #{@title} - #{@tabtitle}") + @html = HTML.new("dudle - #{@title} - #{@tabtitle}",params[:relative_dir]) @html.header["Cache-Control"] = "no-cache" else @basedir = "." - inittabs @title = params[:title] || "dudle" - @html = HTML.new(@title) + @html = HTML.new(@title,params[:relative_dir]) end |