1<?php 2 3/** 4 * Default box configuration of the "vector" 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 <development@andreas-haerter.com> 13 * @link http://andreas-haerter.com/projects/dokuwiki-template-vector 14 * @link http://www.dokuwiki.org/template:vector 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 30if (!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)? 40if (empty($conf["useacl"]) || //are there any users? 41 $loginname !== "" || //user is logged in? 42 !tpl_getConf("vector_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("vector_navigation")){ 56 //headline 57 $_vector_boxes["p-navigation"]["headline"] = $lang["vector_navigation"]; 58 59 //detect wiki page to load as content 60 if (!empty($transplugin) && 61 is_object($transplugin) && 62 tpl_getConf("vector_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("vector_navigation_location"); 72 } else { 73 //load language specific navigation 74 $nav_location = tpl_getConf("vector_navigation_location")."_".$transplugin_langcur; 75 } 76 }else{ 77 //default navigation, no translation 78 $nav_location = tpl_getConf("vector_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 $_vector_boxes["p-navigation"]["xhtml"] = "[ ".html_wikilink($nav_location, hsc($lang["vector_fillplaceholder"]." (".$nav_location.")"))." ]<br />"; 90 }else{ 91 //the rendered page content 92 $_vector_boxes["p-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("vector_toc_position") === "sidebar"){ 100 //check if the current page got a TOC 101 $toc = tpl_toc(true); 102 if (!empty($toc)) { 103 //headline 104 $_vector_boxes["p-toc"]["headline"] = $lang["toc"]; //language comes from DokuWiki core 105 106 //content 107 $_vector_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 //exportbox ("print/export") 121 if (tpl_getConf("vector_exportbox")){ 122 //headline 123 $_vector_boxes["p-coll-print_export"]["headline"] = $lang["vector_exportbox"]; 124 125 //content 126 if (tpl_getConf("vector_exportbox_default")){ 127 //define default, predefined exportbox 128 $_vector_boxes["p-coll-print_export"]["xhtml"] = " <ul>\n"; 129 //ODT plugin 130 //see <http://www.dokuwiki.org/plugin:odt> for info 131 if (file_exists(DOKU_PLUGIN."odt/syntax.php") && 132 !plugin_isdisabled("odt")){ 133 $_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"; 134 } 135 //dw2pdf plugin 136 //see <http://www.dokuwiki.org/plugin:dw2pdf> for info 137 if (file_exists(DOKU_PLUGIN."dw2pdf/action.php") && 138 !plugin_isdisabled("dw2pdf")){ 139 $_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"; 140 //html2pdf plugin 141 //see <http://www.dokuwiki.org/plugin:html2pdf> for info 142 } else if (file_exists(DOKU_PLUGIN."html2pdf/action.php") && 143 !plugin_isdisabled("html2pdf")){ 144 $_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"; 145 } 146 $_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" 147 ." </ul>"; 148 }else{ 149 //we have to use a custom exportbox 150 if (empty($conf["useacl"]) || 151 auth_quickaclcheck(cleanID(tpl_getConf("vector_exportbox_location"))) >= AUTH_READ){ //current user got access? 152 //get the rendered content of the defined wiki article to use as 153 //custom exportbox 154 $interim = tpl_include_page(tpl_getConf("vector_exportbox_location"), false); 155 if ($interim === "" || 156 $interim === false){ 157 //add creation/edit link if the defined page got no content 158 $_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>"; 159 }else{ 160 //add the rendered page content 161 $_vector_boxes["p-coll-print_export"]["xhtml"] = $interim; 162 } 163 }else{ 164 //we are not allowed to show the content of the defined wiki 165 //article to use as custom sitenotice. 166 //$_vector_boxes["p-tb"]["xhtml"] = hsc($lang["vector_accessdenied"])." (".tpl_getConf("vector_exportbox_location").")"; 167 } 168 } 169 } 170 171 //toolbox 172 if (tpl_getConf("vector_toolbox")){ 173 //headline 174 $_vector_boxes["p-tb"]["headline"] = $lang["vector_toolbox"]; 175 176 //content 177 if (tpl_getConf("vector_toolbox_default")){ 178 //define default, predefined toolbox 179 $_vector_boxes["p-tb"]["xhtml"] = " <ul>\n"; 180 if (actionOK("backlink")){ //check if action is disabled 181 $_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 182 } 183 if (actionOK("recent")){ //check if action is disabled 184 $_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 185 } 186 if (actionOK("media")){ //check if action is disabled 187 if (function_exists("media_managerURL")) { 188 //use new media manager (available on releases newer than 2011-05-25a "Rincewind" / since 2011-11-10 "Angua" RC1) 189 $_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 } else { 191 $_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 } 193 } 194 if (actionOK("index")){ //check if action is disabled 195 $_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"; 196 } 197 $_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" 198 ." <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" 199 ." </ul>"; 200 }else{ 201 //we have to use a custom toolbox 202 if (empty($conf["useacl"]) || 203 auth_quickaclcheck(cleanID(tpl_getConf("vector_toolbox_location"))) >= AUTH_READ){ //current user got access? 204 //get the rendered content of the defined wiki article to use as 205 //custom toolbox 206 $interim = tpl_include_page(tpl_getConf("vector_toolbox_location"), false); 207 if ($interim === "" || 208 $interim === false){ 209 //add creation/edit link if the defined page got no content 210 $_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>"; 211 }else{ 212 //add the rendered page content 213 $_vector_boxes["p-tb"]["xhtml"] = $interim; 214 } 215 }else{ 216 //we are not allowed to show the content of the defined wiki 217 //article to use as custom sitenotice. 218 //$_vector_boxes["p-tb"]["xhtml"] = hsc($lang["vector_accessdenied"])." (".tpl_getConf("vector_toolbox_location").")"; 219 } 220 } 221 } 222 223}else{ 224 225 //headline 226 $_vector_boxes["p-login"]["headline"] = $lang["btn_login"]; 227 $_vector_boxes["p-login"]["xhtml"] = " <ul>\n" 228 ." <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 229 ." </ul>"; 230 231} 232 233 234/****************************************************************************** 235 ******************************** ATTENTION ********************************* 236 DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES! 237 ****************************************************************************** 238 If you want to add some own boxes, have a look at the README of this 239 template and "/user/boxes.php". You have been warned! 240 *****************************************************************************/ 241 242