samuelet / indexmenu

A dokuwiki plugin to show a customizable and sortable index for a namespace.
http://dokuwiki.org/plugin:indexmenu
GNU General Public License v2.0
44 stars 42 forks source link

Tree new - unable to browse the tree structure without page loading #300

Open macin opened 5 months ago

macin commented 5 months ago

Hi, I tried the treenew option and immediate reaction was that I am unable to browse the indexmenu tree without the page being reloaded every time I click to expand. In the previous version I was able to expand to n-th level of the namespaces and then click the name to open the page... is it gone or I am doing something wrong?

Klap-in commented 5 months ago

Do you have a picture of such a tree? The name of node become clickable if a namespace has a headpage associated (adjustable via config of plugin), might be that a difference is that the folder/page icon is now clickable as well (I do not know exactly if that was changed). The expander before the icon must only open and close, it should not load the page.

I can consider if an icon must load or not, eventually trying to make it consistent between old and new tree..

macin commented 5 months ago

Hi, definitely in old version icon did not load the page. In the new version it does nothing I think. I used a default template for a test.

Klap-in commented 5 months ago

Sure you see the new tree, and not the nojs tree? I do not yet understand the situation.

What happens if you click on:

about namespace nodes:

about page node:

Are there any errors in the Console of your browser?

macin commented 5 months ago

I have recorded the video showing how it works, one for treenew and the other without treenew. I suspect this could have something to do with the skins. As you can see, without the skin defined, it works ok. When I define a skin, then it is extremely hard to click to expand. It is only possible when I precisely hit the middle of the marker.

https://drive.google.com/drive/folders/1ByYl17pqtwHLNQjY_y6M-doE3fE6am-d?usp=drive_link Hope that helps to understand.

Klap-in commented 5 months ago

Thanks for the movies. That helps a lot.

doku2 exists only as 'theme' for the js treeold. The js treenew has that one not available as 'skin'. I should do two separate checks: if it is treeold, check if the theme-name exists as 'theme', or if it is treenew that it exists as 'skin'. Now these approaches are mixed, such that it find a hit for treeold, but most of these does not exist for treenew. Next it try to show the not existing 'doku2'-skin for treenew. But because it does not exist, you see a bare tree, that looks even a kind of decent, but works rather bad because it misses a lot of relevant css code.

At certain point you see a syntax error on a node. I guess that is a separate issue than the layouting issue. Could you open the network tab of the Developer tool, reload the page, and navigate to this point in the tree again. If that error occurs, could you check what is returned as Response by the ajax.php call? I guess it returns something that starts different than default. e.g. it starts with an error text or something like that..

macin commented 4 months ago

Hi @Klap-in , sorry for the delay. This is the response.

<!DOCTYPE html>
<html>
<head><title>TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, class Doku_Renderer_metadata does not have a method &quot;table_align&quot;</title></head>
<body style="font-family: Arial, sans-serif">
    <div style="width:60%; margin: auto; background-color: #fcc;
                border: 1px solid #faa; padding: 0.5em 1em;">
        <h1 style="font-size: 120%">TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, class Doku_Renderer_metadata does not have a method &quot;table_align&quot;</h1>
        <p>An unforeseen error has occured. This is most likely a bug somewhere. It might be a problem in the indexmenu plugin.</p>
        <p>More info has been written to the DokuWiki error log.</p>
    </div>
</body>
</html>

Here is the full log

2024-02-28 18:39:22
TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, class Doku_Renderer_metadata does not have a method "table_align"
C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\inc\parserutils.php(535)
#0 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\inc\parserutils.php(299): p_render_metadata('en:admin-guides...', Array)
#1 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\lib\plugins\indexmenu\Search.php(812): p_get_metadata('en:admin-guides...', 'indexmenu_n')
#2 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\lib\plugins\indexmenu\Search.php(608): dokuwiki\plugin\indexmenu\Search->getSortValue(Array)
#3 [internal function]: dokuwiki\plugin\indexmenu\Search->searchIndexmenuItemsNew(Array, 'C:/Users/mradla...', '//en/admin-guid...', 'f', 6, Array)
#4 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\lib\plugins\indexmenu\Search.php(656): call_user_func_array(Array, Array)
#5 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\lib\plugins\indexmenu\Search.php(681): dokuwiki\plugin\indexmenu\Search->customSearch(Array, 'C:/Users/mradla...', Array, Array, '//en/admin-guid...', 6)
#6 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\lib\plugins\indexmenu\Search.php(681): dokuwiki\plugin\indexmenu\Search->customSearch(Array, 'C:/Users/mradla...', Array, Array, '//en/admin-guid...', 5)
#7 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\lib\plugins\indexmenu\Search.php(681): dokuwiki\plugin\indexmenu\Search->customSearch(Array, 'C:/Users/mradla...', Array, Array, '//en/admin-guid...', 4)
#8 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\lib\plugins\indexmenu\Search.php(681): dokuwiki\plugin\indexmenu\Search->customSearch(Array, 'C:/Users/mradla...', Array, Array, '//en/admin-guid...', 3)
#9 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\lib\plugins\indexmenu\Search.php(681): dokuwiki\plugin\indexmenu\Search->customSearch(Array, 'C:/Users/mradla...', Array, Array, '//en/release_no...', 2)
#10 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\lib\plugins\indexmenu\Search.php(240): dokuwiki\plugin\indexmenu\Search->customSearch(Array, 'C:/Users/mradla...', Array, Array, '//wiki')
#11 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\lib\plugins\indexmenu\action.php(299): dokuwiki\plugin\indexmenu\Search->search('', Array)
#12 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\lib\plugins\indexmenu\action.php(201): action_plugin_indexmenu->getDataFancyTree()
#13 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\inc\Extension\EventHandler.php(80): action_plugin_indexmenu->ajaxCalls(Object(dokuwiki\Extension\Event), NULL)
#14 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\inc\Extension\Event.php(75): dokuwiki\Extension\EventHandler->process_event(Object(dokuwiki\Extension\Event), 'BEFORE')
#15 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\inc\Ajax.php(31): dokuwiki\Extension\Event->advise_before()
#16 C:\Users\someone\Downloads\Dokuwiki\Wiki\dokuwiki\lib\exe\ajax.php(26): dokuwiki\Ajax->__construct('indexmenu')
#17 {main}

I think this does not play well with this plugin: https://github.com/ConX/dokuwiki-plugin-prettytables/

macin commented 4 months ago

And as for

doku2 exists only as 'theme' for the js treeold. The js treenew has that one not available as 'skin'. I should do two separate checks: if it is treeold, check if the theme-name exists as 'theme', or if it is treenew that it exists as 'skin'. Now these approaches are mixed, such that it find a hit for treeold, but most of these does not exist for treenew. Next it try to show the not existing 'doku2'-skin for treenew. But because it does not exist, you see a bare tree, that looks even a kind of decent, but works rather bad because it misses a lot of relevant css code.

Should I do anything? I followed the docs to put the icons into the images folder. Not sure if there should a new folder named skins? When I check in admin panel index menu utils, I see no templates there :/

Klap-in commented 4 months ago

call_user_func_array(): Argument #1 ($callback) must be a valid callback, class Doku_Renderer_metadata does not have a method "table_align&quot

this is an issue, for which a hotfix release of DokuWiki is released. I guess you have not yet installed that hotfix release?

if you use the treenew, then theme doku2 cannot be used. It is only for the old js tree. If you created a new skin yourself for the new tree (that is not yet documented), then you need to create less files as well.

macin commented 4 months ago

Thanks @Klap-in , Yes indeed, the problem was with missing hotfix. I realized that while having other bug. As for the skin...I am then looking forward for documentation on how to create a new skin for treenew. Thanks for help! Marcin