good module. To be honest I've been waiting for it...

Anyway I can't get it working even though I follow your instructions.

The modal open up but it shows this message: Request unsuccessful: error

I create the link in the body of a node using ckeditor (look this picture)

This is the generated link. As you can see the path is wrong even though I created the link as usual. I have pathologic module if this matters.

<a class="colorbox-load colorbox-node init-colorbox-load-processed-processed cboxElement colorboxNode-processed" href="/colorbox/mysite.com/es/servicios">colorbox link</a>

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chefnelone’s picture

Issue summary: View changes

info

iLLin’s picture

Hmmm, it seems when its rewriting its doing something wrong. Can you take off the colorbox-node class and repost the HTML generated for the link?

iLLin’s picture

Also what browser are you using so I can try and duplicate the issue.

iLLin’s picture

Assigned: Unassigned » iLLin
chefnelone’s picture

#1
If I remove colorbox-node class it works fine but then header and footer are also shown.

This is the generated html:

<a class="colorbox-load init-colorbox-load-processed-processed cboxElement" href="http://localhost/mysite.com/es/servicios">colorbox link</a>

iLLin’s picture

Ohhh, you have Drupal sub foldered? I need to add colorbox after the base path in this case (mysite.com). Let me see if I can set something up real quick for testing to get a fix for you.

iLLin’s picture

Status: Active » Needs review
FileSize
971 bytes

Here is a patch to take the base path settings into account. See if this fixes your issue.

chefnelone’s picture

still not working, here's the html output.

<a class="colorbox-load colorbox-node init-colorbox-load-processed-processed cboxElement colorboxNode-processed" href="/colorbox/refineriaoro.com/es/servicios">colorbox link</a>

iLLin’s picture

It should do something. Here is the updated code:

var base_path = Drupal.settings.basePath;
if(base_path != '/') {
     var link = parse.pathname.replace(base_path, base_path + 'colorbox/');
} else {
     var link = base_path + 'colorbox' + parse.pathname;
}

It should add it somewhere. Your drupal install is in a subfolder correct? I tested this locally and it worked fine for me. Is this only accessible locally?

iLLin’s picture

Oh you have a typo, it says "colobox-node"

chefnelone’s picture

I fixed the typo but still no working I pasted the html output in #7

Yes, you are right, it is a subfolder.

iLLin’s picture

Can you do a
console.log(Drupal.settings.basePath);

chefnelone’s picture

I run it and I get:

/refineriaoro.com/

which is the real folder.

and the html output is

<a class="colorbox-load colorbox-node init-colorbox-load-processed-processed cboxElement colorboxNode-processed" href="/colorbox/refineriaoro.com/es/servicios">colorbox link</a>

iLLin’s picture

FileSize
660 bytes

Try this file, I have some console logs in it and paste the output from the console. Just copy it over top.

chefnelone’s picture

here:

Base: /refineriaoro.com/ 
Path: /refineriaoro.com/es/servicios 
New Base Path
/refineriaoro.com/colorbox/es/servicios
iLLin’s picture

That looks right, your saying it doesn't work like that? Paste your markup now.

chefnelone’s picture

still not working. Modal open up but no content in it.

the output is:

<a class="colorbox-load colorbox-node init-colorbox-load-processed-processed cboxElement colorboxNode-processed" href="/refineriaoro.com/colorbox/es/servicios">colorbox link</a>

and I think it should be:

<a class="colorbox-load colorbox-node init-colorbox-load-processed-processed cboxElement colorboxNode-processed" href="colorbox/es/servicios">colorbox link</a>

iLLin’s picture

FileSize
1.12 KB

No thats right, now I am thinking its the translations. Here is a new .module file. This should output some extra error checking or at least the path we are attempting to lookup.

chefnelone’s picture

I've made a very short video to show you what's happening:

http://www.screencast.com/t/9Qus2PTlKld

iLLin’s picture

What does the modal output with the last file?

chefnelone’s picture

The modal output is.

Page Not Found.

The following page es/servicios was not found.

the html for the link is:

<p><a class="colorbox-load colorbox-node init-colorbox-load-processed-processed cboxElement colorboxNode-processed" href="/refineriaoro.com/colorbox/es/servicios">colorbox link</a></p>

iLLin’s picture

FileSize
1.14 KB

It's something with the language. I don't have an install with languages turned on at the moment but I took a guess. Try the file attached and let me know. If it doesn't work it will be a few before I can get a language install going.

chefnelone’s picture

doesn't work. Now the link output is:

<a class="colorbox-load colorbox-node init-colorbox-load-processed-processed cboxElement colorboxNode-processed" href="/refineriaoro.com/colorbox/es/servicios">colorbox link</a>

iLLin’s picture

The link output is correct, its the language that is causing the grief now. Should work in english :), but it seems when the path is prepended with a language selector, in your case the "es", its not mapping correctly. I will try and get a two language Drupal install going this weekend sometime so I can find out how to correctly pass it off to retrieve the correct node id.

iLLin’s picture

Title: I can't get it working » Using multiple languages does not map the url correctly.
Category: support » bug
Status: Needs review » Needs work
iLLin’s picture

FileSize
1.27 KB

Give this file a try. I haven't tested this so if you get errors I'm sorry :) but it looks right lol.

iLLin’s picture

FileSize
1.32 KB

Sorry wrong file. This should be the correct one.

chefnelone’s picture

sorry, but still not working.

The modal box text is:


Page Not Found.

The following page es/servicios was not found.

iLLin’s picture

OK, I did a base install with languages turned on. I think I got it figured out. Here is a patch against the latest -dev release.

iLLin’s picture

Status: Needs work » Needs review
chefnelone’s picture

Status: Needs review » Closed (fixed)

It works, thanks for your time.

bennos’s picture

Status: Closed (fixed) » Needs work

does not work for me.

Fatal error: Call to undefined function language_url_split_prefix() in /data/disk/devel/distro/001/drupal-7.14.2-dev/sites/www.domain.com/modules/colorbox_node/colorbox_node.module on line 81

Looks like it only works when a path prefix is set, but I do not have it set. Standard language is german and second is english.

Changing the status back to needs work.

iLLin’s picture

Status: Needs work » Needs review
FileSize
584 bytes

Hmmm, I can change the function to check if that function exists instead as its included with the locale.inc file. Maybe that file is only included if your using prefixes? Not sure, try this patch against 2.x-dev and then I will backport to 1.x.

bennos’s picture

tried it out.
Updated the module to 2.x, applied patch and cleared all caches.

get a lot of ajax errors
[{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"at_codex","theme_token":"jDuIO4DJVr3hl7IB-E1x1zsgNFOY3HWGFePsBL5r0OM"},"colorbox":{"opacity":"0.85","current":"{current} von {total}","previous":"\u00ab Zur\u00fcck","next":"Weiter \u00bb","close":"Schlie\u00dfen","maxWidth":"100%","maxHeight":"100%","fixed":true,"__drupal_alter_by_ref":["default"]},"overlay":{"paths":.....

iLLin’s picture

You need to apply different classes for the 2.x version. That is why you have JSON output. Remove the colorbox-load class and add use-ajax in its place.

bennos’s picture

ah ok, but it does not work with the new classes.
not json output, a parsing error.

Ein AJAX-HTTP-Fehler ist aufgetreten
HTTP-Rückgabe-Code: 200
Im Folgenden finden Sie Debugging-Informationen.
Pfad: /node/9042?width=600&height=600
Statustext: parsererror
Antworttext:
var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);
doppelter Test | OM - Manager
@import url("http://www.domain.com/modules/system/system.base.css?m4fq43");
@import url("http://www.domain.com/modules/system/system.menus.css?m4fq43");
@import url("http://www.domain.com/modules/system/system.messages.css?m4fq43");
@import url("http://www.domain.com/modules/system/system.theme.css?m4fq43");
@import url("http://www.domain.com/sites/www.domain.com/modules/jquery_update/replace...");
@import url("http://www.domain.com/sites/www.domain.com/modules/jquery_update/replace...");
@import url("http://www.domain.com/modules/overlay/overlay-parent.css?m4fq43");
@import url("http://www.domain.com/sites/www.domain.com/modules/jquery_update/replace...");
@import url("http://www.domain.com/sites/www.domain.com/modules/jquery_update/replace...");
@import url("http://www.domain.com/sites/www.domain.com/modules/jquery_update/replace...");
@import url("http://www.domain.com/modules/book/book.css?m4fq43");
@import url("http://www.domain.com/modules/comment/comment.css?m4fq43");
@import url("http://www.domain.com/sites/www.domain.com/modules/date/date_api/date.cs...");
@import url("http://www.domain.com/sites/www.domain.com/modules/date/date_popup/theme...");
@import url("http://www.domain.com/sites/www.domain.com/modules/date/date_repeat_fiel...");
@import url("http://www.domain.com/modules/field/theme/field.css?m4fq43");
@import url("http://www.domain.com/sites/www.domain.com/modules/ideal_comments/theme/...");
@import url("http://www.domain.com/sites/www.domain.com/modules/logintoboggan/loginto...");
@import url("http://www.domain.com/modules/node/node.css?m4fq43");
@import url("http://www.domain.com/sites/www.domain.com/modules/om_maximenu/css/om_ma...");
@import url("http://www.domain.com/modules/user/user.css?m4fq43");
@import url("http://www.domain.com/sites/www.domain.com/modules/views/css/views.css?m...");
@import url("http://www.domain.com/sites/www.domain.com/modules/cctags/cctags.css?m4fq43");
@import url("http://www.domain.com/sites/www.domain.com/modules/colorbox/styles/defau...");
@import url("http://www.domain.com/sites/www.domain.com/modules/ctools/css/ctools.css...");
@import url("http://www.domain.com/sites/www.domain.com/modules/ganttView/ganttview.c...");
@import url("http://www.domain.com/sites/www.domain.com/modules/kaltura/style/kaltura...");
@import url("http://www.domain.com/sites/www.domain.com/modules/panels/css/panels.css...");
@import url("http://www.domain.com/sites/www.domain.com/modules/rate/rate.css?m4fq43");
@import url("http://www.domain.com/sites/www.domain.com/modules/shorten/shortener/sho...");
@import url("http://www.domain.com/sites/www.domain.com/modules/views_table_highlight...");
@import url("http://www.domain.com/sites/www.domain.com/modules/flag_solved/theme/fla...");
@import url("http://www.domain.com/sites/www.domain.com/modules/panels/plugins/layout...");
@import url("http://www.domain.com/sites/www.domain.com/modules/field_collection/fiel...");
@import url("http://www.domain.com/modules/filter/filter.css?m4fq43");
@import url("http://www.domain.com/sites/www.domain.com/modules/field_group/field_gro...");
@import url("http://www.domain.com/sites/www.domain.com/files/ctools/css/dd40f13e1e57...");
@import url("http://www.domain.com/sites/www.domain.com/modules/om_maximenu/skin/no_s...");
@import url("http://www.domain.com/sites/www.domain.com/themes/adaptivetheme/at_core/...");
@import url("http://www.domain.com/sites/www.domain.com/themes/adaptivetheme/at_core/...");
@import url("http://www.domain.com/sites/www.domain.com/themes/adaptivetheme/at_core/...");
@import url("http://www.domain.com/sites/www.domain.com/themes/at_codex/css/styles.ba...");
@import url("http://www.domain.com/sites/www.domain.com/themes/at_codex/css/styles.se...");
@import url("http://www.domain.com/sites/www.domain.com/themes/at_codex/css/styles.mo...");
@import url("http://www.domain.com/sites/www.domain.com/files/color/at_codex-9aac2a88...");
@import url("http://www.domain.com/sites/www.domain.com/files/adaptivetheme/at_codex_...");
@import url("http://www.domain.com/sites/www.domain.com/files/adaptivetheme/at_codex_...");
@import url("http://www.domain.com/sites/www.domain.com/files/adaptivetheme/at_codex_...");
@import url("http://www.domain.com/sites/www.domain.com/files/adaptivetheme/at_codex_...");
jQuery(document).ready(function($){
$('#om-maximenu-main-menu li.om-leaf .om-maximenu-content').removeClass('om-maximenu-content-nofade');
//$('#om-maximenu-main-menu li.om-leaf').hover(omFadeIn,omFadeOut); //native jquery
$('#om-maximenu-main-menu li.om-leaf').hoverIntent({
over: omFadeIn,
timeout: 1000,
out: omFadeOut
});
function omFadeIn(){ $('.om-maximenu-content.closed', this).fadeIn();}
function omFadeOut(){ $('.om-maximenu-content.closed', this).fadeOut();}
});
jQuery(document).ready(function($){
if ($('#om-maximenu-main-menu').hasClass('om-maximenu-row')) {
var wrapper = $('#om-maximenu-main-menu .om-menu-ul-wrapper'),
wrapper_width = wrapper.width(),
ul = $('#om-menu-main-menu'),
ul_width = 0;
$('#om-menu-main-menu .om-leaf').each(function(index) {
ul_width += parseInt($(this).width(), 10);
});
// this will only be triggered when links won't fit inside the wrapper
if (ul_width > wrapper_width) {
var wrapper_height = 30,
li_first = ul.find('li:first-child').width(),
li_last = ul.find('li:last-child').width();
wrapper.height(wrapper_height + 'px');
$('#om-menu-main-menu-ul-wrapper').css('margin', '0 30px');
$('#om-menu-main-menu').css('position', 'absolute');
// scroll adjustment to end link
ul.width(ul_width + 30 + 'px')
wrapper.css({overflow: 'hidden'});
$('#om-maximenu-main-menu').prepend('');
$('#om-maximenu-main-menu').append('>');
$('#om-maximenu-main-menu').serialScroll({
target:'#om-menu-main-menu-ul-wrapper',
items:'li.om-leaf',
prev:'div.om-menu-previous',
next:'div.om-menu-next',
axis:'xy',
navigation:'',
duration: 250,
force:true,
onBefore:function( e, elem, $pane, $items, pos ){
e.preventDefault();
if( this.blur ) this.blur();
},
onAfter:function( elem ){
//'this' is the element being scrolled ($pane) not jqueryfied
}
});
}
}
else if ($('#om-maximenu-main-menu').hasClass('om-maximenu-column')) {
var wrapper = $('#om-maximenu-main-menu .om-menu-ul-wrapper'),
wrapper_height = wrapper.height(),
ul = $('#om-menu-main-menu'),
ul_height = 0;
$('#om-menu-main-menu .om-leaf').each(function(index) {
ul_height += parseInt($(this).height(), 10);
});
// this will only be triggered when links won't fit inside the wrapper
if (ul_height > wrapper_height) {
var wrapper_width = wrapper.width(),
li_first = ul.find('li:first-child').height(),
li_last = ul.find('li:last-child').height();
$('#om-menu-main-menu').css('position', 'absolute');
// scroll adjustment to end link
ul.height(ul_height + 30 + 'px');
wrapper.css({overflow: 'hidden'});
$('#om-maximenu-main-menu').prepend('^');
//$('#om-maximenu-main-menu').append('v');
$('v').insertAfter(wrapper);
$('#om-maximenu-main-menu .om-menu-scroller').width(wrapper_width);
$('#om-maximenu-main-menu').serialScroll({
target:'#om-menu-main-menu-ul-wrapper',
items:'li.om-leaf',
prev:'div.om-menu-previous',
next:'div.om-menu-next',
axis:'xy',
navigation:'',
duration: 250,
force:true,
onBefore:function( e, elem, $pane, $items, pos ){
e.preventDefault();
if( this.blur ) this.blur();
},
onAfter:function( elem ){
//'this' is the element being scrolled ($pane) not jqueryfied
}
});
}
}
});
jQuery.extend(Drupal.settings, {"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"at_codex","theme_token":"5XBFgh4LBiHJXM3eMBtsObl_NH30pw4iYoxO87PM4xU","js":{"sites\/www.domain.com\/modules\/wysiwyg\/wysiwyg.js":1,"sites\/www.domain.com\/modules\/jquery_update\/replace\/jquery\/jquery.min.js":1,"misc\/jquery.once.js":1,"misc\/drupal.js":1,"sites\/www.domain.com\/modules\/jquery_update\/replace\/ui\/ui\/minified\/jquery.ui.core.min.js":1,"sites\/www.domain.com\/modules\/jquery_update\/replace\/ui\/ui\/minified\/jquery.ui.widget.min.js":1,"sites\/www.domain.com\/modules\/jquery_update\/replace\/ui\/external\/jquery.cookie.js":1,"sites\/www.domain.com\/modules\/jquery_update\/replace\/misc\/jquery.form.js":1,"misc\/jquery.ba-bbq.js":1,"modules\/overlay\/overlay-parent.js":1,"sites\/www.domain.com\/modules\/jquery_update\/replace\/ui\/ui\/minified\/jquery.ui.button.min.js":1,"sites\/www.domain.com\/modules\/jquery_update\/replace\/ui\/ui\/minified\/jquery.ui.mouse.min.js":1,"

iLLin’s picture

Can you paste your link markup?

bennos’s picture

Input:
<a class="use-ajax colorbox-node" href="/node/[nid]?width=600&height=600">[title]</a>

It is an views field, and [nid] gets replaced with the node id.

Output
<a class="use-ajax colorbox-node ajax-processed colorboxNode-processed" href="/colorbox/node/9042?width=600&height=600">doppelter Test</a>

iLLin’s picture

OK, I figured out that problem. The use-ajax link is firing before the colorbox-node has time to rewrite the URL so it was never re-writing. I basically copied the JS from misc/ajax.js to attach the AJAX stuff to it, over to the colorbox_node.js file so it will fire in order. Apply this patch against the latest 2.x-dev version and then clear you javascript cache.

iLLin’s picture

Oh, you only need to add ONE class to your link now. Remove the 'use-ajax' class and only use 'colorbox-node'.

bennos’s picture

patch applied and the css classes removed.

cool thing, it works.

let me test more. When I found bugs, i will post ist,

iLLin’s picture

Status: Needs review » Fixed

Committed to lastest -dev releases.

harrrrrrr’s picture

Status: Fixed » Needs review
FileSize
713 bytes

Hello iLLin,

I needed to add following changes in orde to render the pages in the correct (current) language, otherwise they were renderend in the default language.

This patch adds the lang prefix in front of the colorbox link, that does the job for me.

iLLin’s picture

Status: Needs review » Needs work

Hmm, I don't know about this as I have a test site with prefixes turned on and it works fine for me. I think you are creating your link wrong as it should already contain the prefix and automatically be included. There shouldn't be a need to add it again.

iLLin’s picture

Status: Needs work » Postponed (maintainer needs more info)
iLLin’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Please re-open if you still encounter issues around languages.

mErilainen’s picture

Version: 7.x-1.x-dev » 7.x-2.4
Assigned: iLLin » Unassigned
Status: Closed (fixed) » Active

I cannot get this to work. Or it's unclear how I should form my link. Should I include the prefix in a view rewrite or not? I hope not, because I'm using the same view for different languages, all the labels etc. have been translated.

Currently I'm generating the link like this:
<a class="colorbox-node" href="/node/[nid]?width=70%&height=80%">Link</a>

If I change languages, the link always looks the same when hovering over it. I always get my content inside the colorbox in Finnish, which is the default language. If I add the "en" prefix in views rewrite, content still pops out in Finnish.

iLLin’s picture

You need to add the prefix to your link like this.

<a class="colorbox-node" href="[prefix]/node/[nid]?width=70%&height=80%">Link</a>

It seems you are worried about it being in a view and you don't want to manually set the prefix? You should be able to grab that token for your rewrite, just add it to your view and exclude it from display. Then its dynamic. You could also just use the "NODE LINK" field and just click the checkbox "use colorbox" and it will do it automatically for you.

mErilainen’s picture

Well my problem was more about the link not working, with or without the prefix. I didn't even try yet to add it dynamically, but adding it manually didn't change the language inside the popup.

I also tried to add the link like you mentioned with the Content: Link field and then choosing "Display the content inside of a colorbox." Then the prefix appears dynamically but my content inside the popup is still in Finnish all the time. If I open the content without node popup I get all the labels etc. in English.

Which reminds me that the content type I want to open in the popup is not translated, only the labels and such should appear translated.

iLLin’s picture

Try using the alias and not an actual node id. The node id will always map to w/e language its in and not the linked one.

mErilainen’s picture

I'm not sure if I follow. Using alias when I create the link manually in views field rewrite?

Like I said, if I use the "Content: Link" field which gives me the option to display content inside colorbox, then I do get the aliased path with the right prefix, but still content always comes in the default language, no matter if the link has prefix or not.

Could this be somehow related to content language vs. interface language? Because the content type doesn't have translation enabled, but we have translated the interface, meaning labels, prefixes/suffixes etc.

mErilainen’s picture

Priority: Normal » Major

Bumping up to major. Using the "Content: Path" will give me the proper alias with prefix, but still content is always displayed in site's default language. Copy-pasting the alias to browser's address bar to open the node without colorbox opens the node in the right language, so colorbox is losing come context here.

mErilainen’s picture

Assigned: Unassigned » mErilainen
Status: Active » Needs work
FileSize
1.89 KB

I found a possible fix. When I altered the colobox_node.js to include the path prefix before the /colorbox/ in the path when opening the popup, it works. So here is my patch, now the path prefix appears twice, but it seems to work anyway. Somebody who is more experienced in jQuery can probably do it in the proper way.

iLLin’s picture

You are doing something wrong. I have tested this in views and everything works for me. Something is setup wrong on your end.

mErilainen’s picture

That's a brave claim. What you are saying is that you have tested this in every possible configuration and I have not tried to read the instructions or I cannot follow them properly, even after the discussion here.

My content type is not using any "Multilingual support" option, because everything is imported from a XML feed and only the field labels etc. are translated in Drupal. I can test this on vanilla Drupal, but it's quite complicated setup and still I got it working when the language prefix is in the proper place (which is before /colorbox/). By the way, in your setup, do you get the prefix before or after "/colorbox/"? Because if it comes before, then I agree there is something messing in my setup and the problem is probably not in colobox_node.

iLLin’s picture

Status: Needs work » Closed (works as designed)
iLLin’s picture

Issue summary: View changes

as

kostask’s picture

Issue summary: View changes
Status: Closed (works as designed) » Needs work

I am having the same problem.

My use case is: I am using Entity translation and the default language has no language prefix. I want the colorbox node to be used in views. I cannot use the 'use colorbox' checkbox via views ui as I am not using the drupal default title but the title field that has no such option.

A solution that I found to tackle this problem is:

To change the line 34 of colorbox_node.js from

var base_path = Drupal.settings.basePath;

to

var base_path = Drupal.settings.basePath + Drupal.settings.pathPrefix;

The Drupal.settings.pathPrefix contains the right language prefix. That is a prefix if the language has a prefix or is empty if the language has no prefix.

What do you think about the above solution? If you like it I can roll a patch with it.

iLLin’s picture

Patch needs to be rerolled against the latest DEV version. Please note that I needed to add in a Clean URL check so take that into account when re-rolling.

jenshk’s picture

#56 works for me.

kostask’s picture

Assigned: mErilainen » kostask
Status: Needs work » Needs review
Issue tags: +entity translation
FileSize
736 bytes

Although the solution that I proposed at #56 solved my particular use case and jenshk's as it seems, it introduces a new bug:

The pathPrefix is added to all links thus making node/1 and fr/node/1 load only on the default language if invoked from the /node page and only on the french language if invoked from the fr/node page.

A workaround would be to keep the same ajax callback (colorbox/node/1 and colorbox/fr/node/1) and make sure that the content in the correct language is loaded.

The colorbox_node_url_load function already deals with the language, so setting the global $language_content to the language seems to be enough to solve the fields language problem.

jurgenhaas’s picture

#56 works well for me too

iLLin’s picture

iLLin’s picture

Status: Needs review » Fixed

Reopen, if the above does not fix this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.