Difference: CommentPlugin (8 vs. 9)

Revision 92007-02-04 - Main.TWikiContributor

Line: 1 to 1
 

Comment Plugin

Line: 14 to 14
  Comment Plugin lets users quickly post comments to a page without an edit/preview/save cycle.
Changed:
<
<
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

 
Changed:
<
<
>
>
WARNING: TWiki-4 only. If you want to use this plugin with an earlier version of TWiki, please use revision 31 of the zip.
 

Features

Line: 26 to 28
 
  • signed or unsigned, dated or undated (as defined by a template),
  • in other topics, or other positions within the current topic.
Changed:
<
<

Syntax Rules

Write the command %COMMENT{ attributes }% anywhere in a TWiki topic. %COMMENT% is also legal.

>
>

Syntax

 
Changed:
<
<
The following attributes are recognized (see also additional attributes):
Name Description
type This is the name of the template to use for this comment. Comment templates are defined in a TWiki template - see Customisation, below. If this attribute is not defined, the type is whatever is defined by COMMENTPLUGIN_DEFAULT_TYPE, either in this topic or in your WebPreferences. By default this is 'below'.
default Default text to put into the textarea of the prompt.
target Name of the topic to add the comment to. Defaults to the current topic.
location Regular expression specifying the comment location in the target topic. Read carefully below!
mode For compatability with older versions only, synonymous with type
nonotify Set to "on" to disable change notification for target topics
noform Set to "on" to disable the automatic form that encloses your comment block - remember to insert <form> tags yourself! See CommentPluginExamples for an example.
nopost Set to "on" to disable insertion of the posted text into the topic.
remove Set to "on" to remove the comment prompt after the first time it is clicked.
button Button label text; by default Add comment.
>
>
Write %COMMENT{attributes}% anywhere in a TWiki topic.

  • A %COMMENT% without parameters shows a simple text box.
  • The following standard attributes are recognized
    Name Description Default
    type This is the name of the template to use for this comment. Comment templates are defined in a TWiki template - see Customisation, below. 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 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

(See also additional attributes)

 

Positioning the 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.
Line: 68 to 58
  will place comments above the first occurence of the string Flights of Fancy in the current topic.
Changed:
<
<
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.
>
>
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.
  I look forward to someone leveraging this feature to create - for example - threaded conversations using %COMMENT.
Line: 77 to 68
 

Default templates

Templates are used to define the "comment style" i.e. how comments appear in the page. The default is to add comments in "Blog like" style using bulleted lists, with the most recent comment at the top, but many other styles are available such as tables or Wiki thread mode comments. It is easy to define your own customer styles as well.
Changed:
<
<
A set of default comment templates are shipped with the plugin. These are:
>
>
A set of default comment templates are shipped with the plugin - see also CommentPluginTemplates:
 
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
Added:
>
>
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>)
Added:
>
>
action Action added to action table directly above comment box (requires TWiki:Plugins/ActionTrackerPlugin)
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
  Your local installation may add more template types as well - see Customisation, below.
Line: 108 to 105
 
  1. To override templates on a web-by-web basis, add a topic UserCommentsTemplate to the web (this will replace TWiki.UserCommentsTemplate)
  2. 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)
Changed:
<
<
ALERT! 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.
>
>
You can also define a comment template in a topic, by passing the topic location with templatetopic. For example:
%COMMENT{type="blogpost" templatetopic="BlogPostCommentTemplate" target="%TOPIC%" button="Add comment" }%

templatetopic accepts topic or web.topic syntax. See an example in CommentPluginExamples:templatetopic.

 
Added:
>
>
ALERT! 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.
 ALERT! Note that from TWiki release 4.1.0 leading and trailing whitespace is no longer stripped. This means that when you upgrade to TWiki 4.1.X you may need to remove the first line break in your custom comment templates. See TWikiReleaseNotes04x01 for more information.

Customisation example

Line: 163 to 169
 
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
Added:
>
>
comment_templatetopic As passed to %COMMENT
 Note that 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}%/%WEB%/%TOPIC%">
Line: 173 to 180
 
Added:
>
>

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"
  • In %COMMENT use parameter templatetopic to point to the topic with the form template

Example form:

%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="%TOPIC%" button="Add comment" }%
 

The OUTPUT template

The 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.
Line: 184 to 212
 
%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
Added:
>
>
%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.

Settings

Line: 213 to 243
 

Plugin Info

Changed:
<
<
Plugin Author: TWiki:Main.DavidWeller, TWiki:Main.PeterMasiar, TWiki:Main.CrawfordCurrie http://www.c-dot.co.uk
Copyright: © 2004, TWiki:Main.CrawfordCurrie
© 2004-2007 TWiki:TWiki.TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 12750 (04 Feb 2007)
Change History:
<-- specify latest version first -->
 
12750 Item3510 added a note about the changed template spec in TWiki 4.1.0. Code remains unchanged
11358 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 Item2322 removed span tag around oneliner bullet output
8788 Item1465 Item1577: reverted 8433 to fix inclusion of correct user templates
8787 Item1573 renamed standard templates topic to avoid naming clash on Windows, where filenames are case-insensitive
8433 Item1465 Fix 'TWiki.' to 'TWiki.'; also fixed include 'UserComments' to 'UserCommentsTemplate' (at least that is what the doc suggests)
7427 Item845 removed duplicate date in default comments; stick with server time
7251 Item810 fix for user template inclusion; reorganised templates to make customisation easier
5906 Item143 apache warning from comment plugin when CommentsTmpl.txt not found
>
>
Another great TWiki extension from the WikiRing - working together to improve your wiki experience!

Plugin Author: TWiki:Main.CrawfordCurrie http://www.c-dot.co.uk inspired by the work of TWiki:Main.DavidWeller and TWiki:Main.PeterMasiar
Plugin Version: 15776 (22 Jan 2008)
Change History:  
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 'TWiki.'; 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.
Line: 238 to 273
 
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
Changed:
<
<
Perl Version: >= 5.6.1
>
>
Copyright: © 2004, TWiki:Main.CrawfordCurrie
© 2004-2007 TWiki:TWiki.TWikiContributor
License: GPL (GNU General Public License)
 
Plugin Home: TWiki:Plugins/CommentPlugin
Feedback: TWiki:Plugins/CommentPluginDev

Related Topics: TWikiPreferences, TWikiPlugins

Changed:
<
<
-- TWiki:Main/CrawfordCurrie - 15:45:58 03 March 2007
>
>
META FILEATTACHMENT attr="h" comment="" name="wikiringlogo20x20.png" version="1"
 
This site is powered by the TWiki collaboration platformCopyright © 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.CommentPlugin