diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2010-12-03 15:17:59 +0100 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2010-12-03 15:17:59 +0100 |
commit | dccd3af9d67ae1f3ef13f46c03e61678d57169db (patch) | |
tree | 3598b55b663b511ba97e5ee55c8010928142d1d5 /participate.rb | |
parent | 7b629538e7e3d806307e83e3d5c7cdd2c770b42c (diff) |
use redirect to overcome the problem of reload after vote
Diffstat (limited to '')
-rwxr-xr-x | participate.rb | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/participate.rb b/participate.rb index ff7da89..5153f0d 100755 --- a/participate.rb +++ b/participate.rb @@ -24,9 +24,11 @@ if __FILE__ == $0 load "../dudle.rb" $d = Dudle.new +edit = false unless $cgi.include?("cancel") if $cgi.include?("delete_participant_confirm") $d.table.delete($cgi["delete_participant_confirm"]) + edit = true elsif $cgi.include?("add_participant") agreed = {} $cgi.params.each{|k,v| @@ -36,23 +38,29 @@ unless $cgi.include?("cancel") } $d.table.add_participant($cgi["olduser"],$cgi["add_participant"],agreed) + edit = true end end -$d.table.add_comment($cgi["commentname"],$cgi["comment"]) if $cgi["comment"] != "" -$d.table.delete_comment($cgi["delete_comment"]) if $cgi.include?("delete_comment") +if $cgi["comment"] != "" + $d.table.add_comment($cgi["commentname"],$cgi["comment"]) + edit = true +end +if $cgi.include?("delete_comment") + $d.table.delete_comment($cgi["delete_comment"]) + edit = true +end -$d.html.add_atom("atom.cgi") if File.exists?("../atom.rb") +if edit + $d.html.header["status"] = "REDIRECT" + $d.html.header["Cache-Control"] = "no-cache" + $d.html.header["Location"] = SITEURL + $d << _("The changes were saved, you should be redirected to %{link}.") % {:link => "<a href=\"#{SITEURL}\">#{SITEURL}</a>"} -reloadstr = _("Reload") -$d << <<END -<form method='get' action='.'> -<div> -<input value='#{reloadstr}' type='submit'/> -</div> -</form> -END +else + +$d.html.add_atom("atom.cgi") if File.exists?("../atom.rb") # TABLE $d << <<HTML @@ -65,5 +73,7 @@ $d << <<HTML #{$d.table.comment_to_html} HTML +end + $d.out end |