%WATCHLIST{...}%
variable. All watchlist interaction is done using this variable.
Parameter | Description | Default |
---|---|---|
"..." oraction="..." |
Action to take | "showwatchlink" |
Action: "showwatchlink" | Default | |
"showwatchlink" |
Action: Show "Watch" / "Unwatch" link | |
format="..." |
Format of link. Supported variables: • $url - URL to toggle the watch state. • $watch - "Watch" if page is not watched, else "Unwatch". |
"[[$url][$watch]]" |
Action: "showwatchlistlink" | Default | |
"showwatchlistlink" |
Action: Show link of a user's watchlist topic | |
format="..." |
Format of link. Supported variables: • $url - URL of the watchlist topic. In case the topic does not exist, a special URL is returned so that the topic with the proper format can be created. • $wikiname - WikiName of user. |
"[[$url][Watchlist Changes]]" |
wikiname="..." |
WikiName of user | logged-in user |
Action: "togglewatch" | Default | |
"togglewatch" |
Action: Toggle the watch state of a topic. The URL parameter watchlist_topic must specify the Web.TopicName . |
|
Action: "showchanges" | Default | |
"showchanges" |
Action: Show watchlist changes of topics a user is watching | |
header="..." |
Header of watchlist changes. Supported variable: • $n or $n() - newline. |
{ChangesHeader} |
format="..." |
Format of one entry of watchlist changes. Supported variables: • $web - name of web. • $topic - topic name. • $title - topic title, or spaced topic name if title does not exist. • $date - change date of topic. • $rev - revision of topic. • $wikiname - WikiName of last author. • $percnt - percent sign. • $n or $n() - newline. |
{ChangesFormat} |
footer="..." |
Footer of watchlist changes. Supported variable: • $n or $n() - newline. |
{ChangesFooter} |
separator="..." |
Separator between entries. Supported variable: • $n or $n() - newline. |
"$n" |
limit="..." |
Limit number of topics. | URL parameter limit or "50" |
empty="..." |
Message shown if no topics are watched. Supported variable: • $percnt - percent sign. |
{EmptyMessage} |
Action: "watched" | Default | |
"watched" |
Action: Show table of with all watched topics, with checkboxes to unwatch topics. The form action points to the "updatelist" action. | |
topics="..." |
List of watched topics in Web.TopicName format. The plugin stores the watchlist using this variable action in the user's watchlist topic. |
"" |
Action: "updatelist" | Default | |
"updatelist" |
Action: Update the watched topics list. The URL parameter watchlist_topic must specify the Web.TopicName of the topic to update. A list of URL parameters named watchlist_item represents the list of watched topics, each one of format Web.TopicName . |
|
Action: "preferences" | Default | |
"preferences" |
Action: Show a form with preferences options. The form action points to the "updatepreferences" action. | |
notification="..." |
Notification preference: "n0" - none, "n1" immediate, "n2" digest. The plugin stores the notification preference using this variable action in the user's watchlist topic. |
"n0" |
Action: "updatepreferences" | Default | |
"updatepreferences" |
Action: Update the watchlist preferences. The URL parameter watchlist_topic must specify the Web.TopicName of the topic to update. The URL parameter named notification indicates the new preference, one of n0 , n1 or n2 . |
{...}
are abbreviated configure settings. For example {ChangesFormat}
is the {Plugins}{WatchlistPlugin}{ChangesFormat}
configure setting.
watchlist_action
URL parameter. If present, one of the above actions are taken.
watchlistdigestnotify.tmpl
template file is the e-mail template for digest notification. It is located in the twiki/templates
directory. The plugin handles the TWiki variables, and in addition these special variables:
Variable | Expands to |
---|---|
%WATCHLISTTO% |
E-mail "To" list, comma-space separated |
%WATCHCHANGESTEXT% |
The watchlist changes in text format. The format of a changes entry is defined by the {Plugins}{WatchlistPlugin}{NotifyTextFormat} configure setting |
%WATCHLISTUSER% |
WikiName of user being notified |
watchlistimmediatenotify.tmpl
template file is the e-mail template for immediate notification. It is located in the twiki/templates
directory. The plugin handles the TWiki variables, and in addition these special variables:
Variable | Expands to |
---|---|
%WATCHLISTTO% |
E-mail "To" list, comma-space separated |
%WATCHLISTUSER% |
WikiName of user being notified |
%WATCHWEB% |
Name of updated topic |
%WATCHTOPIC% |
Name of updated web |
%WATCHTITLE% |
Title of updated topic |
%WATCHUSER% |
WikiName of last author of updated topic |
%WATCHREV% |
Revision of updated topic |
%WATCHDATE% |
Update date of of topic |
WatchlistPlugin.zip
in your twiki installation directory. Content: File: | Description: |
---|---|
data/TWiki/WatchlistPlugin.txt | Plugin topic |
data/TWiki/WatchlistTemplate.txt | Template topic for watchlist topics |
pub/TWiki/WatchlistPlugin/*png | Screenshots |
templates/watchlistdigestnotify.tmpl | E-mail template for digest notification |
templates/watchlistimmediatenotify.tmpl | E-mail template for immediate notification |
lib/TWiki/Plugins/WatchlistPlugin.pm | Plugin Perl module |
lib/TWiki/Plugins/WatchlistPlugin/Core.pm | Plugin core module |
lib/TWiki/Plugins/WatchlistPlugin/Config.spec | Configure spec file |
tools/watchlistnotify | Command-line script for digest notification |
$TWiki::cfg{Plugins}{WatchlistPlugin}{ChangesFormat}
# Format of one line of recently changed topics in the watchlist. Supported variables: $web: Name of web, $topic: Topic name, $title: Topic title, $date: Date of last change, $rev: Last revision number, $wikiname: WikiName of last user, $n or $n(): Newline. $TWiki::cfg{Plugins}{WatchlistPlugin}{ChangesHeader}
# Format of the header of the recently changed topic list. Supported variable: $n or $n(): Newline. $TWiki::cfg{Plugins}{WatchlistPlugin}{ChangesFooter}
# Format of the footer of the recently changed topic list. Supported variable: $n or $n(): Newline. $TWiki::cfg{Plugins}{WatchlistPlugin}{EmptyMessage}
# Text shown in the recent changes and watchlist topics screen if no topics are watched. $TWiki::cfg{Plugins}{WatchlistPlugin}{NotifyTextFormat}
# Format of one topic in the digest notification e-mail. Supported variables: $web: Name of web, $topic: Topic name, $title: Topic title, $date: Date of last change, $rev: Last revision number, $wikiname: WikiName of last user, $viewscript: URL of view script, $n: newline. $TWiki::cfg{Plugins}{WatchlistPlugin}{AnchorName}
# Anchor name to jump to after submit. Leave empty for no anchor jump. $TWiki::cfg{Plugins}{WatchlistPlugin}{UseEmailField}
# Use the "Email" form field of user profile topics instead of the e-mail stored in the password system. This is useful if LDAP authentication is used. $TWiki::cfg{Plugins}{WatchlistPlugin}{Debug}
# Debug plugin. See output in data/debug.txt
cron
(or equivalent) job to run the tools/watchlistnotify
script. The script must be run as the webserver user and can be used as follows from the command-line:
$ cd /var/www/twiki/bin $ ../tools/watchlistnotifyChange first to the twiki bin directory so that the script can find the TWiki libraries. An optional
quiet=1
parameter can be specified to suppress progress output.
This example shows a crontab entry for user apache
on a RedHat or CentOS server that sends daily digest notification at 01:00, and logs the progress output:
00 01 * * * (cd /var/www/twiki/bin; nice ../tools/watchlistnotify >/var/www/twiki/data/watchlistnotify-log.txt 2>&1)The tool can also be called from any directory if the twiki bin directory is specified. Example:
00 00 * * * cd /var/www/twiki/tools && perl -I /var/www/twiki/bin ./watchlistnotify quiet=1Note: Multiple instances of the watchlistnotify script are not allowed to be executed simultaneously. 4. Upgrade the TopMenuSkin to get a "Watch" Pulldown Menu: To show a "Watch" pulldown menu next to the "Edit" pulldown, upgrade the TopMenuSkin to version 2013-02-26 or later, or add the following to TopMenuSkinTopicMenu just before the
%STOPINCLUDE%
:
%IF{ "context WatchlistPluginEnabled AND context authenticated" then=" * $percntWATCHLIST{ \"showwatchlink\" format=\"<a href='$url' title='$watch this topic'>$watch %ICON{ "menu-down" format="<img src='$urlpath' width='$width' height='$height' border='0' alt='' />" }%</a>\" }$percnt * $percntWATCHLIST{ \"showwatchlistlink\" format=\"[[$url][Watchlist Changes]]\" }$percnt" else="<nop>" }%5. Upgrade the TWikiUserMappingContrib to get the "Watchlist Changes" box in the user profile topics: To add the "Watchlist Changes" box to the user profile topics, upgrade the TWikiUserMappingContrib to version 2013-02-26 or later, or update the Main.UserProfileHeader to the latest version at TWikisvn:TWikiUserMappingContrib/data/Main/UserProfileHeader.txt. 6. Patch viewtopicactionbuttons to get a "Watch" Link in the Topic Action Row: To add a "Watch" link to the bottom topic action row, edit
templates/viewtopicactionbuttons.tmpl
and make the following two modifications.
1. In template definition %TMPL:DEF{"topicactionbuttons"}%
, add %TMPL:P{"action_watch"}%
before %TMPL:P{"action_printable"}%
.
2. Add the following two template definitions:
%TMPL:DEF{"action_watch"}%%TMPL:P{context="WatchlistPluginEnabled" then="watch_link" else=""}%%TMPL:END% %TMPL:DEF{"watch_link"}%<span>%IF{ "context authenticated" then="$percntWATCHLIST{showwatchlink}$percnt" else="<strike>Watch</strike>" }%</span>%TMPL:P{"sep"}%%TMPL:END%7. Test the Plugin: Test if the installation was successful by watching and unwatching topics.
Plugin Author: | TWiki:Main.PeterThoeny |
Copyright: | © 2013-2014 Wave Systems Corp. © 2014 TWiki:Main.PeterThoeny & TWiki:TWiki.TWikiContributor |
License: | GPL (GNU General Public License) |
Sponsor: | Wave Systems Corp. |
Plugin Version: | 2014-05-20 |
2014-05-20: | TWikibug:Item7411: In list of webs, exclude webs the current user has no view access |
2014-05-19: | TWikibug:Item7495: Execute bit missing in tools/watchlistnotify; doc fix |
2014-04-30: | TWikibug:Item7411: Layout improvements in watchlist topic; doc fixes |
2014-02-06: | TWikibug:Item7411: Improve caching, correct order of change processing, fix table alignment, add watch all topics in web and watch new topics in web, apply perltidy, report last change date in verbose watchlistnotify, make watchlistnotify run under 4.x, fix for mod_perl & mod_perl-masked environment -- TWiki:Main.TimotheLitt |
2014-01-16: | TWikibug:Item7409: Don't notify oneself -- TWiki:Main.TimotheLitt |
2013-04-11: | TWikibug:Item7154: Minor doc fixes |
2013-03-15: | TWikibug:Item7215: Log watchlist changes & e-mail notification actions |
2013-03-15: | TWikibug:Item7143: Change default notification from "none" to "immediate" |
2013-03-11: | TWikibug:Item7143: Sanitize watchlist_topic parameter |
2013-03-06: | TWikibug:Item7143: Support new $title variable that expands to the topic title, or the spaced topic name if the title does not exist |
2013-03-05: | TWikibug:Item7143: The "showwatchlistlink" action now returns full URL instead of Web.Topic link so that it can be used in a a HTML tag. |
2013-03-04: | TWikibug:Item7143: Initial version |
TWiki Dependency: | $TWiki::Plugins::VERSION 1.2 |
CPAN Dependencies: | none |
Other Dependencies: | none |
Perl Version: | 5.005 |
Plugin Benchmarks: | GoodStyle nn%, FormattedSearch nn%, WatchlistPlugin nn% |
Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/WatchlistPlugin |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/WatchlistPluginDev |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/WatchlistPluginAppraisal |