diff --git a/conf/default.php b/conf/default.php index 05efd8e3..75135021 100755 --- a/conf/default.php +++ b/conf/default.php @@ -7,6 +7,7 @@ */ $conf['showTools'] = 'always'; +$conf['showSearchForm'] = 'always'; $conf['individualTools'] = 0; $conf['showUserHomeLink'] = 1; $conf['showLoginOnFooter'] = 0; diff --git a/conf/metadata.php b/conf/metadata.php index 2c261167..3e23709e 100755 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -7,6 +7,7 @@ */ $meta['showTools'] = array('multichoice', '_choices' => array('never', 'logged', 'always')); +$meta['showSearchForm'] = array('multichoice', '_choices' => array('never', 'logged', 'always')); $meta['individualTools'] = array('onoff'); $meta['showUserHomeLink'] = array('onoff'); $meta['showLoginOnFooter'] = array('onoff'); diff --git a/css/template.css b/css/template.css index b36dfc21..f66cb918 100755 --- a/css/template.css +++ b/css/template.css @@ -122,9 +122,9 @@ input, textarea, select { font-size: .9em; } -#dokuwiki__content .page-header { +/*#dokuwiki__content .page-header { margin-top: 10px; -} +}*/ #dw__logo { margin-right: 10px; @@ -285,3 +285,7 @@ a.iw_user { display: block; margin: .2em auto; } + +ul.btn-group { + padding: 0; +} \ No newline at end of file diff --git a/lang/en/settings.php b/lang/en/settings.php index 3d37675b..610d40ef 100755 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -20,6 +20,10 @@ $lang['showTools_o_never'] = 'Never'; $lang['showTools_o_logged'] = 'When logged in'; $lang['showTools_o_always'] = 'Always'; +$lang['showSearchForm'] = 'Display Search form in navbar'; +$lang['showSearchForm_o_never'] = 'Never'; +$lang['showSearchForm_o_logged'] = 'When logged in'; +$lang['showSearchForm_o_always'] = 'Always'; $lang['sidebarPosition'] = 'DokuWiki Sidebar position (left or right)'; $lang['rightSidebar'] = 'The Right Sidebar page name, empty field disables the right sidebar.
The Right Sidebar is displayed only when the default DokuWiki sidebar is enabled and is on the left position (see the tpl»bootstrap3»sidebarPosition configuration). If do you want only the DokuWiki sidebar on right position, set the tpl»bootstrap3»sidebarPosition configuration with right value'; $lang['tableFullWidth'] = 'Enable 100% full table width (Bootstrap default)'; diff --git a/main.php b/main.php index 5a357bdf..05a00596 100755 --- a/main.php +++ b/main.php @@ -47,7 +47,6 @@ -
@@ -108,7 +107,7 @@
- +
diff --git a/template.info.txt b/template.info.txt index c97e6cb2..b027190c 100755 --- a/template.info.txt +++ b/template.info.txt @@ -1,7 +1,7 @@ base bootstrap3 author Giuseppe Di Terlizzi email giuseppe.diterlizzi@gmail.com -date 2015-07-31 +date 2015-08-01 name Bootstrap3 Template desc Bootstrap-based template for Dokuwiki url https://www.dokuwiki.org/template:bootstrap3 diff --git a/tpl_functions.php b/tpl_functions.php index abb0e7b5..494d0e77 100755 --- a/tpl_functions.php +++ b/tpl_functions.php @@ -162,11 +162,19 @@ function _tpl_action_item($action, $icon, $linkonly = false) { } if ($link = tpl_action($action, 1, 0, 1, ' ')) { - if ($linkonly) return $link; + + if ($linkonly) { + if ($ACT == $action) { + $link = str_replace('class="action ', 'class="action active ', $link); + } + return $link; + } + return '' . $link . ''; } return ''; + } /** @@ -192,13 +200,13 @@ function _tpl_get_container_grid() { return 'container' . (($fluidContainer) ? '-fluid' : ''); } - foreach (split(' ', tpl_getConf('leftSidebarGrid')) as $grid) { - list($col, $media, $size) = split('-', $grid); + foreach (explode(' ', tpl_getConf('leftSidebarGrid')) as $grid) { + list($col, $media, $size) = explode('-', $grid); $grids[$media]['left'] = (int) $size; } - foreach (split(' ', tpl_getConf('rightSidebarGrid')) as $grid) { - list($col, $media, $size) = split('-', $grid); + foreach (explode(' ', tpl_getConf('rightSidebarGrid')) as $grid) { + list($col, $media, $size) = explode('-', $grid); $grids[$media]['right'] = (int) $size; } @@ -237,7 +245,7 @@ function _tpl_user_homepage_link() { * @param string $toc from tpl_toc() * @return string */ -function bootstrap_toc($toc) { +function bootstrap3_toc($toc) { if (! $toc) return false; @@ -292,7 +300,7 @@ function bootstrap_toc($toc) { * @param string $sidebar * @return string */ -function bootstrap_sidebar($sidebar) { +function bootstrap3_sidebar($sidebar) { if (! $sidebar) return false; @@ -346,7 +354,7 @@ function bootstrap_sidebar($sidebar) { * @param bool $autocomplete * @return bool */ -function bootstrap_searchform($ajax = true, $autocomplete = true) { +function bootstrap3_searchform($ajax = true, $autocomplete = true) { global $lang; global $ACT; @@ -372,3 +380,83 @@ function bootstrap_searchform($ajax = true, $autocomplete = true) { return true; } + +/** + * Return all DokuWiki actions for tools menu + * + * @author Giuseppe Di Terlizzi + * + * @return array + */ +function _tpl_tools() { + + global $ACT; + + return array( + + 'user' => array( + 'icon' => 'glyphicon glyphicon-user', + 'items' => array( + 'admin' => array('icon' => 'glyphicon glyphicon-cog'), + 'profile' => array('icon' => 'glyphicon glyphicon-refresh'), + #'register' => array('icon' => 'glyphicon glyphicon-edit'), + #'login' => array('icon' => 'glyphicon glyphicon-log-'.(!empty($_SERVER['REMOTE_USER']) ? 'out' : 'in')), + ) + ), + + 'site' => array( + 'icon' => 'glyphicon glyphicon-cog', + 'items' => array( + 'recent' => array('icon' => 'glyphicon glyphicon-list-alt'), + 'media' => array('icon' => 'glyphicon glyphicon-picture'), + 'index' => array('icon' => 'glyphicon glyphicon-list'), + ) + ), + + 'page' => array( + 'icon' => 'glyphicon glyphicon-file', + 'items' => array( + 'edit' => array('icon' => 'glyphicon glyphicon-' . (($ACT == 'edit') ? 'file' : 'edit')), + 'discussion' => array('icon' => 'glyphicon glyphicon-comment'), + 'revert' => array('icon' => 'glyphicon glyphicon-repeat'), + 'revisions' => array('icon' => 'glyphicon glyphicon-time'), + 'backlink' => array('icon' => 'glyphicon glyphicon-link'), + 'subscribe' => array('icon' => 'glyphicon glyphicon-envelope'), + 'top' => array('icon' => 'glyphicon glyphicon-chevron-up'), + ) + ), + + ); + +} + + +function bootstrap3_tools_menu() { + + $tools = _tpl_tools(); + + foreach ($tools as $id => $menu) { + foreach ($menu['items'] as $action => $item) { + $tools[$id]['menu'][$action] = _tpl_action_item($action, $item['icon']); + } + } + + return $tools; + +} + + +function bootstrap3_toolbar() { + + $tools = _tpl_tools(); + + foreach ($tools as $id => $menu) { + foreach ($menu['items'] as $action => $item) { + $tools[$id]['menu'][$action] = str_replace('class="action ', 'class="action btn btn-default ', _tpl_action_item($action, $item['icon'], 1)); + } + } + + return $tools; + +} + diff --git a/tpl_global.php b/tpl_global.php index e0bbf419..fc22b5ba 100755 --- a/tpl_global.php +++ b/tpl_global.php @@ -6,9 +6,11 @@ * @author Giuseppe Di Terlizzi * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) */ - + $showTools = tpl_getConf('showTools') != 'never' && ( tpl_getConf('showTools') == 'always' || !empty($_SERVER['REMOTE_USER']) ); +$showSearchForm = tpl_getConf('showSearchForm') != 'never' && + ( tpl_getConf('showSearchForm') == 'always' || !empty($_SERVER['REMOTE_USER']) ); $individualTools = tpl_getConf('individualTools'); $showUserHomeLink = tpl_getConf('showUserHomeLink'); $showLoginOnFooter = tpl_getConf('showLoginOnFooter'); @@ -45,44 +47,6 @@ ); -// Tools Menu -$tools = array( - - 'user' => array( - 'icon' => 'glyphicon glyphicon-user', - 'items' => array( - 'admin' => _tpl_action_item('admin', 'glyphicon glyphicon-cog'), - 'profile' => _tpl_action_item('profile', 'glyphicon glyphicon-refresh'), - #'register' => _tpl_action_item('register', 'glyphicon glyphicon-edit'), - #'login' => _tpl_action_item('login', 'glyphicon glyphicon-log-'.(!empty($_SERVER['REMOTE_USER']) ? 'out' : 'in')), - ) - ), - - 'site' => array( - 'icon' => 'glyphicon glyphicon-cog', - 'items' => array( - 'recent' => _tpl_action_item('recent', 'glyphicon glyphicon-list-alt'), - 'media' => _tpl_action_item('media', 'glyphicon glyphicon-picture'), - 'index' => _tpl_action_item('index', 'glyphicon glyphicon-list'), - ) - ), - - 'page' => array( - 'icon' => 'glyphicon glyphicon-file', - 'items' => array( - 'edit' => _tpl_action_item('edit', 'glyphicon glyphicon-edit'), - 'discussion' => _tpl_action_item('discussion', 'glyphicon glyphicon-comment'), - 'revert' => _tpl_action_item('revert', 'glyphicon glyphicon-repeat'), - 'revisions' => _tpl_action_item('revisions', 'glyphicon glyphicon-time'), - 'backlink' => _tpl_action_item('backlink', 'glyphicon glyphicon-link'), - 'subscribe' => _tpl_action_item('subscribe', 'glyphicon glyphicon-bookmark'), - 'top' => _tpl_action_item('top', 'glyphicon glyphicon-chevron-up'), - ) - ), - -); - - if ($showThemeSwitcher && $bootstrapTheme == 'bootswatch') { if (get_doku_pref('bootswatchTheme', null) !== null && get_doku_pref('bootswatchTheme', null) !== '') { @@ -108,7 +72,6 @@ $bootstrapStyles[] = $customTheme; break; case 'bootswatch': - //$bootstrapStyles[] = "//bootswatch.com/$bootswatchTheme/bootstrap.min.css"; $bootstrapStyles[] = "//maxcdn.bootstrapcdn.com/bootswatch/3.3.5/$bootswatchTheme/bootstrap.min.css"; break; case 'default': diff --git a/tpl_navbar.php b/tpl_navbar.php index 656e4607..605f4d2d 100755 --- a/tpl_navbar.php +++ b/tpl_navbar.php @@ -52,9 +52,11 @@ + diff --git a/tpl_sidebar.php b/tpl_sidebar.php index deb1990b..da7f850a 100755 --- a/tpl_sidebar.php +++ b/tpl_sidebar.php @@ -6,7 +6,7 @@
- +
diff --git a/tpl_tools_menu.php b/tpl_tools_menu.php index 558a8e7e..e520d0d1 100755 --- a/tpl_tools_menu.php +++ b/tpl_tools_menu.php @@ -9,8 +9,7 @@ */ ?> - - + @@ -46,7 +45,7 @@ - + $i): ?>