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

Changes to indexmenu are not responding.properly #296

Closed rgleason closed 4 months ago

rgleason commented 8 months ago

Changes to the title of a page do not change in the sidebar indexmenu. Removal of a page, does not remove the instance in the sidebar indexmenu. find that our index menu is no longer working properly, and it has performed flawlessly for years. No indexmenu is unresponsive when I remove a page, or change the title. What has happened here? https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:supplementary_software:signalk:sk-windows

https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:supplementary_software:signalk:a1

Klap-in commented 8 months ago

Thanks for sharing your experiences. I tried to find the syntax on your site, could you share here the syntax(es) you are using?

I will try to have a look on your site this evening, to see if I can understand better what is the issue.

Btw, previous versions are available on https://github.com/samuelet/indexmenu/releases

rgleason commented 8 months ago

I have defined a TOC page for Supplementary Software using: Thank you Klap-in.

{{indexmenu_n>100}}
====== TOC ======
For Export of the Offline Manual.
==== Supplementary Software Table of Contents ====
[[:opencpn:supplementary_software]]
{{indexmenu>:opencpn:supplementary_software#5|msort nsort nojs}}

Which appears to work the way I expect it to.

Screenshot (2007)

Here is what I have on the IndexMenu sidebar

Screenshot (2006)

These are the changes to the indexmenu sidebar that are not showing up.

Screenshot (2005)

Here are the setting that I found.

Screenshot (2003)

Screenshot (2004)

Has some setting been changed with the upgrade?

Klap-in commented 8 months ago

I did some big refactoring to improve the maintainability of this plugin. It might that I affect something pieces... Recently, I changed the nsort setting, but due to feedback I revert that behaviour, but added the nogroup setting instead. But that is also not your problem here.

I do not yet understand why titles are affected, so I need to look a bit further.

Thanks for the detailed description including settings.

The syntax you shared is a nojs example, while the screenshots shown are a js example? Right?

Klap-in commented 8 months ago

If you re-save the Configuration Manager (just press Save there) (this expires all caches), do you get them the recent titles? It might be something with the caching...

Klap-in commented 8 months ago

Sorry, I did not manage to dive into this due to other work this evening. It feels a bit as caching issue, but not yet clear where I have to search it. To be continued.

rgleason commented 8 months ago

@Klap-in Good morning. That was a brilliant suggestion to "Save" Configuration. Why didn't I try that? It appears to be working now! Thank you! I am closing this, and if I notice anything else, since I am getting back to editing this Manual wiki for OpenCPN, I will post an issue. We love indexmenu, it has been our answer for navigation in the wiki all these years. We really appreciate your care of it. Screenshot (2008)

rgleason commented 8 months ago

PS: I notice there is an upgrade to 2024-02-06 "Kaos" Should we go ahead with it, considering the indexmenu issue we had?

Klap-in commented 8 months ago

From #297:

See closed #296 Resolution of the this issue was to save the configuration, which updates the sidebar index menu. Now, every time I edit a title in a page, I have to go to configuration > Save.

It used to be more seamless, with the sidebar updating when changes are made. Can this be fixed I hope?

LATER: Also see https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:edit_user_manual:indexmenu_plugin#navigation_and_table_of_contents

for info on how indexmenu is set up.

I tested with

{{indexmenu>:test#1|js#drktheme navbar msort nsort}}

I enabled the useheading: navigation. I changed the aclcache also to 'None'. If I remove a page or change a title, it is directly applied. (also trying the default 'Groups' for the aclcache I got the same results).

So I'm not able yet to reproduce your situation. Could you check if you have any error messages? in the dokuwiki error log (php error log) or in the Console of your browser? Maybe you can just reinstall (see Extension Manager) it again to be sure no old stuff is in our way?

hupb commented 8 months ago

Don't know if it's helpful, but after removing the word hasindexmenu in action.php/line 95 p_get_metadata($ID, 'indexmenu hasindexmenu') I get the usual behavior ...

Klap-in commented 7 months ago

Hmm, interesting. @hupb I renamed that metadata variable. Might be that the expiring of the caches is not triggered. Could you just resave your Configuration Manager? (that expires all caches)

You use also {{indexmenu>:test#1|js#drktheme navbar msort nsort}} ?

If it still does not work, could you add temporary the line:

var_dump($ID, p_get_metadata($ID, 'indexmenu hasindexmenu'));

just above the line you proposed to remove? On most pages with an indexmenu you should see true, otherwise null will appear. (true is not show for pages with navbar and the nojs tree.)

rgleason commented 7 months ago

@Klap-in I went ahead and upgraded to 2024-02-06 "Kaos" all went well. Should I now try

{{indexmenu>:test#1|js#drktheme navbar msort nsort}}

I enabled the useheading: navigation. I changed the aclcache also to 'None'. If I remove a page or change a title, it is directly applied. (also trying the default 'Groups' for the aclcache I got the same results).

So I'm not able yet to reproduce your situation. Could you check if you have any error messages? in the dokuwiki error log (php error log) or in the Console of your browser?
Maybe you can just reinstall (see Extension Manager) it again to be sure no old stuff is in our way?

I will try to get the error.log too.

Lots of errors here. I don't have any idea where to start... error_log.txt

I do have ftp access to the server.

Klap-in commented 7 months ago

Should I now try

{{indexmenu>:test#1|js#drktheme navbar msort nsort}}

This example of syntax was of your wiki, but with just different namespace, which existed on my own wiki. It was description how I have tested it.

If your situation differs please tell. What is your useheading setting (I do not expect it makes a difference).

Might what @hupb mentioned gives us a first clue.

rgleason commented 7 months ago
plugin»indexmenu»defaultoptions
List of indexmenu options separated by spaces. These options will be applied by default to every indexmenu and can be undone with a reverse command in the plugin syntax

(Blank Nothing entered)

plugin»indexmenu»page_index
The page that will replace the main dokuwiki index. Create it and insert the indexmenu syntax. Use id#random if you already have an indexmenu sidebar with navbar option.
 My suggestion is {{indexmenu>..|js navbar nocookie id#random}}.

:opencpn:sidebar

Should I be trying to get rid of these errors in error.log?

[15-Jan-2024 10:11:28 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/szlhykiz/public_html/wiki/dokuwiki/inc/fulltext.php on line 588

[15-Jan-2024 12:44:18 UTC] PHP Warning: preg_quote() expects parameter 1 to be string, array given in /home/szlhykiz/public_html/wiki/dokuwiki/inc/common.php on line 1580

[25-Jan-2024 04:35:34 UTC] PHP Warning: imagecreatefromstring(): gd-png: fatal libpng error: Read Error: truncated data in /home/szlhykiz/public_html/wiki/dokuwiki/lib/plugins/dw2pdf/vendor/mpdf/mpdf/src/Image/ImageProcessor.php on line 581

[25-Jan-2024 04:35:34 UTC] PHP Warning: imagecreatefromstring(): gd-png error: setjmp returns error condition 3 in /home/szlhykiz/public_html/wiki/dokuwiki/lib/plugins/dw2pdf/vendor/mpdf/mpdf/src/Image/ImageProcessor.php on line 581

[25-Jan-2024 04:35:34 UTC] PHP Warning: imagecreatefromstring(): Passed data is not in 'PNG' format in /home/szlhykiz/public_html/wiki/dokuwiki/lib/plugins/dw2pdf/vendor/mpdf/mpdf/src/Image/ImageProcessor.php on line 581

[25-Jan-2024 04:35:34 UTC] PHP Warning: imagecreatefromstring(): Couldn't create GD Image Stream out of Data in /home/szlhykiz/public_html/wiki/dokuwiki/lib/plugins/dw2pdf/vendor/mpdf/mpdf/src/Image/ImageProcessor.php on line 581

[26-Jan-2024 17:08:03 UTC] PHP Warning: preg_quote() expects parameter 1 to be string, array given in /home/szlhykiz/public_html/wiki/dokuwiki/inc/common.php on line 1580

rgleason commented 7 months ago

https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:sidebar&do=edit&mode=dwiki&fck_preview_mode=nil

{{indexmenu>:opencpn#1|js#drktheme navbar msort nsort}}

Screenshot (2009) Screenshot (2010)

Klap-in commented 7 months ago

The “id conflict” is because you have two tree in one view (in sidebar and as main page). But can you summarize how your problem is doing? Are the titles still not updated in a indexmenu after a change of a page title? (For me that is difficult to judge from a picture)

rgleason commented 7 months ago

The “id conflict” is because you have two tree in one view (in sidebar and as main page).

How would you suggest fixing this?
Should I remove " {{indexmenu>:opencpn#1|js#drktheme navbar msort nsort}}" from the sidebar page and put it into the Indexmenu "plugin»indexmenu»page_index" location? In order to remove the two trees?

rgleason commented 7 months ago

@klap-in I still need to hit "Save" configuration to get the indexmenu to update after a change.

hupb commented 7 months ago

@Klap-in

But ... I'm actually quite happy with my workaround ... :)

rgleason commented 7 months ago

Ok, where do you put {{indexmenu>.#1|js#thread nomenu notoc navbar noscroll}} ? Do I remove from Sidebar the code " {{indexmenu>:opencpn#1|js#drktheme navbar msort nsort}}"

Also where do these go?

If I do this do you think our indexmenu will use the Namespace titles for the TOC? I no longer need :msort nsort"?

hupb commented 7 months ago

I don't think you should change anything in your sidebar ... wait for Klap-in ... But if you dare, you can try to change line 95 in lib/plugins/indexmenu/action.php to if (!p_get_metadata($ID, 'indexmenu')) return; like I did (see my first post) and maybe ...

rgleason commented 7 months ago

Thanks, I might try that.

rgleason commented 7 months ago

Any thoughts on how I eliminate the id conflict found in my error log. Kap-in says it is from "two tree in one view as sidebar and as main page"? Thanks

Klap-in commented 7 months ago

Any thoughts on how I eliminate the id conflict found in my error log. Kap-in says it is from "two tree in one view as sidebar and as main page"? Thanks

No action needed. It is just a (bit useless) warning. Normally your visitors do not open your sidebar as sidebar and main page at the same time (which creates duplicated view which is not supported by this plugin).

@hupb thanks for the info. Probably how the metadata is stored is causing this. It works differently than expected. I have to study its behavior…

rgleason commented 7 months ago

@hupb That works! Thank you.

But if you dare, you can try to change line 95 in lib/plugins/indexmenu/action.php to if (!p_get_metadata($ID, 'indexmenu')) return; like I did (see my first post) and maybe ...

@klap-in Thanks. that was probably me searching for the sidebar indexmenu code.

No action needed. It is just a (bit useless) warning. Normally your visitors do not open your sidebar as sidebar and main page at the same time (which creates duplicated view which is not supported by this plugin).

rgleason commented 7 months ago

Well now Myron's DW Edit (the one I use all the time) has no Edit Icons.... any way to fix that? Screenshot (2011)

Klap-in commented 7 months ago

Well now Myron's DW Edit (the one I use all the time) has no Edit Icons.... any way to fix that? Screenshot (2011)

That is another topic, off topic. But my fist guess is this issue. https://github.com/dokuwiki/dokuwiki/issues/4200 Which php version are you using?

rgleason commented 7 months ago

Thanks. Reported at the Issue. https://github.com/dokuwiki/dokuwiki/issues/4200#issuecomment-1938592202 have this exact same problem. We are using PHP Version 7.4.33 with Kaos We are using bootstrap3 also. Should I make those changes to inc/cache.php as well? https://github.com/dokuwiki/dokuwiki/commit/7a9c51a02e7db6a472b4afebfd75357bd20906fe Did it and it works. Thanks very much Gerrit @Klap-in

Klap-in commented 7 months ago

The hotfix release is just released, so you can also update to this version instead of manually fixing :-)

rgleason commented 7 months ago

Can I close this now?

rgleason commented 7 months ago

I think it is resolved. Closing.

Klap-in commented 7 months ago

I meant the hotfix release of DokuWiki was released. I have not made changes for this plugin sofar.

Stikus commented 7 months ago

I have some problems with indexmenu data updates:

image

image


image

image

So I have to manually edit page to update it. Moreover - same problem with sidebar.

I have errors in error.log:

2024-02-14 12:03:05     /opt/www/wiki/lib/plugins/ckgedit/action/meta.php(402)       E_WARNING: Undefined array key "fck_preview_mode"
  #0 /opt/www/wiki/lib/plugins/ckgedit/action/meta.php(402): dokuwiki\ErrorHandler::errorHandler(2, 'Undefined array...', '/opt/www/wiki.c...', 402)
  #1 /opt/www/wiki/inc/Extension/EventHandler.php(80): action_plugin_ckgedit_meta->insertFormElement(Object(dokuwiki\Extension\Event), Array)
  #2 /opt/www/wiki/inc/Extension/Event.php(75): dokuwiki\Extension\EventHandler->process_event(Object(dokuwiki\Extension\Event), 'BEFORE')
  #3 /opt/www/wiki/inc/Extension/Event.php(133): dokuwiki\Extension\Event->advise_before(false)
  #4 /opt/www/wiki/inc/Extension/Event.php(200): dokuwiki\Extension\Event->trigger(NULL, false)
  #5 /opt/www/wiki/inc/Form/Form.php(482): dokuwiki\Extension\Event::createAndTrigger('FORM_EDIT_OUTPU...', Object(dokuwiki\Form\Form), NULL, false)
  #6 /opt/www/wiki/inc/Ui/Editor.php(180): dokuwiki\Form\Form->toHTML('FORM_EDIT_OUTPU...')
  #7 /opt/www/wiki/inc/Action/Preview.php(31): dokuwiki\Ui\Editor->show()
  #8 /opt/www/wiki/inc/template.php(120): dokuwiki\Action\Preview->tplContent()
  #9 [internal function]: tpl_content_core('preview')
  #10 /opt/www/wiki/inc/Extension/Event.php(134): call_user_func_array('tpl_content_cor...', Array)
  #11 /opt/www/wiki/inc/Extension/Event.php(200): dokuwiki\Extension\Event->trigger('tpl_content_cor...', true)
  #12 /opt/www/wiki/inc/template.php(102): dokuwiki\Extension\Event::createAndTrigger('TPL_ACT_RENDER', 'preview', 'tpl_content_cor...')
  #13 /opt/www/wiki/lib/tpl/dokuwiki/main.php(60): tpl_content()
  #14 /opt/www/wiki/inc/actions.php(30): include('/opt/www/wiki.c...')
  #15 /opt/www/wiki/doku.php(131): act_dispatch()
  #16 {main}

But I'm not using CKG edit so I'm not sure if they are related.

Klap-in commented 7 months ago

Good to have another example as well. Also interesting to see this is for a case without titles and js option. Unfortunately, I'm now sick, so it will take more time for I will investigate this further.

PerThomsen commented 7 months ago

if (!p_get_metadata($ID, 'indexmenu')) return;

It worked for me

rgleason commented 4 months ago

I think I can close this now. Our indexmenu has been working ok for quite some time.