Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement action to display/hide showrev warning. #68

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions action/handleshowrev.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

if(!defined('DOKU_INC')) die();

class action_plugin_publish_handleshowrev extends DokuWiki_Action_Plugin {

/**
* @var helper_plugin_publish
*/
private $hlp;

function __construct() {
$this->hlp = plugin_load('helper','publish');
}

function register(Doku_Event_Handler $controller) {
$controller->register_hook('HTML_SHOWREV_OUTPUT', 'BEFORE', $this, 'handle_showrev', array());
}

/**
* @param Doku_Event $event
* @param array $param
*/
function handle_showrev(Doku_Event &$event, $param) {
if (!$this->hlp->isActive()) {
return;
}

if ($this->getConf('hide_showrev')) {
$event->preventDefault();
}

return;
}
}
1 change: 1 addition & 0 deletions conf/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$conf['hidereaderbanner'] = 0;
$conf['hide drafts'] = 0;
$conf['hide_approved_banner'] = 0;
$conf['hide_showrev'] = 0;
$conf['author groups'] = '';
$conf['internal note'] = '';
$conf['delete attic on first approve'] = 0;
Expand Down
1 change: 1 addition & 0 deletions conf/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$meta['hide drafts'] = array('onoff');
$meta['hidereaderbanner'] = array('onoff');
$meta['hide_approved_banner'] = array('onoff');
$meta['hide_showrev'] = array('onoff');
$meta['author groups'] = array('string');
$meta['internal note'] = array('string');
$meta['delete attic on first approve'] = array('onoff');
Expand Down
1 change: 1 addition & 0 deletions lang/de/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
$lang['hidereaderbanner'] = 'Verstecke Banner vor Benutzern, die nur das Leserecht haben';
$lang['hide drafts'] = 'Verstecke unbestätigte Versionen vor Benutzern, die nur das Leserecht haben.';
$lang['hide_approved_banner'] = 'Verstecke Banner auf bestätigten Seiten.';
$lang['hide_showrev'] = 'Verstecke showrev Warnung';
$lang['author groups'] = 'Gruppen, die Drafts sehen können (mehrere mit Leerzeichen trennen)';
$lang['internal note'] = 'Notiz auf nicht veröffentlichten Seiten';
$lang['delete attic on first approve'] = 'Alte Versionen bei erster Bestätigung löschen';
Expand Down
1 change: 1 addition & 0 deletions lang/en/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
$lang['hidereaderbanner'] = 'Hide banner to read only users';
$lang['hide drafts'] = 'Hide drafts to read only users';
$lang['hide_approved_banner'] = 'Hide banner on approved pages';
$lang['hide_showrev'] = 'Hide showrev warning';
$lang['author groups'] = 'Groups that can see drafts (separate by blank)';
$lang['internal note'] = 'Note on unapproved pages';
$lang['delete attic on first approve'] = 'Delete attic on first approve';
Expand Down