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