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