aboutsummaryrefslogtreecommitdiff
path: root/access_control.rb
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2010-01-20 16:44:00 +0100
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2010-01-20 16:44:00 +0100
commit93a2b996386c989bd28013332086f7489e7c7b52 (patch)
tree4d8f274f416a94ae4136d4f22f2aacf7cefb2139 /access_control.rb
parent3488b0c58caa8250c81fd2d5e5a15a2d4332e2e1 (diff)
added localization support + german language
Diffstat (limited to 'access_control.rb')
-rwxr-xr-xaccess_control.rb50
1 files changed, 29 insertions, 21 deletions
diff --git a/access_control.rb b/access_control.rb
index dfe3381..6701738 100755
--- a/access_control.rb
+++ b/access_control.rb
@@ -23,7 +23,7 @@ if __FILE__ == $0
load "../dudle.rb"
-$d = Dudle.new("Access Control")
+$d = Dudle.new
acusers = {}
@@ -71,11 +71,12 @@ def add_to_htdigest(user,password)
end
def createform(userarray,hint,acusers)
+ usernamestr = _("Username:")
ret = <<FORM
<form id='ac_#{userarray[0]}' method='post' action='' >
- <table summary='Enter Access Control details' class='settingstable'>
+ <table class='settingstable'>
<tr>
- <td class='label'>Username:</td>
+ <td class='label'>#{usernamestr}</td>
<td title="#{userarray[1]}">
#{userarray[0]}
<input type='hidden' name='ac_user' value='#{userarray[0]}' />
@@ -83,10 +84,12 @@ def createform(userarray,hint,acusers)
</tr>
FORM
+ passwdstr = _("Password")
+ repeatstr = _("repeat")
2.times{|i|
ret += <<PASS
<tr>
- <td class='label'><label for='password#{i}'>Password#{i == 1 ? " (repeat)" : ""}:</label></td>
+ <td class='label'><label for='password#{i}'>#{passwdstr}#{i == 1 ? " (#{repeatstr})" : ""}:</label></td>
<td>
PASS
if acusers.include?(userarray[0])
@@ -108,12 +111,14 @@ PASS
FORM
if acusers.include?(userarray[0])
if userarray[0] == "admin" && acusers.include?("participant")
- ret += "<div class='shorttextcolumn'>You have to remove the participant user before you can remove the administrator.</div>"
+ ret += "<div class='shorttextcolumn'>" + _("You have to remove the participant user before you can remove the administrator.") + "</div>"
else
- ret += "<input type='submit' name='ac_delete_#{userarray[0]}' value='Delete' />"
+ ret += "<input type='hidden' name='ac_delete_#{userarray[0]}' value='Delete' />"
+ ret += "<input type='submit' value='" + _("Delete") + "' />"
end
else
- ret += "<input type='submit' name='ac_create' value='Save' />"
+ ret += "<input type='hidden' name='ac_create' value='Save' />"
+ ret += "<input type='submit' value='" + _("Save") + "' />"
end
ret += <<FORM
@@ -131,9 +136,9 @@ if $cgi.include?("ac_user")
user = $cgi["ac_user"]
if !(user =~ /^[\w]*$/)
# add user
- usercreatenotice = "<div class='error'>Only uppercase, lowercase, digits are allowed in the username.</div>"
+ usercreatenotice = "<div class='error'>" + _("Only letters and digits are allowed in the username.") + "</div>"
elsif $cgi["ac_password0"] != $cgi["ac_password1"]
- usercreatenotice = "<div class='error'>Passwords did not match.</div>"
+ usercreatenotice = "<div class='error'>" + _("Passwords did not match.") + "</div>"
else
if $cgi.include?("ac_create")
add_to_htdigest(user,$cgi["ac_password0"])
@@ -166,43 +171,46 @@ $d.wizzard_redirect
if $d.html.header["status"] != "REDIRECT"
-$d.html << "<h2>Change Access Control Settings</h2>"
+$d.html << "<h2>" + _("Change Access Control Settings") + "</h2>"
if acusers.empty? && $cgi["ac_activate"] != "Activate"
- acstatus = ["red","not activated"]
- acswitchbutton = "<input type='submit' name='ac_activate' value='Activate' />"
+ acstatus = ["red",_("not activated")]
+ acswitchbutton = "<input type='hidden' name='ac_activate' value='Activate' />"
+ acswitchbutton += "<input type='submit' value='" + _("Activate") + "' />"
else
if acusers.empty?
- acstatus = ["blue","will be activated when at least an admin user is configured"]
- acswitchbutton = "<input type='submit' name='ac_activate' value='Deactivate' />"
+ acstatus = ["blue",_("will be activated when at least an admin user is configured")]
+ acswitchbutton = "<input type='hidden' name='ac_activate' value='Deactivate' />"
+ acswitchbutton += "<input type='submit' value='" + _("Deactivate") + "' />"
else
- acstatus = ["green", "activated"]
- acswitchbutton = "<div class='shorttextcolumn'>You have to remove all users before you can deactivate the access control settings.</div>"
+ acstatus = ["green", _("activated")]
+ acswitchbutton = "<div class='shorttextcolumn'>" + _("You have to remove all users before you can deactivate the access control settings.") + "</div>"
end
- admincreatenotice = usercreatenotice || "You will be asked for the password you entered here after pressing save!"
+ admincreatenotice = usercreatenotice || _("You will be asked for the password you entered here after pressing save!")
user = ["admin",
- "The user ‘admin’ has access to the vote as well as the configuration interface."]
+ _("The user ‘admin’ has access to the vote as well as the configuration interface.")]
createform = createform(user,admincreatenotice,acusers)
if acusers.include?("admin")
participantcreatenotice = usercreatenotice || ""
user = ["participant",
- "The user ‘participant’ has only access to the vote interface."]
+ _("The user ‘participant’ has only access to the vote interface.")]
createform += createform(user,participantcreatenotice,acusers)
end
end
+acstr = _("Access control:")
$d.html << <<AC
<form id='ac' method='post' action='' >
-<table summary='Enable Access Control settings' class='settingstable'>
+<table class='settingstable'>
<tr>
<td>
- Access control:
+ #{acstr}
</td>
<td style='color: #{acstatus[0]}'>
#{acstatus[1]}