r6 < r5 < r4 |
|
MyCo.MyTopic |
Webs: Myco | Main | TWiki | Sandbox |
|
Changes | Index | Search | Go |
MyCo.MyTopic |
Webs: Myco | Main | TWiki | Sandbox |
|
Changes | Index | Search | Go |
Edit | Attach | Diffs | r2 > r1 | More | |
Revision r1.2 - 13 Feb 2004 - 09:09 GMT - TWikiPresenter |
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors. Ideas, requests, problems regarding TWiki? Send feedback Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.WebHome. |
the world
is an OblateSpheroid_Everyone_ *knows* that =the world= is an OblateSpheroid
Actually it is perfectly and absolutely flat
_Actually_ it is *perfectly* and __absolutely__ flat
You type | You see |
---|---|
---+ This is a heading | This is a heading |
---++ And so is this | And so is this |
like this
You type | You see |
---|---|
* Bullet * Sub-bullet |
|
1
| Cat | Feline | | Bear | Ursine | | Wolf | Lupine |
Cat | Feline |
Bear | Ursine |
Wolf | Lupine |
[[BumpyWords][bumpy words]] appears as bumpy words
[[http://www.google.com/][Google]]
appears as Google
<nop>
<nop>_word_
appears as _word_
Attachment | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|
myco.gif | manage | 9.6 K | 13 Feb 2004 - 18:41 | MushroomMagicMan | Attached image file |
%ATTACHURL%/myco.gif
to see this:
%SEARCH{"CategoryWeather" nosearch="on" nosummary="on"}%
%CALENDAR...%
%COMMENT...
%CHART...
%EDITTABLE...
%RENDERLIST...
%SLIDESHOWSTART...
%CALC...
%TABLE...
%DRAWING...
configure
, make
, etc. This is often not necessary on Linux or Windows.
TWiki web | Tools |
---|---|
IVOA: Welcome to TWiki expandable virtual workspace. | |
PDL1RFC: | |
PhotDM1: | |
Spectral2: Welcome to TWiki expandable virtual workspace. | |
SpectralDM2: | |
Know: Knowledge base set-up - Add TWikiForms for organizing & classifying content. | |
Main: TWiki home with users and groups for access control | |
Sandbox: Sandbox web to experiment in an unrestricted hands-on area | |
TWiki: TWiki documentation, welcome, registration and other starting points | |
_default: | |
_empty: |
This table is updated automatically based on WebPreferences settings of the individual webs. | |||||
Legend: | WebHome | WebSearch | WebChanges | WebNotify | |
WebPreferences | WebStatistics | WebTopicList | WebIndex |
"$SUM( $ABOVE() )"
to TWiki tables or anywhere in topic text ExternalSite:Page
to link to a page on an external site based on aliases defined in a rules topic :-)
for or :eek:
for {SiteLocale}
setting in configure - this enables you to have a slightly different spelling of the character set in the server locale (e.g. 'eucjp') and the HTTP header sent to the browser (e.g. 'euc-jp').
This feature should also support use of Mozilla Browser with TWiki:Codev.TWikiOnMainframe (as long as mainframe web server can convert or pass through UTF-8 URLs) - however, this specific combination is not tested. Other browser-server combinations should not have any problems.
Please note that use of UTF-8 as the site character set is not yet supported - see Phase 2 of TWiki:Codev.ProposedUTF8SupportForI18N for plans and work to date in this area.
This feature is complete in TWiki releases newer than February 2004.
Note for skin developers: is no longer required (TWiki:Plugins.InternationalisingYourSkin).
twiki-backup-2024-10-31-23-56.zip
in the backup directory (default /tmp
).
backuprestore
utility can be used to create a backup (scheduled or manually), to copy a backup, and to check on the status of the backup process.
Command | Description |
---|---|
./backuprestore status |
Show backup status. Returns backup_status: 1 if web-based backup is in progress. |
./backuprestore create_backup |
Create a backup. This is done without a background daemon process, e.g. the script returns when the backup is done. |
./backuprestore download_backup <name.zip> |
Dump a backup file to STDOUT. If called as CGI script, download a backup file. |
apache
, nobody
, www-data
, wwwrun
or the like, and depends on the webserver configuration.
twiki/bin
directory before executing the backuprestore
utility.
10 0 * * 0 (cd /path/to/twiki/bin; ./backuprestore create_backup >/dev/null 2>&1)Make sure the plugin is configured properly before creating backups. The backup destination can be local or remote. If remote, the remote server needs to be mounted on the TWiki server via NFS or the like.
{Plugins}{BackupRestorePlugin}{BackupDir}
- Backup destination directory. Default: /tmp
.
{Plugins}{BackupRestorePlugin}{KeepNumberOfBackups}
- keep number of backups (e.g. delete old backups), 0 to keep all. Default: 7
{Plugins}{BackupRestorePlugin}{TempDir}
- temp directory. Default: /tmp
{Plugins}{BackupRestorePlugin}{createZipCmd}
- create zip command. Default: /usr/bin/zip -r
{Plugins}{BackupRestorePlugin}{listZipCmd}
- list zip content command. Default: /usr/bin/unzip -l
{Plugins}{BackupRestorePlugin}{unZipCmd}
- unzip command. Default: /usr/bin/unzip -o
{Plugins}{BackupRestorePlugin}{Debug}
- debug flag. Default: 0
{Plugins}{BackupRestorePlugin}{BackupDir}
configure setting.
twiki-backup-2024-10-31-23-56.zip
- date based names.
data/*
- all data and logs.
pub/*
- all attachments.
working/*
- working data.
working/BackupRestorePlugin/LocalSite.cfg
- TWiki configuration file (if found).
working/BackupRestorePlugin/LocalLib.cfg
- TWiki lib file (if found).
working/BackupRestorePlugin/twiki.conf
- Apache config file (if found).
working/BackupRestorePlugin/version.txt
- contains the TWiki version number of the backup. Used to intelligently restore backup to newer TWiki version. Example: version: TWiki-5.1.0
short: 5.1
working/BackupRestorePlugin/version-long-TWiki-5.1.0.txt
- file with TWiki version in filename
working/BackupRestorePlugin/version-short-5.1.txt
- file with TWiki short-version in filename, name version-short-<major>.<minor>.txt
%BACKUPRESTORE{"..."}%
variable to perform all web-based operations. The variable is used in the BackupRestoreConsole page.
%BACKUPRESTORE{"..."}%
parameters:
Parameter | Explanation | Default |
---|---|---|
action="..." |
Action to take: • "" (empty) - show backup overview console. • "backup_detail" - show backup detail console. • "create_backup" - start new backup. • "cancel_backup" - cancel backup in progress. • "delete_backup" - delete a backup. • "restore_backup" - restore from a backup. • "status" - show backup status (1: backup in progress). • "debug" - debug and diagnostics - {Plugins}{BackupRestorePlugin}{Debug} must be enabled. |
"" (empty) |
file="..." |
Name of backup file to take action. The file parameter is required for the following actions: "backup_detail" , "delete_backup" and "restore_backup" . |
"" |
{Plugins}{BackupRestorePlugin}{BackupDir}
directory.
BackupRestorePlugin.zip
in your twiki installation directory. Content: File: | Description: |
---|---|
bin/backuprestore | CGI/command line utility |
data/TWiki/BackupRestorePlugin.txt | Plugin topic |
data/TWiki/BackupRestoreConsole.txt | Backup and restore console topic |
lib/TWiki/Plugins/BackupRestorePlugin.pm | Plugin Perl module |
lib/TWiki/Plugins/BackupRestorePlugin/CaptureOutput.pm | Perl module |
lib/TWiki/Plugins/BackupRestorePlugin/Core.pm | Core backup module |
lib/TWiki/Plugins/BackupRestorePlugin/ProcDaemon.pm | Perl module |
twiki/lib/LocalSite.cfg
and customize as needed:# Path to backup destination directory. Can be a volume mounted to the file system. $TWiki::cfg{Plugins}{BackupRestorePlugin}{BackupDir} = '/tmp'; # Keep number of backups (e.g. delete old backups), 0 to keep all. $TWiki::cfg{Plugins}{BackupRestorePlugin}{KeepNumberOfBackups} = '7'; # Path to temp directory, used by BackupRestorePlugin daemon for temporary data. $TWiki::cfg{Plugins}{BackupRestorePlugin}{TempDir} = '/tmp'; # Path to zip command with options to recursively archive files and directory. $TWiki::cfg{Plugins}{BackupRestorePlugin}{createZipCmd} = '/usr/bin/zip -r'; # Path to unzip command with options to list all files. $TWiki::cfg{Plugins}{BackupRestorePlugin}{listZipCmd} = '/usr/bin/unzip -l'; # Path to unzip command with options to unzip all files with option to overwrite existing files. $TWiki::cfg{Plugins}{BackupRestorePlugin}{unZipCmd} = '/usr/bin/unzip -o'; # Debug plugin. See output in data/debug.txt $TWiki::cfg{Plugins}{BackupRestorePlugin}{Debug} = 0;
twiki/lib/LocalSite.cfg
file with above $TWiki::cfg
settings and end the file with: 1;
twiki/bin/setlib.cfg
file with this content:my $twikiLibPath = "/path/to/your/twiki/lib"; unshift @INC, $twikiLibPath; 1;
working
directory in the twiki
root (same level as twiki/lib
), and set ownership to the webserver user.
Plugin Author: | TWiki:Main.PeterThoeny, TWiki.org |
Copyright: | © 2011-2021 TWiki:Main.PeterThoeny © 2011-2021 TWiki:TWiki.TWikiContributor © 2004, 2005 Simon Flack (for CPAN:IO::CaptureOutput) © 2007, 2008 David Golden (for CPAN:IO::CaptureOutput) © 1997-2011 by Earl Hood and Detlef Pilzecker (for CPAN:Proc::Daemon) |
License: | GPL (GNU General Public License) |
Plugin Version: | 2021-03-19 |
2021-03-19: | TWikibug:Item7927: Copyright update to 2021 |
2018-07-10: | TWikibug:Item7841: Copyright update to 2018 |
2017-12-31: | TWikibug:Item7831: Allow action=debug only if Debug flag set; parameter sanity checks |
2016-01-08: | TWikibug:Item7708: Copyright update to 2016 |
2015-01-09: | TWikibug:Item7604: Switch to GPL v3 |
2013-02-16: | TWikibug:Item7091: Use TWISTY in installation instructions section and change history |
2012-09-03: | TWikibug:Item6837: Doc update with zip utility limitation of 4GB |
2012-01-13: | TWikibug:Item6796: Fixing copyright year to 2012 |
2011-12-19: | TWikibug:Item6799: Improved docs on GNU zip dependency |
2011-09-13: | TWikibug:Item6796: Improved docs on command line use |
2011-09-05: | TWikibug:Item6795: Add restore from backup functionality; upgrade old system topics on restore of old TWiki; describe how to upgrade TWiki |
2011-08-17: | TWikibug:Item6793: Avoid or work around newer APIs to make plugin run on old TWiki-2001-09-01 (Athens Release) for backup |
2011-08-16: | TWikibug:Item6793: Add screenshot; add Config.spec configure file; proper detection of command line mode also for older TWiki versions; use TWiki::Func::registerTagHandler only if available so that plugin can run in older TWiki versions |
2011-08-15: | TWikibug:Item6793: Better error handling; add magic number to download URL to restrict download of backups to TWiki admins only |
2011-08-12: | TWikibug:Item6631: Initial version |
TWiki Dependency: | $TWiki::Plugins::VERSION 1.0 |
CPAN Dependencies: | none ( Proc::Daemon included as TWiki::Plugins::BackupRestorePlugin::ProcDaemon ) ( IO::CaptureOutput included as TWiki::Plugins::BackupRestorePlugin::CaptureOutput ) |
Other Dependencies: | GNU zip and unzip command line utilities |
Perl Version: | 5.005 |
TWiki:Plugins.Benchmark: | GoodStyle nn%, FormattedSearch nn%, BackupRestorePlugin nn% |
Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/BackupRestorePlugin |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/BackupRestorePluginDev |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/BackupRestorePluginAppraisal |
Behaviour
Javascript event library, available from http://bennolan.com/behaviour/.
Behaviour uses CSS selectors to subscribe to Javascript event handlers. This allows to create clean code, separated from HTML (and well suited to create Javascript based interaction that degrades nicely when Javascript is not available).
From the website:
After all the work of WASP and others to promote clean markup, valid pages and graceful degradation via css - it sucks that we're going back to tag soup days by throwing javascript tags into our html. The better way to do javascript is to do it unobtrusively. PPK and Simon Willison have been recommending this approach for ages. And it's definitely the way to go. The only problem is that it's a bit of a pain in the ass. That's why I came up with Behaviour - my solution to unobtrusive javascript behaviours. How does it work? Behaviour lets you use CSS selectors to specify elements to add javascript events to. This means that instead of writing:<li> <a onclick="this.parentNode.removeChild(this)" href="#"> Click me to delete me </a> </li>You can use:<ul id="example"> <li> <a href="/someurl">Click me to delete me</a> </li> </ul>And then use css selectors to select that element and add javascript functions to it.var myrules = { '#example li' : function(el){ el.onclick = function(){ this.parentNode.removeChild(this); } } }; Behaviour.register(myrules);
In your code you create a "rules" object, with sub-objects for each html element class name or id:<script type="text/javascript" src="%PUBURL%/%SYSTEMWEB%/BehaviourContrib/behaviour.js"></script>
Apply the rules with:var myrules = { '.classname' : function(element) { // element event element.onclick = function() { // code here } }, '#id' : function(element) { // element event element.onclick = function() { // code here } } };Or use nested identifiers:var myrules = { '.menu li a' : function(element) { element.onclick = function() { // code here } } };
Behaviour.register(myrules);
Creates:<div id="demoblock" style="padding:1em; width:100px; text-align:center;"> MOUSE OVER ME </div> <script type="text/javascript"> // <![CDATA[ var myrules = { '#demoblock' : function(el) { var defaultColor = '#A3D6F8'; var highlightColor = '#4A7FB5'; el.style.backgroundColor = defaultColor; el.onmouseover = function() { this.style.backgroundColor = highlightColor; return false; } el.onmouseout = function() { this.style.backgroundColor = defaultColor; return false; } }, '#demoblock span' : function(el) { var text = el.innerHTML; var fisherYates = function (inArray) { var i = inArray.length; if ( i == 0 ) return false; while ( --i ) { var j = Math.floor( Math.random() * ( i + 1 ) ); var tempi = inArray[i]; var tempj = inArray[j]; inArray[i] = tempj; inArray[j] = tempi; } } var randomize = function(inText) { var letters = inText.split(''); fisherYates(letters); return letters.join(''); } el.onmouseover = function() { this.innerHTML = randomize(text); return false; } el.onmouseout = function() { this.innerHTML = text; return false; } } }; Behaviour.register(myrules); // ]]> </script>
null
:
var myrules = { 'table.test td' : function(element) { element.onmouseover = function() { this.style.backgroundColor = highlightColor; return false; } element = null; // by setting this IE will not leak } }; Behaviour.register(myrules);
configure
interface (Go to Plugins->Find More Extensions) .zip
or .tgz
archives
perl <module>_installer
)
configure
and enable the module, if it is a plugin.
,v
files in your existing install (take care not to lock the files when you check in)
Behaviour
Javascript event library to create Javascript based interactions that degrade well when Javascript is not available
Author: | TWiki:Main/ArthurClemens |
Copyright: | Code: behaviour.js version 1.1 - Copyright (c) Ben Nolan and Simon Willison.TWiki distribution and updates/additions: © TWiki:Main/ArthurClemens. © 2006-2010 TWiki:TWiki/TWikiContributor |
License: | BSD for behaviour.js GPL (GNU General Public License) for TWiki BehaviourContrib |
Version: | 18694 (2010-05-29) |
Dependencies: | None |
Contrib Version: | 1.4 |
Change History: | |
2010-05-15: | TWikibug:Item6433 - doc improvements; replacing TWIKIWEB with SYSTEMWEB |
17 Oct 2007 | 1.3 Replaced "faster code" by other code from Dean Edwards, [[ packed by http://groups.google.com/group/behaviour/browse_thread/thread/85137977bedf5ed/3cf3ba8065d41a8c#3cf3ba8065d41a8c][Raymond Irving]]. |
02 Jul 2007 | 1.2 Integrated other faster code by Dean Edwards: faster onload (again). |
08 Mar 2007 | 1.1 Integrated code by Dean Edwards (see Code update version 1.1 with faster DOM queries). |
04 Jun 2006 | 1.0 First Version. Included Behaviour version: 1.1. |
Home: | http://TWiki.org/cgi-bin/view/Plugins/BehaviourContrib |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/BehaviourContribDev |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/BehaviourContribAppraisal |
<noautolink> %EDITTABLE{}% | FirstName | LastName | Email | WikiName | | Test | User | you@example.com | TestUser | </noautolink>Usage:
<noautolink> %EDITTABLE{}% | FirstName | LastName | Email | WikiName | CustomFieldThis | SomeOtherRandomField | WhateverYouLike | | Test | User | you@example.com | TestUser | A | B | C | </noautolink>
alias | meaning |
s | Second |
m | Minute |
h | Hour |
d | Day |
w | Week |
M | Month |
y | Year |
* Set Email = user@example.comIf your user topic is not protected from changes by other people, and you don't register an e-mail address using this form, then your user account could be hijacked by someone else. If your old e-mail addresses are all invalid (you can't receive mail there any more) and you have forgotten your password, please contact ivoadoc@ivoa.net for help.
new
method used to create new object instances. For example,
my $mobile = new Telecoms();or
my $mobile = Telecoms->new();Related Topics: StaticMethod, ObjectMethod, DeveloperDocumentationCategory
Description: | The classic TWiki skin, bare bone and functional, for any browser, with a minimum of graphics |
Screenshot: | |
Base Name: | classic |
Skin Author: | TWiki:Main/PeterThoeny |
Skin Version: | 03 Aug 2008 |
Change History: | |
03 May 2008 | TWiki 4.2.1 release version |
21 May 2007 | Bugs:Item3969 - 8bit email fix (TWiki:Main.WillNorris) |
25 Jul 2004: | Initial version (v1.000) |
Dependencies: | |
Skin Home: | http://TWiki.org/cgi-bin/view/Plugins/ClassicSkin |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/ClassicSkinDev |
color
type to TWikiForms:
Type | Description | Size | Value |
---|---|---|---|
color |
Single-line text box and a color picker to pick a color. The color can also be typed into the text box, such as #123456 . |
Text box width in number of characters | Initial (default) color |
Name: | Type: | Size | Values: | Tooltip message: |
---|---|---|---|---|
Background color | color | 12 | Select color |
<form action="..."> %COLORPICKER{ name="text_color" size="12" value="#123456" class="twikiInputField" }% <form>This will show an HTML input field named "text_color" and a color picker tied to it. The
size
, value
and class
parameters are optional. Additional parameters can be supplied; they will be added to the HTML input field.
Test: (this only works if the ColorPickerPlugin is installed and enabled)
%INCLUDE{ "%SYSTEMWEB%.ColorPickerPlugin" section="code" }% <form action="..."> %INCLUDE{ "%SYSTEMWEB%.ColorPickerPlugin" section="picker" NAME="demo_color" SIZE="12" VALUE="#123456" EXTRA="class=\"twikiInputField\"" }% </form>This will show an HTML input field named "demo_color" and a color picker tied to it. The
"code"
section should be included once per topic, the "picker"
section can be included as many times as needed. The NAME
parameter is required; SIZE
, VALUE
and EXTRA
parameters are optional. Use the EXTRA
parameter to add additional parameters to the HTML input field.
Test: (this works only if the ColorPickerPlugin is installed and disabled)
addHEAD
needs to be called before TWiki::Plugins::ColorPickerPlugin::renderForEdit
is called.
configure
interface (Go to Plugins->Find More Extensions) .zip
or .tgz
archives
perl <module>_installer
)
configure
and enable the module, if it is a plugin.
,v
files in your existing install (take care not to lock the files when you check in)
Author: | TWiki:Main.PeterThoeny, Twiki Inc | ||||||
Copyright: | © 2007 Steven Wittens, Acko.net for Farbtastic jQuery plugin © 2010-2011 TWiki:Main.PeterThoeny and TWiki:TWiki.TWikiContributor for TWiki ColorPickerPlugin |
||||||
License: | GPL (GNU General Public License) | ||||||
Dependencies: |
|
||||||
Version: | 21489 (2011-08-20) | ||||||
Change History: | |||||||
2011-06-11: | TWikibug:Item6725: Change global package variables from "use vars" to "our" | ||||||
2010-11-30: | TWikibug:Item6610: Rewrite ColorPickerContrib into ColorPickerPlugin | ||||||
2010-11-27: | TWikibug:Item6609: In TWikiForms type table, automatically list the color form field type defined in this contrib -- TWiki:Main.PeterThoeny |
||||||
2010-11-26: | TWikibug:Item6606: Complete rewrite of contrib using Farbtastic color picker -- TWiki:Main.PeterThoeny | ||||||
2006-10-27: | Initial version of ColorPickerContrib by TWiki:Main.FlavioCurti using Colorpicker by Norman Timmler (inlet media e.K., Hamburg, Germany) | ||||||
Home: | http://TWiki.org/cgi-bin/view/Plugins/ColorPickerPlugin | ||||||
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/ColorPickerPluginDev | ||||||
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/ColorPickerPluginAppraisal |
%COMMENT{attributes}%
anywhere in a TWiki topic.
%COMMENT%
without parameters shows a simple text box.
%COMMENT{}%
can handle the following parameters: Parameter | Description | Default |
---|---|---|
type | This is the name of the template to use for this comment. Comment templates are defined in a TWiki template - see customization. If this attribute is not defined, the type is whatever is defined by COMMENTPLUGIN_DEFAULT_TYPE, either in this topic or in your WebPreferences. | "below" |
default | Default text to put into the textarea of the prompt. | |
target | Name of the topic to add the comment to | the current topic |
location | Regular expression specifying the comment location in the target topic. Read carefully the CommentPlugin documentation! | |
mode | For compatibility with older versions only, synonymous with type | |
nonotify | Set to "on" to disable change notification for target topics | "off" |
noform | Set to "on" to disable the automatic form that encloses your comment block - remember to insert <form> tags yourself! See CommentPluginExamples#noform for an example. | "off" |
nopost | Set to "on" to disable insertion of the posted text into the topic. | "off" |
remove | Set to "on" to remove the comment prompt after the first time it is clicked. | "off" |
button | Button label text | "Add comment" |
%COMMENT
supports several ways to specify where a comment should be inserted in the target topic. This is referred to as the location of the comment.
%COMMENT
tag %COMMENT
tag itself. For example:
%COMMENT{type="below"}%will add comments in the current topic, directly below the
%COMMENT
tag.
target
attribute may specify a web, and may also specify an anchor within the target topic; for example,
%COMMENT{type="above" target="%USERSWEB%.PersonalRemarks#InsertHere"}%This uses a standard TWiki in-topic anchor as the insertion location. See TextFormattingRules for more about TWiki anchors.
location
parameter. The target topic is searched for the regular expression, and the comment inserted relative to the string that the search matched. For example,
%COMMENT{type="above" location="Flights of Fancy"}%will place comments above the first occurrence of the string
Flights of Fancy
in the current topic.
Warning of course, if a user's comment contains the string "Flights of Fancy" they may and up changing the location for the next comment! Also, if you use a tag in the location, then you've just inserted another tag in the page that contains the %COMMENT
! So be very careful how you specify the RE for location
. Note that the RE is matched using perl "multiple line" mode, so ^ and $ match the start of a line and the end of a line respectively. location="
just before the location.
I look forward to someone leveraging this feature to create - for example - threaded conversations using %COMMENT
.
If you specify an anchor and a location
, the anchor will be ignored.
Template type | Description |
---|---|
top |
Comments, signed and dated (server time), added at top of the topic (the anchor is ignored) |
bottom |
Comments, signed and dated (server time), added at end of the target topic (the anchor is ignored) |
above |
Comments, signed and dated (server time), added immediately before the target anchor, or the %COMMENT if no anchor is specified |
below |
Comments, signed and dated (server time), added immediately below the target anchor, or the %COMMENT if no anchor is specified |
belowthreadmode |
Comments, signed and dated, added recurse after comment box |
threadmode |
Wiki thread mode comment, signed and dated (server time) |
tableprepend |
Comments, signed and dated (server time), formatted as an HTML table row, added below the anchor (which must be in an HTML <table>) |
tableappend |
Comments, signed and dated (server time), formatted as an HTML table row, added above the anchor (which must be in an HTML <table>) |
action |
Action added to action table directly above comment box (see Plugin Installation Instructions below for important notes) |
table |
Tablerows adding on end |
toctalk |
Talk using TOC adding on end |
bookmark |
Create a list of annotated bookmarks |
return |
Post to a different topic and return |
PROMPT:mytype
and OUTPUT:mytype
respectively. See comments.tmpl
in the templates directory for examples.
The plugin picks up these template definitions from a standard TWiki template file, templates/comments.tmpl
. This allows different templates to be defined for different TWiki skins.
templates/comments.tmpl
includes the topic CommentPluginTemplate, which contains all the shipped standard templates and in turn includes TWiki.UserCommentsTemplate that can include non-standard customizations.
This allows for several levels of customization: comments.tmpl
to include a different topic (this customization will be lost next time you upgrade, though).
UserCommentsTemplate
to the web (this will replace TWiki.UserCommentsTemplate)
templatetopic
parameter. For example:
%COMMENT{type="blogpost" templatetopic="BlogPostCommentTemplate" target="CommentPlugin" button="Add comment" }%
templatetopic
accepts topic
or web.topic
syntax. See an example in CommentPluginExamples#TemplateTopic.
If you use any topic other than UserCommentTemplate, it is critically important that you include this line at the end of your comment template topic:
%TMPL:INCLUDE{"%SYSTEMWEB%.CommentPlugin"}%Without this line your templates will not be picked up. Templates are picked up by following the standard TWiki rules for locating template files. Note that you can use
%TMPL:INCLUDE%
to include other files of templates. PROMPT
and an OUTPUT
definition:
%TMPL:DEF{PROMPT:myComment}%%TMPL:P{promptbox}%%TMPL:END% %TMPL:DEF{OUTPUT:myComment}%%TMPL:P{outputoneliner}%%POS:TOP% %TMPL:END%Call your custom comment with:
%COMMENT{type="myComment"}%
PROMPT
template PROMPT
template defines the contents of an HTML form that is used to capture the comment. This form invokes the comment generator when submitted. Parameters to the comment generator are defined using standard HTML input fields, such as input
, textarea
and select
. The user enters values for these parameters, and these are then available when the OUTPUT
template is expanded, in the form of %URLPARAM%
s.
Only the input fields of the form need be defined. The plugin automatically generates the <form>
and </form>
tags, unless you specify noform="on"
, in which case you have to provide them yourself. Note that you must define a "submit" button if you want the form to work!
%COMMENT
tag that is not one of the standard attributes, then that attribute is taken as the name of a parameter to be expanded in the PROMPT
template. Expressions in the template of the form %
param|
default%
(e.g. %rows|3%
, %button|Push me%
) are expanded to the values given in the %COMMENT
. For example, if the PROMPT
template 'example' contains:
<textarea rows=%rows|3% cols="%cols|50%" value="%tval|Rubbish%">and the %COMMENT tag is:
%COMMENT{type="example" cols="75"}%then the template will be expanded as
<textarea rows="3" cols="75" value="Rubbish">
PROMPT
definition:
Variable | Description |
---|---|
%DISABLED% |
Set to 'disabled' when you cannot comment (e.g. in preview mode). |
%MESSAGE% |
The text specified by default . This may be overridden by a helpful message when the prompt is DISABLED. |
save
script is invoked on the target topic, with a number of parameters provided by the comment form. Normally the CommentPlugin will provide these fields in the form, but experts can also provide the fields themselves in order to get finer control over what is submitted, or you might want to define your own HTML forms that do comment submission. The parameters that the CommentPlugin recognises are as follows:
CGI parameter | Description |
---|---|
comment_action |
Must be save to get the CommentPlugin to perform |
comment_type |
Type of the OUTPUT template |
comment_index |
Zero-based index of the %COMMENT in the source topic. Used to place a post relative to an existing %COMMENT. |
comment_anchor |
Anchor taken from the target spec |
comment_location |
As passed to %COMMENT |
comment_nonotify |
As passed to %COMMENT |
comment_remove |
Zero-based index of a %COMMENT to remove from the target topic |
comment_nopost |
As passed to %COMMENT |
comment_templatetopic |
As passed to %COMMENT |
comment_location
overrides comment_anchor
, and both override comment_index
. Example, shows an "I Approve" button that adds your approval signature to the end of the topic:
<form method="post" action="%SCRIPTURL{save}%/TWiki/CommentPlugin"> <input type="submit" value="I Approve" /> <input type="hidden" name="comment_action" value="save" /> <input type="hidden" name="comment_type" value="bottom" /> <input type="hidden" name="comment" value="I Approve" /> </form>
%COMMENTPROMPT%
; the prompt will be positioned here.
noform="on"
templatetopic
to point to the topic with the form template
%TMPL:DEF{FORM:example}% <form method="post" action="%SCRIPTURL{save}%/%BASEWEB%/%BASETOPIC%" enctype="application/x-www-form-urlencoded" name="examplecomment" id="examplecomment"> <input type="hidden" name="redirectto" value="%BASEWEB%.%BASETOPIC%" /> %COMMENTPROMPT% </form> %TMPL:END%Example comment:
%COMMENT{noform="on" type="example" templatetopic="Sandbox.CommentPluginTemplateExample" target="CommentPlugin" button="Add comment" }%
OUTPUT
template OUTPUT
template defines the format for the text that actually gets embedded into the topic. All the usual TWiki variables are available in the PROMPT
definition, but note that they get expanded when the comment is inserted in the text, so time, date and username will refer to the time and date when the comment was made, and the user who made it.
There are also four position tags that are used to indicate where the comment should be placed, relative to the location
defined in the %COMMENT
tag:
%POS:TOP% |
If present, comments will be inserted at the top of the topic i.e. before any other text |
%POS:BOTTOM% |
If present, comments will be inserted at the end of the topic i.e. after all existing text |
%POS:BEFORE% |
If present, comments will be inserted immediately before the %COMMENT% tag |
%POS:AFTER% |
If present, comments will be inserted immediately after the %COMMENT% tag |
COMMENTPLUGIN_DEFAULT_TYPE
%COMMENTPROMPT% |
Use with a custom form. If present, the comment prompt will be positioned here. |
OUTPUT
template. See TWikiVariables for details.
COMMENTPLUGIN_DEFAULT_TYPE
setting, add a * Set COMMENTPLUGIN_DEFAULT_TYPE = ...
bullet in Main.TWikiPreferences.
twiki/templates
directory that contains the comment templates. The default 'comments.tmpl' automatically includes user templates from TWiki.CommentPluginTemplate, which in turn includes TWiki.UserCommentsTemplate. CommentPlugin_installer
to automatically check and install other modules that this module depends on, and enable the plugin.
configure
to enable the plugin
action
template then you must also: {PluginsOrder}
configuration option (in configure
)
Plugin Author: | TWiki:Main.CrawfordCurrie http://www.c-dot.co.uk inspired by the work of TWiki:Main.DavidWeller and TWiki:Main.PeterMasiar |
Copyright: | © 2004, TWiki:Main.CrawfordCurrie; © 2009 TWiki:Main.SopanShewale; © 2004-2011 TWiki:TWiki.TWikiContributor |
License: | GPL (GNU General Public License) |
Plugin Version: | 21517 (2012-01-14) |
Change History: | |
2011-06-16: | TWikibug:Item6754: Fix for action comment template missing %ENDACTION% -- TWiki:Main.JohnRouillard |
2011-06-12: | TWikibug:Item6725: Change global package variables from "use vars" to "our"; adding NO_PREFS_IN_TOPIC in plugin package -- TWiki:Main.PeterThoeny |
2011-03-28: | TWikibug:Item6672 - doc improvements: Adding link to HIDE |
2010-12-11: | TWikibug:Item6530 - doc improvements -- TWiki:Main.ScottGutman |
2010-05-16: | TWikibug:Item6433 - doc improvements |
2010-03-19 | TWikibug:Item6404 Use $br in newline parameter for break tag instead of turning off encoding -- TWiki:Main/PeterThoeny |
2010-02-27 | TWikibug:Item6276 Cannot specify percentBRpercent for newline value -- TWiki:Main/SopanShewale |
2009-01-21 | TWikibug:Item6163 Fix for Comment Plugin losing data if target anchor is missing -- TWiki:Main/TimotheLitt and TWiki:Main/SopanShewale |
03 Aug 2008 | The TWiki 4.2.1 release version |
11 Apr 2008 | TWikibug:Item5518 corrected the template definition for bulletabove |
5 Sep 2007 | TWikibug:Item3689 corrected location handling TWikibug:Item4181 added VarCOMMENT TWikibug:Item4402 corrected access check |
22 Jun 2007 | Removed the long-deprecated %TIME (use %GMTIME instead). Minor doc changes |
14021 | TWikibug:Item3755 Fixed incorrect handling of line terminators when targeting an anchor |
13311 | Added option to define a comment template in any topic. Pass the topic location with templatetopic (either topic or web.topic ). See an example in CommentPluginExamples:templatetopic. |
12822 | TWikibug:Item3598 minor doc fixes |
12750 | TWikibug:Item3510 added a note about the changed template spec in TWiki 4.1.0. Code remains unchanged |
11358 | TWikibug:Item2802 moved SHORTDESCRIPTION to .pm. Coded up TWiki:Main/PankajPant's suggestions as nopost and remove . Added default text for the %COMMENT as requested by TWiki:Main.AndyGlew |
11118 | TWikibug:Item2322 removed span tag around oneliner bullet output |
8788 | TWikibug:Item1465 Item1577: reverted 8433 to fix inclusion of correct user templates |
8787 | TWikibug:Item1573 renamed standard templates topic to avoid naming clash on Windows, where filenames are case-insensitive |
8433 | TWikibug:Item1465 Fix 'TWiki.' to '%TWIKIWEB%.'; also fixed include 'UserComments' to 'UserCommentsTemplate' (at least that is what the doc suggests) |
7427 | TWikibug:Item845 removed duplicate date in default comments; stick with server time |
7251 | TWikibug:Item810 fix for user template inclusion; reorganised templates to make customisation easier |
5906 | TWikibug:Item143 apache warning from comment plugin when CommentsTmpl.txt not found |
5519 | CommentPluginOnAnchorsBroken: incorporated JacobEisinger's fix |
5518 | CommentPluginOnAnchorsBroken: incorporated OlivierBerger's fix |
5455 | On Niels Kodslo's prompting, removed the global recursion prevention that I believe is no longer needed. |
5280 | Removed templates, and some minor fixes |
5250 | Removed newlines from prompt box |
4902 | Changed to use viewauth. Moved templates into user topics. |
4901 | Added templates in user webs support |
4897 | Fixes for disabling during preview; re-enabled old legacy parameters |
4889 | Chopped down from PeterMasiar version, removing several parameters, savecomment script, changing way templates are done. Major rewrite, atcherly. |
4882 | Update from PeterMasiar's 2.0 version, plus documentation and small code improvements. |
4745 | 06 Mar 2002 initial commit |
Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/CommentPlugin |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/CommentPluginDev |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/CommentPluginAppraisal |
top
bottom
above
below
bulletabove
inputsize="20"
:
threadmode
belowthreadmode
tableprepend
Tablepreprend comment output 2 | TWikiContributor | 26 Nov 2006 - 11:03 |
Tablepreprend comment output 1 | TWikiContributor | 26 Nov 2006 - 11:02 |
tableappend
Tableappend comment output 1 | TWikiContributor | 26 Nov 2006 - 10:38 |
Tableappend comment output 2 | TWikiContributor | 26 Nov 2006 - 10:39 |
after
action
table
1 Dec 2007 | TWikiContributor | Athens |
1 Jan 2008 | TWikiContributor | Beijing |
toctalk
bookmark
return
Warning: Can't find topic TWiki.COMMENT_TOPIC
noform
templatetopic
encode="off"
in the URLPARAM variable. The newline=""
parameter of URLPARAM gets encoded with the same encoding as the actual URL parameter. In TWiki 5.0 and later you can specify newline="$br"
to add a <br />
, regardless of the encoding used.
%TMPL:DEF{promptbox}%<div class="commentPlugin commentPluginPromptBox"><table border="0" cellpadding="0" cellspacing="0"><tr valign="middle"><td><textarea %DISABLED% rows="%rows|3%" cols="%cols|70%" name="comment" class="twikiInputField" wrap="soft" onfocus="if(this.value=='%MESSAGE%')this.value=''" onblur="if(this.value=='')this.value='%MESSAGE%'">%MESSAGE%</textarea></td><td> <input %DISABLED% type="submit" value="%button|Add comment%" class="twikiButton" /></td></tr></table></div><!--/commentPlugin-->%TMPL:END%Short comment, signed and dated
%TMPL:DEF{outputoneliner}% * %URLPARAM{"comment"}% -- %WIKIUSERNAME% - %GMTIME{"$day $month $year"}%%TMPL:END%See rendered template Default
%TMPL:DEF{PROMPT:top}%%TMPL:P{promptbox}%%TMPL:END%
%TMPL:DEF{OUTPUT:top}%%TMPL:P{outputoneliner}%%POS:TOP% %TMPL:END%See rendered template top
%TMPL:DEF{PROMPT:bottom}%%TMPL:P{promptbox}%%TMPL:END%
%TMPL:DEF{OUTPUT:bottom}%%POS:BOTTOM%%TMPL:P{outputoneliner}%%TMPL:END%See rendered template bottom
%TMPL:DEF{PROMPT:above}%%TMPL:P{promptbox}%%TMPL:END%
%TMPL:DEF{OUTPUT:above}%%POS:BEFORE%%TMPL:P{OUTPUT:threadmode}%%TMPL:END%See rendered template above
inputsize
, for example:
%COMMENT{type="bulletabove" inputsize="20"}%
%TMPL:DEF{PROMPT:bulletabove}%<input class="twikiInputField" name="bullet_above_item" id="bullet_above_item" type="text" size="%inputsize|40%" value="%URLPARAM{"bullet_above_item"}%" /> <input %DISABLED% type="submit" value="%button|Add item%" class="twikiButton" />%TMPL:END%
%TMPL:DEF{OUTPUT:bulletabove}% * %URLPARAM{"bullet_above_item"}%%POS:BEFORE% %TMPL:END%See rendered template bulletabove
%TMPL:DEF{PROMPT:threadmode}%%TMPL:P{promptbox}%%TMPL:END%
%TMPL:DEF{OUTPUT:threadmode}%%POS:BEFORE% %URLPARAM{"comment"}% -- %WIKIUSERNAME% - %DATE% %TMPL:END%See rendered template threadmode
%TMPL:DEF{PROMPT:belowthreadmode}%%TMPL:P{promptbox}%%TMPL:END%
%TMPL:DEF{OUTPUT:belowthreadmode}%%POS:AFTER% ---++++ %WIKIUSERNAME% - %SERVERTIME% %URLPARAM{"comment"}% %TMPL:END%See rendered template belowthreadmode
%TMPL:DEF{PROMPT:below}%%TMPL:P{promptbox}%%TMPL:END%
%TMPL:DEF{OUTPUT:below}%%POS:AFTER%%TMPL:P{outputoneliner}% %TMPL:END%See rendered template below
%TMPL:DEF{PROMPT:tableprepend}%%TMPL:P{promptbox}%%TMPL:END%
%TMPL:DEF{OUTPUT:tableprepend}%%POS:AFTER%| %URLPARAM{"comment" newline="$br"}% | %WIKIUSERNAME% | %SERVERTIME% | %TMPL:END%See rendered template tableprepend
%TMPL:DEF{PROMPT:tableappend}%%TMPL:P{promptbox}%%TMPL:END%
%TMPL:DEF{OUTPUT:tableappend}%%POS:BEFORE%| %URLPARAM{"comment" newline="$br"}% | %WIKIUSERNAME% | %SERVERTIME% | %TMPL:END%See rendered template tableappend
%TMPL:DEF{PROMPT:after}%%TMPL:P{promptbox}%%TMPL:END%
%TMPL:DEF{OUTPUT:after}%%NOP%%TMPL:P{outputoneliner}% %POS:BEFORE%%TMPL:END%See rendered template after
%TMPL:DEF{PROMPT:action}% %TABLE{databg="#ffffff" tableborder="0" cellborder="0"}% | <label for="action_who">Action for</label>| <input class="twikiInputField" name="action_who" id="action_who" type="text" size="50" value="%URLPARAM{"who"}%" /> | | <label for="action_due">Due date</label>| <input class="twikiInputField" name="action_due" id="action_due" type="text" size="30" value="%URLPARAM{"due"}%" /> | | <label for="action_comment">Comment</label>| <textarea %DISABLED% rows="%rows|3%" cols="%cols|50%" name="action_comment" id="action_comment" class="twikiInputField" wrap="soft" onfocus="if(this.value=='%MESSAGE%')this.value=''" onblur="if(this.value=='')this.value='%MESSAGE%'">%MESSAGE%</textarea> | || <input %DISABLED% type="submit" class="twikiButton" value="Add action" /> | %TMPL:END%
%TMPL:DEF{OUTPUT:action}%%POS:BEFORE%%AC%NOP%TION{who="%URLPARAM{"action_who"}%" due="%URLPARAM{"action_due"}%"}% %URLPARAM{"action_comment" newline="<br />"}%<br />- Created by %WIKIUSERNAME%, %SERVERTIME% %ENDAC%NOP%TION% %TMPL:END%See rendered template action
%TMPL:DEF{PROMPT:table}% %TABLE{databg="#ffffff" tableborder="0" cellborder="0"}% | <label for="comment_date">Date</label>| <input class="twikiInputField" %DISABLED% type="text" size="40" name="comment_date" id="comment_date" /> | | <label for="comment_city">City</label>| <input class="twikiInputField" %DISABLED% type="text" size="40" name="comment_city" id="comment_city" value="" /> | || <input %DISABLED% type="submit" class="twikiButton" value="%button|Add entry%" /> | %TMPL:END%
%TMPL:DEF{OUTPUT:table}%%POS:BEFORE%| %URLPARAM{"comment_date"}% | %WIKIUSERNAME% | %URLPARAM{"comment_city"}% | %TMPL:END%See rendered template table
%TMPL:DEF{PROMPT:toctalk}% %TABLE{databg="#ffffff" tableborder="0" cellborder="0"}% | <label for="comment_summary">Summary</label>| <input class="twikiInputField" %DISABLED% type="text" size="40" name="comment_summary" id="comment_summary" /> | | <label for="toctalk_comment_text">Message</label>| <textarea %DISABLED% rows="%rows|3%" cols="%cols|50%" name="toctalk_comment_text" id="toctalk_comment_text" class="twikiInputField" wrap="soft" onfocus="if(this.value=='%MESSAGE%')this.value=''" onblur="if(this.value=='')this.value='%MESSAGE%'">%MESSAGE%</textarea> | || <input %DISABLED% type="submit" value="%button|Add%" class="twikiButton" /> | %TMPL:END%
%TMPL:DEF{OUTPUT:toctalk}% %POS:BEFORE%---++++ %SERVERTIME% %WIKIUSERNAME%: %URLPARAM{"comment_summary"}% %POS:BEFORE%%URLPARAM{"toctalk_comment_text" }% %POS:BEFORE% %TMPL:END%See rendered template toctalk
%TMPL:DEF{PROMPT:bookmark}% %TABLE{databg="#ffffff" tableborder="0" cellborder="0"}% | <label for="comment_url">Url</label>| <input class="twikiInputField" %DISABLED% type="text" size="40" name="comment_url" id="comment_url" value="http://" /> | | <label for="comment_link">Link label</label>| <input class="twikiInputField" %DISABLED% type="text" size="40" name="comment_link" id="comment_link" /> | | <label for="bookmark_comment_text">Comment</label>| <input class="twikiInputField" %DISABLED% type="text" size="40" name="bookmark_comment_text" id="bookmark_comment_text" value="%MESSAGE%" /> | || <input %DISABLED% type="submit" value="%button|Add bookmark%" class="twikiButton" /> | %TMPL:END%
%TMPL:DEF{OUTPUT:bookmark}%%POS:BEFORE% * [[%URLPARAM{"comment_url" encode="entity"}%][%URLPARAM{"comment_link" encode="entity"}%]] %IF{" '%URLPARAM{"bookmark_comment_text" encode="entity"}%' = '' " then="" else="- "}%%URLPARAM{"bookmark_comment_text" encode="entity"}% %TMPL:END%See rendered template bookmark
target
is set in the PROMPT
. In the form below the redirectto
is set to the current (including) topic. Available with TWiki 4.1.
%TMPL:DEF{returnpromptbox}% <input type="hidden" name="redirectto" value="%BASEWEB%.%BASETOPIC%" /> %TMPL:P{promptbox}% %TMPL:END%
%TMPL:DEF{PROMPT:return}%%TMPL:P{returnpromptbox}%%TMPL:END%
%TMPL:DEF{OUTPUT:return}%%POS:BEFORE%%TMPL:P{OUTPUT:threadmode}%%TMPL:END%See rendered template return
%DBI_QUERY{"db_identifier" ...}% SELECT ... .header head .body %column% %DBI_SUBQUERY{"name"}% .footer footer %DBI_QUERY% %DBI_DO{"db_identifier" ...}% # Some Perl code. %DBI_DO% %DBI_DO{"db_identifier" topic="SomeTopic" script="some_script"}% %DBI_CALL{"subquery"}% %DBI_CODE{...}% # Some Perl Code %DBI_CODE%
SELECT
) and output formatting filters. SQL statement starts just after the leading %DBI_QUERY{...}%
declaration. The filters are defined by .header
, .body
, and .footer
keywords each starting at the beginning of line. Their meaning shall be obvious from their name:
Declaration | Description |
---|---|
.header |
It is prepended to the query output once. |
.body |
It is repeated for each row of data being fetched from the database. |
.footer |
It is appended to the query output. |
Parameter | Description | Default | Required |
---|---|---|---|
"db_identifier" | Database ID as defined in the plugin configuration. See plugin configuration section. | none | required |
subquery="name" | Defines a subquery which does not produce immediate result but could be used from inside another query | none | optional |
unquoted="col1 col2 ..." | List of columns to be left unquoted in the output. Read more in Quoting of Values section. | none | optional |
protected="col1 col2 ..." | List of columns to be protected from processing by TWiki engine. | none | optional |
protected
parameter. Say, one has an arbitrary data in a displayed column which could contain any kind of text strings. What happens if a TWiki variable is found in a string? It gets expanded by TWiki, for sure. Adding this columns to the protected
list prevents the expansion. Precisely saying, the whole purpose of protection is displaying of data as is, without any modification.
%DBI_DO{...}%
is nothing but a Perl CGI script stored withing TWiki. There are three ways to store it:
%DBI_DO{...}%
and ending %DBI_DO%
.
%DBI_CODE{...}%
.
Parameter | Description | Default | Required |
---|---|---|---|
"db_identifier" | Database ID as defined in the plugin configuration. See Plugin Installation section. | none | required |
multivalued="par1 par2 ..." | Defines HTTP parameters expected to contain several values. These could be, for instance, either values from checkboxes or multiselection lists. | none | optional |
subquery="name" | Defines a subquery which does not produce immediate result but could be used from inside another query | none | optional |
topic="SomeTopic" | Topic to read script from. | none | optional |
script="name" | Specific script defined by its name from several stored in a topic. | none | optional |
name="do_name" | Informational parameter which defines in-place stored script name. | none | optional |
%DBI_CALL{...}%
directly calls a subquery.
Parameters:
Parameter | Description | Default | Required |
---|---|---|---|
"subquery" | Subquery to call. | none | required |
%DBI_CALL{"example" uid="12"}% %DBI_QUERY{"db_identifier" subquery="example"}% SELECT name FROM Users WHERE id = %uid% .header .... %DBI_QUERY%Read more in Variable Expansion section.
%DBI_CODE{...}%
is used for keeping several %DBI_DO%
scripts within single topic. A script is kept between starting %DBI_CODE{...}%
and ending %DBI_CODE%
. Output is formatted as a table representing script's name and code.
Parameters:
Parameter | Description | Default | Required |
---|---|---|---|
"script_name" | Name of the script. Must be unique within topic. | none | required |
.header
, .body
, and .footer
gets changed with space except for the last ones. They're removed. Whereas newline is needed \n
escape sequence must be used. Consequently, \\n
is translated into \n
.
.header
filter is expanded with variable expansion mechanizm and put into the output.
.body
filter is expanded using these values.
.footer
filter is expanded with DBIQueryPlugin mechanism and put into the output.
%column%
variable found in a text being expanded with corresponding value from the database. Variable names are in fact table column names as they're declared in the SQL statement and returned by DBI module. NAME_lc
case conversion performed so that every name is in lowercase. For instance, the following SELECT
:
SELECT Name, PersonalID, SomeOtherInfo FROM PersonDatawould provide us with variables
%name%
, %personalid%
, %someotherinfo%
.
There are some special cases like SHOW CREATE PROCEDURE
query where column names may contain spaces within them. These spaces are changed with undersocre sign making it possible to refer to them as to database columns. I.e. 'Create Procedure' may be referred as %create_procedure%
.
The second step is subquery processing. %DBI_SUBQUERY{"subqueryname"}%
statements are replaced with output from corresponding subqueries. All currently defined variables are passed to the subquery making it possible to use them for SQL statement, header and footer expansion.
CGI::escapeHTML()
unless contrary behaviour dictated by unquoted
parameter. Then every newline character is changed with TWiki variable %BR%
.
top_query -> subquery1 -> subquery2 -> ...
, in which case all variables from all the calling queries are accessible.
For instance, in the following code:
%DBI_QUERY{...}% SELECT col1, col2 FROM someTable WHERE col3 = %parent_query_col1% .body ... %DBI_QUERY%we choose only the rows which are somehow related to a row in a parent query. Of course, relatively similar approach would be to use nested
SELECT
in the parent query SQL statement. Yet, this would be faster. But there are old versions of MySQL where nested SELECT
is not supported. And there are situations when some more output formatting is needed. Or one could form header and/or footer using data contained in database.
.body
uses subquery column names. Take care of this! Best of all avoid this situation by using SQL aliasing:
Parent:
SELECT col1 as parent_col1 ....Subquery:
SELECT col1 as subquery_col1 ...
%DBI_DO%
could implement all required functionality. In other words, one could say that %DBI_QUERY%
becomes obsolete. This is obvious from the syntax description. But it also implies that %DBI_DO%
is:
%DBI_QUERY%
hides quite a number of boring implementation details from a user.
So, let's define %DBI_DO%
as a last resort method when nothing else could do the job. The most typical use for it would be database editing.
%DBI_DO%
can fetch a script from another topics which would either represent the whole script or contain %DBI_CODE%
declarations. In both cases the script is visible on the topic's page. For instance, the following declaration:
%DBI_CODE{"test"}% if ($varParams{test}) { $rc = "This is test."; } else { $rc = "This is for real."; } %DBI_CODE%would output table like this:
Script name | test |
Script code | if ($varParams{test}) { $rc = "This is test."; } else { $rc = "This is for real."; } |
%DBI_CODE{"test"}% %CODE{"perl"}% if ($varParams{test}) { $rc = "This is test."; } else { $rc = "This is for real."; } %ENDCODE% %DBI_CODE%
Script name | test |
Script code |
if ($varParams{test}) { $rc = "This is test."; } else { $rc = "This is for real."; }
|
%DBI_DO%
knows about existence of %CODE%/%ENDCODE%
and attempts to strip these tags out just after the script has been fetched from a topic. After that Perl code becomes a part of an anonymous sub
. Several variables are available to the code:
Variable | Description |
---|---|
$dbh |
Database connection handle. |
$cgiQuery |
A CGI object as returned by TWiki::Func::getCgiQuery() . |
$varParams |
Parameters specified in %DBI_DO{...}% . User can put any number of addition parameters there besides those described in syntax section. |
$dbRecord |
Last fetched by %DBI_QUERY% database record or %DBI_CALL% parameters. |
%httpParams |
HTTP parameters as returned by CGI::param() method. Note the multivalued parameter in the syntax section. |
sub
is executed within plugin's module namespace all internal functions and variables are directly accessible. The most useful of them are described below.
There is one special variable $rc
. A value assigned to it is the value returned by sub
and put into the output then. In this way one could display a error message or notification or form any kind of TWiki/HTML code.
$db_identifier
parameter is database ID as specified in the plugin configuration.
%DBI_SUBQUERY%
and %DBI_CALL%
. $subquery
is the name of subquery to be called. $dbRecord
has the same meaning as corresponding sub
parameter.
$text
as described in DBIQueryPlugin Expansion.
$text
value modified in a way that prevents it from TWiki processing.
connection1
and test
, to be inserted into the DatabaseContrib
section of the configure
script.
connection1 => { usermap => { TWikiAdminGroup => { user => 'dbuser1', password => 'dbpassword1', }, SpecialGroup => { user => 'specialdb', password => 'specialpass', }, }, user => 'guest', password => 'guestpass', driver => 'mysql', database => 'some_db', codepage => 'koi8r', host => 'your.server.name', }, test => { usermap => { TWikiAdminGroup => { user => 'dbuser2', password => 'dbpassword2', }, SomeUser => { user => 'someuser', password => 'somepassword', }, }, allow_do => { default => [qw(TWikiAdminGroup)], 'Sandbox.SomeUserSandbox' => [qw(TWikiAdminGroup SpecialGroup)], }, #user => 'nobody', #password => 'never', driver => 'mysql', database => 'test', # host => 'localhost', }
%DBI_DO%
, relying on the allow_do
key of the configuration specification.
In the example above, for database test
, members of the TWikiAdminGroup
may perform queries on any topic; users in SpecialGroup
may execute %DBI_DO%
queries on Sandbox.SomeUserSandbox
.
%DBI_DO%
. The first approach was to make it working much like %DBI_QUERY%
, using sections of declarations. But the more quiestions like:
%DBI_DO%
to a user.
The other issue is about plugin execution order. As one can see from MessageBoard example, attached to this topic, usage of other plugins could significally improve control over DBIQueryPlugin output. However, it is not guaranteed that another plugin would not be called in first place causing unpredictable results like unwanted changes in a Perl script.
Considering this issue the decision was made that DBIQueryPlugin must act as a preprocessor. For those who understand, it does all the job in beforeCommonTagsHandler()
routine. This approach has three major drawbacks:
%CALC{"$SET(var,1)"}% %DBI_QUERY{"..."}% SELECT ... WHERE field = %CALC{"$GET(var)"}% %DBI_QUERY%One will not get what would be expected because at the time
%CALC{"$GET(var)"}%
is executed %CALC{"$SET(var,1)"}%
has not been called yet! The only way to have it be done properly is to put the latter just under %DBI_QUERY{...}%
line.
%INCLUDE{}%
would not work because beforeCommonTagsHandler()
is not called for included topics.
%<plugin>_<setting>%
, i.e. %DBIQUERYPLUGIN_SHORTDESCRIPTION%
data/debug.txt
) DBIQueryPlugin.zip
in your twiki installation directory. Content: File: | Description: |
---|---|
data/TWiki/DBIQueryPlugin.txt | Plugin topic |
lib/TWiki/Plugins/DBIQueryPlugin.pm | Plugin Perl module |
Plugin Author: | TWiki:Main.VadimBelman |
Copyright: | © 2005-2006 TWiki:Main.VadimBelman © 2009 TWiki:Main.ThomasWeigert © 2008-2011 TWiki:TWiki.TWikiContributor |
License: | GPL (GNU General Public License) |
Plugin Version: | 2011-03-13 |
Change History: | |
2011-03-13: | TWikibug:Item6662: Initial import into SVN; doc fixes; change TWIKIWEB to SYSTEMWEB -- TWiki:Main.DipuDeshmukh |
2009-05-20: | Use TWiki:Plugins.DatabaseContrib to provide connection services to the database -- TWiki:Main.ThomasWeigert |
2009-05-18: | Updated to work in TWiki 4.2.4. Corrected the Message Board example -- TWiki:Main.ThomasWeigert |
2006-06-03: | 1.2: Added 'dsn' and 'init' parameters of configuration file. Character set support for PostgreSQL. No default value for 'allow_do' parameter of configuration file. Support for column names with spaces. |
2005-10-17: | 1.1 |
2005-10-13: | Initial version |
CPAN Dependencies: | CPAN:DBI, CPAN:Error |
Other Dependencies: | TWiki:Plugins.DatabaseContrib |
Perl Version: | 5.8 |
TWiki:Plugins/Benchmark: | GoodStyle nn%, FormattedSearch nn%, DBIQueryPlugin nn% |
Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/DBIQueryPlugin |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/DBIQueryPluginDev |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/DBIQueryPluginAppraisal |
db_connect
connects to a SQL database
db_connected
verifies that a connection exists for a database
db_disconnect
disconnects from all databases
db_allowed
tests for additional access permissions
$dbh
refers to the database handle abstraction of DBI.
db_connect ( $dbname ) -> ( $dbh )
$dbname
. The database can then be queried or updated.
db_connected ( $dbname ) -> ( 0|1 )
db_disconnect ( )
db_allowed ( $dbname, $topic )
configure
script. The connection information is inserted in the DatabaseContrib
section.
Example:This example defines a databasemessage_board => { user => 'dbuser', password => 'dbpasswd', driver => 'mysql', database => 'message_board', codepage => 'utf8', allow_do => { default => [qw(TWikiAdminGroup)], 'Sandbox.CommonDiscussion' => [qw(TWikiGuest)], }, host => 'localhost', }
message_board
and the necessary information to access this database. Additional databases can be added, as a comma-separated list of Perl hash refs.
The following parameters can be used to specify a database. The first level key are the database names used in the above functions. Each database has its own set of parameters defined in the hash.
Key | Description | Default | Required |
---|---|---|---|
database |
Database name on the server. | none | required |
user |
Default database account name. | none | optional |
password |
Default database account password. | none | optional |
driver |
DBI driver used to access the server, (such as mysql , sqlite , oracle ).1 |
none | required |
dsn |
Complete dsn string to be used when creating the connection. See your DBD driver documentation. With this key defined both database and driver keys are ignored. |
none | optional |
init |
Initialization command to be sent to the database server just after the connection is initiated. | none | optional |
host |
DB server hostname. | localhost |
optional |
codepage |
Client-side codepage of this connection.2 | none | optional |
usermap |
Hash ref mapping TWiki users or groups to database accounts. See Access control below. | none | optional |
allow_do |
Additional topic-level access control support (see Access control below). | default => [qw(TWikiAdminGroup)] | optional |
usermap
key in the configuration setting (see Database definition above).
usermap
.
usermap
.
user
and password
keys of the database definition.
allow_do
maps individual topics into lists of users or groups with access permission for a query executed from that topic.
The key default
is used, if a matching key cannot be found for the given topic.
In the example above, members of the TWikiAdminGroup
may perform queries onany topic; TWikiGuest
is allowed only for topic Sandbox.CommonDiscussion
.
%<plugin>_<setting>%
, e.g. %DATABASECONTRIB_DEBUG%
DatabaseContrib.zip
in your twiki installation directory. Content: File: | Description: |
---|---|
data/TWiki/DatabaseContrib.txt | Contrib topic |
lib/TWiki/Contrib/DatabaseContrib.pm | Contrib Perl module |
lib/TWiki/Contrib/DatabaseContrib/Config.spec | Configuration specification |
lib/TWiki/Configure/Types/TEXT.pm | Perl module supporting text areas in configure script |
savesection
script (if needed).
Author: | TWiki:Main.ThomasWeigert |
Copyright: | © 2009 TWiki:Main.ThomasWeigert © 2009-2011 TWiki:TWiki.TWikiContributor |
License: | GPL (GNU General Public License) |
Plugin Version: | 2011-05-14 |
Change History: | |
2011-05-14: | TWikibug:Item6701: Small fix in Config.spec and MANIFEST -- TWiki:Main.PeterThoeny |
2011-03-13: | TWikibug:Item6661: Import into SVN; adding build stuff -- TWiki:Main.DipuDeshmukh |
2009-05-20: | Initial version |
CPAN Dependencies: | CPAN:DBI |
Other Dependencies: | Libraries CPAN:DBI depends on |
Perl Version: | 5.005 |
Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/DatabaseContrib |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/DatabaseContribDev |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/DatabaseContribAppraisal |
Trash
web, where it's hidden but can be "undeleted" with system administrator access.
Click [More topic actions]
on the control bar at the bottom of the page you want to change, then choose [Rename/move topic]
, and make your changes to that screen. There's a link that launches to the ManagingTopics reference page in a pop-up window.
NOTE: The configuration of your site and your own access permissions determine whether you can access these functions.
Note for site administrators: To remove a topic permanently move it to the Trash web, then with file-level access, delete the .txt
and .txt,v
files manually from /twiki/data/Trash
.
Back to: TWikiFAQ
Related Topics: UserDocumentationCategoryTrashAttachment
topic in the Trash
web, where it's hidden but can be "undeleted" with system administrator access. Please note that you cannot rename an attachment in the current TWiki release.
Click on [action]
on the file in the FileAttachment table, then in the Update attachment screen choose [Move attachment]
, and make your changes to that screen.
NOTE: The configuration of your site and your own access permissions determine whether you can access these functions.
Note for system administrators: To remove an attachment permanently move it to the Trash.TrashAttachment topic, then with file-level access, delete the file attachment and its ,v
repository file manually from twiki/pub/Trash/TrashAttachment
.
Back to: TWikiFAQ
Related Topics: UserDocumentationCategoryDONTNOTIFYCHECKBOX
preferences variable. See TWikiPreferences for more.
Related Topics: UserDocumentationCategory[Save]
button.
Note that a new revision is created if another person edits the same topic, regardless of the time.
TWiki administrators can modify the time frame with the {ReplaceIfEditedAgainWithin}
configure setting.
Back to: TWikiFAQ
Related Topics: UserDocumentationCategory%EDITTABLE{}%
directly above the table. This can be added to tables that are formatted with TablePlugin: add the EDITTABLE
variable just above or below the TABLE
tag. It can also be used without any TABLE
tag.
Customize entry fields by specifying the format: use a text field, a drop down box, a date field, radio buttons or checkboxes.
Multiple tables per topic are editable, but only one at a time can be edited.
%EDITTABLE{...}%
variable just before an existing table to make it editable, or add the variable anywhere in a topic to start a new table.
Attribute | Comment | Default |
---|---|---|
header | Specify the header format of a new table like "|*Food*|*Drink*|" . Useful to start a table with only a button | (no header) |
format | The format of one column when editing the table. A cell can be a text input field, or any of these edit field types: • Text input field (1 line): | text, <size>, <initial value> | • Textarea input field: | textarea, <rows>x<columns>, <initial value> | • Drop down box: | select, <size>, <option 1>, <option 2>, etc* | * only one item can be selected • Radio buttons: | radio, <size*>, <option 1>, <option 2>, etc | * size indicates the number of buttons per line in edit mode • Checkboxes: | checkbox, <size*>, <option 1>, <option 2>, etc | * size indicates the number of checkboxes per line in edit mode • Fixed label: | label, 0, <label text> | • Row number: | row, <offset> | • Date: | date, <size>, <initial value>, <DHTML date format*> | * see Date Field Type | "text, 16" for all cells |
changerows | Rows can be added and removed if "on" Rows can be added but not removed if "add" Rows cannot be added or removed if "off" | CHANGEROWS plugin setting |
quietsave | Quiet Save button is shown if "on" , hidden if "off" | QUIETSAVE plugin setting |
include | Other topic defining the EDITTABLE parameters. The first %EDITTABLE% in the topic is used. This is useful if you have many topics with the same table format and you want to update the format in one place. | (none) |
helptopic | Topic name containing help text shown below the table when editing a table. The %STARTINCLUDE% and %STOPINCLUDE% variables can be used in the topic to specify what is shown. | (no help text) |
headerislabel | Table header cells are read-only (labels) if "on" ; header cells can be edited if "off" or "0" | "on" |
editbutton | Set edit button text, e.g. "Edit this table" ; set button image with alt text, e.g. "Edit table, %PUBURL%/%SYSTEMWEB%/TWikiDocGraphics/edittopic.gif" ; hide edit button at the end of the table with "hide" (Note: Button is automatically hidden if an edit button is present in a cell) | EDITBUTTON plugin setting |
buttonrow | Set to top to put the edit buttons above the table. | bottom |
javascriptinterface | Use javascript to directly move and delete row without page refresh. Enable with "on" , disable with "off" . | JAVASCRIPTINTERFACE plugin setting |
<initial value>
(of text input field) and <label text>
(of fixed label) get expanded when a new row is added. This can be used for example to add a timestamp to a label. You can escape characters with format tokens if you do not want that.
Any TWiki variable inside a table cell will be preserved. For instance, %TOPIC%
will not get expanded to the current topic name.
The format tokens are the same as with FormattedSearch:
Escape: | Expands To: |
---|---|
$n or $n() |
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar |
$nop or $nop() |
Is a "no operation". |
$quot |
Double quote (" ) |
$percnt |
Percent sign (% ) |
$dollar |
Dollar sign ($ ) |
date
field type allows one to choose a date with a popup calendar. Popup calendar works with all modern browsers. The date picker button is inactive if the browser cannot support the popup calendar or if Javascript is disabled.
The date format can be defined; the default is taken from the {JSCalendarContrib}{format}
configure setting. Date specifiers are described in JSCalendarContrib. Example format for ISO date: format="| date, 10, , %Y-%m-%d |"
.
%EDITCELL{ "type, ..." }%
variable at the end of the cell content. This is useful to override the per column %EDITTABLE{ format="..." }%
settings, or to create tables with key/value rows. All edit field types of the format="..."
parameter are supported. For example, to define a text field, type: | cell content %EDITCELL{ "text, 20" }% |
It is also possible to place the edit button inside a cell instead of default location below the table. Type | %EDITCELL{ "editbutton, 1, Edit this table" }% |
to show a button, or | %EDITCELL{ "editbutton, 1, Edit table, Image-URL" }% |
to show a button image with alternate text.
Note: The %EDITCELL{ }%=variable cannot be used by itself; place an =%EDITTABLE{ }%=variable at the beginning of a table where you want to use =%EDITCELL{ }%
variables.
%EDITTABLE{ format="| row, -1 | text, 20, init | select, 1, one, two, three, four | radio, 3,:-),:-I,:-( | label, 0, %SERVERTIME{"$day $mon $year $hour:$min"}% |" changerows="on" }%
Nr | Text field | Drop down | Mood | Timestamp |
---|---|---|---|---|
1 | 26 Jun 2002 12:30 | |||
2 | 27 Jun 2002 12:40 |
You type: | You get: | Table in edit mode: |
---|---|---|
%TABLE{"headerrows="1"}% %EDITTABLE{ format="| label | text, 40 |" changerows="off" }% |*Key*|*Value*| | Name: | John Smith | | Gender: | M %EDITCELL{select, 1, , F, M}% | | DOB: | 1999/12/31 %EDITCELL{date, 10}% | | City: | New York | |
%<plugin>_<setting>%
, for example, %EDITTABLEPLUGIN_SHORTDESCRIPTION%
data/debug.txt
. Default: 0
javascriptinterface
. on
, off
, add
on
to show the Quiet Save button, off
to hide button text
, or specify alternate text, image URL
. Note: Texts inside %MAKETEXT{}%
are translated into other languages. | ... ||
) and cell justification (e.g. | centered | right |
)
%EDITTABLE{}%
statements on the same line in the source
select,1,%<nop>X%,%<nop>Y%
EditTablePlugin.zip
in your ($TWIKI_ROOT) directory.
viewauth
script to authenticate the user. As described in TWikiAccessControl, copy the view
script to viewauth
(or better, create a symbolic link) and add viewauth
to the list of authenticated scripts in the .htaccess
file.
configure
in your TWiki installation, and enable the plugin in the {Plugins} section.
Plugin Author: | Arthur Clemens, TWiki:Main.PeterThoeny |
Copyright: | © 2008 Arthur Clemens; © 2002-2011 TWiki:Main.PeterThoeny, Twiki, Inc.; © 2002-2011 TWiki:TWiki.TWikiContributor |
License: | GPL (GNU General Public License) |
Plugin Version: | 2011-07-07 |
Change History: | |
2011-07-07: | TWikibug:Item6725: Change global package variables from "use vars" to "our" |
2010-05-25: | 5.1: TWikibug:Item6324 - Fix for editing a table removing EDITCELL from another table - patch by TWiki:Main/NickThorpe |
2010-05-16: | 5.0: TWikibug:Item6433 - doc improvements; replacing TWIKIWEB with SYSTEMWEB |
17 Apr 2009: | 4.9.1: Save of table can only be done with http POST method, not GET |
01 Nov 2008: | 4.9: Arthur Clemens: Fixed rendering of verbatim blocks when editing. Added parameter buttonrow="top" to allow the buttons to be positioned at the top of the table. |
26 Sep 2008: | 4.8.7: Arthur Clemens: Let empty table initialize more than one column from header parameter |
24 Sep 2008: | 4.8.6: Arthur Clemens: Fix parsing of header labels |
21 Sep 2008: | 4.8.5: Arthur Clemens: Fix rendering of TML inside label |
03 Aug 2008: | 4.8.4: TWiki 4.2.1 release version |
19 Jul 2008: | 4.8.3: Bugfix release |
20 Mar 2008: | 4.8: Arthur Clemens: Code refactoring; disabled table sort when editing; removed usage of $percnt to prevent variable expansion (is now done automatically); made Javascript interface aware of headers and footers, and of changerows="off" ; improved feedback on row move. |
25 Dec 2007: | 4.7.1: Arthur Clemens: Added warning if include parameter topic does not exist. |
22 Dec 2007: | 4.7: Arthur Clemens: Changed handling of escaped variables. To escape TWiki variable, use formatting tokens such as $percnt . |
16 Dec 2007: | 4.6: Kenneth Lavrsen: The plugin prevents TablePlugin from initsorting the table being edited. This is done by temporarily appending the attribute disableallsort="on" to the TABLE tag of a table being edited. Additionally all header sorting is disabled while editing a table by setting a hidden formfield sort to "off". Disabling sorting while editing is needed now that the EditTablePlugin supports moving rows up and down. |
01 Dec 2007: | 4.3: Arthur Clemens: added support for TablePlugin headerrows and footerrows ; updated edit button |
16 Oct 2007: | 4.2: Arthur Clemens: refactoring, bug fixes. |
07 Oct 2007: | 15182: PTh: Added VarEDITTABLE to have it listed in TWikiVariables |
15 Mar 2007: | Arthur Clemens: Fixed eating of double newlines; icons for Javascript buttons and interface improvements. By default the Javascript interface is turned off, set JAVASCRIPTINTERFACE to use it in edit mode. |
05 Mar 2007: | Byron Darrah: Added ability to dynamically move and delete rows. |
12 Oct 2006: | Item2982 Use default date format from JSCalendarContrib |
02 Oct 2006: | Item2884 Check also for access permission in meta data; proper fix to not warn if oneself has a lock on topic |
30 Aug 2006: | Item2829 Remove whitespace from select, radio and checkbox items; restored topic lock if $TWiki::Plugins::VERSION < 1.1 |
29 Jul 2006: | Item2684 - Quietly ignore topic edit locks on table edit |
21 Jan 2006: | TWiki:Main.CrawfordCurrie ported to TWiki-4.0.0, changed to use JSCalendarContrib |
16 Sep 2004: | Added radio buttons and checkbox controls; escaped "|" pipe symbol found in input fields to preserve tables |
01 Aug 2004: | Fixed bug where edittable did not work if at the end of a topic |
07 Apr 2004: | Fixed bug where two tables got updated when you edit and save a table included into a topic containing other edit tables |
02 Mar 2004: | Default for %EDITCELL{editbutton}% is EDITBUTTON preference |
27 Feb 2004: | Added QUIETSAVE setting and quietsave parameter; image for Edit button |
18 Feb 2004: | Doc fixes; allow edit button anywhere in a cell not just at the end of a cell |
17 Feb 2004: | Added per cell definition of edit field types with %EDITCELL{}% variable; added headerislabel and editbutton parameters |
20 Dec 2003: | Fixed bug where calendar did not work after adding a row (TWiki:Main/PaulineCheung); added all language files of Mishoo DHTML calendar 0.9.5 |
13 Dec 2003: | Added CHANGEROWS, JSCALENDARDATEFORMAT, JSCALENDARLANGUAGE, JSCALENDAROPTIONS settings |
16 Oct 2003: | small typo fixed (garbled if ---+ header on top) |
15 Oct 2003: | new date field type with Javascript calendar - CN |
14 Oct 2003: | docfix: the documentation page was an old one - CN |
13 Oct 2003: | bugfix: %-vars in select were resetted to first on add/del row - CN |
18 Sep 2003: | incompatibility: changed default of changerows to on ; support for %-vars, Quiet save for saving without notification; all other fixes in Dev topic integrated - CN |
08 Nov 2002: | Prevent variable expansion in label text; added escape characters |
27 Jun 2002: | New helptopic parameter |
26 Jun 2002: | Support for variables in included EDITTABLE parameters; fixed problem with HTML in cells |
21 May 2002: | Added fixed label format; new changerows="add" parameter |
27 Apr 2002: | Fixed bug where text after a double quote in a cell disappeared |
18 Apr 2002: | Fixed bug where table was breaking when pasting multiple lines into an edit field using Netscape on Unix |
08 Apr 2002: | Check for change permission and edit lock of topic |
05 Apr 2002: | Initial version |
Dependencies: | None |
Perl Version: | 5.0 |
TWiki:Plugins/Benchmark: | GoodStyle 98%, FormattedSearch 98%, EditTablePlugin 95% |
Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/EditTablePlugin |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/EditTablePluginDev |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/EditTablePluginAppraisal |
lib/TWiki/Plugins/EmptyPlugin.pm
to <name>Plugin.pm
and customize the plugin. Add your own code; remove all handlers you do not plan to use.
<name>Plugin
documentation topic in the TWiki web. Do so by visiting http://twiki.org/cgi-bin/view/Plugins/PluginPackageHowTo and starting a new topic to get the default plugin topic text (don't save the topic on twiki.org yet). Customize your plugin topic to your needs.
%EXAMPLEVAR{"..."}%
Parameter | Explanation | Default |
---|---|---|
"..." |
Default parameter. | (none) |
format="..." |
Format: ... | "$name" |
%EXAMPLEVAR{}%
expands to: %EXAMPLEVAR{}%
EmptyPlugin.zip
in your twiki installation directory. Content: File: | Description: |
---|---|
data/TWiki/EmptyPlugin.txt | Plugin topic |
data/TWiki/VarEXAMPLEVAR.txt | Variable documentation topic |
lib/TWiki/Plugins/EmptyPlugin.pm | Plugin Perl module |
lib/TWiki/Plugins/EmptyPlugin/Config.spec | Plugin Config spec |
Plugin Author: | TWiki:Main.AndreaSterbini, TWiki:Main.PeterThoeny, TWiki:Main.CrawfordCurrie |
Copyright: | © 2001-2011, TWiki:TWiki.TWikiContributor |
License: | GPL (GNU General Public License) |
Plugin Version: | 21319 (2012-01-14) |
Change History: | |
2011-05-22: | TWikibug:Item6724: Pass text and meta data to registerTagHandler callback -- TWiki:Main.PeterThoeny |
2011-05-17: | TWikibug:Item6725: Change global package variables from "use vars" to "ours"; doc improvements -- TWiki:Main.PeterThoeny |
2011-03-06: | TWikibug:Item6656: Add meta data to attachment save handlers |
2011-02-08: | TWikibug:Item6593: Doc improvements; adding VarEXAMPLEVAR variable documentation |
2010-05-08: | TWikibug:Item6433: Doc improvements; replacing TWIKIWEB with SYSTEMWEB |
2007-05-20: | Added renderWikiWordHandler |
2006-02-01: | Dakar changes |
2004-03-21: | Added afterSaveHandler |
2001-07-14: | Changed to plug&play |
2001-02-27: | Initial version |
TWiki Dependency: | $TWiki::Plugins::VERSION 1.4 |
Dependencies: | %$DEPENDENCIES |
TWiki:Plugins/Benchmark: | GoodStyle 99%, FormattedSearch 99%, EmptyPlugin 99% |
Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/EmptyPlugin |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/EmptyPluginDev |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/EmptyPluginAppraisal |
Attach
link at the bottom of the page. The Attach
screen lets you browse for a file, add a comment, and upload it. The uploaded file will show up in the File Attachment table. *.php
files are renamed to *.php.txt
so that no one can place code that would be read in a .php file.
%ATTACHFILESIZELIMIT%
variable of the TWikiPreferences, currently set at 150000 KB. Manage
on the Attachment to be moved.
Move
. The attachment and its version history are moved. The original location is stored as topic Meta Data.
Trash
, topic TrashAttachment
.
Attach
file: Sample.txt
Edit
topic and enter: %ATTACHURL%/Sample.txt
Preview
: %ATTACHURL%/Sample.txt
text appears as: /internal/TWiki/FileAttachment/Sample.txt, a link to the text file.
%PUBURLPATH%/%WEB%/OtherTopic/Sample.txt
(if it's within the same web)
%PUBURLPATH%/Otherweb/OtherTopic/Sample.txt
(if it's in a different web)
Attach
file: Sample.txt
Edit
topic and write text: %INCLUDE{"%ATTACHURL%/Sample.txt"}%
Attach
file: Smile.gif
Edit
topic and write text: %ATTACHURL%/Smile.gif
Preview
: text appears as /internal/TWiki/FileAttachment/Smile.gif, an image.
I | Attachment | Action | Size | Date | Who | Comment |
---|---|---|---|---|---|---|
txt | Sample.txt | manage | 0.1 K | 22 Jul 2000 - 19:37 | TWikiContributor | Just a sample |
gif | Smile.gif | manage | 0.1 K | 22 Jul 2000 - 19:38 | TWikiContributor | Smiley face |
Manage
link takes you to a new page that looks a bit like this (depending on what skin is selected):
Sample.txt
(UploadingUser)h
means the attachment is hidden, it isn't listed when viewing a topic.
Hide file
checkbox, then click Change properties
.
{ReplaceIfEditedAgainWithin}
), TWiki will fold together your changes. This is often the "right thing to do", as it can reduce the visual clutter of the topic history.
The "Force new revision" checkbox is a way to force it to create a separate revision each time you save.
The TWiki.TWikiPreferences variable FORCENEWREVISIONCHECKBOX
controls whether this is checked by default or not.
On a related note, you can force every save to be a new revision number by setting {ReplaceIfEditedAgainWithin}
to 0
.
Related Topics: UserDocumentationCategory, AdminDocumentationCategory $n or $n() |
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar |
$nop or $nop() |
Is a "no operation". This variable gets removed; useful for nested search |
$quot or \" |
Double quote (" ) |
$percnt |
Percent sign (% ) |
$dollar |
Dollar sign ($ ) |
$lt |
Less than sign (< ) |
$gt |
Greater than sign (> ) |
$dollar
to escape the leading dollar, thus: $dollarpercnt
.
Related topics: FormattedSearch, IfStatements, QuerySearch, TWikiForms%SEARCH{...}%
is a table consisting of topic names and topic summaries. Use the format="..."
parameter to customize the search result. The format parameter typically defines a bullet or a table row containing variables, such as %SEARCH{ "food" format="| $topic | $summary |" }%
. See %SEARCH{...}%
for other search parameters, such as separator=""
.
header="..."
parameter header="| *Topic:* | *Summary:* |"
Variables that can be used in the header string:
Name: | Expands To: |
---|---|
$web |
Name of the web |
$n or $n() |
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar |
$nop or $nop() |
Is a "no operation". This variable gets removed; useful for nested search |
$quot or \" |
Double quote (" ) |
$percnt |
Percent sign (% ) |
$dollar |
Dollar sign ($ ) |
$lt |
Less than sign (< ) |
$gt |
Greater than sign (> ) |
format="..."
parameter format="| $topic | $summary |"
Variables that can be used in the format string:
Name: | Expands To: |
---|---|
$web |
Name of the web |
$topic |
Topic name |
$topic(20) |
Topic name, "- " hyphenated each 20 characters |
$topic(30, -<br />) |
Topic name, hyphenated each 30 characters with separator "-<br />" |
$topic(40, ...) |
Topic name, shortened to 40 characters with "..." indication |
$parent |
Name of parent topic; empty if not set |
$parent(20) |
Name of parent topic, same hyphenation/shortening like $topic() |
$text |
Formatted topic text. In case of a multiple="on" search, it is the line found for each search hit. |
$locked |
LOCKED flag (if any) |
$date |
Time stamp of last topic update, e.g. 31 Oct 2024 - 22:56 |
$isodate |
Time stamp of last topic update, e.g. 2024-10-31T22:56Z |
$rev |
Number of last topic revision, e.g. 4 |
$username |
Login name of last topic update, e.g. jsmith |
$wikiname |
Wiki user name of last topic update, e.g. JohnSmith |
$wikiusername |
Wiki user name of last topic update, like Main.JohnSmith |
$createdate |
Time stamp of topic revision 1 |
$createusername |
Login name of topic revision 1, e.g. jsmith |
$createwikiname |
Wiki user name of topic revision 1, e.g. JohnSmith |
$createwikiusername |
Wiki user name of topic revision 1, e.g. Main.JohnSmith |
$summary |
Topic summary, just the plain text, all formatting and line breaks removed; up to 162 characters |
$summary(50) |
Topic summary, up to 50 characters shown |
$summary(showvarnames) |
Topic summary, with %ALLTWIKI{...}% variables shown as ALLTWIKI{...} |
$summary(noheader) |
Topic summary, with leading ---+ headers removedNote: The tokens can be combined, for example $summary(100, showvarnames, noheader) |
$changes |
Summary of changes between latest rev and previous rev |
$changes(n) |
Summary of changes between latest rev and rev n |
$formname |
The name of the form attached to the topic; empty if none |
$formfield(name) |
The field value of a form field; for example, $formfield(TopicClassification) would get expanded to PublicFAQ . This applies only to topics that have a TWikiForm |
$formfield(name, 10) |
Form field value, "- " hyphenated each 10 characters |
$formfield(name, 20, -<br />) |
Form field value, hyphenated each 20 characters with separator "-<br />" |
$formfield(name, 30, ...) |
Form field value, shortened to 30 characters with "..." indication |
$query(query-syntax) |
Access topic meta data using SQL-like QuerySearch syntax. Example: • $query(attachments.arraysize) returns the number of files attached to the current topic • $query(attachments[name~'*.gif'].size) returns an array with size of all .gif attachments, such as 848, 1425, 923 • $query(parent.name) is equivalent to $parent |
$pattern(reg-exp) |
A regular expression pattern to extract some text from a topic (does not search meta data; use $formfield instead). In case of a multiple="on" search, the pattern is applied to the line found in each search hit.• Specify a RegularExpression that covers the whole text (topic or line), which typically starts with .* , and must end in .* • Put text you want to keep in parenthesis, like $pattern(.*?(from here.*?to here).*) • Example: $pattern(.*?\*.*?Email\:\s*([^\n\r]+).*) extracts the e-mail address from a bullet of format * Email: ... • This example has non-greedy .*? patterns to scan for the first occurance of the Email bullet; use greedy .* patterns to scan for the last occurance • Limitation: Do not use .*) inside the pattern, e.g. $pattern(.*foo(.*)bar.*) does not work, but $pattern(.*foo(.*?)bar.*) does • Note: Make sure that the integrity of a web page is not compromised; for example, if you include an HTML table make sure to include everything including the table end tag |
$count(reg-exp) |
Count of number of times a regular expression pattern appears in the text of a topic (does not search meta data). Follows guidelines for use and limitations outlined above under $pattern(reg-exp) . Example: $count(.*?(---[+][+][+][+]) .*) counts the number of <H4> headers in a page. |
$ntopics |
Number of topics found in current web. This is the current topic count, not the total number of topics |
$nhits |
Number of hits if multiple="on" . Cumulative across all topics in current web. Identical to $ntopics unless multiple="on" |
$n or $n() |
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar |
$nop or $nop() |
Is a "no operation". This variable gets removed; useful for nested search |
$quot or \" |
Double quote (" ) |
$percnt |
Percent sign (% ) |
$dollar |
Dollar sign ($ ) |
$lt |
Less than sign (< ) |
$gt |
Greater than sign (> ) |
footer="..."
parameter footer="| *Topic* | *Summary* |"
Variables that can be used in the footer string:
Name: | Expands To: |
---|---|
$web |
Name of the web |
$ntopics |
Number of topics found in current web |
$nhits |
Number of hits if multiple="on" . Cumulative across all topics in current web. Identical to $ntopics unless multiple="on" |
$n or $n() |
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar |
$nop or $nop() |
Is a "no operation". This variable gets removed; useful for nested search |
$quot or \" |
Double quote (" ) |
$percnt |
Percent sign (% ) |
$dollar |
Dollar sign ($ ) |
$lt |
Less than sign (< ) |
$gt |
Greater than sign (> ) |
%SEARCH{}%
are evaluated once before the search. This is OK for variables that do not change, such as %SCRIPTURLPATH%
. Variables that should be evaluated once per search hit must be escaped. For example, to escape a conditional:
%IF{ "..." then="..." else="..." }%
format="$percntIF{ \"...\" then=\"...\" else=\"...\" }$percnt"
%SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header=" * *Topic: Summary:*" format=" * [[$topic]]: $summary" footer=" * *Topic: Summary*" }%
To get this:
TopicClassification
field, an OperatingSystem
field and an OsVersion
field we could write:
| *Topic:* | *OperatingSystem:* | *OsVersion:* |
%SEARCH{ "[T]opicClassification.*?value=\"[P]ublicFAQ\"" scope="text" type="regex" nosearch="on" nototal="on" format="| [[$topic]] | $formfield(OperatingSystem) | $formfield(OsVersion) |" }%
To get this:
Topic: | OperatingSystem | OsVersion |
---|---|---|
IncorrectDllVersionW32PTH10DLL | OsWin | 95/98 |
WinDoze95Crash | OsWin | 95 |
%SEARCH{ "__Back to\:__ TWikiFAQ" scope="text" type="regex" nosearch="on" nototal="on" header="TWiki FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [[$topic][Answer...]]" }%
To get this:
TWiki FAQs: %SEARCH{ "culture" format=" * $topic is referenced by: (list all references)" nosearch="on" nototal="on" }%
%SEARCH{ "(topic found in first search)" format="$topic" nosearch="on" nototal="on" separator=", " }%
$percnt
to escape the leading percent of the second search
\"
to escape the double quotes
$dollar
to escape the $
of $topic
$nop
to escape the }%
sequence
%SEARCH{ "culture" format=" * $topic is referenced by:$n * $percntSEARCH{ \"$topic\" format=\"$dollartopic\" nosearch=\"on\" nototal=\"on\" separator=\", \" }$nop%" nosearch="on" nototal="on" }%
To get this:
$dollarpercntSEARCH{
for level three, $dollardollarpercntSEARCH{
for level four, etc.
%SEARCH{ "\.*" scope="topic" type="regex" nosearch="on" nototal="on" order="modified" reverse="on" format="| [[$topic]] | $wikiusername | $date |" limit="7" }%
To get this:
TWikiRegistration | GiuliaIafrate | 2024-04-08 - 07:41 |
RedirectPlugin | TWikiAdminUser | 2023-01-19 - 10:06 |
VarREDIRECT | TWikiAdminUser | 2023-01-19 - 10:06 |
BackupRestoreConsole | TWikiAdminUser | 2022-12-02 - 09:41 |
BackupRestorePlugin | TWikiAdminUser | 2022-12-02 - 09:41 |
TinyMCEPlugin | TWikiAdminUser | 2022-12-02 - 09:10 |
TinyMCEQuickHelp | TWikiAdminUser | 2022-12-02 - 09:10 |
%CALC{$SET(weekold, $TIMEADD($TIME(), -7, day))}%
%SEARCH{ "." scope="topic" type="regex" nosearch="on" nototal="on" order="modified" reverse="on" format="$percntCALC{$IF($TIME($date) < $GET(weekold), <nop>, | [[$topic]] | $wikiusername | $date | $rev |)}$percnt" limit="100" }%
weekold
variable to the serialized date of exactly one week ago
$percnt
makes sure that the CALC gets executed once for each search hit
weekold
date
<nop>
is returned, which gets removed at the end of the TWiki rendering process
%URLPARAM{"..."}%
variable. Example:
Write this:
<form action="%SCRIPTURLPATH{"view"}%/TWiki/FormattedSearch"> Find Topics: <input type="text" name="q" size="32" value="%URLPARAM{"q" encode="entity"}%" /> <input type="submit" class="twikiSubmit" value="Search" /> </form> Result: %SEARCH{ search="%URLPARAM{"q" encode="quote"}%" type="keyword" format=" * $web.$topic: %BR% $summary" nosearch="on" }%To get this: Result: Related Topics: UserDocumentationCategory, SearchHelp, VarSEARCH, SearchPatternCookbook, RegularExpression, QuerySearch -- Contributors: TWiki:Main.PeterThoeny, TWiki:Main.CrawfordCurrie, TWiki:Main.SopanShewale
-- Main.TWikiGuest - 31 Oct 2024
-- [[Main.TWikiGuest][ZXQ]] - 31 Oct 2024
Contributors:
at the end of the page
http://etcete.ra/...
- it'll be clear to anyone where they're headed on click.
2024-09-01
(ISO 8601 date format) or 01 Sep 2024
(RFC 5322 date format) is preferred. It's clearer than the xx/xx/xx
format, where a date like 9/1/01 can mean either January or September, depending on the local conventions of the readers. For months, use the first three letters: Jan, Feb, Mar, Apr,...
[Edit]
on the lower toolbar. To see earlier versions, click [More topic actions]
, then check "Raw text format"
and click [View revision]
. A bit of HTML experience can't hurt, but you'll soon see with TWikiShorthand how far that is from necessary.
%HEADLINES{"..."}%
Parameter | Explanation | Default |
---|---|---|
"..." |
Source of RSS or ATOM feed; this can be an url (starting with http) or a web.topic location for internal feeds | None; is required |
href="..." |
(Alternative to above) | N/A |
refresh="60" |
Refresh rate in minutes for caching feed; "0" for no caching |
Global REFRESH setting |
limit="12" |
Maximum number of items shown | Global LIMIT setting |
header="..." |
Header. May include these variables: - $channeltitle , $title : title of channel (channel.title) - $channellink , $link : link of channel (channel.link) - $channeldescription , $description : description (channel.description) - $channeldate , $date : publication date of the channel (channel.pubDate) - $rights : copyrights of the channel (channel.copyright) - $imagetitle : title text for site (image.title) - $imagelink : link for site (image.link) - $imageurl : URL of image (image.url) - $imagedescription : description of image (image.description) |
Global HEADER setting |
format="..." |
Format of one item. May include these variables: - $title : news item title (item.title) - $link : news item link (item.link) - $description : news item description (item.description) - $date : the publication date (item.pubDate, item.date) - $category : the article category (item.category) |
Global FORMAT setting |
touch="..." |
Touch (edit/save) topics if the feed has updates. Specify a comma-space delimited list of TopicNames or Web.TopicNames, such as "%TOPIC%, NewsLetter" . Useful to send out newsletter using MailerContrib, showing new feeds since last newsletter. To update feeds, visit topics with feeds in regular intervals (using cron with wget or the like). |
N/A |
header
and format
parameters might also use variables rendering the dc
, image
and content
namespace information. Note, that only bits of interest have been implemented so far and those namespaces might not be implemented fully yet.
dc
namespace dc
namespace info, that could be used in header
and format
. Note that some of the variables are already used above. This is done by purpose to use different feeds with the same formatting parameters. If there's a conflict the non-dc tags have higher precedence, i.e. a <title> content </title>
is preferred over <dc:title> content </dc:title>
. $title
: channel/article title (dc:title)
$creator
: channel creator (dc:creator)
$subject
: subject text; this will also add an image according to the subject hash list, see above (dc:subject)
$description
: ... (dc:description)
$publisher
: the channel/article publisher (dc:publisher)
$contributor
: ... (dc:contributor)
$date
: ... (dc:date)
$type
: ... (dc:type)
$format
: ... (dc:format)
$identifier
: ... (dc:identifier)
$source
: ... (dc:source)
$language
: ... (dc:language)
$relation
: ... (dc:relation)
$coverage
: ... (dc: coverage)
$rights
: ... (dc: rights)
image
namespace image:item
is converted into an <img> tag using the following mappings: src
: image url (rdf:about attribute of the image.item tag)
alt
: image title (title)
width
: image width (image:width)
height
: image height image:height)
content
namespace $content
is referring to the <content:encoding> content </content:encoding>
.
%HEADLINES{ "http://slashdot.org/slashdot.rdf" header="*[[$link][$title]]:* $description" format="$t* [[$link][$title]]" limit="4" }%to get the latest Slashdot news as a bullet list format:
%HEADLINES{ "http://www.business-opportunities.biz/feed" limit="2" }%to get the latest postings on the "Business Opportunities" weblog:
HEADLINESPLUGIN_USERAGENTNAME
setting, add a * Set HEADLINESPLUGIN_USERAGENTNAME = ...
bullet in Main.TWikiPreferences.
0
to disable caching: 1
, or fallback to TWiki's internal getUrl()
method if set to 0
: * Set HEADLINESPLUGIN_HEADER = <div class="headlinesChannel"><div class="headlinesLogo"><img src="$imageurl" alt="$imagetitle" border="0" />%BR%</div><div class="headlinesTitle">$n---+!! <a href="$link">$title</a></div><div class="headlinesDate">$date</div><div class="headlinesDescription">$description</div><div class="headlinesRight">$rights</div></div>
* Set HEADLINESPLUGIN_FORMAT = <div class="headlinesArticle"><div class="headlinesTitle"><a href="$link">$title</a></div>$n<span class="headlinesDate">$date</span> <span class="headlinesCreator"> $creator</span> <span class="headlinesSubject"> $subject </span>$n<div class="headlinesText"> $description</div></div>
$TWiki::cfg{PROXY}{HOST}
- proxy host, such as "proxy.example.com";
$TWiki::cfg{PROXY}{PORT}
- proxy port, such as "8080";
$TWiki::cfg{PROXY}{SkipProxyForDomains}
- domains excluded from proxy, such as "intra.example.com, bugs.example.com";
headlinesRss
: output of the HeadlinesPlugin (div) headlinesChannel
: channel header (div) headlinesLogo
: channel logo (div)
headlinesTitle
: channel title (div)
headlinesDate
: channel date (div)
headlinesDescription
: channel description (div)
headlinesRight
: channel copyright (div)
headlinesArticle
: one news item (div) headlinesTitle
: article title (div)
headlinesDate
: article date (span)
headlinesCreator
: author of article (span)
headlinesSubject
: subect category of the article (span)
headlinesText
: article text (div)
HeadlinesPlugin.zip
in your twiki installation directory. Content: File: | Description: |
---|---|
data/TWiki/HeadlinesPlugin.txt | Plugin topic |
pub/TWiki/HeadlinesPlugin/style.css | Default CSS |
lib/TWiki/Plugins/HeadlinesPlugin.pm | Plugin Perl module |
lib/TWiki/HeadlinesPlugin/Core.pm | Plugin core |
Name | Version | Description |
---|---|---|
Digest::MD5 | >=2.33 | Required. Download from CPAN:Digest::MD5 |
LWP::UserAgent | >=5.803 | Optional. Download from CPAN:LWP::UserAgent |
Plugin Author: | TWiki:Main.PeterThoeny, TWiki:Main.MichaelDaum |
Copyright: | © 2002-2011 Peter Thoeny, Twiki, Inc. © 2005-2007 Michael Daum http://wikiring.de |
License: | GPL (GNU General Public License) |
Plugin Version: | 2011-07-17 |
Change History: | |
2011-07-17: | TWikibug:Item6764: Add VarHEADLINES variable documentation; doc improvements; setting NO_PREFS_IN_TOPIC |
2011-07-08: | TWikibug:Item6725: Change global package variables from "use vars" to "our" |
2010-05-16: | TWikibug:Item6433: More doc improvements |
2010-04-25: | TWikibug:Item6433: Doc fix: Changing TWIKIWEB to SYSTEMWEB |
2010-02-27: | TWikibug:Item6313: Fixed bug in ATOM feed with <link ...></link> instead of <link ... /> -- Peter Thoeny |
2009-09-30: | fixed bug in lastBuildDate of feeds affecting touch parameter functionality -- Peter Thoeny |
2009-08-29: | added touch parameter -- Peter Thoeny |
12 Feb 2009: | {PROXY}{HOST} supports domain with and without protocol -- Peter Thoeny |
06 Feb 2009: | added {PROXY}{SkipProxyForDomains} configure setting, added USERAGENTNAME plugin setting -- Peter Thoeny |
11 Dec 2008: | added {PROXY}{HOST} and {PROXY}{PORT} configure settings -- Peter Thoeny |
13 Sep 2007: | fixed parsing of content:encoded |
23 Jul 2006: | improved atom parser; if a posting has no title default to 'Untitled' |
26 Apr 2006: | added lazy compilation |
10 Feb 2006: | packaged using the TWiki:Plugins/BuildContrib; minor fixes |
03 Feb 2006: | off-by-one: limit="n" returned n+1 articles; make FORMAT and HEADER format strings more robust |
23 Jan 2006: | released v2.00 |
05 Dec 2005: | internal feed urls must be absolute |
02 Dec 2005: | added web.topic shorthand for internal feeds |
29 Nov 2005: | fixed CDATA handling |
21 Nov 2005: | added ATOM support; extended RSS support; added dublin core support; added content support; optionally using LWP to fetch feeds to follow redirections; corrected CPAN dependencies ; recoding special chars from html integer to entity encoding to increase browser compatibility; added css support; use getWorkArea() if available |
11 May 2005: | TWiki:Main.WillNorris: added DevelopBranch compatability |
31 Oct 2004: | Fixed taint issue by TWiki:Main.AdrianWeiler; small performance improvement |
29 Oct 2004: | Fixed issue of external caching if mod_perl or SpeedyCGI is used |
02 Aug 2002: | Implemented caching of feeds, thanks to TWiki:Main/RobDuarte |
11 Jun 2002: | Initial version (V1.000) |
Perl Version: | 5.8 |
TWiki:Plugins/Benchmark: | GoodStyle 100%, FormattedSearch 99.5%, HeadlinesPlugin 94% |
Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/HeadlinesPlugin |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/HeadlinesPluginDev |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/HeadlinesPluginAppraisal |
[action]
link,
"Hide file"
checkbox,
[Change properties]
all
children
generates: When included in WebLeftBar (using default Pattern skin) this is styled to:%INCLUDE{"%SYSTEMWEB%.HierarchicalNavigation" section="all"}%
generates: Child topics: When included in WebLeftBar (using default Pattern skin) this is styled to:*Child topics:* %INCLUDE{"%SYSTEMWEB%.HierarchicalNavigation" section="children"}%
%IF%
construct gives TWiki the power to include content in topics based on the value of simple expressions.
%IF{"CONDITION" then="THEN" else="ELSE"}%
In the example above, if CONDITION evaluates to TRUE, then THEN will be included in the topic; otherwise ELSE will be included.
Note that because of the way TWiki evaluates, then whatever is in the THEN and ELSE parameters will already have been expanded by the time the condition is actually evaluated. The standard FormatTokens can be used in the THEN and ELSE parameters when you need to delay evaluation of (for example) a TWiki variable.
The basic syntax of a condition is the same as the syntax used for queries, with operators =
, !=
, ~
, <
, >
, <=
, >=
, NOT
, AND
, OR
, ()
, and functions lc()
, uc()
, d2n()
. In addition, the following special operators are supported:
context |
True if the current context is set (see below) |
allows |
'X' allows 'Y' is true if web/topic 'X' exists and allows access mode 'Y' for the current user. Web access rights are only checked if there is no topic called 'X'. |
istopic |
istopic 'X' is true if topic 'X' exists |
isweb |
isweb 'X' is true if web 'X' exists |
ingroup |
'X' ingroup 'Y' is true if user 'X' is in group 'Y'. 'X' can be a login name or a wikiname. |
defined |
True if a preference variable or url parameter of this name is defined. |
isempty |
True if a preference variable, url parameter or session variable of this name has an empty value. It is equivalent to the expression (defined(x) || $x='') |
$ |
expands a URL parameter or TWikiVariable name. Plugin handlers are not called. Built-in variables and user-defined preferences are supported. You can pass a limited subset of parameters to TWiki variables by enclosing the variable name in single quotes; for example, $ 'VARIABLE{value}' . The 'VARIABLE{value}' string may not contain quotes (' or "). |
{X} |
expands to the value of the configuration variable {X} - for example, {ScriptUrlPath} |
%IF{"defined 'WIKINAME'" then="WIKINAME is defined" else="WIKINAME is not defined"}%2. Compare TWiki variable
You are %IF{ "$ WIKINAME='TWikiGuest' and not defined 'OPEN_DAY'" then="not" }% allowed to %IF{ "context view" then="view" else="edit"}% this TWiki today.3. URL parameter
%IF{ "defined 'search'" then="Search: $percntURLPARAM{search}$percnt" else="No search passed in"}%4. Range test on URL parameter
url param t is %IF{ "0 < $ t and $ t < 1000" then="in" else="out of"}% range.5. Text comparison of URL parameter
%IF{ "$'URLPARAM{scope}'='text'" then="Plain text search" }%6. Configuration item set or not
%IF{ "{AntiSpam}{HideUserDetails}" then="User details are hidden" }%7. Plugin enabled test
TablePlugin is %IF{ "context TablePluginEnabled" then="enabled" else="disabled" }%.expands to:
You %IF{"'IfStatements' allows 'change'" then="can" else="cannot"}% change this topic. You %IF{"'Sandbox.TestTopic' allows 'change'" then="can" else="cannot"}% change Sandbox.TestTopic. You %IF{"'Sandbox' allows 'change'" then="can" else="cannot"}% change Sandbox webexpands to:
Topic Sandbox.TestTopic %IF{"istopic 'Sandbox.TestTopic'" then="exists" else="does not exist"}% Web Sandbox.TestTopic %IF{"isweb 'Sandbox'" then="exists" else="does not exist"}%expands to:
You %IF{"'%USERNAME%' ingroup 'TWikiAdminGroup'" then="are an admin" else="are a normal user"}%expands to:
<div style="visibility: %IF{"'%USERNAME%' ingroup 'TWikiAdminGroup'" then="visible" else="hidden"}%"> * Conditional text enclosed in div tags here... * ...can be as long as needed </div>Above text is only shown to users who are in the TWikiAdminGroup. Configuration items are defined in configure. You cannot see the value of a configuration item, you can only see if the item is set or not. Context identifiers are used in TWiki to label various stages of the rendering process. They are especially useful for skin authors to find out where they are in the rendering process. The following context identifiers are available:
id | context |
---|---|
absolute_urls |
Set if absolute URLs are required |
attach |
in attach script (see TWikiScripts) |
authenticated |
a user is authenticated |
body_text |
when the body text is being processed in a view (useful in plugin handlers) |
can_login |
current environment supports login |
changes |
in changes script (see TWikiScripts) |
command_line |
the running script was run from the command line, and not from CGI |
diff |
in rdiff script (see TWikiScripts) |
edit |
in edit script (see TWikiScripts) |
footer_text |
when the footer text is being processed in a view (useful in plugin handlers) |
header_text |
when the header text is being processed in a view (useful in plugin handlers) |
i18n_enabled |
when user interface I18N support is enabled (i.e., user can choose the language for UI) |
inactive |
if active links such as 'edit' and 'attach' should be disabled |
login & logon |
in login / logon script (see TWikiScripts) |
manage |
in manage script (see TWikiScripts) |
mirror |
if this is a mirror |
new_topic |
if the topic doesn't already exist |
oops |
in oops script (see TWikiScripts) |
preview |
in preview script (see TWikiScripts) |
register |
in register script (see TWikiScripts) |
rename |
in rename script (see TWikiScripts) |
resetpasswd |
in resetpasswd script (see TWikiScripts) |
rss |
if this is an RSS skin rendering |
save |
in save script (see TWikiScripts) |
search |
in search script (see TWikiScripts) |
statistics |
in statistics script (see TWikiScripts) |
textareas_hijacked |
provided for use by editors that highjack textareas, and want to signal this fact. This is used by skins, for example, so they can suppress extra controls when textareas have been hijacked. |
upload |
in upload script (see TWikiScripts) |
view |
in view script (see TWikiScripts) |
viewfile |
in viewfile script (see TWikiScripts) |
rest |
in rest script (see TWikiScripts) |
registration_supported |
registration is supported by the current UserMapper |
registration_enabled |
set if {Register}{EnableNewUserRegistration} is on, and registrationis supported |
passwords_modifyable |
set if the password manager support changing the password / email |
GallousBreeksPlugin
is installed and enabled, then the context ID GallousBreeksPluginEnabled
will be set. Other extensions may set additional context identifiers.
The %IF%
statement is deliberately kept simple. In particular, note that there is no way to conditionally execute a Set statement. If you need more sophisticated control over formatting, then consider using the SpreadSheetPlugin.
Note also that while the query syntax can be used to access form fields, there are some contexts in which an IF statement may be used where there is no topic context, or the topic context is not what you expected.
Related Topics: QuerySearch, VarIF, VarGET, VarSET, VarSEARCH, FormattedSearch, FormatTokens, SpreadSheetPlugin, TWikiScripts
-- Contributors: TWiki:Main.ArthurClemens, TWiki:Main.CrawfordCurrie, TWiki:Main.PeterThoeny, TWiki:Main.SopanShewale, TWiki:Main.SvenDowideit, TWiki:Main.WillNorris - 2011-04-04%INCLUDE{...}%
Variable %INCLUDE{...}%
variable to embed the content of another topic or web page inside a TWiki topic. The whole content or only parts of a page can be included. If needed, set a proxy server in TWikiPreferences.
%INCLUDE{ "page" pattern="reg-exp" rev="2" warn="off" section="clients" PARAMETER1="value" PARAMETER2="Some value"}%
The pattern
parameter is optional and allows you to extract some parts of a web page. Specify a RegularExpression that scans from start ('^'
) to end and contains the text you want to keep in parenthesis, e.g., pattern="^.*?(from here.*?to here).*"
. You need to make sure that the integrity of a web page is not compromised; for example, if you include an HTML table, make sure to include everything including the table end tag.
The example parameters PARAMETER1 and PARAMETER2 will be defined as a variable within the scope of the included topic. The example parameters shown will result in %PARAMETER1% and %PARAMETER2% being defined within the included topic. A default value can be specified such as %PARAMETER1{ default="..." }% in case the INCLUDE does not specify the parameter. Parametrized includes can be used to define and use macros, which is an alternative to parameterized variables.
VarINCLUDE explains the other parameters.
Note: All text of a topic is included unless it contains a %STARTINCLUDE%
and %STOPINCLUDE%
, or you specify a section
parameter and/or a pattern
parameter. A pattern will only search between %STARTINCLUDE%
and %STOPINCLUDE%
.
<pre> %INCLUDE{"http://domain/~qa/v1.1/REDTest.log.txt"}% </pre>
%INCLUDE{"http://www.google.com/robots.txt"}%
Tokyo: %INCLUDE{"http://TWiki.org/cgi-bin/xtra/tzdate?tz=Asia/Tokyo" pattern="^.*<\!--tzdate:date-->(.*?)<\!--/tzdate:date-->.*"}%
---+!! Breadslicer Users Guide %TOC{ depth="3" }% %INCLUDE{ "UsersGuidePreface" headingoffset="1" }% %INCLUDE{ "UsersGuideChapter1" headingoffset="1" }% %INCLUDE{ "UsersGuideChapter2" headingoffset="1" }% %INCLUDE{ "UsersGuideChapter3" headingoffset="1" }% %INCLUDE{ "UsersGuideChapter4" headingoffset="1" }% %INCLUDE{ "UsersGuideAppendix" headingoffset="1" }% %INCLUDE{ "UsersGuideIndex" headingoffset="1" }%
%INCLUDE{ "MyTopic" BETTER="apples" WORSE="Oranges"}%An example of a very simple MyTopic could contain
* I like %BETTER% better than %WORSE%.The result would be
----- %STARTINCLUDE% <div style="border-color:#FF9933; border-style:solid; border-width:thin; width:85%; margin: 0 auto"> <table cellpadding="5" width="100%" cellspacing="0" cellpadding="12" border="0"> <tr bgcolor="#FFBB55"> <td valign="top" width="16"><img src="%ICONURL{warning}%" width="16" height="16" align="absmiddle" alt="" border="0"></td> <td><b> %TITLE{ default="Alert!" }% </b></td> </tr> <tr bgcolor="#FFCC66"> <td> </td> <td> %MESSAGE{ default="Please specify a MESSAGE parameter." }% </td> </tr> </table> </div> %STOPINCLUDE% -----Now you can write
%INCLUDE{ "AlertBox" TITLE="Alert" MESSAGE="This a test message" }%
to get this:
Alert | |
This a test message |
TITLE=""
and MESSAGE=""
parameters are passed into the include. Using this approach, you can create a library of boxes in the Main web, such as Main.NoteBox, Main.InfoBox.
%STARTSECTION{AlertBox}%
... %ENDSECTION{AlertBox}%
(instead of the %STOPINCLUDE%
... %STOPINCLUDE%
)
%INCLUDE{ "Main.WidgetLibrary" section="AlertBox" TITLE="Alert" MESSAGE="The sky is the limit!" }%
"$SUM( $ABOVE() )"
to TWiki tables or anywhere in topic text ExternalSite:Page
to link to a page on an external site based on aliases defined in a rules topic :-)
for or :eek:
for Plugin | Errors |
---|---|
SpreadSheetPlugin | none |
BackupRestorePlugin | none |
ColorPickerPlugin | none |
CommentPlugin | none |
DatePickerPlugin | none |
EditTablePlugin | none |
HeadlinesPlugin | none |
InterwikiPlugin | none |
JQueryPlugin | none |
PreferencesPlugin | none |
RedirectPlugin | none |
SetGetPlugin | none |
SlideShowPlugin | none |
SmiliesPlugin | none |
TWikiSheetPlugin | none |
TablePlugin | none |
TagMePlugin | none |
TinyMCEPlugin | none |
TwistyPlugin | none |
WatchlistPlugin | none |
WysiwygPlugin | none |
Handler | Plugins |
---|---|
afterEditHandler | WysiwygPlugin |
afterRenameHandler | TagMePlugin WatchlistPlugin |
afterSaveHandler | TagMePlugin WatchlistPlugin |
beforeCommonTagsHandler | EditTablePlugin PreferencesPlugin TWikiSheetPlugin TwistyPlugin WysiwygPlugin |
beforeEditHandler | TinyMCEPlugin WysiwygPlugin |
beforeMergeHandler | WysiwygPlugin |
beforeSaveHandler | CommentPlugin WatchlistPlugin WysiwygPlugin |
commonTagsHandler | SpreadSheetPlugin BackupRestorePlugin CommentPlugin EditTablePlugin JQueryPlugin SlideShowPlugin SmiliesPlugin TWikiSheetPlugin |
initPlugin | SpreadSheetPlugin BackupRestorePlugin ColorPickerPlugin CommentPlugin DatePickerPlugin EditTablePlugin HeadlinesPlugin InterwikiPlugin JQueryPlugin PreferencesPlugin RedirectPlugin SetGetPlugin SlideShowPlugin SmiliesPlugin TWikiSheetPlugin TablePlugin TagMePlugin TinyMCEPlugin TwistyPlugin WatchlistPlugin WysiwygPlugin |
modifyHeaderHandler | WysiwygPlugin |
postRenderingHandler | PreferencesPlugin WysiwygPlugin |
preRenderingHandler | InterwikiPlugin SmiliesPlugin TablePlugin |
%FAILEDPLUGINS%
variable
Related Topics: TWikiPlugins, TWikiPreferences, AdminDocumentationCategory, AdminToolsCategory, TWikiSkinBrowserview.tmpl
(in the templates
directory). In the HTML at the top, the body tag has the page background hardcoded to white bgcolor="#ffffff"
. You can change that color value to new variable. First, define a new preferences variable in the site-level Main.TWikiPreferences, e.g. * Set =PAGEBGCOLOR = #d0d0d0
, then edit the view.tmpl
template file and change bgcolor="#ffffff"
to bgcolor="%PAGEBGCOLOR%"
. If you want, you can set the page background color individually per web, simple add a * Set =PAGEBGCOLOR = #d0d0d0
bullet to the WebPreferences to overload the site-level preferences. (Without font color control, you'll have to stick to light colors.)
WebIndex
with WebTopicList
, and save.
Edit
is disabled. Instead, go to More
and view the topic in raw
format.
days.gif
. To show this image in a topic, write %ICON{"days"}%
to get .
Creating image variables
You may find it easier to write shorthand graphic notation. You can create your own image variables by defining them in a preference topic (most likely Main.TWikiPreferences.)
A variable name may be one letter, like Y
, or may be longer like HELP
, WARN
etc. You can also add your own images, e.g. a NEW
, or a ASK
to ask question.
For instance, if we want to write %DOWN%
instead of %ICON{"arrowbdown"}%
, define the new variable like this:
* Set DOWN = %ICON{"arrowbdown"}%Or if you have a custom image to use, attach this to Main.TWikiPreferences and write:
* Set DOWN = <img src="https://wiki.ivoa.net/internal/TWiki/InstantEnhancements/my_image.gif" border="0" alt="DOWN" width="16" height="16" />Most images in TWikiDocGraphics are 16 x 16 pixels.
---++
, see TWikiShorthand).
For example, you may want to put all your custom variables in Main.TWikiPreferences right on top of the page, and generate table of contents, like:
w3m
pager/browser for Linux. This is a text based version similar to lynx
but it includes text editor features and a configurable command set to act like lynx
if you are more accustomed to it.
__Here's a list of topics I've been involved in recently:__ ---++++ Codev %SEARCH{ "InstantEnhancements" web="Codev" scope="text" nosearch="on" nosummary="on" noheader="on" nototal="on" order="modified" reverse="on" limit="20"}% ---++++ Support %SEARCH{ "InstantEnhancements" web="Support" scope="text" nosearch="on" nosummary="on" noheader="on" nototal="on" order="modified" reverse="on" limit="20"}% ---++++ TWiki %SEARCH{ "InstantEnhancements" web="TWiki" scope="text" nosearch="on" nosummary="on" noheader="on" nototal="on" order="modified" reverse="on" limit="10"}%End Copy The SEARCH variable has many more formatting options, see TWikiVariables.
<table> %SEARCH{ "\.*" scope="topic" type="regex" nosearch="on" nototal="on" order="modified" reverse="on" format="<tr><td> [[$topic][$topic]] </td><td> $wikiusername </td><td> $date </td></tr>" limit="15" }% </table>
Edit
. Set ALLOWTOPICCHANGE = Main.UserName, Main.GroupName
<!--
on the line _above the setting, and -->
on the line below.
Set WEBLOGONAME = filename.gif
WEBLOGOIMG
, WEBLOGOURL
, and WEBLOGOALT
(they mirror the WIKILOGO*
TWiki variables, but are applied to each web, rather than to the %WIKITOOLNAME%-based references)
If you'd like to have the same customised logo for all the webs, make these changes in TWikiPreferences instead of each web's WebPreferences, e.g., Set WEBLOGOIMG = %PUBURLPATH%/Main/WebPreferences/mylogo.gif
[Add]
button, and select the form if it isn't already enabled. Then, click the title to get to the actual form, [Edit]
, and carefully change values, probably basic page classifications. You'll get some increased value, and hands-on experience with TWikiForms, without having to read up about them first. (add the corresponding search per category - copy a default and change)
view.pattern.tmpl
(if you are using default pattern skin) (in the templates
directory) for some dramatic effects. The top of the template is mostly regular HTML with some variables. Open up some space in the <head>
area, and you can drop in reliable JavaScripts - a pop-up window script, for example - or tag it as an external script.