xref: /template/writr/main.php (revision 6b276c46499fbc62afc453f4aae3c683e43e96c0)
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    <link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css' />
29    <style>
30        body {
31            font-family: <?= tpl_getConf('font') ?>;
32        }
33    </style>
34</head>
35
36<body id="dokuwiki__top" class="sidebar-closed <?php echo tpl_classes(); ?>">
37    <div id="writr__page" class="hfeed <?php echo ($showSidebar) ? 'hasSidebar' : ''; ?>">
38        <?php tpl_includeFile('header.html') ?>
39
40        <div class="sidebar-area group" id="writr__sidebar">
41            <a id="writr__sidebar-toggle" href="#writr__secondary" title="<?php echo $lang['sidebar'] ?>">
42                <span class="genericon genericon-close"></span>
43                <span class="a11y"><?php echo $lang['sidebar'] ?></span>
44            </a>
45
46            <!-- ********** HEADER ********** -->
47            <header id="writr__masthead" class="site-header" role="banner">
48                <?php
49                    $logoSize = array();
50                    $logoImages = array();
51                    if(tpl_getConf('doLogoChangesByNamespace')){
52                        $logoImages[] = getNS($ID).':logo.png';
53                    }
54                    $logoImages[] = ':logo.png';
55                    $logoImages[] = 'images/logo.png';
56                    $logo = tpl_getMediaFile($logoImages, false, $logoSize);
57                ?>
58
59                <a class="site-logo"  href="<?php echo wl(); ?>" title="<?php echo $conf['title']; ?>" rel="home" accesskey="h" title="[H]">
60                    <img src="<?php echo $logo; ?>" <?php echo $logoSize[3]; ?> alt="" class="no-grav header-image" />
61                </a>
62
63                <div class="site-branding">
64                    <h1 class="site-title"><a href="<?php echo wl(); ?>" rel="home" accesskey="h" title="[H]"><?php echo $conf['title']; ?></a></h1>
65                    <?php if ($conf['tagline']): ?>
66                        <h2 class="site-description"><?php echo $conf['tagline'] ?></h2>
67                    <?php endif ?>
68                </div>
69
70                <div class="search-form widget">
71                    <?php tpl_searchform() ?>
72                </div>
73
74                <?php if (page_findnearest('topnav')): ?>
75                    <nav id="writr__site-navigation" class="main-navigation" role="navigation">
76                        <h3 class="menu-toggle genericon genericon-menu" title="<?php echo tpl_getLang('menu') ?>">
77                            <span class="a11y"><?php echo tpl_getLang('menu') ?></span>
78                        </h3>
79                        <div class="a11y skip-link">
80                            <a href="#writr__content"><?php echo $lang['skip_to_content'] ?></a>
81                        </div>
82                        <?php tpl_include_page('topnav', 1, 1) ?>
83                    </nav><!-- #writr__site-navigation -->
84                <?php endif; ?>
85            </header><!-- #writr__masthead -->
86
87            <div id="writr__secondary" class="widget-area" role="complementary">
88                <?php if ($conf['sidebar']): ?>
89                    <div class="widget">
90                        <?php tpl_includeFile('sidebarheader.html') ?>
91                        <?php tpl_include_page($conf['sidebar'], 1, 1) ?>
92                        <?php tpl_includeFile('sidebarfooter.html') ?>
93                    </div>
94                <?php endif ?>
95
96                <div class="tools widget_links widget">
97                    <?php if(!tpl_getConf('doSiteToolsRequireLogin') || (tpl_getConf('doSiteToolsRequireLogin') && $conf['useacl'])){ ?>
98                        <!-- SITE TOOLS -->
99                        <div class="site-tools">
100                            <?php if(tpl_getConf('showSiteToolsTitle')){ ?>
101                                <h3><?php echo $lang['site_tools'] ?></h3>
102                            <?php } ?>
103                            <ul>
104                                <?php $items = (new \dokuwiki\Menu\SiteMenu())->getItems();
105                                foreach($items as $item) {
106                                    echo '<li>'
107                                        .'<a href="'.$item->getLink().'" class="action '.strtolower($item->getType()).'" rel="nofollow" title="'.$item->getTitle().'">'
108                                        .'<span></span> '
109                                        .$item->getLabel()
110                                        .'</a></li>';
111                                } ?>
112                            </ul>
113                        </div>
114                    <?php } ?>
115
116                    <!-- PAGE TOOLS -->
117                    <div class="page-tools">
118                        <?php if(tpl_getConf('showPageToolsTitle')){ ?>
119                            <h3 class="a11y"><?php echo $lang['page_tools'] ?></h3>
120                        <?php } ?>
121                        <ul>
122                            <?php if (!$conf['useacl'] || ($conf['useacl'] && $INFO['perm'] >= 4)): ?>
123                                <?php $instructions = p_get_instructions('{{'.tpl_getConf('defaultAddNewPage').'}}');
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                                <!-- <li class="plugin_move_page" style="display: list-item;"><a href=""><span>Rename Page</span></a></li> -->
135                            <?php endif ?>
136                            <?php $items = (new \dokuwiki\Menu\PageMenu())->getItems();
137                            foreach($items as $item) {
138                                echo '<li>'
139                                    .'<a href="'.$item->getLink().'" class="action '.strtolower($item->getType()).'" title="'.$item->getTitle().'">'
140                                    .'<span class="icon"></span>'
141                                    .'<span class="a11y">'.$item->getLabel().'</span>'
142                                    .'</a></li>';
143                            } ?>
144                            <?php $translation = plugin_load('helper','translation');
145                            if ($translation){
146                                $render = $translation->showTranslations(false);
147                                echo '<li>'
148                                    .'<a href="#" class="action Translation" title="'.tpl_getLang('Language').'">'
149                                    .'<span class="icon"></span>'
150                                    .'<span class="a11y">'.tpl_getLang('Language').'</span>'
151                                    .'</a>'
152                                    .$render
153                                    .'</li>';
154                            } ?>
155                        </ul>
156                    </div>
157
158                    <?php if ($conf['useacl']): ?>
159                        <!-- USER TOOLS -->
160                        <div class="user-tools">
161                            <?php if(tpl_getConf('showUserToolsTitle')){ ?>
162                                <h3><?php echo $lang['user_tools'] ?></h3>
163                            <?php } ?>
164                            <ul>
165                                <?php $items = (new \dokuwiki\Menu\UserMenu())->getItems();
166                                foreach($items as $item) {
167                                    echo '<li>'
168                                        .'<a href="'.$item->getLink().'" class="action '.strtolower($item->getType()).'" rel="nofollow" title="'.$item->getTitle().'">'
169                                        .'<span></span> '
170                                        .$item->getLabel()
171                                        .'</a></li>';
172                                } ?>
173                            </ul>
174                            <?php
175                                if (!empty($_SERVER['REMOTE_USER'])) {
176                                    echo '<p class="user">'.$INFO['userinfo']['name'].'</p>';
177                                }
178                            ?>
179                        </div>
180                    <?php endif ?>
181                </div>
182
183                <footer id="writr__colophon" class="site-footer" role="contentinfo">
184                    <div class="site-info">
185                        <?php tpl_license('button') ?>
186                        <?php tpl_includeFile('footer.html') ?>
187                    </div><!-- .site-info -->
188                </footer><!-- #writr__colophon -->
189
190            </div>
191        </div>
192
193        <div id="writr__content" class="site-content">
194            <div id="writr__primary" class="content-area">
195
196                <div class="writr-message-area">
197                    <!-- Translation Notication -->
198                    <?php if($translation) { $translation->checkage(); } ?>
199                    <!-- Message Area -->
200                    <?php html_msgarea() ?>
201                </div>
202
203                <!-- BREADCRUMBS -->
204                <?php if($conf['breadcrumbs']){ ?>
205                    <div class="breadcrumbs"><?php tpl_breadcrumbs() ?></div>
206                <?php } ?>
207                <?php if($conf['youarehere']){ ?>
208                    <div class="breadcrumbs"><?php tpl_youarehere() ?></div>
209                <?php } ?>
210
211                <main id="writr__main" class="site-main group" role="main">
212
213                    <?php tpl_flush() ?>
214                    <?php tpl_includeFile('pageheader.html') ?>
215
216                    <!-- wikipage start -->
217                    <?php tpl_content() ?>
218                    <!-- wikipage stop -->
219
220                    <?php tpl_flush() ?>
221                    <?php tpl_includeFile('pagefooter.html') ?>
222                </main><!-- #writr__main -->
223
224		<div class="page-footer">
225			<?php tpl_pageinfo(); ?>
226		</div>
227            </div><!-- #writr__primary -->
228        </div><!-- #writr__content -->
229    </div><!-- #writr__page -->
230
231    <div class="no"><?php tpl_indexerWebBug() /* provide DokuWiki housekeeping, required in all templates */ ?></div>
232
233    <!-- JavaScript Libraries and Scripts -->
234    <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.0/dist/jquery.slim.min.js"></script>
235    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
236    <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>
237</body>
238</html>
239