Feature Proposal: Make view topic actions customizable
Motivation
Installations or users may want to add site-specific actions without having to rewrite the templates. For example, on our site there is a link in the topic actions that allows registering this topic in ones
notifications.
Description
- Define topic actions in topic, e.g.,
TWiki.WebActionBar
- Define tool bar in topic, e.g.,
TWiki.WebToolBar
- Include these topics in
view.pattern.tmpl
- To make this work, the first call to
handleCommonTags() needs to be moved before the construction of %EDITTOPIC% etc. in lib/TWiki/UI/View.pm
--
ThomasWeigert - 19 Feb 2005
Impact and Available Solutions
Note: Patch is attached as
flexible_actions.diff. The patch is against the Cairo release.
Documentation
Will provide if accepted.
Examples
Sample
TWiki.WebActionBar
%EDITTOPIC% %TMPL:P{"sep"}% <a href="%SCRIPTURLPATH%/attach%SCRIPTSUFFIX%/%WEB%/%TOPIC%">Attach image or document</a> %TMPL:P{"sep"}% <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%?skin=print.pattern%REVARG%">Printable version</a> %TMPL:P{"sep"}% <a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%?raw=on">Raw text</a> %TMPL:P{"sep"}% <a href="%SCRIPTURLPATH%/oops%SCRIPTSUFFIX%/%WEB%/%TOPIC%?template=oopsmore¶m1=%MAXREV%¶m2=%CURRREV%">More topic actions</a><br />Revisions: %REVISIONS% %TMPL:P{"sep"}% <a href="%SCRIPTURLPATH%/rdiff%SCRIPTSUFFIX%/%WEB%/%TOPIC%">Total page history</a> %TMPL:P{"sep"}% <a href="%SCRIPTURLPATH%/search%SCRIPTSUFFIX%/%WEB%/SearchResult?scope=text&regex=on&excludetopic=%TOPIC%&search=%SPACEDTOPIC%%5B%5EA-Za-z0-9%5D">Backlinks</a>
Sample
TWiki.WebToolBar
*%EDITTOPIC%*
*<a href="%SCRIPTURLPATH%/attach%SCRIPTSUFFIX%/%WEB%/%INCLUDINGTOPIC%">Attach</a>*
*<a href="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%INCLUDINGTOPIC%?skin=print.pattern%REVARG%">Printable</a>* </div><div class="twikiRevInfo"><span class="twikiGrayText"><span class="twikiToolbarElem"><nop>%WEB%.%INCLUDINGTOPIC%</span><span class="twikiToolbarElem">%REVTITLE%</span><span class="twikiToolbarElem"><a href="#TopicEnd">topic end</a></span></span></div>
Implementation
Note that there are two problems with this proposal:
- %REVINFO% cannot be shown using this scheme, as it would take that from the included topic defining the tool bar.
- Albeit I cannot see it in the HTML generated, there is a line feed added between the two parts of the tool bar.
Discussion:
This is a good idea, (and similiar to
WebControlBottomBar).
WebControlBottomBar never actually made code because I wasn't going to code it only to have it rot in the patch queue.
Now, I appreciate that you have provided code, but because Dakar is quite different to Cairo I am hesitant to even look at your code.
Besides which, we don't really check in patches for each other now. Not since the
DevelopBranch made reality. And, we've known you long enough to know you to be sure you have no malintent!
So, please feel free to fill in
ThomasWeigertWouldLikeToCheckIn: that way you will have the (almost wiki-like) power to make your changes yourself.
--
MartinCleaver - 19 Feb 2005
Note that this patch is not doing exactly what is suggested in
WebControlBottomBar, as it takes the bottom bar from the TWiki web.
Actually, I think that the way topics are included in the layout currently is a mistake. You have to hardwire in which web to take them from. I think the mechanism for templates is preferable, where you would take the topic from a web, and if it is not found, then from the TWiki web.
Note that, e.g., for the bottom bar in general you would like to have the topics in all webs to be consistent by default, but there may be special webs where you might want to add or delete certain actions.
I think this needs a rethink. One could handle this by adding several possible webs to %INCLUDE%, or by extending the template include mechanism to alternatively search the data directory.
--
ThomasWeigert - 19 Feb 2005