ajax1Add my vote for this tag integration2Add my vote for this tag javascript1Add my vote for this tag linking1Add my vote for this tag rendering2Add my vote for this tag xml1Add my vote for this tag create new tag
, view all tags


Display extra information (using AJAX) next to ExternalSite:Page links, based on rules defined in the InterWikiPreviews topic. Best used in conjunction with InterwikiPlugin.

Syntax Rules

  • Extra information, as specified in InterWikiPreviews, is loaded asynchronously and appended to ExternalSite:Page links.
  • Add and edit aliases in InterWikiPreviews.
  • Each entry must be of format:
    | External site alias | Data URL | Data format | Info format | Reload Every |
  • Site aliases must start with an upper case letter and may contain alphanumeric letters.
  • data is retrieved from the URL, which may contain $page variables.
  • The data format may be XML or JSON
  • Info format is appended to any ExternalSite:Page , with any %INTERWIKIPREVIEWFIELD{source="data_source" width="initial_width"}% fields replaced by values extracted from the retrieved XML or JSON data.
  • The information will be loaded only once if Reload Every is 0. Otherwise Reload Every is a periodic reload interval in seconds.


Given the following in InterWikiPreviews:

Alias: Data Source URL: Data Format: Info Format: Reload Every:
KernelBug http://bugzilla.kernel.org/xml.cgi?id= XML "%INTERWIKIPREVIEWFIELD{source="short_desc" width="30"}%" %INTERWIKIPREVIEWFIELD{source="version" width="10"}% %INTERWIKIPREVIEWFIELD{source="product"}% 0

Then KernelBug:1020 will render as:

KernelBug:1020 "------------------------------" ---------- -

Once http://bugzilla.kernel.org/xml.cgi?id=1020 has been retrieved, this will be replaced by:

KernelBug:1020 "EFS isnt working yet in 2.6.0-test2" 2.6.0-test2 File System

(Assuming that the metadata of that bug hasn't changed.)

The data retrieved from http://bugzilla.kernel.org/xml.cgi?id=1020 will be cached in the plugin's work area. The next time KernelBug:1020 is rendered, it will contain the cached data. (The cache validity period is the same as the reload interval, or a configurable default.)

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %NEWPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Display extra information (using AJAX) next to ExternalSite:Page links.

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = no

  • Default Cache expiration time. Valid values are those understood by Cache::Cache::set
    • Set DEFAULT_CACHE_EXPIRY = 1 day

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the TWiki server.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip InterwikiPreviewPlugin.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/InterwikiPreviewPlugin.txt Plugin topic
    data/TWiki/InterwikiPreviewPlugin.txt,v Plugin topic repository
    data/TWiki/InterWikiPreviews.txt Preview rules topic
    data/TWiki/InterWIkiPreviews.txt,v Preview rules topic repository
    lib/TWiki/Plugins/InterwikiPreviewPlugin.pm Plugin Perl module
    lib/TWiki/Plugins/InterwikiPreviewPlugin/Rule.pm Plugin Perl module
    lib/TWiki/Plugins/InterwikiPreviewPlugin/Query.pm Plugin Perl module
    pub/TWiki/InterwikiPreviewPlugin/MochiKit.js Redistributed Javascript library (MIT license)
    pub/TWiki/InterwikiPreviewPlugin/query.js Plugin Javascript library
  • Configure the Plugin:
    • TWiki 4.0 and up: Run the configure script to enable the Plugin
    • Change the Plugin settings as needed
    • Ensure InterwikiPreviewPlugin is loaded before InterwikiPlugin if they are both enabled. Use the {PluginsOrder} configuration setting.
  • Test if the installation was successful:
    • enter samples here

Plugin Info

Plugin Author: TWiki:Main.IanBygrave
Copyright: © 2007, TWiki:Main.IanBygrave
License: GPL (GNU General Public License)
Plugin Version: 3 Jun 2007 (V1.010)
Change History:  
3 Jun 2007: Apply HTTP Cache-control request headers to cached data.
Serialize AJAX requests to reduce server load.
Use session values instead of global variables.
Bug fixes.
2 May 2007: Prepopulate fields from cached JSON data too.
Make CPAN dependencies optional.
30 Apr 2007: Allow %INTERWIKIPREVIEWFIELD% tags outside info format specs.
Improve interaction with rendering process, and handling of other markup in info format.
Protect javascript from rendering.
Catch XML parsing errors.
Don't delay AJAX when field prepopulation failed.
Set CSS class to reflect field prepopulation.
26 Apr 2007: Prepopulate fields from cached data (XML only).
Configurable default cache expiration.
25 Apr 2007: Add simple caching of rest responses.
Minor fixes and code comments.
16 Apr 2007: Extract javascript to query.js
15 Apr 2007: Fix for IE7.
Fix forced links.
13 Apr 2007: Add JSON support.
Implement '$page' in url.
Use twiki version conditional code for getUrl.
Use correct plugin handlers.
Replace info format syntax %source% with %INTERWIKIPREVIEWFIELD{source="source" width="width"}%
12 Apr 2007: Fix interaction with InterwikiPlugin. Add css classes to field elements.
10 Apr 2007: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.1
CPAN Dependencies: Cache::FileCache
XML::Parser optional
JSON optional
Other Dependencies: none
Perl Version: 5.005
Benchmarks: GoodStyle 88%, FormattedSearch 96%, InterwikiPreviewPlugin 89%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/InterwikiPreviewPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/InterwikiPreviewPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/InterwikiPreviewPluginAppraisal

Related Topics: TWikiPlugins, DeveloperDocumentationCategory, AdminDocumentationCategory, TWikiPreferences

-- TWiki:Main.IanBygrave - 09 Apr 2007

Topic attachments
I Attachment History Action Size Date Who Comment
Compressed Zip archivezip InterwikiPreviewPlugin.zip r12 r11 r10 r9 r8 manage 64.1 K 2007-06-02 - 23:07 IanBygrave Plugin Package
Edit | Attach | Watch | Print version | History: r16 < r15 < r14 < r13 < r12 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r16 - 2007-06-02 - IanBygrave
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.