[pmwiki-users] Wayward Group Creation

Kurt Devlin kurt.devlin at gmail.com
Thu Nov 16 14:41:44 CST 2006


There haven't been any comments on this, so I thought I'd check back to see
if anyone had any thoughts on how to address this issue without modifying
pmwiki.php directly.

Thanks,
Kurt

On 11/8/06, Kurt Devlin <kurt.devlin at gmail.com> wrote:
>
> I know this is not recommended, but I wound up addressing this issue by
> updating the EditTemplate function in pmwiki.php. I've bolded the lines
> that I added below. Is there an easy way to incorporate this in a cookbook
> recipe or config.php or can this be added as an option to the core PmWiki
> functionality? Also, I tried to just redirect this request to
> Site.PageNotFound, but couldn't get it to work. Any ideas on getting that
> working would be appreciated too.
>
> # EditTemplate allows a site administrator to pre-populate new pages
> # with the contents of another page.
> function EditTemplate($pagename, &$page, &$new) {
>   global $EditTemplatesFmt;
>   if (@$new['text'] > '') return;
>   if (@$_REQUEST['template'] && PageExists($_REQUEST['template'])) {
>     $rc = FmtPageName('$Group.RecentChanges', $pagename);
>     if (PageExists($rc)) {
>         $p = RetrieveAuthPage($_REQUEST['template'], 'read', false,
>                  READPAGE_CURRENT);
>         if ($p['text'] > '') $new['text'] = $p['text'];
>         return;
>     }
>     else {
>         $new['text'] = "The requested group does not exist.\n\nCreating a
> new group based on a template is not allowed.\n\nPlease check that you
> didn't include an unintentional dot (.) or slash (/) in your link name.";
>         return;
>     }
>   }
>   foreach((array)$EditTemplatesFmt as $t) {
>     $rc = FmtPageName('$Group.RecentChanges', $pagename);
>     if (PageExists($rc)) {
>         $p = RetrieveAuthPage(FmtPageName($t,$pagename), 'read', false,
>                  READPAGE_CURRENT);
>         if (@$p['text'] > '') { $new['text'] = $p['text']; return; }
>     }
>     else {
>         $new['text'] = "The requested group does not exist.\n\nCreating a
> new group based on a template is not allowed.\n\nPlease check that you
> didn't include an unintentional dot (.) or slash (/) in your link name.";
>     }
>   }
> }
>
> On 11/7/06, Crisses < crisses at kinhost.org> wrote:
> >
> > Hey, Kurt,
> >
> > I'm sorry to see no one picked up your post and responded.  I'll give
> > it a go, but I don't really know a good answer....  maybe if I ask
> > the right questions it will help :)
> >
> > On Nov 6, 2006, at 10:51 AM, Kurt Devlin wrote:
> >
> > > I have a good number of novice users that are creating pages
> > > dealing with the XML content that they work with. Unfortunately, a
> > > lot of the XML elements follow a dot separated naming convention.
> > > This does not translate well to wiki page creation. If have a lot
> > > of situations where users create a page like "Unhandled Case in
> > > para.text Element". Instead of creating the desired page, this
> > > creates a "Text Element" in the wayward group, "Unhandled Case In
> > > Para". To combat this, I created a custom Site/PageNotFound page
> > > (see below) that tries to determine if the group in the page
> > > request exists or not. If the group doesn't appear to exist, it
> > > generates additional warnings.
> > >
> > > My problem is that this approach does not work if the user is
> > > creating a page that is generated from a template. This happens off
> > > of the Issues page in MyGroup (see local/MyGroup.Issues.php below).
> > > In this case, there is no checking that happens, so my users can
> > > create new groups without warning.
> >
> > I don't understand what you mean by generated by a template.
> >
> > Are you using a recipe to generate pages by a template?  Or are you
> > using the PmWiki ability to set a new page to have a template within
> > a group?
> >
> > > My questions are:
> > > Is there a way to add PageNotFound functionality to pages created
> > > from templates?
> > > Is there an easier way to check the existence of a group besides
> > > "(:if ! [ exists {$Group}.{$Group} or exists {$Group}.HomePage ] :)"?
> >
> > You can check in config.php rather than in a wiki page...
> >
> > > Is there an easy way to identify the user adding the new page and
> > > do conditional processing based on their name?
> >
> > perhaps:
> > (:if equal {$Author} "Name" :)
> >
> > > local/MyGroup.Issues.php
> > > <?
> > >     $LinkPageCreateFmt = "<a class='createlinktext'
> > >     href='\$PageUrl?action=edit&amp;template= Site.IssuesTemplate'>\
> > > $LinkText</a>
> > >     <a class='createlink' href='\$PageUrl?
> > > action=edit&amp;template=Site.IssuesTemplate '>?</a>";
> > > ?>
> >
> > Is this where you're defining the template you mentioned?
> >
> > Crisses
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users/attachments/20061116/59ea214a/attachment.html 


More information about the pmwiki-users mailing list