LayoutEditModified

Summary: Modify the Edit page
Version:
Prerequisites:
Status:
Maintainer:
Categories: Obsolete

Goal

  1. Modify the edit page to have edition buttons atop the edit Windows
  2. Remove header, title, footer and sidebar to maximize edit windows size

Solution

This recipe is superceded by version 2.0.beta44. To adjust the edit buttons, location of preview, or remove the header/title/footer/and sidebar, edit the Site.EditForm page on your site. --Pm

for point 1: set in the 'config.php' file the variable

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

In the hereabove text, remove <samp> markups, and also the '`' in the variable EditText.
This is only to avoid strange interpretation by browser/PmWiki.

for point 2:

You can do by using the following in config.php:

  
      function clearframe($pagename,$args) {
        $GLOBALS['PageHeaderFmt'] = '';
        $GLOBALS['PageFooterFmt'] = '';
        $GLOBALS['PageTitleFmt'] = '';
        $GLOBALS['PageLeftFmt'] = '';
      }

      $HandleEditFmt = array(
        'function:clearframe',
        &$PageStartFmt,
        &$PageEditFmt,
        'wiki:$[PmWiki.EditQuickReference]',
        &$PagePreviewFmt,
        &$PageEndFmt);
    

This is demonstrated at Test.BigEdit. --Pm

From pmwiki2 beta22 onwards there is an alternative to remove header, footer, title and sidebar sections:

  
  global $action;
  if ($action=='edit') { SetTmplDisplay('PageHeaderFmt', 0);
			 SetTmplDisplay('PageFooterFmt', 0);
			 SetTmplDisplay('PageTitleFmt', 0);
			 SetTmplDisplay('PageLeftFmt', 0); 
	};

Discussion

It's not clear to me how to remove the sidebar by editing the Site.EditForm page on my site as PM suggests above. Any suggestions or examples? - Carl

For what it's worth I accomplished the first goal by just adding the following lines into local/config.php

## $EditMessageFmt adds a save button to the top of the form
$EditMessageFmt = "<input type='submit' name='post' value=' $[Save] ' /><P>";

 --csc

Since the textarea is in a <div> with a unique identifier of "wikiedit" you can set its size in your CSS stylesheet. Example:

 #wikiedit textarea { width:660px; height:450px; }

That textarea now has a unique identifier called 'text', but it seems like that's more dificult to recognize as the text area of the wiki edit page than "#wikiedit textarea" which is obvious.
--HaganFox

For width, it is much better to left as in the present pmwiki skin css

 #wikiedit textarea { width:98% }

which uses the disponible width and supersede the textarea column width defined.

For the height, you may expect that someone who have a large screen definition (e.g 1600 x 1200) set large police or very large police to maintain minimal readability. This means that a dimension given in number of rows have statistically more chances to be accurate than a pixel sized dimension. So I think the present solution is better - note that height:99% don't work... PRZ

For me, sometimes using pixels has worked better. The point was not what units to use, but that you can specify the size using CSS by targeting #wikiedit textarea. --ProfilesHagan


Does point2 work regardless the skin used. I'm using marathon skin and the code presented doesn't seem to work.

--Jota?


Hi, is there a way to get rid of the other header (the one which contains the logo, subtitle and the search box)? I only used point 2 so far.

Thanks, Rod


Using IE6 the edit textbox always expands when typing the first character. The following is my modification which prevents this horizontal stretching. It also puts the buttons to the top, and adds a link to the pagename. i also replaced the reset button with a cancel button, which will return the author to the page view. It works by enclosing the textarea ina container division and adding some style definitions. Add the following code to config.php. (--HansB - 14 Feb 2005)

  
## wide Edit page with buttons on top and link
#global $PageEditFmt;
$PageEditFmt = "<div id='wikiedit'>
  <a id='top' name='top'></a>
  <h2 class='wikiaction'>$[Editing]<a href='\$PageUrl'>
    \$FullName</a></h2><br />
  <form method='post' action='\$PageUrl?action=edit'>
  <input type='hidden' name='action' value='edit' />
  <input type='hidden' name='pagename' value='\$FullName' />
  <input type='hidden' name='basetime' value='\$EditBaseTime' />
  $[Author]: <input type='text' name='author' value='\$Author' />
  <input type='submit' name='post' value=' $[Save] ' />
  <input type='submit' name='preview' value=' $[Preview] ' />
  <input type='button' name='cancel' value=' $[Cancel] ' 
       onclick=\"window.location='\$PageUrl'\"/><br />
  <input type='checkbox' name='diffclass' value='minor' \$DiffClassMinor />
    $[This is a minor edit]<br />
  \$EditMessageFmt
  <div id='tbox'><textarea id='text' name='text' rows='25' cols='80'
    onkeydown='if (event.keyCode==27) event.returnValue=false;'
    >\$EditText</textarea></div><br /></form></div>";

 $HTMLStylesFmt[] = "
     #wikiedit form { margin:0; }
     #tbox { position: relative;
		padding:0;
		margin-top:0.5em;
		}
    * html #wikiedit #tbox { height: 1%; } 
    #wikiedit textarea { 
		margin:0; 
		padding:0;
		position: relative;
		width: 99%;
		} \n"
  

Usage Notes

Contributor

  • PRZ
  • Pm (changed $PageName to $FullName)
  • PRZ added header, footer and sidebar removal.
  • Pm describe how to implement above in config.php file