concrete5/concrete5 — pull request #1708 by ahukkanen (2014-04-05 19:11:18+00:00)
Title: Preserve system pages sorting order in a sort request, an effort

An effort to fix a sorting problem when the system pages are not included in the sorting request.

This is to think about. This does not solve the whole problem, only a part of it.

This is also regarding #1707 but I split this to another PR because I wasn't quite sure about this.

The problem is when you do a sorting request when the system pages are hidden in the sitemap, this causes the original system pages to get messed up in the new sorting order because their sorting priority is not updated during the request.

E.g. in the default installation you can see this with the "Profile", "Download File" and "Members" pages if you sort the other pages without having the "Show System Pages" option enabled. Does it really matter on the front-end of the site? No, not really. Does it mess up the sorting order at the dashboard? Yes, it does, and might cause confusion because of that.

To really fix this, it would be required to go through all of the sub-pages of the first sortable page's parent which would get really inefficient and might cause problems if the page has a lot of sub-pages (like hundreds of them). Or another way would be to somehow include the system pages in the sorting request although they are not visible in the sitemap.

One approach that I tried here is that if those system pages are the first ones in the list (like they often are), their original sorting order would be preserved and the order for rest of the pages would be incremented by the amount of system pages before them. This only works if the system pages are the first ones in the list but this is still an improvement to the current situation.