From ff79b0e8c5b823baab38440a201315a033af7d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= Date: Tue, 21 Mar 2017 18:19:51 +0100 Subject: [PATCH] Add shims for move, dw2pdf and odt pagetools In SPR-837 we decided to integrated the svg-pagetools with the approach in splitbrain/dokuwiki#1821. However that had the consequence that the pagetool-icons of plugins no longer work. Until the approach in the PR is mainlined and the plugins have adapted, we will use manual shims to include selected plugins in the pagetools. This commits implements the pagetool-icons for odt, dw2pdf and move plugin. The actual icon for the odt-export is still missing. SPR-906 --- images/tools/40-pdf-file.svg | 3 ++ images/tools/41-format-paint.svg | 3 ++ tpl/nav-page-tools.php | 73 ++++++++++++++++++++++++++++---- 3 files changed, 70 insertions(+), 9 deletions(-) create mode 100644 images/tools/40-pdf-file.svg create mode 100644 images/tools/41-format-paint.svg diff --git a/images/tools/40-pdf-file.svg b/images/tools/40-pdf-file.svg new file mode 100644 index 0000000..0c0b1d5 --- /dev/null +++ b/images/tools/40-pdf-file.svg @@ -0,0 +1,3 @@ + + + diff --git a/images/tools/41-format-paint.svg b/images/tools/41-format-paint.svg new file mode 100644 index 0000000..a87f0b2 --- /dev/null +++ b/images/tools/41-format-paint.svg @@ -0,0 +1,3 @@ + + + diff --git a/tpl/nav-page-tools.php b/tpl/nav-page-tools.php index 477879b..5f97b18 100755 --- a/tpl/nav-page-tools.php +++ b/tpl/nav-page-tools.php @@ -21,16 +21,71 @@ ) ); - // the page tools can be amended through a custom plugin hook - $evt = new Doku_Event('TEMPLATE_PAGETOOLS_DISPLAY', $data); - if($evt->advise_before()){ - foreach($evt->data['items'] as $k => $html) { - if($html) - echo "
  • $html
  • "; + + foreach ($data['items'] as $k => $html) { + if ($html) { + echo "
  • $html
  • "; + } + } + + /** + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * Begin shims as a temporary solution until the svg-approach is mainlined and the plugins have adapted + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + */ + global $ACT; + if (act_clean($ACT) === 'show') { + /** @var action_plugin_move_rename $move */ + $move = plugin_load('action', 'move_rename'); + if ($move && $move->getConf('pagetools_integration')) { + $attr = array( + 'style' => 'background-image: none;', + ); + $item = \dokuwiki\template\sprintdoc\tpl::pageToolItem('', $move->getLang('renamepage'), __DIR__ . '/../images/tools/41-format-paint.svg', $attr); + echo '
  • ' . $item . '
  • '; + } + + /** @var action_plugin_odt_export $odt */ + $odt = plugin_load('action', 'odt_export'); + if ($odt && $odt->getConf('showexportbutton')) { + global $ID, $REV; + $params = array('do' => 'export_odt'); + if ($REV) { + $params['rev'] = $REV; } - } - $evt->advise_after(); - unset($data); + $attr = array( + 'class' => 'action export_pdf', + 'style' => 'background-image: none;', + ); + $svg = __DIR__ . '/../images/tools/FIXME'; + $item = \dokuwiki\template\sprintdoc\tpl::pageToolItem(wl($ID, $params), $odt->getLang('export_odt_button'), $svg, $attr); + echo '
  • ' . $item . '
  • '; + } + + /** @var action_plugin_dw2pdf $dw2pdf */ + $dw2pdf = plugin_load('action', 'dw2pdf'); + if ($dw2pdf && $dw2pdf->getConf('showexportbutton')) { + global $ID, $REV; + + $params = array('do' => 'export_pdf'); + if ($REV) { + $params['rev'] = $REV; + } + $attr = array( + 'class' => 'action export_pdf', + 'style' => 'background-image: none;', + ); + $svg = __DIR__ . '/../images/tools/40-pdf-file.svg'; + $item = \dokuwiki\template\sprintdoc\tpl::pageToolItem(wl($ID, $params), $dw2pdf->getLang('export_pdf_button'), $svg, $attr); + echo '
  • ' . $item . '
  • '; + } + } + /** + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + * End of shims + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + */ + ?>