If you change the menu-index of a MODx resource, the result can be that two resources have the same menu index.
Wouldn’t it be more logical (and less prone to errors) for the MODx manager to automatically renumber the menu indexes?
Thanks.
Best regards,
Black Raven
One advantage of leaving them alone is that you can give a page and index of 999 and it will always appear at the end of the menu.
If duplicate menu indexes cause a problem, it’s pretty easy to correct.
Hi BobRay,
Thanks for the response. And I agree that it would be nice if an index like 999 would keep that number.
On the other hand is the current situation sometimes confusing for editors.
Possible solution for both: only do automatic renumberering for those cases where two menuindexes are indeed the same.
(pushing all resources one menuindex up, until there is no "collision" anymore)
Not a bad idea.
You could file it as a feature request via the Jira link at the top of this page. Ideally, it would warn the user on non-zero, non-unique menu indexes and send them back to the form.
In the meantime, you could do it with a plugin attached to the OnBeforeDocFormSave event.
Quote from: Black at Feb 07, 2010, 04:01 AM
Bob,
Thanks for your help; the suggestion is now entered in Jira (http://svn.modxcms.com/jira/browse/MODX-1637).
I must admit I dislike sending the user(editor) back to the form; what if (s)he wanted exactly what (s)he asked?
I prefer the MODx manager to make an educated guess about what the user wanted to accomplish (and that will almost never be: have two resources with the same menuindex) - and take action accordingly.
It would be unusual for MODx to do a user’s thinking for them, but it could certainly work that way. OTOH, it could also say "Warning: Duplicate menu index. Continue with save?" with Yes/No buttons.
My guess (and that’s all it is) is that this won’t be a part of the MODx core, which is intended to be lean and mean wherever possible so it would have to be developed as a plugin.
FWIW, I do the menu on paper and number the menuindex by 10 (10, 20, 30, etc) so there’s room to insert new ones. If you plan to do a lot of inserting, you could number them by 25, 50, or even 100. I always give the "Contact" page a menu index of 9999 because I always want it last.
Right; the experienced users will not have a problem - and as Shaun pointed out in Jira, in Revolution drag and drop of the pages works fine (and causes automatic renumbering).