dokufreaks / plugin-pagelist

Lists DokuWiki pages in a nice looking table or unordered list.
http://dokuwiki.org/plugin:pagelist
GNU General Public License v2.0
30 stars 22 forks source link

allow sorting, the flag sortby=<columnname> sets which column is used for sorting #153

Closed Klap-in closed 1 year ago

Klap-in commented 1 year ago

Replaces #152

Sorting of non-existing pages might be annoying, these have a key that might sort higher than a lot of other keys. Now chosen to use a high number such that these are at least grouped.

zeerd commented 1 year ago

I got an error :

PHP Fatal error: Uncaught Error: Class 'dokuwiki\Utf8\Sort' not found in /xxx/doku/lib/plugins/pagelist/helper.php:630

Seems there is a new class in some new version of dokuwiki? I am using "Hogfather".

zeerd commented 1 year ago

I updated my doku to "Jack Jackrum" and tested sort by date. It works.

But seems:

  1. The arsort in finishList() should be replaced by krsort for reverses works. like:
    public function finishList()
    {
        if ($this->sort) {
            Sort::ksort($this->pages);
            if ($this->rsort) {
                krsort($this->pages);
            }
        }
  2. When I am using the authorstats plugin. it will list all the "orphaned and wanted pages" . Which will not by using the master branch of pagelist. So , I think the page_exists check is necessary. like:
    public function addPage($page)
    {
        $id = $page['id'];
        if (!$id) return false;
        if (!page_exists($id)) { return false; }
Klap-in commented 1 year ago

Point 3 locks out listing of nonexisting pages in other usages of the pagelist plugin. I did not yet look into the authorstats plugin, do you have an example of the syntax I can test?

zeerd commented 1 year ago

I have no special example for this. Just using this authorstats plugin. Seems , this plugin will collect pages created/edited by each user. And nonexisting pages are in the range of created-pages.

Klap-in commented 1 year ago

point 1. Good spotted. The krsort I did not test yet, is now fixed including support of different languages.

point 3. With <AUTHORSTATS> and the config setting plugin»authorstats»enable-pagelist, I got the pagelist. The flags used are from the general pagelist flags.

Pagelist has no filtering of non-exising pages. I will not implement default filtering in pagelist. The current approach is that the source of the pages does the filtering. In this case it means that the authorstats should do the filtering. Also I do not understand why you would remove deleted pages from these list. I guess that with such filtering the list shown if you click on one of the Deletes fields in the authorstats table will be almost empty?

Alternatively, an extra flag could be introduced for the pagelist plugin for filtering (I have not the intention to do so). However, I wonder if it is really useful?

Klap-in commented 1 year ago

@zeerd thanks for your first proposal and input!

zeerd commented 1 year ago

You are welcome! The point of deleted pages is right. I had ignored it.