aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xaccess_control.rb39
-rw-r--r--charset.rb1
-rwxr-xr-xcustomize.rb46
-rwxr-xr-xdelete_poll.rb52
-rw-r--r--dudle.rb91
-rwxr-xr-xedit_columns.rb60
-rwxr-xr-xhelp.rb34
-rwxr-xr-xhistory.rb50
-rw-r--r--html.rb29
-rwxr-xr-xinvite_participants.rb36
-rwxr-xr-xparticipate.rb52
-rw-r--r--timepollhead.rb9
12 files changed, 189 insertions, 310 deletions
diff --git a/access_control.rb b/access_control.rb
index 6080452..a40ad43 100755
--- a/access_control.rb
+++ b/access_control.rb
@@ -19,22 +19,11 @@
# along with dudle. If not, see <http://www.gnu.org/licenses/>. #
############################################################################
-require "cgi"
-
if __FILE__ == $0
-$cgi = CGI.new
-olddir = File.expand_path(".")
-Dir.chdir("..")
-load "html.rb"
-load "config.rb"
-require "poll"
-require "yaml"
-Dir.chdir(olddir)
+load "../dudle.rb"
-POLL = YAML::load_file("data.yaml").name
-$html = HTML.new("dudle - #{POLL} - Help")
-$html.header["Cache-Control"] = "no-cache"
+$d = Dudle.new("Access Control")
acusers = {}
@@ -66,9 +55,9 @@ HTACCESS
}
VCS.commit("Access Control changed")
unless acusers.empty?
- $html.header["status"] = "REDIRECT"
- $html.header["Cache-Control"] = "no-cache"
- $html.header["Location"] = "access_control.cgi"
+ $d.html.header["status"] = "REDIRECT"
+ $d.html.header["Cache-Control"] = "no-cache"
+ $d.html.header["Location"] = "access_control.cgi"
end
end
def add_to_htdigest(user,password)
@@ -173,19 +162,10 @@ if $cgi.include?("ac_user")
end
end
-unless $html.header["status"] == "REDIRECT"
-
-load "../charset.rb"
-$html.add_css("../dudle.css")
+unless $d.html.header["status"] == "REDIRECT"
-$html << "<body>"
-$html << Dudle::tabs("Access Control")
-$html << <<HEAD
-<div id='main'>
- <h1>#{POLL}</h1>
- <h2>Change Access Control Settings</h2>
-HEAD
+$d.html << "<h2>Change Access Control Settings</h2>"
if acusers.empty? && $cgi["ac_activate"] != "Activate"
@@ -216,7 +196,7 @@ else
end
-$html << <<AC
+$d.html << <<AC
<form id='ac' method='post' action='' >
<table summary='Enable Access Control settings' class='settingstable'>
<tr>
@@ -239,8 +219,7 @@ $html << <<AC
#{createform}
AC
-$html << "</div></body>"
end
-$html.out($cgi)
+$d.out($cgi)
end
diff --git a/charset.rb b/charset.rb
index b305eac..237a8c1 100644
--- a/charset.rb
+++ b/charset.rb
@@ -64,4 +64,3 @@ else
end
UTFCHARS = CGI.escapeHTML("✔✘↞←→↠✍⌧•▾▴")
-$html.add_cookie("utf","true","/",Time.now + (1*60*60*24*365 * (USEUTF ? 1 : -1 )))
diff --git a/customize.rb b/customize.rb
index 5300b1c..8b0aeee 100755
--- a/customize.rb
+++ b/customize.rb
@@ -19,24 +19,16 @@
# along with dudle. If not, see <http://www.gnu.org/licenses/>. #
############################################################################
-require "cgi"
if __FILE__ == $0
-$cgi = CGI.new
-load "../html.rb"
-$html = HTML.new("dudle - Customize")
-load "../charset.rb"
+load "../dudle.rb"
-$html.header["Cache-Control"] = "no-cache"
+$d = Dudle.new("Customize")
-$html.add_css("../dudle.css")
-$html << <<END
-<body>
-#{Dudle::tabs("Customize")}
-<div id='main'>
-<h1>Customize Personal Settings</h1>
+$d << <<END
+<h2>Customize Personal Settings</h2>
You need cookies enabled in order to personalize your settings.
END
@@ -65,9 +57,10 @@ end
a = [["Use normal strings","ascii"],
["Use special characters (#{UTFCHARS})","utf", "Use this options if you see the characters in the parenthesis."]]
-$html << <<CHARSET
+$d.html.add_cookie("utf","true","/",Time.now + (1*60*60*24*365 * (USEUTF ? 1 : -1 )))
+$d << <<CHARSET
<div id='charset'>
-<h2>Charset</h2>
+<h3>Charset</h3>
#{choosetable("Charset settings",a,USEUTF ? "utf" : "ascii")}
</div>
CHARSET
@@ -80,10 +73,10 @@ a = [["default","css=dudle.css"],
css = $cgi.cookies["css"][0]
css = $cgi["css"] if $cgi.include?("css")
css ||= "dudle.css"
-$html.add_cookie("css",css,"/",Time.now + (1*60*60*24*365 * (css == "dudle.css" ? -1 : 1 )))
-$html << <<CSS
+$d.html.add_cookie("css",css,"/",Time.now + (1*60*60*24*365 * (css == "dudle.css" ? -1 : 1 )))
+$d << <<CSS
<div id='config_stylesheet'>
-<h2>Stylesheet</h2>
+<h3>Stylesheet</h3>
#{choosetable("Stylesheet settings",a,"css=#{css}")}
</div>
CSS
@@ -91,15 +84,15 @@ CSS
username = $cgi.cookies["username"][0]
if $cgi.include?("delete_username")
- $html.add_cookie("username","","/",Time.now - 1*60*60*24*365)
+ $d.html.add_cookie("username","","/",Time.now - 1*60*60*24*365)
username = nil
elsif $cgi.include?("username")
username = $cgi["username"]
- $html.add_cookie("username",username,"/",Time.now + 1*60*60*24*365)
+ $d.html.add_cookie("username",username,"/",Time.now + 1*60*60*24*365)
end
-$html << <<CHARSET
+$d << <<CHARSET
<div id='config_user'>
<h2>Default Username</h2>
<form method='get' action=''>
@@ -112,7 +105,7 @@ $html << <<CHARSET
CHARSET
if username && !$cgi.include?("edit")
- $html << <<CHARSET
+ $d << <<CHARSET
<span>#{username}</span>
<input type='hidden' value="#{username}" name='username' />
<input type='hidden' value="true" name='edit' />
@@ -124,7 +117,7 @@ if username && !$cgi.include?("edit")
<input id='username' type='submit' value='Edit' />
CHARSET
else
- $html << <<CHARSET
+ $d << <<CHARSET
<input id='username' type='text' value="#{username}" name='username' />
</td>
</tr>
@@ -135,9 +128,9 @@ else
CHARSET
end
-$html << "<input type='submit' name='delete_username' value='Delete' />" if username
+$d.html << "<input type='submit' name='delete_username' value='Delete' />" if username
-$html << <<CHARSET
+$d << <<CHARSET
</td>
</tr>
</table>
@@ -145,10 +138,7 @@ $html << <<CHARSET
</div>
CHARSET
-$html << "</div>"
-$html << "</body>"
-
-$html.out($cgi)
+$d.out($cgi)
end
diff --git a/delete_poll.rb b/delete_poll.rb
index d2681ed..8a7c41b 100755
--- a/delete_poll.rb
+++ b/delete_poll.rb
@@ -19,44 +19,23 @@
# along with dudle. If not, see <http://www.gnu.org/licenses/>. #
############################################################################
+if __FILE__ == $0
+
+load "../dudle.rb"
+$d = Dudle.new("Delete Poll")
+require "ftools"
+
QUESTIONS = ["Yes, I know what I am doing!",
"I hate these stupid entry fields.",
"I am aware of the consequences.",
"Please delete this poll."]
-
-require "cgi"
-require "ftools"
-
-if __FILE__ == $0
-
-$cgi = CGI.new
-
-olddir = File.expand_path(".")
-Dir.chdir("..")
-load "html.rb"
-load "config.rb"
-require "poll"
-require "yaml"
-Dir.chdir(olddir)
-
-POLLNAME = YAML::load_file("data.yaml").name
-POLL = File.basename(File.expand_path("."))
-$html = HTML.new("dudle - #{POLLNAME} - Delete")
-
-$html.header["Cache-Control"] = "no-cache"
-
-$html.add_css("../dudle.css")
-
-$html << "<body>"
-
if $cgi.include?("confirmnumber")
CONFIRM = $cgi["confirmnumber"].to_i
if $cgi["confirm"] == QUESTIONS[CONFIRM]
Dir.chdir("..")
- File.move(POLL, "/tmp/#{POLL}.#{rand(9999999)}")
- $html << <<SUCCESS
-<div id='main'>
+ File.move(@d.table.urlsuffix, "/tmp/#{@d.table.urlsuffix}.#{rand(9999999)}")
+ $d.html << <<SUCCESS
<p class='textcolumn'>
The poll was deleted successfully!
</p>
@@ -71,10 +50,8 @@ if $cgi.include?("confirmnumber")
<li><a href='http://www.google.de'>Search something with Google</a></li>
</ul>
</div>
-</div>
-</body>
SUCCESS
- $html.out($cgi)
+ $d.out($cgi)
exit
else
hint = <<HINT
@@ -101,12 +78,9 @@ HINT
else
CONFIRM = rand(QUESTIONS.size)
end
-$html << <<TABLE
-#{Dudle::tabs("Delete Poll")}
-<div id='main'>
- <h1>#{POLLNAME}</h1>
+$d.html << <<TABLE
<h2>Delete this Poll</h2>
- You want to delete the poll named <b>#{POLLNAME}</b>.<br />
+ You want to delete the poll named <b>#{$d.table.name}</b>.<br />
This is an irreversible action!<br />
If you are sure in what you are doing, please type into the form “#{QUESTIONS[CONFIRM]}”
#{hint}
@@ -117,10 +91,8 @@ $html << <<TABLE
<input type='submit' value='Delete' />
</div>
</form>
-</div>
-</body>
TABLE
-$html.out($cgi)
+$d.out($cgi)
end
diff --git a/dudle.rb b/dudle.rb
new file mode 100644
index 0000000..a94dfcf
--- /dev/null
+++ b/dudle.rb
@@ -0,0 +1,91 @@
+############################################################################
+# Copyright 2009 Benjamin Kellermann #
+# #
+# This file is part of dudle. #
+# #
+# Dudle is free software: you can redistribute it and/or modify it under #
+# the terms of the GNU Affero General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# Dudle is distributed in the hope that it will be useful, but WITHOUT ANY #
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public #
+# License for more details. #
+# #
+# You should have received a copy of the GNU Affero General Public License #
+# along with dudle. If not, see <http://www.gnu.org/licenses/>. #
+############################################################################
+
+require "yaml"
+require "cgi"
+
+$cgi = CGI.new
+
+olddir = File.expand_path(".")
+Dir.chdir("..")
+require "html"
+require "poll"
+require "config"
+require "charset"
+Dir.chdir(olddir)
+
+class Dudle
+ attr_reader :html, :table, :urlsuffix
+ def Dudle.tabs(active_tab)
+ ret = "<div id='tabs'><ul>"
+ [["Home",".."],
+ ["",""],
+ ["Poll","."],
+ ["History","history.cgi"],
+ ["Help","help.cgi"],
+ ["",""],
+ ["Edit Columns","edit_columns.cgi"],
+ ["Invite Participants","invite_participants.cgi"],
+ ["Access Control","access_control.cgi"],
+ ["Delete Poll","delete_poll.cgi"],
+ ["",""],
+ ["Customize","customize.cgi"]
+ ].each{|tab,file|
+ case tab
+ when active_tab
+ ret += "<li id='active_tab' >&nbsp;#{tab}&nbsp;</li> "
+ when ""
+ ret += "<li class='separator_tab' />"
+ else
+ ret += "<li class='nonactive_tab' ><a href='#{file}'>&nbsp;#{tab}&nbsp;</a></li> "
+ end
+ }
+ ret += "</ul></div>"
+ ret
+ end
+ def initialize(htmltitle, revision=nil)
+ if revision
+ @table = YAML::load(VCS.cat(revision, "data.yaml"))
+ else
+ @table = YAML::load_file("data.yaml")
+ end
+ @urlsuffix = File.basename(File.expand_path("."))
+
+ @html = HTML.new("dudle - #{@table.name} - #{htmltitle}")
+ @html.header["Cache-Control"] = "no-cache"
+ @html.add_css("../dudle.css")
+
+ @html << <<HEAD
+<body>
+<div id='header' />
+#{Dudle.tabs(htmltitle)}
+<div id='main'>
+ <h1>#{@table.name}</h1>
+HEAD
+ end
+ def out(cgi)
+ @html << "</div></body>"
+ @html.out(cgi)
+ end
+ def <<(htmlbodytext)
+ @html << htmlbodytext
+ end
+
+end
+
diff --git a/edit_columns.rb b/edit_columns.rb
index 9841bc2..474281c 100755
--- a/edit_columns.rb
+++ b/edit_columns.rb
@@ -19,62 +19,31 @@
# along with dudle. If not, see <http://www.gnu.org/licenses/>. #
############################################################################
-require "yaml"
-require "cgi"
-
-
if __FILE__ == $0
-
-$cgi = CGI.new
-
-olddir = File.expand_path(".")
-Dir.chdir("..")
-require "html"
-load "config.rb"
-require "poll"
-Dir.chdir(olddir)
-# BUGFIX for Time.parse, which handles the zone indeterministically
-class << Time
- alias_method :old_parse, :parse
- def Time.parse(date, now=self.now)
- Time.old_parse("2009-10-25 00:30")
- Time.old_parse(date)
- end
-end
+
+load "../dudle.rb"
revbeforeedit = VCS.revno
if $cgi.include?("undo_revision") && $cgi["undo_revision"].to_i < revbeforeedit
undorevision = $cgi["undo_revision"].to_i
- table = YAML::load(VCS.cat(undorevision, "data.yaml"))
+ $d = Dudle.new("Edit Columns",undorevision)
comment = "Reverted Poll"
comment = "Redo changes" if $cgi.include?("redo")
- table.store("#{comment} to version #{undorevision}")
+ $d.table.store("#{comment} to version #{undorevision}")
else
- table = YAML::load_file("data.yaml")
+ $d = Dudle.new("Edit Columns")
end
-table.edit_column($cgi["columnid"],$cgi["new_columnname"],$cgi) if $cgi.include?("new_columnname")
-table.delete_column($cgi["deletecolumn"]) if $cgi.include?("deletecolumn")
+$d.table.edit_column($cgi["columnid"],$cgi["new_columnname"],$cgi) if $cgi.include?("new_columnname")
+$d.table.delete_column($cgi["deletecolumn"]) if $cgi.include?("deletecolumn")
revno = VCS.revno
-$html = HTML.new("dudle - #{table.name} - Edit Columns")
-$html.header["Cache-Control"] = "no-cache"
-load "../charset.rb"
-$html.add_css("../dudle.css")
-
-$html << "<body>"
-$html << Dudle::tabs("Edit Columns")
-
-$html << <<TABLE
- <div id='main'>
- <h1>#{table.name}</h1>
- <h2>Add and Remove Columns</h2>
-TABLE
+$d << "<h2>Add and Remove Columns</h2>"
# ADD/REMOVE COLUMN
-$html << table.edit_column_htmlform($cgi["editcolumn"],revno)
+$d << $d.table.edit_column_htmlform($cgi["editcolumn"],revno)
h = VCS.history
urevs = h.undorevisions
@@ -120,13 +89,13 @@ if rrevs.min
hidden["Redo"] = "<input type='hidden' name='redo'/>"
end
- $html << <<UNDOREDOREADY
+ $d << <<UNDOREDOREADY
<div class='undo'>
<table summary='Undo/Redo functionallity'>
<tr>
UNDOREDOREADY
["Undo","Redo"].each{|button|
- $html << <<TD
+ $d << <<TD
<td>
<form method='post' action=''>
<div>
@@ -139,7 +108,7 @@ UNDOREDOREADY
</td>
TD
}
- $html << <<READY
+ $d << <<READY
<td>
<form method='get' action='help.cgi'>
<div>
@@ -152,10 +121,9 @@ TD
</div>
READY
-#$html << (urevs + rrevs).to_html(curundorev,"")
+#$d << (urevs + rrevs).to_html(curundorev,"")
-$html << "</div></body>"
-$html.out($cgi)
+$d.out($cgi)
end
diff --git a/help.rb b/help.rb
index 923476d..7935aea 100755
--- a/help.rb
+++ b/help.rb
@@ -19,33 +19,16 @@
# along with dudle. If not, see <http://www.gnu.org/licenses/>. #
############################################################################
-require "cgi"
-
if __FILE__ == $0
-$cgi = CGI.new
-olddir = File.expand_path(".")
-Dir.chdir("..")
-load "html.rb"
-load "config.rb"
-require "poll"
-require "yaml"
-Dir.chdir(olddir)
-
-POLL = YAML::load_file("data.yaml").name
-$html = HTML.new("dudle - #{POLL} - Access Control Settings")
-$html.header["Cache-Control"] = "no-cache"
-
-$html.add_css("../dudle.css")
-
-$html << <<END
-<body>
-#{Dudle::tabs("Help")}
-<div id='main'>
-<h1>#{POLL}</h1>
+load "../dudle.rb"
+
+$d = Dudle.new("Help")
+
+$d << <<END
The link to your poll is:
<pre>#{SITEURL}</pre>
-<a href='mailto:?subject=dudle%20link&body=#{SITEURL}'>Send this link via email...</a>
+<a href='mailto:?subject=dudle%20link&amp;body=#{SITEURL}'>Send this link via email...</a>
<form method='get' action='.'>
<div>
<input type='submit' value='To the Vote interface' />
@@ -53,10 +36,7 @@ The link to your poll is:
</form>
END
-$html << "</div>"
-$html << "</body>"
-
-$html.out($cgi)
+$d.out($cgi)
end
diff --git a/history.rb b/history.rb
index b8c047e..f154fea 100755
--- a/history.rb
+++ b/history.rb
@@ -19,56 +19,28 @@
# along with dudle. If not, see <http://www.gnu.org/licenses/>. #
############################################################################
-require "cgi"
-require "yaml"
-
if __FILE__ == $0
-
-$cgi = CGI.new
-
-olddir = File.expand_path(".")
-Dir.chdir("..")
-require "html"
-require "poll"
-load "config.rb"
-Dir.chdir(olddir)
+load "../dudle.rb"
if $cgi.include?("revision")
revno=$cgi["revision"].to_i
versiontitle = "Poll of Version #{revno}"
- table = YAML::load(VCS.cat(revno, "data.yaml"))
+ $d = Dudle.new("History",revno)
else
revno = VCS.revno
versiontitle = "Current Poll (Version #{revno})"
- table = YAML::load_file("data.yaml")
+ $d = Dudle.new("History")
end
-$html = HTML.new("dudle - #{table.name} - History")
-$html.header["Cache-Control"] = "no-cache"
-load "../charset.rb"
-$html.add_css("../dudle.css")
-
-$html << "<body>"
-$html << Dudle::tabs("History")
-
-$html << <<TABLE
- <div id='main'>
- <h1>#{table.name}</h1>
-TABLE
-
-
-
-$html << "<h2>#{versiontitle}</h2>"
-$html << table.to_html("",false)
-
-$html << "<h2>History</h2>"
-$html << "<div id='history'>"
-$html << table.history_selectform($cgi.include?("revision") ? revno : nil, $cgi["history"])
+$d << "<h2>#{versiontitle}</h2>"
+$d << $d.table.to_html("",false)
-$html << table.history_to_html(revno, $cgi["history"])
-$html << "</div>"
+$d << "<h2>History</h2>"
+$d << "<div id='history'>"
+$d << $d.table.history_selectform($cgi.include?("revision") ? revno : nil, $cgi["history"])
-$html << "</div></body>"
+$d << $d.table.history_to_html(revno, $cgi["history"])
+$d << "</div>"
-$html.out($cgi)
+$d.out($cgi)
end
diff --git a/html.rb b/html.rb
index 6164d01..3d55b37 100644
--- a/html.rb
+++ b/html.rb
@@ -80,32 +80,3 @@ HEAD
end
end
-module Dudle
- def Dudle.tabs(active_tab)
- ret = "<div id='tabs'><ul>"
- [["Home",".."],
- ["",""],
- ["Poll","."],
- ["History","history.cgi"],
- ["Help","help.cgi"],
- ["",""],
- ["Edit Columns","edit_columns.cgi"],
- ["Invite Participants","invite_participants.cgi"],
- ["Access Control","access_control.cgi"],
- ["Delete Poll","delete_poll.cgi"],
- ["",""],
- ["Customize","customize.cgi"]
- ].each{|tab,file|
- case tab
- when active_tab
- ret += "<li id='active_tab' >&nbsp;#{tab}&nbsp;</li> "
- when ""
- ret += "<li class='separator_tab' />"
- else
- ret += "<li class='nonactive_tab' ><a href='#{file}'>&nbsp;#{tab}&nbsp;</a></li> "
- end
- }
- ret += "</ul></div>"
- ret
- end
-end
diff --git a/invite_participants.rb b/invite_participants.rb
index 6c9204a..abb1ddc 100755
--- a/invite_participants.rb
+++ b/invite_participants.rb
@@ -19,47 +19,23 @@
# along with dudle. If not, see <http://www.gnu.org/licenses/>. #
############################################################################
-require "yaml"
-require "cgi"
-
-
if __FILE__ == $0
-$cgi = CGI.new
-
-olddir = File.expand_path(".")
-Dir.chdir("..")
-require "html"
-load "config.rb"
-require "poll"
-Dir.chdir(olddir)
-
+load "../dudle.rb"
-table = YAML::load_file("data.yaml")
+$d = Dudle.new("Invite Participants")
if $cgi.include?("add_participant")
- table.add_participant("",$cgi["add_participant"],{})
+ $d.table.add_participant("",$cgi["add_participant"],{})
end
-$html = HTML.new("dudle - #{table.name} - Invite Participants")
-$html.header["Cache-Control"] = "no-cache"
-load "../charset.rb"
-$html.add_css("../dudle.css")
-
-$html << "<body>"
-$html << Dudle::tabs("Invite Participants")
-
-$html << <<TABLE
- <div id='main'>
- <h1>#{table.name}</h1>
+$d << <<TABLE
<h2>Invite Participants</h2>
<form method='post' action=''>
- #{table.to_html("","invite")}
+ #{$d.table.to_html("","invite")}
</form>
TABLE
-$html << "</div></body>"
-
-$html.out($cgi)
+$d.out($cgi)
end
diff --git a/participate.rb b/participate.rb
index 6efca03..f085e8f 100755
--- a/participate.rb
+++ b/participate.rb
@@ -19,26 +19,14 @@
# along with dudle. If not, see <http://www.gnu.org/licenses/>. #
############################################################################
-require "yaml"
if __FILE__ == $0
-
-require "cgi"
-
-$cgi = CGI.new
-
-olddir = File.expand_path(".")
-Dir.chdir("..")
-require "html"
-require "poll"
-load "config.rb"
-Dir.chdir(olddir)
-
-table = YAML::load_file("data.yaml")
+load "../dudle.rb"
+$d = Dudle.new("Poll")
if $cgi.include?("add_participant")
if $cgi.include?("delete_participant")
- table.delete($cgi["olduser"])
+ $d.table.delete($cgi["olduser"])
else
agreed = {}
$cgi.params.each{|k,v|
@@ -47,43 +35,27 @@ if $cgi.include?("add_participant")
end
}
- table.add_participant($cgi["olduser"],$cgi["add_participant"],agreed)
+ $d.table.add_participant($cgi["olduser"],$cgi["add_participant"],agreed)
end
end
-table.add_comment($cgi["commentname"],$cgi["comment"]) if $cgi["comment"] != ""
-table.delete_comment($cgi["delete_comment"].to_i) if $cgi.include?("delete_comment")
-
-$html = HTML.new("dudle - #{table.name}")
-$html.header["Cache-Control"] = "no-cache"
-load "../charset.rb"
-$html.add_css("../dudle.css")
-$html.add_css("../print.css","print")
+$d.table.add_comment($cgi["commentname"],$cgi["comment"]) if $cgi["comment"] != ""
+$d.table.delete_comment($cgi["delete_comment"].to_i) if $cgi.include?("delete_comment")
-$html.add_atom("atom.cgi") if File.exists?("../atom.rb")
+$d.html.add_css("../print.css","print")
-
-$html << "<body>"
-
-$html << Dudle::tabs("Poll")
-
-$html << <<HEAD
- <div id='main'>
-HEAD
+$d.html.add_atom("atom.cgi") if File.exists?("../atom.rb")
# TABLE
-$html << <<TABLE
-<h1>#{table.name}</h1>
+$d << <<TABLE
<div id='polltable'>
<form method='post' action='.'>
- #{table.to_html($cgi['edituser'])}
+ #{$d.table.to_html($cgi['edituser'])}
</form>
</div>
TABLE
-$html << table.comment_to_html
-
-$html << "</div></body>"
+$d << $d.table.comment_to_html
-$html.out($cgi)
+$d.out($cgi)
end
diff --git a/timepollhead.rb b/timepollhead.rb
index 4521f26..24958a0 100644
--- a/timepollhead.rb
+++ b/timepollhead.rb
@@ -17,6 +17,15 @@
# along with dudle. If not, see <http://www.gnu.org/licenses/>. #
############################################################################
+# BUGFIX for Time.parse, which handles the zone indeterministically
+class << Time
+ alias_method :old_parse, :parse
+ def Time.parse(date, now=self.now)
+ Time.old_parse("2009-10-25 00:30")
+ Time.old_parse(date)
+ end
+end
+
class TimePollHead
class TimeString
attr_reader :date, :time