This is an old revision of the document!
Table of Contents
Plugin Dir - Discussions
Questions
I get all sorts of debug output in red
The dir plugin looks like almost exactly what I want, it outputs a directory just as I need but it also outputs a load of what appears to be diagnostics in red above the output that I want.
OK, I have just found out that turning the debug flag off stops this appearing but it's still a bit odd. All other code sends output to debug.log when debug is turned on, it doesn't output to the browser page.
Apart from that, brilliant, thank you!
Is there any way to specify how much output appears with the cols=description option?
Skip flag, broken links
Can't get the skip flag to recognize namespaces. [OK Solved]
Also, I get broken links. Are these to pages which have been picked up from the meta data but which may no longer exist? These are essentially unfound start pages, as though the plugin assummes that every namespace must have a start and if it doesn't it reports a broken link.
— Myron Turner 2011/04/08 13:04
Missing Table-Tag at the end
I'm having a problem with the DIR plugin not inserting a </table>
tag at the end of the table. On some pages it works and on others it doesn't. This is the syntax that generates the bad HTML: ~~DIR?table&cols=page;tags;mdate&sort=page~~
It's kind of annoying because with the ending table tag, all of the page contents after the directory listing is swallowed in the last cell of the table. I have temp fix: inserting <html></table></html>
immediately after the above DIR text. — clint, 18.10.2008
Issues with 2007-06-26b
I'm trying to use this plugin with version 2007-06-26b.
When I simply insert ~~DIR~~ it properly lists pages on my test install; however, when I try to use a more advanced function (such as ~~DIR:cols=page;user;mdate~~) it tells me “There are no documents to show.” Is there some kind of compatibility issue with 2007-06-26b?
Not that I know of. In the 2008-02-25 version of the plugin I changed the syntax a little bit, the namespace specification should start with a colon and the specification of any flags should start with a question mark. So, your statement should like like this: — jg
~~DIR?cols=page;user;mdate~~
Pagename with space instead underscore
Hello, i install, and work fine.. but, i need the names of pages without underline; example, pagetitle is hello_world,
but i want show “Hello world”. its possible?
Dir ignores tags
Hi, I just can't get tags to work… It lists all the pages and completely ignores the tag parameter (~~DIR?tag=2009~~ lists all pages, not only those with 2009 tag)… any suggestions? I have installed the tag plugin after dir plugin, but tag plugin itself is working fine…I had the same problem see above. I've now managed to fix it.
Fixes/Bugs
only current namespace will be listed, no matter what I do
Hi, I am trying to use DIR here for creating a sidebar index, but no matter what I try, it always lists the namespace relative to the page from which I call DIR. I tried all possible solutions like: DIR:: DIR:.. DIR:namespace etc. Additionally it ignores the ego flag and just never displays the ego page in the listing.
Any ideas? PS: i am using URL rewriting, might this be the problem?
Level of startpages
Hi
1: Shouldn't the start-pages be listed in the same level as all other pages in the namespace? In the current implementation, the start-page of a subnamespace is on the same level as all pages of the current namespace, whats kinda confusing.
2: Could the namespace-names be shown in the tree-view or as a column? I find it confusing to have a tree full of starts, if I have many start-pages.
3: I think there is an issue about security and ACL. Pages not accessible for the current user should not be listed (especially the description can contain confidential information).
4: Whats the syntax to get a list of all pages (=root namespace) independent of current namespace? Solved, itsDIR::
5: where does desc come from? Seems to me it's the unformatted content of the page? Shouldn't it be the given revision description?
6: user and userid have valid content only if the specific page had been edited at least once (not only created)
Thanks for considering
— Benny Wegner 2008/07/14 01:23
5:
change function _tableCellContent in syntax.php to see the page title in description
modify the line 964:$this→_put ($this→_getMeta ($page, “description”, “abstract”)) ;
to: $this→_put ($this→_getMeta ($page, “title”)) ;
— Ralph Hahn 2009/01/01 09:33
Filter by tag
Hi,
Just been trying out this plugin and noticed a bug/issue. When I filter by using the tag flag it only filters correctly if I actually have tags as a displayed column. If I don't have a tags column it ignores what tags I've asked it to filter on.
So this works: -~~DIR:.:mynamespace:?cols=page;tags&hdrs=Service&tag=Service&table~~> And this doesn't work: -
~~DIR:.:mynamespace:?cols=page&hdrs=Service&tag=Service&table~~> — Anthony Yates 2009/01/13 17:36
I've now managed to fix this by changing some code in the plug-in. I found that it was only loading the tag plugin if you showed the column, it was not loading it if you just had the flag set. If you open syntax.php in the dir plugin folder and look for the function “function _initOpts”, should be on line 353. This is where it detects the flag switches. Change the code for the tag switch, starts on line 369, from this: -
case "tag": $val = split (';', trim ($val, ';')) ; break ;
To this: -
case "tag": $val = split (';', trim ($val, ';')) ; $this->_loadPlugin ("tag") ; break ;
This should then fix it. Not sure if this is the correct way, but it worked for me.
— Anthony Yates 2009/02/02 16:27
No contributor shown
Greetings. I have discovered the following bug… If a page is created with no edits yet, the user and userid columns do not return the creator (which it should since there is not a contributor array). The fix is shown in the following plugins/dir/syntax.php code snippet (needs to be added to the userid case as well)…
case "user": $users = $this->_getMeta ($page, "contributor") ; if (is_array ($users)) { $index = 0 ; foreach ($users as $userid => $user) { if ($user && $user <> '') { if ($index++ > 0) { $this->_putNewLine () ; } $this->_put ($user) ; } } } else {$this->_put ($users) ;} //<===the missing statement! break ;
(I forgot to say thanks for a great plugin! –Scott Sampson)
Respect Namespace Default Linking Rule
Doesn't respect Namespace Default Linking rule
It would be nice, if this plugin respect Namepace Default Linking Rule, i. e. doesn't insist on start
page.
—- 2009-07-31, Jorge
ACL-Bug
There is an ACL bug with this plugin. When you call Dir plugin with relative path, the page, should be able to be seen, is hidden. It comes from auth_quickaclcheck function with relative path. That function checks the path as absolute path.
I make a patch for that, but it's dirty fixing. Please anyone fix it properly.
Daichi Kitagawa 2008/11/17 2:33
Situation with the bug
For example, the pages are:
- namespaceA
- pageA
- namespaceB
- pageB
the acls are:
- * @ALL none
- namespaceA:* @ALL Read
and you write this in pageA
~~DIR~~
Although all user has permission to read pageB, ACL check function compares the acls with string 'namespaceB:pageB', and it returns 'none'. So Dir plugin doesn't list pageB.
In this situation, the plugin have to call the function with 'namespaceA:namespaceB:pageB'. In addition, the string ':namespaceA:namespaceB:pageB' is not collect too.
Diff
--- syntax.php.org 2008-06-29 03:04:55.000000000 +0900 +++ syntax.php 2008-11-17 01:20:22.000000000 +0900 @@ -640,7 +640,7 @@ return false ; //check ACL $id = pathID ($file) ; --- if (auth_quickaclcheck ($id) < AUTH_READ) +++ if (auth_quickaclcheck (substr($ns.$id,1,-1)) < AUTH_READ) return false ; $this->_addFoundPage ($data, $ns, $id, $type, $level) ; }
Ego and collapse background
I am using DokuWiki with a sidebar template (the Better Navigation Template). Until now, I created sidebars for each namespace that would show me the pages in that namespace, together with links to higher level namespaces and their siblings. This gives the effect that all namespaces but one are collapsed. Clicking on another namespace would “expand” that namespace and “collapse” the one you are leaving. Maintaining this manually was tedious. So I started looking for automated alternatives. The DIR plugin came closest to my goal: it automatically generates a list of all pages in a namespace. Its limitation for me is that it really shows all pages and namespaces. In a large wiki, that would mean a very big table of contents in the sidebar. Or I would have to start again with creating separate sidebars for separate namespaces, thus kind of defeating my original goal.
So I have implemented an additional flag called “collapse”. When this flag is set, the generated list will only show pages in the current namespace, together with sibling namespaces on all the higher level namespaces.
With this additional flag, I can create only one top-level sidebar and my whole wiki has got the perfect navigation !
The second flag -ego- was added because the philosophy of the Better Navigation Template is that the navigation should indicate in a simple way where in the wiki the user is currently browsing. For this the Better Navigation Template sets the name of the current page in the sidebar in bold. However, the default dir plugin removes the current page from the dir listing, which is contrary to the navigation idea. The ego flag remedies this: when the ego flag is set, the current page will also be listed in the dir listing. As such the Better Navigation Template can highlight it.
Q Why not use the DokuWiki index as sidebar ? This is what the Better Navigation template uses by default. This does show a collapsible and expandable list of all pages in the wiki, but it has some disadvantages for me:
- It doesn't keep track of where you are in the wiki. It will always show the same index, which you can navigate through. So it may show too much or too little information depending on where you are or where you want to go. I prefer to see the context of my current page (meaning more detail in the navigation close to the current page, and less detail further away in the navigation).
- It shows namespace names as tree structure items. But namespaces don't have titles. Especially with the philosophy of the Better Navigation template, it makes sense that the navigation uses titles as these have more meaning to the readers than simply the page names. In contrast, the DIR plugin uses the index pages of namespaces (start by default) as tree structure items. Each start page can have a title, which makes for potentially better navigation.
Usage
Although it works on all kinds of pages, the collapse flag is really designed to be used on a sidebar.
- Install a sidebar template (like Better Navigation Template))
- Download and install my modified dir plugin: http://www.kobaltwit.be/plugin_dir_GeertJanssens.tgz. Alternatively, you could use the plugin manager to install this plugin. Simply use:
http://www.kobaltwit.be/plugin_dir_GeertJanssens.tgz
- Create a sidebar page in the root namespace
- Enter this content:
====== Navigation ====== [[:start]] ~~DIR::?noheader&skip=:playground:;:wiki:&list&collapse&ego~~
And there you go !
Comments
- In addition to the collapse and ego flags, I have also added some code to hide namespaces that are not readable by the current user's ACL. In a setup where certain subnamespaces are readable for an unreadable namespace, these subnamespaces will be hidden from the navigation. It works quite well with the collapse flag, but I haven't tested this yet without this flag. It may cause unexpected behaviour.
- Some things to note about my proposed sidebar content:
- I set a title in the sidebar: this ensures that the link generated by the DIR syntax to the sidebar itself also has a nice title (Navigation), instead of having the pagename (sidebar) shown.
- With the collapse flag, this link to the sidebar is only visible on pages in the root namespace.
Any suggestions, comments, questions: — Geert Janssens 2008/11/04 10:44