From cc5025b06013380fe07adecab5ca670b75eb690f Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Wed, 22 Sep 2010 14:10:48 +0200 Subject: better approach to example polls (generate a new one for every user) --- bzr.rb | 4 ++++ config_sample.rb | 18 ++++++++++++++---- dudle.rb | 21 +++++++++++++-------- error.cgi | 3 ++- example.cgi | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ git.rb | 5 +++++ index.cgi | 5 +++-- 7 files changed, 89 insertions(+), 15 deletions(-) create mode 100755 example.cgi diff --git a/bzr.rb b/bzr.rb index 83a4e4b..f2fe2db 100644 --- a/bzr.rb +++ b/bzr.rb @@ -62,4 +62,8 @@ class VCS File.delete(tmpfile) ret end + + def VCS.branch source, target + `#{BZRCMD} branch #{source} #{target}` + end end diff --git a/config_sample.rb b/config_sample.rb index 0441d8c..d8a3993 100644 --- a/config_sample.rb +++ b/config_sample.rb @@ -53,10 +53,20 @@ BUGREPORTMAIL = "Benjamin.Kellermann@tu-dresden.de" AUTO_SEND_REPORT = false # Add some Example Polls to the start page -EXAMPLES = { - "event_schedule_example" => "coffeebreak", - "normal_example" => "coffee" -} +# you may create those using the normal interface +# and make them password protected afterwards +# .htaccess and .htdigest are deleted after +# example creation (defining password protected +# examples is not possible therefore) +EXAMPLES = [ + { + :url => "coffeebreak", + :description => _("Event Schedule Poll") + },{ + :url => "coffee", + :description => _("Normal Poll") + } +] # add the htmlcode in the Variable NOTICE to the startpage # Example: displays all available Polls diff --git a/dudle.rb b/dudle.rb index 7cf1dc0..adc01b7 100644 --- a/dudle.rb +++ b/dudle.rb @@ -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 = "