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 --- access_control.rb | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) (limited to 'access_control.rb') diff --git a/access_control.rb b/access_control.rb index 6080452..a40ad43 100755 --- a/access_control.rb +++ b/access_control.rb @@ -19,22 +19,11 @@ # along with dudle. If not, see . # ############################################################################ -require "cgi" - if __FILE__ == $0 -$cgi = CGI.new -olddir = File.expand_path(".") -Dir.chdir("..") -load "html.rb" -load "config.rb" -require "poll" -require "yaml" -Dir.chdir(olddir) +load "../dudle.rb" -POLL = YAML::load_file("data.yaml").name -$html = HTML.new("dudle - #{POLL} - Help") -$html.header["Cache-Control"] = "no-cache" +$d = Dudle.new("Access Control") acusers = {} @@ -66,9 +55,9 @@ HTACCESS } VCS.commit("Access Control changed") unless acusers.empty? - $html.header["status"] = "REDIRECT" - $html.header["Cache-Control"] = "no-cache" - $html.header["Location"] = "access_control.cgi" + $d.html.header["status"] = "REDIRECT" + $d.html.header["Cache-Control"] = "no-cache" + $d.html.header["Location"] = "access_control.cgi" end end def add_to_htdigest(user,password) @@ -173,19 +162,10 @@ if $cgi.include?("ac_user") end end -unless $html.header["status"] == "REDIRECT" - -load "../charset.rb" -$html.add_css("../dudle.css") +unless $d.html.header["status"] == "REDIRECT" -$html << "" -$html << Dudle::tabs("Access Control") -$html << < -

#{POLL}

-

Change Access Control Settings

-HEAD +$d.html << "

Change Access Control Settings

" if acusers.empty? && $cgi["ac_activate"] != "Activate" @@ -216,7 +196,7 @@ else end -$html << < @@ -239,8 +219,7 @@ $html << <" end -$html.out($cgi) +$d.out($cgi) end -- cgit v1.2.3