1fa5fcacaSAndreas Haerter<?php 2fa5fcacaSAndreas Haerter 3fa5fcacaSAndreas Haerter/** 4fa5fcacaSAndreas Haerter * Default box configuration of the "vector" DokuWiki template 5fa5fcacaSAndreas Haerter * 6fa5fcacaSAndreas Haerter * 7fa5fcacaSAndreas Haerter * LICENSE: This file is open source software (OSS) and may be copied under 8fa5fcacaSAndreas Haerter * certain conditions. See COPYING file for details or try to contact 9fa5fcacaSAndreas Haerter * the author(s) of this file in doubt. 10fa5fcacaSAndreas Haerter * 11fa5fcacaSAndreas Haerter * @license GPLv2 (http://www.gnu.org/licenses/gpl2.html) 12078ed773SAndreas Haerter * @author Andreas Haerter <development@andreas-haerter.com> 13fa5fcacaSAndreas Haerter * @link http://andreas-haerter.com/projects/dokuwiki-template-vector 14fa5fcacaSAndreas Haerter * @link http://www.dokuwiki.org/template:vector 15fa5fcacaSAndreas Haerter * @link http://www.dokuwiki.org/devel:configuration 16fa5fcacaSAndreas Haerter */ 17fa5fcacaSAndreas Haerter 18fa5fcacaSAndreas Haerter 19fa5fcacaSAndreas Haerter 20fa5fcacaSAndreas Haerter/****************************************************************************** 21fa5fcacaSAndreas Haerter ******************************** ATTENTION ********************************* 22fa5fcacaSAndreas Haerter DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES! 23fa5fcacaSAndreas Haerter ****************************************************************************** 24fa5fcacaSAndreas Haerter If you want to add some own boxes, have a look at the README of this 25fa5fcacaSAndreas Haerter template and "/user/boxes.php". You have been warned! 26fa5fcacaSAndreas Haerter *****************************************************************************/ 27fa5fcacaSAndreas Haerter 28fa5fcacaSAndreas Haerter 29fa5fcacaSAndreas Haerter//check if we are running within the DokuWiki environment 30fa5fcacaSAndreas Haerterif (!defined("DOKU_INC")){ 31fa5fcacaSAndreas Haerter die(); 32fa5fcacaSAndreas Haerter} 33fa5fcacaSAndreas Haerter 34fa5fcacaSAndreas Haerter 35fa5fcacaSAndreas Haerter//note: The boxes will be rendered in the order they were defined. Means: 36fa5fcacaSAndreas Haerter// first box will be rendered first, last box will be rendered at last. 37fa5fcacaSAndreas Haerter 38fa5fcacaSAndreas Haerter 39fa5fcacaSAndreas Haerter//hide boxes for anonymous clients (closed wiki)? 40fa5fcacaSAndreas Haerterif (empty($conf["useacl"]) || //are there any users? 41fa5fcacaSAndreas Haerter $loginname !== "" || //user is logged in? 42fa5fcacaSAndreas Haerter !tpl_getConf("vector_closedwiki")){ 43fa5fcacaSAndreas Haerter 44952c7991SAndreas Haerter //Languages/translations provided by Andreas Gohr's translation plugin, 4552972747SAndreas Haerter //see <http://www.dokuwiki.org/plugin:translation>. Create plugin object if 4652972747SAndreas Haerter //needed. 4752972747SAndreas Haerter if (file_exists(DOKU_PLUGIN."translation/syntax.php") && 4852972747SAndreas Haerter !plugin_isdisabled("translation")){ 4952972747SAndreas Haerter $transplugin = &plugin_load("syntax", "translation"); 5052972747SAndreas Haerter } else { 5152972747SAndreas Haerter $transplugin = false; 5252972747SAndreas Haerter } 53fa5fcacaSAndreas Haerter 54fa5fcacaSAndreas Haerter //navigation 55fa5fcacaSAndreas Haerter if (tpl_getConf("vector_navigation")){ 56fa5fcacaSAndreas Haerter //headline 57fa5fcacaSAndreas Haerter $_vector_boxes["p-navigation"]["headline"] = $lang["vector_navigation"]; 58fa5fcacaSAndreas Haerter 5952972747SAndreas Haerter //detect wiki page to load as content 6052972747SAndreas Haerter if (!empty($transplugin) && 6152972747SAndreas Haerter is_object($transplugin) && 6252972747SAndreas Haerter tpl_getConf("vector_navigation_translate")){ 6352972747SAndreas Haerter //translated navigation? 6452972747SAndreas Haerter $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part 6552972747SAndreas Haerter $transplugin_langs = explode(" ", trim($transplugin->getConf("translations"))); //available languages 6652972747SAndreas Haerter if (empty($transplugin_langs) || 6752972747SAndreas Haerter empty($transplugin_langcur) || 6852972747SAndreas Haerter !is_array($transplugin_langs) || 6952972747SAndreas Haerter !in_array($transplugin_langcur, $transplugin_langs)) { 7052972747SAndreas Haerter //current page is no translation or something is wrong, load default navigation 7152972747SAndreas Haerter $nav_location = tpl_getConf("vector_navigation_location"); 7252972747SAndreas Haerter } else { 7352972747SAndreas Haerter //load language specific navigation 7452972747SAndreas Haerter $nav_location = tpl_getConf("vector_navigation_location")."_".$transplugin_langcur; 7552972747SAndreas Haerter } 7652972747SAndreas Haerter }else{ 7752972747SAndreas Haerter //default navigation, no translation 7852972747SAndreas Haerter $nav_location = tpl_getConf("vector_navigation_location"); 7952972747SAndreas Haerter } 8052972747SAndreas Haerter 81fa5fcacaSAndreas Haerter //content 82fa5fcacaSAndreas Haerter if (empty($conf["useacl"]) || 8352972747SAndreas Haerter auth_quickaclcheck(cleanID($nav_location)) >= AUTH_READ){ //current user got access? 84fa5fcacaSAndreas Haerter //get the rendered content of the defined wiki article to use as custom navigation 8552972747SAndreas Haerter $interim = tpl_include_page($nav_location, false); 86fa5fcacaSAndreas Haerter if ($interim === "" || 87fa5fcacaSAndreas Haerter $interim === false){ 88fa5fcacaSAndreas Haerter //creation/edit link if the defined page got no content 8952972747SAndreas Haerter $_vector_boxes["p-navigation"]["xhtml"] = "[ ".html_wikilink($nav_location, hsc($lang["vector_fillplaceholder"]." (".$nav_location.")"))." ]<br />"; 90fa5fcacaSAndreas Haerter }else{ 91fa5fcacaSAndreas Haerter //the rendered page content 92fa5fcacaSAndreas Haerter $_vector_boxes["p-navigation"]["xhtml"] = $interim; 93fa5fcacaSAndreas Haerter } 94fa5fcacaSAndreas Haerter } 9552972747SAndreas Haerter unset($nav_location); 96fa5fcacaSAndreas Haerter } 97fa5fcacaSAndreas Haerter 98fa5fcacaSAndreas Haerter //table of contents (TOC) - show outside the article? (this is a dirty hack but often requested) 99fa5fcacaSAndreas Haerter if (tpl_getConf("vector_toc_position") === "sidebar"){ 100fa5fcacaSAndreas Haerter //check if the current page got a TOC 101fa5fcacaSAndreas Haerter $toc = tpl_toc(true); 102fa5fcacaSAndreas Haerter if (!empty($toc)) { 103fa5fcacaSAndreas Haerter //headline 104fa5fcacaSAndreas Haerter $_vector_boxes["p-toc"]["headline"] = $lang["toc"]; //language comes from DokuWiki core 105fa5fcacaSAndreas Haerter 106fa5fcacaSAndreas Haerter //content 107fa5fcacaSAndreas Haerter $_vector_boxes["p-toc"]["xhtml"] = //get rid of some styles and the embedded headline 108fa5fcacaSAndreas Haerter str_replace(//search 109fa5fcacaSAndreas Haerter array("<div class=\"tocheader toctoggle\" id=\"toc__header\">".$lang["toc"]."</div>", //language comes from DokuWiki core 110fa5fcacaSAndreas Haerter " class=\"toc\"", 111fa5fcacaSAndreas Haerter " id=\"toc__inside\""), 112fa5fcacaSAndreas Haerter //replace 113fa5fcacaSAndreas Haerter "", 114fa5fcacaSAndreas Haerter //haystack 115fa5fcacaSAndreas Haerter $toc); 116fa5fcacaSAndreas Haerter } 117fa5fcacaSAndreas Haerter unset($toc); 118fa5fcacaSAndreas Haerter } 119fa5fcacaSAndreas Haerter 120fa5fcacaSAndreas Haerter //exportbox ("print/export") 121fa5fcacaSAndreas Haerter if (tpl_getConf("vector_exportbox")){ 122fa5fcacaSAndreas Haerter //headline 123fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["headline"] = $lang["vector_exportbox"]; 124fa5fcacaSAndreas Haerter 125fa5fcacaSAndreas Haerter //content 126fa5fcacaSAndreas Haerter if (tpl_getConf("vector_exportbox_default")){ 127fa5fcacaSAndreas Haerter //define default, predefined exportbox 128fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["xhtml"] = " <ul>\n"; 129fa5fcacaSAndreas Haerter //ODT plugin 130fa5fcacaSAndreas Haerter //see <http://www.dokuwiki.org/plugin:odt> for info 131fa5fcacaSAndreas Haerter if (file_exists(DOKU_PLUGIN."odt/syntax.php") && 132fa5fcacaSAndreas Haerter !plugin_isdisabled("odt")){ 133fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["xhtml"] .= " <li id=\"coll-download-as-odt\"><a href=\"".wl(cleanID(getId()), array("do" => "export_odt"))."\" rel=\"nofollow\">".hsc($lang["vector_exportbxdef_downloadodt"])."</a></li>\n"; 134fa5fcacaSAndreas Haerter } 135fa5fcacaSAndreas Haerter //dw2pdf plugin 136fa5fcacaSAndreas Haerter //see <http://www.dokuwiki.org/plugin:dw2pdf> for info 137fa5fcacaSAndreas Haerter if (file_exists(DOKU_PLUGIN."dw2pdf/action.php") && 138fa5fcacaSAndreas Haerter !plugin_isdisabled("dw2pdf")){ 139fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["xhtml"] .= " <li id=\"coll-download-as-rl\"><a href=\"".wl(cleanID(getId()), array("do" => "export_pdf"))."\" rel=\"nofollow\">".hsc($lang["vector_exportbxdef_downloadpdf"])."</a></li>\n"; 140fa5fcacaSAndreas Haerter //html2pdf plugin 141fa5fcacaSAndreas Haerter //see <http://www.dokuwiki.org/plugin:html2pdf> for info 142fa5fcacaSAndreas Haerter } else if (file_exists(DOKU_PLUGIN."html2pdf/action.php") && 143fa5fcacaSAndreas Haerter !plugin_isdisabled("html2pdf")){ 144fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["xhtml"] .= " <li id=\"coll-download-as-rl\"><a href=\"".wl(cleanID(getId()), array("do" => "export_pdf"))."\" rel=\"nofollow\">".hsc($lang["vector_exportbxdef_downloadpdf"])."</a></li>\n"; 145fa5fcacaSAndreas Haerter } 146fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["xhtml"] .= " <li id=\"t-print\"><a href=\"".wl(cleanID(getId()), array("rev" =>(int)$rev, "vecdo" => "print"))."\" rel=\"nofollow\">".hsc($lang["vector_exportbxdef_print"])."</a></li>\n" 147fa5fcacaSAndreas Haerter ." </ul>"; 148fa5fcacaSAndreas Haerter }else{ 149fa5fcacaSAndreas Haerter //we have to use a custom exportbox 150fa5fcacaSAndreas Haerter if (empty($conf["useacl"]) || 151fa5fcacaSAndreas Haerter auth_quickaclcheck(cleanID(tpl_getConf("vector_exportbox_location"))) >= AUTH_READ){ //current user got access? 152fa5fcacaSAndreas Haerter //get the rendered content of the defined wiki article to use as 153fa5fcacaSAndreas Haerter //custom exportbox 154fa5fcacaSAndreas Haerter $interim = tpl_include_page(tpl_getConf("vector_exportbox_location"), false); 155fa5fcacaSAndreas Haerter if ($interim === "" || 156fa5fcacaSAndreas Haerter $interim === false){ 157fa5fcacaSAndreas Haerter //add creation/edit link if the defined page got no content 158fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["xhtml"] = "<li>[ ".html_wikilink(tpl_getConf("vector_exportbox_location"), hsc($lang["vector_fillplaceholder"]." (".tpl_getConf("vector_exportbox_location").")"), null)." ]<br /></li>"; 159fa5fcacaSAndreas Haerter }else{ 160fa5fcacaSAndreas Haerter //add the rendered page content 161fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["xhtml"] = $interim; 162fa5fcacaSAndreas Haerter } 163fa5fcacaSAndreas Haerter }else{ 164fa5fcacaSAndreas Haerter //we are not allowed to show the content of the defined wiki 165fa5fcacaSAndreas Haerter //article to use as custom sitenotice. 166fa5fcacaSAndreas Haerter //$_vector_boxes["p-tb"]["xhtml"] = hsc($lang["vector_accessdenied"])." (".tpl_getConf("vector_exportbox_location").")"; 167fa5fcacaSAndreas Haerter } 168fa5fcacaSAndreas Haerter } 169fa5fcacaSAndreas Haerter } 170fa5fcacaSAndreas Haerter 171fa5fcacaSAndreas Haerter //toolbox 172fa5fcacaSAndreas Haerter if (tpl_getConf("vector_toolbox")){ 173fa5fcacaSAndreas Haerter //headline 174fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["headline"] = $lang["vector_toolbox"]; 175fa5fcacaSAndreas Haerter 176fa5fcacaSAndreas Haerter //content 177fa5fcacaSAndreas Haerter if (tpl_getConf("vector_toolbox_default")){ 178fa5fcacaSAndreas Haerter //define default, predefined toolbox 179fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] = " <ul>\n"; 180fa5fcacaSAndreas Haerter if (actionOK("backlink")){ //check if action is disabled 181fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] .= " <li id=\"t-whatlinkshere\"><a href=\"".wl(cleanID(getId()), array("do" => "backlink"))."\">".hsc($lang["vector_toolbxdef_whatlinkshere"])."</a></li>\n"; //we might use tpl_actionlink("backlink", "", "", hsc($lang["vector_toolbxdef_whatlinkshere"]), true), but it would be the only toolbox link where this is possible... therefore I don't use it to be consistent 182fa5fcacaSAndreas Haerter } 183fa5fcacaSAndreas Haerter if (actionOK("recent")){ //check if action is disabled 184fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] .= " <li id=\"t-recentchanges\"><a href=\"".wl("", array("do" => "recent"))."\" rel=\"nofollow\">".hsc($lang["btn_recent"])."</a></li>\n"; //language comes from DokuWiki core 185fa5fcacaSAndreas Haerter } 18626d590edSAndreas Haerter if (actionOK("media")){ //check if action is disabled 187*0a1cb4e9SAndreas Haerter if (function_exists("media_managerURL")) { 188*0a1cb4e9SAndreas Haerter //use new media manager (available on releases newer than 2011-05-25a "Rincewind" / since 2011-11-10 "Angua" RC1) 1896d885141SAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] .= " <li id=\"t-upload\"><a href=\"".wl("", array("do" => "media"))."\" rel=\"nofollow\">".hsc($lang["btn_media"])."</a></li>\n"; //language comes from DokuWiki core 190*0a1cb4e9SAndreas Haerter } else { 191*0a1cb4e9SAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] .= " <li id=\"t-upload\"><a href=\"".DOKU_BASE."lib/exe/mediamanager.php?ns=".getNS(getID())."\" rel=\"nofollow\">".hsc($lang["vector_toolbxdef_upload"])."</a></li>\n"; 192*0a1cb4e9SAndreas Haerter } 19326d590edSAndreas Haerter } 194fa5fcacaSAndreas Haerter if (actionOK("index")){ //check if action is disabled 195fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] .= " <li id=\"t-special\"><a href=\"".wl("", array("do" => "index"))."\" rel=\"nofollow\">".hsc($lang["vector_toolbxdef_siteindex"])."</a></li>\n"; 196fa5fcacaSAndreas Haerter } 197fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] .= " <li id=\"t-permanent\"><a href=\"".wl(cleanID(getId()), array("rev" =>(int)$rev))."\" rel=\"nofollow\">".hsc($lang["vector_toolboxdef_permanent"])."</a></li>\n" 198fa5fcacaSAndreas Haerter ." <li id=\"t-cite\"><a href=\"".wl(cleanID(getId()), array("rev" =>(int)$rev, "vecdo" => "cite"))."\" rel=\"nofollow\">".hsc($lang["vector_toolboxdef_cite"])."</a></li>\n" 199fa5fcacaSAndreas Haerter ." </ul>"; 200fa5fcacaSAndreas Haerter }else{ 201fa5fcacaSAndreas Haerter //we have to use a custom toolbox 202fa5fcacaSAndreas Haerter if (empty($conf["useacl"]) || 203fa5fcacaSAndreas Haerter auth_quickaclcheck(cleanID(tpl_getConf("vector_toolbox_location"))) >= AUTH_READ){ //current user got access? 204fa5fcacaSAndreas Haerter //get the rendered content of the defined wiki article to use as 205fa5fcacaSAndreas Haerter //custom toolbox 206fa5fcacaSAndreas Haerter $interim = tpl_include_page(tpl_getConf("vector_toolbox_location"), false); 207fa5fcacaSAndreas Haerter if ($interim === "" || 208fa5fcacaSAndreas Haerter $interim === false){ 209fa5fcacaSAndreas Haerter //add creation/edit link if the defined page got no content 210fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] = "<li>[ ".html_wikilink(tpl_getConf("vector_toolbox_location"), hsc($lang["vector_fillplaceholder"]." (".tpl_getConf("vector_toolbox_location").")"), null)." ]<br /></li>"; 211fa5fcacaSAndreas Haerter }else{ 212fa5fcacaSAndreas Haerter //add the rendered page content 213fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] = $interim; 214fa5fcacaSAndreas Haerter } 215fa5fcacaSAndreas Haerter }else{ 216fa5fcacaSAndreas Haerter //we are not allowed to show the content of the defined wiki 217fa5fcacaSAndreas Haerter //article to use as custom sitenotice. 218fa5fcacaSAndreas Haerter //$_vector_boxes["p-tb"]["xhtml"] = hsc($lang["vector_accessdenied"])." (".tpl_getConf("vector_toolbox_location").")"; 219fa5fcacaSAndreas Haerter } 220fa5fcacaSAndreas Haerter } 221fa5fcacaSAndreas Haerter } 222fa5fcacaSAndreas Haerter 223fa5fcacaSAndreas Haerter}else{ 224fa5fcacaSAndreas Haerter 225fa5fcacaSAndreas Haerter //headline 226fa5fcacaSAndreas Haerter $_vector_boxes["p-login"]["headline"] = $lang["btn_login"]; 227fa5fcacaSAndreas Haerter $_vector_boxes["p-login"]["xhtml"] = " <ul>\n" 228fa5fcacaSAndreas Haerter ." <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 229fa5fcacaSAndreas Haerter ." </ul>"; 230fa5fcacaSAndreas Haerter 231fa5fcacaSAndreas Haerter} 232fa5fcacaSAndreas Haerter 233fa5fcacaSAndreas Haerter 234fa5fcacaSAndreas Haerter/****************************************************************************** 235fa5fcacaSAndreas Haerter ******************************** ATTENTION ********************************* 236fa5fcacaSAndreas Haerter DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES! 237fa5fcacaSAndreas Haerter ****************************************************************************** 238fa5fcacaSAndreas Haerter If you want to add some own boxes, have a look at the README of this 239fa5fcacaSAndreas Haerter template and "/user/boxes.php". You have been warned! 240fa5fcacaSAndreas Haerter *****************************************************************************/ 241fa5fcacaSAndreas Haerter 242