#5 — Kupu compatibility

State Resolved
Version: ploneglossary-1.4.0
Area User interface
Issue type Bug
Severity Medium
Submitted by Guillaume CHARAVEL
Submitted on Aug 03, 2010
Responsible Alter Way Solutions
Target release:
Plone 3.3.5 (kupu 1.4.16).
Tested on IE6 / IE7 / FF 3.5.9

The edit form encounters bug due to glossary Highlightment of the kupu configuration. It seems that it happens on items whose id correspond to a glossary definition.

Depending on browsers, result is different but quite unpleasant. On FF for exemple, kupu drawers are unavailable. A pop-up with "Error 404 loading [object Object]mediaobject" appears when trying to insert a image .
Steps to reproduce:
Add a glossary (title doesn't matter) and a definition titled "def".
Add a newsItem (that's for the exemple) titled "def" (what really matters here is the identifier but plone standard behaviour should give you a "def" identifier).

Make sure you have highlight enabled on news Items and that the glossary is in the scope of your news.

Edit your news. Insert an image.
Added by Alter Way Solutions on Aug 11, 2010 09:25 AM
Issue state: UnconfirmedConfirmed
Responsible manager: (UNASSIGNED)ingeniweb
Please attach and explain your patch to that issue
Added by Guillaume CHARAVEL on Aug 11, 2010 11:53 AM
So my ugly quick and dirty patch:

Changed ploneglossary.js to enable filtering on specific Tag Ids (tag only by default). In the highlight_related_term_in_node function replace

// Don't dig into unauthorized keys
tag_name = node.nodeName.toLowerCase();

for (i=0;i<unauthorized_tags.length;i++) {
unauthorized_tag_name = unauthorized_tags[i].toLowerCase();
if (tag_name == unauthorized_tag_name) {
return false;
}
}

By

    // Don't dig into unauthorized keys
    tag_name = node.nodeName.toLowerCase();
    try {tag_id = node.attributes.id.nodeValue;}
    catch (err){tag_id = '';}
    for (i=0;i<unauthorized_tags.length;i++) {
        unauthorized_tag_name = unauthorized_tags[i].toLowerCase();
        if ((tag_name == unauthorized_tag_name) || (tag_name+'#'+tag_id == unauthorized_tag_name)) {
            return false;
        }
    }

Then configure (portal_glossary not_hilhglighted_tags option) ploneGlossary to not hihglight
div#kupu-editor-text-config-escaped
div#kupu-editor-text-config

It has worked for me ... Quick and dirty as previously said.
Added by Hanno Schulz on Aug 13, 2010 09:32 AM
We've stumbled over this yesterday.

After some debugging we found it also happens, when the glossary definition exists in the domain name. Editing via IP works fine in this situation.
Added by Hanno Schulz on Aug 13, 2010 09:50 AM
Hi,

found the time to make a patch.
Used on ploneglossary.js.dtml from ver 1.4.1
Attached:
ploneglossary.js.dtml.patch — text/x-patch, 0 Kb
Added by Alter Way Solutions on Aug 16, 2010 05:56 PM
Issue state: ConfirmedResolved
Hi, thanks but the equivalent thing has already be included in the last release (1.4.2)

No responses can be added.