diff --git a/MenuItemODT.php b/MenuItemODT.php new file mode 100644 index 00000000..04053ae8 --- /dev/null +++ b/MenuItemODT.php @@ -0,0 +1,40 @@ +params['rev'] = $REV; + } + + /** + * Get label from plugin language file + * + * @return string + */ + public function getLabel() { + $hlp = plugin_load('action', 'odt_export'); + return $hlp->getLang('export_odt_button'); + } +} diff --git a/MenuItemODTPDF.php b/MenuItemODTPDF.php new file mode 100644 index 00000000..55e9db11 --- /dev/null +++ b/MenuItemODTPDF.php @@ -0,0 +1,40 @@ +params['rev'] = $REV; + } + + /** + * Get label from plugin language file + * + * @return string + */ + public function getLabel() { + $hlp = plugin_load('action', 'odt_export'); + return $hlp->getLang('export_odt_pdf_button'); + } +} diff --git a/action/export.php b/action/export.php index 9244c059..b922d5ab 100644 --- a/action/export.php +++ b/action/export.php @@ -11,6 +11,9 @@ // must be run within Dokuwiki if(!defined('DOKU_INC')) die(); +use dokuwiki\Action\Exception\ActionException; +use dokuwiki\Action\Exception\ActionAbort; + /** * Class action_plugin_odt_export * @@ -35,6 +38,8 @@ public function register(Doku_Event_Handler $controller) { $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'convert', array()); $controller->register_hook('TEMPLATE_PAGETOOLS_DISPLAY', 'BEFORE', $this, 'addbutton_odt', array()); $controller->register_hook('TEMPLATE_PAGETOOLS_DISPLAY', 'BEFORE', $this, 'addbutton_pdf', array()); + $controller->register_hook('MENU_ITEMS_ASSEMBLY', 'AFTER', $this, 'addbutton_odt_new', array()); + $controller->register_hook('MENU_ITEMS_ASSEMBLY', 'AFTER', $this, 'addbutton_pdf_new', array()); } /** @@ -91,6 +96,26 @@ public function addbutton_pdf(Doku_Event $event) { } } + /** + * Add 'export odt' button to page tools, new SVG based mechanism + * + * @param Doku_Event $event + */ + public function addbutton_odt_new(Doku_Event $event) { + if($event->data['view'] != 'page') return; + array_splice($event->data['items'], -1, 0, [new \dokuwiki\plugin\odt\MenuItemODT()]); + } + + /** + * Add 'export odt pdf' button to page tools, new SVG based mechanism + * + * @param Doku_Event $event + */ + public function addbutton_pdf_new(Doku_Event $event) { + if($event->data['view'] != 'page') return; + array_splice($event->data['items'], -1, 0, [new \dokuwiki\plugin\odt\MenuItemODTPDF()]); + } + /*********************************************************************************** * Book export * ***********************************************************************************/ diff --git a/menu-odt-pdf.svg b/menu-odt-pdf.svg new file mode 100644 index 00000000..92283811 --- /dev/null +++ b/menu-odt-pdf.svg @@ -0,0 +1,9 @@ + + +PDF + diff --git a/menu-odt.svg b/menu-odt.svg new file mode 100644 index 00000000..1b853a9f --- /dev/null +++ b/menu-odt.svg @@ -0,0 +1,8 @@ + + +