Image Assist and Panels

DustWolff - April 26, 2009 - 20:37
Project:Image Assist
Version:6.x-2.0-alpha4
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs work
Description

After continuously using the latest Panels release, we started encountering errors when adding panes to panels, well, not so much an error as a parsing crash or javascript crash. Instead of adding a block to a pane, it returned with text that appeared as if it were returning syntax rather than adding a block.

{ "type": "add", "region": "#panel-pane-top", "id": "#panel-pane-new-1", "output": "\x3cdiv class=\"panel-pane\" id=\"panel-pane-new-1\"\x3e\x3cdiv class=\"grabber\"\x3e\x3cspan class=\"buttons\"\x3e\x3ca href=\"/panels/ajax/hide/7/new-1\" class=\"panels-ajax-link pane-toggle-shown-link panels-no-modal\" title=\"Hide \x26quot;Networks Welcome Banner\x26quot;\" alt=\"Hide \x26quot;Networks Welcome Banner\x26quot;\"\x3e\x3cimg src=\"/sites/all/modules/panels/images/icon-hidepane.png\" alt=\"\" title=\"\" width=\"16\" height=\"16\" /\x3e\x3c/a\x3e\x3ca href=\"/panels/ajax/configure/7/new-1\" class=\"panels-ajax-link pane-configure-link\" title=\"Configure settings for \x26quot;Networks Welcome Banner\x26quot;\" alt=\"Configure settings for \x26quot;Networks Welcome Banner\x26quot;\"\x3e\x3cimg src=\"/sites/all/modules/panels/images/icon-configure.png\" alt=\"\" title=\"\" width=\"16\" height=\"16\" /\x3e\x3c/a\x3e\x3ca href=\"/\" class=\"pane-delete\" id=\"pane-delete-panel-pane-new-1\" title=\"Delete pane \x26quot;Networks Welcome Banner\x26quot;\" alt=\"Delete pane \x26quot;Networks Welcome Banner\x26quot;\"\x3e\x3cimg src=\"/sites/all/modules/panels/images/icon-delete.png\" alt=\"\" title=\"\" width=\"16\" height=\"16\" /\x3e\x3c/a\x3e\x3c/span\x3e\x3cspan class=\"text\"\x3eNetworks Welcome Banner\x3c/span\x3e\x3c/div\x3e\x3cdiv class=\"panel-pane-collapsible\"\x3e\x3ch2 class=\"title\"\x3eNetworks Welcome Banner\x3c/h2\x3e\x3cdiv class=\"content\"\x3e\x3cem\x3eDynamic content previews have been disabled to improve performance and stability for this editing screen.\x3c/em\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e" }

We had searched all over the internet and drupal forums that pointed us in several different directions, including Advanced Profile Kit, Javascript crash in Firefox, etc. But we're not utilizing Advanced Profile Kit, the error appears in Google Chrome, IE and Firefox, so it doesn't appear to just be a firefox issue.

We methodically disabled modules and tested panels to isolate the issue and came down to Image Assist, any feedback on this? Has anyone else encountered this problem?

#1

DustWolff - April 26, 2009 - 21:11

We seemed to have isolated it down to this function:

Drupal.theme.prototype.img_assist_link = function(el) {
var html = '<div class="img_assist-button">', link = Drupal.t('Add image');
if (Drupal.settings.img_assist.link == 'icon') {
   link = '<img src="'+ Drupal.settings.basePath + Drupal.settings.img_assist.icon +'" alt="'+ link +'" title="'+ link +'" />';
}
html += '<a href="'+ Drupal.settings.basePath +'index.php?q=img_assist/load/textarea&textarea='+ el.name +'" class="img_assist-link" id="img_assist-link-'+ el.id +'" title="'+ Drupal.t('Click here to add images') +'" onclick="window.open(this.href, \'img_assist_link\', \'width=600,height=350,scrollbars=yes,status=yes,resizable=yes,toolbar=no,menubar=no\'); return false;">'+ link +'</a>';
html += '</div>';
return html;
}

when this is commented out, image assist can be enabled and we can safely add blocks to panes

#2

DustWolff - April 26, 2009 - 21:19

adding a Try/Catch seems to fix the error:

Drupal.theme.prototype.img_assist_link = function(el) {
var html;
try{
html = '<div class="img_assist-button">', link = Drupal.t('Add image');
if (Drupal.settings.img_assist.link == 'icon') {
link = '<img src="'+ Drupal.settings.basePath + Drupal.settings.img_assist.icon +'" alt="'+ link +'" title="'+ link +'" />';
}
html += '<a href="'+ Drupal.settings.basePath +'index.php?q=img_assist/load/textarea&textarea='+ el.name +'" class="img_assist-link" id="img_assist-link-'+ el.id +'" title="'+ Drupal.t('Click here to add images') +'" onclick="window.open(this.href, \'img_assist_link\', \'width=600,height=350,scrollbars=yes,status=yes,resizable=yes,toolbar=no,menubar=no\'); return false;">'+ link +'</a>';
html += '</div>';
} catch {}
return html;
}

#3

sun - May 17, 2009 - 12:57

#4

naught101 - June 25, 2009 - 07:25
Status:active» needs review

This seems to work for me too. It also makes the "input formats" field expandable for me (previously, this wasn't even a link, and I couldn't change it).

#5

Justin W Freeman - June 30, 2009 - 02:07

On the panels page do you get a js error in firefox that says "Drupal.settings.img_assist is not defined"?

If so this is possibly the same issue as #428950: Javascript error when editing views or panels.

#6

naught101 - June 30, 2009 - 06:58

no, I don't get that error Justin. Probably a different bug.

#7

bigbob446 - September 3, 2009 - 07:29

FYI this still seems to be an issue with Panels 3. but disabling image attach seems to work.

#8

lazly - October 26, 2009 - 20:02
Status:needs review» reviewed & tested by the community

This patch tested by me and works fine, thanx the work.
I maded a patch file, so if somebody want use it its simple.

AttachmentSize
img_assist.js_.patch 1.62 KB

#9

lazly - October 26, 2009 - 22:33
Version:6.x-2.0-alpha3» 6.x-2.0-alpha4
Status:reviewed & tested by the community» needs work

Sorry my last post. The patch isn't work, fix this bug, but if use image_assist icon will disapear from edit screens.

#10

lazly - October 26, 2009 - 22:34
Priority:normal» critical

#11

chrism2671 - November 25, 2009 - 18:14

Subscribing.

 
 

Drupal is a registered trademark of Dries Buytaert.