AddToWatchlist-Talk

Summary: Talk page for AddToWatchlist.
Maintainer: Petko
Users: +1 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

I noticed that on new page creation, there is no ending anchor-tag created, only a beginning. Is the ending tag necessary to tell a pagelist where to stop? And, since this is a watchlist-for-changes, would it not also be beneficial to provide some configurable formats to display the watch-for-changes listings instead of just a page list actually on that page while comment-div'ing the pages being listed?
--Marcus 20170813, 00:01 CST

This anchor is where a new page will be added to the trail, and is intended to be at the top of the trail so the person who just added that page can see it immediately and return to it. No, an ending tag is not necessary. This list is not a PageList, it is a WikiTrail, and it is intended to be used for Notify, or for actual pagelists (with the trail= argument with a custom PageListTemplate). About automatically having content on all watchlists, you could use a GroupHeader with a conditional like (:if name *-Watchlist:)content shown on watchlists, eg (:pagelist order=-time trail={*$FullName} fmt=#customPLtemplate:) (:div99 style="display:none;":)(:ifend:) and the "div99" will actually hide the rest of the page where the trail is. --Petko August 13, 2017, at 02:27 AM


If the watchlist page was not present, it was also not newly created and had to be created manually. I assume this is a script design issue.
Also, is there any reason why after creating a profile watchlist page and even some preliminary list information on it, that the script would not update the watchlist page just using the default information? The instructions were followed for adding the postconfig, the format variable (tried before and after script), and the page action - the watchlist page will not update.
--Marcus 20170808, 03:14 CST
v2.2.101 with config mod.

None of these is normal. If a watchlist page does not exist, it is created automatically. If such a page exists, with or without preliminary information, the newly watched item is added in it. In both cases, when you press the "watch" link, you are redirected to the watchlist page and see the newly added page -- what happens in your case? If you don't have an author name, or edit permissions for the watchlist, a form will appear to enter your name and/or password before continuing. --Petko August 08, 2017, at 09:06 PM

After reviewing your installation, the RequireSummary recipe was not compatible with this one and didn't allow the watchlist to be saved. This is fixed in the latest version. Additionally if the saving fails for some (other) reason, any messages about it will be shown. --Petko August 10, 2017, at 03:00 AM


This is a wonderful recipe. It could be even better with a few more configuration options.

It appears the watchlist can be kept on a page other than the author's Profiles page (or that page with a suffix). For example, I seem to be able to use in config $AuthorListPage="MyPrivateGroup.$Author";. Is that safe to do?

Yes, from version 20110322 you can use $WatchlistTrailFmt = 'MyPrivateGroup.{$Name}';, documentation updated. --Petko March 22, 2011, at 04:23 AM

FYI, I think you made a typo in your script. In version 20110322c I have to specify "Watchist" not "Watchlist" to get it to work. RandyB March 25, 2011, at 01:13 PM

Thanks, corrected. --Petko March 25, 2011, at 01:29 PM

Is there a way to specify terminology other than "Watch" and "Unwatch" - for example "Star" and "UnStar" or "Remember" and "Forget"?

Yes, you can "set" the English "translations" like this:
XLSDV('en',array('Watch' => 'Star', 'Unwatch'=>'Forget')); --Petko March 21, 2011, at 02:40 PM

Is there a way to control where redirection goes after the post, for example, if I want the user to stay on the current page rather than go to the page where the list is stored?

Yes, you can add to the special link url &goto={*$FullName} like:
[[{*$FullName}?action={*$WatchlistAction}&goto={*$FullName} | {*$WatchlistText}]]
After some use I found that most often I prefer to see the watchlist, and if I want to stay on the current page, I'll middle-click the Watch link to open a new tab. --Petko March 21, 2011, at 02:40 PM

You can also redirect to a fixed page with &goto=Group.Page in the link or you can set a default redirect page with the variable $WatchlistRedirectFmt = "Group.Page"; in config.php. Petko March 22, 2011, at 04:44 AM

Is there a way to encode extra info in the target? For example, "&goto=Site.Watchlist?extrainfo=Preferences.{$Author}%23AddToWatchlist" won't work because the extrainfo would be dropped. - RandyB March 21, 2011, at 06:49 PM

How would you use this extra info? If I understand correctly, you want a single watchlist page for all users, which would construct pagelists based on the author name (brilliant idea)? In that case, I think it is better to use a page variable, either create one or use {$WatchlistTrail} added in version 20110322a. Petko March 22, 2011, at 04:44 AM

For example on my watchlist page I might have "[[{$?returnto}|Return to {$?returnto}]]" and the page might make use of "{$?MaxPagesToShow}". I use URL parameters for all sorts of things. RandyB March 22, 2011, at 06:00 AM

The "Return to Page" link can be done with something like (:pagelist trail={$WhachlistTrail} count=1 fmt=#my_return_fmt:). The max number could be set in a different way - preference, page variable for a different page, pagelist with request=1 parameter, etc.. In case you have to pass such and other things in the link url, you can write a custom $WatchRedirectFunction which can append these things to the url that this recipe returns. --Petko March 22, 2011, at 05:50 PM

You can probably anticipate my next question...

Can I use an image such as an uncolored star for Watch and colored star for UnWatch - thereby allowing the user to toggle the page on and off the list? ("Starred pages" are becoming common - for example in Google Docs.)

- RandyB March 21, 2011, at 12:43 PM

Great idea. You could do the same as with the English "translation", use the "★" star or ♡ ♥ hearts Unicode characters. You can use grey and gold colors if you like:
XLSDV('en',array('Watch' => '%gray%★%%', 'Unwatch'=>'%color=gold%★%%'));
There is a list with several special characters here [1] [2].

You could even set star icons, just use the url address like you would include a picture:

XLSDV('en',array(
  'Watch' => 'http://yoursite/pub/star-gray.png"Page not in your watchlist. Click to add it."',
  'Unwatch'=>'http://yoursite/pub/star-gold.png"Page in your watchlist. Click to remove it."'));

It is probably a good idea to add "tooltip titles" to the icons (see PmWiki:Images) so that your users know what the icons do. --Petko March 21, 2011, at 03:21 PM

Found a problem: "Watching" or "unwatching" a page eliminates the history for the target page where I keep my list. RandyB March 21, 2011, at 01:42 PM

Nice catch, thanks, fixed in 20110321a (just released). --Petko March 21, 2011, at 02:40 PM

Comment lier cette recette avec notify ?

Les membres peuvent choisir les pages à suivre, mais les mails ne sont pas envoyé... Pourtant, j'ai bien ajouté $EnableNotify = 1; dans config.php

Il y a un truc que je ne comprend pas !

Merci d'avance !Manu February 22, 2012, at 02:55 PM

Pour chaque utilisateur, il faut ajouter dans SiteAdmin.NotifyList une telle ligne:
notify=adresse@domaine.fr trail=Profiles.Petko-Watchlist
où après notify= c'est l'adresse de l'utilisateur, et après trail= c'est sa propre page avec sa liste de suivi, définie avec $WatchlistTrailFmt. Effectivement, le module fonctionne comme les listes de suivi sur Wikipédia, avec une page spéciale à chaque utilisateur; pour des envois avec Notify il faut bidouiller un peu. --Petko February 22, 2012, at 04:21 PM

Merci ! Je vais tester ça ! Je vais utiliser une requête SQL via php pour le faire automatiquement dans config.php

 
$EnableNotify = 1;		
	include_once("$FarmD/cookbook/adodb/adodb.inc.php");
	$DB['mysql'] = NewADOConnection('mysql');  
	if (!$DB['mysql']) die("Connection failed"); 
	$DB['mysql']->Connect('mysqlxxxxxxxx', 'xxxxxxxxxx', 'xxxxxxxxxx', 'xxxxxxxxx');
	$rs = $DB['mysql']->Execute("SELECT email,username FROM pmwiki_users");
	if ($rs){
        while ($arr = $rs->FetchRow()) {
		$monMail=$arr['email'];
		$monPseudo=$arr['username'];
		$NotifyList[] = 'notify='.$monMail.' trail=Watchlists.'.$monPseudo.'';  
        } 
	}

Manu? February 22, 2012, at 11:47 PM

Talk page for the AddToWatchlist recipe (users).