diff options
author | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2009-11-20 13:34:14 +0100 |
---|---|---|
committer | Benjamin Kellermann <Benjamin.Kellermann@gmx.de> | 2009-11-20 13:34:14 +0100 |
commit | 393b80ed66f10a7670d1022361b063fe0118e746 (patch) | |
tree | 8bf5048486d3525ca6dc7f605cbd4509a2bebdef /config_sample.rb | |
parent | 7f405dc57353e699f7da9e341153bfcf07f7c96d (diff) |
added sample for showing all available polls
Diffstat (limited to 'config_sample.rb')
-rw-r--r-- | config_sample.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/config_sample.rb b/config_sample.rb index 358b443..371db2a 100644 --- a/config_sample.rb +++ b/config_sample.rb @@ -23,13 +23,31 @@ load "bzr.rb" # Change this if the url is not determined correctly SITEURL = "http://#{$cgi.server_name}#{$cgi.script_name.gsub(/[^\/]*$/,"")}" -# add this htmlcode to the startpage -NOTICE = <<NOTICE +# add the htmlcode in the Variable NOTICE to the startpage +# Example 1: displays all available Polls +notice = <<NOTICE +<fieldset><legend>Available Polls</legend> +<table><tr><th>Poll</th><th>Last change</th></tr> +NOTICE +Dir.glob("*/data.yaml").sort_by{|f| + File.new(f).mtime +}.reverse.collect{|f| f.gsub(/\/data\.yaml$/,'') }.each{|site| + notice += <<NOTICE +<tr> + <td class='polls'><a href='./#{CGI.escapeHTML(site).gsub("'","%27")}/'>#{CGI.escapeHTML(site)}</a></td> + <td class='mtime'>#{File.new(site + "/data.yaml").mtime.strftime('%d.%m, %H:%M')}</td> +</tr> +NOTICE +} +notice += "</table></fieldset>" +# Example 2: displays a static text +notice += <<NOTICE <fieldset><legend>Examples</legend> If you want to play around with the Tool, you may want to take a look at these two Example Polls:<br /> <a href='EventScheduleExample'>Event Schedule Poll</a><br /> <a href='NormalExample'>Normal Poll</a> </fieldset> NOTICE +NOTICE = notice |