[Pmwiki-users] Another feature: new page form with title input

Patrick R. Michaud pmichaud
Thu May 13 10:08:49 CDT 2004


On Wed, May 12, 2004 at 11:01:47AM -0400, Crisses wrote:
> I want to 
> be able to change the title of the wiki page WHILE I'm editing a new 
> wiki page.
> 
> So I would like another form-field that will normally have the title of 
> the new page being edited in it, but that will allow someone to change 
> the page title before submitting a new page.
> 
> Any suggestions?

I haven't tried this yet, but I think it turns out to be embarassingly
simple -- just redefine $PageEditFmt so that the

   <input type='hidden' name='pagename' value='$PageName' />

tag is changed to

   <input type='text' name='pagename' value='$PageName' />

See below for an example.

Of course, this requires that the person enter the page's name as 
'Group.PageName' (and not just 'PageName'), so perhaps there's a 
user-interface improvement that ought to be made there.  Let me know 
if you want that.  But this gets the basic functionality across.

This should probably be written up as a Cookbook module.

Pm


$PageEditFmt=array("
  <div id='wikiedit'>
  <a id='top' name='top'></a><h1 class='wikiaction'>$[Editing \$PageName]</h1>
  <form action='\$PageUrl' method='post'>
  \$EditMessageFmt
  <input type='hidden' name='action' value='edit' />
  <input type='text' name='pagename' value='\$PageName' /><br />
  <textarea name='text' rows='25' cols='60'
    onkeydown='if (event.keyCode == 27) event.returnValue=false;'
    >\$Text</textarea><br />
  $[Author]: <input type='text' name='author' value='\$Author' />
  <input type='checkbox' name='diffclass' value='minor' \$DiffClassMinor />
    $[This is a minor edit]<br />
  <input type='submit' name='post' value=' $[Save] ' />
  <input type='submit' name='preview' value=' $[Preview] ' />
  <input type='reset' value=' $[Reset] ' />
  </form></div>",'wiki:$[PmWiki.EditQuickReference]');




More information about the pmwiki-users mailing list