[pmwiki-users] PageList Project

Patrick R. Michaud pmichaud at pobox.com
Wed Jan 10 08:43:30 CST 2007


On Tue, Jan 09, 2007 at 02:40:25PM -0500, The Editor wrote:
> On 1/9/07, The Editor <editor at fast.st> wrote:
> > Can anyone explain how PagelistProtect works?

If $EnablePageListProtect is enabled (default), then a pagelist will
exclude any pages for which the browser doesn't have read
permission.

If $EnablePageListProtect is disabled (i.e., zero), then the 
names of read-protected pages are allowed to appear in a pagelist.  
This doesn't mean that the browser gains an ability to view any 
of a protected page's contents or attributes, it just means
that the page is not automatically excluded from appearing
in the list due to read permissions.

> > In config.php I have:
> >     $EnablePageListProtect = 0;
> > Then in my site I have pages in group MailList that are read protected.
> > Finally I have a pagelist producing a pulldown menu for group=MailList
> > that is supposed to show all the lists for an action I'm trying to
> > perform.  Instead I get a bunch of blank lines, one line for each list
> > with no content.

I'm not sure where the blank lines are coming from, and I don't
see them in the sample output you gave.  Continuing on to 
the next message...

> Here's the markup and the pagelist template if it helps anyone spot
> something (still using zap's markup for the select box as it's a bit
> shorter).
> [...]

Actually, in this case PmWiki's markup for the select box is 
(overall) shorter than the select/option/selectend markup.  
All that is needed using PmWiki markup is to have
"(:input select list {=$Name}:)" in the pagelist template.

> [...]
> The html output for authorized readers is fine.  When an unauthorized
> reader loads the page he gets this html:
> 
> <form name='join'
> action='http://localhost/zapnews/index.php?n=Main.Subscribe'
> method='post'><input type='hidden' name='action' value='zap' /><input
> type='hidden' name='ZAPkey' value='join' />
> <table ><tr><td  valign='top'><input type='hidden' name='logentry'
> value='guest at zapsite.org' />
> </td><td  valign='top'><select name=list><div
> class='fpltemplate'></div></select>
> </td><td  valign='top'><input type='submit' name='button'
> value='Subscribe' class='inputbutton' />
> </form>

I don't see any "blank lines, one line for each list element" here
in the output, so there must be something else going on.

Also, the above isn't valid HTML.  The <select> element above 
contains a <div>, but the HTML spec says that <select> is only 
allowed to contain <option> elements.  The problem is that the 
(:select:) markup is being generated outside of the pagelist, 
while the (:option:) markups are inside the pagelist, so the
pagelist's <div> is getting in the way.

In order to produce valid HTML, the (:select:) directives would
need to be generated as part of the pagelist.  So, the pagelist 
template would need to be something like...

    [[#picklist]]
    (:if equal {<$Name}:)(:select name=list:)(:if:)
    (:option :){=$Name}
    (:if equal {>$Name}:)(:selectend:)(:if:)
    [[#picklistend]]

Using PmWiki's "input select" directive, it's just:

    [[#picklist]]
    (:input select list {=$Name}:)
    [[#picklistend]]

PmWiki will generate the <select>...</select> tags automatically.

(While I'm on the topic of validation, also note that 
"<select name=list>" in the HTML output above isn't 
valid XHTML because the attribute value isn't quoted.)

> It has every appearance of the pagelist still being projected.  Yet
> I've checked a dozen times (well, maybe not quite a dozen, but
> close...) that this line is in my one sole config file...
> 
> $EnablePageListProtect = 0;
> 
> Yep, it's still there.  

Setting $EnablePageListProtect = 0; means that it's okay
for read-protected pages to appear in a pagelist's output,
not that such pages should be excluded.  In other words
a setting of zero means to disable the check for read
permissions when generating pagelists.  This can significantly
speed up pagelist generation, but also means that list might
contain the names of pages for which the browser doesn't
currently have read permission.

In order to help troubleshoot further I'll probably need to 
see an example where the blank lines are showing up in the 
output.

Pm





More information about the pmwiki-users mailing list