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