Forums / Extensions / ezodf : importing an .odt section

ezodf : importing an .odt section

Author Message

Pascal France

Saturday 08 May 2010 7:50:54 am

Hi,

In the PDf doc of the ezodf extension it is said that we can define a section in the .odt file and then import it in a specific class attribute.

I've defined an «intro» section in my .odt document which contains a simple ligne of text.

My class «article» contains an attribute «intro»

But I don't understand what I need to configure in odf.ini.append.php to import the content of the .odt intro section in the intro attribute of the class.

Thanks for your help

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Robin Muilwijk

Saturday 08 May 2010 11:28:44 am

Hi Pascal,

Did you check on http://share.ez.no/tutorials/ez-publish/import-export-from-odf/%28page%29/3 and the link mentioned there to http://ez.no/doc/extensions/odf_import_export ? If you check the odf.ini.append.php file in a default install you will also see how to accomplish this.

Regards Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Pascal France

Saturday 08 May 2010 2:28:33 pm

Hi Robin,

Thanks for your reply.

In your first link, all seems clear: on the left, the class attribute, on the right, the odt section name... This is what we can understand reading the comments in the odf.ini file.

So, here is my odf.ini section:

ClassAttributeMappingToHeader=enabled

[frontpage]
DefaultImportTitleAttribute=name
DefaultImportBodyAttribute=corps_article
Attribute[name]=name
Attribute[intro]=intro
Attribute[corps_article]=body
Attribute[image]=image
Attribute[caption]=caption
Attribute[publish_date]=publish_date
Attribute[unpublish_date]=unpublish_date

In fact, what I don't understand is that the first two lines are mandatory because otherwise I obtain a PHP fatal error message and, consequently, all other lines are strictly useless and can be removed without effect.

Here is where I am.

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Robin Muilwijk

Sunday 09 May 2010 11:19:30 am

Hi Pascal,

Are you saying that with the ini configuration posted above the import is not working? The intro section from the odt document is not imported to the intro attribute of your content class/object?

Regards Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Pascal France

Sunday 09 May 2010 2:49:13 pm

Hi Robin,

Yes. You have absolutely well understood what I've meant.

The only config which works is:

[frontpage]
DefaultImportTitleAttribute=name
DefaultImportBodyAttribute=corps_article

Nothing else is needed and nothing else works. The Attribute[xxx]=xxxx lines are totally useless.

Cordially,

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Robin Muilwijk

Wednesday 12 May 2010 11:41:46 am

Time to take a step back, what if you try to export/import with a default class, if you have any available on the site? Does that work? What I would like to know is if export/import works at all.

-- Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Pascal France

Friday 14 May 2010 5:02:16 pm

Hi Robin,

Sorry for the delay...

Well, here is my environment:

Debian 2.6.32.3 x86_64 GNU/Linux
mysql-server 5.1.46-1
php5 5.2.11.dfsg.1-2
apache2 2.2.15-2
eZ Publish 4.3.0 with ezComponents from scratch
Website Interface (ez webin)
Admin2 interface

My ODT document:

  1. An «intro» section which contains:
    Mon intro
  2. A «body» section which contains:
    Titre 2
    Pascal

When I import this document, I get a new article where "Mon intro" and "Titre2 - Pascal" are both in the body attribute of my article class object.

Normally, I should obtain an article which contains:

  1. "Mon intro" in its default intro attribute
  2. "Titre2 - Pascal" in its default body attribute

Does it answer your question ?

The sections in my ODT document are realised with "Insert" -> "Section..." and I give a name to my section.

Cordially,

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Robin Muilwijk

Sunday 16 May 2010 10:53:19 am

Hi Pascal,

How did you name the sections on your odt file? I assume with a matching name you set in the ini file? It's a difficult problem to tackle, I'm in doubt if this is a bug some kind of other problem.

-- Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Pascal France

Sunday 16 May 2010 4:22:59 pm

Hi Robin,

Here is 3 screenshots illustrating how I create a section in an .odt document:

http://linuxorable.fr/test/ODT/ODT_section_1.png

http://linuxorable.fr/test/ODT/ODT_section_2.png

http://linuxorable.fr/test/ODT/ODT_section_3.png

In this example I create a section named «intro» because the default class used to create an object via «Import odt document» contains an «intro» attribut. Moreover, the default /extension/ezodf/settings/odf.ini.append.php file contains:

[article]
DefaultImportTitleAttribute=title
DefaultImportBodyAttribute=body
Attribute[title]=title
Attribute[intro]=intro  <======== THIS LINE
Attribute[body]=body
Attribute[image]=image
Attribute[caption]=caption
Attribute[publish_date]=publish_date
Attribute[unpublish_date]=unpublish_date

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Robin Muilwijk

Tuesday 18 May 2010 11:46:57 am

Hi Pascal,

Everything looks ok to me, I'm out of ideas. I'll ask for some help on this one.

Regards Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Pascal France

Tuesday 18 May 2010 2:02:40 pm

Hi Robin,

Could you give me some information about the environment you are working with ?

From my part, I'm using OOo 3.2.1~rc1-2.deb

And could you send me an odt file which works for you ( advil4005 AT gmail DOT com)

Thank you in advance,

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Nicolas Pastorino

Wednesday 19 May 2010 1:28:47 am

Hi Pascal,

It seems like one configuration directive might come in the way 'ClassAttributeMappingToHeader'. Could you try the following modification :

[ODFExport]
ClassAttributeMappingToHeader=disabled

Let us know,
Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Pascal France

Wednesday 19 May 2010 5:06:09 pm

Hi Nicolas ;-)

This has no effect.

Btow, ClasseAttributeMappingToHeader is a parameter of the export section now my problem concerns the import of an odt document.

The best way to determine if my environment is the origine of the trouble would be that I could test an odt file which works for someone else.

Regards,

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Pascal France

Friday 21 May 2010 9:35:20 am

Hi,

I continue to look for the reasons of the dysfunction of the extension.

I tried with an .odt file created with OOo under Windows, but the result is always the same.

[ODFImport]
# Default class for import
DefaultImportClass=article
# Default class for making an image
DefaultImportImageClass=image
RegisteredClassArray[]=article
RegisteredClassArray[]=folder
RegisteredClassArray[]=image
RegisteredClassArray[]=documentation_page
RegisteredClassArray[]=blog_post
ImportedImagesMediaNodeName=Imported images
PlaceImagesInMedia=false
OOConverterPort=9090
# Currently only localhost (127.0.0.1) is allowed
OOConverterAddress=127.0.0.1

[article]
DefaultImportTitleAttribute=name
DefaultImportBodyAttribute=resume <== THIS LINE
Attribute[name]=name
Attribute[resume]=intro
Attribute[corps_article]=body
Attribute[image]=image
Attribute[caption]=caption
Attribute[publish_date]=publish_date
Attribute[unpublish_date]=unpublish_date

The only thing which has an effect is to modify the name of the class attribute (see THIS LINE above) which will contain all the sections of my .odt file.

I am discouraged ;-) not to manage to run this extension.

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Robin Muilwijk

Friday 21 May 2010 1:39:20 pm

Hi Pascal,

I have OO 3.2 on Windows. I'll send you an odt to your mail which should work, if it doesn't let me know and I'll send another one.

-- Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Pascal France

Friday 21 May 2010 3:27:12 pm

Robin, can I tell you that you are my savior ! ;-)

Thanks a lot for your odt file.

Now, I think (I think...) that I understand how this extension works.

First, the odt file needs to contain as many sections as the object class (even if some sections are left empty in the odt file). If this is not the case, another object class will be used to create the new imported object.

Second, the object class defined in the odf.ini file must contain as many sections as the object class too. If this is not the case, another object class will be used to create the new imported object.

Last, in the odt file the right date format is: 2010/05/21 23:36

Thank you still for your help and your patience,

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish

Robin Muilwijk

Friday 21 May 2010 11:54:46 pm

Hi Pascal,

Does the above mean you are closer to a solution, or do you actually have it working now? I do see you marked the topic as solved :)

-- Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Pascal France

Saturday 22 May 2010 4:34:54 am

Hi Robin,

Thanks to your odt file which also works at home I was able to understand how works the extension.

Regards

Pascal

Ce qui embellit le désert c'est qu'il cache un puits... quelque part... (A. de Saint-Exupéry) - http://luxpopuli.fr/eZ-Publish