|
Cookbook /
SwitchToAndFromDraftSummary: Provide a sidebar or PageActions link to switch to/from -Draft pages
Version: Initial
Prerequisites: PmWiki 2.1 (?)
Status: Quo
Maintainer:
DescriptionPut a link in the SideBar or PageActions so authors can easily switch to and from a -Draft version of a page. ProcedurePut this in a local configuration file (config.php):
## Enable (:if enabled EditDraft:) for a page that has a -Draft version and
## (:if enabled PageIsDraft:) with {$DraftBaseName} page variable for -Draft pages.
$pagename = ResolvePageName($pagename);
if (CondAuth($pagename, 'edit')) {
if (PageExists($pagename.'-Draft')) { $EditDraft = TRUE; }
if (preg_match('/-Draft$/', $pagename)) { $PageIsDraft = TRUE;
$draftbasename = preg_replace("/-Draft\$/", '', $pagename);
$FmtPV['$DraftBaseName'] = "'$basename'";
# $HTMLStylesFmt['isdraft'] = " /* Custom CSS for draft page */ ";
}
}
Then you can use markup like this in the sidebar:
(:if enabled EditDraft:)
[-([[{*$FullName}-Draft | View draft ]])-]
(:if enabled PageIsDraft:)
[-([[{*$DraftBaseName} | View published ]])-]
(:if:)
Another possibility is to use this in Site.PageActions:
(:if enabled EditDraft:)
* %item class=browse %[[{*$FullName}-Draft | View Draft ]]
(:if enabled PageIsDraft:)
* %item class=browse %[[{*$DraftBaseName} | View Published ]]
(:if:)
NotesPmWiki 2.2 beta57 appears to have a bug that disables the Publish button. A workaround might be to add $DefaultPasswords['publish'] = $DefaultPasswords['edit'];
or possibly $DefaultPasswords['publish'] = '';
--Hagan CommentsSee AlsoContributors
|