json output broken when using 1.4.2 of jQuery, this patch fixes it

CommentFileSizeAuthor
ctools-jquery142.patch1.06 KBrealityloop
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

voxpelli’s picture

As it's drupal_json() that's broken - shouldn't this be posted as a bug towards Drupal core?

merlinofchaos’s picture

Yes, but we can fix it separately too.

merlinofchaos’s picture

To be fair I haven't decided if we *should* fix it separately.

voxpelli’s picture

Status: Needs review » Needs work

Should be a back port of the functionality in Drupal 7 then I think: http://api.drupal.org/api/function/drupal_json_output/7

+++ includes/ajax.inc	5 Aug 2010 05:58:07 -0000
@@ -580,3 +580,12 @@ function ctools_ajax_associate_url_to_el
+  drupal_set_header('Content-Type: application/json; charset=utf-8');

Remove charset - according to the JSON-spec it shouldn't be there.

+++ includes/ajax.inc	5 Aug 2010 05:58:07 -0000
@@ -580,3 +580,12 @@ function ctools_ajax_associate_url_to_el
+    echo str_replace(array("\r", "\n", "<", ">", "&"), array('\r', '\n', '\u003c', '\u003e', '\u0026'), str_replace("\'","'", json_encode($var)));

Why replace \r and \n? Drupal 7 doesn't.

Powered by Dreditor.

merlinofchaos’s picture

Status: Needs work » Needs review

We looked at that. The Drupal 7 version is PHP 5 only, and we continue to support PHP4.

voxpelli’s picture

Isn't this patch PHP 5.2+ only as well? It uses json_encode().

If Ctools should support PHP 4 then this patch should look more like what is discussed in #479368: D7: Create RFC compliant HTML safe JSON.

merlinofchaos’s picture

Status: Needs review » Needs work

Um. Ok that's not the patch I thought it was. I guess realityloop took the Drupal 7 version after all instead of the Drupal 6 version of drupal_to_js().

realityloop’s picture

Status: Needs work » Postponed

I think i must have accidentally used it from pressflow.. but the patch in #6 which i reviewed yesterday fixes the issues with Views I was going to move on to after we spoke yesterday anyway so I'm pretty sure it will resolve issues with ctools as well.

merlinofchaos’s picture

I'm torn if we should just point to the core patch or implement our own until core fixes itself.

realityloop’s picture

I'd suggest pointing to the core patch as draggable sorts will still be broken in the 'content types' section under manage fields without it anyway, if implementing own fixed all D6 issues with jQuery 1.4.2 then I'd say go.. but it won't so I think the core fix is better..?

XiaN Vizjereij’s picture

Title: Support jQuery 1.4.2 » Support jQuery 1.5.2
Status: Postponed » Active

Just a quick question coming from #1067290: Fix jQuery 1.7 for Drupal 6.

A lot of users report that Panels Drag and Drop is broken after updating to jQuery 1.5.2 ( and applying the json fix to core that comes with it ).

Using Chromes DevInspector it actually seems like some CTools js is breaking after the patch. Maybe its just a small adjustment to ctools that would make it compatible. Help would be much appreciated :)

klonos’s picture

...subscribing.

merlinofchaos’s picture

I admit I have had no reason to try jquery 1.5 with Drupal 6, and I don't know what the actual differences are.

jthomasbailey’s picture

Same problem with 1.4.4, if that means anything. In 1.5.2 on the panels edit page you can drag the panels but you can't drop them anywhere. But I'm not seeing any errors, unlike #11.

I'm poking at Ctools but I still haven't found the drag and drop js, any help would be appreciated. Probably a simple solution but for now I'm swapping Jquery versions whenever I need to rearrange panels.

gcornoiu’s picture

+1

joelpittet’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Triaging the 6.x issues, it's no longer supported.