diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2009-06-03 09:23:40 +0200 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2009-06-03 09:23:40 +0200 |
commit | b7e5654a565ee3d76f290cf14fbd4ac5632814d5 (patch) | |
tree | e99c0da47888f4970e12f897a1714ff4b68b17e9 /participate.rb | |
parent | 23646a1a6aa8ec6399d507681bf35c863a4f6829 (diff) |
cleaner interface
Diffstat (limited to 'participate.rb')
-rw-r--r-- | participate.rb | 93 |
1 files changed, 25 insertions, 68 deletions
diff --git a/participate.rb b/participate.rb index 35bf0a6..b4a7f66 100644 --- a/participate.rb +++ b/participate.rb @@ -28,12 +28,34 @@ $htmlout += <<HEAD <link rel="alternate" type="application/atom+xml" href="atom.cgi" /> </head> <body> - <div id='backlink'> +<small> <a href='..' style='text-decoration:none'>#{BACK}</a> - </div> - <h1>#{table.name}</h1> + <a href='config.cgi' style='text-decoration:none'>config</a> HEAD + +# HISTORY +MAXREV=VCS.revno +REVISION=MAXREV unless defined?(REVISION) +log = VCS.history +log.collect!{|s| s.scan(/\nrevno:.*\ncommitter.*\n.*\ntimestamp: (.*)\nmessage:\n (.*)/).flatten} +log.shift +log.collect!{|t,c| [DateTime.parse(t),c]} +$htmlout +=" history:" + +((REVISION-2)..(REVISION+2)).each do |i| + if i >0 && i<=MAXREV + $htmlout += " " + $htmlout += "<a href='?revision=#{i}' title='#{log[i-1][0].strftime('%d.%m, %H:%M')}: #{log[i-1][1]}'>" if REVISION != i + $htmlout += "#{i}" + $htmlout += "</a>" if REVISION != i + end +end +$htmlout += "</small>" + + +# TABLE +$htmlout += "<h1>#{table.name}</h1>" if $cgi.include?("add_participant") agreed = {} $cgi.params.each{|k,v| @@ -60,70 +82,5 @@ POLLTABLE $htmlout += table.comment_to_html -# ADD COMMENT -$htmlout += <<ADDCOMMENT -<div id='add_comment'> - <fieldset> - <legend>Comment</legend> - <form method='post' action='.'> - <div> - <label for='Commentname'>Name: </label> - <input id='Commentname' value='anonymous' type='text' name='commentname' /> - <br /> - <textarea cols='50' rows='7' name='comment' ></textarea> - <br /> - <input type='submit' value='Submit comment' /> - </div> - </form> - </fieldset> -</div> -ADDCOMMENT - -# HISTORY -MAXREV=VCS.revno -REVISION=MAXREV unless defined?(REVISION) -log = VCS.history -log.collect!{|s| s.scan(/\nrevno:.*\ncommitter.*\n.*\ntimestamp: (.*)\nmessage:\n (.*)/).flatten} -log.shift -log.collect!{|t,c| [DateTime.parse(t),c]} -$htmlout += <<HISTORY -<div id='history'> - <fieldset><legend>browse history</legend> - <table> - <tr> - <th>rev</th> - <th>time</th> - <th>description of change</th> - </tr> -HISTORY - -((REVISION-2)..(REVISION+2)).each do |i| - if i >0 && i<=MAXREV - if REVISION == i - $htmlout += "<tr id='displayed_revision'><td>#{i}" - else - $htmlout += "<tr><td>" - $htmlout += "<a href='?revision=#{i}'>#{i}</a>" - end - $htmlout += "</td>" - $htmlout += "<td>#{log[i-1][0].strftime('%d.%m, %H:%M')}</td>" - $htmlout += "<td>#{log[i-1][1]}</td>" - $htmlout += "</tr>" - end -end -$htmlout += "</table>" -$htmlout += "</fieldset>" -$htmlout += "</div>" - - -$htmlout +=<<CONFIG -<div id='configlink'> - <fieldset> - <legend>Configure the Poll</legend> - <a href='config.cgi' style='text-decoration:none'>config</a> - </fieldset> -</div> -CONFIG - $htmlout += "</body>" |