diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2009-11-26 00:15:10 +0100 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2009-11-26 00:15:10 +0100 |
commit | 54386017ceacacb2a6990a29bffc7f93982572e4 (patch) | |
tree | 762f8f6b6aa504ca7ffc767bd5c43e1c2212e3ea /history.rb | |
parent | 5ebf12ea5b30cd9a7c5c31bff087d7703f1e149c (diff) |
heavy code restructuring, moved common code to dudle.rb
Diffstat (limited to '')
-rwxr-xr-x | history.rb | 50 |
1 files changed, 11 insertions, 39 deletions
@@ -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 |