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 <andreas.haerter@dev.mail-node.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 45 //navigation 46 if (tpl_getConf("vector_navigation")){ 47 //headline 48 $_vector_boxes["p-navigation"]["headline"] = $lang["vector_navigation"]; 49 50 //content 51 if (empty($conf["useacl"]) || 52 auth_quickaclcheck(cleanID(tpl_getConf("vector_navigation_location"))) >= AUTH_READ){ //current user got access? 53 //get the rendered content of the defined wiki article to use as custom navigation 54 $interim = tpl_include_page(tpl_getConf("vector_navigation_location"), false); 55 if ($interim === "" || 56 $interim === false){ 57 //creation/edit link if the defined page got no content 58 $_vector_boxes["p-navigation"]["xhtml"] = "[ ".html_wikilink(tpl_getConf("vector_navigation_location"), hsc($lang["vector_fillplaceholder"]." (".tpl_getConf("vector_navigation_location").")"))." ]<br />"; 59 }else{ 60 //the rendered page content 61 $_vector_boxes["p-navigation"]["xhtml"] = $interim; 62 } 63 } 64 } 65 66 //table of contents (TOC) - show outside the article? (this is a dirty hack but often requested) 67 if (tpl_getConf("vector_toc_position") === "sidebar"){ 68 //check if the current page got a TOC 69 $toc = tpl_toc(true); 70 if (!empty($toc)) { 71 //headline 72 $_vector_boxes["p-toc"]["headline"] = $lang["toc"]; //language comes from DokuWiki core 73 74 //content 75 $_vector_boxes["p-toc"]["xhtml"] = //get rid of some styles and the embedded headline 76 str_replace(//search 77 array("<div class=\"tocheader toctoggle\" id=\"toc__header\">".$lang["toc"]."</div>", //language comes from DokuWiki core 78 " class=\"toc\"", 79 " id=\"toc__inside\""), 80 //replace 81 "", 82 //haystack 83 $toc); 84 } 85 unset($toc); 86 } 87 88 //exportbox ("print/export") 89 if (tpl_getConf("vector_exportbox")){ 90 //headline 91 $_vector_boxes["p-coll-print_export"]["headline"] = $lang["vector_exportbox"]; 92 93 //content 94 if (tpl_getConf("vector_exportbox_default")){ 95 //define default, predefined exportbox 96 $_vector_boxes["p-coll-print_export"]["xhtml"] = " <ul>\n"; 97 //ODT plugin 98 //see <http://www.dokuwiki.org/plugin:odt> for info 99 if (file_exists(DOKU_PLUGIN."odt/syntax.php") && 100 !plugin_isdisabled("odt")){ 101 $_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"; 102 } 103 //dw2pdf plugin 104 //see <http://www.dokuwiki.org/plugin:dw2pdf> for info 105 if (file_exists(DOKU_PLUGIN."dw2pdf/action.php") && 106 !plugin_isdisabled("dw2pdf")){ 107 $_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"; 108 //html2pdf plugin 109 //see <http://www.dokuwiki.org/plugin:html2pdf> for info 110 } else if (file_exists(DOKU_PLUGIN."html2pdf/action.php") && 111 !plugin_isdisabled("html2pdf")){ 112 $_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"; 113 } 114 $_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" 115 ." </ul>"; 116 }else{ 117 //we have to use a custom exportbox 118 if (empty($conf["useacl"]) || 119 auth_quickaclcheck(cleanID(tpl_getConf("vector_exportbox_location"))) >= AUTH_READ){ //current user got access? 120 //get the rendered content of the defined wiki article to use as 121 //custom exportbox 122 $interim = tpl_include_page(tpl_getConf("vector_exportbox_location"), false); 123 if ($interim === "" || 124 $interim === false){ 125 //add creation/edit link if the defined page got no content 126 $_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>"; 127 }else{ 128 //add the rendered page content 129 $_vector_boxes["p-coll-print_export"]["xhtml"] = $interim; 130 } 131 }else{ 132 //we are not allowed to show the content of the defined wiki 133 //article to use as custom sitenotice. 134 //$_vector_boxes["p-tb"]["xhtml"] = hsc($lang["vector_accessdenied"])." (".tpl_getConf("vector_exportbox_location").")"; 135 } 136 } 137 } 138 139 //toolbox 140 if (tpl_getConf("vector_toolbox")){ 141 //headline 142 $_vector_boxes["p-tb"]["headline"] = $lang["vector_toolbox"]; 143 144 //content 145 if (tpl_getConf("vector_toolbox_default")){ 146 //define default, predefined toolbox 147 $_vector_boxes["p-tb"]["xhtml"] = " <ul>\n"; 148 if (actionOK("backlink")){ //check if action is disabled 149 $_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 150 } 151 if (actionOK("recent")){ //check if action is disabled 152 $_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 153 } 154 $_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"; 155 if (actionOK("index")){ //check if action is disabled 156 $_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"; 157 } 158 $_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" 159 ." <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" 160 ." </ul>"; 161 }else{ 162 //we have to use a custom toolbox 163 if (empty($conf["useacl"]) || 164 auth_quickaclcheck(cleanID(tpl_getConf("vector_toolbox_location"))) >= AUTH_READ){ //current user got access? 165 //get the rendered content of the defined wiki article to use as 166 //custom toolbox 167 $interim = tpl_include_page(tpl_getConf("vector_toolbox_location"), false); 168 if ($interim === "" || 169 $interim === false){ 170 //add creation/edit link if the defined page got no content 171 $_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>"; 172 }else{ 173 //add the rendered page content 174 $_vector_boxes["p-tb"]["xhtml"] = $interim; 175 } 176 }else{ 177 //we are not allowed to show the content of the defined wiki 178 //article to use as custom sitenotice. 179 //$_vector_boxes["p-tb"]["xhtml"] = hsc($lang["vector_accessdenied"])." (".tpl_getConf("vector_toolbox_location").")"; 180 } 181 } 182 } 183 184}else{ 185 186 //headline 187 $_vector_boxes["p-login"]["headline"] = $lang["btn_login"]; 188 $_vector_boxes["p-login"]["xhtml"] = " <ul>\n" 189 ." <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 190 ." </ul>"; 191 192} 193 194 195/****************************************************************************** 196 ******************************** ATTENTION ********************************* 197 DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES! 198 ****************************************************************************** 199 If you want to add some own boxes, have a look at the README of this 200 template and "/user/boxes.php". You have been warned! 201 *****************************************************************************/ 202 203