source: documentation/trunk/packages/templates/greenstone-monobook/main.php~@ 30114

Last change on this file since 30114 was 30114, checked in by jmt12, 9 years ago

Updated Greenstone customizations for Detritus, but rearranged to move into separate plugin. Initial checkin of plugins, template, special wiki pages.

File size: 34.6 KB
Line 
1<?php
2
3/**
4 * Main file of the "monobook" template for DokuWiki
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:templates
16 * @link http://www.dokuwiki.org/devel:coding_style
17 * @link http://www.dokuwiki.org/devel:environment
18 * @link http://www.dokuwiki.org/devel:action_modes
19 */
20
21//check if we are running within the DokuWiki environment
22if (!defined("DOKU_INC")){
23 die();
24}
25
26// Hardcode these paths, as this template will be loaded via SkinLoader
27if(!defined('GSMONO_TPL'))
28{
29 define('GSMONO_TPL', DOKU_BASE.'lib/tpl/greenstone-monobook/');
30}
31if(!defined('GSMONO_TPLINC'))
32{
33 define('GSMONO_TPLINC', DOKU_INC.'lib/tpl/greenstone-monobook/');
34}
35
36/**
37 * Stores the template wide action
38 *
39 * Different DokuWiki actions requiring some template logic. Therefore the
40 * template has to know, what we are doing right now - and that is what this
41 * var is for.
42 *
43 * Please have a look at the "detail.php" file in the same folder, it is also
44 * influencing the var's value.
45 *
46 * @var string
47 * @author Andreas Haerter <[email protected]>
48 */
49$monobook_action = "article";
50//note: I used $_REQUEST before (cause DokuWiki controls and fills it. Normally,
51// using $_REQUEST is a possible security threat. For details, see
52// <http://www.suspekt.org/2008/10/01/php-53-and-delayed-cross-site-request-forgerieshijacking/>
53// and <http://forum.dokuwiki.org/post/16524>), but it did not work as
54// expected by me (maybe it is a reference and setting $monobook_action
55// also changed the contents of $_REQUEST?!). That is why I switched back,
56// checking $_GET and $_POST like I did it before.
57if (!empty($_GET["mddo"])){
58 $monobook_action = (string)$_GET["mddo"];
59}elseif (!empty($_POST["mddo"])){
60 $monobook_action = (string)$_POST["mddo"];
61}
62if (!empty($monobook_action) &&
63 $monobook_action !== "article" &&
64 $monobook_action !== "print" &&
65 $monobook_action !== "detail" &&
66 $monobook_action !== "cite"){
67 //ignore unknown values
68 $monobook_action = "article";
69}
70
71
72/**
73 * Stores the template wide context
74 *
75 * This template offers discussion pages via common articles, which should be
76 * marked as "special". DokuWiki does not know any "special" articles, therefore
77 * we have to take care about detecting if the current page is a discussion
78 * page or not.
79 *
80 * @var string
81 * @author Andreas Haerter <[email protected]>
82 */
83$monobook_context = "article";
84if (preg_match("/^".tpl_getConf("monobook_discuss_ns")."?$|^".tpl_getConf("monobook_discuss_ns").".*?$/i", ":".getNS(getID()))){
85 $monobook_context = "discuss";
86}
87
88
89/**
90 * Stores the name the current client used to login
91 *
92 * @var string
93 * @author Andreas Haerter <[email protected]>
94 */
95$loginname = "";
96if (!empty($conf["useacl"])){
97 if (isset($_SERVER["REMOTE_USER"]) && //no empty() but isset(): "0" may be a valid username...
98 $_SERVER["REMOTE_USER"] !== ""){
99 $loginname = $_SERVER["REMOTE_USER"]; //$INFO["client"] would not work here (-> e.g. if
100 //current IP differs from the one used to login)
101 }
102}
103
104
105//get needed language array
106include GSMONO_TPLINC."lang/en/lang.php";
107//overwrite English language values with available translations
108if (!empty($conf["lang"]) &&
109 $conf["lang"] !== "en" &&
110 file_exists(GSMONO_TPLINC."/lang/".$conf["lang"]."/lang.php")){
111 //get language file (partially translated language files are no problem
112 //cause non translated stuff is still existing as English array value)
113 include GSMONO_TPLINC."/lang/".$conf["lang"]."/lang.php";
114}
115
116
117//detect revision
118$rev = (int)$INFO["rev"]; //$INFO comes from the DokuWiki core
119if ($rev < 1){
120 $rev = (int)$INFO["lastmod"];
121}
122
123
124//get tab config
125include GSMONO_TPLINC."/conf/tabs.php"; //default
126if (file_exists(GSMONO_TPLINC."/user/tabs.php")){
127 include GSMONO_TPLINC."/user/tabs.php"; //user defined
128}
129
130
131//get boxes config
132include GSMONO_TPLINC."/conf/boxes.php"; //default
133if (file_exists(GSMONO_TPLINC."/user/boxes.php")){
134 include GSMONO_TPLINC."/user/boxes.php"; //user defined
135}
136
137
138//get button config
139include GSMONO_TPLINC."/conf/buttons.php"; //default
140if (file_exists(GSMONO_TPLINC."/user/buttons.php")){
141 include GSMONO_TPLINC."/user/buttons.php"; //user defined
142}
143
144
145/**
146 * Helper to render the tabs (like a dynamic XHTML snippet)
147 *
148 *
149 * NOTE: This function is heavily inspired by "writeMBPortlet(), context.php" of
150 * the "Monobook for Dokuwiki" template by Terence J. Grant.
151 *
152 * @param array The tab data to render within the snippet. Each element
153 * is represented through a subarray:
154 * $array = array("tab1" => array("text" => "hello world!",
155 * "href" => "http://www.example.com"
156 * "nofollow" => true),
157 * "tab2" => array("text" => "I did it again",
158 * "href" => DOKU_BASE."doku.php?id=foobar",
159 * "class" => "foobar-css"),
160 * "tab3" => array("text" => "I did it again and again",
161 * "href" => wl("start", false, false, "&"),
162 * "class" => "foobar-css"),
163 * "tab4" => array("text" => "Home",
164 * "wiki" => ":start"
165 * "accesskey" => "H"));
166 * Available keys within the subarrays:
167 * - "text" (mandatory)
168 * The text/label of the element.
169 * - "href" (optional)
170 * URL the element should point to (as link). Please submit raw,
171 * unencoded URLs, the encoding will be done by this function for
172 * security reasons. If the URL is not relative
173 * (= starts with http(s)://), the URL will be treated as external
174 * (=a special style will be used if "class" is not set).
175 * - "wiki" (optional)
176 * ID of a WikiPage to link (like ":start" or ":wiki:foobar").
177 * - "class" (optional)
178 * Name of an additional CSS class to use for the element content.
179 * Works only in combination with "text" or "href", NOT with "wiki"
180 * (will be ignored in this case).
181 * - "nofollow" (optional)
182 * If set to TRUE, rel="nofollow" will be added to the link if "href"
183 * is set (otherwise this flag will do nothing).
184 * - "accesskey" (optional)
185 * accesskey="<value>" will be added to the link if "href" is set
186 * (otherwise this option will do nothing).
187 * @author Andreas Haerter <[email protected]>
188 * @see _monobook_renderButtons()
189 * @see _monobook_renderBoxes()
190 * @link http://www.wikipedia.org/wiki/Nofollow
191 * @link http://de.selfhtml.org/html/verweise/tastatur.htm#kuerzel
192 * @link http://www.dokuwiki.org/devel:environment
193 * @link http://www.dokuwiki.org/devel:coding_style
194 */
195function _monobook_renderTabs($arr)
196{
197 //is there something useful?
198 if (empty($arr) ||
199 !is_array($arr)){
200 return false; //nope, break operation
201 }
202
203 //array to store the created tabs into
204 $elements = array();
205
206 //handle the tab data
207 foreach($arr as $li_id => $element){
208 //basic check
209 if (empty($element) ||
210 !is_array($element) ||
211 !isset($element["text"])){
212 continue; //ignore invalid stuff and go on
213 }
214 $li_created = true; //flag to control if we created any list element
215 $interim = "";
216 //do we have an external link?
217 if (!empty($element["href"])){
218 //add URL
219 $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding
220 //add rel="nofollow" attribute to the link?
221 if (!empty($element["nofollow"])){
222 $interim .= " rel=\"nofollow\"";
223 }
224 //add special css class?
225 if (!empty($element["class"])){
226 $interim .= " class=\"".hsc($element["class"])."\"";
227 } elseif (substr($element["href"], 0, 4) === "http" ||
228 substr($element["href"], 0, 3) === "ftp"){
229 $interim .= " class=\"urlextern\"";
230 }
231 //add access key?
232 if (!empty($element["accesskey"])){
233 $interim .= " accesskey=\"".hsc($element["accesskey"])."\" title=\"[ALT+".hsc(strtoupper($element["accesskey"]))."]\"";
234 }
235 $interim .= ">".hsc($element["text"])."</a>";
236 //internal wiki link
237 }else if (!empty($element["wiki"])){
238 //add special css class?
239 if (!empty($element["class"])){
240 $interim = "<span class=\"".hsc($element["class"])."\">".html_wikilink($element["wiki"], hsc($element["text"]))."</span>";
241 }else{
242 $interim = html_wikilink($element["wiki"], hsc($element["text"]));
243 }
244 /* Following works, but I think it is too heavy... //use a wiki page as content
245 } elseif ($element["wiki_include"]){
246
247 //we have to show a wiki page. get the rendered content of the
248 //defined wiki article to use as content.
249 $interim = tpl_include_page($element["wiki_include"], false);
250 if ($interim === "" ||
251 $interim === false){
252 //show creation/edit link if the defined page got no content
253 $interim = "[&#160;".html_wikilink($element["wiki_include"], hsc($lang["monobook_fillplaceholder"]." (".hsc($element["wiki_include"]).")"))."&#160;]<br />";
254 }*/
255 //text only
256 }else{
257 $interim = "<span";
258 //add special css class?
259 if (!empty($element["class"])){
260 $interim .= " class=\"".hsc($element["class"])."\"";
261 }else{
262 $interim .= " style=\"color:#ccc;\"";
263 }
264 $interim .= ">&#160;".hsc($element["text"])."&#160;</span>";
265 }
266 //store it
267 $elements[] = " <li id=\"".hsc($li_id)."\">".$interim."</li>\n";
268 }
269
270 //show everything created
271 if (!empty($elements)){
272 echo "\n"
273 ." <div id=\"p-cactions\" class=\"portlet\">\n" //don't touch the id, it is needed as css selector
274 ." <ul>\n";
275 foreach ($elements as $element){
276 echo $element;
277 }
278 echo " </ul>\n"
279 ." </div>\n";
280 }
281 return true;
282}
283
284
285/**
286 * Helper to render the boxes (like a dynamic XHTML snippet)
287 *
288 *
289 * NOTE: This function is heavily inspired by "writeMBPortlet(), context.php" of
290 * the "Monobook for Dokuwiki" template by Terence J. Grant.
291 *
292 * @param array The box data to render within the snippet. Each box is
293 * represented through a subarray:
294 * $array = array("box-id1" => array("headline" => "hello world!",
295 * "xhtml" => "I am <i>here</i>."));
296 * Available keys within the subarrays:
297 * - "xhtml" (mandatory)
298 * The content of the Box you want to show as XHTML. Attention: YOU
299 * HAVE TO TAKE CARE ABOUT FILTER EVENTUALLY USED INPUT/SECURITY. Be
300 * aware of XSS and stuff.
301 * - "headline" (optional)
302 * Headline to show above the box. Leave empty/do not set for none.
303 * @author Andreas Haerter <[email protected]>
304 * @see _monobook_renderButtons()
305 * @see _monobook_renderTabs()
306 * @link http://www.wikipedia.org/wiki/Nofollow
307 * @link http://www.wikipedia.org/wiki/Cross-site_scripting
308 * @link http://www.dokuwiki.org/devel:coding_style
309 */
310function _monobook_renderBoxes($arr)
311{
312 //is there something useful?
313 if (empty($arr) ||
314 !is_array($arr)){
315 return false; //nope, break operation
316 }
317
318 //array to store the created boxes into
319 $boxes = array();
320 $search_handled = false;
321
322 //handle the box data
323 foreach($arr as $div_id => $contents){
324 //basic check
325 if (empty($contents) ||
326 !is_array($contents) ||
327 !isset($contents["xhtml"])){
328 continue; //ignore invalid stuff and go on
329 }
330 $interim = " <div class=\"portlet\" id=\"".hsc($div_id)."\">\n";
331 if (isset($contents["headline"])
332 && $contents["headline"] !== ""){
333 //hack for search box
334 if ($search_handled === true ||
335 $div_id !== "p-search") {
336 $interim .= " <h5>".hsc($contents["headline"])."</h5>\n";
337 } else {
338 $interim .= " <h5><label for=\"qsearch__in\">".hsc($contents["headline"])."</label></h5>\n";
339 }
340 }
341 $interim .= " <div class=\"pBody\">\n"
342 ." <div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we might have to show rendered page content
343 .$contents["xhtml"]."\n"
344 ." </div>\n"
345 ." </div>\n"
346 ." </div>\n";
347 //hack for search box
348 if ($search_handled === false &&
349 $div_id === "p-search") {
350 $interim .= " <div id=\"qsearch__out\" class=\"ajax_qsearch JSpopup\"></div>\n";
351 //set flag
352 $search_handled = true;
353 }
354 //store it
355 $boxes[] = $interim;
356 }
357 //show everything created
358 if (!empty($boxes)){
359 echo "\n";
360 foreach ($boxes as $box){
361 echo $box;
362 }
363 echo "\n";
364 }
365
366 return true;
367}
368
369
370/**
371 * Helper to render the footer buttons (like a dynamic XHTML snippet)
372 *
373 * @param array The button data to render within the snippet. Each element
374 * is represented through a subarray:
375 * $array = array("btn1" => array("img" => GSMONO_TPL."static/img/button-monobook.png",
376 * "href" => "http://andreas-haerter.com/projects/dokuwiki-template-monobook",
377 * "width" => 80,
378 * "height" => 15,
379 * "title" => "monobook for DokuWiki",
380 * "nofollow" => false),
381 * "btn2" => array("img" => GSMONO_TPL."user/mybutton1.png",
382 * "href" => wl("start", false, false, "&")),
383 * "btn3" => array("img" => GSMONO_TPL."user/mybutton2.png",
384 * "href" => "http://www.example.com");
385 * Available keys within the subarrays:
386 * - "img" (mandatory)
387 * The relative or full path of an image/button to show. Users may
388 * place own images within the /user/ dir of this template.
389 * - "href" (mandatory)
390 * URL the element should point to (as link). Please submit raw,
391 * unencoded URLs, the encoding will be done by this function for
392 * security reasons.
393 * - "width" (optional)
394 * width="<value>" will be added to the image tag if both "width" and
395 * "height" are set (otherwise, this will be ignored).
396 * - "height" (optional)
397 * height="<value>" will be added to the image tag if both "height" and
398 * "width" are set (otherwise, this will be ignored).
399 * - "nofollow" (optional)
400 * If set to TRUE, rel="nofollow" will be added to the link.
401 * - "title" (optional)
402 * title="<value>" will be added to the link and image if "title"
403 * is set + alt="<value>".
404 * @author Andreas Haerter <[email protected]>
405 * @see _monobook_renderButtons()
406 * @see _monobook_renderBoxes()
407 * @link http://www.wikipedia.org/wiki/Nofollow
408 * @link http://www.dokuwiki.org/devel:coding_style
409 */
410function _monobook_renderButtons($arr)
411{
412 //array to store the created buttons into
413 $elements = array();
414
415 //handle the button data
416 foreach($arr as $li_id => $element){
417 //basic check
418 if (empty($element) ||
419 !is_array($element) ||
420 !isset($element["img"]) ||
421 !isset($element["href"])){
422 continue; //ignore invalid stuff and go on
423 }
424 $interim = "";
425
426 //add URL
427 $interim = "<a href=\"".hsc($element["href"])."\""; //@TODO: real URL encoding
428 //add rel="nofollow" attribute to the link?
429 if (!empty($element["nofollow"])){
430 $interim .= " rel=\"nofollow\"";
431 }
432 //add title attribute to the link?
433 if (!empty($element["title"])){
434 $interim .= " title=\"".hsc($element["title"])."\"";
435 }
436 $interim .= " target=\"_blank\"><img src=\"".hsc($element["img"])."\"";
437 //add width and height attribute to the image?
438 if (!empty($element["width"]) &&
439 !empty($element["height"])){
440 $interim .= " width=\"".(int)$element["width"]."\" height=\"".(int)$element["height"]."\"";
441 }
442 //add title and alt attribute to the image?
443 if (!empty($element["title"])){
444 $interim .= " title=\"".hsc($element["title"])."\" alt=\"".hsc($element["title"])."\"";
445 } else {
446 $interim .= " alt=\"\""; //alt is a mandatory attribute for images
447 }
448 $interim .= " border=\"0\" /></a>";
449
450 //store it
451 $elements[] = " ".$interim."\n";
452 }
453
454 //show everything created
455 if (!empty($elements)){
456 echo "\n";
457 foreach ($elements as $element){
458 echo $element;
459 }
460 }
461 return true;
462}
463
464//workaround for the "jumping textarea" IE bug. CSS only fix not possible cause
465//some DokuWiki JavaScript is triggering this bug, too. See the following for
466//info:
467//- <http://blog.andreas-haerter.com/2010/05/28/fix-msie-8-auto-scroll-textarea-css-width-percentage-bug>
468//- <http://msdn.microsoft.com/library/cc817574.aspx>
469if ($ACT === "edit" &&
470 !headers_sent()){
471 header("X-UA-Compatible: IE=EmulateIE7");
472}
473
474?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
475 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
476<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo hsc($conf["lang"]); ?>" lang="<?php echo hsc($conf["lang"]); ?>" dir="<?php echo hsc($lang["direction"]); ?>">
477<head>
478<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
479<title><?php tpl_pagetitle(); echo " - ".hsc($conf["title"]); ?></title>
480<?php
481//show meta-tags
482tpl_metaheaders();
483echo "<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\" />";
484
485//manually load needed CSS? this is a workaround for PHP Bug #49642. In some
486//version/os combinations PHP is not able to parse INI-file entries if there
487//are slashes "/" used for the keynames (see bugreport for more information:
488//<http://bugs.php.net/bug.php?id=49692>). to trigger this workaround, simply
489//delete/rename monobook's style.ini.
490if (!file_exists(GSMONO_TPLINC."style.ini")){
491 echo "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".GSMONO_TPL."bug49642.php".((!empty($lang["direction"]) && $lang["direction"] === "rtl") ? "?langdir=rtl" : "")."\" />\n"; //var comes from DokuWiki core
492}
493
494//include default or userdefined favicon
495//
496//note: since 2011-04-22 "Rincewind RC1", there is a core function named
497// "tpl_getFavicon()". But its functionality is not really fitting the
498// behaviour of this template, therefore I don't use it here.
499if (file_exists(GSMONO_TPLINC."user/favicon.ico")){
500 //user defined - you might find http://tools.dynamicdrive.com/favicon/
501 //useful to generate one
502 echo "\n<link rel=\"shortcut icon\" href=\"".GSMONO_TPL."user/favicon.ico\" />\n";
503}elseif (file_exists(GSMONO_TPLINC."user/favicon.png")){
504 //note: I do NOT recommend PNG for favicons (cause it is not supported by
505 //all browsers), but some users requested this feature.
506 echo "\n<link rel=\"shortcut icon\" href=\"".GSMONO_TPL."user/favicon.png\" />\n";
507}else{
508 //default
509 echo "\n<link rel=\"shortcut icon\" href=\"".GSMONO_TPL."static/3rd/dokuwiki/favicon.ico\" />\n";
510}
511
512//include default or userdefined Apple Touch Icon (see <http://j.mp/sx3NMT> for
513//details)
514if (file_exists(GSMONO_TPLINC."user/apple-touch-icon.png")){
515 echo "<link rel=\"apple-touch-icon\" href=\"".GSMONO_TPL."user/apple-touch-icon.png\" />\n";
516}else{
517 //default
518 echo "<link rel=\"apple-touch-icon\" href=\"".GSMONO_TPL."static/3rd/dokuwiki/apple-touch-icon.png\" />\n";
519}
520
521//load userdefined js?
522if (tpl_getConf("monobook_loaduserjs")){
523 echo "<script type=\"text/javascript\" charset=\"utf-8\" src=\"".GSMONO_TPL."user/user.js\"></script>\n";
524}
525
526//show printable version?
527if ($monobook_action === "print"){
528 //note: this is just a workaround for people searching for a print version.
529 // don't forget to update the styles.ini, this is the really important
530 // thing! BTW: good text about this: http://is.gd/5MyG5
531 echo "<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".GSMONO_TPL."static/css/print.css\" />\n"
532 ."<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".GSMONO_TPL."static/3rd/wikipedia/commonPrint.css\" />\n"
533 ."<link rel=\"stylesheet\" media=\"all\" type=\"text/css\" href=\"".GSMONO_TPL."user/print.css\" />\n";
534}
535
536//load language specific css hacks?
537if (file_exists(GSMONO_TPLINC."lang/".$conf["lang"]."/style.css")){
538 $interim = trim(file_get_contents(GSMONO_TPLINC."lang/".$conf["lang"]."/style.css"));
539 if (!empty($interim)){
540 echo "<style type=\"text/css\" media=\"all\">\n".hsc($interim)."\n</style>\n";
541 }
542}
543?>
544<!--[if lt IE 5.5000]><link rel="stylesheet" media="all" type="text/css" href="<?php echo GSMONO_TPL; ?>static/3rd/monobook/IE50Fixes.css" /><![endif]-->
545<!--[if IE 5.5000]><link rel="stylesheet" media="all" type="text/css" href="<?php echo GSMONO_TPL; ?>static/3rd/monobook/IE55Fixes.css" /><![endif]-->
546<!--[if IE 6]><link rel="stylesheet" media="all" type="text/css" href="<?php echo GSMONO_TPL; ?>static/3rd/monobook/IE60Fixes.css" /><![endif]-->
547<!--[if IE 7]><link rel="stylesheet" media="all" type="text/css" href="<?php echo GSMONO_TPL; ?>static/3rd/monobook/IE70Fixes.css" /><![endif]-->
548<!--[if lt IE 7]><script type="text/javascript" charset="utf-8" src="<?php echo GSMONO_TPL; ?>static/3rd/wikipedia/IEFixes.js"></script><meta http-equiv="imagetoolbar" content="no" /><![endif]-->
549</head>
550<body class="<?php //different styles/backgrounds for different page types
551 switch (true){
552 //special: tech
553 case ($monobook_action === "detail"):
554 case ($monobook_action === "cite"):
555 case ($ACT === "media"): //var comes from DokuWiki
556 case ($ACT === "search"): //var comes from DokuWiki
557 echo "mediawiki ns-2 ltr";
558 break;
559 //special: other
560 case ($ACT === "edit"): //var comes from DokuWiki
561 case ($ACT === "draft"): //var comes from DokuWiki
562 case ($ACT === "revisions"): //var comes from DokuWiki
563 case ($monobook_context === "discuss"):
564 case (preg_match("/^wiki$|^wiki:.*?$/i", getNS(getID()))):
565 echo "mediawiki ns-1 ltr";
566 break;
567 //"normal" content
568 case ($monobook_action === "print"):
569 default:
570 echo "mediawiki ns-0 ltr";
571 break;
572 }
573 ?>">
574<div id="globalWrapper">
575
576 <div id="column-content">
577 <div id="content">
578 <a name="top" id="top"></a>
579 <a name="dokuwiki__top" id="dokuwiki__top"></a>
580 <div id="bodyContent">
581 <div class="dokuwiki">
582 <!-- start main content area -->
583 <?php
584 //show messages (if there are any)
585 html_msgarea();
586 //show site notice
587 if (tpl_getConf("monobook_sitenotice")){
588 //we have to show a custom sitenotice
589 if (empty($conf["useacl"]) ||
590 auth_quickaclcheck(cleanID(tpl_getConf("monobook_sitenotice_location"))) >= AUTH_READ){ //current user got access?
591 echo "\n <div id=\"siteNotice\" class=\"noprint\">\n";
592 //get the rendered content of the defined wiki article to use as
593 //custom sitenotice.
594 $interim = tpl_include_page(tpl_getConf("monobook_sitenotice_location"), false);
595 if ($interim === "" ||
596 $interim === false){
597 //show creation/edit link if the defined page got no content
598 echo "[&#160;";
599 tpl_pagelink(tpl_getConf("monobook_sitenotice_location"), hsc($lang["monobook_fillplaceholder"]." (".tpl_getConf("monobook_sitenotice_location").")"));
600 echo "&#160;]<br />";
601 }else{
602 //show the rendered page content
603 echo $interim;
604 }
605 echo "\n </div>\n";
606 }
607 }
608 //show breadcrumps if enabled and positioned on top
609 if ($conf["breadcrumbs"] == true &&
610 $ACT !== "media" && //var comes from DokuWiki
611 (empty($conf["useacl"]) || //are there any users?
612 $loginname !== "" || //user is logged in?
613 !tpl_getConf("monobook_closedwiki")) &&
614 tpl_getConf("monobook_breadcrumbs_position") === "top"){
615 echo "\n <div class=\"catlinks noprint\"><p>\n ";
616 tpl_breadcrumbs();
617 echo "\n </p></div>\n";
618 }
619 //show hierarchical breadcrumps if enabled and positioned on top
620 if ($conf["youarehere"] == true &&
621 $ACT !== "media" && //var comes from DokuWiki
622 (empty($conf["useacl"]) || //are there any users?
623 $loginname !== "" || //user is logged in?
624 !tpl_getConf("monobook_closedwiki"))){// &&
625 // tpl_getConf("monobook_youarehere_position") === "top"){
626 echo "\n <div class=\"catlinks noprint\"><p>\n ";
627 tpl_youarehere();
628 echo "\n </p></div>\n";
629 }
630 ?>
631
632 <!-- start rendered wiki content -->
633 <?php
634 //flush the buffer for faster page rendering, heaviest content follows
635 if (function_exists("tpl_flush")) {
636 tpl_flush(); //exists since 2010-11-07 "Anteater"...
637 } else {
638 flush(); //...but I won't loose compatibility to 2009-12-25 "Lemming" right now.
639 }
640 //decide which type of pagecontent we have to show
641 switch ($monobook_action){
642 //"image details"
643 case "detail":
644 include GSMONO_TPLINC."inc_detail.php";
645 break;
646 //"cite this article"
647 case "cite":
648 include GSMONO_TPLINC."inc_cite.php";
649 break;
650 //show "normal" content
651 default:
652 tpl_content(((tpl_getConf("monobook_toc_position") === "article") ? true : false));
653 break;
654 }
655 ?>
656 <!-- end rendered wiki content -->
657
658 <br />
659 <?php
660 //show breadcrumps if enabled and positioned on bottom
661 if ($conf["breadcrumbs"] == true &&
662 $ACT !== "media" && //var comes from DokuWiki
663 (empty($conf["useacl"]) || //are there any users?
664 $loginname !== "" || //user is logged in?
665 !tpl_getConf("monobook_closedwiki")) &&
666 tpl_getConf("monobook_breadcrumbs_position") === "bottom"){
667 echo "\n <div class=\"catlinks noprint\"><p>\n ";
668 tpl_breadcrumbs();
669 echo "\n </p></div>\n";
670 }
671 //show hierarchical breadcrumps if enabled and positioned on bottom
672 if ($conf["youarehere"] == true &&
673 $ACT !== "media" && //var comes from DokuWiki
674 (empty($conf["useacl"]) || //are there any users?
675 $loginname !== "" || //user is logged in?
676 !tpl_getConf("monobook_closedwiki"))){ // &&
677 // tpl_getConf("monobook_youarehere_position") === "bottom"){
678 echo "\n <div class=\"catlinks noprint\"><p>\n ";
679 tpl_youarehere();
680 echo "\n </p></div>\n";
681 }
682 ?>
683
684 <!-- end main content area -->
685 <div class="visualClear"></div>
686 </div>
687 </div>
688 </div>
689 </div>
690
691 <div id="column-one" class="noprint">
692 <div class="portlet" id="p-logo">
693 <?php
694 //include default or userdefined logo
695 echo "<a href=\"".wl()."\" ";
696 if (file_exists(GSMONO_TPLINC."user/logo.png")){
697 //user defined PNG
698 echo "style=\"background-image:url(".GSMONO_TPL."user/logo.png);\"";
699 }elseif (file_exists(GSMONO_TPLINC."user/logo.gif")){
700 //user defined GIF
701 echo "style=\"background-image:url(".GSMONO_TPL."user/logo.gif);\"";
702 }elseif (file_exists(GSMONO_TPLINC."user/logo.jpg")){
703 //user defined JPG
704 echo "style=\"background-image:url(".GSMONO_TPL."user/logo.jpg);\"";
705 }else{
706 //default
707 echo "style=\"background-image:url(".GSMONO_TPL."static/3rd/dokuwiki/logo.png);\"";
708 }
709 echo " accesskey=\"h\" title=\"Back to start [ALT+H]\"></a>\n";
710 ?>
711 </div>
712 <?php
713 //show tabs, see monobook/user/tabs.php to configure them
714 if (!empty($_monobook_tabs) &&
715 is_array($_monobook_tabs)){
716 _monobook_renderTabs($_monobook_tabs);
717 }
718
719 //show personal tools
720 if (!empty($conf["useacl"])){ //...makes only sense if there are users
721 echo "\n"
722 ." <div id=\"p-personal\" class=\"portlet\">\n"
723 ." <div class=\"pBody\">\n"
724 ." <ul>\n";
725 //login?
726 if ($loginname === ""){
727 echo " <li id=\"pt-login\"><a href=\"".wl(cleanID(getId()), array("do" => "login"))."\" rel=\"nofollow\">".hsc($lang["btn_login"])."</a></li>\n"; //language comes from DokuWiki core
728 }else{
729 //username and userpage
730 echo " <li id=\"pt-userpage\">".(tpl_getConf("monobook_userpage")
731 ? html_wikilink(tpl_getConf("monobook_userpage_ns").$loginname, hsc($loginname))
732 : hsc($loginname))."</li>";
733 //admin
734 if (!empty($INFO["isadmin"]) ||
735 !empty($INFO["ismanager"])){
736 echo " <li id=\"pt-admin\"><a href=\"".wl(cleanID(getId()), array("do" => "admin"))."\" rel=\"nofollow\">".hsc($lang["btn_admin"])."</a></li>\n"; //language comes from DokuWiki core
737 }
738 //personal discussion
739 if (tpl_getConf("monobook_discuss") &&
740 tpl_getConf("monobook_userpage")){
741 echo " <li id=\"pt-mytalk\">".html_wikilink(tpl_getConf("monobook_discuss_ns").ltrim(tpl_getConf("monobook_userpage_ns"), ":").$loginname, hsc($lang["monobook_tab_mytalk"]))."</li>";
742 }
743 //profile
744 echo " <li id=\"pt-preferences\"><a href=\"http://www.greenstone.org/users/change.php\" rel=\"nofollow\">".hsc($lang["btn_profile"])."</a></li>\n"; //language comes from DokuWiki core
745 //logout
746 echo " <li id=\"pt-logout\"><a href=\"".wl(cleanID(getId()), array("do" => "logout"))."\" rel=\"nofollow\">".hsc($lang["btn_logout"])."</a></li>\n"; //language comes from DokuWiki core
747 }
748 echo " </ul>\n"
749 ." </div>\n"
750 ." </div>\n";
751 }
752
753 //show boxes, see monobook/user/boxes.php to configure them
754 if (!empty($_monobook_boxes) &&
755 is_array($_monobook_boxes)){
756 _monobook_renderBoxes($_monobook_boxes);
757 }
758 ?>
759 </div> <!-- end of the left (by default at least) column -->
760
761 <div class="visualClear"></div>
762
763 <div id="footer">
764 <div id="footer-buttons" class="noprint">
765 <?php
766 //show buttons, see monobook/user/buttons.php to configure them
767 if (!empty($_monobook_btns) &&
768 is_array($_monobook_btns)){
769 _monobook_renderButtons($_monobook_btns);
770 }
771 ?>
772 </div>
773 <ul id="f-list">
774 <li id="lastmod">
775 <?php tpl_pageinfo()?><br />
776 </li>
777 <?php
778 //copyright notice
779 if (tpl_getConf("monobook_copyright")){
780 //show dokuwiki's default notice?
781 if (tpl_getConf("monobook_copyright_default")){
782 echo "<li id=\"copyright\">\n <div class=\"dokuwiki\">";
783 tpl_license(false);
784 echo "</div>\n </li>\n";
785 //show custom notice.
786 }else{
787 if (empty($conf["useacl"]) ||
788 auth_quickaclcheck(cleanID(tpl_getConf("monobook_copyright_location"))) >= AUTH_READ){ //current user got access?
789 echo "<li id=\"copyright\">\n ";
790 //get the rendered content of the defined wiki article to use as custom notice
791 $interim = tpl_include_page(tpl_getConf("monobook_copyright_location"), false);
792 if ($interim === "" ||
793 $interim === false){
794 //show creation/edit link if the defined page got no content
795 echo "[&#160;";
796 tpl_pagelink(tpl_getConf("monobook_copyright_location"), hsc($lang["monobook_fillplaceholder"]." (".tpl_getConf("monobook_copyright_location").")"));
797 echo "&#160;]<br />";
798 }else{
799 //show the rendered page content
800 echo "<div class=\"dokuwiki\">\n" //dokuwiki CSS class needed cause we are showing rendered page content
801 .$interim."\n "
802 ."</div>";
803 }
804 echo "\n </li>\n";
805 }
806 }
807 }
808 ?>
809 <li id="usermod" class="noprint">
810 <?php tpl_userinfo(); ?><br />
811 </li>
812 </ul>
813 </div>
814
815</div> <!-- end of global wrap -->
816<a href="<?php echo wl("", array("do" => "recent"));?>" accesskey="r" style="visibility:hidden;" rel="nofollow">&#160;</a>
817<?php
818//provide DokuWiki housekeeping, required in all templates
819tpl_indexerWebBug();
820
821//include web analytics software
822if (file_exists(GSMONO_TPLINC."/user/tracker.php")){
823 include GSMONO_TPLINC."/user/tracker.php";
824}
825?>
826</body>
827</html>
Note: See TracBrowser for help on using the repository browser.