|
< < | |
| Comment Plugin |
|
< < | |
| |
|
> > |
The Comment Plugin lets users quickly post comments to a page without an edit/preview/save cycle. |
| |
|
< < | Comment Plugin lets users quickly post comments to a page without an edit/preview/save cycle.
Related topics: CommentPluginTemplates, CommentPluginExamples
WARNING: TWiki-4 only. If you want to use this plugin with an earlier version of TWiki, please use revision 31 of the zip . |
> > | Related topics: CommentPluginTemplates, CommentPluginExamples |
|
Features |
|
- in other topics, or other positions within the current topic.
Syntax |
|
> > | |
|
Write %COMMENT{attributes}% anywhere in a TWiki topic. |
|
< < |
- A
%COMMENT% without parameters shows a simple text box.
- A
%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" | emailto | Send comment by email. Use comma "," to seperate multiple email addresses. This feature is disabled by default. To enable this feature, please set up "$TWiki::cfg{Plugins}{CommentPlugin}{EmailEnabled} = 1;". | |
|
> > |
- A
%COMMENT% without parameters shows a simple text box.
- A
%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" | emailto | Send comment by email. Use comma "," to seperate multiple email addresses. This feature is disabled by default. To enable this feature, please set up "$TWiki::cfg{Plugins}{CommentPlugin}{EmailEnabled} = 1;". | |
|
| (See also additional attributes)
Positioning the comment |
| will add comments in the current topic, directly below the %COMMENT tag.
Location relative to a TWiki anchor |
|
> > | |
| The target attribute may specify a web, and may also specify an anchor within the target topic; for example, |
|
< < | |
> > | |
| |
|
< < | This uses a standard TWiki in-topic anchor as the insertion location. See TextFormattingRules for more about TWiki anchors. |
> > | This uses a standard TWiki in-topic anchor as the insertion location. See TextFormattingRules for more about TWiki anchors. |
|
Location relative to an arbitrary text string |
|
> > | |
| Getting more sophisticated, you can also specify a regular expression for the target location using the 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 occurence of the string Flights of Fancy in the current topic. |
> > | 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.
Also note that you cannot have the text location=" just before the location. |
|
Customisation |
|
> > | |
| Customisation of the comment plugin requires
- familiarity with HTML forms
|
|
< < | |
> > | |
|
To define a comment type, you have to provide two simple template definitions in the template file; one for the prompt box, and one for the generated output. If we have a template type "mytype", these are named 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.
Defining custom templates |
|
< < | By default, 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 customisations. |
| |
|
< < | This allows for several levels of customisation:
- To override all default templates, everywhere, change
comments.tmpl to include a different topic (this customisation will be lost next time you upgrade, though).
- To add site-wide local template customisations, add them to UserCommentsTemplate (create if it does not exist yet). You can redefine the standard templates here if you want, and your definitions will override the standard definitions.
- To override templates on a web-by-web basis, add a topic
UserCommentsTemplate to the web (this will replace TWiki.UserCommentsTemplate)
- To override templates for a specific skin, add them to TWiki.UserComments<Skin>Template (where <Skin> is the name of the skin with the first letter capitalised, e.g. Pattern)
|
> > | By default, 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:
- To override all default templates, everywhere, change
comments.tmpl to include a different topic (this customization will be lost next time you upgrade, though).
- To add site-wide local template customizations, add them to UserCommentsTemplate (create if it does not exist yet). You can redefine the standard templates here if you want, and your definitions will override the standard definitions.
- To override templates on a web-by-web basis, add a topic
UserCommentsTemplate to the web (this will replace TWiki.UserCommentsTemplate)
- To override templates for a specific skin, add them to TWiki.UserComments<Skin>Template (where <Skin> is the name of the skin with the first letter capitalized, e.g. Pattern)
|
|
You can also define a comment template in a topic, by passing the topic location with templatetopic . For example:
|
|
|
|
< < | Customisation example with custom form template |
> > | Customisation example with custom form template |
| Write a custom form in a topic.
- In the form set the location of the prompt with
%COMMENTPROMPT% ; the prompt will be positioned here.
- In %COMMENT use parameter
noform="on"
|
|
%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 |
|
|
> > | |
| Note that these position tags are obviously mutually exclusive. If you define more than one, the result is undefined. If none is present, the default is taken from the plugin setting DEFAULT_TYPE
%COMMENTPROMPT% |
Use with a custom form. If present, the comment prompt will be positioned here. |
|
|
< < | All the usual TWikiVariables that can be used in a topic template can also be used in an OUTPUT template. See TWikiVariables for details. |
> > | All the usual TWikiVariables that can be used in a topic template can also be used in an OUTPUT template. See TWikiVariables for details. |
|
Settings |
|
> > | |
| |
|
< < | Two TWiki Preference variables are recognised by the CommentPlugin: |
> > | Two TWiki Preference variables are recognized by the CommentPlugin: |
|
|
|
< < |
%COMMENTPLUGIN_TEMPLATES% |
comments |
Name of template file in the 'templates' directory that contains the comment templates. The default 'comments.tmpl' automatically includes user templates from CommentPluginTemplate, which in turn includes UserCommentsTemplate. |
|
> > |
%COMMENTPLUGIN_TEMPLATES% |
comments |
Name of template file in the 'templates' directory that contains the comment templates. The default 'comments.tmpl' automatically includes user templates from CommentPluginTemplate, which in turn includes UserCommentsTemplate. |
|
|
%COMMENTPLUGIN_DEFAULT_TYPE% |
above |
Default template type |
These can be set in TWikiPreferences, in WebPreferences or in individual topics.
#Installation
Plugin Installation Instructions |
|
< < |
- This plugin is pre-installed in most TWiki releases. However if you need to upgrade the plugin for any reason:
|
> > |
- This plugin is pre-installed in TWiki releases. However if you need to upgrade the plugin for any reason:
|
|
- Download the archive file from the Plugin web (see below)
- Unpack the archive in your twiki installation directory.
- You may need to correct file permissions
|
|
Plugin Info |
|
< < | Another great TWiki extension from the WikiRing - working together to improve your wiki experience!
|
> > |
|
|
|
|
|
|
< < |
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 |
|
> > |
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 'TWiki.'; also fixed include 'UserComments' to 'UserCommentsTemplate' (at least that is what the doc suggests) |
|
> > |
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 |
|
|
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 |
|
|
< < |
Related Topics: TWikiPreferences, TWikiPlugins |
> > |
|
| |
|
< < |
META FILEATTACHMENT |
attr="h" comment="" name="wikiringlogo20x20.png" version="1" |
|
> > | Related Topics: CommentPluginTemplates, CommentPluginExamples, TWikiPreferences, TWikiPlugins |