aboutsummaryrefslogtreecommitdiff
path: root/access_control.rb
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-26 00:15:10 +0100
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-26 00:15:10 +0100
commit54386017ceacacb2a6990a29bffc7f93982572e4 (patch)
tree762f8f6b6aa504ca7ffc767bd5c43e1c2212e3ea /access_control.rb
parent5ebf12ea5b30cd9a7c5c31bff087d7703f1e149c (diff)
heavy code restructuring, moved common code to dudle.rb
Diffstat (limited to 'access_control.rb')
-rwxr-xr-xaccess_control.rb39
1 files changed, 9 insertions, 30 deletions
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 <http://www.gnu.org/licenses/>. #
############################################################################
-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 << "<body>"
-$html << Dudle::tabs("Access Control")
-$html << <<HEAD
-<div id='main'>
- <h1>#{POLL}</h1>
- <h2>Change Access Control Settings</h2>
-HEAD
+$d.html << "<h2>Change Access Control Settings</h2>"
if acusers.empty? && $cgi["ac_activate"] != "Activate"
@@ -216,7 +196,7 @@ else
end
-$html << <<AC
+$d.html << <<AC
<form id='ac' method='post' action='' >
<table summary='Enable Access Control settings' class='settingstable'>
<tr>
@@ -239,8 +219,7 @@ $html << <<AC
#{createform}
AC
-$html << "</div></body>"
end
-$html.out($cgi)
+$d.out($cgi)
end