From 54386017ceacacb2a6990a29bffc7f93982572e4 Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Thu, 26 Nov 2009 00:15:10 +0100 Subject: heavy code restructuring, moved common code to dudle.rb --- history.rb | 50 +++++++++++--------------------------------------- 1 file changed, 11 insertions(+), 39 deletions(-) (limited to 'history.rb') 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 . # ############################################################################ -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 << "" -$html << Dudle::tabs("History") - -$html << < -

#{table.name}

-TABLE - - - -$html << "

#{versiontitle}

" -$html << table.to_html("",false) - -$html << "

History

" -$html << "
" -$html << table.history_selectform($cgi.include?("revision") ? revno : nil, $cgi["history"]) +$d << "

#{versiontitle}

" +$d << $d.table.to_html("",false) -$html << table.history_to_html(revno, $cgi["history"]) -$html << "
" +$d << "

History

" +$d << "
" +$d << $d.table.history_selectform($cgi.include?("revision") ? revno : nil, $cgi["history"]) -$html << "
" +$d << $d.table.history_to_html(revno, $cgi["history"]) +$d << "" -$html.out($cgi) +$d.out($cgi) end -- cgit v1.2.3