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?

CommentFileSizeAuthor
#8 img_assist.js_.patch1.62 KBlazly

Comments

C.Wolff’s picture

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

C.Wolff’s picture

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;
}
sun’s picture

naught101’s picture

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).

agileware’s picture

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.

naught101’s picture

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

bigbob446’s picture

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

lazly’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.62 KB

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

lazly’s picture

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.

lazly’s picture

Priority: Normal » Critical
chrism2671’s picture

Subscribing.

lazly’s picture

Version: 6.x-2.0-alpha4 » 6.x-3.x-dev

Bug is already alive! :\ Please if somebody have got a little time, try do it, I tried, but cant find what is the problem.

chrism2671’s picture

Sorry, what is the status of this issue at present? I can't work out from the posts above whether this is resolved or not?

chrism2671’s picture

Status: Needs work » Needs review

OK I've fixed this with the following code:

Drupal.theme.prototype.img_assist_link = function(el) {
	var html;
	html = '<div class="img_assist-button">', link = Drupal.t('Add image');
	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;
}

Caveat

This will remove the icon and leave you with just a text link- but it works. It was the icon that was causing the problem. Can somebody please review & confirm? Many thanks.