1<?php
2
3/**
4 * Default tab 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 ARSAVA <dokuwiki@dev.arsava.com>
13 * @link https://www.dokuwiki.org/template:vector
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
35/****************************** LEFT NAVIGATION ******************************/
36
37//note: The tabs will be rendered in the order they were defined. Means: first
38//      tab will be rendered first, last tab will be rendered at last.
39
40
41
42//article tab
43//ATTENTION: "ca-nstab-main" is used as css id selector!
44if (substr(getID(), 0, strlen("wiki:user:")) !== "wiki:user:"){
45    $_vector_tabs_left["ca-nstab-main"]["text"] = $lang["vector_article"];
46}else{
47    $_vector_tabs_left["ca-nstab-main"]["text"] = $lang["vector_userpage"];
48}
49$_vector_tabs_left["ca-nstab-main"]["accesskey"] = "V";
50if ($vector_context !== "discuss"){ //$vector_context was defined within main.php
51    $_vector_tabs_left["ca-nstab-main"]["wiki"]  = ":".getID();
52    $_vector_tabs_left["ca-nstab-main"]["class"] = "selected";
53}else{
54    $_vector_tabs_left["ca-nstab-main"]["wiki"]  = ":".substr(getID(), strlen(tpl_getConf("vector_discuss_ns"))-1);
55}
56
57
58//hide some tabs for anonymous clients (closed wiki)?
59if (empty($conf["useacl"]) || //are there any users?
60    $loginname !== "" || //user is logged in?
61    !tpl_getConf("vector_closedwiki")){
62
63    //discussion tab
64    //ATTENTION: "ca-talk" is used as css id selector!
65    if (tpl_getConf("vector_discuss")){
66        $_vector_tabs_left["ca-talk"]["text"] = $lang["vector_discussion"];
67        if ($vector_context === "discuss"){ //$vector_context was defined within main.php
68            $_vector_tabs_left["ca-talk"]["wiki"]  = ":".getID();
69            $_vector_tabs_left["ca-talk"]["class"] = "selected";
70        }else{
71            $_vector_tabs_left["ca-talk"]["wiki"] = tpl_getConf("vector_discuss_ns").getID();
72        }
73    }
74
75}
76
77
78
79/****************************** RIGHT NAVIGATION ******************************/
80
81//note: The tabs will be rendered in the order they were defined. Means: first
82//      tab will be rendered first, last tab will be rendered at last.
83
84
85//read tab
86if(!empty($INFO["exists"])){
87    //ATTENTION: "ca-view" is used as css id selector!
88    $_vector_tabs_right["ca-view"]["text"] = $lang["vector_read"];
89    if ($vector_context !== "discuss"){ //$vector_context was defined within main.php
90        $_vector_tabs_right["ca-view"]["wiki"]  = ":".getID();
91        if ($ACT === "show") { //$ACT comes from DokuWiki core
92            $_vector_tabs_right["ca-view"]["class"] = "selected";
93        }
94    }else{
95        $_vector_tabs_right["ca-view"]["wiki"]  = ":".substr(getID(), strlen(tpl_getConf("vector_discuss_ns"))-1);
96    }
97}
98
99
100//hide some tabs for anonymous clients (closed wiki)?
101if (empty($conf["useacl"]) || //are there any users?
102    $loginname !== "" || //user is logged in?
103    !tpl_getConf("vector_closedwiki")){
104
105    //edit/create/show source tab
106    //ATTENTION: "ca-edit" is used as css id selector!
107    $_vector_tabs_right["ca-edit"]["href"]      = wl(cleanID(getId()), array("do" => "edit", "rev" => (int)$rev), false, "&");
108    $_vector_tabs_right["ca-edit"]["accesskey"] = "E";
109    if (!empty($INFO["writable"])){ //$INFO comes from DokuWiki core
110        if (!empty($INFO["draft"])){
111            $_vector_tabs_right["ca-edit"]["href"] = wl(cleanID(getId()), array("do" => "draft", "rev" => (int)$rev), false, "&");
112            $_vector_tabs_right["ca-edit"]["text"] = $lang["btn_draft"]; //language comes from DokuWiki core
113        }else{
114            if(!empty($INFO["exists"])){
115                $_vector_tabs_right["ca-edit"]["text"] = $lang["vector_edit"];
116            }else{
117                $_vector_tabs_right["ca-edit"]["text"] = $lang["vector_create"];
118            }
119        }
120    }elseif (actionOK("source")){ //check if action is disabled
121        $_vector_tabs_right["ca-edit"]["text"]      = $lang["btn_source"]; //language comes from DokuWiki core
122        $_vector_tabs_right["ca-edit"]["accesskey"] = "E";
123    }
124    if ($ACT === "edit"){ //$ACT comes from DokuWiki core
125        $_vector_tabs_right["ca-edit"]["class"] = "selected";
126    }
127
128
129    //old versions/revisions tab
130    if (!empty($INFO["exists"]) &&
131        actionOK("revisions")){ //check if action is disabled
132        //ATTENTION: "ca-history" is used as css id selector!
133        $_vector_tabs_right["ca-history"]["text"]      = $lang["btn_revs"]; //language comes from DokuWiki core
134        $_vector_tabs_right["ca-history"]["href"]      = wl(cleanID(getId()), array("do" => "revisions"), false, "&");
135        $_vector_tabs_right["ca-history"]["accesskey"] = "O";
136        if ($ACT === "revisions"){ //$ACT comes from DokuWiki core
137            $_vector_tabs_right["ca-history"]["class"] = "selected";
138        }
139    }
140
141
142    //(un)subscribe tab
143    //ATTENTION: "ca-watch" is used as css id selector!
144    if (!empty($conf["useacl"]) &&
145        !empty($conf["subscribers"]) &&
146        !empty($loginname)){ //$loginname was defined within main.php
147        //2010-11-07 "Anteater" and newer ones
148        if (empty($lang["btn_unsubscribe"])) {
149            if (actionOK("subscribe")){ //check if action is disabled
150                $_vector_tabs_right["ca-watch"]["href"] = wl(cleanID(getId()), array("do" => "subscribe"), false, "&");
151                $_vector_tabs_right["ca-watch"]["text"] = $lang["btn_subscribe"]; //language comes from DokuWiki core
152            }
153        //2009-12-25 "Lemming" and older ones. See the following for information:
154        //<http://www.freelists.org/post/dokuwiki/Question-about-tpl-buttonsubscribe>
155        } else {
156            if (empty($INFO["subscribed"]) && //$INFO comes from DokuWiki core
157                actionOK("subscribe")){ //check if action is disabled
158                $_vector_tabs_right["ca-watch"]["href"] = wl(cleanID(getId()), array("do" => "subscribe"), false, "&");
159                $_vector_tabs_right["ca-watch"]["text"] = $lang["btn_subscribe"]; //language comes from DokuWiki core
160            }elseif (actionOK("unsubscribe")){ //check if action is disabled
161                $_vector_tabs_right["ca-watch"]["href"] = wl(cleanID(getId()), array("do" => "unsubscribe"), false, "&");
162                $_vector_tabs_right["ca-watch"]["text"] = $lang["btn_unsubscribe"]; //language comes from DokuWiki core
163            }
164        }
165    }
166
167}
168
169/******************************************************************************
170 ********************************  ATTENTION  *********************************
171         DO NOT MODIFY THIS FILE, IT WILL NOT BE PRESERVED ON UPDATES!
172 ******************************************************************************
173  If you want to add some own tabs, have a look at the README of this template
174  and "/user/tabs.php". You have been warned!
175 *****************************************************************************/
176
177