xref: /template/writr/main.php (revision c890aa38b3a3b230bc94dc0306e4542eb9df1336) !
1<?php
2/**
3 * DokuWiki Writr Template
4 *
5 * @link     http://dokuwiki.org/template:writr
6 * @author   Anika Henke <anika@selfthinker.org>
7 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
8 */
9
10if (!defined('DOKU_INC')) die();
11@require_once(dirname(__FILE__).'/tpl_functions.php');
12header('X-UA-Compatible: IE=edge,chrome=1');
13$showSidebar = page_findnearest($conf['sidebar']);
14?>
15<!DOCTYPE html>
16<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $conf['lang'] ?>"
17  lang="<?php echo $conf['lang'] ?>" dir="<?php echo $lang['direction'] ?>" class="no-js">
18<head>
19    <meta charset="UTF-8" />
20    <title><?php tpl_pagetitle() ?> [<?php echo strip_tags($conf['title']) ?>]</title>
21    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" />
22    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css" />
23    <script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
24    <?php tpl_metaheaders() ?>
25    <meta name="viewport" content="width=device-width,initial-scale=1" />
26    <?php echo tpl_favicon(array('favicon', 'mobile')) ?>
27    <?php tpl_includeFile('meta.html') ?>
28</head>
29
30<body id="dokuwiki__top" class="sidebar-closed <?php echo tpl_classes(); ?>">
31    <div id="writr__page" class="hfeed <?php echo ($showSidebar) ? 'hasSidebar' : ''; ?>">
32        <?php tpl_includeFile('header.html') ?>
33
34        <div class="sidebar-area group" id="writr__sidebar">
35            <a id="writr__sidebar-toggle" href="#writr__secondary" title="<?php echo $lang['sidebar'] ?>">
36                <span class="genericon genericon-close"></span>
37                <span class="a11y"><?php echo $lang['sidebar'] ?></span>
38            </a>
39
40            <!-- ********** HEADER ********** -->
41            <header id="writr__masthead" class="site-header" role="banner">
42                <?php
43                    $logoSize = array();
44                    $logoImages = array();
45                    if(tpl_getConf('doLogoChangesByNamespace')){
46                        $logoImages[] = getNS($ID).':logo.png';
47                    }
48                    $logoImages[] = ':logo.png';
49                    $logoImages[] = 'images/logo.png';
50                    $logo = tpl_getMediaFile($logoImages, false, $logoSize);
51                ?>
52
53                <a class="site-logo"  href="<?php echo wl(); ?>" title="<?php echo $conf['title']; ?>" rel="home" accesskey="h" title="[H]">
54                    <img src="<?php echo $logo; ?>" <?php echo $logoSize[3]; ?> alt="" class="no-grav header-image" />
55                </a>
56
57                <div class="site-branding">
58                    <h1 class="site-title"><a href="<?php echo wl(); ?>" rel="home" accesskey="h" title="[H]"><?php echo $conf['title']; ?></a></h1>
59                    <?php if ($conf['tagline']): ?>
60                        <h2 class="site-description"><?php echo $conf['tagline'] ?></h2>
61                    <?php endif ?>
62                </div>
63
64                <div class="search-form widget">
65                    <?php tpl_searchform() ?>
66                </div>
67
68                <?php if (page_findnearest('topnav')): ?>
69                    <nav id="writr__site-navigation" class="main-navigation" role="navigation">
70                        <h3 class="menu-toggle genericon genericon-menu" title="<?php echo tpl_getLang('menu') ?>">
71                            <span class="a11y"><?php echo tpl_getLang('menu') ?></span>
72                        </h3>
73                        <div class="a11y skip-link">
74                            <a href="#writr__content"><?php echo $lang['skip_to_content'] ?></a>
75                        </div>
76                        <?php tpl_include_page('topnav', 1, 1) ?>
77                    </nav><!-- #writr__site-navigation -->
78                <?php endif; ?>
79            </header><!-- #writr__masthead -->
80
81            <div id="writr__secondary" class="widget-area" role="complementary">
82                <?php if ($conf['sidebar']): ?>
83                    <div class="widget">
84                        <?php tpl_includeFile('sidebarheader.html') ?>
85                        <?php tpl_include_page($conf['sidebar'], 1, 1) ?>
86                        <?php tpl_includeFile('sidebarfooter.html') ?>
87                    </div>
88                <?php endif ?>
89
90                <div class="tools widget_links widget">
91                    <?php if(!tpl_getConf('doSiteToolsRequireLogin') || (tpl_getConf('doSiteToolsRequireLogin') && $conf['useacl'])){ ?>
92                        <!-- SITE TOOLS -->
93                        <div class="site-tools">
94                            <?php if(tpl_getConf('showSiteToolsTitle')){ ?>
95                                <h3><?php echo $lang['site_tools'] ?></h3>
96                            <?php } ?>
97                            <ul>
98                                <?php $items = (new \dokuwiki\Menu\SiteMenu())->getItems();
99                                foreach($items as $item) {
100                                    echo '<li>'
101                                        .'<a href="'.$item->getLink().'" class="action '.strtolower($item->getType()).'" rel="nofollow" title="'.$item->getTitle().'">'
102                                        .'<span></span> '
103                                        .$item->getLabel()
104                                        .'</a></li>';
105                                } ?>
106                            </ul>
107                        </div>
108                    <?php } ?>
109
110                    <!-- PAGE TOOLS -->
111                    <div class="page-tools">
112                        <?php if(tpl_getConf('showPageToolsTitle')){ ?>
113                            <h3 class="a11y"><?php echo $lang['page_tools'] ?></h3>
114                        <?php } ?>
115                        <ul>
116                            <?php if (!$conf['useacl'] || ($conf['useacl'] && $INFO['perm'] >= 4)): ?>
117                                <?php
118                                $instructions = '{{NEWPAGE';
119                                if(tpl_getConf('defaultAddNewPage') !== ''){
120                                    $instructions .= tpl_getConf('defaultAddNewPage');
121                                }
122                                $instructions .= '}}';
123                                $instructions = p_get_instructions($instructions);
124                                if(count($instructions) <= 3) {
125                                    $render = p_render('xhtml',$instructions,$info);
126                                    echo '<li>'
127                                        .'<a href="#" class="action AddNewPage" title="'.tpl_getLang('AddNewPage').'">'
128                                        .'<span class="icon"></span>'
129                                        .'<span class="a11y">'.tpl_getLang('AddNewPage').'</span>'
130                                        .'</a>'
131                                        .$render
132                                        .'</li>';
133                                }
134                                ?>
135                                <!-- <li class="plugin_move_page" style="display: list-item;"><a href=""><span>Rename Page</span></a></li> -->
136                            <?php endif ?>
137                            <?php $items = (new \dokuwiki\Menu\PageMenu())->getItems();
138                            foreach($items as $item) {
139                                echo '<li>'
140                                    .'<a href="'.$item->getLink().'" class="action '.strtolower($item->getType()).'" title="'.$item->getTitle().'">'
141                                    .'<span class="icon"></span>'
142                                    .'<span class="a11y">'.$item->getLabel().'</span>'
143                                    .'</a></li>';
144                            } ?>
145                            <?php $translation = plugin_load('helper','translation');
146                            if ($translation){
147                                $render = $translation->showTranslations(false);
148                                echo '<li>'
149                                    .'<a href="#" class="action Translation" title="'.tpl_getLang('Language').'">'
150                                    .'<span class="icon"></span>'
151                                    .'<span class="a11y">'.tpl_getLang('Language').'</span>'
152                                    .'</a>'
153                                    .$render
154                                    .'</li>';
155                            } ?>
156                        </ul>
157                    </div>
158
159                    <?php if ($conf['useacl']): ?>
160                        <!-- USER TOOLS -->
161                        <div class="user-tools">
162                            <?php if(tpl_getConf('showUserToolsTitle')){ ?>
163                                <h3><?php echo $lang['user_tools'] ?></h3>
164                            <?php } ?>
165                            <ul>
166                                <?php $items = (new \dokuwiki\Menu\UserMenu())->getItems();
167                                foreach($items as $item) {
168                                    echo '<li>'
169                                        .'<a href="'.$item->getLink().'" class="action '.strtolower($item->getType()).'" rel="nofollow" title="'.$item->getTitle().'">'
170                                        .'<span></span> '
171                                        .$item->getLabel()
172                                        .'</a></li>';
173                                } ?>
174                            </ul>
175                            <?php
176                                if (!empty($_SERVER['REMOTE_USER'])) {
177                                    echo '<p class="user">'.$INFO['userinfo']['name'].'</p>';
178                                }
179                            ?>
180                        </div>
181                    <?php endif ?>
182                </div>
183
184                <footer id="writr__colophon" class="site-footer" role="contentinfo">
185                    <div class="site-info">
186                        <?php tpl_license('button') ?>
187                        <?php tpl_includeFile('footer.html') ?>
188                    </div><!-- .site-info -->
189                </footer><!-- #writr__colophon -->
190
191            </div>
192        </div>
193
194        <div id="writr__content" class="site-content">
195            <div id="writr__primary" class="content-area">
196
197                <div class="writr-message-area">
198                    <!-- Translation Notication -->
199                    <?php if($translation) { $translation->checkage(); } ?>
200                    <!-- Message Area -->
201                    <?php html_msgarea() ?>
202                </div>
203
204                <!-- BREADCRUMBS -->
205                <?php if($conf['breadcrumbs']){ ?>
206                    <div class="breadcrumbs"><?php tpl_breadcrumbs() ?></div>
207                <?php } ?>
208                <?php if($conf['youarehere']){ ?>
209                    <div class="breadcrumbs"><?php tpl_youarehere() ?></div>
210                <?php } ?>
211
212                <main id="writr__main" class="site-main group" role="main">
213
214                    <?php tpl_flush() ?>
215                    <?php tpl_includeFile('pageheader.html') ?>
216
217                    <!-- wikipage start -->
218                    <?php tpl_content() ?>
219                    <!-- wikipage stop -->
220
221                    <?php tpl_flush() ?>
222                    <?php tpl_includeFile('pagefooter.html') ?>
223                </main><!-- #writr__main -->
224
225		<div class="page-footer">
226			<?php tpl_pageinfo(); ?>
227		</div>
228            </div><!-- #writr__primary -->
229        </div><!-- #writr__content -->
230    </div><!-- #writr__page -->
231
232    <div class="no"><?php tpl_indexerWebBug() /* provide DokuWiki housekeeping, required in all templates */ ?></div>
233
234    <!-- JavaScript Libraries and Scripts -->
235    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.0/dist/jquery.slim.min.js"></script>
236    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
237    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha256-BRqBN7dYgABqtY9Hd4ynE+1slnEw+roEPFzQ7TRRfcg=" crossorigin="anonymous"></script>
238</body>
239</html>
240