Jot

任意のページにコメントフォームを設置。工夫すれば掲示板として運用することもできます。

Jotを用いて、簡易のコミュニティ機能を実装することができます。主にブログのコメント機能のような用途を想定していますが、カスタマイズの自由度が高いため掲示板として運用することも可能です。

ひとつのページに複数のJotインスタンスを設置することができます。逆に、複数ページに渡って共有できるひとつのJotインスタンスを設置することもできます。

ただいま翻訳が追いついてません。上記サイトの情報が充実してますので、参考にしてください。

https://github.com/yama/jot
ダウンロード

【導入時の注意】

出力をカスタマイズする場合は、PHx構文を記述する必要があります。マクロ言語に近いレベルの記述を行なう必要がありますので、導入時は事前にご確認ください。

Features

* Add comments to any (part of your) document
* Supports multiple instances on one page
* Database support
* Unlimited custom fields (separate for each instance)
* Pagination
* Sorting
* Subscriptions

Let users subscribe to each comment source so they can receive email notifications on new posts

* Moderation
o 公開・非公開
o 削除・編集・公開前のプレビュー
o メールによる投稿通知

Receive notifications on new comments (unpublished, containing bad words, or all content)
Send notification to document author when new comment is added

* Access control
o can view / post / moderate
o trusted users
* Anti-spam
o Captcha/Veriword validation
o Post delay
o Double post elimination
o Bad language filter

Specify bad words and take specific action (do nothing, unpublish, reject)

* Control output by using placeholders
* Enhanced templating (PHx enabled - not required)

Installation

New installation

1. Download and extract the archive.
2. Create a directory called "jot" in your [MODX Directory]/assets/snippets directory
3. FTP or copy the files into [MODX Directory]/assets/snippets/jot
4. Create a new snippet in the manager called "Jot" and copy/paste the contents of jot.snippet.txt into the code field.

Upgrade from previous version

1. Download and extract the archive.
2. Backup and delete the contents of [MODX Directory]/assets/snippets/jot
3. Copy the files into [MODX Directory]/assets/snippets/jot
4. Update the "Jot" snippet in the manager and copy/paste the contents of jot.snippet.txt into the code field.

簡単な使い方

[!Jot? &subscribe=`1` &pagination=`10`!]

または

[[Jot? &subscribe=`1` &pagination=`10`]]

Depending on your page cache settings.

主なパラメータ

&action

出力するブロックを指定します。

何も指定しない場合、formとcommentsを出力します。投稿フォームとコメント一覧の順番を入れ換えたい場合などにこのパラメータを用いるとよいでしょう。

&docid

docid as integer

Link instance to this document, defaults to parent document id.

&tagid

tagid as string [A-Za-z0-9]

Extra tag to use when two instances use the same docid.

&subscribe

* 0 (default)
* 1

* 0 = disable subscriptions.
* 1 = enable subscriptions.

&moderated

* 0 (default)
* 1

* 0 = new comments will be published
* 1 = new comments will be unpublished

a moderator/manager user can review before publishing.

&notify

* 0
* 1 (default)
* 2

Notify moderators specified by &canmoderate by email

* 0 = do not notify
* 1 = notify on new unpublished reply
* 2 = notify on every new reply

&subjectSubscribe

yes (string) Subject for subscription notification email.

&subjectModerate

string

Subject for moderator notification email.
&captcha yes

* 0 (default)
* 1
* 2

* 0 = disable captcha when posting.
* 1 = enable captcha when posting.
* 2 = enable captcha when posting, but disable it for logged in users.

&badwords

comma delimited list of words not allowed in post

best practice is to create a chunk with bad words separated by a comma and call Jot like:

&badwords=`{{MyBadwordsChunk}}`

to allow central administration of your badwords list.

Use the &bw parameter to specify the required action on detection.

&bw yes

* 0
* 1 (default)
* 2

When a word specified by &badwords is detected:

* 0 = do nothing.
* 1 = do not publish the comment.
* 2 = reject the comment.

&customfields

comma separated list of extra form fieldnames

Using this command will save the specified fields when posting.

defaults to "name,email". (Note: Be sure not to have spaces in comma separated list of custom fields in the Jot call.)

&authorid

id of source author

defaults to author value for the current document.

&title

title of source

defaults to longtitle value for the current document.

used for subject when left empty.

&css

* 0
* 1 (default)

* 0 = do not auto-include jot stylesheet in header
* 1 = auto-include jot stylesheet in header

&cssFile

relative path from MODX root to CSS file

default to location of the included jot.css

&sortby

comma separated sort string

syntax:

fieldname:a (for ascending) or fieldname:d (for descending) defaults to "createdon:d".

&numdir

* 0
* 1 (default)

* 0 = first comment lowest number.
* 1 = first comment highest number.

&validate

comma separated validate string

syntax: fieldname:message(:validation)

if a field name is entered in validate it automatically becomes a required field. if validation is omitted it assumes "required". other validations are:

* number
* email
* custom regular expression

examples:

* required field:
o "MyRequiredField:This field is required!"
* to validate an email field:
o "MyEmailField:Not a valid e-mail address.:email"
* to validate a number:
o "MyNumberField:Not a number.:number"
* to validate an hyphen separated US phonenumber by using custom regular expression:
o "MyPhoneField:Not a valid phonenumber:^[2-9]\d{2}-\d{3}-\d{4}$"
* Combinations of multiple validations:
o "MyRequiredField:This field is required!,MyEmailField:Not a valid e-mail address.:email,MyNumberField:Not a number.:number"

defaults to "content:You forgot to enter a comment."

&guestname

string

The anonymous authorname to use when none is specified.

defaults to: anonymous.

&postdelay

seconds as integer

number of seconds there must be between posts from the same user.

Enter 0 to disable, defaults to: 15.

&pagination

number of comments per page

* 0 = disable, show all comments on one page (default)
* 1 > enable paging with specified number.

&placeholders

* 0
* 1

* 0 = no placeholders are created (default)
* 1 = placeholders are created for every debug value (see &debug parameter)
o if no tagid is specified the placeholders are created like this:

[+jot.html.form+]

o if the tagid is specified the placeholders are created like this:

[+jot.html.form.tagid+]

&output

* 0
* 1

* 0 = hide output (can be used in combination with &placeholder parameter)
* 1 = show output (default)

&debug

* 0
* 1

* 0 = disable output of jot "hidden" variables. (default)
* 1 = enable output of jot "hidden" variables.

&trusted

comma delimited web groups

Comma delimited web groups that are trusted and have their comments

published by default when &moderated is set 1. Badwords also does not apply for trusted webgroups. Manager users are always trusted.

&canpost

comma delimited web groups

Comma delimited web groups that can post comments.

Leave blank for public posting.

&canview

comma delimited web groups

Comma delimited web groups that can view comments.

Leave blank for public viewing.

&canedit

comma delimited web groups

Comma delimited web groups that can edit their OWN comments.

Leave blank for no editing by users.
&canmoderate yes (comma delimited web groups) Comma delimited web groups that can moderate comments.

Leave blank for no webuser moderation (=moderation by using manager account).

&notifyAuthor

* 0 (Default)
* 1

Send the author of the document an email notification when someone posts a comment (v 1.1.3+)

&subjectAuthor

string

Subject for author notification email (v 1.1.3+)

Template parameters

parameter optional description

&tplForm

Template (HTML) for user form.

&tplComments

Template (HTML) for comment. This templates gets repeated for each comment.

&tplModerate

Template (HTML) for moderation block. This templates gets included once (top) in comment view

&tplNav

Template (HTML) for navigation bar. This templates gets included twice (top and bottom) in default comment view.

&tplSubscribe

Template (HTML) for subscriptions block. This templates gets included once (top) in comment view

&tplNotify

Template (TXT) for notification email for subscribers.

&tplNotifyModerator

Template (TXT) for notification email for moderators.

&tplNotifyAuthor

Template (TXT) for notification email for author (v 1.1.3+)

&cssRowAlt

CSS style classname for alternate row.

&cssRowMe

CSS style classname for current user row.

&cssRowAuthor

CSS style classname for author row.

If you are using templates, create a chunk in MODX, you can get the default templates from the jot/template directory

Examples

Feel free to add your own examples to the list.

simple

[[Jot? &subscribe=`1` &pagination=`10`]]

simple: alternate sorting

[[Jot? &subscribe=`1` &pagination=`10` &sortby=`createdon:a`]]

moderated

[[Jot? &subscribe=`1` &pagination=`10` &moderated=`1`]]

moderated: trusted

* allow subscriptions
* paginated: 10 comments per page
* new posts are unpublished and need to be published by a moderator (in this case a manager user)
* new posts by users that are member of the "Trusted Users" webgroup will be published.

[[Jot? &subscribe=`1` &pagination=`10` &moderated=`1` &trusted=`Trusted Users`]]

anti-spam: automatic

* paginated: 10 comments per page
* captcha validation for everyone
* if a bad word is detected the post will be rejected
* the badwordlist is a chunk containing words separated by a comma

[[Jot? &pagination=`10` &captcha=`1` &badwords=`{{myBadwordList}}` &bw=`2`]]

anti-spam: moderated

* paginated: 10 comments per page
* captcha validation for everyone
* if a bad word is detected the post will be unpublished and a notify will be send out to the moderators.
* webusers in the "Jot Moderators" webgroup can moderate comments
* the badwordlist is a chunk containing words separated by a comma

[[Jot? &pagination=`10` &captcha=`1` &canmoderate=`Jot Moderators` &badwords=`{{myBadwordList}}` &bw=`1`]]

Tips & Tricks

Best practice for including comments

The best practice for comment-enabling your documents is to create a chunk for each type of Jot call you will use. Include each chunk in a template and link it to your articles. Try to avoid direct jot calls in the content field of a document (even if it's a chunk).

Extended MODX templating

Jot uses an internal template handler that includes the functionality of the PHx plugin available from the repository. For more details on the modifiers check its description here.

Note: Jot does not require that the PHx plugin is installed. If not installed PHx functionality will still be available, but for the Jot templates only.

Active identity

When logged in as both web- and manager user your webuser identity will over-rule your manager identity but your permissions will be the same. When logged in as a manager user you will always have moderator options.

Custom fields

The custom fields you specify with &customfields will have to be added to your form chunk manually. The default templates holds an example of how a guest form looks (added fields here are: name and email)

NOTE: Be sure to prefix custom. to custom field. ie.

 [+comment.custom.customfieldname.url+]

Bad words

Bad words are checked on all input, including custom fields.

URL/Link generation

All generated links by Jot will preserve the current querystring and only the variables specific for the Jot instance are altered if necessary. This ensures that the current page state (that could be altered by other snippets on the same page) is preserved.

レイアウトのアイデア

To change the way jot outputs your forms including where moderator comments and actual comments appear use your call as normal

[[Jot? &placeholders=`1` &output=`0` &pagination=`10` &captcha=`1` &canmoderate=`Jot Moderators` &badwords=`{{myBadwordList}}` &bw=`1`]]

Please note: You need to set

&placeholders=`1` &output=`0`

Then, you can add these placeholders calls in your page where the Jot call is.

[+jot.html.navigation+] - First. places the navigation on the page
[+jot.html.comments+] - Second. places the comment of the page
[+jot.html.moderate+] - Third. places moderated info on the page
[+jot.html.form+] - Fourth. places the form on the page

You can change the order as you see fit, the example has the comments first then the form is last but you could have.

[+jot.html.form+] - First. places the form on the page
[+jot.html.comments+] - Second. places the comment of the page
[+jot.html.moderate+] - Third. places moderated info on the page
[+jot.html.navigation+] - Fourth. places the navigation on the page

PR

  • KAGOYA
  • ASP at AKIHABARA Japan
  • CMS AWARDS 2007 Winner
ページトップへ