diff --git a/Template.php b/Template.php index b2924d9..ba66389 100644 --- a/Template.php +++ b/Template.php @@ -205,4 +205,50 @@ class Template { echo $mobile; } } + + /** + * Add the current mode information to the hierarchical breadcrumbs + */ + public function breadcrumbSuffix() { + global $ACT; + global $lang; + global $INPUT; + global $ID; + global $conf; + global $IMG; + if($ACT == 'show') return; + + // find an apropriate label for the current mode + if($ACT) { + $label = tpl_getLang('mode_' . $ACT); + if(!$label) { + if(isset($lang['btn_' . $ACT])) { + $label = $lang['btn_' . $ACT]; + } else { + $label = $ACT; + } + } + } else { + // actually we would need to create a proper namespace breadcrumb path here, + // but this is the most simplest thing we can do for now + if(defined('DOKU_MEDIADETAIL')) { + $label = hsc(noNS($IMG)); + } else { + return; + } + } + + if($ACT == 'admin' && $INPUT->has('page')) { + $link = wl($ID, array('do' => 'admin')); + echo ' : ' . $label . ''; + + /** @var \DokuWiki_Admin_Plugin $plugin */ + $plugin = plugin_load('admin', $INPUT->str('page')); + if(!$plugin) return; + + $label = $plugin->getMenuText($conf['lang']); + } + + echo ' : ' . $label . ''; + } } diff --git a/js/breadcrumb.js b/js/breadcrumb.js deleted file mode 100644 index 7825584..0000000 --- a/js/breadcrumb.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Sets up the breadcrumb behaviour (adds do / ACT status information) - * or adds tpl_getLang('image_detail') on detail template - */ -(function($) { - - - var setBreadcrumbSuffix = function(){ - - var $breadcrumb = $('.breadcrumbs'); - if (!$breadcrumb.length) return; - - - /** - * add ACT status to breadcrumb (if not show) - * or tpl_getLang('image_detail') on detail.php - */ - var mode = $breadcrumb.attr('data-do'); - if(mode && mode.indexOf('show') !== 0){ - var markup = ' : ' + mode + ''; - $breadcrumb.find('p').append(markup); - } - }; - - $(function(){ - setBreadcrumbSuffix(); - }); - - -})(jQuery); diff --git a/lang/de/lang.php b/lang/de/lang.php index 1273ce6..46deb8d 100755 --- a/lang/de/lang.php +++ b/lang/de/lang.php @@ -48,6 +48,9 @@ $lang['osm_zoom_link_title'] = 'externer Link - öffnet in neuem Fenster' $lang['image_detail'] = 'Detailinformationen zum Bild'; +$lang['mode_edit'] = 'Seite bearbeiten'; +$lang['mode_detail'] = 'Details zum Bild'; + /** * colors */ diff --git a/lang/en/lang.php b/lang/en/lang.php index 3f20956..87c9bb1 100755 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -51,7 +51,8 @@ $lang['osm_zoom_link_text'] = 'view larger map'; $lang['osm_zoom_link_title'] = 'external link opens new window'; $lang['image_detail'] = 'image details'; - +$lang['mode_edit'] = 'Editing Page'; +$lang['mode_detail'] = 'Image Details'; /** * colors diff --git a/script.js b/script.js index 11e9ce9..503fea9 100755 --- a/script.js +++ b/script.js @@ -8,4 +8,3 @@ /* DOKUWIKI:include js/meta-box.js */ /* DOKUWIKI:include js/sidebar.js */ -/* DOKUWIKI:include js/breadcrumb.js */ diff --git a/tpl/nav-breadcrumb.php b/tpl/nav-breadcrumb.php index 1ab1359..a8c2680 100755 --- a/tpl/nav-breadcrumb.php +++ b/tpl/nav-breadcrumb.php @@ -1,11 +1,13 @@ +
+

+ breadcrumbSuffix(); + ?> +

- -
-

- - - +