xref: /template/writr/main.php (revision 0e5c21f3faa8901098b429e7502b22fccfb13a92)
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 href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/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 echo tpl_getLogo(); ?>
43
44                <div class="site-branding">
45                    <h1 class="site-title"><a href="<?php echo wl(); ?>" rel="home" accesskey="h" title="[H]"><?php echo $conf['title']; ?></a></h1>
46                    <?php if ($conf['tagline']): ?>
47                        <h2 class="site-description"><?php echo $conf['tagline'] ?></h2>
48                    <?php endif ?>
49                </div>
50
51                <div class="search-form widget">
52                    <?php tpl_searchform() ?>
53                </div>
54
55                <?php if (page_findnearest('topnav')): ?>
56                    <nav id="writr__site-navigation" class="main-navigation" role="navigation">
57                        <h3 class="menu-toggle genericon genericon-menu" title="<?php echo tpl_getLang('menu') ?>">
58                            <span class="a11y"><?php echo tpl_getLang('menu') ?></span>
59                        </h3>
60                        <div class="a11y skip-link">
61                            <a href="#writr__content"><?php echo $lang['skip_to_content'] ?></a>
62                        </div>
63                        <?php tpl_include_page('topnav', 1, 1) ?>
64                    </nav><!-- #writr__site-navigation -->
65                <?php endif; ?>
66            </header><!-- #writr__masthead -->
67
68            <div id="writr__secondary" class="widget-area" role="complementary">
69                <?php if ($conf['sidebar']): ?>
70                    <div class="widget">
71                        <?php tpl_includeFile('sidebarheader.html') ?>
72                        <?php tpl_include_page($conf['sidebar'], 1, 1) ?>
73                        <?php tpl_includeFile('sidebarfooter.html') ?>
74                    </div>
75                <?php endif ?>
76
77                <div class="tools widget_links widget">
78                    <?php if(!tpl_getConf('doSiteToolsRequireLogin') || (tpl_getConf('doSiteToolsRequireLogin') && $conf['useacl'])){ ?>
79                        <!-- SITE TOOLS -->
80                        <div class="site-tools">
81                            <h3 <?php if(!tpl_getConf('showSiteToolsTitle')){ echo 'class="a11y"'; } ?>><?php echo $lang['site_tools'] ?></h3>
82                            <ul>
83                                <?php $items = (new \dokuwiki\Menu\SiteMenu())->getItems();
84                                foreach($items as $item) {
85                                    echo '<li>'
86                                        .'<a href="'.$item->getLink().'" class="action '.strtolower($item->getType()).'" rel="nofollow" title="'.$item->getTitle().'">'
87                                        .'<span></span> '
88                                        .$item->getLabel()
89                                        .'</a></li>';
90                                } ?>
91                            </ul>
92                        </div>
93                    <?php } ?>
94
95                    <!-- PAGE TOOLS -->
96                    <div class="page-tools">
97                        <h3 <?php if(!tpl_getConf('showPageToolsTitle')){ echo 'class="a11y"'; } ?>><?php echo $lang['page_tools'] ?></h3>
98                        <ul>
99                            <?php if (!$conf['useacl'] || ($conf['useacl'] && $INFO['perm'] >= 4)): ?>
100                                <?php
101                                $instructions = '{{NEWPAGE';
102                                if(tpl_getConf('defaultAddNewPage') !== ''){
103                                    $instructions .= '>';
104                                    $instructions .= tpl_getConf('defaultAddNewPage');
105                                }
106                                $instructions .= '}}';
107                                $instructions = p_get_instructions($instructions);
108                                if(count($instructions) <= 3) {
109                                    $render = p_render('xhtml',$instructions,$info);
110                                    echo '<li>'
111                                        .'<a href="#" class="action AddNewPage" title="'.tpl_getLang('AddNewPage').'">'
112                                        .'<span class="icon"></span>'
113                                        .'<span class="a11y">'.tpl_getLang('AddNewPage').'</span>'
114                                        .'</a>'
115                                        .$render
116                                        .'</li>';
117                                }
118                                ?>
119                            <?php endif ?>
120                            <?php $translation = plugin_load('helper','translation');
121                            if ($translation){
122                                $render = $translation->showTranslations(false);
123                                echo '<li>'
124                                    .'<a href="#" class="action Translation" title="'.tpl_getLang('Language').'">'
125                                    .'<span class="icon"></span>'
126                                    .'<span class="a11y">'.tpl_getLang('Language').'</span>'
127                                    .'</a>'
128                                    .$render
129                                    .'</li>';
130                            } ?>
131                            <?php $items = (new \dokuwiki\Menu\PageMenu())->getItems();
132                            foreach($items as $item) {
133                                $attributes = $item->getLinkAttributes();
134                                $html = '<li><a';
135                                foreach($attributes as $key => $value) {
136                                    $html .= ' '.$key.'="'.$value.'"';
137                                }
138                                $html .= '><span class="icon"></span>'
139                                    .'<span class="a11y">'.$item->getLabel().'</span>'
140                                    .'</a></li>';
141                                echo $html;
142                            } ?>
143                        </ul>
144                    </div>
145
146                    <?php if ($conf['useacl']): ?>
147                        <!-- USER TOOLS -->
148                        <div class="user-tools">
149                            <h3 <?php if(!tpl_getConf('showUserToolsTitle')){ echo 'class="a11y"'; } ?>><?php echo $lang['user_tools'] ?></h3>
150                            <ul>
151                                <?php $items = (new \dokuwiki\Menu\UserMenu())->getItems();
152                                foreach($items as $item) {
153                                    echo '<li>'
154                                        .'<a href="'.$item->getLink().'" class="action '.strtolower($item->getType()).'" rel="nofollow" title="'.$item->getTitle().'">'
155                                        .'<span></span> '
156                                        .$item->getLabel()
157                                        .'</a></li>';
158                                } ?>
159                            </ul>
160                            <?php
161                                if (!empty($_SERVER['REMOTE_USER'])) {
162                                    echo '<p class="user">';
163                                    tpl_userinfo();
164                                    echo '</p>';
165                                }
166                            ?>
167                        </div>
168                    <?php endif ?>
169                </div>
170
171                <footer id="writr__colophon" class="site-footer" role="contentinfo">
172                    <div class="site-info">
173                        <?php tpl_license('button') ?>
174                        <?php tpl_includeFile('footer.html') ?>
175                    </div><!-- .site-info -->
176                </footer><!-- #writr__colophon -->
177
178            </div>
179        </div>
180
181        <div id="writr__content" class="site-content">
182            <div id="writr__primary" class="content-area">
183
184                <div class="writr-message-area">
185                    <!-- Translation Notication -->
186                    <?php if($translation) { $translation->checkage(); } ?>
187                    <!-- Message Area -->
188                    <?php html_msgarea() ?>
189                </div>
190
191                <!-- BREADCRUMBS -->
192                <?php if($conf['breadcrumbs']){ ?>
193                    <div class="breadcrumbs"><?php tpl_breadcrumbs() ?></div>
194                <?php } ?>
195                <?php if($conf['youarehere']){ ?>
196                    <div class="breadcrumbs"><?php tpl_youarehere() ?></div>
197                <?php } ?>
198
199                <main id="writr__main" class="site-main group" role="main">
200
201                    <?php tpl_flush() ?>
202                    <?php tpl_includeFile('pageheader.html') ?>
203
204                    <!-- wikipage start -->
205                    <?php tpl_content() ?>
206                    <!-- wikipage stop -->
207
208                    <?php tpl_flush() ?>
209                    <?php tpl_includeFile('pagefooter.html') ?>
210                </main><!-- #writr__main -->
211
212		<div class="page-footer">
213			<?php tpl_pageinfo(); ?>
214		</div>
215            </div><!-- #writr__primary -->
216        </div><!-- #writr__content -->
217    </div><!-- #writr__page -->
218
219    <div class="no"><?php tpl_indexerWebBug() /* provide DokuWiki housekeeping, required in all templates */ ?></div>
220</body>
221</html>
222