Closed tormec closed 8 years ago
I am not entirely sure what youwant to do. Do you want different nav_pages for different namespaces? The most current upgrade no longer uses a hard-coded name for the nav_page. It is specified in the configuration options, so it may be possible to set a nav_page using relative names, if that's is what you want. Otherwise, the overlay plugin is simply a transmitter of whatever you place in the nav_page.
In reference to my previous tree structure, I have two sidebar.txt
, in two different namespaces, with the following different contents:
in sidebar
- link A
- ..
- private:sidebar
in private:sidebar
- link B
- ..
- sidebar
So, the answer to your question:
Do you want different nav_pages for different namespaces?
is yes, but I'd also like that:
if I'm in the root namespace then shows sidebar
if I'm in private namespace then shows private:sidebar
In Configuration Manager I've tried the syntax sidebar
, that is:
refers to the page “sidebar” in the current namespace
but it always shows the sidebar in the root namespace, even though I'm in the private namespace. Maybe I don't properly understand the right syntax...
The basic answer to your question is "no". You do not have the option of installing two sidebars in Dokuwiki -- the same is true of the overlay plugin. But conforming navigation plugins like simplenavi and indexmenu use ACL rules. And they respect the sneaky index configuration setting, which means that namespaces for which the user does not have ACL rights will not be displayed in the index listings.
But your suggestion is an interesting one and I'll have to think about it for the overlay plugin.
But your suggestion is an interesting one and I'll have to think about it for the overlay plugin.
Ok, Many thanks.
Let me post two images in order to better understand the problem.
In the below image you can see my current sitemap (1) and in (2) and in (3) you can see that the sidebar is different depending on which namespace I am viewing.
In (4) I installed Dokuwiki-Nav-Overlay Plugin and in Configuration Manager I used the (relative?) path sidebar
, but it always points to the same file.
In the below image you can see, maybe because of the previous behaviour, that a user, without a read permission, can view the page private:sidebar
(he can't open any link of that page..but he can "read" its content).
Thanks for your time!
See the current update and the explanation of options on the plugin page at dokuwiki.org. The update should do as you ask.
Well done!! Just one little thing..
It seems to me that now the variables $conf['page']
and $conf['nsoverlays']
are "excessive".
For example, in CM I can set:
$conf['page'] = :overlay
$conf['nsoverlays'] = :, private
or
$conf['page'] = :overlay
$conf['nsoverlays'] = private
or
$conf['page'] = private:overlay
$conf['nsoverlays'] = :, private
or
$conf['page'] = private:overlay
$conf['nsoverlays'] = :
and the result is always the same: when I'm in :
or in private
I load the relative overlay
page.
An idea could be to use only one variable which takes the name of the page containing overlay data and then execute the following if-statements:
//when in : and in private load the relative overlay page
$conf['xyz'] = :overlay, private:overlay
//always load the overlay page from the root namespace
$conf['xyz'] = :overlay
//always load the overlay page from the current namespace
$conf['xyz'] = overlay
//always load the overlay page from the current namespace
//but if you are in : and in private load the relative overlay page
$conf['xyz'] = overlay, :overlay, private:overlay
Also, I think in this way there is no longer need to constrain to call the page with the overlay data with a specific name (since now $conf['nsoverlays']
accepts only the name overlay
).
Do you think it makes any sense?
since now $conf['nsoverlays'] accepts only the name overlay
This is in fact already the case. And the main, named page is there so that a default page exists to be called when not in a namespace where an alternate overlay
page is found.
You can always fork a copy and make your changes so that your ideas are easier to follow
I bag your pardon but my jQuerry/JavaScript knowledge is equal to zero and I can't load a page with a variable name. My bug :)
By the way, this is my attempt (not tested)
function print_overlay(&$event, $param) {
global $INFO;
$paths = $this->getConf('nsoverlays');
$paths = explode(',', $paths);
$overlays = array();
$overlay = '';
foreach ($paths as $path) {
$re = '/(\w+(?!.*\:))/';
$subst = "";
$path = trim($path);
preg_match($re, $path, $matches);
$page = $matches[1];
$namespace = trim(preg_replace($re, $subst, $path));
$overlays[] = array($path, $namespace, $page);
}
foreach ($overlays as $key=>$val) {
if (array_search($INFO['namespace'], $val) !== false) {
$overlay = $overlays[$key][0];
}
elseif (array_search('', $val) !== false) {
$overlay = $overlays[$key][0];
}
}
$insert = p_wiki_xhtml($overlay);
if(!$insert) return;
$close = trim($this->getLang('close'));
$text = <<<TEXT
//call the javascript window
TEXT;
echo $text;
}
For instance, if:
$paths = "overlay0, :overlay1, private:overlay2";
then the array $overlays
is:
Array
(
[0] => Array
(
[0] => overlay0
[1] =>
[2] => overlay0
)
[1] => Array
(
[0] => :overlay1
[1] => :
[2] => overlay1
)
[2] => Array
(
[0] => private:overlay2
[1] => private:
[2] => overlay2
)
)
I know that without a valid contribution (= pull request) is very difficult to follow an idea and this is my fault. Maybe give me some days in order to learn how jQuerry works.
Solved in pull request #2.
Thank you for all of your input. Merged the namespace branch into the master, giving you credit for your suggestions. Upated the plugin page at dw.org.
Hi, In my wiki I have the following structure:
So, the
your:nav_page
has always the same name but its content is different depending on at which namespace it belongs.Is it possible to add the possibility to use the syntax described here https://www.dokuwiki.org/namespaces (see the table with the examples)?
Thanks