diff options
-rwxr-xr-x | atom.rb | 1 | ||||
-rw-r--r-- | charset.rb | 2 | ||||
-rw-r--r-- | hash.rb | 4 | ||||
-rwxr-xr-x | history.rb | 2 | ||||
-rwxr-xr-x | invite_participants.rb | 10 | ||||
-rw-r--r-- | locale/de/dudle.po | 72 | ||||
-rw-r--r-- | locale/sv/dudle.po | 75 | ||||
-rwxr-xr-x | participate.rb | 10 | ||||
-rw-r--r-- | poll.rb | 85 | ||||
-rw-r--r-- | pollhead.rb | 6 | ||||
-rw-r--r-- | timepollhead.rb | 9 | ||||
-rw-r--r-- | vcs_test.rb | 11 |
12 files changed, 186 insertions, 101 deletions
@@ -47,6 +47,7 @@ log = VCS.history log.reverse_each {|l| feed.entries << Atom::Entry.new do |e| e.title = l.comment +# e.content = Atom::Content::Xhtml.new("<p><a href=\"#{SITEURL}history.cgi?revision=#{l.rev}\">permalink</a>, <a href='#{SITEURL}' >current version</a></p>") e.links << Atom::Link.new(:href => "#{SITEURL}history.cgi?revision=#{l.rev}") e.id = "urn:#{poll.class}:#{poll.name}:rev=#{l.rev}" e.updated = l.timestamp @@ -40,7 +40,7 @@ if $USEUTF EARLIER = CGI.escapeHTML("▴") LATER = CGI.escapeHTML("▾") - EDIT = CGI.escapeHTML("✍") + EDIT = CGI.escapeHTML("✎") DELETE = CGI.escapeHTML("✖") PASSWORDSTAR = CGI.escapeHTML("•") @@ -53,8 +53,8 @@ require "test/unit" assert_equal( 0,a.compare_by_values(a,[1,2,3])) assert_equal( 1,a.compare_by_values(b,[1,2,3])) assert_equal(-1,a.compare_by_values(c,[1,2,3])) - assert_equal( 1,c.compare_by_values(d,[1,2,3])) - assert_equal(-1,d.compare_by_values(c,[1,2,3])) + assert_equal(-1,c.compare_by_values(d,[1,2,3])) + assert_equal( 1,d.compare_by_values(c,[1,2,3])) assert_equal( 0,d.compare_by_values(c,[])) end end @@ -35,7 +35,7 @@ end historystr = _("History") $d << <<HTML <h2>#{versiontitle}</h2> -#{$d.table.to_html("",false)} +#{$d.table.to_html(false)} #{$d.table.comment_to_html(false)} <h2>#{historystr}</h2> diff --git a/invite_participants.rb b/invite_participants.rb index 8784fe3..e5db1ea 100755 --- a/invite_participants.rb +++ b/invite_participants.rb @@ -25,10 +25,10 @@ load "../dudle.rb" $d = Dudle.new -if $cgi.include?("add_participant") - if $cgi.include?("delete_participant") - $d.table.delete($cgi["olduser"]) - else +unless $cgi.include?("cancel") + if $cgi.include?("deleteuser") + $d.table.delete($cgi["edituser"]) + elsif $cgi.include?("add_participant") $d.table.add_participant($cgi["olduser"],$cgi["add_participant"],{}) end end @@ -39,7 +39,7 @@ inviteparticipantsstr = _("Invite Participants") $d << <<TABLE <h2>#{inviteparticipantsstr}</h2> <form id='invite_participants_form' method='post' action='invite_participants.cgi' accept-charset='utf-8'> - #{$d.table.invite_to_html($cgi['edituser'])} + #{$d.table.invite_to_html} </form> TABLE diff --git a/locale/de/dudle.po b/locale/de/dudle.po index 73705f3..820f29c 100644 --- a/locale/de/dudle.po +++ b/locale/de/dudle.po @@ -19,8 +19,8 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2010-05-14 12:02+0200\n" -"PO-Revision-Date: 2010-05-14 12:04+0100\n" +"POT-Creation-Date: 2010-05-26 08:56+0200\n" +"PO-Revision-Date: 2010-05-26 08:58+0100\n" "Last-Translator: Benjamin Kellermann <Benjamin.Kellermann@tu-dresden.de>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -118,7 +118,7 @@ msgstr "Bearbeiten" #: customize.cgi:121 #: access_control.rb:121 #: customize.rb:121 -#: poll.rb:244 +#: poll.rb:286 msgid "Save" msgstr "Speichern" @@ -126,7 +126,7 @@ msgstr "Speichern" #: access_control.rb:117 #: customize.rb:124 #: delete_poll.rb:96 -#: poll.rb:266 +#: poll.rb:307 msgid "Delete" msgstr "Löschen" @@ -454,73 +454,90 @@ msgstr "Dudle Umfrage über %{polltitle}" msgid "Reload" msgstr "Neu laden" -#: poll.rb:68 -msgid "Edit user %{user}" -msgstr "Bearbeite Teilnehmer %{user}" +#: poll.rb:71 +msgid "Edit user %{user}..." +msgstr "Bearbeite Teilnehmer %{user}..." + +#: poll.rb:75 +msgid "Delete user %{user}..." +msgstr "Lösche Teilnehmer %{user}..." -#: poll.rb:110 -msgid "total" +#: poll.rb:122 +msgid "Total" msgstr "Summe" -#: poll.rb:151 +#: poll.rb:164 msgid "Invite" msgstr "Einladen" -#: poll.rb:152 +#: poll.rb:165 #: pollhead.rb:62 #: timepollhead.rb:137 msgid "Name" msgstr "Name" -#: poll.rb:202 +#: poll.rb:182 +msgid "Delete %{user}?" +msgstr "Lösche Teilnehmer %{user}?" + +#: poll.rb:185 +#: poll.rb:247 +msgid "Confirm" +msgstr "Bestätigen" + +#: poll.rb:218 msgid "Save Changes" msgstr "Speichern" -#: poll.rb:203 -msgid "Delete User" -msgstr "Lösche Teilnehmer" +#: poll.rb:222 +msgid "Cancel" +msgstr "Abbrechen" + +#: poll.rb:244 +msgid "Do you really want to delete user %{user}?" +msgstr "Wollen sie den Teilnehmer %{user} wirklich löschen?" -#: poll.rb:254 +#: poll.rb:295 msgid "Comments" msgstr "Kommentare" -#: poll.rb:261 +#: poll.rb:302 msgid "%{user} said on %{time}" msgstr "%{user} sagte am %{time}" -#: poll.rb:276 +#: poll.rb:317 msgid "says" msgstr "sagt" -#: poll.rb:277 +#: poll.rb:318 msgid "Submit Comment" msgstr "Sende Kommentar" -#: poll.rb:295 +#: poll.rb:336 msgid "Show history items:" msgstr "Zeige nur folgende Versionen:" -#: poll.rb:302 +#: poll.rb:343 msgid "All" msgstr "Alle" -#: poll.rb:303 +#: poll.rb:344 msgid "Participant related" msgstr "Teilnehmer betreffend" -#: poll.rb:304 +#: poll.rb:345 msgid "Column related" msgstr "Spalten betreffend" -#: poll.rb:305 +#: poll.rb:346 msgid "Comment related" msgstr "Kommentare betreffend" -#: poll.rb:306 +#: poll.rb:347 msgid "Access Control related" msgstr "Zugriffskontrolle betreffend" -#: poll.rb:312 +#: poll.rb:353 msgid "Update" msgstr "Aktualisieren" @@ -602,3 +619,6 @@ msgstr "Hinzufügen" msgid "e. g., 09:30, morning, afternoon" msgstr "z.B., 9:30, morgens, abends" +#~ msgid "Delete User" +#~ msgstr "Lösche Teilnehmer" + diff --git a/locale/sv/dudle.po b/locale/sv/dudle.po index 1785915..d4df56a 100644 --- a/locale/sv/dudle.po +++ b/locale/sv/dudle.po @@ -19,9 +19,9 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2010-05-14 12:02+0200\n" +"POT-Creation-Date: 2010-05-26 08:56+0200\n" "PO-Revision-Date: \n" -"Last-Translator: Erica <erica.resare@kau.se>\n" +"Last-Translator: Benjamin Kellermann <Benjamin.Kellermann@tu-dresden.de>\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -111,12 +111,12 @@ msgstr "Användarnamn:" msgid "Edit" msgstr "Redigera" -#: customize.cgi:121 access_control.rb:121 customize.rb:121 poll.rb:244 +#: customize.cgi:121 access_control.rb:121 customize.rb:121 poll.rb:286 msgid "Save" msgstr "Spara" #: customize.cgi:124 access_control.rb:117 customize.rb:124 delete_poll.rb:96 -#: poll.rb:266 +#: poll.rb:307 msgid "Delete" msgstr "Radera" @@ -462,71 +462,91 @@ msgstr "Länk till dudle omröstning om %{polltitle}" msgid "Reload" msgstr "Ladda om" -#: poll.rb:68 -msgid "Edit user %{user}" +#: poll.rb:71 +#, fuzzy +msgid "Edit user %{user}..." msgstr "Redigera användare %{user}" -#: poll.rb:110 -msgid "total" -msgstr "total" +#: poll.rb:75 +#, fuzzy +msgid "Delete user %{user}..." +msgstr "Redigera användare %{user}" -#: poll.rb:151 +#: poll.rb:122 +msgid "Total" +msgstr "Total" + +#: poll.rb:164 msgid "Invite" msgstr "Bjud in" -#: poll.rb:152 pollhead.rb:62 timepollhead.rb:137 +#: poll.rb:165 pollhead.rb:62 timepollhead.rb:137 msgid "Name" msgstr "Namn" -#: poll.rb:202 +#: poll.rb:182 +#, fuzzy +msgid "Delete %{user}?" +msgstr "Redigera användare %{user}" + +#: poll.rb:185 poll.rb:247 +msgid "Confirm" +msgstr "" + +#: poll.rb:218 msgid "Save Changes" msgstr "Spara ändringar" -#: poll.rb:203 -msgid "Delete User" -msgstr "Radera användare" +#: poll.rb:222 +msgid "Cancel" +msgstr "" -#: poll.rb:254 +#: poll.rb:244 +#, fuzzy +msgid "Do you really want to delete user %{user}?" +msgstr "Redigera användare %{user}" + +#: poll.rb:295 msgid "Comments" msgstr "Kommentarer" -#: poll.rb:261 +#: poll.rb:302 msgid "%{user} said on %{time}" msgstr "sa %{user} %{time}" -#: poll.rb:276 +#: poll.rb:317 msgid "says" msgstr "säger" -#: poll.rb:277 +#: poll.rb:318 msgid "Submit Comment" msgstr "Skicka kommentarer" -#: poll.rb:295 +#: poll.rb:336 msgid "Show history items:" msgstr "Visa historik:" -#: poll.rb:302 +#: poll.rb:343 msgid "All" msgstr "Alla" -#: poll.rb:303 +#: poll.rb:344 msgid "Participant related" msgstr "Tillhörande deltagare" -#: poll.rb:304 +#: poll.rb:345 msgid "Column related" msgstr "Tillhörande kolumn" -#: poll.rb:305 +#: poll.rb:346 msgid "Comment related" msgstr "Tillhörande kommentar" -#: poll.rb:306 +#: poll.rb:347 msgid "Access Control related" msgstr "Tillhörande åtkomstkontroll" -#: poll.rb:312 +#: poll.rb:353 msgid "Update" msgstr "Uppdatera" @@ -610,3 +630,6 @@ msgstr "Lägg till" #: timepollhead.rb:373 msgid "e. g., 09:30, morning, afternoon" msgstr "t ex 09:30, morgon, eftermiddag" + +#~ msgid "Delete User" +#~ msgstr "Radera användare" diff --git a/participate.rb b/participate.rb index d51f92b..862325d 100755 --- a/participate.rb +++ b/participate.rb @@ -24,10 +24,10 @@ if __FILE__ == $0 load "../dudle.rb" $d = Dudle.new -if $cgi.include?("add_participant") - if $cgi.include?("delete_participant") - $d.table.delete($cgi["olduser"]) - else +unless $cgi.include?("cancel") + if $cgi.include?("delete_participant_confirm") + $d.table.delete($cgi["delete_participant_confirm"]) + elsif $cgi.include?("add_participant") agreed = {} $cgi.params.each{|k,v| if k =~ /^add_participant_checked_/ @@ -58,7 +58,7 @@ END $d << <<HTML <div id='polltable'> <form method='post' action='.' accept-charset='utf-8'> - #{$d.table.to_html($cgi['edituser'])} + #{$d.table.to_html} </form> </div> @@ -65,24 +65,36 @@ class Poll def userstring(participant,link) ret = "" - ret += "<a title='" + _("Edit user %{user}") % {:user => CGI.escapeHTML(participant)} + "' href=\"?edituser=#{CGI.escapeHTML(CGI.escape(participant))}\">" if link - ret += participant - ret += "<span class='edituser'> <sup>#{EDIT}</sup></span></a>" if link + if link + ret += "<td><span class='edituser'>" + ret += "<a title='" + ret += _("Edit user %{user}...") % {:user => CGI.escapeHTML(participant)} + ret += "' href=\"?edituser=#{CGI.escapeHTML(CGI.escape(participant))}\">" + ret += EDIT + ret += "</a> | <a title='" + ret += _("Delete user %{user}...") % {:user => CGI.escapeHTML(participant)} + ret += "' href=\"?deleteuser&edituser=#{CGI.escapeHTML(CGI.escape(participant))}\">" + ret += "#{DELETE}</a>" + ret += "</span></td>" + ret += "<td class='name'>" + else + ret += "<td class='name' colspan='2'>" + end + ret += "<span id='#{participant.to_htmlID}'>#{participant}</span>" + ret += "</td>" ret end - def to_html(edituser = "", showparticipation = true) + def to_html(showparticipation = true) ret = "<table border='1'>\n" sortcolumns = $cgi.include?("sort") ? $cgi.params["sort"] : ["timestamp"] ret += @head.to_html(sortcolumns) sort_data(sortcolumns).each{|participant,poll| - if edituser == participant - ret += participate_to_html(edituser) + if $cgi["edituser"] == participant + ret += participate_to_html else ret += "<tr class='participantrow'>\n" - ret += "<td class='name'>" ret += userstring(participant,showparticipation) - ret += "</td>\n" @head.columns.each{|column| klasse = poll[column] case klasse @@ -104,10 +116,10 @@ class Poll } # PARTICIPATE - ret += participate_to_html(edituser) unless @data.keys.include?(edituser) || !showparticipation + ret += participate_to_html unless @data.keys.include?($cgi["edituser"]) || !showparticipation # SUMMARY - ret += "<tr id='summary'><td class='name'>" + _("total") + "</td>\n" + ret += "<tr id='summary'><td colspan='2' class='name'>" + _("Total") + "</td>\n" @head.columns.each{|column| yes = 0 undecided = 0 @@ -147,13 +159,14 @@ class Poll ret end - def invite_to_html(edituser) + def invite_to_html + edituser = $cgi["edituser"] unless $cgi.include?("deleteuser") invitestr = _("Invite") namestr = _("Name") ret = <<HEAD -<table id='participanttable' class='settingstable'> +<table id='participanttable'> <tr> - <th>#{namestr}</th> + <th colspan='2'>#{namestr}</th> </tr> HEAD @data.keys.sort.each{|participant| @@ -163,20 +176,18 @@ HEAD } if edituser == participant - ret += "<tr id='add_participant_row'>" + ret += "<tr id='add_participant'>" ret += add_participant_input(edituser) ret += save_input(edituser,invitestr) else - ret += "<tr class='participantrow'>" - ret += "<td class='name'>" + ret += "<tr id='#{participant.to_htmlID}_tr' class='participantrow'>" ret += userstring(participant,!has_voted) - ret += "</td>" end ret += "</tr>" } unless @data.keys.include?(edituser) - ret += "<tr id='add_participant_row'>" + ret += "<tr id='add_participant'>" ret += add_participant_input(edituser) ret += save_input(edituser,invitestr) ret += "</tr>" @@ -186,7 +197,7 @@ HEAD end def add_participant_input(edituser) return <<END -<td id='add_participant_input_td'> +<td colspan='2' id='add_participant_input_td'> <input type='hidden' name='olduser' value=\"#{edituser}\" /> <input size='16' type='text' @@ -196,18 +207,42 @@ HEAD </td> END end - def save_input(edituser, savestring) + def save_input(edituser, savestring, changestr = _("Save Changes")) ret = "<td>" if @data.include?(edituser) - ret += "<input id='savebutton' type='submit' value='" + _("Save Changes") + "' />" - ret += "<br /><input style='margin-top:1ex' type='submit' name='delete_participant' value='" + _("Delete User") + "' />" + ret += "<input id='savebutton' type='submit' value='#{changestr}' />" + ret += "<br /><input id='cancelbutton' style='margin-top:1ex' type='submit' name='cancel' value='" + _("Cancel") + "' />" else ret += "<input id='savebutton' type='submit' value='#{savestring}' />" end ret += "</td>\n" end - def participate_to_html(edituser) + def participate_to_html + ret = "<tr id='separator_top'><td colspan='#{@head.col_size + 3}' class='invisible'></td></tr>\n" + + if $cgi.include?("deleteuser") && @data.include?($cgi["edituser"]) + ret += deleteuser_to_html + else + ret += edituser_to_html + end + ret += "<tr id='separator_bottom'><td colspan='#{@head.col_size + 3}' class='invisible'></td></tr>\n" + end + + def deleteuser_to_html + ret = "<tr id='add_participant'>\n" + ret += "<td colspan='2' class='name'>#{$cgi["edituser"]}</td>" + ret += "<td colspan='#{@head.col_size}'>" + ret += _("Do you really want to delete user %{user}?") % {:user => $cgi["edituser"]} + ret += "<input type='hidden' name='delete_participant_confirm' value='#{$cgi["edituser"]}' />" + ret += "</td>" + ret += save_input($cgi["edituser"], "", _("Confirm")) + ret += "</tr>" + ret + end + + def edituser_to_html + edituser = $cgi["edituser"] checked = {} if @data.include?(edituser) @head.columns.each{|k| checked[k] = @data[edituser][k]} @@ -215,9 +250,8 @@ END edituser = $cgi.cookies["username"][0] unless @data.include?($cgi.cookies["username"][0]) @head.columns.each{|k| checked[k] = NOVAL} end - ret = "<tr id='separator_top'><td colspan='#{@head.col_size + 2}' class='invisible'></td></tr>\n" - ret += "<tr id='add_participant'>\n" + ret = "<tr id='add_participant'>\n" ret += add_participant_input(edituser) @@ -244,7 +278,6 @@ TR ret += save_input(edituser, _("Save")) ret += "</tr>\n" - ret += "<tr id='separator_bottom'><td colspan='#{@head.col_size + 2}' class='invisible'></td></tr>\n" ret end diff --git a/pollhead.rb b/pollhead.rb index 17a05bb..02478d8 100644 --- a/pollhead.rb +++ b/pollhead.rb @@ -59,7 +59,7 @@ class PollHead SORTSYMBOL end ret = "<tr>" - ret += "<th><a href='?sort=name'>" + _("Name") + " #{sortsymb(scols,"name")}</a></th>\n" unless showeditbuttons + ret += "<th colspan='2'><a href='?sort=name'>" + _("Name") + " #{sortsymb(scols,"name")}</a></th>\n" unless showeditbuttons @data.sort.each{|columntitle,columndescription| ret += "<th title=\"#{columndescription}\"" ret += " id='active' " if activecolumn == columntitle @@ -68,8 +68,8 @@ SORTSYMBOL ret += "#{CGI.escapeHTML(columntitle)}" ret += "#{sortsymb(scols,columntitle)}</a>" unless showeditbuttons if showeditbuttons - editstr = _("Edit Column") - deletestr = _("Delete Column") + editstr = _("Edit column") + deletestr = _("Delete column") ret += <<EDITDELETE <div> <small> diff --git a/timepollhead.rb b/timepollhead.rb index dc4476c..6f3fcec 100644 --- a/timepollhead.rb +++ b/timepollhead.rb @@ -117,13 +117,13 @@ class TimePollHead ret.sort end def to_html(scols,config = false,activecolumn = nil) - ret = "<tr><th class='invisible'></th>" + ret = "<tr><th colspan='2' class='invisible'></th>" head_count("%Y-%m",false).each{|title,count| year, month = title.split("-").collect{|e| e.to_i} ret += "<th colspan='#{count}'>#{Date.parse("#{year}-#{month}-01").strftime("%b %Y")}</th>\n" } - ret += "<th class='invisible'></th></tr><tr><th class='invisible'></th>" + ret += "<th class='invisible'></th></tr><tr><th colspan='2' class='invisible'></th>" head_count("%Y-%m-%d",false).each{|title,count| ret += "<th colspan='#{count}'>#{Date.parse(title).strftime('%a, %d')}</th>\n" } @@ -134,7 +134,7 @@ class TimePollHead SORTSYMBOL end - ret += "<th class='invisible'></th></tr><tr><th><a href='?sort=name'>" + _("Name") + " #{sortsymb(scols,"name")}</a></th>" + ret += "<th class='invisible'></th></tr><tr><th colspan='2'><a href='?sort=name'>" + _("Name") + " #{sortsymb(scols,"name")}</a></th>" @data.sort.each{|date| ret += "<th><a title='#{date}' href='?sort=#{CGI.escape(date.to_s)}'>#{date.time_to_s} #{sortsymb(scols,date.to_s)}</a></th>\n" } @@ -223,7 +223,8 @@ END @lasttime = realtimes.max.strftime("%H").to_i def add_remove_button(klasse, buttonlabel, action, columnstring, revision, pretext = "") - titlestr = _("Delete Column") + titlestr = _("Add column") + titlestr = _("Delete column") if klasse == "chosen" return <<FORM <form method='post' action=''> <div> diff --git a/vcs_test.rb b/vcs_test.rb index 9881fb5..91b6609 100644 --- a/vcs_test.rb +++ b/vcs_test.rb @@ -20,6 +20,10 @@ if __FILE__ == $0 require "test/unit" require "pp" +unless ARGV[0] + puts "Usage: ruby #{$0} (git|bzr)" + exit +end require ARGV[0] require "benchmark" @@ -41,8 +45,9 @@ class VCS_test < Test::Unit::TestCase @t = "" end def teardown - Dir.chdir("/") - `rm -rf #{@repo}` + puts @repo +# Dir.chdir("/") +# `rm -rf #{@repo}` puts "#{@t}: #{@b}" end def test_cat @@ -68,6 +73,8 @@ class VCS_test < Test::Unit::TestCase @b += Benchmark.measure{ l = VCS.history }.total + pp l + exit assert_equal(@data.size,l.size) @history.each_with_index{|h,revminusone| assert_equal(h,l[revminusone+1].comment) |