diff --git a/MenuNSItem.php b/MenuNSItem.php new file mode 100644 index 00000000..a850c053 --- /dev/null +++ b/MenuNSItem.php @@ -0,0 +1,51 @@ +params['at'] = $DATE_AT; + } elseif ($REV) { + $this->params['rev'] = $REV; + } + + $this->params['book_ns'] = getNS($ID); + $this->params['book_title'] = noNS(getNS($ID)); + } + + /** + * Get label from plugin language file + * + * @return string + */ + public function getLabel() + { + $hlp = plugin_load('action', 'dw2pdf'); + return $hlp->getLang('export_pdfns_button'); + } +} diff --git a/action.php b/action.php index 5c4b9fd1..074e1081 100644 --- a/action.php +++ b/action.php @@ -1013,7 +1013,11 @@ public function getExportConfig($name, $notset = false) { public function addbutton(Doku_Event $event) { global $ID, $REV, $DATE_AT; - if($this->getConf('showexportbutton') && $event->data['view'] == 'main') { + if(!$event->data['view'] == 'main') { + return; + } + + if($this->getConf('showexportbutton')) { $params = array('do' => 'export_pdf'); if($DATE_AT) { $params['at'] = $DATE_AT; @@ -1032,6 +1036,28 @@ public function addbutton(Doku_Event $event) { ) + array_slice($event->data['items'], -1, 1, true); } + + if($this->getConf('showexportnsbutton') && getNS($ID)) { + $params = array('do' => 'export_pdf'); + if($DATE_AT) { + $params['at'] = $DATE_AT; + } elseif($REV) { + $params['rev'] = $REV; + } + $params['book_ns'] = getNS($ID); + $params['book_title'] = noNS(getNS($ID)); + + // insert button at position before last (up to top) + $event->data['items'] = array_slice($event->data['items'], 0, -1, true) + + array('export_pdfns' => + '
screen.css should be used for PDF generation. By default only print.css and pdf.css are used.';
$lang['qrcodesize'] = 'Size of embedded QR code (in pixels <width>x<height>). Empty to disable';
$lang['showexportbutton'] = 'Show PDF export button (only when supported by your template)';
+$lang['showexportnsbutton'] = 'Show PDF Namespace export button (only when supported by your template)';