Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix child tree expansion nodes not working on TreeNew #306

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private function makeNodes(&$data, $indexLatestParsedItem, $previousLevel, &$nod
$hasActiveNode,
[
'currentPage' => $opts['currentPage'],
'isParentLazy' => $item['type'] === 'l',
'isParentLazy' => $item['type'] === 'l' || $item['type'] === 'd',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See line 164, this throws away children for a directory, and forces always lazy loading? However, line 164 is only reachable for type=l. So I do not yet understand why this works.

Copy link
Contributor Author

@eduardomozart eduardomozart Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the following content on line 120 to troubleshoot this issue:

echo($item['id'] . " (" . $item['type'] . ") <BR />");

I accessed the URL http://wiki.example.com/doku.php?id=imc:labguide and here's the result of the AJAX 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

3cx (l)
3cx:msg (l)
3cx:phones (l)
3cx:settings (l)
ad (l)
ad:aduc (l)
ad:dns (l)
ad:fsmo (l)
ad:gpo (l)
ad:ingressar (l)
airwave (l)
airwave:amp_status (l)
airwave:ap_group_list (l)
airwave:clients (l)
airwave:devcon (l)
airwave:devices (l)
airwave:pref (l)
airwave:reports (l)
airwave:root (l)
airwave:vrf (l)
apache (l)
apache:php (l)
arubavmc (l)
arubavmc:config (l)
arubavmc:dashboard (l)
arubavmc:diag (l)
arubavmc:labguide (l)
arubavmc:maintenance (l)
central (l)
central:clients (l)
central:devices (l)
central:guests (l)
central:home (l)
central:labguide (l)
central:overview (l)
clearpass (l)
clearpass:cppm (l)
clearpass:guest (l)
clearpass:labguide (l)
conceitos (l)
conceitos:rede (l)
conceitos:seg-info (l)
conceitos:sistop (l)
db (l)
db:mysql (l)
formalms (l)
formalms:admin (l)
formalms:lms (l)
fusion (l)
fusion:advanced (l)
fusion:agent (l)
fusion:server (l)
fusion:tasks (l)
gco (l)
gco:pacientes (l)
glpi (l)
glpi:admin (l)
glpi:assets (l)
glpi:helpdesk (l)
glpi:install (l)
glpi:management (l)
glpi:setup (l)
glpi:tools (l)
hypervisor (l)
hypervisor:vmware (l)
iap (l)
iap:dashboard (l)
iap:maintenance (l)
iap:settings (l)
imc (d)
imc:alarm (l)
imc:labguide (l)
imc:report (l)
imc:resources (l)
imc:service (l)
imc:system (l)
linux (l)
linux:debian (l)
linux:rocky (l)
linux:seguranca (l)
linux:wine (l)
o365 (l)
o365:admin-centers (l)
o365:setup (l)
o365:teams (l)
o365:users (l)
pfsense (l)
pfsense:diag (l)
pfsense:fw (l)
pfsense:if (l)
pfsense:services (l)
pfsense:status (l)
pfsense:system (l)
pfsense:vpn (l)
qualitor (l)
qualitor:adm (l)
qualitor:invent (l)
qualitor:recursos (l)
refnotes (l)
refnotes:db (l)
refnotes:eset (l)
refnotes:exin (l)
refnotes:fusion (l)
refnotes:gp (l)
refnotes:gti (l)
refnotes:licensing (l)
refnotes:net (l)
refnotes:seg-info (l)
refnotes:sisop (l)
refnotes:wiki (l)
refnotes:windows (l)
refnotes:ws (l)
sw (l)
sw:alcatel (l)
sw:aos (l)
sw:aos-cx (l)
sw:cisco (l)
sw:comware (l)
sw:dell (l)
sw:mellanox (l)
syspass (l)
syspass:plugins (l)
unifi (l)
unifi:adv (l)
unifi:install (l)
unifi:manage (l)
veeam (l)
veeam:backup (l)
vtiger (l)
vtiger:settings (l)
wiki (l)
wiki:admin (l)
wiki:ebook (l)
wiki:plugin (l)
wiki:template (l)
ws (l)
ws:ad (l)
ws:dns (l)
ws:iis (l)
ws:nps (l)
ws:wsus (l)

Notice that the imc parent returns as directory (it seems to return as directory if it's set as currentpage URL parameter on AJAX call), but it's children have "l" (lazy) tag added to it, but as it's parent is a directory, the "isParentLazy" is false, consequently the "lazy" attr isn't assigned to the "imc:labguide" tree, even it containing child pages, as can be seen below:

image

The following output is originally generated:

{"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}]}

Notice that the "imc:labguide" namespace do not contain the "lazy" attr assigned to it.

With the fix of this PR, even if "imc" namespace is set as a directory, it allows it's children to be loaded as lazy, which fixes the issue, as can be seen below:

image

Here's the output with this PR applied:

{"children":[{"title":"3cx","key":"3cx:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"ad","key":"ad:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"airwave","key":"airwave:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"apache","key":"apache:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"arubavmc","key":"arubavmc:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"central","key":"central:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"clearpass","key":"clearpass:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"conceitos","key":"conceitos:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"db","key":"db:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"formalms","key":"formalms:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"fusion","key":"fusion:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"gco","key":"gco:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"glpi","key":"glpi:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"hypervisor","key":"hypervisor:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"iap","key":"iap:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"imc","key":"imc:","hns":false,"folder":true,"url":false,"expanded":true,"children":[{"title":"alarm","key":"imc:alarm:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"labguide","key":"imc:labguide:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"report","key":"imc:report:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"resources","key":"imc:resources:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"service","key":"imc:service:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"system","key":"imc:system:","hns":false,"folder":true,"url":false,"lazy":true}]},{"title":"linux","key":"linux:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"o365","key":"o365:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"pfsense","key":"pfsense:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"qualitor","key":"qualitor:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"refnotes","key":"refnotes:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"sw","key":"sw:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"syspass","key":"syspass:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"unifi","key":"unifi:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"veeam","key":"veeam:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"vtiger","key":"vtiger:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"wiki","key":"wiki:","hns":false,"folder":true,"url":false,"lazy":true},{"title":"ws","key":"ws:","hns":false,"folder":true,"url":false,"lazy":true}]}

Tip: You can use Beyond Compare, WinMerge, Meld or anyother diff tool to compare both JSON output and compare it's differences.

'nopg' => $opts['nopg']
]
);
Expand Down
Loading