From 72166b7941a75a535d86f35171a05d4fd2953004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jana=20Deutschla=CC=88nder?= Date: Mon, 11 Mar 2019 16:08:20 +0100 Subject: [PATCH 001/153] #17: make header layout configurable --- conf/default.php | 2 +- conf/metadata.php | 9 +++++ css/area_header.less | 72 +++++++++++++++++++++++++++++++++++++ css/area_nav-usertools.less | 70 ++++++++++++++++++++++++++++++++++++ css/base_structure.less | 10 ++++++ detail.php | 2 +- lang/de/settings.php | 4 +++ lang/en/settings.php | 3 ++ main.php | 2 +- 9 files changed, 171 insertions(+), 3 deletions(-) diff --git a/conf/default.php b/conf/default.php index 9f1418e..1ca4c37 100755 --- a/conf/default.php +++ b/conf/default.php @@ -5,4 +5,4 @@ */ $conf['sidebar_sections'] = 'h1,h2,h3,h4,h5'; - +$conf['header_layout'] = 'header-default'; diff --git a/conf/metadata.php b/conf/metadata.php index 274f7c5..dd94e6f 100755 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -9,3 +9,12 @@ $meta['sidebar_sections'] = array( 'li.level1 > .li', ), ); + +$meta['header_layout'] = array( + 'multichoice', + '_choices' => array( + 'header-default', + 'header-compact', + 'header-hidden', + ), + ); diff --git a/css/area_header.less b/css/area_header.less index f524543..0eb54dd 100755 --- a/css/area_header.less +++ b/css/area_header.less @@ -207,3 +207,75 @@ } } } + + +/* + + + + + layout option compact + + + + + */ +.header-compact { + #dokuwiki__header { + .main-title.desktop-only p.claim, + p.claim { + display: none; + } + + // desktop + @media @screen_min-md { + div.claim { + vertical-align: top; + } + + .main-title.desktop-only { + vertical-align: top; + } + + .main-title.desktop-only, + .logo { + padding-top: 0.4rem + } + } + + // mobile middle + @media @screen_max-md { + + .logo { + display: block; + position: absolute; + top: 0; + left: 3rem; + + .mobile-only { + margin: .4rem; + height: 1.75rem; + } + } + + .main-title:not([class*="desktop-only"]) { + display: inline-block; + vertical-align: top; + padding-left: 1.75rem; + } + + p.title { + font-size: 1rem; + } + } + + @media @screen_max-sm { + min-height: 2.7rem; + } + + @media @screen_max-xxs { + min-height: 70px; // needed for menu select toolbar + + .logo { + left: 2rem; + } + + .menu-tool-select { + padding-top: .3rem; + } + + } + + + } +} diff --git a/css/area_nav-usertools.less b/css/area_nav-usertools.less index 46aa165..c3e382b 100755 --- a/css/area_nav-usertools.less +++ b/css/area_nav-usertools.less @@ -297,3 +297,73 @@ } // a } // ul } // nav-usertools + + +/* + + + + + layout option compact + + + + + */ +.header-compact { + #dokuwiki__usertools.nav-usertools { + + // mobile + @media @screen_max-md { + left: 6rem; + + ul { + overflow: hidden; + + li.user { + color: @ini_background_site; + + bdi { + position: absolute; + width: 0; + padding: 0; + text-indent: -10000px; + + &:before { + transition: @transition background-color; + background-color: @ini_background_site; + color: @ini_nav_menu_color; + text-indent: 0; + } + } + + > a { + padding: 0 .2em; + color: @ini_nav_menu_hover_bg; + + bdi { + &:before { + background-color: @ini_nav_menu_hover_bg; + color: @ini_nav_menu_hover_color; + } + } + + &:hover { + color: @ini_nav_menu_hover_color; + + bdi { + &:before { + background-color: @ini_nav_menu_hover_color; + color: @ini_nav_menu_hover_bg; + } + } + } + } + + bdi + bdi { + display: none; + } + } + } + } + + @media @screen_max-sm { + ul li { + position: static; + float: right; + top: 0; right: 0; + } + } + } +} + diff --git a/css/base_structure.less b/css/base_structure.less index 0048ad4..1ef944e 100755 --- a/css/base_structure.less +++ b/css/base_structure.less @@ -166,6 +166,16 @@ } } + /* + + + + + layout option compact + + + + + */ + .header-compact { + .header { + .row > .col-xs-12 { + height: auto; + min-height: fit-content; + } + } + } + .tools { .row > .col-xs-12 { position: absolute; diff --git a/detail.php b/detail.php index fdc2afe..fa90150 100755 --- a/detail.php +++ b/detail.php @@ -65,7 +65,7 @@ include('tpl/favicon_tiles.php'); - +
.li'] = 'Top-level Listeneinträge in verschachtelten Listen'; + +$lang['header_layout'] = 'Layout des Headers anpassen:'; +$lang['header_layout_o_default'] = 'großer Header für langen Wiki Titel und Tagline'; +$lang['header_layout_o_compact'] = 'kompakter Header für kurzen Wiki Titel ohne Tagline'; diff --git a/lang/en/settings.php b/lang/en/settings.php index c210f07..b37442c 100755 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -11,4 +11,7 @@ $lang['sidebar_sections_o_h1,h2'] = '1st and 2nd order headings'; $lang['sidebar_sections_o_h1,h2,h3,h4,h5'] = 'All headings'; $lang['sidebar_sections_o_li.level1 > .li'] = 'Top-level list items'; +$lang['header_layout'] = 'Adjust header layout:'; +$lang['header_layout_o_default'] = 'generous header layout for long wiki titel and tagline'; +$lang['header_layout_o_compact'] = 'compact header layout for short wiki title and hidden tagline'; diff --git a/main.php b/main.php index d3bc13e..990e4a8 100755 --- a/main.php +++ b/main.php @@ -69,7 +69,7 @@ $showSidebar = true; /* #dokuwiki__top used as anchor for "back to top" button/link links */ $classWideContent = ($ACT === "show") ? "": "wide-content "; ?> - +
Date: Mon, 11 Mar 2019 16:29:31 +0100 Subject: [PATCH 002/153] #17: set min-height for compact header with neither logo nor title --- css/area_header.less | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/css/area_header.less b/css/area_header.less index 0eb54dd..e46c549 100755 --- a/css/area_header.less +++ b/css/area_header.less @@ -212,6 +212,8 @@ /* + + + + + layout option compact + + + + + */ .header-compact { #dokuwiki__header { + min-height: 2.7rem; + .main-title.desktop-only p.claim, p.claim { display: none; @@ -258,11 +260,7 @@ font-size: 1rem; } } - - @media @screen_max-sm { - min-height: 2.7rem; - } - + @media @screen_max-xxs { min-height: 70px; // needed for menu select toolbar From c1e0eaa8303a36a2701cb9109f231a7ab8d2c2bf Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 12 Mar 2019 10:40:53 +0100 Subject: [PATCH 003/153] added support for the sitemapnavi plugin When installed the navigation can be switched between the default sidebar based navigation and the site tree --- Template.php | 80 ++++++++++++++++++++++++++++----- css/area_main-sidebar-tabs.less | 19 ++++++++ css/plugins/sitemapnavi.less | 10 +++++ lang/de/lang.php | 4 ++ lang/en/lang.php | 3 ++ main.php | 1 + style.ini | 3 +- tpl/main-sidebar-nav.php | 9 ++-- 8 files changed, 113 insertions(+), 16 deletions(-) create mode 100644 css/area_main-sidebar-tabs.less create mode 100644 css/plugins/sitemapnavi.less diff --git a/Template.php b/Template.php index ba66389..163fcfc 100644 --- a/Template.php +++ b/Template.php @@ -11,15 +11,19 @@ namespace dokuwiki\template\sprintdoc; */ class Template { - /** - * @var array loaded plugins - */ + /** @var array loaded plugins */ protected $plugins = array( 'sqlite' => null, 'tagging' => null, 'magicmatcher' => null, + 'tplinc' => null, + 'sitemapnavi' => null, ); + /** @var string the type of special navigation to use */ + protected $nav = ''; + + /** * Get the singleton instance * @@ -36,12 +40,26 @@ class Template { */ protected function __construct() { $this->initializePlugins(); + $this->initNavigationCookie(); /** @var \Doku_Event_Handler */ global $EVENT_HANDLER; $EVENT_HANDLER->register_hook('PLUGIN_TPLINC_LOCATIONS_SET', 'BEFORE', $this, 'registerIncludes'); } + /** + * Load all the plugins we support directly + */ + protected function initializePlugins() { + $this->plugins['sqlite'] = plugin_load('helper', 'sqlite'); + if($this->plugins['sqlite']) { + $this->plugins['tagging'] = plugin_load('helper', 'tagging'); + $this->plugins['magicmatcher'] = plugin_load('syntax', 'magicmatcher_issuelist'); + } + $this->plugins['tplinc'] = plugin_load('helper', 'tplinc'); + $this->plugins['sitemapnavi'] = plugin_load('helper', 'sitemapnavi'); + } + /** * Makes include position info available to the tplinc plugin * @@ -71,15 +89,57 @@ class Template { } /** - * Load all the plugins we support directly + * Sets a cookie to remember the requested special navigation */ - protected function initializePlugins() { - $this->plugins['sqlite'] = plugin_load('helper', 'sqlite'); - if($this->plugins['sqlite']) { - $this->plugins['tagging'] = plugin_load('helper', 'tagging'); - $this->plugins['magicmatcher'] = plugin_load('syntax', 'magicmatcher_issuelist'); + protected function initNavigationCookie() { + if ($this->plugins['sitemapnavi'] === null) return; + global $INPUT; + + $nav = $INPUT->str('nav'); + if($nav) { + set_doku_pref('nav', $nav); + $this->nav = $INPUT->str('nav'); + } else { + $this->nav = get_doku_pref('nav', 'sidebar'); } - $this->plugins['tplinc'] = plugin_load('helper', 'tplinc'); + } + + /** + * Return the navigation for the sidebar + * + * Defaults to the standard sidebar mechanism, but supports also the sitemapnavi plugin + * + * @return string + */ + public function getNavigation() { + global $ID; + global $conf; + + // add tabs if multiple navigation types available + $header = ''; + if ($this->plugins['sitemapnavi'] !== null) { + $header = ''; + } + + // decide what to show + if ($this->nav === 'sitetree') { + // site tree created by sitemapnavi plugin + $nav = ''; + } else { + // main navigation, loaded from standard sidebar, fixed up by javascript + $nav = ''; + } + + return $header . $nav; } /** diff --git a/css/area_main-sidebar-tabs.less b/css/area_main-sidebar-tabs.less new file mode 100644 index 0000000..9674def --- /dev/null +++ b/css/area_main-sidebar-tabs.less @@ -0,0 +1,19 @@ +#dokuwiki__aside ul.sidebar-tabs { + margin-top: 0; + margin-bottom: @nav-margin; + + border-bottom: 1px solid @ini_nav_menu_color; + + li { + display: inline-block; + border: 1px solid @ini_nav_menu_color; + padding: 0.25em 0.5em; + margin-bottom: -1px; + border-top-right-radius: @fix_border-radius; + border-top-left-radius: @fix_border-radius; + + &.active { + border-bottom: 1px solid @ini_background_site; + } + } +} diff --git a/css/plugins/sitemapnavi.less b/css/plugins/sitemapnavi.less new file mode 100644 index 0000000..75c6f3f --- /dev/null +++ b/css/plugins/sitemapnavi.less @@ -0,0 +1,10 @@ +#plugin__sitemapnavi { + padding-left: @nav-margin*2.5; + padding-bottom: @nav-margin; + margin-bottom: @nav-margin; + border-bottom: 1px solid @ini_nav_menu_color; + + li { + line-height: @line-height-bigger; + } +} diff --git a/lang/de/lang.php b/lang/de/lang.php index b86959c..478cb44 100755 --- a/lang/de/lang.php +++ b/lang/de/lang.php @@ -59,6 +59,10 @@ $lang['image_detail'] = 'Detailinformationen zum Bild'; $lang['mode_edit'] = 'Seite bearbeiten'; +$lang['nav_sidebar'] = 'Navigation'; +$lang['nav_sitemap'] = 'Seitenbaum'; + + /** * preferences colors */ diff --git a/lang/en/lang.php b/lang/en/lang.php index 48d6210..af8c4b2 100755 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -59,6 +59,9 @@ $lang['image_detail'] = 'image details'; $lang['mode_edit'] = 'Editing Page'; +$lang['nav_sidebar'] = 'Navigation'; +$lang['nav_sitemap'] = 'Site Tree'; + /** * preferences colors */ diff --git a/main.php b/main.php index 990e4a8..20bd84a 100755 --- a/main.php +++ b/main.php @@ -9,6 +9,7 @@ */ use dokuwiki\template\sprintdoc\Template; +Template::getInstance(); if (!defined('DOKU_INC')) die(); /* must be run from within DokuWiki */ header('X-UA-Compatible: IE=edge,chrome=1'); diff --git a/style.ini b/style.ini index 0c266e4..519d234 100755 --- a/style.ini +++ b/style.ini @@ -70,6 +70,7 @@ css/area_nav-usertools.less = all css/area_nav-pagetools.less = all css/area_nav-metabox.less = all css/area_main-sidebar-nav.less = all +css/area_main-sidebar-tabs.less = all css/area_main-sidebar-search.less = all css/area_main-content.less = all css/area_main-content-secedit.less = all @@ -109,7 +110,7 @@ css/plugins/folded.less = all css/plugins/configmanager.less = all css/plugins/starred.less = all css/plugins/quicksubscribe.less = all - +css/plugins/sitemapnavi.less = all css/plugins/data.less = all diff --git a/tpl/main-sidebar-nav.php b/tpl/main-sidebar-nav.php index 3079428..43e2a23 100644 --- a/tpl/main-sidebar-nav.php +++ b/tpl/main-sidebar-nav.php @@ -1,8 +1,7 @@ - + +getNavigation(); +?> +