MoinMoin PageComment2 Macro
PageComment Release 2
A comment board utility written by SeungikLee and implemented as a MoinMoin macro. This macro gives a form to post a new comment to the page and shows a list of the posted comments.
/Ideas /Patches |
Contents
Features
Simple usage, just put [[PageComment2]] on any page.
- Lets anonymous users post a new comment with an input form.
- Lets logged-in users post a new comment without providing name, password
- Shows a list of the posted comments.
- Support for comment deletion by given password.
- Support for administrative actions, e.g.,
- to delete a comment without entering a given password
- Support despam action
Platform Support
PageComment2 Tested on/with:
MoinMoin 1.6, 1.5.x, 1.35, Desktop edition 1.3.4-2
- Python 2.4 or later
- ascii/non-ascii characters (e.g., Korean)
Installation Guide
Download the latest PageComment2.py macro and place it either in your global macro directory (MoinMoin/macro) or preferably in your local macro directory (yourwiki/data/plugins/macro).
Do not forget to rename the downloaded .py file. For example, you should change the file name 'PageComment2-090.py' to 'PageComment2.py'.
- You will need to restart your wiki once the macro is installed.
Usage Guide
- Place the following code on any wiki page:
[[PageComment2]]
If using MoinMoin 1.6 or above use the following code:
<<PageComment2>>
- You should see an input form to post a new comment.
- After posting comments, you can see a list of the comments for the page.
Parameters
- Parameters are included as a comma-delimited list within parenthesis following the macro name. If the parameter includes an equals (eg: section=N) do not put spaces around the equals sign.
[[PageComment2(<param1>[,param2][,param3][,...])]]
- pagename: the page name which the comments are retrieved for. By default the page itself. If the user has no 'read' ACL for that page, it does not allow to insert/view comments.
pagename=AnotherPage
- section: the section name of the page. The comments in different sections are managed in separated sub pages. Section name should be alphanumeric format ([a-zA-Z0-9] in regular expression). If not, all the non-alphanumric characters are removed.
section=1, section=News, section=Opinion
- inputonly: shows input form only. list of the comments are shown to admin users only.
- inputonly=0; default, all list is shown to all users including anonymous users
- inputonly=1; shown to admin users only (who has the page delete privilege)
- commentonly: shows the list of comments only.
- commentonly=0; default, both of the list and input form will be shown
- commentonly=1; only the list of comments will be shown
- countonly: returns the number of the comments posted to this page
- countonly=0; default, normal form (input form; list of comments)
- countonly=1; just return the number of comments.
There are [[PageComment2(countonly=1)]] comments here
(where PageComment2 is the name of your macro (if you named it differently))
- rows: the # of rows of the textarea. Default 2.
rows=2
- cols: the # of columns of the textarea. Default 60. e.g.,
cols=60
- maxlength: limitation on # of characters for comment text. Default 0 (no limit).
maxlength=500
- newerfirst: order of the list of comments.
- newerfirst=0: default, newer ones are listed at the end
- newerfirst=1: newer ones are listed at the top
- commentfirst: shows comment list before the input form.
- commentfirst=0: default, the input form first
- commentfirst=1: comment list first
tablewidth: the width of the table format. Default '' (none).
tablewidth=600, tablewidth=100%
- articleview: shows comment list in an article view.
- articleview=0: default, list in table view
- articleview=1: list in article view
- smileylist: shows smiley options with drop-down list box
- smileylist=0: default, a part of the smiley in radio button
- smileylist=1: smiley in drop-down list box
- nosmiley: shows no smiley
- nosmiley=0: default, shows smiley selection
- nosmiley=1: no smiley selection
- notify: notifies to the subscribers of the page which includes the macro when a comment is added
- notify=0: default, notification disabled
- notify=1: notification enabled
- encryptpass: encrypts entered password
- encryptpass=0: default, the password is stored in plain text
- encryptpass=1: the password is stored in encrypted format
- markup: enables wiki markup in the comment text except some specified macros.
- markup=0: default, use of wiki markup in the text is disabled
- markup=1: use of wiki markup in the text is enabled and preview button is activated
Download & Release Notes
Download |
Release Version |
Moin Version |
Release Notes |
0.993 |
1.9 |
For moin 1.9.3 and up, up to 1.9.3 is untested. Different defaults |
|
0.992 |
1.6 |
(only for use with Moin 1.6) fixes markup=1 errors |
|
0.991 |
1.6 |
(only for use with Moin 1.6) fixes notify error |
|
0.99 |
1.6 |
(only for use with Moin 1.6) |
|
0.98.1 |
1.5/1.3 |
|
|
0.98.1 |
1.5/1.3 |
Login Required |
|
0.98 |
1.5/1.3 |
|
|
0.97 |
1.5/1.3 |
|
|
0.96 |
1.5/1.3 |
|
|
0.95 |
1.5/1.3 |
|
|
0.94 |
1.5/1.3 |
|
|
0.92 |
1.5/1.3 |
|
|
0.91 |
1.5/1.3 |
|
|
0.90 |
1.5/1.3 |
|
(See MacroMarket/PageComment for Release 1: PageComment.py)
Change Log
February 19, 2008 - Version 0.991
notify feature broke as a result of Moin 1.6 back-end changes-- now fixed (Thanks Marcel Juhnke)
January 29, 2008 - Version 0.99
changed for use with MoinMoin 1.6
April 25, 2006 - Version 0.98.1
- fixed a bug on change subscription
fixed the errata (Thanks to ThiloPfennig)
April 17, 2006 - Version 0.98
- fixed a bug on revision history
- added a despam action (using normal wiki despam feature, enabled by default)
Jan. 05, 2006 - Version 0.97
- added features:
- mail notification
- password encryption
- wiki markup support with preview
- remember author name last used
- administrative actions (delete without password) are allowed to those who has WRITE acl.
- added features:
Nov. 29, 2005 - Version 0.96
- some format parameters are added
- random password feature is added
Nov. 20, 2005 - Version 0.95
- some minor bugs are fixed
Nov. 20, 2005 - Version 0.94
- some parameters are added
- some minor bugs are fixed
Nov. 19, 2005 - Version 0.92
- some minor bugs are fixed
- 'olderfirst' parameter replaced with 'newerfirst'
Nov. 19, 2005 - Version 0.91
- some parameters are added
- validates smiley markup
- modified view
Nov. 18, 2005 - Version 0.90 (Release 2)
- No text data file is supported any more: Comment is stored in the sub wiki page.
( does not compatible with Release 1: PageComment.py)
- Custom icon (smiley) can be inserted
- Pre-fill the name input field with his/her login name
- Logs at add/remove comments
- Added some parameters
Oct. 08, 2005 - Version 0.82
- Changed the directory the data file stored to be secured
Oct. 07, 2005 - Version 0.81
Unicode encoding related bugs in deletecomment function are patched.
- Instruction bugs are patched.
Oct. 06, 2005 - Version 0.80
- The initial version is released.
Sample & Screenshot
Known Problems
socket.gethostnamebyaddr method cause some delay in rendering the input form in order to get a name automatically generated for an anonymous user.
some errors on HTML codes. (no matched table row/cols)
at adding a comment, e-mail notification is ignored. .savetext should be used instead of .writefile method.
To do list
(2005-10-06 12:01:53)
To handle the index overflow
To pre-fill the name input field with his/her login name
- To provide selective options for:
formatting text or form
- selecting columns to be shown (*)
selecting a list of comments by a given ID not just page name
- To encrypt/decrypt the entered passwords (****)
To give more friendly message or instructions
To provide an option to remove a comment permanently
To receive a confirm before deleting a comment
To insert an emotional icon
To add log entry at add/delete comment
Discussion / Support / Request / Contribution
Release 2
UI Things
Wow, great macro! Simple and powerful Permit me to make some suggestions/requests:
- Make the smiley a dropdown box that defaults to no smiley. -- People often don't know the smiley codes and don't bother to change the defaults. As a result you and up with just a long list of default smiley faces.
- Option for the comments to appear above the box -- The comments are of more interest than the entry box and should appear first (at least as an option).
Show comment count for a different page -- I would like to post some news stories on the front page of my wiki and would like to allow comments to these. The actual stories will be located on pages with permanent a URL, while the latest stories appear in short form on the front page or a 'news' page. (see example). The comments would appear on the page with the actual news story, but it would be cool if the summary page could contain a comments count (a la Slashdot et al.)
-- HenrikOmma
Thanks for the comments. I've patched all the suggestions in version 0.94. I hope you like it -- SeungikLee 2005-11-20 07:24:00
Hey, that was quick So, you've inspired me to make some more suggestions now ... I've posted them on this sub-page: /Ideas.
Great tweak! In fact, I'm not good at designing UI things as you suggested. Would you give a patch for that please? After discussing and testing it, I'll patch it up -- SeungikLee 2005-11-21 01:35:14
Oh sorry, I wasn't being clear: I made those changes in Photoshop only. I usually find that to get the layout right you have to play around with it in an image editor for a while and then implement it in HTML/CSS (and even then, I made 4-5 versions before settling on that one). I could have a go at implementing it if you like, but I'm a real python novice -- HenrikOmma
Could you allow registered users to delete their own comments, and just not allow anonymous users to delete comments at all? If you want to be more flexible, you could also allow anyone with ACL rights to modify the comments subpage, the ability to delete any of the comments (which they could do anyway by directly editing the subpage). -- PaulMoore 2005-11-18 14:39:28
At first, let me describe how the PageComment2 macro deals with adding/deleting comments currently:
the data wiki page, named 'PageCommentData' is automatically created with '#acl All:'
- for not-logged-in users (anonymous): he should provide name and password, etc. He can delete his comment by password given.
- for logged-in users: it does not ask name and password. the name field will be inserted with his login name, the password field will be left as blank. He can delete his OWN comment with just clicking the 'X' button at the end of the comment.
- for admin users who has delete privilege: he can delete any of the comments without providing a password.
I think that anonymous SHOULD be able to delete his own comment with given password. It's not the problem of the policy but editorial problem. Assume that you made a typo in the comment and you cannot delete or modify the comment.
I tried to use ACL for modifying comments in the sub page, but it results into a very complicated implementation and weak security because I assumed that we untrust any other users and it may be not wiki nature. Anyway, if you want to allow the users to modify the data page, change the Globs.defaultacl variable in the macro
-- SeungikLee 2005-11-18 15:47:12
I like the changes. Tweaks I would like to see: The items in each column don't alwasy line up properly. For example, in the screen shot above, the date for Anonymous' comment does not line up with those above it. I also see the same thing on my wiki when the usernames are different lenghts. For MisterSmith, the comment begins further to the right than does the comment of JonDoe. Second, I would like to see the comment entry box show more than just 2 lines of text at a time. 6 or 7 lines would be better. Thanks for your work on this. -- RichardHiers
I've already patched that kind of problem and I'll add a parameter for the # of rows of the textarea Thanks for you comment. -- SeungikLee 2005-11-18 15:47:12
Looks pretty useful, but I would like to be able to have multiple comment sections on a single page. I don't see any way to do this. Could you add a parameter for "section name", or some other way to allow this? -- AndyCrews 2024-12-23 07:16:03
Thanks for the comment. I've added section parameter into version 0.94. I hope you like it -- SeungikLee 2005-11-20 07:24:00
Sections work exactly as I had hoped. This seems like a HUGE feature for the wiki that was previously missing. It allows people can add comments about different sections of the page without scrolling up to the top to find the "edit" button. It also seems very adaptable. I believe one could have several "commentonly" sections on one page, and having a link near each that says "add comments" which sends it to another where the input box exists. (The only reason would be to have several comment sections on one page, but reduce the amount of realestate used by the input window.)
I notice one small bug--the first time I try to add a comment (the only parameter I specified was the section name, like "1"). Starting with the second time, it works great. -- AndyCrews 2024-12-23 07:16:03
Would it be possible to allow Wiki markup in the comment? This would let people use formatting such as bold or italic. (Although it would also allow macros etc, which could expose a security hole - but that may be OK in an intranet style environment) -- PaulMoore 2005-12-07 17:36:34
I'm developing some extensions in v0.97 for that. Please try it in the sample site. I hope it will be updated soon. -- SeungikLee 2005-12-27 14:33:14
I was taking a look at your code, but haven't got quite far enough to do what I'd like to. I'm looking for MailForm-type functionality; that is, I would like to put the code [[PageComment2(mailto='me AT example DOT com')]] on my page and, instead of adding the comment to the page it gets sent to the nominated email address like a regular feedback form that you get on most CMS's. I was thinking of writing a separate macro for this, but it seems to fit right in with the interface you've designed - all it needs is one extra parameter. Or should this be in a separate macro? -- RobertSchumann 2005-12-24 17:05:19
I've added mail notification method into the next version (0.97: try in the sample site) which will be uploaded soon. Since it uses the mail notification process in PageEditor, just subscribe to the page to get notification mail for the comments. -- SeungikLee 2005-12-27 14:33:14
Any idea why the preview button does not work in 0.97? When using the markup=1 parameter, the preview button is greyed out, but I can still press it and when I do, what I typed disappears completely. Is this a bug? --RichardHiers
It is a bug. In order to handle multiple pagecomment macros in a page, it uses form_id. If you entered a comment text with form_id=1, then only the first pagecomment macro will handle it. The form_id is incremented and stored in macro.form or request object. After editing a page, however, the page parsing is done twice - I don't know why - when redirected. If you inserted just one pagecomment macro in a page, the form_id should be #1 but #2 just after completing to edit the page. Thus, if you posted a comment just after editing a page, your input will be posted with form_id=#2, but the pagecomment macro whose actual form_id is #1 will ignore the input. To work it around, please don't add a comment just after editing a page: refresh it and add a comment. BTW, any hints for that without modifying other implementations e.g., request? -- SeungikLee 2006-01-09 05:26:32
I suggest to sort the smiley for easier choosing. For example: -- RuxLi 2006-05-09 02:03:48
Thanks for your valuable suggestion. I'll refrect this in the next update. To fix it now, please modify around the 485 line of PageComment2.py as the following. -- SeungikLee 2006-05-09 03:50:57
# ADD SMILEYS HERE TO BE USED: Globs.smileys = [':))', ':)', 'B)', ';)', ':\\', '|)', ':(', 'X-(']
Internal
- Someone proposed to use capcha instead of password. In fact, I don't know that this means exactly.
Gives a random numbers for a passwod as HenrikOmma proposed?
- or to block the spam writings?
Anyway, both of these proposals are very useful but I don't know how to deploy them, esp., the second functionality. Any hints for that? -- SeungikLee 2005-11-24 16:03:40
Bug Report
- Hi, it's really a great macro! ...but... I am using Version 0981 and I have to enter and save the first comment twice?! The first comment entered isn't saved although no error message appears.
Please help. -- ThomasSchloegl
I have the same problem as reported by the ThomasSchloegl above.
Bug:It seems that the first comment is lost for ever --- Mohammed Irfan. 2007-12-31
Bug: If #preview is in URL (right after saving) comment doesn't get saved. Any way to get pass this? -- JureKodzoman 2006-06-02 12:25:48
I can confirm this for Version 0.98.1 --ChristophKoenig 2007-06-15
Bug report... Try it with "modern" theme. All the page text that appears below the PageComment is blue. -- AndyCrews
I see this behavior with ie6.0 but not with Firefox1.0.7. -- AndyCrews
I'll check it soon. Thanks. -- SeungikLee 2005-11-21 01:35:14
I'm pretty sure this is an IE bug. I tried it with a few other browsers, and no problems. I also look at the HTML, and I don't see any errors. -- AndyCrews 2024-12-23 07:16:03
Version 0.98 - line 741: "commnet" should be "comment" -- ThiloPfennig 2006-04-25 09:19:04
Wish List
- Well, I want to underline the wish to use Latex-Parser in wiki
- It should be better if the comment were appended to the text of the page instead of beeing apart, plus the author, time and date of the comment.
- With the "markup" option must use the default parser of the page, not only the wiki formatter
-- alvaro.mtr@googlemail.com [ ]
I've installed PageComment2 in a MoinMoin DesktopEdtion 1.5.2-1 and it is working great. I'd like commentators to be able to input LaTeX expressions (I've got new-moinmoin-latex already working in the main Wiki). -- STLuk 2024-12-23 07:16:03
- I'll be using this as a log creation tool. As such, Id like to see the ability to put the date of a comment on the left or the right, and to consolidate the display so comments are displayed as
2006-12-02 Comment 2 blah blah blah 2006-11-30 Comment 1
with the goal of removing all the extra white space between the comments. In other words, run them all together with a left-justified fixed width date column to tag each comment. In our logs, the user is not important, only the date the comment was made. -- Matthew Miller 2006-12-09 06:25:30
I hope the patch I just posted in /Patches will help you out. I think that commentformat=dt should just about do it for you, or it should be pretty clear in the code now how to add a new code for just the date only without the time. (There's a dict of all the key characters called Globs.fieldinterps) Let me know if you have any questions. -- GlenWhitney 2007-01-07 02:00:58
I use this in an application for documenting computer networks; it's used to log changes to each component (server, router, firewall, etc). I would love to have a feature that allowed me to include the comments for each sub-page of a wiki in the comments for the entire wiki. For example, one client of mine has their main wiki page, let's say AcmeCorp. They have sub-pages for /server1, /server2, and /firewall. Each sub-page has a comments section, used to log changes to that device individually. The root page (AcmeCorp) has a comments section that is used to document overall changes. What I'd like is to add a parameter to the sub-page comments:
[[PageComment2(addToOther=..)]]
or such-like, so that any comments added to the /server1, server2, and /firewall page comment sections are also added to the comments section of the root page, this creating a complete overall log of changes. Thanks for the great addition to Moin! -- Mmiller 2007-09-03 06:07:00
Release 1
(moved from MacroMarket/PageComment)
bug reports, any suggestions are welcome! -- SeungikLee 2005-10-06 11:22:33
Great idea. I just installed it, and it works great. -- RichardHiers
I found out that there is a bug on handling non-ascii characters. In the end of deletecomment function, it should write u'o' and u'x' not just 'o' and 'x' in order to swap the status of the comment. I'll reflect this in the next version. -- SeungikLee 2005-10-06 15:08:26
I haven't tried this yet, but this looks great! I was starting to program something like this, but I was months away from anything real. Thanks! I will give some real feedback after I install it at work. -- TimCera 2005-10-06 20:27:42
First this is a really useful looking macro. The bug report I have is for Python 2.3.5 on Debian Linux. I get an error message during the add comment of "Failed to add the comment (internal error)". It fails someplace in the addcomment() function I think. If you have any suggestions, I'd love to hear them. mcgarrah@mcgarware.net
sorry for buggy macro. I'm not good at python so I cannot recognize what the problem is. Please try to re-run with commenting out the exception handling blocks to get the detailed error message. -- SeungikLee 2005-10-28 04:18:51
I'm running under Python 2.3.5 on mod_python 3.1.x in Debian. mod_python may be part of the problem. The apache logs didn't show much. I did trace it down to the files are being created but nothing is being saved into them. They are zero length. If I get it further narrowed down, I'll post it here. Thanks, mcgarrah@mcgarware.net
Just upgraded the code to version 0.97 and the problem I had in 0.82 with the file permissions went away. Thanks, mcgarrah@mcgarware.net
- Collecting ideas on changing this macro to use normal wiki page (i.e. comment page) for managing the comments. There are some issues:
to hide password (give no access on the comment page using acl All: ?)
remove the comment item (search & remove the item entry)
- how to add log entry on editing the comment page
- My scratch for that is:
- using a special parser to separate each entry of the comments. e.g.,
{ { {#!pagecomment ## [password] [name] [date/time] [location] [multi-line content] } } }
- Anybody can give a hint for that?
MoinMoin should be able to authenticate users for you. MoinMoin knows who I am when I login, and can detect it in some way since there are links to my page and user preferences. PageComment would only have to make sure that wherever comments are stored, that they can't be tampered with. -- TimCera 2005-11-02 14:26:29
I think that this macro is useful in the BlogNature. Most comments in a blog, there could be more anonymous users' rather than registered wiki users'. For example, I'm using MoinMoin as my personal home, and I disallow user registration on that. In the blog of my homepage, I want to receive some comments on the article from any anonymous users. If this macro does not allow to delete the comment posted once, anyway, that would be more simple. -- SeungikLee 2005-11-02 15:19:09
Instead of PageComment storing messages together in one place, how about in sequentially numbered sub-pages. That way ACL could be assigned by PageComment for each subpage. -- TimCera
I think this macro is a really great idea. I found the same problem as mcgarrah. I'm using DesktopEdition. The problem seems to be with the statement macro.request.user.host(). I replaced this with '0' and the problem went away. There is also another problem: If you post a comment and then refresh the page, you get a duplicate comment. Any ideas how to fix this? -- AndrewFerris 2005-11-15 22:48:29 This is fixed in 1.5 still wait for the next DesktopEdition rc1 -- ReimarBauer 2005-11-19 09:39:12
- How does 1.5 fix this behaviour?
- Suggestion
Thank you. I'm using PageComment2 in my wiki, since two years ago. By the way, I edited PageComment2 4~5 line for showing more comment information. Now, after someone write, PageComment2 show
#02 New comment by "id"
to comment
I replace 'New comment' to new comment's content 10 character
#01 test 2... by "id"
During one year, I have more benefit than showing 'id' because of monitoring with RecentChanges. So, I suggest this changes.
patch file This patch include localization part for Korea.
See Also
--NeoCoin 2008-02-08 13:11:00
This comment macro is great. - Please, will there be an update for version 1.9.3? There is some problem with a 'form' variable
On installing <<PageComment2>> on the FrontPage the following error appears <<PageComment2: execution failed ['Morsel' object has no attribute 'split'] (see also the log)>> --kksurendran AT NOSPAM iitbombay DOT org