Timeline Foswiki Plugin
Timeline is a DHTML-based AJAXy widget for visualizing time-based events.
I use it to show a WebChanges timeline with the query below.
Syntax Rules
the %TIMELINE% variable has the following parmeters:
- DEFAULT - the url of the datasource
- urltype - XML or JSON (defaults to JSON)
- interval - (DAY, MONTH, YEAR, DECADE)
- date - the initial date that the timeline will be centered on
- height - height in pixels that the timeline area will use
- width - width in pixels that the timeline area will use
- orientation - horizontal or vertical (horizontal by default)
Plugin Settings
Plugin settings are stored as preferences variables. To reference
a plugin setting write
%<plugin>_<setting>%
, i.e.
%TIMELINEPLUGIN_SHORTDESCRIPTION%
- One line description, is shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = Show a scrolling Timeline from a Foswiki SEARCH
- Debug plugin: (See output in
data/debug.txt
)
Example (shows when Plugin is installed and running successfully)
Note that the JSON based output is much more reliable cross browsers, so only use xml is you really need to.
static file
The first example shows a timeline based on a pre-existing JSON file (
http://365847.689093.cn/pub/System/TimelinePlugin/cubism.js)
%TIMELINE{
urltype="JSON"
"http://365847.689093.cn/pub/System/TimelinePlugin/cubism.js"
interval="DECADE"
height="200px"
width="700px"
date="1890"
}%
To use data from a Foswiki topic, you need to set the SKIN=text and add
?contenttype=text/xml
(to trick IE's XHTTPRequest into working) to the url
"http://10.10.10.20/trunk/bin/view/System/TimeLineSearchJSON?contenttype=text/xml"
urltype="JSON"
Foswiki SEARCH
based timeline
This example uses the
TimeLineSearchJSON topic to show the last 10 modified topics in the System,Main,Sandbox webs.
%TIMELINE{
urltype="JSON"
"http://365847.689093.cn/System/TimeLineSearchJSON?contenttype=text/xml"
interval="YEAR"
height="450px"
width="700px"
date="28 Nov 2024"
}%
The example is made up of the the %TIMELINE% variable that is converted into the client side javascript, and a Foswiki %SEARCH%
statement that formats the results into the XML data format that the javascript requires.
%TIMELINE{
urltype="JSON"
"%SCRIPTURL{view}%/%SYSTEMWEB%/TimeLineSearchJSON?contenttype=text/xml"
interval="YEAR"
height="450px"
width="700px"
date="%DISPLAYTIME{"$day $month $year"}%"
}%
customising the SEARCH based timeline
Using the URLPARAMs defined in
TimeLineSearchJSON you can customise the output
the currently defined params are:
- query - default to '1'
- querytype - defaults to 'query'
- webs - defaults to 'System,Main,Sandbox'
- tracknum - defaults to '' to use autolayout
%TIMELINE{
urltype="JSON"
"http://365847.689093.cn/System/TimeLineSearchJSON?contenttype=text/xml;query=1;querytype=query;webs=System"
interval="YEAR"
height="250px"
width="700px"
date="28 Nov 2024"
}%
%TIMELINE{
urltype="JSON"
"%SCRIPTURL{view}%/%SYSTEMWEB%/TimeLineSearchJSON?contenttype=text/xml;query=1;querytype=query;webs=System"
interval="YEAR"
height="450px"
width="700px"
date="%DISPLAYTIME{"$day $month $year"}%"
}%
Plugin Installation Instructions
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.
Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".
If you have any problems, or if the extension isn't available in
configure
, then you can still install manually from the command-line. See
http://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Plugin Info
Related Topics: Plugins,
DeveloperDocumentationCategory,
AdminDocumentationCategory,
DefaultPreferences,
SitePreferences