Allow different module path than sites/all/modules
Ander5 - December 2, 2007 - 04:49
| Project: | jQuery Lightbox |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
When opening an image into a popup, the close image "button" that is normally in the lower right corner is not shown (period) in the latest version of firefox, and IE just shows the typical "image not found" x thing.

#1
Upon further investigation, I noticed the path to the image is "/sites/all/modules/jlightbox/images/closelabel.gif" which is incorrect. In my case, it should be "/cnwc/modules/jlightbox/images/closelabel.gif". Hopefully this additional information is useful.
#2
According to latest release notes the path to images has been fixed, but it does not look like the changes were committed. I am still showing the incorrect path in 5.x-1.1, which causes the missing loading and close gif. Otherwise seems to work well.
#3
So in other words I need to wait until the author commits the changes and re-uploads the module?
#4
No, jLightbox is not yet able to support different module paths than the default sites/all/modules currently. If you put jLightbox into sites/all/modules, it will work.
AFAIK, a different path would have to be passed via Drupal.settings(), thus being another javascript snippet slowing down your site. I would like to fix this soon (without performance issues), however, I just don't feel comfortable with additional inline javascript on each page request.
Any suggestions/solutions, and of course patches, are welcome.
#5
drupal_get_path('module', 'jlightbox') .'/images/closelabel.gif'
#6
i have the last stable release of jlightbox installed in the /sites/all/modules directory but the closelabel image is not displayed. i suspect that when drupal is not installed in the root the /sites... link is not working properly (goes to server root instead of drupal root). if not there might be some interference with the i18n module (that adds language to the path).
so, is the code suggested above supposed to be put in the following line of the jlightbox.uncompressed.js file?
fileBottomNavCloseImage: '/sites/all/modules/jlightbox/images/closelabel.gif',and then renaming as jlightbox.js ?
thank you
#7
up
#8
I'd be all for a Drupal settings addition or inline javascript so that the site structure doesn't impact the functionality of this module. I like the module, I just don't like having to throw 1 module into the main /sites/all/modules directory when everything else is nested under contrib. If time avails, I'll try and put together a patch early next week
#9
Here's a patch for the Drupal 6 version that gives the images absolute paths based on a global JavaScript variable. A Drupal.behaviors function updates the "fileLoadingImage" and "fileBottomNavCloseImage" paths using this value and then initializes the lightbox.
Now the loading and close-button images are displayed regardless of the location of the module!
#10
Is there a way to add this php snippet in the js file?
drupal_get_path('module', 'jlightbox') .'/images/closelabel.gif'
#11
@@ -468,6 +468,8 @@+ Lightbox.fileLoadingImage = Drupal.settings.jlightbox_path+'/images/loading.gif';
+ Lightbox.fileBottomNavCloseImage = Drupal.settings.jlightbox_path+'/images/closelabel.gif';
There should be a space before and after the JS string concatenation operator.
This review is powered by Dreditor.
#12
Thanks for reporting, reviewing, and testing! Committed to 6.x.
A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.
#13
Automatically closed -- issue fixed for 2 weeks with no activity.