aboutsummaryrefslogtreecommitdiff
path: root/participate.rb
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-19 23:39:54 +0100
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-19 23:39:54 +0100
commit7effadace31c5c9efee2708e28acc4359b534b25 (patch)
tree85a859a8deeb616f88b83fed18f35702b6b0026e /participate.rb
parent0e8d1d9d28d127704897bb9fb4ea06105a1d0f84 (diff)
better code structure
Diffstat (limited to 'participate.rb')
-rwxr-xr-xparticipate.rb27
1 files changed, 12 insertions, 15 deletions
diff --git a/participate.rb b/participate.rb
index 7f8dce2..d134eb2 100755
--- a/participate.rb
+++ b/participate.rb
@@ -14,13 +14,10 @@ require "cgi"
$cgi = CGI.new
-
olddir = File.expand_path(".")
Dir.chdir("..")
require "html"
-$html = HTML.new
require "poll"
-load "charset.rb"
load "config.rb"
Dir.chdir(olddir)
@@ -48,23 +45,26 @@ else
table.add_comment($cgi["commentname"],$cgi["comment"]) if $cgi["comment"] != ""
table.delete_comment($cgi["delete_comment"].to_i) if $cgi.include?("delete_comment")
end
+$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")
$html.add_atom("atom.cgi") if File.exists?("../atom.rb")
-$html.add_head("dudle - #{table.name}")
-$html.htmlout += "<body>"
-$html.add_tabs
+$html << "<body>"
+
+$html << Dudle::tabs
-$html.htmlout += <<HEAD
+$html << <<HEAD
<div id='main'>
HEAD
# TABLE
if VCS.revno == 1
- $html.htmlout += <<HINT
+ $html << <<HINT
<h1>#{table.name}</h1>
<pre id='configwarning'>
.
@@ -85,7 +85,7 @@ if VCS.revno == 1
</pre>
HINT
else
- $html.htmlout += <<TABLE
+ $html << <<TABLE
<p id='history'>history:#{table.history_to_html}</p>
<h1>#{table.name}</h1>
<div id='polltable'>
@@ -95,13 +95,10 @@ else
</div>
TABLE
- $html.htmlout += table.comment_to_html
+ $html << table.comment_to_html
end
-$html.htmlout += "</div></body>"
+$html << "</div></body>"
-$html.htmlout += "</html>"
-
-$html.header["Cache-Control"] = "no-cache"
-$cgi.out($html.header){$html.htmlout}
+$html.out($cgi)
end