Sorry this is quite a lot of stuff but it isn't possible to disentangle the elements.
The attached patch does two things:-
- adds support for the Nodeorder module http://drupal.org/project/nodeorder when used for drag and drop ordering of images within a gallery (fantastically useful in my experience). If Nodeorder is not in use, the normal Image Gallery sticky+upload date ordering is used instead.
- fixes breadcrumbs where images inhabit multiple taxonomies. In normal operation this is not a problem but as soon as a pager is added to image node pages by any of the various methods, the standard breadcrumb follows the first TID an image is associated with instead of the TID the user is actually viewing.
EG you have an image that has terms 'Scotland','portraits''. If viewing the image node via gallery 'Scotland' the breadcrumb is home>galleries>Scotland . If the pager is then used to advance to a next image which has terms 'portraits' 'Scotland', the breadcrumb then shows home>galleries>portraits which is wrong as the viewer is still in the Scotland gallery. The patch fixes this problem by referring to a $_SESSION variable which references the current TID, if this has been set by suitable pager code. If not, it behaves as normal.
The attached module, image_page_pager, adds a pager to image node pages. It also uses Nodeorder if installed, but defaults to normal Drupal behaviour if not. It also copes with images that have multiple taxonomy terms and is the major reason for the patch. There are a choice of 4 different types so far, see the settings page. I'd like to see both become part of Image, as the request for pagers is a FAQ. Pllease see the readme about addition to node-image.tpl.php
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | add_order_link.patch | 879 bytes | halftone |
| #8 | image_gallery.zip | 4.59 KB | tnt2000 |
| #2 | image_page_pager.tar_.gz | 8.96 KB | halftone |
| #1 | image_page_pager.tar_.gz | 9 KB | halftone |
| image_gallery.patch | 5.98 KB | halftone |
Comments
Comment #1
halftone commentedUnable to attach 2 files, so the Image Page pager module is attached here
Comment #2
halftone commentedCategory and Status changed as I think 'feature request' and 'patch (code needs review) are more correct? Sorry, I'm new to trying to contribute stuff.
Image_page_pager module reuploaded (below) with amended README.TXT - no other changes.
Comment #3
Metusela commentedThis looks great!
Just what's missing in the Image module.
I'm trying it out now.
Comment #4
tnt2000 commentedHi everyone,
I'm using Drupal 5.10 and image 1.9 with nodeorder. I've installed the image_page_pager and patch but still there is sth. wrong. When I click a gallery, first picture of nodeorder is displaying but the next button is not functional (or have the same link as current photo). I need help, people are dying :)
Comment #5
halftone commentedHmm. That happens if the image_page_pager1 (or2,3,4) function isn't picking up the $node $tid and $gallery variables. It's a problem I had at one point after putting the switch into the module to choose the pager type. I believed I'd fixed it as it's fine here. Anyone else seeing this?
Can you change the bit you placed in your theme's node-image.tpl.php (from the Readme.txt):
From:
To:
This will bypass the switch and pager set in the admin settings and use pager_1 directly ... change the function to Image_page pager_2 (or 3 or 4) to use one of the other types.
Please let me know if that works.
BUT! the patch was against 5.x-1.x.dev Image_gallery so if you patched 1.9 anything is possible :-) The dev version has about 30 more lines in it, so d/l and patching that may be the first thing to try.
Comment #6
tnt2000 commentedGreat! It works... Thanks a lot. I'll almost cancel the job becuase of this bug..
Comment #7
halftone commentedIt would be very helpful to know what worked - patching the right version of Image_gallery, or bypassing the module switch in node-image.tpl.php? If the latter was necessary you have a workaround but it means something still isn't right with the module code.
Comment #8
tnt2000 commentedI did lots of modifications before you send the last node-image.tpl.php insert. I think it would the best way to send my image_gallery.module and node-image.tpl.php...
node-image:
Comment #9
halftone commentedtnt2000. As far as I can see, all you have done is add a few blank lines to image_gallery_module. But nobody has time to read through module code searching for differences.
Did you apply the patch manually? Or what? If so see http://drupal.org/node/14231 and if you're on Windows http://drupal.org/node/32875
Comment #10
tnt2000 commentedProbably I patched the module manually :) Not exactly know what I did...
Comment #11
halftone commentedAll I can suggest is that you start again and see if it then works.
Comment #12
mattie-1 commenteda very useful patch imho! thanks
i'll try it out in the coming days
Comment #13
daniel wentsch commentedThanks for this patch, it's very useful to me.
Am I getting it right, that, when I did everything correctly, I should be able to drag&drop (re)order images inside image_gallery galleries?
If so, I must have done something wrong, because this doesn't work.
Here's what I did:
- backed up & patched image_gallery successfully
- installed nodeorder and all dependencies, included demos work
- installed image_page_pager, works perfectly
I just don't get it how to be able to sort/order image_gallery images... did I miss a point?
Thanks in advance,
Daniel
PS: of course, I also set the category "Image Galleries" to "orderable".
PPS: okay, everything fine. I just had thought that "order nodes" tab would appear in the thumbnail overview, found it now and everything works.
PPPS: I find it rather complicated to tell my users they have to go to categories->list->edit vocabulary->nodeorder (url admin/content/taxonomy/X/order) just to re-arrange their images. Could somebody think of a way to make that "nodeorder" tab available more easyly?
It would be way better if that tab was availble under "image galleries->list" (url admin/content/image)
Comment #14
halftone commentedAll is well - this is 'by design' (of Nodeorder), which is a general purpose module for ordering nodes of any type within a taxonomy term or vocabulary. It is a bit obscure in the docs for the module.
To set the order of your images go to http://mysite.com/admin/content/taxonomy/1/order (assuming 1 is the top level TID of your image vocabulary, else use whatever number it is) and you will be presented with a page listing all your galleries with 'set order' links alongside. Click on one of those and you'll be able to drag and drop the images into the order you want.
It's worth creating a menu entry for this, eg 'Order images' -> http://mysite.com/admin/content/taxonomy/1/order if it's something you'll be doing often.
Personally I find it much easier to set Nodeorder to 'Only show titles when ordering nodes' (via admin/settings/nodeorder). This gives a list of image titles instead of thumbnails when ordering nodes as above, which is much faster and easier to manage if you have a lot of images in a gallery. EG I have 76 in http://tonysleep.co.uk/frestonia - pressing Ctrl/- a few times reduces the font size so I can see all the titles on one screen at a time and setting the order was then a doddle.
Once you have set the order - and there is no 'save', just dragging the items around sets the order immediately - then your patched image_gallery should display them in the sequence you have set.
Comment #15
halftone commentedSorry, I had to edit the above as I had used the Drupal 4.7 format http://mysite.com/admin/taxonomy/1/order. The correct Drupal 5.n link for ordering images is what it now says http://mysite.com/admin/content/taxonomy/1/order
Comment #16
halftone commented@wentsch
Not a bad idea, I'd find that easier too :).
The attached additional patch to image_gallery.module adds a link to gallery pages for users to set the order of images within the gallery, provided :
- Nodeorder is installed
- they have access permissions to edit images & set image order
- the vocabulary is orderable.
Nothing happens or is displayed if any of those are untrue.
The link has a CSS class 'order_link' so can be tarted up.
Seems OK here, but please let me know.
Comment #17
daniel wentsch commentedThank you, I'm gonna give it a try :)
(sorry I haven't been around here for a while, been terribly busy)
//edit: patched the file and it works. Thanks again ;)
Comment #18
sunSorry, this is too specific for Image module. Feel free to open a new issue that adds generic support for contributed modules to alter image galleries.
Comment #19
halftone commentedI am sorry but I don't understand the objection. What's the specific problem? Support for Nodeorder being coded into Image_gallery?
Comment #20
sunIt is too limited. There are more modules in contrib that provide the same or similar functionality like Nodeorder. If you want to get this feature in, you have to find a way that works without this:
Also, new features go into 6.x, resp. 5.x-2.x (if possible) only. That said, we have drupal_alter() in D6, which might be what you want to use in a generic approach for this feature.
Comment #21
halftone commentedThanks for the explanation.
I'm aware Views supports Nodeorder. It does so via 'module_exists ('nodeorder')! via an inc file and selectable sort ordering. Might such a solution be acceptable for Image_gallery, so that different methods of ordering can be added via inc files?
[Re Viiews: I'm really reluctant to go that heavyweight route just to obtain what seem to me basic Image_gallery functionality. Everything addressed in this thread is a FAQ that has come up dozens of times. I don't know how a gallery module ever got released without a pager, a means to configure sort order, breadcrumbs that don't break when multi-taxonomies are used. These deficiencies have persisted ever since I began with Drupal 4.x, so hacking and patching is inevitable. That is a complete PITA I would like to try and solve - but I'm not sure the developers haven't decided that Views is the favoured solution?].
[Re: 6.x: I can't contemplate 6.x for production sites. I'm still struggling with porting one complicated 4.7 site to 5.x. As a time-and-ability-limited user, not a developer, I'm afraid the pace of Drupal development and exploding complexity outstrips my ability to keep up. Mind you, looking at the issue queue for 6.x Image (+ Views in particular) it seems to outrun even the developers... ;) ]
Comment #22
scroogie commentedPerhaps the problem is that image_gallery uses taxonomies for galleries. Anyway, I don't understand why a module_exists() for some integration is bad.
@sun How exactly does drupal_alter help in this situation. Do you want to build your own ordering solution into image.module? You would need your own UI then. As Node Order is specifically designed for ordering nodes in terms, I think it fits quite well.
Comment #23
halftone commentedThe patched version discussed here uses taxonomy for galleries too. It just does it properly, ie can handle images that have multiple taxonomy terms without breaking breadcrumbs when using next|prev links. The original code just uses the first term for the gallery which may or may not be the right one, if there are several, so clicking on a 'next' link can dump you at the correct image now in a different gallery.
I believe Nodeorder may become part of core in Drupal 7, though I can't now remember where I read that and haven't been able to find it again.