diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2010-09-22 14:10:48 +0200 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2010-09-22 14:10:48 +0200 |
commit | cc5025b06013380fe07adecab5ca670b75eb690f (patch) | |
tree | 66e4ce495b91883663c5b3e8611d4b1ca8726476 /dudle.rb | |
parent | f20c638c9e25b3da22fd8125c13a6b5ca3a8a9a2 (diff) |
better approach to example polls (generate a new one for every user)
Diffstat (limited to '')
-rw-r--r-- | dudle.rb | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -30,6 +30,14 @@ GetText.cgi=$cgi GetText.output_charset = 'utf-8' require "locale" +if File.exists?("data.yaml") && !File.stat("data.yaml").directory? + $is_poll = true + GetText.bindtextdomain("dudle",:path => "../locale/") +else + $is_poll = false + GetText.bindtextdomain("dudle",:path => "./locale/") +end + $:.push("..") require "date_locale" @@ -41,13 +49,13 @@ require "charset" class Dudle attr_reader :html, :table, :urlsuffix, :css, :user_css, :title, :tab def is_poll? - @is_poll + $is_poll end def tabs(active_tab) ret = "<div id='tabs'><ul id='tablist'>" tabs = [] tabs << [_("Home"),@basedir] - if @is_poll + if $is_poll tabs << ["",""] tabs += @usertabs tabs << ["",""] @@ -74,7 +82,7 @@ class Dudle def inittabs @customizetab = [_("Customize"),"customize.cgi"] - if @is_poll + if $is_poll # set-up tabs @usertabs = [ [_("Poll"),"."], @@ -99,12 +107,11 @@ class Dudle @tab = File.basename($0) @tab = "." if @tab == "index.cgi" - if File.exists?("data.yaml") && !File.stat("data.yaml").directory? + if $is_poll # log last read acces manually (no need to grep server logfiles) File.open("last_read_access","w").close - @is_poll = true + $is_poll = true @basedir = ".." - GetText.bindtextdomain("dudle",:path => "#{@basedir}/locale/") @table = YAML::load(VCS.cat(self.revision, "data.yaml")) @urlsuffix = File.basename(File.expand_path(".")) @title = @table.name @@ -119,9 +126,7 @@ class Dudle @html = HTML.new("dudle - #{@title} - #{@tabtitle}") @html.header["Cache-Control"] = "no-cache" else - @is_poll = false @basedir = "." - GetText.bindtextdomain("dudle",:path => "#{@basedir}/locale/") inittabs @title = "dudle" @html = HTML.new(@title) |