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.<br><br>Thanks,<br>Kurt<br><br><div><span class="gmail_quote">
On 11/8/06, <b class="gmail_sendername">Kurt Devlin</b> <<a href="mailto:kurt.devlin@gmail.com">kurt.devlin@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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.
<br><br><span style="font-family: courier new,monospace;"># EditTemplate allows a site administrator to pre-populate new pages</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
# with the contents of another page.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">function EditTemplate($pagename, &$page, &$new) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> global $EditTemplatesFmt;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> if (@$new['text'] > '') return;</span>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> if (@$_REQUEST['template'] && PageExists($_REQUEST['template'])) {</span><br style="font-family: courier new,monospace;">
<span style="font-weight: bold; font-family: courier new,monospace;"> $rc = FmtPageName('$Group.RecentChanges', $pagename);</span><br style="font-weight: bold; font-family: courier new,monospace;"><span style="font-weight: bold; font-family: courier new,monospace;">
if (PageExists($rc)) {</span><br style="font-weight: bold; font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> $p = RetrieveAuthPage($_REQUEST['template'], 'read', false,</span>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> READPAGE_CURRENT);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
if ($p['text'] > '') $new['text'] = $p['text']; </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> return;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><span style="font-weight: bold; font-family: courier new,monospace;"> }</span><br style="font-weight: bold; font-family: courier new,monospace;"><span style="font-weight: bold; font-family: courier new,monospace;">
else {</span><br style="font-weight: bold; font-family: courier new,monospace;"><span style="font-weight: bold; font-family: courier new,monospace;"> $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.";
</span><br style="font-weight: bold; font-family: courier new,monospace;"><span style="font-weight: bold; font-family: courier new,monospace;"> return;</span><br style="font-weight: bold; font-family: courier new,monospace;">
<span style="font-weight: bold; font-family: courier new,monospace;"> } </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> foreach((array)$EditTemplatesFmt as $t) {</span><br style="font-family: courier new,monospace;"><span style="font-weight: bold; font-family: courier new,monospace;"> $rc = FmtPageName('$Group.RecentChanges', $pagename);
</span><br style="font-weight: bold; font-family: courier new,monospace;"><span style="font-weight: bold; font-family: courier new,monospace;"> if (PageExists($rc)) {</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> $p = RetrieveAuthPage(FmtPageName($t,$pagename), 'read', false,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
READPAGE_CURRENT);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> if (@$p['text'] > '') { $new['text'] = $p['text']; return; }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><span style="font-weight: bold; font-family: courier new,monospace;"> }</span><br style="font-weight: bold; font-family: courier new,monospace;"><span style="font-weight: bold; font-family: courier new,monospace;">
else {</span><br style="font-weight: bold; font-family: courier new,monospace;"><span style="font-weight: bold; font-family: courier new,monospace;"> $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.";
</span><div><span class="e" id="q_10ec89c48d3b45c7_1"><br style="font-weight: bold; font-family: courier new,monospace;"><span style="font-weight: bold; font-family: courier new,monospace;"> } </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">
}</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">}</span><br><br><div><span class="gmail_quote">On 11/7/06, <b class="gmail_sendername">Crisses</b> <<a href="mailto:crisses@kinhost.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
crisses@kinhost.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hey, Kurt,<br><br>I'm sorry to see no one picked up your post and responded. I'll give
<br>it a go, but I don't really know a good answer.... maybe if I ask<br>the right questions it will help :)<br><br>On Nov 6, 2006, at 10:51 AM, Kurt Devlin wrote:<br><br>> I have a good number of novice users that are creating pages
<br>> dealing with the XML content that they work with. Unfortunately, a<br>> lot of the XML elements follow a dot separated naming convention.<br>> This does not translate well to wiki page creation. If have a lot
<br>> of situations where users create a page like "Unhandled Case in<br>> para.text Element". Instead of creating the desired page, this<br>> creates a "Text Element" in the wayward group, "Unhandled Case In
<br>> Para". To combat this, I created a custom Site/PageNotFound page<br>> (see below) that tries to determine if the group in the page<br>> request exists or not. If the group doesn't appear to exist, it<br>
> generates additional warnings.<br>><br>> My problem is that this approach does not work if the user is<br>> creating a page that is generated from a template. This happens off<br>> of the Issues page in MyGroup (see local/MyGroup.Issues.php below).
<br>> In this case, there is no checking that happens, so my users can<br>> create new groups without warning.<br><br>I don't understand what you mean by generated by a template.<br><br>Are you using a recipe to generate pages by a template? Or are you
<br>using the PmWiki ability to set a new page to have a template within<br>a group?<br><br>> My questions are:<br>> Is there a way to add PageNotFound functionality to pages created<br>> from templates?<br>> Is there an easier way to check the existence of a group besides
<br>> "(:if ! [ exists {$Group}.{$Group} or exists {$Group}.HomePage ] :)"?<br><br>You can check in config.php rather than in a wiki page...<br><br>> Is there an easy way to identify the user adding the new page and
<br>> do conditional processing based on their name?<br><br>perhaps:<br>(:if equal {$Author} "Name" :)<br><br>> local/MyGroup.Issues.php<br>> <?<br>> $LinkPageCreateFmt = "<a class='createlinktext'
<br>> href='\$PageUrl?action=edit&amp;template= Site.IssuesTemplate'>\<br>> $LinkText</a><br>> <a class='createlink' href='\$PageUrl?<br>> action=edit&amp;template=Site.IssuesTemplate
'>?</a>";<br>> ?><br><br>Is this where you're defining the template you mentioned?<br><br>Crisses<br></blockquote></div><br>
</span></div></blockquote></div><br>