[pmwiki-users] creating a page the easy way (patch included)

Jo Rhett jrhett at svcolo.com
Wed May 24 11:59:42 CDT 2006


Okay, so we have a few groups were people who really don't write
documentation need to put things.  The group home page is a listing of
everything in the group, so it's easy to find things.

The problem is creating pages.  There are two options for doing this:

1. Add a link to an existing page for a page that doesn't exist
	* these people don't really understand links to start with
	they really don't understand a link they can't copy from their browser.

2. Edit the URL in their browser to reference a page which doesn't exist
	* oh, boy.  Location bar?   You must be kidding.

So last night I was toying around with adding a "Create a Page" form to the
group home page.  I have it working like this, but ...

(:input form "pmwiki.php" GET :)
Add a vendor named (:input text pagename "Vendors." size=40 :)
(:input submit value="Create" :)
(:input end :)

The problem is the prepended group name.  People remove it, or change it,
and it ends up somewhere else.  What I really need is:

(:input form "pmwiki.php" GET :)
(:input hidden groupname "Vendors" :)
Add a vendor named (:input text pagename "" size=40 :)
(:input submit value="Create" :)
(:input end :)

Or perhaps a select box?

Yes, I can limit what groups pages can be created in, but this causes
confusion.

Looking at the code, this would appear to be a fairly trivial fix:

--- pmwiki.php_orig     Wed May 24 09:54:39 2006
+++ pmwiki.php  Wed May 24 09:57:43 2006
@@ -277,6 +277,13 @@
 else $action = 'browse';
 
 $pagename = $_REQUEST['n'];
+
+/* Hack in the ability to specify the group separately. */
+if ( !$pagename && $_REQUEST['groupname'] && $_REQUEST['pagename'] ) {
+       $pagename = $_REQUEST['groupname'] . '.' . $_REQUEST['pagename'];
+}
+/* End Hack */
+
 if (!$pagename) $pagename = $_REQUEST['pagename'];
 if (!$pagename && 
     preg_match('!^'.preg_quote($_SERVER['SCRIPT_NAME'],'!').'/?([^?]*)!',


But since this is so easy, I'm assuming there's a good reason why it wasn't
done before.  So clue me in -- what am I overlooking here?

-- 
Jo Rhett
senior geek
SVcolo : Silicon Valley Colocation




More information about the pmwiki-users mailing list