From c827b6deaadb0c08c003cd8e6410fc02b49513fc Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Fri, 20 Nov 2009 00:20:20 +0100 Subject: index.cgi an HTML-system angepasst --- index.cgi | 48 ++++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) (limited to 'index.cgi') diff --git a/index.cgi b/index.cgi index ecd96a3..eedba17 100755 --- a/index.cgi +++ b/index.cgi @@ -13,18 +13,7 @@ require "cgi" if __FILE__ == $0 $cgi = CGI.new -$header = {} -$header["type"] = "text/html" -#$header["type"] = "application/xhtml+xml" -$header["charset"] = "utf-8" -$htmlout = < - -HEAD - -load "charset.rb" if File.exists?("config.rb") load "config.rb" else @@ -33,18 +22,13 @@ else end require "poll" +require "html" +$html = HTML.new("dudle") +load "charset.rb" +$html.add_css("dudle.css") +$htlm.add_atom("atom.cgi") if File.exists?("atom.cgi") -$htmlout += < - dudle - - - -HEAD - - $htmlout += '' if File.exists?("atom.cgi") - - $htmlout += "

dudle

" + $html << "

dudle

" if $cgi.include?("create_poll") SITE=$cgi["create_poll"] @@ -70,14 +54,14 @@ if $cgi.include?("create_poll") Dir.chdir("..") escapedsite = SITEURL + CGI.escapeHTML(CGI.escape(SITE)) + "/" escapedsite.gsub!("+"," ") - $header["status"] = "REDIRECT" - $header["Location"] = escapedsite - $htmlout = "The poll was created successfully. The link to your new poll is:
#{escapedsite}" + $html.header["status"] = "REDIRECT" + $html.header["Location"] = escapedsite + $html << "The poll was created successfully. The link to your new poll is:
#{escapedsite}" end end -unless $header["status"] == "REDIRECT" - $htmlout += <
Config #{UTFASCII} @@ -85,7 +69,7 @@ unless $header["status"] == "REDIRECT" CHARSET - $htmlout += <Create New Poll
@@ -112,13 +96,9 @@ CHARSET CREATE - $htmlout += NOTICE - $htmlout += "" - - $htmlout += "" + $html << NOTICE end -$header["Cache-Control"] = "no-cache" -$cgi.out($header){$htmlout} +$html.out($cgi) end -- cgit v1.2.3