xref: /template/writr/main.php (revision 0e7d5e1e2af2e57d7851d30da2c6347cd7eec1a3)
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('makeFullWidth')){ echo "makeFullWidth"; } ?> <?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_getSiteBranding(); ?>
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') || !$conf['useacl'] || (tpl_getConf('doSiteToolsRequireLogin') && isset($INFO['userinfo']))){ ?>
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                </div>
95
96                <footer id="writr__colophon" class="site-footer" role="contentinfo">
97                    <div class="site-info">
98                        <?php tpl_license('button') ?>
99                        <?php tpl_includeFile('footer.html') ?>
100                    </div><!-- .site-info -->
101                </footer><!-- #writr__colophon -->
102
103            </div>
104
105            <?php echo tpl_getMenu('sidebarmenu'); ?>
106        </div>
107
108        <!-- PAGE TOOLS -->
109        <div class="page-tools">
110            <h3 <?php if(!tpl_getConf('showPageToolsTitle')){ echo 'class="a11y"'; } ?>><?php echo $lang['page_tools'] ?></h3>
111            <ul>
112                <?php if (!$conf['useacl'] || ($conf['useacl'] && $INFO['perm'] >= 4)): ?>
113                    <?php
114                    $instructions = '{{NEWPAGE';
115                    if(tpl_getConf('defaultAddNewPage') !== ''){
116                        $instructions .= '>';
117                        $instructions .= tpl_getConf('defaultAddNewPage');
118                    }
119                    $instructions .= '}}';
120                    $instructions = p_get_instructions($instructions);
121                    if(count($instructions) <= 3) {
122                        $render = p_render('xhtml',$instructions,$info);
123                        echo '<li>'
124                            .'<a href="#" class="action AddNewPage" title="'.tpl_getLang('AddNewPage').'">'
125                            .'<span class="icon"></span>'
126                            .'<span class="a11y">'.tpl_getLang('AddNewPage').'</span>'
127                            .'</a>'
128                            .$render
129                            .'</li>';
130                    }
131                    ?>
132                <?php endif ?>
133                <?php $translation = plugin_load('helper','translation');
134                if ($translation){
135                    $render = $translation->showTranslations(false);
136                    echo '<li>'
137                        .'<a href="#" class="action Translation" title="'.tpl_getLang('Language').'">'
138                        .'<span class="icon"></span>'
139                        .'<span class="a11y">'.tpl_getLang('Language').'</span>'
140                        .'</a>'
141                        .$render
142                        .'</li>';
143                } ?>
144                <?php $items = (new \dokuwiki\Menu\PageMenu())->getItems();
145                foreach($items as $item) {
146                    $attributes = $item->getLinkAttributes();
147                    $html = '<li><a';
148                    foreach($attributes as $key => $value) {
149                        $html .= ' '.$key.'="'.$value.'"';
150                    }
151                    $html .= '><span class="icon"></span>'
152                        .'<span class="a11y">'.$item->getLabel().'</span>'
153                        .'</a></li>';
154                    echo $html;
155                } ?>
156            </ul>
157        </div>
158
159        <div id="writr__content" class="site-content">
160            <div id="writr__primary" class="content-area">
161
162                <div class="writr-message-area">
163                    <!-- Translation Notication -->
164                    <?php if($translation) { $translation->checkage(); } ?>
165                    <!-- Message Area -->
166                    <?php html_msgarea() ?>
167                </div>
168
169                <!-- BREADCRUMBS -->
170                <?php if($conf['breadcrumbs']){ ?>
171                    <div class="breadcrumbs"><?php tpl_breadcrumbs() ?></div>
172                <?php } ?>
173                <?php if($conf['youarehere']){ ?>
174                    <div class="breadcrumbs"><?php tpl_youarehere() ?></div>
175                <?php } ?>
176
177                <main id="writr__main" class="site-main group" role="main">
178
179                    <?php tpl_flush() ?>
180                    <?php tpl_includeFile('pageheader.html') ?>
181
182                    <!-- wikipage start -->
183                    <?php tpl_content() ?>
184                    <!-- wikipage stop -->
185
186                    <?php tpl_flush() ?>
187                    <?php tpl_includeFile('pagefooter.html') ?>
188                </main><!-- #writr__main -->
189
190		<div class="page-footer">
191			<?php tpl_pageinfo(); ?>
192		</div>
193            </div><!-- #writr__primary -->
194        </div><!-- #writr__content -->
195    </div><!-- #writr__page -->
196
197    <div class="no"><?php tpl_indexerWebBug() /* provide DokuWiki housekeeping, required in all templates */ ?></div>
198</body>
199</html>
200