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
47 stars 43 forks source link

Tree new - Child tree issues rendering when not accessing from main page (start) #301

Open eduardomozart opened 9 months ago

eduardomozart commented 9 months ago

Hello, I noticed that when accessing the Wiki from the main page (https://wiki.example.com/doku.php?id=start), the Tree is rendered as expected:

image

When I access it from any other page (https://wiki.example.com/doku.php?id=clearpass:labguide:radius:dot1x:faq), notice that the child tree navigation is missing!

image

Here's my sidebar:

** Ferramentas do Wiki **

  * [[this>doku.php?id=start|Página principal]]
  * [[this>doku.php?id=wiki:plugin:addnewpage:newpage|Criar página]]

** Barra de Navegação **

{{indexmenu>..:#1|js#awesome navbar nsort nogroup treenew}}
Klap-in commented 9 months ago

Thanks for reporting. It is a bit difficult edge case. Needs probably a bit of puzzling to solve this.

eduardomozart commented 9 months ago

Hello @Klap-in, I decided to take this afternoon to troubleshoot this issue a little bit. I believe that the culprit is the makeNodes() function from "Search.php" file, more specifically the "currentpage" argument from AJAX call that's send from the client browser originated by FancyTree. Here's the request that my browser does when I'm on the Start Page (https://wiki.example.com/doku.php?id=start): https://wiki.example.com/lib/exe/ajax.php?ns=&call=indexmenu&req=fancytree&level=1&nons=0&nopg=0&navbar=1&currentpage=imc%3Alabguide&max=0&skipns=&skipfile=&sort=t&msort=0&rsort=0&nsort=1&group=0&hsort=0&init=1&_=1709063746901

{"children":[{"title":"3CX","key":"3cx:","hns":"3cx","folder":true,"url":"\/doku.php?id=3cx","lazy":true},{"title":"Active Directory (AD)","key":"ad:","hns":"ad","folder":true,"url":"\/doku.php?id=ad","lazy":true},{"title":"Apache","key":"apache:","hns":"apache","folder":true,"url":"\/doku.php?id=apache","lazy":true},{"title":"Aruba AirWave","key":"airwave:","hns":"airwave","folder":true,"url":"\/doku.php?id=airwave","lazy":true},{"title":"Aruba Central","key":"central:","hns":"central","folder":true,"url":"\/doku.php?id=central","lazy":true},{"title":"Aruba ClearPass","key":"clearpass:","hns":"clearpass","folder":true,"url":"\/doku.php?id=clearpass","lazy":true},{"title":"Aruba Instant AP","key":"iap:","hns":"iap","folder":true,"url":"\/doku.php?id=iap","lazy":true},{"title":"Aruba Mobility","key":"arubavmc:","hns":"arubavmc","folder":true,"url":"\/doku.php?id=arubavmc","lazy":true},{"title":"Banco de Dados","key":"db:","hns":"db","folder":true,"url":"\/doku.php?id=db","lazy":true},{"title":"Conceitos","key":"conceitos:","hns":"conceitos","folder":true,"url":"\/doku.php?id=conceitos","lazy":true},{"title":"cPanel","key":"cpanel","hns":false,"url":"\/doku.php?id=cpanel"},{"title":"CUPS","key":"cups:","hns":"cups","folder":true,"url":"\/doku.php?id=cups","lazy":true},{"title":"DokuWiki","key":"wiki:","hns":"wiki","folder":true,"url":"\/doku.php?id=wiki","lazy":true},{"title":"EVE-NG","key":"eve","hns":false,"url":"\/doku.php?id=eve"},{"title":"FOG Project","key":"fog:","hns":"fog","folder":true,"url":"\/doku.php?id=fog","lazy":true},{"title":"Forma LMS","key":"formalms:","hns":"formalms","folder":true,"url":"\/doku.php?id=formalms","lazy":true},{"title":"GCO","key":"gco:","hns":"gco","folder":true,"url":"\/doku.php?id=gco","lazy":true},{"title":"GLPI","key":"glpi:","hns":"glpi","folder":true,"url":"\/doku.php?id=glpi","lazy":true},{"title":"GLPI Agent","key":"fusion:","hns":"fusion","folder":true,"url":"\/doku.php?id=fusion","lazy":true},{"title":"Guacamole","key":"guacamole","hns":false,"url":"\/doku.php?id=guacamole"},{"title":"Hypervisor","key":"hypervisor:","hns":"hypervisor","folder":true,"url":"\/doku.php?id=hypervisor","lazy":true},{"title":"IMC","key":"imc:","hns":"imc","folder":true,"url":"\/doku.php?id=imc","lazy":true},{"title":"Microsoft 365","key":"o365:","hns":"o365","folder":true,"url":"\/doku.php?id=o365","lazy":true},{"title":"pfSense","key":"pfsense:","hns":"pfsense","folder":true,"url":"\/doku.php?id=pfsense","lazy":true},{"title":"Pure Storage","key":"pure","hns":false,"url":"\/doku.php?id=pure"},{"title":"Qualitor","key":"qualitor:","hns":"qualitor","folder":true,"url":"\/doku.php?id=qualitor","lazy":true},{"title":"References","key":"refnotes:","hns":"refnotes","folder":true,"url":"\/doku.php?id=refnotes","lazy":true},{"title":"Remote Desktop Manager (RDM)","key":"rdm:","hns":"rdm","folder":true,"url":"\/doku.php?id=rdm","lazy":true},{"title":"Switches","key":"sw:","hns":"sw","folder":true,"url":"\/doku.php?id=sw","lazy":true},{"title":"sysPass","key":"syspass:","hns":"syspass","folder":true,"url":"\/doku.php?id=syspass","lazy":true},{"title":"UniFi","key":"unifi:","hns":"unifi","folder":true,"url":"\/doku.php?id=unifi","lazy":true},{"title":"UNIX","key":"linux:","hns":"linux","folder":true,"url":"\/doku.php?id=linux","lazy":true},{"title":"Veeam","key":"veeam:","hns":"veeam","folder":true,"url":"\/doku.php?id=veeam","lazy":true},{"title":"Vtiger CRM","key":"vtiger:","hns":"vtiger","folder":true,"url":"\/doku.php?id=vtiger","lazy":true},{"title":"Windows Server","key":"ws:","hns":"ws","folder":true,"url":"\/doku.php?id=ws","lazy":true}]}

I can expand all the subnodes as expected. image When I expand the "imc" tree and click on "labguide" node (https://wiki.example.com/doku.php?id=imc:labguide), it doesn't load the child nodes. Here's the browser request: https://wiki.example.com/lib/exe/ajax.php?ns=&call=indexmenu&req=fancytree&level=1&nons=0&nopg=0&navbar=1&currentpage=imc%3Alabguide&max=0&skipns=&skipfile=&sort=t&msort=0&rsort=0&nsort=1&group=0&hsort=0&init=1&_=1709063746901

{"children":[{"title":"3CX","key":"3cx:","hns":"3cx","folder":true,"url":"\/doku.php?id=3cx","lazy":true},{"title":"Active Directory (AD)","key":"ad:","hns":"ad","folder":true,"url":"\/doku.php?id=ad","lazy":true},{"title":"Apache","key":"apache:","hns":"apache","folder":true,"url":"\/doku.php?id=apache","lazy":true},{"title":"Aruba AirWave","key":"airwave:","hns":"airwave","folder":true,"url":"\/doku.php?id=airwave","lazy":true},{"title":"Aruba Central","key":"central:","hns":"central","folder":true,"url":"\/doku.php?id=central","lazy":true},{"title":"Aruba ClearPass","key":"clearpass:","hns":"clearpass","folder":true,"url":"\/doku.php?id=clearpass","lazy":true},{"title":"Aruba Instant AP","key":"iap:","hns":"iap","folder":true,"url":"\/doku.php?id=iap","lazy":true},{"title":"Aruba Mobility","key":"arubavmc:","hns":"arubavmc","folder":true,"url":"\/doku.php?id=arubavmc","lazy":true},{"title":"Banco de Dados","key":"db:","hns":"db","folder":true,"url":"\/doku.php?id=db","lazy":true},{"title":"Conceitos","key":"conceitos:","hns":"conceitos","folder":true,"url":"\/doku.php?id=conceitos","lazy":true},{"title":"cPanel","key":"cpanel","hns":false,"url":"\/doku.php?id=cpanel"},{"title":"CUPS","key":"cups:","hns":"cups","folder":true,"url":"\/doku.php?id=cups","lazy":true},{"title":"DokuWiki","key":"wiki:","hns":"wiki","folder":true,"url":"\/doku.php?id=wiki","lazy":true},{"title":"EVE-NG","key":"eve","hns":false,"url":"\/doku.php?id=eve"},{"title":"FOG Project","key":"fog:","hns":"fog","folder":true,"url":"\/doku.php?id=fog","lazy":true},{"title":"Forma LMS","key":"formalms:","hns":"formalms","folder":true,"url":"\/doku.php?id=formalms","lazy":true},{"title":"GCO","key":"gco:","hns":"gco","folder":true,"url":"\/doku.php?id=gco","lazy":true},{"title":"GLPI","key":"glpi:","hns":"glpi","folder":true,"url":"\/doku.php?id=glpi","lazy":true},{"title":"GLPI Agent","key":"fusion:","hns":"fusion","folder":true,"url":"\/doku.php?id=fusion","lazy":true},{"title":"Guacamole","key":"guacamole","hns":false,"url":"\/doku.php?id=guacamole"},{"title":"Hypervisor","key":"hypervisor:","hns":"hypervisor","folder":true,"url":"\/doku.php?id=hypervisor","lazy":true},{"title":"IMC","key":"imc:","hns":"imc","folder":true,"url":"\/doku.php?id=imc","expanded":true,"children":[{"title":"1. Home","key":"imc:home","hns":false,"url":"\/doku.php?id=imc:home"},{"title":"2. Resource","key":"imc:resources:","hns":"imc:resources","folder":true,"url":"\/doku.php?id=imc:resources","children":[]},{"title":"4. Service","key":"imc:service:","hns":"imc:service","folder":true,"url":"\/doku.php?id=imc:service","children":[]},{"title":"5. Alarm","key":"imc:alarm:","hns":"imc:alarm","folder":true,"url":"\/doku.php?id=imc:alarm","children":[]},{"title":"6. Report","key":"imc:report:","hns":"imc:report","folder":true,"url":"\/doku.php?id=imc:report","children":[]},{"title":"7. System","key":"imc:system:","hns":"imc:system","folder":true,"url":"\/doku.php?id=imc:system","children":[]},{"title":"Lab Guide","key":"imc:labguide:","hns":"imc:labguide","folder":true,"url":"\/doku.php?id=imc:labguide","children":[],"active":true},{"title":"Solu\u00e7\u00e3o de problemas (FAQ)","key":"imc:faq","hns":false,"url":"\/doku.php?id=imc:faq"}]},{"title":"Microsoft 365","key":"o365:","hns":"o365","folder":true,"url":"\/doku.php?id=o365","lazy":true},{"title":"pfSense","key":"pfsense:","hns":"pfsense","folder":true,"url":"\/doku.php?id=pfsense","lazy":true},{"title":"Pure Storage","key":"pure","hns":false,"url":"\/doku.php?id=pure"},{"title":"Qualitor","key":"qualitor:","hns":"qualitor","folder":true,"url":"\/doku.php?id=qualitor","lazy":true},{"title":"References","key":"refnotes:","hns":"refnotes","folder":true,"url":"\/doku.php?id=refnotes","lazy":true},{"title":"Remote Desktop Manager (RDM)","key":"rdm:","hns":"rdm","folder":true,"url":"\/doku.php?id=rdm","lazy":true},{"title":"Switches","key":"sw:","hns":"sw","folder":true,"url":"\/doku.php?id=sw","lazy":true},{"title":"sysPass","key":"syspass:","hns":"syspass","folder":true,"url":"\/doku.php?id=syspass","lazy":true},{"title":"UniFi","key":"unifi:","hns":"unifi","folder":true,"url":"\/doku.php?id=unifi","lazy":true},{"title":"UNIX","key":"linux:","hns":"linux","folder":true,"url":"\/doku.php?id=linux","lazy":true},{"title":"Veeam","key":"veeam:","hns":"veeam","folder":true,"url":"\/doku.php?id=veeam","lazy":true},{"title":"Vtiger CRM","key":"vtiger:","hns":"vtiger","folder":true,"url":"\/doku.php?id=vtiger","lazy":true},{"title":"Windows Server","key":"ws:","hns":"ws","folder":true,"url":"\/doku.php?id=ws","lazy":true}]}

image It seems that the "lazy" attribute is missing from "imc:labguide" item and another subfolders of "imc" namespace, but pages from another namespaces (e.g. "apache") expands as expected.

eduardomozart commented 9 months ago

Hello @Klap-in, I believe I was able to dig in the issue. When the currentpage parameter of AJAX request is set to "imc:labguide" (or any other namespace instead of null), the "imc:labguide" is tagged as "d" type (it tags as "l" otherwise), so I changed the function to handle this. If the parent is "d" but the children node is "l" (lazy), it adds the "lazy" tag to it so it's rendered as expected on Wiki sidebar, as can be seen below. image