diff --git a/public_html/lib/plugins/folded/action.php b/public_html/lib/plugins/folded/action.php index 3c3b097a..5333f375 100644 --- a/public_html/lib/plugins/folded/action.php +++ b/public_html/lib/plugins/folded/action.php @@ -18,6 +18,7 @@ class action_plugin_folded extends DokuWiki_Action_Plugin { */ function register(Doku_Event_Handler $controller) { $controller->register_hook('DOKUWIKI_STARTED', 'AFTER', $this, 'addhidereveal'); + $controller->register_hook('TEMPLATE_PAGETOOLS_DISPLAY', 'BEFORE', $this, 'add_button', array()); } /** @@ -37,4 +38,30 @@ class action_plugin_folded extends DokuWiki_Action_Plugin { 'reveal' => $reveal ); } + + /** + * Add 'fold/unfold all'-button to pagetools + * + * @param Doku_Event $event + * @param mixed $param not defined + */ + public function add_button(&$event, $param) { + global $ID, $REV; + + if($this->getConf('show_fold_unfold_all_button') && $event->data['view'] == 'main') { + $params = array('do' => 'fold_unfold_all'); + if($REV) $params['rev'] = $REV; + + // insert button at position before last (up to top) + $event->data['items'] = array_slice($event->data['items'], 0, -1, true) + + array('fold_unfold_all' => + '
';
+ if ($this->getConf('unfold_default')) {
+ $renderer->doc .= ' ';
+ } else {
+ $renderer->doc .= ' ';
+ }
if ($cdata)
$renderer->doc .= ' '.$renderer->cdata($cdata);
- $renderer->doc .= '