From d991ac6445249d0786711dca1210ae08b1ad7a82 Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Tue, 24 Nov 2009 12:00:04 +0100 Subject: added invite participant tab template --- access_control.rb | 9 +++++- dudle.css | 2 +- edit_columns.rb | 10 ------- html.rb | 1 + index.cgi | 2 +- invite_participants.rb | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ poll.rb | 4 +-- timepollhead.rb | 2 +- 8 files changed, 90 insertions(+), 16 deletions(-) create mode 100755 invite_participants.rb diff --git a/access_control.rb b/access_control.rb index c50f08a..fb00673 100755 --- a/access_control.rb +++ b/access_control.rb @@ -25,7 +25,14 @@ if __FILE__ == $0 $cgi = CGI.new -load "../html.rb" +olddir = File.expand_path(".") +Dir.chdir("..") +load "html.rb" +load "config.rb" +Dir.chdir(olddir) + + + acusers = {} diff --git a/dudle.css b/dudle.css index e541010..632ba69 100644 --- a/dudle.css +++ b/dudle.css @@ -157,7 +157,7 @@ html { margin-right:auto; width:auto; display: table; - min-width: 35em; + min-width: 45em; } div#tabs{ diff --git a/edit_columns.rb b/edit_columns.rb index c6cd967..fbeed1c 100755 --- a/edit_columns.rb +++ b/edit_columns.rb @@ -42,8 +42,6 @@ class << Time end end -acusers = {} - revbeforeedit = VCS.revno if $cgi.include?("undo_revision") && $cgi["undo_revision"].to_i < revbeforeedit @@ -56,14 +54,6 @@ else table = YAML::load_file("data.yaml") end -# TODO: move to own tab -#if $cgi.include?("add_participant") -# if $cgi.include?("delete_participant") -# table.delete($cgi["olduser"]) -# else -# table.add_participant($cgi["olduser"],$cgi["add_participant"],{}) -# end -#end table.edit_column($cgi["columnid"],$cgi["new_columnname"],$cgi) if $cgi.include?("new_columnname") table.delete_column($cgi["deletecolumn"]) if $cgi.include?("deletecolumn") diff --git a/html.rb b/html.rb index 6f296cd..f7c9c5f 100644 --- a/html.rb +++ b/html.rb @@ -88,6 +88,7 @@ module Dudle ["History","history.cgi"], ["",""], ["Edit Columns","edit_columns.cgi"], + ["Invite Participants","invite_participants.cgi"], ["Access Control","access_control.cgi"], ["Delete Poll","delete_poll.cgi"], ["",""], diff --git a/index.cgi b/index.cgi index 651fa33..aa6d062 100755 --- a/index.cgi +++ b/index.cgi @@ -54,7 +54,7 @@ if $cgi.include?("create_poll") VCS.init File.symlink("../participate.rb","index.cgi") VCS.add("index.cgi") - ["atom","customize", "history", "edit_columns","access_control", "delete_poll"].each{|f| + ["atom","customize", "history", "edit_columns","access_control", "delete_poll", "invite_participants"].each{|f| File.symlink("../#{f}.rb","#{f}.cgi") VCS.add("#{f}.cgi") } diff --git a/invite_participants.rb b/invite_participants.rb new file mode 100755 index 0000000..15c7dd1 --- /dev/null +++ b/invite_participants.rb @@ -0,0 +1,76 @@ +#!/usr/bin/env ruby + +############################################################################ +# Copyright 2009 Benjamin Kellermann # +# # +# This file is part of dudle. # +# # +# Dudle is free software: you can redistribute it and/or modify it under # +# the terms of the GNU Affero General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# Dudle is distributed in the hope that it will be useful, but WITHOUT ANY # +# WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public # +# License for more details. # +# # +# You should have received a copy of the GNU Affero General Public License # +# along with dudle. If not, see . # +############################################################################ + +require "yaml" +require "cgi" + + +if __FILE__ == $0 + +$cgi = CGI.new + +olddir = File.expand_path(".") +Dir.chdir("..") +require "html" +load "config.rb" +require "poll" +Dir.chdir(olddir) +# BUGFIX for Time.parse, which handles the zone indeterministically +class << Time + alias_method :old_parse, :parse + def Time.parse(date, now=self.now) + Time.old_parse("2009-10-25 00:30") + Time.old_parse(date) + end +end + + +table = YAML::load_file("data.yaml") + +# TODO: move to own tab +#if $cgi.include?("add_participant") +# if $cgi.include?("delete_participant") +# table.delete($cgi["olduser"]) +# else +# table.add_participant($cgi["olduser"],$cgi["add_participant"],{}) +# end +#end + +$html = HTML.new("dudle - #{table.name} - Invite Participants") +$html.header["Cache-Control"] = "no-cache" +load "../charset.rb" +$html.add_css("../dudle.css") + +$html << "" +$html << Dudle::tabs("Invite Participants") + +$html << < +

#{table.name}

+

Invite or Delete Participants

+ #{table.to_html} +TABLE + +$html << "" + +$html.out($cgi) +end + diff --git a/poll.rb b/poll.rb index b74bf08..dfb676f 100644 --- a/poll.rb +++ b/poll.rb @@ -60,7 +60,7 @@ class Poll end end - def to_html(edituser, showparticipation = true) + def to_html(edituser = "", showparticipation = true) ret = "
\n" ret += @head.to_html @@ -176,7 +176,7 @@ class Poll ret += "" ret += "
" else - ret += "" + ret += "" end ret += "\n" diff --git a/timepollhead.rb b/timepollhead.rb index 37202af..6b77afb 100644 --- a/timepollhead.rb +++ b/timepollhead.rb @@ -344,7 +344,7 @@ END ret += "" end ret += <
+
-- cgit v1.2.3