Giter Site home page Giter Site logo

xif-fr / dokuwiki-plugin-catlist Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 14.0 125 KB

DokuWiki plugin to list pages and namespaces recursively in nested lists

Home Page: https://www.dokuwiki.org/plugin:catlist

PHP 91.92% JavaScript 6.64% CSS 1.44%
dokuwiki-plugin dokuwiki

dokuwiki-plugin-catlist's Introduction

catlist DokuWiki plugin.

Static tree-like page listing plugin for DokuWiki.

For detailed description and documentation, see the plugin page.

Contribution

Do what you want. Any help to add features or refactor the code is welcome. The only requirement is backwards compatibility and some consistence.

The plugin is not actively developped, but still somewhat maintained. Some features may be added if it is not too much work. As I'm not a user of DokuWiki anymore, I'm looking for a new maintainer for this plugin. Please step in if you're interested.

Security

The plugin directly scans the file system for pages, and does not use the tree-walking DokuWiki primitive. DokuWiki permissions should be respected, but there is no absolute guarantee, as there may be unexplored corner cases. Use with care.

dokuwiki-plugin-catlist's People

Contributors

bellingeri avatar dregad avatar fabienli avatar fosseway avatar fwolfst avatar kevans91 avatar klap-in avatar shioyadan avatar xif-fr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dokuwiki-plugin-catlist's Issues

Respect useheading setting

When the setting "useheading" (in the Dokuwiki settings, Display section) is set to "Never", the text for links to pages default to the page name, rather than the first heading of that page. However, page links that are part of a catlist listing do not behave in this way.

I suggest catlist should at least obey the "useheading" setting by default. It might be useful to also add plugin-level settings to control this behavior. As it currently stands, there appears to be no way to make catlist show page names.

Feature: Allow namespace definition to be the "context" namespace

When included in the sidebar, the relative namespace will always refer to the position of the sidebar.

:root
  |- sidebar
  |- page_in_root
  |-| :subnamespace
    |- page_in_sub
    |- ...
#sidebar
~~NOCACHE~~
<catlist .>

In the example structure given above (with root and subnamespace being namespaces), the sidebar will look the same when viewing page_in_root and page_in_sub.

It would be great if it would only render the "stuff" in subnamespace if rendered within.

IndexMenu solves this with a "context" option (search for "context" here: https://www.dokuwiki.org/plugin:indexmenu https://github.com/samuelet/indexmenu , code most likely here: https://github.com/samuelet/indexmenu/blob/ac677d3079574e0ff70fd16eabbc8126338f3524/syntax/indexmenu.php#L92).

An alternate implementation strategy might be to use another symbol to refer to the context, so instead of . and .. use something like *:..: .

If its an ultra-low-hanging fruit I might look into crafting an PR if somebody guides me, but my php-fu is really weak.

Accordion

Hey,

to add an Accordion you have to,

  1. add an ID in line 457 to <ul id="accordion" class="catlist-nslist">
  2. add jquery to the head in the of main.php of your template (I use basic template)
  3. and <script type="text/javascript"> $(document).ready(function(){ $(".catlist-nshead").click(function(){ // trigger $(this).next("ul#accordx").slideToggle("fast"); // blendet beim Klick auf "dt" die nächste "dd" ein. $(this).children("a").toggleClass("closed open"); // wechselt beim Klick auf "dt" die Klasse des enthaltenen a-Tags von "closed" zu "open". }); }); </script> too.
    I try to add this to script.js file, but it doesn't work.
  4. add ul#accordion { display:none; } to your custom.css

I'm not an professional, but it work for me fine.


Did you can add this feature to the new update?

Kind Regards #

Not displaying restricted namespace items

Distantly related to #1

Hi, I run a wiki with a private namespace where registered users have read-only rights and non-registered users have no rights. ACL is as follows:

*	@ALL	1		# Everyone can read everything by default.
private:*	@ALL	0	# No one can read from the private namespace...
private:*	@user	1	# Except registered users.

On the main wiki page, I would like non-registered users to still be able to see the list of items in the private namespace - just not be able to access them. The plugin»catlist»hide_acl_nsnotr global option is unchecked. The main wiki page (at the root, accessible by non-registered visitors) includes the following syntax:

<catlist private: -noHead -forceHeadTitle -columns:3 -sortAscending -sortByTitle -noAddPageButton>

EXPECTED BEHAVIOR:

The syntax above should display the contents of the private namespace, even to non-registered visitors.

OBSERVED BEHAVIOR:

The contents of the private namespace are hidden from visitors, and shown to registered users. I believe I have occasionally been able to see the list as a non-registered visitor after logging in and out, changing browsers, etc. but this was inconsistent and I can no longer reproduce it.

Thank you for your help. Happy to give you user access to the wiki if you'd like to see for yourself.

NoCache causes list to overwrite itself

Noticed that when we added a new namespace, it was not showing up right away. Saw this is caused by the cache, and to use NoCache option. When I either turn on NoCache or use the NOCACHE options, the tree of namespaces and pages will have the second column of 2, 3, or 4 columns have print over displaying on itself. Seems to be just the top portion of the column. Hitting CTRL F5 2 or 3 times seems to clear it up, until you add another namespace and page.

ACL gestion

Hi,

It could be great if an user didn't see pages he can't have access to.

Nevertheless, thank you for that great extension !

Best regards,

Etienne.

dynamic namespace computation

Hello,

I would like to use catlist plugin in the sidebar, where it would display the list of pages in the current namespace (the namespace relevant to the main page currently displayed).
I can provide a first PR with a simple implementation (that works at least for my need).
Are there others interested by such option? was this already planned for a future release?

Add page button not working for namespaces

Hi, current version of catlist does not support namespaces anymore.
Before, you could add either a normal page (like 'newpage') or a namespace (like 'newns:').

If you try to add 'newns:' now, it will just add a new page and not a new namespace.

sortByTitle problems with headlines starting with a digit [0-9]

#30

Hi

if u have for example 4 pages with the following titles (the first <h1>)

1st page title: 1. some text
2nd page title: 2. some text
3rd page title: 11. some text
4th page title: 4. some text

the result after sorting is

  • 1. some text
  • 11. some text
  • 2.
  • 4.

replacing
$b = strcmp($a_title, $b_title);
with
$b = strnatcasecmp($a_title, $b_title);
in syntax.php Line 344
will do it but not tested for any side effects

br

Non-ASCII character cannot used in page name.

When a page with a name which contains non-ascii characters is tried to add using this plugin, those characters will be converted to _ and we cannot make a page with the desired name.
Screenshot from 2019-07-13 10-22-59
Screenshot from 2019-07-13 10-23-31

Merging PR #10 can solve this problem.
Screenshot from 2019-07-13 10-24-08

Sort by date (ask feature)

Hello,
I use catlist on all my wiki and it is really good.

It would be nice, in some cases, to be able to sort the pages by creation date (-sortByCreationDateAscending and -sortByCreationDateDescending) or last modification date (-sortByModificationDateAscending and sortByModificationDateDescending)

My suggestion are probably too long name for variable, but it is the idea !

trouble excluding pages

Hi,
I'm trying to use this plugin to show some pages of a namespace. Assume we have pagenames starting with "v" others starting with "b" and some starting with "r". I wanted to show the ones starting with 'v' so I used the following syntax:

<catlist -sortDescending -noHead -noAddPageButton -excludeOnName -exclupage:"!^v" -columns:2>

this gives me a result with all pages in this namespace, not what i expected.

When I remove the "!" like this:

<catlist -sortDescending -noHead -noAddPageButton -excludeOnName -exclupage:"^v" -columns:2>

I get a list of all pages except the excluded starting with "v" as I expect.

So what am I doing wrong here ? Did I missunderstand the Syntax ?

Any help is welcome...

Head is show without acl respect

Hi,

I have many namespace and users with restricted ACL.
If "hide_acl_nsnotr" is enable, user with no acces have the head of restricted namespace.

For me, it is not good, for confidential raison.

Administration page become unavailable

Hello,
When plugin Catlist is added on the wiki, administration page (start?do=admin&page=config) become unavailable. If Catlist is deactivated, it is the same thing. The only way to retrieve the page is to uninstall the plugin.

I have the bug on my old wiki after an update, so I try on a fresh install, I this bug appear when I install catlist, and disappears when I uninstall it.

add page function

clicked the add page button.
it created a page called currentnamespace:name_I_chose
is that what was supposed to happen. to be clear I wan in ht notes: namespace and did not get notes:page_I_wanted. maybe I did something wrong?

Error 500 or empty article

Hello,
I have a bug on my wiki and maybe it is with catlist. But maybe not...

I use catlist to generate menus automatically. Some users have problems viewing these pages. They get an error 500 per moment, at other times the wiki is displayed but the article appears empty. The same behavior exists with different machines and browsers:

  • Windows 10 64-bit with Chrome 63 or Edge
  • Ubuntu 17 with Iceweasel
  • Archlinux with Links2

But a lot of other users haven't trouble...

In my Apache errors, I have the following mention:
PHP Fatal error: Class' SafeFn' not found in /var/www/dokuwiki/lib/plugins/catlist/syntax. php on line 238, referer: https://khaganat.net/um1/fr:tag:geographie:start

https://khaganat.net/um1/fr:tag:geographie:start being one of the pages that raises concerns.

Catlist and Dokuwiki are up to date. However, we are on a Debian Jessie server, so with PHP in version 5. In addition, this wiki has a lot of plugins, an obsolete theme, and includes a navigation bar (top) which I also regularly worry about: all these faults could also explain the display error.

The only Apache error mention catlist (for this part of the site), which is why I'm posting here, but I'll also try to solve the other problems.

Thanks a lot for your help and your good plugin :)

Example for -excludeOnTitle ?

HI,

thank you for your work on this usefull plugin.

I have a problem understanding the -excludeOnTitle option. Where do I specify what titles are to be excluded ?

I tried this to exclude pages in ns1:ns2 with first title starting with "Z_"

====== Test catlist plugin ======

<catlist ns1:ns2  -maxDepth:1 -sortAscending -sortByTitle -excludeOnTitle -exclupage:"^Z_.*">

but it does not work.
I think the example excludes pagenames starting wit "Z_*" but no glue how to specify to exclude based on the first title.

Any help will be welcome.

Problem with listing

catlist doesn't list pages in namespace.

Example:
Index - outside, inside
Let's say user has read permission on index pages for ns1 and ns2, and delete permission on namespace ns1:* and ns2:*
Wiki start page lists all available namespaces <catlist -noAddPageButton -noHead -maxDepth:2>

Output:
ns1
ns2

ns1 and ns2 links to their respective outside index
Index should list all pages and subnamespaces in ns <catlist ns1: -addPageButtonEach -noHead >, but for this user index is empty. It is possible to create new pages by using "Add a page..." button, but neither new or already existing pages are listed.
When viewing with admin user (has delete permission on *) all lists are fine.

The namespace does not exist

After adding to any page, I get the error "The namespace does not exist"

I checked to make sure it's not ACL problem: I suspect it's not the case as it's the admin user that gets this error.

plugin.info.txt date information mismatch

Hi,
after update of dokuwiki and the plugins i used, i recognized that dokuwiki told me that there is an new catlist version from 2022-08-07 is available.
When i look in plugin.info.txt the date is on 2022-08-06

kind regards
Gerald

Issue with Friendly URLs

I love the plugin, however, I found an issue when using with Friendly URLs. When adding a new page from the listing the URL will be incorrect creating an unintended URL (https://mydomain.com/doku.php/podcast/ddop/s/test&do=edit). I am then presented with the "This topic does not exist yet" view then I have to click edit. When I do that page name becomes test_do_edit. I believe a test should be done to see if the setting userewrite is set to "DocuWiki Internal" then append a ? instead of an &.

Expand / Contract

Hi,
as a feature request, would it be possible to have an expand / contract as an option on folders
similar to the way the indexmenu plugin works?

Include only pages matching regex?

The various -exclude options are very useful, but is there a way to do the opposite, i.e. include only pages matching a regex?

For instance, if I have a namespace :cities which contains :cities:london:start, :cities:paris:start, :cities:berlin:start and also :cities:paris:museums, how would I show only the page :cities:paris:museum in my catlist results?

I'm hoping for something like: <catlist :cities -includePage:"^museum$" but at the moment I find myself doing things like <catlist :cities -noHead -exclupage:"(?=^((?!museum).)+$)">.

Am I missing something, or is this a feature worth adding?

Sorting by title behaves conservatively when Umlauts are present

When sorting by title, the sort order ("natural") does not behave as expected in other locales, e.g. German Umlauts (Ä) are expected to be near their relevant neighbour (A), but appear at the end of the list

The relevant code is at:

if ($data['sort_order'] != CATLIST_SORT_NONE) {

I do not know PHP enough to understand which sorting function to use, maybe following thread helps:
https://stackoverflow.com/questions/9654907/php-array-sorting-with-accents

CSS to make catlist look good on mobile?

Hello there and thanks for the very useful plugin!

Apparently, on mobile devices the lists appear like if they were very much zoomed, which for multi-column looks very weird and hard to read.. Does anyone know of a right CSS "patch" that would make it look OK on mobile browsers? Maybe making the columns independant floats: or something like this?

Thanks!

Current namespace and the new page button

Hi,
first, great plugin, use it a lot and we even removed all sidebar pages for your plugin. Since we need only the one on the root.

<catlist %%CURRENT_NAMESPACE%% -smallHead -sortAscending -sortByTitle>

these are the current options we use. The only thing not working is the "add a page..." button.
Because we use the %%CURRENT_NAMESPACE%% option, the button tries to add a page to the %%CURRENT_NAMESPACE%% namespace. And of course this namespace doesn't exist.

add page button not work with chinese file name

the add page button work fine with english file name. but if you use chinese file name, the file name will lost in the new page url.

test/test ==> test/test?do=edit
test/测试 ==> test/?do=edit

my conf:
useslash=1
fnencode=utf-8
userewrite=1

Play nice with multiORPHANS

The multiORPHANS plugin finds orphaned pages, but doesn't recognize catlist links.
It provides a hook so you can provide it with the semantic for catlist.

What is the proper syntax for -excludeOnName

I am trying to use -excludeOnName to exclude my templates. However, I can't get it to work. The closest I can get is -excludeOnName template but that will throw the following error:

 The namespace podcast:ddop:notes: template does not exist

What am I doing wrong or is it a bug?

PHP error "Only variables should be passed by reference"

There's a line in syntax.php calling end() on the result of explode() - not allowed in modern PHP (I think since 5.3?)

if (is_null($main['title'])) $main['title'] = end(explode(':', $ns));

Needs to assign explode() to a variable first, like

if (is_null($main['title'])) {$nsparts = explode(':', $ns);$main['title'] = end($nsparts);}

suggestion. -include option

An -includeoption would be fine.

E. g. template:sprintdoc works like a charm with catlist for a dynamic Menu in the sidebar

As you can see at "https://demo.sprintdoc.de/sidebar" they have a menu structure which doesn't follow a given namespace:

===== Dokumentationspatterns @book-open-page-variant.svg =====

  * [[pattern:start|Dokumentationsmuster]]
  * [[usecase:start|Dokumentationsvorgänge]]
  * [[patterns:help:anleitung|Dokumentation Patternanpassung]]

T use catlist for such a case an option -include:":patterns:help:anleitung" would solve this.

Your catlist also works like a charm with template:bootstrap3.
The indexmenu plugin doesn't, it breaks <datatable> and others. So catlist is a good replacement for indexmenu in template:bootstrap.

thank you for this plugin!

regards,
thomas

Catlist update

Hi,
Thanks for the plugin, super useful, but what triggers it to update, though? When I create a page, it doesn't update the list right away, I've done a couple of tests and it looks like it's only updating when I delete a page. Would it be possible for it to update everytime a new page is created?
thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.