[SOL] eZOE - Unable to embed images after upgrade to 4.1.1

Author Message

Michael Fürst

Wednesday 13 May 2009 2:45:01 pm

Hi Guys,

Yesterday I did the update from eZ 4.1.0 to 4.1.1.
Before I did the update, i was able to add embedded images over the ezOE Editor.

Now, if i try to select an image in from the media section, i only get a grey list with the image name and no option box. It looks like if you try to link an non-valid object.

I've the following override settings in <b>/setting/override/content.ini.append.php</b>:

[RelationGroupSettings]
Groups[]=images
DefaultGroup=objects
ImagesClassList[]=artikelfoto
ImagesClassList[]=image

Besides: "artikelfoto" is another image class in my system.

To be sure that there are no overloading problems, I've added these lines directly in <b>/settings/content.ini</b> in the "[RelationGroupSettings]" section:

ImagesClassList[]
ImagesClassList[]=artikelfoto
ImagesClassList[]=image

All caches are cleared, i've enough permissions in CMS (admin) but I'm not able to add the images - they are not shown as related objects.

Does anyone know, if this is a bug in the new version? Or how I'm able to fix this problem?

Thanks in advance,
bye,
Mike

André R.

Wednesday 13 May 2009 11:10:37 pm

if you click on the object button (paperclip) do you get access to select the images then?

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Michael Fürst

Thursday 14 May 2009 2:03:21 am

Hi Andre,

Yes, inserting as object (paperclip icon) works...
If I try to insert it as Image, I get the grey-text list and no option-field to select the image.

Michael Fürst

Thursday 14 May 2009 7:25:30 am

Hm, I've tried different ways now, but no chance to get it to run...
Is there a way to debug the eZOE response?!

André R.

Thursday 14 May 2009 8:48:26 am

it's not the response that is making the selections grayed out (firebug is THE tool for debugging ajax responses btw).

In the source of the upload image dialog its the 'classFilter' javascript parameter.
It comes from $class_filter_array template variable set in ezoe/upload.php :

$contentTypeCase = ucfirst( $contentType );
if ( $contentIni->hasVariable( 'RelationGroupSettings', $contentTypeCase . 'ClassList' ) )
    $tpl->setVariable( 'class_filter_array', $contentIni->variable( 'RelationGroupSettings', $contentTypeCase . 'ClassList' ) );
else
    $tpl->setVariable( 'class_filter_array', array() );

$contentType is set by view parameter set from javascript:

$contentType   = 'objects';

if ( isset( $Params['ContentType'] ) && $Params['ContentType'] !== '' )
{
    $contentType   = $Params['ContentType'];
}

So that parameter should be 'images', and it is set to that in design/standard/javascript/themes/ez/editor_template.js in:

        _mceImage : function(ui, val)
        {
            var ed = this.editor, e = ed.selection.getNode(), eurl = 'images/', type = '/upload/', el;

            if ( ui.nodeName === 'IMG' )
                e = ui;

            if (e !== null && e.nodeName === 'IMG')
            {
                type = '/relations/';
                eurl = 'auto/'; // need to set to auto in case this is attachment icon
                el = e;
                eurl += e.getAttribute('id') + '/' + e.getAttribute('inline') + '/' + e.getAttribute('alt');
            }
            this._generalXmlTagPopup( type, eurl, 500, 480, el )
        },

Start by checking source of image dialog to see what classFilter is set to (look for classFilter.push lines).
If it is empty, then move on to check waht values you have in modules/ezoe/upload.php showed in the two first code blocks above.

Hope that helps.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Michael Fürst

Thursday 14 May 2009 9:43:51 am

Hi Andre,

Thanks... I'm going to start debuging later at night...
Another question:
Is it called

ImagesClassList[] or
ImageClassList[] (without "s")

I've seen both values already...

Cheers,
Michael

André R.

Thursday 14 May 2009 9:52:52 am

With s, see settings/content.ini:

[RelationGroupSettings]
# A list of defined relation groups, each entry
# will have a class definition setting suffixed with ClassList
# e.g. a group called images would have the setting ImagesClassList
Groups[]
Groups[]=images
Groups[]=files

# The group were all non-match classes are placed
# this is usually related folders and articles
DefaultGroup=objects

# A list of class identifiers that should be placed in the
# related image group
ImagesClassList[]
ImagesClassList[]=image

# A list of class identifiers that should be placed in the
# related files group
FilesClassList[]
FilesClassList[]=file

In admin, go to setup -> ini -> content.ini + your siteaccess, and check that the settings are ok and not overwritten somewhere.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Michael Fürst

Thursday 14 May 2009 11:23:21 am

Hi,

Hm.. everything looks pretty good if I inspect the ini settings in backend -> setup:

<b>For my Backend (site "cms"):</b>

ImagesClassList
default [0]
default [1] artikelfoto
default [2] image
override [3] artikelfoto
override [4] image

<b>For my Frontend (site "site"):</b>

ImagesClassList  	 
default [0]
default [1] artikelfoto
default [2] image
override [3] artikelfoto
override [4] image

I'm sure, it's only a small mistake... but i can't find it.
I'm going to start debuging of OE now, maybe then we know more...

Ciao,
Mike

Michael Fürst

Thursday 14 May 2009 11:26:17 am

besides - maybe that's interesting:
I'm also unable to embed objects of class "image" in OE (the standard class)... So it can't depend on the new "artikelfoto" class...

Michael Fürst

Thursday 14 May 2009 11:41:47 am

Ok, what I found out till now:
The object response on the GET request looks good (class_type of the images is "artikelfoto" as it should be).

And (whats also really interesting):
If I'm going to add an Image via direct upload in the editor, it works, but the image is not show in the article in the related objects list. There is the entry, but i can't see the image (that worked in 4.1.0).

If I'm trying to select the image over the "select" tab and browse to the media - images tree, it's the same as ever and i can't select the images. But we have to do it that way, cause our editors have to add the images as objects of class "artikelfoto" first to the media library and then add it to the article. The reason is, that we have much more attributes for our photos like "copyright" or "tags"...

Is it possible, that there is a policy problem depending on related objects?

Michael Fürst

Thursday 14 May 2009 12:01:52 pm

I think we can be sure, that it's not a configuration problem of the ini files.
I've added a debug notice in upload.php as you told me:

print_r($contentIni->variable( 'RelationGroupSettings', $contentTypeCase . 'ClassList' ));

And the output is correct:
<b>Array ( [0] => artikelfoto [1] => image )</b>
So the classes are set correct. I've no more ideas now... :(

Michael Fürst

Thursday 14 May 2009 12:34:21 pm

I found the reason, why the items are always greylisted. I debuged the file <b>/design/standard/templates/ezoe/upload_images.tpl</b>.

There I found the if statement which decides if an item can be selected or not in the "browse" view. And the variable "hasImage" is ALWAYS unset / undefined, also if the object is from class "image" or "artikelfoto". So always "node_not_image" is returned by this JS function.

Here is the part of the function with my debug output:

if ( contentType === 'images' )
{	alert('Content Type is images');
    eZOEPopupUtils.settings.browseClassGenerator = function( n, hasImage ){
    	alert('Start Function');
    	alert('n: ' + n);
    	alert('hasImage: ' + hasImage);  // <------ ALWAYS "undefined"
        if ( hasImage && classFilter.indexOf( n.class_identifier ) !== -1 ) {
            alert('1');
            return '';
        }
        if ( n.children_count ) {
            alert('2');  // <------ ALWAY EXITS HERE
            return 'node_not_image';
        }
        
        alert('3');
        return 'node_not_image node_fadeout';
    };
}

Do you know, where and how "hasImage" is set? Maybe the system doesn't recognize, that "image" and "artikelfoto" are of type "image"??

André R.

Friday 15 May 2009 1:09:51 am

hasImage is set to true if node is considered to be image in design/standard/javascrpt/ezoe/popup_utils.js

                   if ( n.image_attributes && n.data_map[ n.image_attributes[0] ] && n.data_map[ n.image_attributes[0] ].content['small'] )
                   {
                       tag = document.createElement("span");
                       tag.className = 'image_preview';
                       tag.innerHTML += ' <a href="#">' + ed.getLang('preview.preview_desc')  + '<img src="' + ed.settings.ez_root_url + n.data_map[ n.image_attributes[0] ].content['small'].url + '" /></a>';
                       td.appendChild( tag );
                       hasImage = true;
                   }

So look in the json response for the image_attributes array, this is generated in classes/ezoeajaxcontent.php, and the lines there to debug is 241 - 246 and 266, for instance is site.ini [ImageDataTypeSettings] AvailableImageDataTypes properly setup? (used for $params['imageDataTypes'] in ezoeajaxcontent.php)

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Michael Fürst

Friday 15 May 2009 5:37:56 am

Hi Andre,

First: Thanks for you support :)
Ok, I've checked the site.ini (override), and everything seems ok:

[ImageDataTypeSettings]
AvailableImageDataTypes[]=ezimage

Then I've analysed the <b>json response</b> from the server during browsing the categories in the embedded window. If i click on a category I get the following Item-List. I copied three different object types, so maybe you'll see an error:

// FIRST LIST-ITEM OF CLASS "FOLDER"
-----------------------------------------------------------
{list:[
{
"name":"Files",
"id":50,
"contentobject_id":50,
"main_node_id":52,
"modified":"1080220220",
"published":"1080220220",
"section_id":3,
"current_language":"ger-DE",
"owner_id":14,
"class_id":1,
"class_name":"Folder",
"class_identifier":"folder",
"is_container":1,
"node_id":52,
"parent_node_id":43,
"url_alias":"Media\/Files",
"depth":2,
"path":false,
"children_count":1,
"image_attributes":[],
"data_map":[]
}

// SECOND LIST ITEM OF CLASS "IMAGE"
-----------------------------------------------------------
{
"name":"Ford Fiesta",
"id":693,
"contentobject_id":693,
"main_node_id":569,
"modified":"1242326049",
"published":"1242326049",
"section_id":3,
"current_language":"ger-DE",
"owner_id":14,
"class_id":33,"class_name":"Image",
"class_identifier":"image",
"is_container":0,
"node_id":569,
"parent_node_id":51,
"url_alias":"Media\/Fotos-Bilder\/Ford-Fiesta",
"depth":3,
"path":false,
"children_count":0,
"image_attributes":["image"],
"data_map":{"image":{"id":"5705","type":"ezimage","identifier":"image","content":{"articleimage468xX":false,"articleimage170xX"
:false,"original":{"url":"var\/storage\/images\/media\/fotos-bilder\/ford-fiesta\/5705-1-ger-DE
\/Ford-Fiesta.jpe"}}}}
}

// THIRD LIST ITEM OF CLASS "ARTIKELFOTO"
-----------------------------------------------------------
{
"name":"Novak Djokovic (SRB) Rom Finale ",
"id":611,"contentobject_id":611,
"main_node_id":501,
"modified":"1241447540",
"published":"1241447540",
"section_id":3,
"current_language":"ger-DE",
"owner_id":416,
"class_id":58,
"class_name":"Artikelfoto",
"class_identifier":"artikelfoto",
"is_container":0,
"node_id":501,
"parent_node_id":500,
"url_alias":"Media\/Fotos-Bilder\/Artikelfotos\/Contentfotos-Bilder-im-Artikel\/200905\/Novak-Djokovic-SRB-Rom-Finale",
"depth":6,
"path":false,
"children_count":0,
"image_attributes":["image"],
"data_map":{"image":{"id":"4935","type":"ezimage","identifier":"image","content":{"articleimage468xX"
:false,"articleimage170xX":false,"original":{"url":"var\/storage\/images\/media\/fotos-bilder
\/artikelfotos\/contentfotos-bilder-im-artikel\/200905\/novak-djokovic-srb-rom-finale\/4935-1-ger-DE
\/Novak-Djokovic-SRB-Rom-Finale.jpe"}}}}
}

As you can see, the image_attributes are set.
Do you see any other strange thing in here?

Beside: How do you debug the ajax response? Is there an option to enable a debug window (as in xajax for example)?

Ciao,
Michael

André R.

Friday 15 May 2009 5:46:39 am

the 'small' size is missing, you don't have this size do you?

ref:

                  if ( n.image_attributes && n.data_map[ n.image_attributes[0] ] && n.data_map[ n.image_attributes[0] ].content['small'] )

A bit hardcoded, so probably the cause of the issue.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Michael Fürst

Friday 15 May 2009 6:00:20 am

I see, but where can i declare it? I don't really understand the dependencies at the moment... sorry!

Michael Fürst

Friday 15 May 2009 6:38:26 am

Hi,

Ok, after three days I've found the solution:
In <b>/settings/siteaccess/site/image.ini.append.php</b> the AliasList is new declared, and thats the reason, why the alias "small" (wich is hardcoded in ezOE) cannot be found and the images are not listet.

Here we go (image.ini.append.php):

[AliasSettings]
AliasList[] <------ RESET ALIAS LIST
AliasList[]=articleimage
AliasList[]=articleimage100x100

Solution: Just remove the AliasList[] declaration:

[AliasSettings]
#AliasList[] <------ COMMENT OUT
AliasList[]=articleimage
AliasList[]=articleimage100x100

<b>What I'm wondering:</b>
In ez 4.1.0 / ezOE 5.0.0 I had the same declaration as here in ez 4.1.1 / ezOE 5.0.1, and there I had no problems....

Andre, thanks a lot for your support!!

Cheers,
Michael

André R.

Friday 15 May 2009 7:18:40 am

No problem. I'll try to move the small out into a setting and document this in the FAQ.
But I'm not sure why it worked for you in 5.0.0, it has been like this in ezoe since the start.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Michael Fürst

Friday 15 May 2009 11:16:30 am

Yeah, or just a some debug output if the "small" alias is missing...
In 5.0.0 the small alias is also missing, but there it works... no idea why.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.