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) 12*2b0dc040SAndreas Haerter * @author Andreas Haerter <ah@bitkollektiv.org> 13fa5fcacaSAndreas Haerter * @link http://www.dokuwiki.org/template:vector 14fa5fcacaSAndreas Haerter * @link http://www.dokuwiki.org/devel:configuration 15fa5fcacaSAndreas Haerter */ 16fa5fcacaSAndreas Haerter 17fa5fcacaSAndreas Haerter 18fa5fcacaSAndreas Haerter 19fa5fcacaSAndreas Haerter/****************************************************************************** 20fa5fcacaSAndreas Haerter ******************************** ATTENTION ********************************* 21fa5fcacaSAndreas Haerter DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES! 22fa5fcacaSAndreas Haerter ****************************************************************************** 23fa5fcacaSAndreas Haerter If you want to add some own boxes, have a look at the README of this 24fa5fcacaSAndreas Haerter template and "/user/boxes.php". You have been warned! 25fa5fcacaSAndreas Haerter *****************************************************************************/ 26fa5fcacaSAndreas Haerter 27fa5fcacaSAndreas Haerter 28fa5fcacaSAndreas Haerter//check if we are running within the DokuWiki environment 29fa5fcacaSAndreas Haerterif (!defined("DOKU_INC")){ 30fa5fcacaSAndreas Haerter die(); 31fa5fcacaSAndreas Haerter} 32fa5fcacaSAndreas Haerter 33fa5fcacaSAndreas Haerter 34fa5fcacaSAndreas Haerter//note: The boxes will be rendered in the order they were defined. Means: 35fa5fcacaSAndreas Haerter// first box will be rendered first, last box will be rendered at last. 36fa5fcacaSAndreas Haerter 37fa5fcacaSAndreas Haerter 38fa5fcacaSAndreas Haerter//hide boxes for anonymous clients (closed wiki)? 39fa5fcacaSAndreas Haerterif (empty($conf["useacl"]) || //are there any users? 40fa5fcacaSAndreas Haerter $loginname !== "" || //user is logged in? 41fa5fcacaSAndreas Haerter !tpl_getConf("vector_closedwiki")){ 42fa5fcacaSAndreas Haerter 43952c7991SAndreas Haerter //Languages/translations provided by Andreas Gohr's translation plugin, 4452972747SAndreas Haerter //see <http://www.dokuwiki.org/plugin:translation>. Create plugin object if 4552972747SAndreas Haerter //needed. 4652972747SAndreas Haerter if (file_exists(DOKU_PLUGIN."translation/syntax.php") && 4752972747SAndreas Haerter !plugin_isdisabled("translation")){ 4852972747SAndreas Haerter $transplugin = &plugin_load("syntax", "translation"); 4952972747SAndreas Haerter } else { 5052972747SAndreas Haerter $transplugin = false; 5152972747SAndreas Haerter } 52fa5fcacaSAndreas Haerter 53fa5fcacaSAndreas Haerter //navigation 54fa5fcacaSAndreas Haerter if (tpl_getConf("vector_navigation")){ 55fa5fcacaSAndreas Haerter //headline 56fa5fcacaSAndreas Haerter $_vector_boxes["p-navigation"]["headline"] = $lang["vector_navigation"]; 57fa5fcacaSAndreas Haerter 5852972747SAndreas Haerter //detect wiki page to load as content 5952972747SAndreas Haerter if (!empty($transplugin) && 6052972747SAndreas Haerter is_object($transplugin) && 6152972747SAndreas Haerter tpl_getConf("vector_navigation_translate")){ 6252972747SAndreas Haerter //translated navigation? 6352972747SAndreas Haerter $transplugin_langcur = $transplugin->hlp->getLangPart(cleanID(getId())); //current language part 6452972747SAndreas Haerter $transplugin_langs = explode(" ", trim($transplugin->getConf("translations"))); //available languages 6552972747SAndreas Haerter if (empty($transplugin_langs) || 6652972747SAndreas Haerter empty($transplugin_langcur) || 6752972747SAndreas Haerter !is_array($transplugin_langs) || 6852972747SAndreas Haerter !in_array($transplugin_langcur, $transplugin_langs)) { 6952972747SAndreas Haerter //current page is no translation or something is wrong, load default navigation 7052972747SAndreas Haerter $nav_location = tpl_getConf("vector_navigation_location"); 7152972747SAndreas Haerter } else { 7252972747SAndreas Haerter //load language specific navigation 7352972747SAndreas Haerter $nav_location = tpl_getConf("vector_navigation_location")."_".$transplugin_langcur; 7452972747SAndreas Haerter } 7552972747SAndreas Haerter }else{ 7652972747SAndreas Haerter //default navigation, no translation 7752972747SAndreas Haerter $nav_location = tpl_getConf("vector_navigation_location"); 7852972747SAndreas Haerter } 7952972747SAndreas Haerter 80fa5fcacaSAndreas Haerter //content 81fa5fcacaSAndreas Haerter if (empty($conf["useacl"]) || 8252972747SAndreas Haerter auth_quickaclcheck(cleanID($nav_location)) >= AUTH_READ){ //current user got access? 83fa5fcacaSAndreas Haerter //get the rendered content of the defined wiki article to use as custom navigation 8452972747SAndreas Haerter $interim = tpl_include_page($nav_location, false); 85fa5fcacaSAndreas Haerter if ($interim === "" || 86fa5fcacaSAndreas Haerter $interim === false){ 87fa5fcacaSAndreas Haerter //creation/edit link if the defined page got no content 8852972747SAndreas Haerter $_vector_boxes["p-navigation"]["xhtml"] = "[ ".html_wikilink($nav_location, hsc($lang["vector_fillplaceholder"]." (".$nav_location.")"))." ]<br />"; 89fa5fcacaSAndreas Haerter }else{ 90fa5fcacaSAndreas Haerter //the rendered page content 91fa5fcacaSAndreas Haerter $_vector_boxes["p-navigation"]["xhtml"] = $interim; 92fa5fcacaSAndreas Haerter } 93fa5fcacaSAndreas Haerter } 9452972747SAndreas Haerter unset($nav_location); 95fa5fcacaSAndreas Haerter } 96fa5fcacaSAndreas Haerter 97fa5fcacaSAndreas Haerter //table of contents (TOC) - show outside the article? (this is a dirty hack but often requested) 98fa5fcacaSAndreas Haerter if (tpl_getConf("vector_toc_position") === "sidebar"){ 99fa5fcacaSAndreas Haerter //check if the current page got a TOC 100fa5fcacaSAndreas Haerter $toc = tpl_toc(true); 101fa5fcacaSAndreas Haerter if (!empty($toc)) { 102fa5fcacaSAndreas Haerter //headline 103fa5fcacaSAndreas Haerter $_vector_boxes["p-toc"]["headline"] = $lang["toc"]; //language comes from DokuWiki core 104fa5fcacaSAndreas Haerter 105fa5fcacaSAndreas Haerter //content 106fa5fcacaSAndreas Haerter $_vector_boxes["p-toc"]["xhtml"] = //get rid of some styles and the embedded headline 107fa5fcacaSAndreas Haerter str_replace(//search 108fa5fcacaSAndreas Haerter array("<div class=\"tocheader toctoggle\" id=\"toc__header\">".$lang["toc"]."</div>", //language comes from DokuWiki core 109fa5fcacaSAndreas Haerter " class=\"toc\"", 110fa5fcacaSAndreas Haerter " id=\"toc__inside\""), 111fa5fcacaSAndreas Haerter //replace 112fa5fcacaSAndreas Haerter "", 113fa5fcacaSAndreas Haerter //haystack 114fa5fcacaSAndreas Haerter $toc); 115fa5fcacaSAndreas Haerter } 116fa5fcacaSAndreas Haerter unset($toc); 117fa5fcacaSAndreas Haerter } 118fa5fcacaSAndreas Haerter 119fa5fcacaSAndreas Haerter //exportbox ("print/export") 120fa5fcacaSAndreas Haerter if (tpl_getConf("vector_exportbox")){ 121fa5fcacaSAndreas Haerter //headline 122fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["headline"] = $lang["vector_exportbox"]; 123fa5fcacaSAndreas Haerter 124fa5fcacaSAndreas Haerter //content 125fa5fcacaSAndreas Haerter if (tpl_getConf("vector_exportbox_default")){ 126fa5fcacaSAndreas Haerter //define default, predefined exportbox 127fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["xhtml"] = " <ul>\n"; 128fa5fcacaSAndreas Haerter //ODT plugin 129fa5fcacaSAndreas Haerter //see <http://www.dokuwiki.org/plugin:odt> for info 130fa5fcacaSAndreas Haerter if (file_exists(DOKU_PLUGIN."odt/syntax.php") && 131fa5fcacaSAndreas Haerter !plugin_isdisabled("odt")){ 132fa5fcacaSAndreas 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"; 133fa5fcacaSAndreas Haerter } 134fa5fcacaSAndreas Haerter //dw2pdf plugin 135fa5fcacaSAndreas Haerter //see <http://www.dokuwiki.org/plugin:dw2pdf> for info 136fa5fcacaSAndreas Haerter if (file_exists(DOKU_PLUGIN."dw2pdf/action.php") && 137fa5fcacaSAndreas Haerter !plugin_isdisabled("dw2pdf")){ 138fa5fcacaSAndreas 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"; 139fa5fcacaSAndreas Haerter //html2pdf plugin 140fa5fcacaSAndreas Haerter //see <http://www.dokuwiki.org/plugin:html2pdf> for info 141fa5fcacaSAndreas Haerter } else if (file_exists(DOKU_PLUGIN."html2pdf/action.php") && 142fa5fcacaSAndreas Haerter !plugin_isdisabled("html2pdf")){ 143fa5fcacaSAndreas 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"; 144fa5fcacaSAndreas Haerter } 145fa5fcacaSAndreas 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" 146fa5fcacaSAndreas Haerter ." </ul>"; 147fa5fcacaSAndreas Haerter }else{ 148fa5fcacaSAndreas Haerter //we have to use a custom exportbox 149fa5fcacaSAndreas Haerter if (empty($conf["useacl"]) || 150fa5fcacaSAndreas Haerter auth_quickaclcheck(cleanID(tpl_getConf("vector_exportbox_location"))) >= AUTH_READ){ //current user got access? 151fa5fcacaSAndreas Haerter //get the rendered content of the defined wiki article to use as 152fa5fcacaSAndreas Haerter //custom exportbox 153fa5fcacaSAndreas Haerter $interim = tpl_include_page(tpl_getConf("vector_exportbox_location"), false); 154fa5fcacaSAndreas Haerter if ($interim === "" || 155fa5fcacaSAndreas Haerter $interim === false){ 156fa5fcacaSAndreas Haerter //add creation/edit link if the defined page got no content 157fa5fcacaSAndreas 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>"; 158fa5fcacaSAndreas Haerter }else{ 159fa5fcacaSAndreas Haerter //add the rendered page content 160fa5fcacaSAndreas Haerter $_vector_boxes["p-coll-print_export"]["xhtml"] = $interim; 161fa5fcacaSAndreas Haerter } 162fa5fcacaSAndreas Haerter }else{ 163fa5fcacaSAndreas Haerter //we are not allowed to show the content of the defined wiki 164fa5fcacaSAndreas Haerter //article to use as custom sitenotice. 165fa5fcacaSAndreas Haerter //$_vector_boxes["p-tb"]["xhtml"] = hsc($lang["vector_accessdenied"])." (".tpl_getConf("vector_exportbox_location").")"; 166fa5fcacaSAndreas Haerter } 167fa5fcacaSAndreas Haerter } 168fa5fcacaSAndreas Haerter } 169fa5fcacaSAndreas Haerter 170fa5fcacaSAndreas Haerter //toolbox 171fa5fcacaSAndreas Haerter if (tpl_getConf("vector_toolbox")){ 172fa5fcacaSAndreas Haerter //headline 173fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["headline"] = $lang["vector_toolbox"]; 174fa5fcacaSAndreas Haerter 175fa5fcacaSAndreas Haerter //content 176fa5fcacaSAndreas Haerter if (tpl_getConf("vector_toolbox_default")){ 177fa5fcacaSAndreas Haerter //define default, predefined toolbox 178fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] = " <ul>\n"; 179fa5fcacaSAndreas Haerter if (actionOK("backlink")){ //check if action is disabled 180fa5fcacaSAndreas 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 181fa5fcacaSAndreas Haerter } 182fa5fcacaSAndreas Haerter if (actionOK("recent")){ //check if action is disabled 183fa5fcacaSAndreas 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 184fa5fcacaSAndreas Haerter } 18526d590edSAndreas Haerter if (actionOK("media")){ //check if action is disabled 1860a1cb4e9SAndreas Haerter if (function_exists("media_managerURL")) { 1870a1cb4e9SAndreas Haerter //use new media manager (available on releases newer than 2011-05-25a "Rincewind" / since 2011-11-10 "Angua" RC1) 1886d885141SAndreas 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 1890a1cb4e9SAndreas Haerter } else { 1900a1cb4e9SAndreas 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"; 1910a1cb4e9SAndreas Haerter } 19226d590edSAndreas Haerter } 193fa5fcacaSAndreas Haerter if (actionOK("index")){ //check if action is disabled 194fa5fcacaSAndreas 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"; 195fa5fcacaSAndreas Haerter } 196fa5fcacaSAndreas 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" 197fa5fcacaSAndreas 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" 198fa5fcacaSAndreas Haerter ." </ul>"; 199fa5fcacaSAndreas Haerter }else{ 200fa5fcacaSAndreas Haerter //we have to use a custom toolbox 201fa5fcacaSAndreas Haerter if (empty($conf["useacl"]) || 202fa5fcacaSAndreas Haerter auth_quickaclcheck(cleanID(tpl_getConf("vector_toolbox_location"))) >= AUTH_READ){ //current user got access? 203fa5fcacaSAndreas Haerter //get the rendered content of the defined wiki article to use as 204fa5fcacaSAndreas Haerter //custom toolbox 205fa5fcacaSAndreas Haerter $interim = tpl_include_page(tpl_getConf("vector_toolbox_location"), false); 206fa5fcacaSAndreas Haerter if ($interim === "" || 207fa5fcacaSAndreas Haerter $interim === false){ 208fa5fcacaSAndreas Haerter //add creation/edit link if the defined page got no content 209fa5fcacaSAndreas 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>"; 210fa5fcacaSAndreas Haerter }else{ 211fa5fcacaSAndreas Haerter //add the rendered page content 212fa5fcacaSAndreas Haerter $_vector_boxes["p-tb"]["xhtml"] = $interim; 213fa5fcacaSAndreas Haerter } 214fa5fcacaSAndreas Haerter }else{ 215fa5fcacaSAndreas Haerter //we are not allowed to show the content of the defined wiki 216fa5fcacaSAndreas Haerter //article to use as custom sitenotice. 217fa5fcacaSAndreas Haerter //$_vector_boxes["p-tb"]["xhtml"] = hsc($lang["vector_accessdenied"])." (".tpl_getConf("vector_toolbox_location").")"; 218fa5fcacaSAndreas Haerter } 219fa5fcacaSAndreas Haerter } 220fa5fcacaSAndreas Haerter } 221fa5fcacaSAndreas Haerter 222fa5fcacaSAndreas Haerter}else{ 223fa5fcacaSAndreas Haerter 224fa5fcacaSAndreas Haerter //headline 225fa5fcacaSAndreas Haerter $_vector_boxes["p-login"]["headline"] = $lang["btn_login"]; 226fa5fcacaSAndreas Haerter $_vector_boxes["p-login"]["xhtml"] = " <ul>\n" 227fa5fcacaSAndreas 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 228fa5fcacaSAndreas Haerter ." </ul>"; 229fa5fcacaSAndreas Haerter 230fa5fcacaSAndreas Haerter} 231fa5fcacaSAndreas Haerter 232fa5fcacaSAndreas Haerter 233fa5fcacaSAndreas Haerter/****************************************************************************** 234fa5fcacaSAndreas Haerter ******************************** ATTENTION ********************************* 235fa5fcacaSAndreas Haerter DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES! 236fa5fcacaSAndreas Haerter ****************************************************************************** 237fa5fcacaSAndreas Haerter If you want to add some own boxes, have a look at the README of this 238fa5fcacaSAndreas Haerter template and "/user/boxes.php". You have been warned! 239fa5fcacaSAndreas Haerter *****************************************************************************/ 240fa5fcacaSAndreas Haerter 241