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 1/4] 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 + * ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + */ + ?> From 9f631ecba1dc4408d43ba37151b4db69aa60578d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= Date: Mon, 10 Apr 2017 11:13:12 +0200 Subject: [PATCH 2/4] Remove misplaced css to fix button background The button should have a transparent background as all the other buttons. --- css/area_nav-pagetools.less | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/css/area_nav-pagetools.less b/css/area_nav-pagetools.less index d3f982e..40d2b06 100755 --- a/css/area_nav-pagetools.less +++ b/css/area_nav-pagetools.less @@ -110,18 +110,6 @@ nav#dokuwiki__pagetools { margin-top: 1em; } } - - &.plugin_move_page { - a { - .btn-hover(); - - color: @ini_nav_menu_color; - - * { - color: inherit; - } - } - } } } From 4d79698367a83764d06890f127c78e3a843a348b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= Date: Mon, 10 Apr 2017 12:17:46 +0200 Subject: [PATCH 3/4] fix urls by actually using & --- tpl/nav-page-tools.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tpl/nav-page-tools.php b/tpl/nav-page-tools.php index 5f97b18..4f6571f 100755 --- a/tpl/nav-page-tools.php +++ b/tpl/nav-page-tools.php @@ -58,7 +58,7 @@ '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); + $item = \dokuwiki\template\sprintdoc\tpl::pageToolItem(wl($ID, $params, false, '&'), $odt->getLang('export_odt_button'), $svg, $attr); echo '
  • ' . $item . '
  • '; } @@ -76,7 +76,7 @@ '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); + $item = \dokuwiki\template\sprintdoc\tpl::pageToolItem(wl($ID, $params, false, '&'), $dw2pdf->getLang('export_pdf_button'), $svg, $attr); echo '
  • ' . $item . '
  • '; } } From 755c6c7959bc54bc95d3abf7c107fd764705edc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= Date: Mon, 10 Apr 2017 12:28:08 +0200 Subject: [PATCH 4/4] Add icon for odt-export This icon is somewhat suboptimal and should be replaced when a better icon is found or created. SPR-906 --- images/tools/43-file-delimeted.svg | 3 +++ tpl/nav-page-tools.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 images/tools/43-file-delimeted.svg diff --git a/images/tools/43-file-delimeted.svg b/images/tools/43-file-delimeted.svg new file mode 100644 index 0000000..f4a984a --- /dev/null +++ b/images/tools/43-file-delimeted.svg @@ -0,0 +1,3 @@ + + + diff --git a/tpl/nav-page-tools.php b/tpl/nav-page-tools.php index 4f6571f..f57d335 100755 --- a/tpl/nav-page-tools.php +++ b/tpl/nav-page-tools.php @@ -57,7 +57,7 @@ 'class' => 'action export_pdf', 'style' => 'background-image: none;', ); - $svg = __DIR__ . '/../images/tools/FIXME'; + $svg = __DIR__ . '/../images/tools/43-file-delimeted.svg'; $item = \dokuwiki\template\sprintdoc\tpl::pageToolItem(wl($ID, $params, false, '&'), $odt->getLang('export_odt_button'), $svg, $attr); echo '
  • ' . $item . '
  • '; }