[pmwiki-users] Repost: Could Edit always include Preview?

Américo Albuquerque aalbuquerque at lanowar.sytes.net
Fri Apr 28 11:43:05 CDT 2006


Hello

----- Original Message -----
Subject: [pmwiki-users] Repost: Could Edit always include Preview?
Date: Fri, 28 Apr 2006 10:10:19 -0500
From: "Tegan Dowling"

 >Re-posting, and a little re-wording:
 >
 >Is there something I could change, so that whenever a page is displayed in
 >edit mode (whenever ?action=edit), then the preview is also provided
 >("e_preview" is also activated)? I don't think any controls would have to
 >change - maybe just the EditForm, somehow? Or maybe there could be code I
 >could plug in somewhere, e.g. into config.php?
You need to change 2 things.

First change the function PreviewPage in pmwiki.php from
function PreviewPage($pagename,&$page,&$new) {
  global $IsPageSaved, $FmtV;
  if (@$_POST['preview'] ) {
    $text = '(:groupheader:)'.$new['text'].'(:groupfooter:)';
    $FmtV['$PreviewText'] = MarkupToHTML($pagename,$text);
  }
}
to
function PreviewPage($pagename,&$page,&$new) {
  global $IsPageSaved, $FmtV;
  if (@$_POST['preview'] or @$_GET['preview']) {
    $text = '(:groupheader:)'.$new['text'].'(:groupfooter:)';
    $FmtV['$PreviewText'] = MarkupToHTML($pagename,$text);
  }
}

Second change the condition e_preview in scripts/forms.php from
$Conditions['e_preview'] = '(boolean)$_POST["preview"]';
to
$Conditions['e_preview'] = '(boolean)$_POST["preview"] or 
(boolean)$_GET["preview"]';

and add '&preview=1' to all edit links on your template and in 
Site.PageActions

Now, every time the edit link has 'preview=1' it will also preview what 
is being edited

 >
 >This would make editing a little easier and training *much* easier.
 >
 >Should I make this a PITS?
Probably yes since this needs a change in the core of PmWiki.

Americo Albuquerque









More information about the pmwiki-users mailing list