====== forcepreview Plugin ====== ---- plugin ---- description: Force users to hit the preview button before saving changes to a wiki page by deactivating the save button first. author : Pascal Bihler email : bihler@cs.uni-bonn.de type : action lastupdate : 2012-02-09 compatible : 2012-01-25, 2010-11-07, 2008-05-05, 2006-11-06, 2007-05-24, 2007-06-26b depends : conflicts : livepreview similar : enforcesummary tags : editing, preview, users downloadurl: http://pb.wh4f.de/dokuwiki/forcepreview.zip ---- ===== Update Feb. 2012 ===== Removed underscore from name to support future releases of DokuWiki. ===== Download / Installation ===== Download and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. * http://pb.wh4f.de/dokuwiki/forcepreview.zip ===== Usage ===== As soon as the plugin is installed (and as long as it is not deactivated), the save button will be deactivated in edit mode. By clicking "Preview", the user can activate the save button. this assures, that no unpreviewed content is saved into the wiki. ===== non-Javascript solution ===== Here is a solution without Javascript. The only problem with this solution is that you have to change the PHP code of the Dokuwiki files. Edit the file //inc/html.php//, search for the following line (this is how it looks like in version [[:changes#release_2009-02-14b|2009-02-14b]]). $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('id'=>'edbtn__save', 'accesskey'=>'s', 'tabindex'=>'4'))); Add "if($pr)" in front of the line, it should look like this. (This shows the save button only when you have previewed the page - change the color if needed) if($pr) $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('id'=>'edbtn__save', 'accesskey'=>'s', 'tabindex'=>'4'))); If you want to only disable the button without removing add this line below (the save button will be rendered but not clickable and grayed out) else $form->addElement(form_makeButton('button', '', $lang['btn_save'], array('id'=>'edbtn__save', 'accesskey'=>'s', 'tabindex'=>'4', 'disabled' => 'true', 'style' => 'color: grey; cursor: default;'))); --- //[[markus@lazyfrosch.de|Markus Frosch]] 2009/07/21 13:49// ===== Code ===== ==== action.php ==== */ if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'action.php'); class action_plugin_forcepreview extends DokuWiki_Action_Plugin { /** * return some info */ function getInfo(){ return array( 'author' => 'Pascal Bihler', 'email' => 'bihler@cs.uni-bonn.de', 'date' => '2012-02-09', 'name' => 'Force preview', 'desc' => 'Force users to hit preview before saving changes to a wiki page', 'url' => 'http://www.dokuwiki.org/plugin:forcepreview', ); } /* * Register its handlers with the DokuWiki's event controller */ function register(Doku_Event_Handler $controller) { $controller->register_hook('TPL_ACT_RENDER', 'AFTER', $this, '_controlSaveButton'); } /** * Relocates the css-loading to own method */ function _controlSaveButton(&$event, $param) { global $ACT; global $lang; $disable_save_button = ''; if ($ACT == 'edit') { $disable_save_button = 'true'; } elseif ($ACT == 'preview') { $disable_save_button = 'false'; } if ($disable_save_button != '') { print ""; } } } ===== Translations ===== * How to have/manage some translation files? ===== Troubleshooting ===== I like this , but Fckglite seem is not able to save sence it doesnt have the PREVIEW button.