Motivation
I do translate substantial documents to wiki pages. Horizontal menus improve navigation. But many entries destroy the layout. This plugin addition addresses that.
Description and Documentation
I want to render this:
As (note the use of the title tag: hover over the number) :
1 |
2 |
3
This is useful when you split a large document up over a dozen chapters. The horizontal menu allows easy navigation between chapters.
This can not be achieved with a div and styles, because the title (and in IE the alt) tag need to be inserted. This type of menu can fit the whole alphabet on a line. Frequent visitors to the page often remember what the numbers mean. And infrequent visitors get help through the title tag.
SvenDowideit suggested (see
Support) I consider the
RenderListPlugin.
I think it is easily done by extending the plugin. Here is what I propose:
RenderListPlugin does all the setup work and then:
93 if( $type eq "tree" || $type eq "icon" ) {
94 return $thePre . renderIconList( $type, $params, $focus, $depth, $theList );
95 } else {
96 return "$thePre$theList";
97 }
And I believe this can be easily extended with the wanted functionality at line 95 by:
} elsif ( $type eq "horizontal") {
return $thePre . renderHorizontalList( $type, $params, $focus, $depth, $theList );
Examples
Instead of this:
Temporary Stuff |
Bram's Home |
Pictures Page |
Cancer Journey |
Letters from Palestine April/May 2004 |
Things that Make Me Think |
Letters to the Editor |
Letters to Politicians |
Muna Projects
I would get this (hover the mouse over the number):
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8
Impact
I think this will be a relatively harmless, isolated change to
RenderListPlugin
Implementation
I have attached an implementation that meets my needs.
You can see it in action at:
http://211.27.61.7:8080/cgi-bin/foswiki/view/System/RenderListPlugin
The examples included on the
RenderListPlugin page use a vertical bar (|) as the separator. That's fine for now. I thought I would be able to use %S%, but that does not get expanded. I am puzzled by that.
I noticed that
renderIconList
does the expansion itself. Why is that necessary. It appears odd.
Any comments on what I did are welcome.
--
Contributors: BramVanOosterhout - 03 Feb 2009
Discussion
Very nice, I like it. You should get
SVN access and update the Plugin there accordingly. I guess you did test that your enhancement doesn't break anything, right?
Great enhancement Bram, thanks!
--
FranzJosefGigler - 14 Feb 2009
I agree Bram, please - become 'oneofus'
I'm sorry that i didn't give your proposal the attention i intended - I recon you need to add docco for the new format types, and example but thats about it
--
SvenDowideit - 14 Feb 2009
RenderListPlugin is one of the distributed extensions, so we apply a bit more scrutiny here.
The proposal title "Define a horizontal menu with alt and title tags using a bulleted list" assumes (to me) that the plugin would style a bullet list to have the horizontal menu layout as we have on the site. It appears you doing this with separators. I would expect to have both use cases.
I also assume that with
type
value 'horizontal' you will still pass
separator
or
format
parameters?
Note that I don't see any label appear on FF mac, so this needs more attention to cater all users.
--
ArthurClemens - 14 Feb 2009
Thanks for the feedback all. I hoped that taking the initiative would get a response
Franz, Sven. I am in the process of setting up a dev site following the instructions at
ExtensionDeveloperGuide. Being no more than an amateur, it will take me some time coming to grips with it. I started with installing
svn
!
The extract at
Fetching a minimum working Foswiki code base worked perfectly.
pseudoinstall
seemed to do what it was supposed to do. But a working installation it does not give. No apache config. And working on that I find that it is different from the normal one. Need to allow symlinks! I am now trying to get the security to work. But when all that is sorted, I will get back to the plugin.
Arthur, I share your concern and am not asking to include my mod in the distributed extensions.
The only place where I noticed a horizontal menu on the site is on
WikiUsers. And there it is quite sensibly implemented as a list of wiki links.
My proposal would create that same list as follows:
* Set H_ALPHA_THEME = plain, , A
%RENDERLIST{ "h_alpha" }%
* [[#A][Users starting with A]]
* [[#B][Users starting with B]]
...
* [[#Z][Users starting with Z]]
... except that you wouldn't, because there is no value added by adding the text.
I am puzzled by the comment
don't see any label appear on FF mac,. Both alt and title label are inserted in the rendered page:
[[#Anchor][one]]
becomes:
<a href="#Anchor" alt="one" title="one">1</a> |
Leading to this result:
1 |
I am using FF on debian Linux and IE6 on windows XP. This fragment works in both. I will have access to a Mac in two weeks time. I'll try it out then.
Thanks again for your feedback. I'll attempt to become "one of yours" when I have got the
svn
setup under control.
--
BramVanOosterhout - 14 Feb 2009
Something must have been breaking up - now Firefox renders the labels fine.
--
ArthurClemens - 15 Feb 2009
For a broader view see:
RenderListPluginDev
--
BramVanOosterhout - 09 Mar 2009