aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2011-02-21 21:28:03 +0100
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2011-02-21 21:28:03 +0100
commite5b6897c940774e69b83748ce56ed0ae461de6a8 (patch)
treece98671d76a57ba68632c617ca8dfed84cb4beb7
parentd52d6b9a91c09bd698ec0b94ff7e590318246aa4 (diff)
new feature: breadcrumbs
-rw-r--r--classic.css4
-rw-r--r--config_sample.rb10
-rw-r--r--default.css4
-rw-r--r--dudle.rb68
-rw-r--r--print.css2
5 files changed, 60 insertions, 28 deletions
diff --git a/classic.css b/classic.css
index e40d259..cdeb084 100644
--- a/classic.css
+++ b/classic.css
@@ -196,6 +196,10 @@ html {
font-size:small;
}
+#breadcrumbs {
+ display: none;
+}
+
div#tabs {
min-width:65em;
}
diff --git a/config_sample.rb b/config_sample.rb
index 986be02..0f244b3 100644
--- a/config_sample.rb
+++ b/config_sample.rb
@@ -37,6 +37,16 @@ else
end
SITEURL = "#{protocol}://#{$cgi.server_name}#{port}#{$cgi.script_name.gsub(/[^\/]*$/,"")}"
+# You may insert some sites, which are under your site
+# A breadcrumb will be generated in the way:
+# TUD -> ... -> Fakultät Informatik -> Professur DuD -> dudle -> poll
+BREADCRUMBS = [
+ "<a href='http://tu-dresden.de'>TUD</a>",
+ "...",
+ "<a href='http://www.inf.tu-dresden.de'>Fakultät Informatik</a>",
+ "<a href='http://dud.inf.tu-dresden.de'>Professur Datenschutz und Datensicherheit</a>"
+]
+
# If you want to encourage the user to send bug reports, state the errorlog,
# which you have configured in your apache conf with the ErrorLog directive.
# In addition, you can change the email address to yours, if you want to
diff --git a/default.css b/default.css
index 9acf65a..13e11c3 100644
--- a/default.css
+++ b/default.css
@@ -252,6 +252,10 @@ html {
line-height: 1.4em;
}
+#breadcrumbs {
+ display: none;
+}
+
div#tabs{
font-size:80%;
min-width:65em;
diff --git a/dudle.rb b/dudle.rb
index f3047eb..8c36465 100644
--- a/dudle.rb
+++ b/dudle.rb
@@ -51,23 +51,9 @@ class Dudle
def is_poll?
$is_poll
end
- def tabs(active_tab)
+ def tabs_to_html(active_tab)
ret = "<div id='tabs'><ul id='tablist'>"
- tabs = []
- tabs << [_("Home"),@basedir]
- if $is_poll
- tabs << ["",""]
- tabs += @usertabs
- tabs << ["",""]
- tabs += @configtabs
- tabs << @deletetab
- tabs << ["",""]
- else
- tabs << [_("Examples"),"example.cgi"]
- tabs << [_("About"),"about.cgi"]
- end
- tabs << @customizetab
- tabs.each{|tab,file|
+ @tabs.each{|tab,file|
case file
when _(active_tab)
ret += "<li id='active_tab' class='active_tab' >&nbsp;#{tab}&nbsp;</li> "
@@ -82,25 +68,53 @@ class Dudle
end
def inittabs
- @customizetab = [_("Customize"),"customize.cgi"]
+ @tabs = []
+ @tabs << [_("Home"),@basedir]
if is_poll?
- # set-up tabs
- @usertabs = [
- [_("Poll"),"."],
- [_("History"),"history.cgi"]
- ]
+ @tabs << ["",""]
+ @tabs << [_("Poll"),"."]
+ @tabs << [_("History"),"history.cgi"]
+ @tabs << ["",""]
@configtabs = [
[_("Edit Columns"),"edit_columns.cgi"],
[_("Invite Participants"),"invite_participants.cgi"],
[_("Access Control"),"access_control.cgi"],
[_("Overview"),"overview.cgi"]
]
- @deletetab = [_("Delete Poll"),"delete_poll.cgi"]
+ @tabs += @configtabs
+ @tabs << [_("Delete Poll"),"delete_poll.cgi"]
+ @tabs << ["",""]
+ else
+ @tabs << [_("Examples"),"example.cgi"]
+ @tabs << [_("About"),"about.cgi"]
end
+ @tabs << [_("Customize"),"customize.cgi"]
+ @tabtitle = @tabs.collect{|title,file| title if file == @tab}.compact[0]
end
def revision
@requested_revision || VCS.revno
end
+ def breadcrumbs
+ if defined?(BREADCRUMBS)
+ crumbs = BREADCRUMBS
+ else
+ crumbs = []
+ end
+ crumbs << "<a href='#{@basedir}'>" + _("Dudle Home") + "</a>"
+ if is_poll?
+ if @tab == "."
+ crumbs << @title
+ else
+ crumbs << "<a href='.'>#{@title}</a>"
+ crumbs << @tabtitle
+ end
+ else
+ if @tab != "."
+ crumbs << @tabtitle
+ end
+ end
+ "<div id=breadcrumbs><ul><li class='breadcrumb'>#{crumbs.join("</li><li class='breadcrumb'>")}</li></ul></div>"
+ end
def initialize(params = {:revision => nil, :title => nil, :hide_lang_chooser => nil, :relative_dir => ""})
@requested_revision = params[:revision]
@@ -109,12 +123,11 @@ class Dudle
@tab = File.basename($0)
@tab = "." if @tab == "index.cgi"
- inittabs
-
if is_poll?
# log last read acces manually (no need to grep server logfiles)
File.open("last_read_access","w").close
@basedir = ".."
+ inittabs
@table = YAML::load(VCS.cat(self.revision, "data.yaml"))
@urlsuffix = File.basename(File.expand_path("."))
@title = @table.name
@@ -124,11 +137,11 @@ class Dudle
@is_config = configfiles.include?(@tab)
@wizzardindex = configfiles.index(@tab) if @is_config
- @tabtitle = (@usertabs + @configtabs + [@deletetab] + [@customizetab]).collect{|title,file| title if file == @tab}.compact[0]
@html = HTML.new("dudle - #{@title} - #{@tabtitle}",params[:relative_dir])
@html.header["Cache-Control"] = "no-cache"
else
@basedir = "."
+ inittabs
@title = params[:title] || "dudle"
@html = HTML.new(@title,params[:relative_dir])
end
@@ -165,8 +178,9 @@ class Dudle
<div id='header3'></div>
<div id='header4'></div>
<div id='header5'></div>
+#{breadcrumbs}
<div id='main'>
-#{tabs(@tab)}
+#{tabs_to_html(@tab)}
<div id='content'>
<h1 id='polltitle'>#{@title}</h1>
HEAD
diff --git a/print.css b/print.css
index b06a6ea..b94b7ec 100644
--- a/print.css
+++ b/print.css
@@ -221,7 +221,7 @@ tr.participantrow:hover {
background: #AAA;
}
-div#add_comment,div#edit_column, div#history, div#backlink, input.delete_comment_button, tr#add_participant, div#configlink, div#tabs, p#history, span.edituser, span.sortsymb, div#languageChooser, input[type=submit]{
+div#add_comment,div#edit_column, div#history, div#backlink, input.delete_comment_button, tr#add_participant, div#configlink, div#tabs, p#history, span.edituser, span.sortsymb, div#languageChooser, input[type=submit], div#breadcrumbs {
display: none;
}