-
Notifications
You must be signed in to change notification settings - Fork 77
/
navbar.php
executable file
·209 lines (152 loc) · 8.58 KB
/
navbar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<?php
/**
* DokuWiki Bootstrap3 Template: Navbar
*
* @link http://dokuwiki.org/template:bootstrap3
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/
// must be run from within DokuWiki
if (!defined('DOKU_INC')) die();
global $lang;
global $TEMPLATE;
$navbar_labels = $TEMPLATE->getConf('navbarLabels');
$navbar_classes = array();
$navbar_classes[] = ($TEMPLATE->getConf('fixedTopNavbar') ? 'navbar-fixed-top' : null);
$navbar_classes[] = ($TEMPLATE->getConf('inverseNavbar') ? 'navbar-inverse' : 'navbar-default');
$home_link = ($TEMPLATE->getConf('homePageURL') ? $TEMPLATE->getConf('homePageURL') : wl());
?>
<!-- navbar -->
<nav id="dw__navbar" class="navbar <?php echo trim(implode(' ', $navbar_classes)) ?>" role="navigation">
<div class="dw-container container<?php echo ($TEMPLATE->isFluidNavbar() ? '-fluid mx-5' : '') ?>">
<div class="navbar-header">
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<?php
// get logo either out of the template images folder or data/media folder
$logoSize = array();
$logo = tpl_getMediaFile(array(':wiki:logo.png', ':logo.png', 'images/logo.png'), false, $logoSize);
$title = $conf['title'];
$tagline = ($conf['tagline']) ? '<span id="dw__tagline">'.$conf['tagline'].'</span>' : '';
$logo_size = 'height="20"';
if ($tagline) {
$logo_size = 'height="32" style="margin-top:-5px"';
}
// display logo and wiki title in a link to the home page
tpl_link(
$home_link,
'<img src="'.$logo.'" alt="'.$title.'" class="pull-left'.(($tagline) ? ' dw-logo-tagline' : '').'" id="dw__logo" '.$logo_size.' /> <span id="dw__title" '.($tagline ? 'style="margin-top:-5px"': '').'>'. $title . $tagline .'</span>',
'accesskey="h" title="[H]" class="navbar-brand"'
);
?>
</div>
<div class="collapse navbar-collapse">
<?php if ($TEMPLATE->getConf('showHomePageLink')) :?>
<ul class="nav navbar-nav">
<li<?php echo ((wl($ID) == $home_link) ? ' class="active"' : ''); ?>>
<?php tpl_link($home_link, '<i class="mdi mdi-home"></i> Home') ?>
</li>
</ul>
<?php endif; ?>
<?php
echo $TEMPLATE->getNavbar(); // Include the navbar for different namespaces
echo $TEMPLATE->getDropDownPage('dropdownpage');
?>
<?php if(file_exists(dirname(__FILE__) . '/../navbar.html') && $TEMPLATE->getConf('useLegacyNavbar')): ?>
<ul class="nav navbar-nav">
<?php tpl_includeFile('navbar.html') ?>
</ul>
<?php endif; ?>
<div class="navbar-right" id="dw__navbar_items">
<?php
// Search form
include_once(template('tpl/navbar-searchform.php'));
// Admin Menu
include_once(template('tpl/menu-admin.php'));
// Tools Menu
include_once(template('tpl/menu-tools.php'));
// Theme Switcher Menu
include_once(template('tpl/theme-switcher.php'));
// Translation Menu
include_once(template('tpl/translation.php'));
// Add New Page
include_once(template('tpl/new-page.php'));
?>
<ul class="nav navbar-nav">
<?php
if ($TEMPLATE->getConf('showEditBtn')) {
$action = null;
global $ACT;
if ($ACT == 'edit') {
$action = 'show';
}
if ($ACT == 'show') {
$action = 'edit';
}
if ($action && $edit_action = $TEMPLATE->getToolMenuItem('page', $action)) {
$edit_attr = $edit_action->getLinkAttributes();
$edit_html = '<li class="hidden-xs"><a '. buildAttributes($edit_attr) . '>';
$edit_html .= \inlineSVG($edit_action->getSvg());
#$edit_html .= hsc($edit_action->getLabel());
$edit_html .= "</a></li>";
echo $edit_html;
}
}
?>
<?php if ($TEMPLATE->getConf('fluidContainerBtn')): ?>
<li class="hidden-xs <?php echo ($TEMPLATE->getFluidContainerStatus() ? 'active' : '')?>">
<a href="#" class="btn-fluid-container" title="<?php echo tpl_getLang('expand_container') ?>">
<i class="mdi mdi-arrow-expand-all"></i><span class="<?php echo (in_array('expand', $TEMPLATE->getConf('navbarLabels')) ? '' : 'hidden-lg hidden-md hidden-sm') ?>"> <?php echo tpl_getLang('expand_container') ?></span>
</a>
</li>
<?php endif; ?>
<?php if (empty($_SERVER['REMOTE_USER'])): ?>
<li>
<span class="dw__actions dw-action-icon">
<?php
$register_action = $TEMPLATE->getToolMenuItem('user', 'register');
$login_action = $TEMPLATE->getToolMenuItem('user', 'login');
if ($register_action) {
$register_attr = $register_action->getLinkAttributes();
$register_attr['class'] .= ' btn btn-success navbar-btn';
$register_html = '<a '. buildAttributes($register_attr) . '>';
$register_html .= \inlineSVG($register_action->getSvg());
$register_html .= '<span class="'. (in_array('register', $navbar_labels) ? null : 'sr-only') .'"> ' . hsc($register_action->getLabel()) . '</span>';
$register_html .= "</a>";
echo $register_html;
}
if (! $TEMPLATE->getConf('hideLoginLink') && $login_action) {
$login_attr = $login_action->getLinkAttributes();
$login_attr['class'] .= ' btn btn-default navbar-btn';
$login_html = '<a '. buildAttributes($login_attr) . '>';
$login_html .= \inlineSVG($login_action->getSvg());
$login_html .= '<span class="'. (in_array('login', $navbar_labels) ? null : 'sr-only') .'"> ' . hsc($login_action->getLabel()) . '</span>';
$login_html .= "</a>";
echo $login_html;
}
?>
</span>
</li>
<?php endif; ?>
</ul>
<?php if ($TEMPLATE->getConf('tocLayout') == 'navbar'): ?>
<ul class="nav navbar-nav hide" id="dw__toc_menu">
<li class="dropdown">
<a href="<?php wl($ID) ?>" class="dropdown-toggle" data-target="#" data-toggle="dropdown" title="<?php echo $lang['toc'] ?>" role="button" aria-haspopup="true" aria-expanded="false">
<i class="mdi mdi-view-list"></i> <span class="hidden-lg hidden-md hidden-sm"><?php echo $lang['toc'] ?></span><span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu" style="max-height: 400px; overflow-y: auto">
<li class="dropdown-header"><i class="mdi mdi-view-list"></i> <?php echo $lang['toc'] ?></li>
</ul>
</li>
</ul>
<?php endif; ?>
<?php include_once(template('tpl/menu-user.php')); ?>
</div>
</div>
</div>
</nav>
<!-- navbar -->