SID-01858: Not very OK...?
| Status: |
Answered |
TWiki version: |
6.0.0 |
Perl version: |
|
| Category: |
WatchlistPlugin |
Server OS: |
|
Last update: |
12 years ago |
If one has an empty Watchlist, and goes to the 'Watchlist changes' page, a note is display that reads:
The watchlist is empty. To watch topics, select the "Watch" menu item on topics. OK
OK is a link to the Watchlist page - the same page displaying the message.
This is generated for notes or errors in Core::VarWatchlist.
Is there a point to the link? It does nothing. It's not like a pop-up error window that needs to be dismissed?
Was it intended to link to the referring page rather than $web, $topic?
Or should it just go away?
On a related note, the "Return to" link on the Watchlist page assumes that one came from the user profile, when coming from the watch pulldown is possible too.
Why not make that link be to the referrer?
Linking to the referring page can be done like this:
--- /var/www/servers/twiki/lib/TWiki/Plugins/WatchlistPlugin/Core.pm.orig 2013-09-15 18:09:19.000000000 -0400
+++ /var/www/servers/twiki/lib/TWiki/Plugins/WatchlistPlugin/Core.pm 2014-01-16 10:30:12.000000000 -0500
@@ -121,16 +121,16 @@
my $text = $this->{text};
my $style = 'margin: 0 0.5em 0 0; padding: 0.3em 0.5em;';
if( $this->{note} ) {
$text .= "<span style='background-color: #feffc2; $style'> "
. $this->{note}
- . " [[$web.$topic][OK]] </span>";
+ . (CGI::referer()? " [[" . CGI::referer() . '][OK]] ': '') . "</span>";
}
if( $this->{error} ) {
$text .= "<span style='background-color: #ff9594; $style'> *Error:* "
. $this->{error}
- . " [[$web.$topic][OK]] </span>"
+ . (CGI::referer()? " [[" . CGI::referer() . '][OK]] ': '') . "</span>";
}
return $text;
}
# =========================
--
Timothe Litt - 2014-01-16
Discussion and Answer
Thanks Timothe for the patch, this is now incorporated. I applied the patch, but only for the note message, not the error message. It makes sense to dismiss the error message.
--
Peter Thoeny - 2014-01-16
I don't understand - the previous code didn't dismiss anything, it just repainted the current page and since nothing changes, any message of either type will re-appear.
'dismiss' makes sense for a pop-up window, but that's not what happens here. Just create a user with no watched topics, pull down the 'watch' item on the menu bar, and select 'watchlist changes'. You get a full page. So either one stays on that page, or one navigates somewhere else. [$web.$topic] makes one think something will happen. But it doesn't. The page doesn't change. The message doesn't disappear. It's a dead link. Creating an error is harder - but the result is the same.
Something has to be done with the link in each case. The choices are:
- Remove it (it does nothing and is confusing)
- Make it do something useful - what I did was go back to the referrer.
It sounds like you did nothing to the {error} case. That leaves a non-functional OK button.
I'm not sure what your rationale is, but something has to change in both places.
As I also noted - but didn't patch - The "Return to" link on the Watchlist topic should also go to the referrer.
- If you get to the topic from the user profile, it will return there.
- But if you get to the topic from the dropdown change list on some other page, the only sensible place to return is the referrer. You never were on the profile page in this case.
--
Timothe Litt - 2014-01-16
The error message is supplied via a URL parameter. The OK dismisses the error message because the URL parameter will disappear.
--
Peter Thoeny - 2014-01-20
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.