After appending my issue to #240850: book.views.inc, where "dereine" told me to open a new issue I finally arrived here :)
I'm currently trying to enable views to organize books. For that I wrote DraggableViews module and the "DraggableViews Book handler" which work great so far.
When I tried to list books in views the first time I read at the help text of the "Book: Hierarchy" sort criteria:
The order of pages in the book hierarchy. If you want the exactly right order, remember to sort by weight, too.
So I sorted by weight. It took a while until I noticed that ordering by "Book: Weight" as the second sort criteria doesn't effect anything. So I dig deeper and found out that the menu system saves the mlid in the column "p?", where ? is the depth in the hierarchy. That means that the sort criteria "Book: Hierarchy" already defines an unique order.
So now, somehow, is it possible to sort the book pages by weight too?
Greetings,
sevi
I'm not sure about the category because I still think that I missed something. So I chose "support request".
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | alternatively-just-fix-the-help-text.patch | 841 bytes | john morahan |
| #5 | ungodly-hierarchical-order.patch | 3.29 KB | john morahan |
Comments
Comment #1
dawehnerThx :)
As far as i understand the problem it would work, if you could display the items as hierachical menu. You could do this with theming, and grouping by book parent nid.
Comment #2
dawehner.
Comment #3
sevi commentedYes,
but can you confirm that the help text of the "Book: Hierarchy" sort criteria
is wrong?
That's actually the question of this issue.
Thanks for the quick response.
Greetings,
sevi
Comment #4
sevi commentedOkay, I think I finally understood the message of your last post.
All what the help message tells me is that I should sort by weight too, however I accomplish this. It doesn't tell me explicitly to sort by weight as the second sort criteria but it rather tells me to order it on my own, e.g. with
ksortin my theme.I gonna close this issue now because I don't agree with my starting post any longer.
Thanks for your help and patience,
greetings,
sevi
Comment #5
john morahan commentedThis whole thing is my fault. I tried it out before submitting the patch that added that help text, and somehow it seemed to work... I guess I must not have tested it very thoroughly.
It is indeed possible to sort by weight+title as well as hierarchy, but the resulting queries are butt-ugly and, in all likelihood, painfully slow (though I haven't actually benchmarked). It's probably better to do this in the theme layer as dereine suggests, if you can. Nonetheless, patch attached for your amusement.
Comment #6
sevi commentedFirst I want to thank you for investing time for this issue.
Indeed. I've never before seen such an error message:
user warning: Out of sort memory; increase server sort buffer size query: SELECT node.nid AS nid, ..I haven't tried your patch yet but I guess it won't work. The first time you
ORDER BY book_menu_links_weight ASCthe whole order might already be unique (or at least it would lead to an unwanted order). So all following sort criterias (p2, p3, p4,..) would be useless (or would not lead to the desired results).I don't have much time at the moment but I want to explore the deep blue menu system soon :)
Thanks again,
greetings,
sevi
Comment #7
john morahan commentedI feel a bit silly defending this hideous patch, but I'm pretty sure it does produce the correct order (assuming it doesn't kill your database server in the process). It does NOT order by book_menu_links_weight - it joins another copy of menu_links for each p? and orders by the weights of those copies. For example:
Comment #8
sevi commentedMy apologies,
to tell you the truth I've never before built a SQL-query like this. I didn't no that you can sort on a copy of the same table at the same time. Next time I'll be more careful before I tell someone that he's wrong :\
However, as you said before, this query needs too many resources. Thanks for describing your patch to me though, so I've learned more about MySQL/SQL.
Greetings,
sevi
Comment #9
merlinofchaos commentedI'm...not sure what to do with this. I'm scared to even look at a patch named 'ungodly'. This isn't seriously here for consideration of actually adding to Views, is it?
Comment #10
john morahan commentedHehe... of course not :) The help text patch is serious. The ungodly one is just a proof of concept that I found amusing and thought I would share.
Comment #11
merlinofchaos commentedGot it. Help patch applied to all branches. Thanks!