[pmwiki-users] detecting minor edit
Patrick R. Michaud
pmichaud at pobox.com
Tue Feb 13 11:31:07 CST 2007
On Tue, Feb 13, 2007 at 06:15:29PM +0100, sgp wrote:
> Patrick R. Michaud wrote:
> > If you see that, then you know the code to detect minor edits
> > is working. If you don't see it, then something else odd is
> > happening.
>
> That helped. I didn't know that I could select "minor edit" while previewing.
>
> So, with the below code inside my local/News.php, when I
> preview a minor edit of News.Temp1 I see
> "UUUUUUUU" on my screen.
>
> if (@$_POST['diffclass'] == 'minor') {
> print "UUUUUUUUUUUUUUUUUUUUUUUUUUU";
> unset($RecentChangesFmt['$SiteGroup.AllRecentChanges']);
> unset($RecentChangesFmt['$Group.RecentChanges']);
> }
>
> Should I also see it when saving a "minor edit"? ...
You probably wouldn't see it when saving a minor edit, because
a successful save sends a redirect back to the browser to
reload the page (without ?action=edit). If you want to verify
that it's executing when saving, try adding:
$EnableRedirect = 0;
This will turn off the automatic redirect, whereupon you'll
see the 'UUUUUU' line when you do a save with 'minor edit' checked.
> My News.Feed page contains only this line:
>
> (:pagelist group=News name=-News,-*SandBox*,-*SideBar*,-*RightBar*
> list=normal count=20 fmt=simple order=-time:)
>
> When I minor edit News.Temp1 then refresh News.Feed -
> I can see that News.Temp1 jumps on top of the list, sure sign
> that the if-body in local/News.php wasn't executed.
Oh. Pagelists don't use RecentChangesFmt at all (at least
not directly), so this isn't really proving what you think it's
proving. The (:pagelist:) directive says to list all of the
pages in the News group, regardless of minor edit status.
To see if your code is having any impact, look at the contents
of News.RecentChanges. When a page is saved with 'minor edit'
checked, this list won't be modified, but when saved with
'minor edit' unchecked, the page will appear at the top of
the list.
So, what you really want to use for your (:pagelist:)
command is (all one line):
(:pagelist trail=News.RecentChanges
name=-News,-*Sandbox*,-*SideBar*,-*RightBar* list=normal
count=20 fmt=simple:)
This says to obtain the list of pages to display from
the News.RecentChanges trail, and use the order they appear
in that trail. And with the local/config.php lines you have,
News.RecentChanges won't be updated on a minor edit.
Pm
More information about the pmwiki-users
mailing list