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