We need an enhancement to this plugin, that allows us to attach content on viewing the page, that contains the directives. The current implementation allows attachments only on topic save.
--
TWiki:Main/DipuDeshmukh
- 2011-06-03
This plugin has a "feel free to modify" policy, so please go ahead!
--
TWiki:Main.PeterThoeny
- 2011-06-03
Enhancements have been checked in, released and tested to work.
--
TWiki:Main.DipuDeshmukh
- 2011-06-03
Thanks Dipu for enhancing the plugin! I tested the plugin, functionality is good, but there are implications: Attachments are saved every time on page view which could
- slow down page views,
- increase server load,
- makes pages look updated even if there is no update (recent changes and e-mail notification),
- saves pages regardless of access control (for example as TWikiGuest if not logged in).
I suggest to:
- Introduce a
ATTACHONVIEW
plugin setting flag to do/not do action in view, default set to 0
.
- Introduce an
attachonview="1"
parameter to variable to overload the default action.
- Document implications if flag is on.
I recommend also to move the plugin settings to configure, e.g. add a Config.spec file. And to add
our $SHORTDESCRIPTION
and
our $NO_PREFS_IN_TOPIC = 1
to the plugin code.
Test case:
%STARTATTACH{"test.txt"}%
Test attach content:
user: %WIKINAME%
date: %SERVERTIME{$year-$mo-$day $hou:$min:$sec}%
%ENDATTACH%
--
TWiki:Main.PeterThoeny
- 2011-06-03
I have a question regarding your comment
>>> I recommend also to move the plugin settings to configure, e.g. add a Config.spec file. And to add our $SHORTDESCRIPTION and our $NO_PREFS_IN_TOPIC = 1 to the plugin code.
Surely, we want to keep the DEBUG setting in the plugin home page? If, so, then would $NO_PREFS_IN_TOPIC = 1 not conflict?
Also, if we move $SHORTDESCRIPTION to the plugin code, I am confused as to how the topic page picks it up? Is there a Plugin example where I can see this implemented?
--
TWiki:Main.DipuDeshmukh
- 2011-06-05
our $NO_PREFS_IN_TOPIC = 1;
is recommended for performance. This tells TWiki to not scan the plugin topic for preferences settings. That means,
SHORTDESCRIPTION
need to be specified twice, once in plugin code (for TWiki), and once in plugin topic (for plugin reports on twiki.org).
There are two ways to do that:
1. Keep preferences settings: Users can set preferences settings in Main.TWikiPreferences. Recommended if users should be able to overload settings on web level or page level. See example
TWiki:Plugins.VarCachePlugin
and
TWikisvn:VarCachePlugin/lib/TWiki/Plugins/VarCachePlugin.pm
2. Move preferences settings to configure: Users can set plugin settings in configure. Recommended if only site admins should be able to change settings. See example
TWiki:Plugins.RecentVisitorPlugin
,
TWikisvn:RecentVisitorPlugin/lib/TWiki/Plugins/RecentVisitorPlugin.pm
and
TWikisvn:RecentVisitorPlugin/lib/TWiki/Plugins/RecentVisitorPlugin/Config.spec
--
TWiki:Main.PeterThoeny
- 2011-06-06
I updated
TWikiPlugins to document this.
--
TWiki:Main.PeterThoeny
- 2011-06-06
Thanks Peter. This clarifies a lot. I think I shall opt for "configure" setting for this plugin, since I don't think casual users would want to change the default settings, when they can always override on a case by case basis.
--
TWiki:Main.DipuDeshmukh
- 2011-06-06
I have checked in the changes and uploaded the new archives.
--
TWiki:Main.DipuDeshmukh
- 2011-06-07