Closed (won't fix)
Project:
Node Order
Version:
4.7.x-1.0
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
9 Feb 2007 at 17:32 UTC
Updated:
5 Jan 2008 at 14:31 UTC
I love the neat ordering capabilities of the nodeorder module, but I originally picked it up to be able to easily rearrange image nodes for galleries we do. Specifically, images galleries that will be filtered through the flash_gallery module. I can set the image_gallery "category" (taxo) to be orderable, and order the images within, but if I go ahead and actually View the gallery, they're in reverse chronological order, the way they always are. Same with the Flash Gallery.
Is this right? Did I skip a step? And is there anyway to hack something so it will carry through to the flash gallery?
Comments
Comment #1
marcp commentedWhat does the data look like in the term_node table for the tid that you are ordering within?
Comment #2
Offlein commentedApologies, didn't see your response until now:
Here's what I get:
+------+------+---------------+
| nid | tid | weight_in_tid |
+------+------+---------------+
| 2939 | 2452 | 2940 |
| 2940 | 2452 | 2977 |
| 2974 | 2452 | 2976 |
| 2975 | 2452 | 2974 |
| 2976 | 2452 | 2939 |
| 2977 | 2452 | 2975 |
| 2978 | 2452 | 2978 |
| 2980 | 2452 | 2980 |
| 2982 | 2452 | 2982 |
| 2983 | 2452 | 2983 |
| 2984 | 2452 | 2984 |
| 2985 | 2452 | 2985 |
| 2989 | 2452 | 2989 |
| 2990 | 2452 | 2990 |
| 2991 | 2452 | 2991 |
| 2993 | 2452 | 2993 |
| 2994 | 2452 | 2994 |
| 2995 | 2452 | 2995 |
| 2997 | 2452 | 2997 |
| 2998 | 2452 | 2998 |
| 2999 | 2452 | 2999 |
| 3000 | 2452 | 3000 |
| 3002 | 2452 | 3002 |
| 3003 | 2452 | 3003 |
| 3004 | 2452 | 3004 |
| 3005 | 2452 | 3005 |
| 3006 | 2452 | 3006 |
| 3007 | 2452 | 3007 |
| 3008 | 2452 | 3008 |
+------+------+---------------+
29 rows in set (0.00 sec)
Weird, because I can see the weight changing as I move things up and down, but it doesn't affect how the actual listing. Perhaps I'm just viewing it in the wrong place?
Specifically, I am looking at /taxonomy/term/2452. Even on that page I am given the opportunity to move the nodes up and down, but it seems to simply not be organized by the weight.
If that's the issue, then I guess I need to somehow make /taxonomy/ term listings aware of how to organize these things. I hope that we can get that working it somehow ports easily to the image galleries, too.
Comment #3
marcp commentedYou'll need to look at /nodeorder/term/2452 if you want to see the ordered nodes. Nodeorder implements hook_term_path() which should, assuming your other modules are playing nice, cause any Taxonomy links to link to /nodeorder/term/TID. I haven't looked at the Gallery/Flash Gallery code, but I bet they aren't calling taxonomy_term_path() when creating links to terms -- instead they are probably hardcoding '/taxonomy/term'. $tid or something like that...
Can you dig further into this?
Comment #4
Offlein commentedFor you, anything. I'm swamped here right now, but I'll get to it hopefully tomorrow or the day after.
Comment #5
marcp commentedThanks, Jewcy. I want to help with this, and I'll give you as much support as I can, but I'm slammed too...
Marc
Comment #6
halftone commentedWas any progress made on this please? I can't see any way to use image_gallery with nodeorder at present. As far as I can work out after a day of staring blankly at code I only slightly understand, it's the image module (and/or image_gallery component) that needs revision.
Being able to set an explicit order for images seems absolutely fundamental to me, for some purposes - a narrative exhibit or similar. With Drupal 4.6 I used a mess of hacks to order by name (http://drupal.org/node/119052 - never worked properly with multiple taxonomies), and having now upgraded to 4.7 was hoping nodeorder would finally help. Surely someone must have addressed this?
Or should I raise this as a feature request re image module, since as far as I can see nodeorder works exactly as designed, setting all the weight_of_tid values, but image can't use them.
TIA for any help or guidance.
Regards Tony
htttp://tonysleep.co.uk (but offline until I can work something out)
Comment #7
halftone commentedI have now made a feature request for image_gallery to support nodeorder http://drupal.org/node/126668
Comment #8
Offlein commentedI'm sorry, about a week and a half ago I delved a little deeper into this and sort of figured out what was going on. I made a little hack, actually, and now NodeOrder works with my Flash Galleries. It's amazing.
Of course, the reason is the Flash Gallery module is hard coded to order by n.sticky DESC and then n.created DESC... Meaning if the image is sticky it'll go to the top first, and then the rest of the list is ordered via creation time, descending.
I modified the line (line 131 in mine) from..
"ORDER BY n.sticky DESC, n.created DESC"
into this, which is sorted Ascending, just cause it was easier for me to have the images I uploaded last appear at the end of the gallery by default..
"ORDER BY t.weight_in_tid ASC"
And it worked, as long as the images had been uploaded while NodeOrder was installed and active (hence, if there is a value in nodeorder's Weight column).
I assume there is something very similar going on with the imagegallery module. Search it for "ORDER BY" and see if you can replace it with t.weight_in_tid.
Someone should probably make the Status of this "Won't Fix" if they can confirm that imagegallery can be hacked the same way. Although, I wonder if I should open a new ticket requesting a button to generate a list of weights for pre-existing Taxonomy, since in my case, I had NodeOrder set to disable on throttle, throttle got enabled, I uploaded a bunch of pictures, and nodeorder wouldn't order them correctly when I turned it back on...
Comment #9
halftone commentedDuh, this did indeed turn out to be easier than I thought, requiring just the following 2 changes:
Image_gallery module at line #87
$last = db_fetch_object(db_query_range(db_rewrite_sql('SELECT n.nid FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN (%s) AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), implode(',', $descendant_tids), 0, 1));
replace with
and at line #93
$result = pager_query(db_rewrite_sql("SELECT n.nid FROM {term_node} t INNER JOIN {node} n ON t.nid=n.nid WHERE n.status=1 AND n.type='image' AND t.tid=%d ORDER BY n.sticky DESC, n.created DESC"), variable_get('image_images_per_page', 6), 0, NULL, $tid);
replace with
Which works fine here and doesn't break if nodeorder is absent, so I am very happy :-) It could do with further tweaking to display the first image in a term in empty parent galleries (as sticky used to do), but it's now more urgent for me to fix the pager code I am using from http://drupal.org/node/119052. I have done a similar hack for that which I will post there, but haven't yet managed to stop the pager hopping around between multiple terms (it looks at the first TID of the current node and uses that).
Thanks for your help. Image module/gallery is now almost usable ;)
Comment #10
halftone commentedSorry, I hadn't noticed some Watchdog errors. Now fixed and this now allows the first weight_in_tid images in a term to stand in for sticky images in empty parent gallery categories.
Image_gallery module at line #87
$last = db_fetch_object(db_query_range(db_rewrite_sql('SELECT n.nid FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN (%s) AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), implode(',', $descendant_tids), 0, 1));
replace with
and at line #93
$result = pager_query(db_rewrite_sql("SELECT n.nid FROM {term_node} t INNER JOIN {node} n ON t.nid=n.nid WHERE n.status=1 AND n.type='image' AND t.tid=%d ORDER BY n.sticky DESC, n.created DESC"), variable_get('image_images_per_page', 6), 0, NULL, $tid);
replace with
Comment #11
Offlein commentedGreat work, halftone. I'm setting this to won't fix, then.. If that's not correct, someone can change it.
Comment #12
halftone commentedNB http://drupal.org/node/119052#comment-214489 for anyone looking for an image pager (next|prev links) custom module solution that works with the image module AND Nodeorder AND images that inhabit multiple taxonomy terms :-). That version of hacks to the image module also adds back Sticky for Nodeorder'ed images as suggested by Marc. I am so happy, thanks largely to Nodeorder and you guys this is the first time ever Drupal has seemed controllable (or even usable) for images :)
Comment #13
yngens commentedwill this work for 5.x?
Comment #14
halftone commentedYes, I have done it with 5.3. The code changes are a little different to those outlined in #10.
In the contrib/image_gallery.module modify the image_gallery_page function :-
NB that if Nodorder is not installed image gallery reverts to normal reverse-chronology Drupal ordering. This really needs to be submitted as a patch to the image_gallery module so it can become official code, but I am not competent enough to do it. Nevertheless, this works fine - can be seen doing so at http://threadscape.co.uk galleries