• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item6745: Enhance AttachContentPlugin to also work if topic is viewed

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension AttachContentPlugin Enhancement Closed   n/a 4.3.1, 5.0.2

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


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

  1. slow down page views,
  2. increase server load,
  3. makes pages look updated even if there is no update (recent changes and e-mail notification),
  4. 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:

Test attach content:
user: %WIKINAME%
date: %SERVERTIME{$year-$mo-$day $hou:$min:$sec}%

-- 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

Summary Enhance AttachContentPlugin to also work if topic is viewed
ReportedBy TWiki:Main.DipuDeshmukh
Codebase 4.2.1, 5.0.1
SVN Range TWiki-5.1.0-trunk, Sun, 22 May 2011, build 21317
AppliesTo Extension
Component AttachContentPlugin
Priority Enhancement
CurrentState Closed

Checkins TWikirev:21361 TWikirev:21362 TWikirev:21430 TWikirev:21431
TargetRelease n/a
ReleasedIn 4.3.1, 5.0.2
Edit | Attach | Watch | Print version | History: r13 < r12 < r11 < r10 < r9 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r13 - 2011-06-07 - DipuDeshmukh
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback