Description
Currently in Confluence there is no way for the user to order pages within it’s tree (ordered by title by default). The ability to order pages would be a useful feature for html/pdf exports. CONF-1031
Implementation
The thing I found most difficult about this feature was to encapsulate it into an appropriate and user friendly UI. I concluded that a ‘drag-and-drop’ approach would be the most appealing to users and found a tool called tool man
In terms of storing a page’s order, I added a new field “weight” to the ContentEntityObject (which evidently is not the most ideal implementation but was the easiest). When a CEO’s bag of “children” are retrieved, it is returned ordered upon this new “weight” field. Additionally, usages of the CEOTitleComparator were replaced with a CEOWeightComparator.
Problems
The drag-drop library I had chosen did not support nested lists to be drag-and-droppable, so I was only able to get the top level page ordering implemented (i.e in my current implementation the children pages of a top level page cannot be ordered). I did try my best to tweak the library but to much dismay failed to get nested lists working.
A few more issues that would need to be dealt with for a complete implementation would be:
- upgrade task to order pages existing pages with a “weight”
- deal with add/move of pages
- maybe try to think of a better store mechanism than adding a weight field to all CEOs