create new tag
, view all tags

CommentPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on CommentPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please file bug reports in the CommentPlugin bug database.
• See CommentPluginDevArchive for older discussions.

Feedback on CommentPlugin

Older feedback moved to CommentPluginDevArchive

Wouldn't it be nice if.....

... the end user could elect to post anonymously MartinCleaver  
... the minor changes flag could be ticked on the save, under program control. This would be useful for e.g. polls. CrawfordCurrie 01 Oct 2004 09:20:16
...there were attributes for authentication providing option to require sign-in or not on a case-by-case basis. LynnwoodBrown 06 Oct 2004 15:12:25
... you could define "date" fields and use JavaScriptDatePickerForForm AntonAylward 16 Nov 2004 01:04:37
... an HTML anchor brings you back to the comment form after adding (a'la table sort) NielsKoldso 30 Dec 2004 00:07:46
...you could hide the comments (perhaps using a twistee) JeffLevitt 24 Mar 2005 00:26:24
...people could use format, header and footer parameters in very much the same way as with the %SEARCH% variable. IMHO that would allow easy customization of the look and feel. I find having to use TWiki template a bit too heavy. Maybe it's just because I'm not familiar with them. I have the impression that I have to change templates on the server side to modify the rendering of comments or am I missing something? With format, header and footer it would be dead easy to do from your web browser. StephaneLenclud 05 Sep 2006
...!CommentPlugin could replace a string of text defined by a regex with another string. Then it could be used to create a one-click mechanism to change a topic setting, or delete an bit of information. I sometimes INCLUDE a temporary help topic. This mechansim could be used to provide a "Remove this message" button that removes the INCLUDE. LynnwoodBrown 07 Oct 2006 - 09:44
the ability to extract a particular line from the comment text (the first line makes the most sense). This could then be combined with the Twisty Plugin so that the full content of the comment is hidden under the first line of the comment. RobLeach 22 Nov 2006 - 10:32
... to use the Comment plugin for a threaded discussion? The ThreadedDiscussionPlugin is not flexible enough. In particular I mean replying to single comments. I haven't found a solution for this yet.
* What would you need for this? How would comments be structured? -- ArthurClemens - 19 Dec 2006
MarijanaPrusina 19 Dec 2006 - 04:32

Already done...

... the plugin could accept input from e-mail see MailInContrib CrawfordCurrie, TobiasRoeser  
... it were possible to add a comment without locking the page (either via preference variable or via individual selection). NO LONGER RELEVANT MichaelSchmidt 25 Feb 2005 09:51:57
... you could override where it gets its templates from, either in the CommentPlugin topic or even in the %COMMENT itself DONE CrawfordCurrie 28 Sep 2004
... there was a way to provide a default value to be placed in the COMMENT box? (this is in aid of my desire to create a JavaScript bookmark saver to a wiki page.) AndyGlew done by CrawfordCurrie in 11359
...we added a couple of more parameters comment_removeprompt (deletes the comment box) and comment_postandremoveprompt (posts the message and deletes the comment box). PankajPant done by CrawfordCurrie in 11359


Hello, I want to send the form data to two different topics with different formats. Is it possible to define multiple targets? Or is there another way to do this?

Thanks already

-- UgurUyanik - 03 Jul 2008

I'm getting a no such template def error, but when the user is not a member of TWikiAdminGroup. Details are described in NoSuchTemplateDef

Can anyone help to identify what's going on there ?

-- KeithHelfrich - 05 Oct 2008

Many of our non-tech users have been complaining for some time about the stripping of newline characters in the comments field.

I realise that there is some history to this, and from my own tinkering have seen some breakage of metadata and old content, but I think I have a workable solution for us.

Original code:

sub _buildNewTopic {
  # Expand common variables in the template, but don't expand other
  # tags.
  $output = TWiki::Func::expandVariablesOnTopicCreation($output);

New code:

sub _buildNewTopic {
  # USQ HACK - 06/02/08 - (1)
  # Replace newlines characters with gibberish markers.
  # This is PRE new text being inserted.
  # We will revert the gibberish afterwards.
  $output =~ s/[\r\n]+/\<123USQCOMMENTSPLUGINHACK123\>/g;

  # Expand common variables in the template, but don't expand other
  # tags.
  $output = TWiki::Func::expandVariablesOnTopicCreation($output);

  # USQ HACK - 06/02/08 - (2)
  # Strip return characters altogether.
  # Replace newline characters with html breaks.
  # Only newlines left here should be from the new comment.
  # Then revert the older newlines.
  $output =~ s/\r//g;
  $output =~ s/(.+)\n/\1\<br\/\>\n/g;
  $output =~ s/\<123USQCOMMENTSPLUGINHACK123\>/\n/g;

It's not 100% perfect, since it is also putting a break after the signature (fixed, simple typo), but it does preserve newlines after the <br/> as well as blank lines (unlike newline in templates) so TWiki can handle paragraphing as normal, and raw edit is almost exactly as entered.

Is there something I'm missing in relation to why newlines were taken out in the first place that this does not resolve? Loosely resolve anyway, it can use polish.

-- GregPendlebury - 06 Feb 2009

Eating newlines is a legacy of HTML and the TWiki roots. I agree that adding HTML line breaks for line breaks would be more intuitive. An implementation has to be tested carefully though. For example, it needs to work with regular TML, such as tables, bullets, e-mail addresses at end of line etc.

We have to be careful though because it introduces an incompatibility. Possibly enable with a new %COMMENT parameter, such as preservenewlines="on"?

-- PeterThoeny - 06 Feb 2009

Is it possible to specify the target topic in the Comment form? That is, can I put up a comment form where the user controls wwhere the results go?

-- VickiBrown - 27 Mar 2009

I assume you can do that with a selector named topictemplate.

-- PeterThoeny - 01 Apr 2009

TWikibug:Item6276 submitted. In a template you used to be able to specify newline= to specify, for example, that newlines should be BReaks. This functionality has been lost and now the text in the value of newline= gets turned into HTML, for example the greater than sign gets turned into ampersand-gt-semi.

-- AJAlfieriCrispin - 2009-06-08

This is likely related to Codev.SecurityAlert-CVE-2009-1339 fix. Needs to be addressed.

-- PeterThoeny - 2009-06-08

Fixed in Bugs:Item6276

thank you.

-- AJAlfieriCrispin - 2009-12-09

I'm thinking about implementing partially untrusted collaboration through the CommentPlugin. ie. making selectively included comments written with individual ID's to a different target topic and fetched by a including plugin only if they pass the integrity check. At a later stage I will probably add a widget for down- and upmodding as well as flagging for the comments, with a author reputation and comment score visibility threshold on per user basis.

Example code before

unless( $nopost ) {

in _buildNewTopic would look like this:

if ($signed) {
      # 128 bit comment id should be enough for everyone
      my $commentid= join "", map { unpack "H*", chr(rand(256)) } 1..16;
      use Digest::SHA;
                # This should be randomly assigned on the first run and saved somewhere
      my $mackey = 'secret';
      # make a MAC code for the message
      my $mac=Digest::SHA::hmac_sha256_base64(TWiki::Func::getWikiName().$commentid.$output,$mackey);
      # Wrap the whole thing into sections and use _SECTION0 - _SECTIONX to fetch the id 
      $output= '<br>%STARTSECTION{}%'.$commentid.'%ENDSECTION{}%'
         .'%STARTSECTION{"hmac"}%'. $mac .'%ENDSECTION{"hmac"}%'
         .'%STARTSECTION{"WikiName"}%'. TWiki::Func::getWikiName() .'%ENDSECTION{"WikiName"}%'

-- JoonaKannisto - 2011-04-20

In the template (particularly in the OUTPUT template of UserCommentsTemplate), will it expand other TWiki commands? I want to put a SEARCH command in the output, so that the output of the SEARCH command is hard-coded at that point in time. Merci.

-- AaronLWalker - 2012-11-16

Figured out how to make it work. Very nice.

%TMPL:DEF{OUTPUT:monlog}%%POS:AFTER%| %URLPARAM{"appId" encode="off"}% | %STARTSECTION{type="expandvariables"}%%SEARCH{ "ApplicationID = '%URLPARAM{"appId" encode="off"}%'" type="query" nosearch="on" noheader="on" nototal="on" nofinalnewline="on" separator=", " format="$topic (r$rev)" }%%ENDSECTION{type="expandvariables"}% | %WIKIUSERNAME% | %SERVERTIME% |

-- AaronLWalker - 2012-11-26

Aaron, I did not spot your question in time. Yes, the encode="off" does the trick. Keep in mind that this could open it up to Wikipedia:CSRF exploits.

-- PeterThoeny - 2012-11-26

When using the comment type 'action' the date field is not displayed as date field with a date picker, which is a bit annoying.

I found that it works if the current date input field in the CommentPluginTemplate for type action is replaced by a DatePicker-Field:

%DATEPICKER{ name="action_due" value="%URLPARAM{"due"}%" }%

This creates a new dependency to the DatePickerPlugin, but ActionTrackerPlugin already requires DatePickerPlugin, too.

So far I did not notice any bad side effects on our system.

-- Michael Gulitz - 2013-04-25

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatdiff Comment.pm.diff r1 manage 4.4 K 2006-05-05 - 18:30 PankajPant Diff against CommentPlugin version 3.009 (for Cairo)
Unknown file formatpm_attachfiles Comment.pm_attachfiles r1 manage 11.5 K 2007-02-06 - 14:28 JohnFitzpatrick Modified 4.0.5 Comment.pm to allow file attachments
Unknown file formatdiff CommentPlugin-UTF8-bugfix.diff r2 r1 manage 1.3 K 2004-12-29 - 23:09 NielsKoldso diff -u against CommentPlugin.pm version 3.008
Compressed Zip archivezip CommentPlugin.zip r2 r1 manage 20.8 K 2005-01-03 - 12:34 CrawfordCurrie  
Perl source code filepm QuickPostPlugin.pm   manage 3.4 K 2005-02-19 - 02:00 UnknownUser  
Texttxt UserTemplates.txt   manage 2.1 K 2005-02-19 - 02:00 UnknownUser  
Compressed Zip archivezip comment-oct02.zip   manage 9.9 K 2005-02-19 - 02:00 UnknownUser  
Texttxt commentpluginfromatemplate.txt   manage 0.6 K 2005-02-19 - 02:00 UnknownUser  
Compressed Zip archivezip cpluginfix.zip   manage 3.7 K 2005-02-19 - 02:00 UnknownUser  
Compressed Zip archivezip cpluginlockfix.zip   manage 4.7 K 2005-02-19 - 02:00 UnknownUser  
Unknown file formatEXT saveqp   manage 3.7 K 2005-02-19 - 02:00 UnknownUser  
Edit | Attach | Watch | Print version | History: r396 < r395 < r394 < r393 < r392 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r396 - 2013-04-25 - MichaelGulitz
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.