MODx/Встроенные сниппеты/Jot: различия между версиями

Содержимое удалено Содержимое добавлено
м Категоризация по запросу на w:ВП:РДБ
Нет описания правки
Строка 30:
 
5) Сохраните
 
== Пример вызова ==
 
<source lang="php">[!Jot? &subscribe=`1` &pagination=`10`!]</source>
 
или
 
<source lang="php">[[Jot? &subscribe=`1` &pagination=`10`]]</source>
 
В зависимости от того кешируется или нет.
 
 
Строка 74 ⟶ 64 :
.jot-extra {text-align: right;}
.jot-editby {font-size: 10px;color: #666666;font-style: italic;}</source>
 
 
<h2>Использование</h2>
<ul><li> <pre>[!Jot? &amp;subscribe=`1` &amp;pagination=`10`!]</pre>
</li></ul>
<p>или</p>
 
<ul><li> <pre>[[Jot? &amp;subscribe=`1` &amp;pagination=`10`]]</pre>
</li></ul>
<p>В зависимости от того кешируется или нет.</p>
 
 
<h3>Параметры</h3>
<table style="text-align: left; border:1px solid #ccc" cellpadding="5" cellspacing="0" border="1">
<tr>
<th> parameter
</th><th> optional
</th><th> value
 
</th><th> description
</th></tr>
<tr>
<th> &amp;action
</th><td>yes
</td><td>
<ul><li> default (form &amp; comments)
</li><li> count-comments
</li><li> count-subscriptions
</li><li> comments
 
</li><li> form
</li></ul>
</td><td> Controls what to display
</td></tr>
<tr>
<th> &amp;docid
</th><td>yes
</td><td> (docid as integer)
</td><td> Link instance to this document, defaults to parent document id.
</td></tr>
<tr>
<th> &amp;tagid
 
</th><td>yes
</td><td> (tagid as string [A-Za-z0-9])
</td><td> Extra tag to use when two instances use the same docid.
</td></tr>
<tr>
<th> &amp;subscribe
</th><td>yes
</td><td>
<ul><li> 0 (default)
</li><li> 1
</li></ul>
</td><td>
 
<ul><li> 0 = disable subscriptions.
</li><li> 1 = enable subscriptions.
</li></ul>
</td></tr>
<tr>
<th> &amp;moderated
</th><td>yes
</td><td>
<ul><li> 0 (default)
</li><li> 1
</li></ul>
</td><td>
 
<ul><li>0 = new comments will be published
</li><li>1 = new comments will be unpublished
<dl><dd>a moderator/manager user can review before publishing.
</dd></dl>
</li></ul>
</td></tr>
<tr>
<th> &amp;notify
</th><td>yes
</td><td>
<ul><li> 0
</li><li> 1 (default)
</li><li> 2
 
</li></ul>
</td><td>
<p>Notify moderators specified by <b>&amp;canmoderate</b> by email
</p>
<ul><li>0 = do not notify
</li><li>1 = notify on new unpublished reply
</li><li>2 = notify on every new reply
</li></ul>
</td></tr>
<tr>
<th> &amp;subjectSubscribe
</th><td>yes
</td><td>(string)
 
</td><td>Subject for subscription notification email.
</td></tr>
<tr>
<th> &amp;subjectModerate
</th><td>yes
</td><td>(string)
</td><td>Subject for moderator notification email.
</td></tr>
<tr>
<th> &amp;captcha
</th><td>yes
</td><td>
<ul><li> 0 (default)
</li><li> 1
 
</li><li> 2
</li></ul>
</td><td>
<ul><li>0 = disable captcha when posting.
</li><li>1 = enable captcha when posting.
</li><li>2 = enable captcha when posting, but disable it for logged in users.
</li></ul>
</td></tr>
<tr>
<th> &amp;badwords
</th><td>yes
</td><td>(comma delimited list of words not allowed in post)
</td><td>best practice is to create a chunk with bad words separated by a comma and call Jot like:
<pre>&amp;badwords=`{{MyBadwordsChunk}}`</pre> to allow central administration of your badwords list.
 
<p>Use the <b>&amp;bw</b> parameter to specify the required action on detection.
</p>
</td></tr>
<tr>
<th> &amp;bw
</th><td>yes
</td><td>
<ul><li> 0
</li><li> 1 (default)
</li><li> 2
 
</li></ul>
</td><td>When a word specified by <b>&amp;badwords</b> is detected:
<ul><li> 0 = do nothing.
</li><li> 1 = do not publish the comment.
</li><li> 2 = reject the comment.
</li></ul>
</td></tr>
<tr>
<th> &amp;customfields
</th><td>yes
 
</td><td>(comma separated list of extra form fieldnames)
</td><td>Using this command will save the specified fields when posting.
<p>defaults to "name,email". (Note: Be sure not to have spaces in comma separated list of custom fields in the Jot call.)
</p>
</td></tr>
<tr>
<th> &amp;authorid
</th><td>yes
</td><td>(id of source author)
</td><td>defaults to author value for the current document.
</td></tr>
<tr>
<th> &amp;title
</th><td>yes
</td><td>(title of source)
 
</td><td>defaults to longtitle value for the current document.
<p>used for subject when left empty.
</p>
</td></tr>
<tr>
<th> &amp;css
</th><td>yes
</td><td>
<ul><li> 0
</li><li> 1 (default)
</li></ul>
</td><td>
<ul><li>0 = do not auto-include jot stylesheet in header
</li><li>1 = auto-include jot stylesheet in header
 
</li></ul>
</td></tr>
<tr>
<th> &amp;cssFile
</th><td>yes
</td><td>(relative path from modx root to CSS file)
</td><td> default to location of the included jot.css
</td></tr>
<tr>
<th> &amp;sortby
</th><td>yes
</td><td>(comma separated sort string)
</td><td>syntax:
<p>fieldname:a (for ascending) or
fieldname:d (for descending)
defaults to "createdon:d".
 
</p>
</td></tr>
<tr>
<th> &amp;numdir
</th><td>yes
</td><td>
<ul><li> 0
</li><li> 1 (default)
</li></ul>
</td><td>
<ul><li>0 = first comment lowest number.
</li><li>1 = first comment highest number.
</li></ul>
</td></tr>
 
<tr>
<th> &amp;validate
</th><td>yes
</td><td>(comma separated validate string)
</td><td>syntax: fieldname:message(:validation)
<p>if a field name is entered in validate it automatically becomes a required field. if validation is omitted it assumes "required".
other validations are:
</p>
<ul><li> number
</li><li> email
</li><li> custom regular expression
</li></ul>
<p>examples:
</p>
 
<ul><li>required field:
<ul><li> "MyRequiredField:This field is required!"
</li></ul>
</li><li>to validate an email field:
<ul><li> "MyEmailField:Not a valid e-mail address.:email"
</li></ul>
</li><li>to validate a number:
<ul><li>"MyNumberField:Not a number.:number"
</li></ul>
</li><li>to validate an hyphen separated US phonenumber by using custom regular expression:
<ul><li> "MyPhoneField:Not a valid phonenumber:^[2-9]\d{2}-\d{3}-\d{4}$"
</li></ul>
</li><li>Combinations of multiple validations:
<ul><li> "MyRequiredField:This field is required!,MyEmailField:Not a valid e-mail address.:email,MyNumberField:Not a number.:number"
 
</li></ul>
</li></ul>
<p><br>
</p><p>defaults to "content:You forgot to enter a comment."
</p><p><br>
</p>
</td></tr>
<tr>
<th> &amp;guestname
</th><td>yes
</td><td>(string)
</td><td>The anonymous authorname to use when none is specified.
<p>defaults to: anonymous.
</p>
</td></tr>
<tr>
 
<th> &amp;postdelay
</th><td>yes
</td><td>(seconds as integer)
</td><td>number of seconds there must be between posts from the same user.
<p>Enter 0 to disable, defaults to: 15.
</p>
</td></tr>
<tr>
<th> &amp;pagination
</th><td>yes
</td><td>(number of comments per page)
</td><td>
<ul><li>0 = disable, show all comments on one page (default)
</li><li>1 &gt; enable paging with specified number.
 
</li></ul>
</td></tr>
<tr>
<th> &amp;placeholders
</th><td>yes
</td><td>
<ul><li> 0
</li><li> 1
</li></ul>
</td><td>
<ul><li>0 = no placeholders are created (default)
</li><li>1 = placeholders are created for every debug value (see <b>&amp;debug</b> parameter)
 
<ul><li>if no tagid is specified the placeholders are created like this:<pre>[+jot.html.form+]</pre>
</li><li>if the tagid is specified the placeholders are created like this: <pre>[+jot.html.form.tagid+]</pre>
</li></ul>
</li></ul>
</td></tr>
<tr>
<th> &amp;output
</th><td>yes
</td><td>
<ul><li> 0
</li><li> 1
 
</li></ul>
</td><td>
<ul><li>0 = hide output (can be used in combination with <b>&amp;placeholder</b> parameter)
</li><li>1 = show output (default)
</li></ul>
</td></tr>
<tr>
<th> &amp;debug
</th><td>yes
</td><td>
<ul><li> 0
</li><li> 1
 
</li></ul>
</td><td>
<ul><li>0 = disable output of jot "hidden" variables. (default)
</li><li>1 = enable output of jot "hidden" variables.
</li></ul>
</td></tr>
<tr>
<th> &amp;trusted
</th><td>yes
</td><td>(comma delimited web groups)
</td><td>Comma delimited web groups that are trusted and have their comments
<p>published by default when <b>&amp;moderated</b> is set 1. Badwords also does
not apply for trusted webgroups. Manager users are always trusted.
</p>
 
</td></tr>
<tr>
<th> &amp;canpost
</th><td>yes
</td><td>(comma delimited web groups)
</td><td>Comma delimited web groups that can post comments.
<p>Leave blank for public posting.
</p>
</td></tr>
<tr>
<th> &amp;canview
</th><td>yes
</td><td>(comma delimited web groups)
</td><td>Comma delimited web groups that can view comments.
<p>Leave blank for public viewing.
 
</p>
</td></tr>
<tr>
<th> &amp;canedit
</th><td>yes
</td><td>(comma delimited web groups)
</td><td>Comma delimited web groups that can edit their OWN comments.
<p>Leave blank for no editing by users.
</p>
</td></tr>
<tr>
<th> &amp;canmoderate
</th><td>yes
</td><td>(comma delimited web groups)
</td><td>Comma delimited web groups that can moderate comments.
 
<p>Leave blank for no webuser moderation (=moderation by using manager account).
</p>
</td></tr>
<tr>
<th> &amp;notifyAuthor
</th><td>yes
</td><td>
<ul><li> 0 (Default)
</li><li> 1
</li></ul>
</td><td>Send the author of the document an email notification when someone posts a comment (v 1.1.3+)
</td></tr>
<tr>
<th> &amp;subjectAuthor
 
</th><td>yes
</td><td>(string)
</td><td>Subject for author notification email (v 1.1.3+)
</td>
</table>
 
 
<h3>Переменные шаблона (TV)</h3>
<table style="text-align: left; border:1px solid #ccc" cellpadding="5" cellspacing="0" border="1">
<tr>
<th> parameter
</th><th> optional
</th><th> description
 
</th></tr>
<tr>
<th> &amp;tplForm
</th><td>yes
</td><td> Template (HTML) for user form.
</td></tr>
<tr>
<th> &amp;tplComments
</th><td>yes
</td><td> Template (HTML) for comment. This templates gets repeated for each comment.
</td></tr>
<tr>
<th> &amp;tplModerate
 
</th><td>yes
</td><td> Template (HTML) for moderation block. This templates gets included once (top) in comment view
</td></tr>
<tr>
<th> &amp;tplNav
</th><td>yes
</td><td> Template (HTML) for navigation bar. This templates gets included twice (top and bottom) in default comment view.
</td></tr>
<tr>
<th> &amp;tplSubscribe
</th><td>yes
</td><td> Template (HTML) for subscriptions block. This templates gets included once (top) in comment view
 
</td></tr>
<tr>
<th> &amp;tplNotify
</th><td>yes
</td><td> Template (TXT) for notification email for subscribers.
</td></tr>
<tr>
<th> &amp;tplNotifyModerator
</th><td>yes
</td><td> Template (TXT) for notification email for moderators.
</td></tr>
<tr>
<th> &amp;tplNotifyAuthor
 
</th><td>yes
</td><td> Template (TXT) for notification email for author (v 1.1.3+)
</td></tr>
<tr>
<th> &amp;cssRowAlt
</th><td>yes
</td><td> CSS style classname for alternate row.
</td></tr>
<tr>
<th> &amp;cssRowMe
</th><td>yes
</td><td> CSS style classname for current user row.
 
</td></tr>
<tr>
<th> &amp;cssRowAuthor
</th><td>yes
</td><td> CSS style classname for author row.
</td></tr></table>
<p>If you are using templates, create a chunk in modx, you can get the default templates from the jot/template directory
</p>
 
 
== Ссылки ==