diff options
-rwxr-xr-x | config_poll.rb | 62 | ||||
-rw-r--r-- | html.rb | 21 | ||||
-rwxr-xr-x | participate.rb | 2 |
3 files changed, 33 insertions, 52 deletions
diff --git a/config_poll.rb b/config_poll.rb index e2529bc..65484df 100755 --- a/config_poll.rb +++ b/config_poll.rb @@ -13,21 +13,10 @@ require "cgi" if __FILE__ == $0 $cgi = CGI.new -$header = {} - -$header["type"] = "text/html" -#$header["type"] = "application/xhtml+xml" -$header["charset"] = "utf-8" - -$htmlout = <<HEAD -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" - "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> -HEAD olddir = File.expand_path(".") Dir.chdir("..") -load "charset.rb" +require "html" load "config.rb" require "poll" Dir.chdir(olddir) @@ -138,23 +127,15 @@ HTACCESS end end -$htmlout += <<HTMLHEAD -<head> - <meta http-equiv="Content-Type" content="#{$header["type"]}; charset=#{$header["charset"]}" /> - <meta http-equiv="Content-Style-Type" content="text/css" /> - <title>dudle - Administration - #{table.name}</title> - <link rel="stylesheet" type="text/css" href="../dudle.css" title="default"/> -</head> -<body> - <div id='tabs'> - <ul> - <li class='nonactive_tab'><a href='.'> poll </a></li> - <li id='active_tab'> admin </li> - </ul> - </div> -HTMLHEAD - -$htmlout += <<TABLE +$html = HTML.new("dudle - Administration - #{table.name}") +$html.header["Cache-Control"] = "no-cache" +load "../charset.rb" +$html.add_css("../dudle.css") + +$html << "<body" +$html << Dudle::tabs("Admin") + +$html << <<TABLE <div id='main'> <h1>#{table.name}</h1> <form method='post' action='config.cgi'> @@ -163,7 +144,7 @@ $htmlout += <<TABLE TABLE # ADD/REMOVE COLUMN -$htmlout +=<<ADD_EDIT +$html << <<ADD_EDIT <div id='edit_column'> #{table.edit_column_htmlform($cgi["editcolumn"])} </div> @@ -171,7 +152,7 @@ ADD_EDIT # ACCESS CONTROL $accesslevels = { "vote" => "Vote Interface", "config" => "Config Interface" } -$htmlout +=<<ACL +$html << <<ACL <div id='access_control'> <fieldset> <legend>Change Access Control Settings</legend> @@ -182,7 +163,7 @@ $htmlout +=<<ACL </tr> ACL acusers.each{|user,action| - $htmlout += <<USER + $html << <<USER <tr> <td>#{$accesslevels[action]}</td> <td>#{user}</td> @@ -195,15 +176,15 @@ acusers.each{|user,action| USER } -$htmlout += <<ACL +$html << <<ACL <tr> <td> <select name='ac_type'> ACL $accesslevels.each{|action,description| - $htmlout += "<option value='#{action}'>#{description}</option>" + $html << "<option value='#{action}'>#{description}</option>" } - $htmlout += <<ACL + $html << <<ACL </select> </td> <td><input size='6' value="" type='text' name='ac_user' /></td> @@ -215,7 +196,7 @@ ACL </tr> ACL -$htmlout += <<ACL +$html << <<ACL </table> </form> #{usercreatenotice} @@ -223,7 +204,7 @@ $htmlout += <<ACL </div> ACL -$htmlout +=<<REMOVE +$html << <<REMOVE <div id='delete_poll'> <fieldset> <legend>Delete the Whole Poll</legend> @@ -237,11 +218,8 @@ $htmlout +=<<REMOVE </div> REMOVE -$htmlout += "</div></body>" - -$htmlout += "</html>" +$html << "</div></body>" -$header["Cache-Control"] = "no-cache" -$cgi.out($header){$htmlout} +$html.out($cgi) end @@ -67,14 +67,17 @@ HEAD end module Dudle - def Dudle.tabs - return <<HEAD - <div id='tabs'> - <ul> - <li id='active_tab' > poll </li> - <li class='nonactive_tab'><a href='config.cgi'> admin </a></li> - </ul> - </div> -HEAD + def Dudle.tabs(active_tab) + ret = "<div id='tabs'><ul>" + [["Poll","."], + ["Admin","config.cgi"]].each{|tab,file| + if tab == active_tab + ret += "<li id='active_tab' > #{tab} </li> " + else + ret += "<li class='nonactive_tab' ><a href='#{file}'> #{tab} </a></li> " + end + } + ret += "</ul></div>" + ret end end diff --git a/participate.rb b/participate.rb index d134eb2..1bafd30 100755 --- a/participate.rb +++ b/participate.rb @@ -56,7 +56,7 @@ $html.add_atom("atom.cgi") if File.exists?("../atom.rb") $html << "<body>" -$html << Dudle::tabs +$html << Dudle::tabs("Poll") $html << <<HEAD <div id='main'> |