Project:Image Assist
Version:6.x-3.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs review

Issue Summary

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?

Comments

#1

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

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

#4

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

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

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

#7

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

#8

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

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

Priority:normal» critical

#11

Subscribing.

#12

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.

#13

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?

#14

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.

nobody click here