diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2008-11-17 18:34:11 +0100 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2008-11-17 18:34:11 +0100 |
commit | 911b56477925248808aab2e8cd075faeeaefaf48 (patch) | |
tree | 2c204e7c01e306804c6435dca424c13d1495d5c5 | |
parent | cb09cd55424b21904d42c2bf2157907ad981e532 (diff) | |
parent | e9e6f73609bbbd55f5aa7250f0650848120e8db0 (diff) |
merged with main
-rw-r--r-- | License | 1 | ||||
-rwxr-xr-x | atom.cgi | 7 | ||||
-rw-r--r-- | datepoll.rb | 6 | ||||
-rw-r--r-- | dudle.css | 6 | ||||
-rw-r--r-- | hash.rb | 10 | ||||
-rwxr-xr-x | index.cgi | 7 | ||||
-rw-r--r-- | overview.rb | 19 | ||||
-rw-r--r-- | participate.rb | 6 | ||||
-rw-r--r-- | poll.rb | 43 | ||||
-rw-r--r-- | print.css | 6 |
10 files changed, 90 insertions, 21 deletions
@@ -0,0 +1 @@ +This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. @@ -1,4 +1,11 @@ #!/usr/bin/env ruby + +################################ +# Author: Benjamin Kellermann # +# Licence: CC-by-sa 3.0 # +# see Licence # +################################ + require "rubygems" require "atom" require "yaml" diff --git a/datepoll.rb b/datepoll.rb index 344d122..b05b8d8 100644 --- a/datepoll.rb +++ b/datepoll.rb @@ -1,3 +1,9 @@ +################################ +# Author: Benjamin Kellermann # +# Licence: CC-by-sa 3.0 # +# see Licence # +################################ + require "date" require "poll" @@ -1,3 +1,9 @@ +/******************************** + * Author: Benjamin Kellermann * + * Licence: CC-by-sa 3.0 * + * see Licence * + *******************************/ + td.yes, input.choosen { background-color:#0F0; } td.no { background-color:#F00; } td.maybe { background-color:#FF0; } @@ -1,8 +1,14 @@ +################################ +# Author: Benjamin Kellermann # +# Licence: CC-by-sa 3.0 # +# see Licence # +################################ + class Hash def compare_by_values(other, fieldarray) return 0 if fieldarray.size == 0 - return -1 if self[fieldarray[0]].nil? - return 1 if other[fieldarray[0]].nil? + return 1 if self[fieldarray[0]].nil? + return -1 if other[fieldarray[0]].nil? if self[fieldarray[0]] == other[fieldarray[0]] if fieldarray.size == 1 @@ -1,4 +1,11 @@ #!/usr/bin/env ruby + +################################ +# Author: Benjamin Kellermann # +# Licence: CC-by-sa 3.0 # +# see Licence # +################################ + require "yaml" require "cgi" diff --git a/overview.rb b/overview.rb index 6990bda..4fb4091 100644 --- a/overview.rb +++ b/overview.rb @@ -1,3 +1,9 @@ +################################ +# Author: Benjamin Kellermann # +# Licence: CC-by-sa 3.0 # +# see Licence # +################################ + require "poll" require "datepoll" @@ -94,5 +100,18 @@ $htmlout += <<CREATE </fieldset> CREATE +$htmlout += <<CHARSET +<fieldset><legend>--verbose</legend> +<a href="http://dudle.inf.tu-dresden.de/src/">Get the sourcecode.</a> +<br /> +Checkout using <a href="http://bazaar-vcs.org/">bazaar</a>: +<br /> +bzr branch http://dudle.inf.tu-dresden.de/src/ dudle +<br /> +<a href="mailto:Benjamin_dot_Kellermann@tu-dresden_in_germany?subject=Feedback to dudle">give feedback</a> +</fieldset> +CHARSET + $htmlout += "</body></html>" + diff --git a/participate.rb b/participate.rb index fc48e0a..7531ddf 100644 --- a/participate.rb +++ b/participate.rb @@ -1,3 +1,9 @@ +################################ +# Author: Benjamin Kellermann # +# Licence: CC-by-sa 3.0 # +# see Licence # +################################ + olddir = File.expand_path(".") Dir.chdir("..") require "poll" @@ -1,3 +1,9 @@ +################################ +# Author: Benjamin Kellermann # +# Licence: CC-by-sa 3.0 # +# see Licence # +################################ + require "hash" require "yaml" @@ -12,16 +18,16 @@ class Poll store "Poll #{name} created" end def sort_data fields - @data.sort{|x,y| - if fields.include?("name") - until fields.pop == "name" - end - cmp = x[1].compare_by_values(y[1],fields) == 0 - return cmp == 0 ? x[0] <=> y[0] : cmp - else - return x[1].compare_by_values(y[1],fields) + if fields.include?("name") + until fields.pop == "name" end - } + @data.sort{|x,y| + cmp = x[1].compare_by_values(y[1],fields) + cmp == 0 ? x[0] <=> y[0] : cmp + } + else + @data.sort{|x,y| x[1].compare_by_values(y[1],fields) } + end end def head_to_html ret = "<tr><th><a href='?sort=name'>Name</a></th>\n" @@ -38,7 +44,6 @@ class Poll ret += "<table border='1'>\n" ret += head_to_html - sort_data($cgi.include?("sort") ? $cgi.params["sort"] : ["timestamp"]).each{|participant,poll| ret += "<tr>\n" ret += "<td class='name'>#{participant}</td>\n" @@ -48,11 +53,11 @@ class Poll when nil value = UNKNOWN klasse = "undecided" - when "yes" + when "0 yes" value = YES - when "no" + when "2 no" value = NO - when "maybe" + when "1 maybe" value = MAYBE end ret += "<td class='#{klasse}' title='#{participant}: #{columntitle}'>#{value}</td>\n" @@ -68,13 +73,13 @@ class Poll ret += "<td class='checkboxes'> <table><tr> <td class='input-yes'>#{YES}</td> - <td><input type='radio' value='yes' name='add_participant_checked_#{columntitle}' title='#{columntitle}' /></td> + <td><input type='radio' value='0 yes' name='add_participant_checked_#{columntitle}' title='#{columntitle}' /></td> </tr><tr> <td class='input-no'>#{NO}</td> - <td><input type='radio' value='no' name='add_participant_checked_#{columntitle}' title='#{columntitle}' checked='checked' /></td> + <td><input type='radio' value='2 no' name='add_participant_checked_#{columntitle}' title='#{columntitle}' checked='checked' /></td> </tr><tr> <td class='input-maybe'>#{MAYBE}</td> - <td><input type='radio' value='maybe' name='add_participant_checked_#{columntitle}' title='#{columntitle}' /></td> + <td><input type='radio' value='1 maybe' name='add_participant_checked_#{columntitle}' title='#{columntitle}' /></td> </tr></table> </td>\n" } @@ -88,9 +93,9 @@ class Poll yes = 0 undecided = 0 @data.each_value{|participant| - if participant[columntitle] == "yes" + if participant[columntitle] == "0 yes" yes += 1 - elsif !participant.has_key?(columntitle) or participant[columntitle] == "maybe" + elsif !participant.has_key?(columntitle) or participant[columntitle] == "1 maybe" undecided += 1 end } @@ -168,7 +173,7 @@ END end def add_participant(name, agreed) htmlname = CGI.escapeHTML(name.strip) - @data[htmlname] = {"timestamp" => Time.now} + @data[htmlname] = {"timestamp" => Time.now } @head.each_key{|columntitle| @data[htmlname][columntitle] = agreed[columntitle.to_s] } @@ -1,3 +1,9 @@ +/******************************** + * Author: Benjamin Kellermann * + * Licence: CC-by-sa 3.0 * + * see Licence * + *******************************/ + td.yes, input.choosen { background-color:#0F0; } td.no { background-color:#F00; } td.maybe { background-color:#FF0; } |