aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-10-07 09:20:47 +0200
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-10-07 09:20:47 +0200
commit16d58fddddfa7942d6355dd27fa87a77ff53f97c (patch)
tree371d976fa0cea05f254c5ade5bb0406cc2439d3f
parentd67da9fd0f5fd21e0438d6676d7353342a517bea (diff)
new feature: users can delete their row
-rwxr-xr-xparticipate.rb21
-rw-r--r--poll.rb5
2 files changed, 16 insertions, 10 deletions
diff --git a/participate.rb b/participate.rb
index 77f11ba..2c52b6a 100755
--- a/participate.rb
+++ b/participate.rb
@@ -44,14 +44,19 @@ else
table = YAML::load_file("data.yaml")
if $cgi.include?("add_participant")
- agreed = {}
- $cgi.params.each{|k,v|
- if k =~ /^add_participant_checked_/
- agreed[k.gsub(/^add_participant_checked_/,"")] = v[0]
- end
- }
-
- table.add_participant($cgi["add_participant"],agreed)
+ if $cgi.include?("delete_participant")
+ table.invite_delete($edituser)
+ $edituser = nil
+ else
+ agreed = {}
+ $cgi.params.each{|k,v|
+ if k =~ /^add_participant_checked_/
+ agreed[k.gsub(/^add_participant_checked_/,"")] = v[0]
+ end
+ }
+
+ table.add_participant($cgi["add_participant"],agreed)
+ end
end
table.add_comment($cgi["commentname"],$cgi["comment"]) if $cgi["comment"] != ""
diff --git a/poll.rb b/poll.rb
index b54249e..59ba5b5 100644
--- a/poll.rb
+++ b/poll.rb
@@ -136,8 +136,9 @@ class Poll
type='text'
name='add_participant'
value=\"#{participant}\"
- title='To change a line, add a new person with the same name!' />
- </td>\n"
+ title='To change a line, add a new person with the same name!' />"
+ ret += "<br /><input type='submit' name='delete_participant' value='delete user' />" if $edituser
+ ret += "</td>\n"
@head.sort.each{|columntitle,columndescription|
ret += "<td class='checkboxes'><table>"
[[YES, YESVAL],[NO, NOVAL],[MAYBE, MAYBEVAL]].each{|valhuman, valbinary|