Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I introduced the tablesorting capabilities to the content listing in admin/content/node.
While this is also a step to making Drupal 6 UI as consistent as possible, it is mainly a major usability improvement. I don't want to decide whether this is considered featureish or not. However, I'd be happy to see this in D6.
I didn't add a default sorting order, as we need to discuss this. Would be no problem though.
The enclosed patch has been tested to some extent and should work as advertised. Some more testing would be helpful anyway.
Comment | File | Size | Author |
---|---|---|---|
#22 | tablesort-title-asc.png | 437.97 KB | deviantintegral |
#22 | tablesort-status.png | 465.48 KB | deviantintegral |
#16 | sortable_node_admin_nodes_15.patch | 5.11 KB | deviantintegral |
#12 | sortable_node_admin_nodes_12.patch | 4.14 KB | Pancho |
#11 | sortable_node_admin_nodes_11.patch | 4.14 KB | Pancho |
Comments
Comment #1
tonyn CreditAttribution: tonyn commentedTable sorting is useful in almost all instances I can think of, I surprised we haven't seen this sooner!
Comment #2
birdmanx35 CreditAttribution: birdmanx35 commentedThis patch applies cleanly. I am changing it to a feature request and 7.x; if you feel otherwise, feel free to change it.
Comment #3
tonyn CreditAttribution: tonyn commentedWhy does this have to wait until 7.0?
This patch uses a sorting method (tablesort.inc) that has been around since the stone age.
The interface looks identical. Multiple selection options works (stick, publish, unpublish, fp, demote fp, delete, etc). Filters work.
When no nodes are present:
warning: Invalid argument supplied for foreach() in ....drupal6/includes/theme.inc on line 1292.
theme.inc beginning with line 1292.
This was fixed by changing $rows to $rows[] in node.admin.inc, on line 571 (after patched).
Testers?
Comment #4
birdmanx35 CreditAttribution: birdmanx35 commentedI'm changing this to 7.x-dev because it is a feature change. Feature changes go to 7.x-dev.
Also, AFAIK, this patch update no longer applies cleanly. I get this message:
$ patch -p0 < sortable_node_admin_nodes_1.patch
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- node.admin.inc_original 2008-01-26 20:24:44.000000000 -0600
|+++ node.admin.inc 2008-01-26 21:06:47.000000000 -0600
--------------------------
File to patch:
That may just be my newbieness, however, this IS a 7.x-dev issue because it is a feature request, and feature requests go to 7.x-dev.
Comment #5
yched CreditAttribution: yched commentedDefinitely for 7.x. D6 is now frozen, only bugfixes get in.
Comment #6
tonyn CreditAttribution: tonyn commentedI did something wrong.
The command I used was for the relative dir. I think, because it works for me. (
created using diff -up..
Does this one apply?
Comment #7
PanchoDidn't apply anymore after heavy changes to node.admin.inc.
Refactored (including skiquels' correction) and rerolled against HEAD (D7).
Please test!
Comment #8
PanchoMarked #132714 a duplicate of this. Though the other one is older, this one is more up to date.
Comment #9
PasqualleI did not tested, but as I see from the patch, you removed the default sort. Sorting by node.changed column is very useful, it should be there. Maybe adding column "last modification" would be a possible option.
Please add table name to field items like changing
'field' => 'title'
to'field' => 'n.title'
. It should be useful when someone tries to rewrite this sql (db_rewrite_sql) with a table containing same column names.why is this part rewritten? I can't see any improvement on it.
and I still think that the language should be checked by translation module not locale module, but maybe I am wrong.
this is also unnecessary, and I do not agree with using unnecessary else statements. Try to write a whole application without using else statements (like I did some years ago), and you will feel the difference. (no, I am not kidding, I really did, and it was a really big application. And I was not so confident with the stability of my code since then.)
I really like the way how you solved the header. I learned something new, thank you.
Comment #10
PanchoThank you very much for your valuable review!
Note, that this patch now depends on and doesn't work without http://drupal.org/node/219454. Would be great if you helped me getting that one in early.
Some more testing would be cool now!
Comment #11
PanchoJust a minor reroll with some codestyle and comment nitpicks...
Comment #12
PanchoSome more nitpicking... :)
Comment #13
Pasquallean idea:
you can add header "Last modification" (or something similar), and do not show the column (only the header). This way the user can sort by it, and it does not take space from the table with showing the dates (n.changed).
Something like "Species", "Height", "Weight" headers on this page, just make it sortable.
http://www.star-fleet.com/webb/node/922?sort=asc&order=User
(i know the columns are there and they are empty. it seems as a good "visual" example for this now.)
Comment #14
catchNice idea, but no longer applies.
Comment #16
deviantintegral CreditAttribution: deviantintegral commentedI've updated the patch so it applies. I realized that as-is, there was no way to reset the sort back to the original order, as no 'Updated' column was being rendered. This patch adds that, and properly shows the default sort. This actually was a serious issue for a client of mine, as they couldn't figure out the default sorting of the list on their own. Unfortunately, it does make the table a little tighter, but I don't see a way around it.
Enjoy!
--Andrew
Comment #17
swentel CreditAttribution: swentel commentedNice, applies cleanly. Generated about 200 nodes having 3 content types. Being able to sort is a real enchancement!
(When this might get in, why not write a patch to be able to hook into node_filters?)
Comment #18
kscheirerworks for me, patch applied cleanly. I like the addition of the "Updated" column.
Comment #19
lilou CreditAttribution: lilou commentedPatch still applied.
Work great.
Comment #20
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedis this only for drupal 7+?
Chris
Comment #21
lilou CreditAttribution: lilou commentedYes, no new feature in stable version.
Comment #22
deviantintegral CreditAttribution: deviantintegral commentedI agree this is RTBC. Here's a few screenshots for anyone reviewing this patch.
--Andrew
Comment #23
webchickThis looks like a great improvement, and something we ought to probably back-port to Drupal 6 since all of the other table-like things work this way.
However.... needs updating to DBTNG. :(
Comment #24
Damien Tournoud CreditAttribution: Damien Tournoud commentedThat query is a db_rewrite_sql() one, which will be converted anyway when we will have replaced all db_rewrite_sql by hook_query_alter() (see http://drupal.org/node/299176). There is no need to rush the conversion, the query could stay that way for now.
Comment #25
webchickCool, thanks Damien.
This patch one of those obvious "duh" usability things that must've somehow been overlooked over the years. It also makes the node screen consistent with the comment and user admin screens.
I clicked through a bunch of stuff manually since we don't yet have tests for node.admin.inc, and things seem to work. Node tests we do have all passed. Code looks good, so committed. Thanks!
Comment #26
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.