1<?php
2
3/**
4 * Default tab configuration of the "monobook" 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 ARSAVA <dokuwiki@dev.arsava.com>
13 * @link https://www.dokuwiki.org/template:monobook
14 * @link https://www.dokuwiki.org/devel:configuration
15 */
16
17
18
19/******************************************************************************
20 ********************************  ATTENTION  *********************************
21         DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES!
22 ******************************************************************************
23  If you want to add some own tabs, have a look at the README of this template
24  and "/user/tabs.php". You have been warned!
25 *****************************************************************************/
26
27
28//check if we are running within the DokuWiki environment
29if (!defined("DOKU_INC")){
30    die();
31}
32
33
34//note: The tabs will be rendered in the order they were defined. Means: first
35//      tab will be rendered first, last tab will be rendered at last.
36
37
38//article tab
39//ATTENTION: "ca-nstab-main" is used as css id selector!
40if (substr(getID(), 0, strlen("wiki:user:")) !== "wiki:user:"){
41    $_monobook_tabs["ca-nstab-main"]["text"] = $lang["monobook_tab_article"];
42}else{
43    $_monobook_tabs["ca-nstab-main"]["text"] = $lang["monobook_tab_userpage"];
44}
45$_monobook_tabs["ca-nstab-main"]["accesskey"] = "V";
46if ($monobook_context !== "discuss"){ //$monobook_context was defined within main.php
47    $_monobook_tabs["ca-nstab-main"]["wiki"]  = ":".getID();
48    $_monobook_tabs["ca-nstab-main"]["class"] = "selected";
49}else{
50    $_monobook_tabs["ca-nstab-main"]["wiki"]  = ":".substr(getID(), strlen(tpl_getConf("monobook_discuss_ns"))-1);
51}
52
53
54//hide some tabs for anonymous clients (closed wiki)?
55if (empty($conf["useacl"]) || //are there any users?
56    $loginname !== "" || //user is logged in?
57    !tpl_getConf("monobook_closedwiki")){
58
59    //discussion tab
60    //ATTENTION: "ca-talk" is used as css id selector!
61    if (tpl_getConf("monobook_discuss")){
62        $_monobook_tabs["ca-talk"]["text"] = $lang["monobook_tab_discussion"];
63        if ($monobook_context === "discuss"){ //$monobook_context was defined within main.php
64            $_monobook_tabs["ca-talk"]["wiki"]  = ":".getID();
65            $_monobook_tabs["ca-talk"]["class"] = "selected";
66        }else{
67            $_monobook_tabs["ca-talk"]["wiki"] = tpl_getConf("monobook_discuss_ns").getID();
68        }
69    }
70
71
72    //edit/create/show source tab
73    //ATTENTION: "ca-edit" is used as css id selector!
74    $_monobook_tabs["ca-edit"]["href"]      = wl(cleanID(getId()), array("do" => "edit", "rev" => (int)$rev), false, "&");
75    $_monobook_tabs["ca-edit"]["accesskey"] = "E";
76    if ($ACT === "edit"){ //$ACT comes from DokuWiki core
77        $_monobook_tabs["ca-edit"]["class"] = "selected";
78    }
79    if (!empty($INFO["writable"])){ //$INFO comes from DokuWiki core
80        if (!empty($INFO["draft"])){
81            $_monobook_tabs["ca-edit"]["href"] = wl(cleanID(getId()), array("do" => "draft", "rev" => (int)$rev), false, "&");
82            $_monobook_tabs["ca-edit"]["text"] = $lang["btn_draft"]; //language comes from DokuWiki core
83        }else{
84            if(!empty($INFO["exists"])){
85                $_monobook_tabs["ca-edit"]["text"] = $lang["btn_edit"]; //language comes from DokuWiki core
86            }else{
87                $_monobook_tabs["ca-edit"]["text"] = $lang["btn_create"]; //language comes from DokuWiki core
88            }
89        }
90    }elseif (actionOK("source")){ //check if action is disabled
91        $_monobook_tabs["ca-edit"]["text"]      = $lang["btn_source"]; //language comes from DokuWiki core
92        $_monobook_tabs["ca-edit"]["accesskey"] = "E";
93    }
94
95
96    //old versions/revisions tab
97    if (!empty($INFO["exists"]) &&
98        actionOK("revisions")){ //check if action is disabled
99        //ATTENTION: "ca-history" is used as css id selector!
100        $_monobook_tabs["ca-history"]["text"]      = $lang["btn_revs"]; //language comes from DokuWiki core
101        $_monobook_tabs["ca-history"]["href"]      = wl(cleanID(getId()), array("do" => "revisions"), false, "&");
102        $_monobook_tabs["ca-history"]["accesskey"] = "O";
103        if ($ACT === "revisions"){ //$ACT comes from DokuWiki core
104            $_monobook_tabs["ca-history"]["class"] = "selected";
105        }
106    }
107
108
109    //(un)subscribe tab
110    //ATTENTION: "ca-watch" is used as css id selector!
111    if (!empty($conf["useacl"]) &&
112        !empty($conf["subscribers"]) &&
113        !empty($loginname)){  //$loginname was defined within main.php
114        //2010-11-07 "Anteater" and newer ones
115        if (empty($lang["btn_unsubscribe"])) {
116            if (actionOK("subscribe")){ //check if action is disabled
117                $_monobook_tabs["ca-watch"]["href"] = wl(cleanID(getId()), array("do" => "subscribe"), false, "&");
118                $_monobook_tabs["ca-watch"]["text"] = $lang["btn_subscribe"]; //language comes from DokuWiki core
119            }
120        //2009-12-25 "Lemming" and older ones. See the following for information:
121        //<http://www.freelists.org/post/dokuwiki/Question-about-tpl-buttonsubscribe>
122        } else {
123            if (empty($INFO["subscribed"]) && //$INFO comes from DokuWiki core
124                actionOK("subscribe")){ //check if action is disabled
125                $_monobook_tabs["ca-watch"]["href"] = wl(cleanID(getId()), array("do" => "subscribe"), false, "&");
126                $_monobook_tabs["ca-watch"]["text"] = $lang["btn_subscribe"]; //language comes from DokuWiki core
127            }elseif (actionOK("unsubscribe")){ //check if action is disabled
128                $_monobook_tabs["ca-watch"]["href"] = wl(cleanID(getId()), array("do" => "unsubscribe"), false, "&");
129                $_monobook_tabs["ca-watch"]["text"] = $lang["btn_unsubscribe"]; //language comes from DokuWiki core
130            }
131        }
132    }
133
134
135    //ODT plugin: export tab
136    //see <https://www.dokuwiki.org/plugin:odt> for info
137    if (file_exists(DOKU_PLUGIN."odt/syntax.php") &&
138        !plugin_isdisabled("odt")){
139        $_monobook_tabs["tab-export-odt"]["text"]     = $lang["monobook_tab_exportodt"];
140        $_monobook_tabs["tab-export-odt"]["href"]     = wl(cleanID(getId()), array("do" => "export_odt"), false, "&");
141        $_monobook_tabs["tab-export-odt"]["nofollow"] = true;
142    }
143
144
145    //html2pdf plugin: export tab (thanks to Luigi Micco <l.micco@tiscali.it>)
146    //see <https://www.dokuwiki.org/plugin:html2pdf> for info
147    if (file_exists(DOKU_PLUGIN."html2pdf/action.php") &&
148        !plugin_isdisabled("html2pdf")){
149        $_monobook_tabs["tab-export-pdf"]["text"]     = $lang["monobook_tab_exportpdf"];
150        $_monobook_tabs["tab-export-pdf"]["href"]     = wl(cleanID(getId()), array("do" => "export_pdf"), false, "&");
151        $_monobook_tabs["tab-export-pdf"]["nofollow"] = true;
152    }
153
154    //(un)subscribe namespace tab
155    if (!empty($conf["useacl"]) &&
156        !empty($conf["subscribers"]) &&
157        !empty($loginname)){ //$loginname was defined within main.php
158        if (empty($INFO["subscribedns"])){ //$INFO comes from DokuWiki core
159            $_monobook_tabs["ca-watchns"]["href"] = wl(cleanID(getId()), array("do" => "subscribens"), false, "&");
160            $_monobook_tabs["ca-watchns"]["text"] = $lang["btn_subscribens"]; //language comes from DokuWiki core
161        }else{
162            $_monobook_tabs["ca-watchns"]["href"] = wl(cleanID(getId()), array("do" => "unsubscribens"), false, "&");
163            $_monobook_tabs["ca-watchns"]["text"] = $lang["btn_unsubscribens"]; //language comes from DokuWiki core
164        }
165    }
166
167}
168
169
170/******************************************************************************
171 ********************************  ATTENTION  *********************************
172         DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES!
173 ******************************************************************************
174  If you want to add some own tabs, have a look at the README of this template
175  and "/user/tabs.php". You have been warned!
176 *****************************************************************************/
177
178