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