1 | <?php
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Default box configuration of the "monobook" DokuWiki template
|
---|
5 | *
|
---|
6 | *
|
---|
7 | * LICENSE: This file is open source software (OSS) and may be copied under
|
---|
8 | * certain conditions. See COPYING file for details or try to contact
|
---|
9 | * the author(s) of this file in doubt.
|
---|
10 | *
|
---|
11 | * @license GPLv2 (http://www.gnu.org/licenses/gpl2.html)
|
---|
12 | * @author Andreas Haerter <[email protected]>
|
---|
13 | * @link http://andreas-haerter.com/projects/dokuwiki-template-monobook
|
---|
14 | * @link http://www.dokuwiki.org/template:monobook
|
---|
15 | * @link http://www.dokuwiki.org/devel:configuration
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 |
|
---|
20 | /******************************************************************************
|
---|
21 | ******************************** ATTENTION *********************************
|
---|
22 | DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES!
|
---|
23 | ******************************************************************************
|
---|
24 | If you want to add some own boxes, have a look at the README of this
|
---|
25 | template and "/user/boxes.php". You have been warned!
|
---|
26 | *****************************************************************************/
|
---|
27 |
|
---|
28 |
|
---|
29 | //check if we are running within the DokuWiki environment
|
---|
30 | if (!defined("DOKU_INC")){
|
---|
31 | die();
|
---|
32 | }
|
---|
33 |
|
---|
34 |
|
---|
35 | //note: The boxes will be rendered in the order they were defined. Means:
|
---|
36 | // first box will be rendered first, last box will be rendered at last.
|
---|
37 |
|
---|
38 |
|
---|
39 | //hide boxes for anonymous clients (closed wiki)?
|
---|
40 | if (empty($conf["useacl"]) || //are there any users?
|
---|
41 | $loginname !== "" || //user is logged in?
|
---|
42 | !tpl_getConf("monobook_closedwiki")){
|
---|
43 |
|
---|
44 | //Languages/translations provided by Andreas Gohr's translation plugin,
|
---|
45 | //see <http://www.dokuwiki.org/plugin:translation>. Create plugin object if
|
---|
46 | //needed.
|
---|
47 | if (file_exists(DOKU_PLUGIN."translation/syntax.php") &&
|
---|
48 | !plugin_isdisabled("translation")){
|
---|
49 | $transplugin = &plugin_load("syntax", "translation");
|
---|
50 | } else {
|
---|
51 | $transplugin = false;
|
---|
52 | }
|
---|
53 |
|
---|
54 | //navigation
|
---|
55 | if (tpl_getConf("monobook_navigation")){
|
---|
56 | //headline
|
---|
57 | $_monobook_boxes["p-x-navigation"]["headline"] = $lang["monobook_bar_navigation"];
|
---|
58 |
|
---|
59 | //detect wiki page to load as content
|
---|
60 | if (!empty($transplugin) &&
|
---|
61 | is_object($transplugin) &&
|
---|
62 | tpl_getConf("monobook_navigation_translate")){
|
---|
63 | //translated navigation?
|
---|
64 | $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part
|
---|
65 | $transplugin_langs = explode(" ", trim($transplugin->getConf("translations"))); //available languages
|
---|
66 | if (empty($transplugin_langs) ||
|
---|
67 | empty($transplugin_langcur) ||
|
---|
68 | !is_array($transplugin_langs) ||
|
---|
69 | !in_array($transplugin_langcur, $transplugin_langs)) {
|
---|
70 | //current page is no translation or something is wrong, load default navigation
|
---|
71 | $nav_location = tpl_getConf("monobook_navigation_location");
|
---|
72 | } else {
|
---|
73 | //load language specific navigation
|
---|
74 | $nav_location = tpl_getConf("monobook_navigation_location")."_".$transplugin_langcur;
|
---|
75 | }
|
---|
76 | }else{
|
---|
77 | //default navigation, no translation
|
---|
78 | $nav_location = tpl_getConf("monobook_navigation_location");
|
---|
79 | }
|
---|
80 |
|
---|
81 | //content
|
---|
82 | if (empty($conf["useacl"]) ||
|
---|
83 | auth_quickaclcheck(cleanID($nav_location)) >= AUTH_READ){ //current user got access?
|
---|
84 | //get the rendered content of the defined wiki article to use as custom navigation
|
---|
85 | $interim = tpl_include_page($nav_location, false);
|
---|
86 | if ($interim === "" ||
|
---|
87 | $interim === false){
|
---|
88 | //creation/edit link if the defined page got no content
|
---|
89 | $_monobook_boxes["p-x-navigation"]["xhtml"] = "[ ".html_wikilink($nav_location, hsc($lang["monobook_fillplaceholder"]." (".$nav_location.")"))." ]<br />";
|
---|
90 | }else{
|
---|
91 | //the rendered page content
|
---|
92 | $_monobook_boxes["p-x-navigation"]["xhtml"] = $interim;
|
---|
93 | }
|
---|
94 | }
|
---|
95 | unset($nav_location);
|
---|
96 | }
|
---|
97 |
|
---|
98 | //table of contents (TOC) - show outside the article? (this is a dirty hack but often requested)
|
---|
99 | if (tpl_getConf("monobook_toc_position") === "sidebar"){
|
---|
100 | //check if the current page got a TOC
|
---|
101 | $toc = tpl_toc(true);
|
---|
102 | if (!empty($toc)) {
|
---|
103 | //headline
|
---|
104 | $_monobook_boxes["p-toc"]["headline"] = $lang["toc"]; //language comes from DokuWiki core
|
---|
105 |
|
---|
106 | //content
|
---|
107 | $_monobook_boxes["p-toc"]["xhtml"] = //get rid of some styles and the embedded headline
|
---|
108 | str_replace(//search
|
---|
109 | array("<div class=\"tocheader toctoggle\" id=\"toc__header\">".$lang["toc"]."</div>", //language comes from DokuWiki core
|
---|
110 | " class=\"toc\"",
|
---|
111 | " id=\"toc__inside\""),
|
---|
112 | //replace
|
---|
113 | "",
|
---|
114 | //haystack
|
---|
115 | $toc);
|
---|
116 | }
|
---|
117 | unset($toc);
|
---|
118 | }
|
---|
119 |
|
---|
120 | //search
|
---|
121 | if (tpl_getConf("monobook_search") &&
|
---|
122 | actionOK("search")){ //check if action is disabled
|
---|
123 | //headline
|
---|
124 | $_monobook_boxes["p-search"]["headline"] = $lang["monobook_bar_search"];
|
---|
125 |
|
---|
126 | //content
|
---|
127 | $_monobook_boxes["p-search"]["xhtml"] = "<form action=\"".wl()."\" accept-charset=\"utf-8\" id=\"dw__search\" name=\"dw__search\">\n"
|
---|
128 | ." <input type=\"hidden\" name=\"do\" value=\"search\" />\n"
|
---|
129 | ." <input id=\"qsearch__in\" name=\"id\" type=\"text\" accesskey=\"f\" value=\"\" />\n"
|
---|
130 | ." <input type=\"button\" class=\"searchButton\" id=\"searchGoButton\" value=\"".hsc($lang["monobook_btn_go"])."\" onclick=\"document.location.href='".DOKU_BASE.DOKU_SCRIPT."?id='+document.getElementById('qsearch__in').value;\" /> \n"
|
---|
131 | ." <input type=\"submit\" name=\"fulltext\" class=\"searchButton\" value=\"".hsc($lang["monobook_btn_search"])."\" />\n"
|
---|
132 | ."</form>";
|
---|
133 | }
|
---|
134 |
|
---|
135 | //toolbox
|
---|
136 | if (tpl_getConf("monobook_toolbox")){
|
---|
137 | //headline
|
---|
138 | $_monobook_boxes["p-tb"]["headline"] = $lang["monobook_bar_toolbox"];
|
---|
139 |
|
---|
140 | //content
|
---|
141 | if (tpl_getConf("monobook_toolbox_default")){
|
---|
142 | //define default, predefined toolbox
|
---|
143 | $_monobook_boxes["p-tb"]["xhtml"] = " <ul>\n";
|
---|
144 | $_monobook_boxes["p-tb"]["xhtml"] .= " <li id=\"tb-refresh\"><a href=\"".wl(cleanID(getId()), array("purge" => "true"))."\" rel=\"nofollow\">Refresh Page</a></li>\n";
|
---|
145 | if (actionOK("backlink")){ //check if action is disabled
|
---|
146 | $_monobook_boxes["p-tb"]["xhtml"] .= " <li id=\"tb-whatlinkshere\"><a href=\"".wl(cleanID(getId()), array("do" => "backlink"))."\">".hsc($lang["monobook_toolbxdef_whatlinkshere"])."</a></li>\n"; //we might use tpl_actionlink("backlink", "", "", hsc($lang["monobook_toolbxdef_whatlinkshere"]), true), but it would be the only toolbox link where this is possible... therefore I don't use it to be consistent
|
---|
147 | }
|
---|
148 | if (actionOK("recent")){ //check if action is disabled
|
---|
149 | $_monobook_boxes["p-tb"]["xhtml"] .= " <li id=\"tb-recent\"><a href=\"".wl("", array("do" => "recent"))."\" rel=\"nofollow\">".hsc($lang["btn_recent"])."</a></li>\n"; //language comes from DokuWiki core
|
---|
150 | }
|
---|
151 | /*
|
---|
152 | if (actionOK("media")){ //check if action is disabled
|
---|
153 | if (function_exists("media_managerURL")) {
|
---|
154 | //use new media manager (available on releases newer than 2011-05-25a "Rincewind" / since 2011-11-10 "Angua" RC1)
|
---|
155 | $_monobook_boxes["p-tb"]["xhtml"] .= " <li id=\"tb-upload\"><a href=\"".wl("", array("do" => "media"))."\" rel=\"nofollow\">".hsc($lang["btn_media"])."</a></li>\n"; //language comes from DokuWiki core
|
---|
156 | }else{
|
---|
157 | $_monobook_boxes["p-tb"]["xhtml"] .= " <li id=\"tb-upload\"><a href=\"".DOKU_BASE."lib/exe/mediamanager.php?ns=".getNS(getID())."\" rel=\"nofollow\">".hsc($lang["monobook_toolbxdef_upload"])."</a></li>\n";
|
---|
158 | }
|
---|
159 | }
|
---|
160 | */
|
---|
161 | if (actionOK("index")){ //check if action is disabled
|
---|
162 | //$_monobook_boxes["p-tb"]["xhtml"] .= " <li id=\"tb-special\"><a href=\"".wl("", array("do" => "index"))."\" rel=\"nofollow\">".hsc($lang["monobook_toolbxdef_siteindex"])."</a></li>\n";
|
---|
163 | $_monobook_boxes["p-tb"]["xhtml"] .= " <li id=\"tb-special\"><a href=\"".wl("", array("id" => "wiki:special"))."\" rel=\"nofollow\">Special Pages</a></li>\n";
|
---|
164 | // add a link to All Pages --kjdon
|
---|
165 | // $_monobook_boxes["p-tb"]["xhtml"] .= " <li id=\"tb-all\"><a href=\"".wl("", array("id" => "wiki:special", "do" => "index"))."\" rel=\"nofollow\">All Pages</a></li>\n";
|
---|
166 | // changed the All Pages link to make the en namespace be open --kjdon
|
---|
167 | $_monobook_boxes["p-tb"]["xhtml"] .= " <li id=\"tb-all\"><a href=\"".wl("", array("idx" => "en"))."\" rel=\"nofollow\">All Pages</a></li>\n";
|
---|
168 | }
|
---|
169 | //add link to a printable version? this is not needed in every case (and
|
---|
170 | //therefore configurable) cause the print stylesheets are used automatically
|
---|
171 | //by common browsers if the user wants to print. but often users are
|
---|
172 | //searching for a print version instead of using the browser's printing
|
---|
173 | //preview...
|
---|
174 | if (tpl_getConf("monobook_toolbox_default_print")){
|
---|
175 | $_monobook_boxes["p-tb"]["xhtml"] .= " <li id=\"tb-print\"><a href=\"".wl(cleanID(getId()), array("rev" =>(int)$rev, "mddo" => "print"))."\" rel=\"nofollow\">".hsc($lang["monobook_toolbxdef_print"])."</a></li>\n";
|
---|
176 | }
|
---|
177 | $_monobook_boxes["p-tb"]["xhtml"] .= " <li id=\"tb-permanent\"><a href=\"".wl(cleanID(getId()), array("rev" =>(int)$rev))."\" rel=\"nofollow\">".hsc($lang["monobook_toolboxdef_permanent"])."</a></li>\n"
|
---|
178 | ." <li id=\"tb-cite\"><a href=\"".wl(cleanID(getId()), array("rev" =>(int)$rev, "mddo" => "cite"))."\" rel=\"nofollow\">".hsc($lang["monobook_toolboxdef_cite"])."</a></li>\n"
|
---|
179 | ." </ul>";
|
---|
180 | }else{
|
---|
181 | //we have to use a custom toolbox
|
---|
182 | if (empty($conf["useacl"]) ||
|
---|
183 | auth_quickaclcheck(cleanID(tpl_getConf("monobook_toolbox_location"))) >= AUTH_READ){ //current user got access?
|
---|
184 | //get the rendered content of the defined wiki article to use as
|
---|
185 | //custom toolbox
|
---|
186 | $interim = tpl_include_page(tpl_getConf("monobook_toolbox_location"), false);
|
---|
187 | if ($interim === "" ||
|
---|
188 | $interim === false){
|
---|
189 | //add creation/edit link if the defined page got no content
|
---|
190 | $_monobook_boxes["p-tb"]["xhtml"] = "<li>[ ".html_wikilink(tpl_getConf("monobook_toolbox_location"), hsc($lang["monobook_fillplaceholder"]." (".tpl_getConf("monobook_toolbox_location").")"), null)." ]<br /></li>";
|
---|
191 | }else{
|
---|
192 | //add the rendered page content
|
---|
193 | $_monobook_boxes["p-tb"]["xhtml"] = $interim."\n";
|
---|
194 | }
|
---|
195 | }else{
|
---|
196 | //we are not allowed to show the content of the defined wiki
|
---|
197 | //article to use as custom sitenotice.
|
---|
198 | //$_monobook_boxes["p-tb"]["xhtml"] = hsc($lang["monobook_accessdenied"])." (".tpl_getConf("monobook_toolbox_location").")";
|
---|
199 | }
|
---|
200 | }
|
---|
201 | }
|
---|
202 |
|
---|
203 | //Languages/translations provided by Andreas Gohr's translation plugin,
|
---|
204 | //see <http://www.dokuwiki.org/plugin:translation>
|
---|
205 | if (!empty($transplugin) &&
|
---|
206 | is_object($transplugin)){
|
---|
207 | $_monobook_boxes["p-lang"]["headline"] = $lang["monobook_bar_inotherlanguages"];
|
---|
208 | $_monobook_boxes["p-lang"]["xhtml"] = $transplugin->_showTranslations();
|
---|
209 | }
|
---|
210 |
|
---|
211 | }else{
|
---|
212 |
|
---|
213 | //headline
|
---|
214 | $_monobook_boxes["p-login"]["headline"] = $lang["btn_login"];
|
---|
215 | $_monobook_boxes["p-login"]["xhtml"] = " <ul>\n"
|
---|
216 | ." <li id=\"t-login\"><a href=\"".wl(cleanID(getId()), array("do" => "login"))."\" rel=\"nofollow\">".hsc($lang["btn_login"])."</a></li>\n" //language comes from DokuWiki core
|
---|
217 | ." </ul>";
|
---|
218 |
|
---|
219 | }
|
---|
220 |
|
---|
221 |
|
---|
222 | /******************************************************************************
|
---|
223 | ******************************** ATTENTION *********************************
|
---|
224 | DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES!
|
---|
225 | ******************************************************************************
|
---|
226 | If you want to add some own boxes, have a look at the README of this
|
---|
227 | template and "/user/boxes.php". You have been warned!
|
---|
228 | *****************************************************************************/
|
---|
229 |
|
---|