Help required for updating the eZ publish database from external application.

Author Message

Megha Barpande

Monday 14 February 2005 1:15:27 pm

Hi,

I have eZpublish 3 to publish my intranet web pages. One of the web pages displays an internal phonelist for my company.

I'm able to display the new person details when I add this information from the CMS web page. The CMS database(MySQL) is updated accordingly.

My query:

I have a phonelist application in VB 6.0, which I use to query the Exchange Server and get a list of all the address book entries. I want to populate the CMS database(MySQL) with these address book entries from my application.

I'm able to update the tables however when I try to access this person information from the CMS web page I cannot see the new person details.

I would appreciate some help regarding this. I'm unaware if I'm missing on something or some key data that is required for retrieving the record from the database.

Also if you can highlight how the CMS uses the database to retrieve information will be a great help.

Thanks for your help and assistance in advance.

Regards,
Megha B

Gabriel Ambuehl

Tuesday 15 February 2005 12:00:35 am

Look into ezcontentobject and ezcontentobjectattribute tables for starters. The schema is pretty complex to implement yourself, but interfacing to PHP code isn't possible from VB for all I know.

Maybe you could write some PHP code that reads a CSV or somethingl ike that and have VB output such?

Visit http://triligon.org

Olivier Pierret

Tuesday 15 February 2005 3:04:28 am

Hello,

I am not a specialist of EZ Publish yet and if somoeone from EZ-Team could review this post and possibly amend the content, this would be interesting for every one.

My opinion is that writing directly in the EZ database is not a good idea for the following reasons:
- while doing this, you actually bypass the abstraction layer of EZ Publish hence you might insert wrongly formatted data that later may appear unusable or you can event corrupt your database
- if you upgrade to a newer version of EZ Publish, the database structure might change and would make your import script not working anymore (data corrupting again is a possibility in this case)
- If you change the database (mysql to Oracle for instance) you might have to rework your script procedure

An alternate way to import data into ez-publish would be to export your external data to XML and then write a procedure as an extension that will parse this XML files and import the content as a series of ez publish objects.

I have written and tested such an extension. I consider contribute this code to the community if some people find it useful but it is not packaged yet.

Thank you for any feedback on this

regards

Olivier

 

Paulo Almeida

Tuesday 15 February 2005 8:17:01 am

I'm not favor to write in DB directly, but i'm favor to read data from DB.

My needs ate the moment for example:

I have a intranet working with ez, now i need to access DB directly to any report designer (Crystal Reports, JasperReports , etc), and a public schema helps a lot.
I know i can write a template for this, but i want give to the user the chance of change the report for their needs in the moment withou my interference.

Regards,
Paulo Almeida
PACPI.COM

PACPI.COM Internet Consulting
http://pacpi.com

Gabriel Ambuehl

Tuesday 15 February 2005 8:47:31 am

Olivier: I'd love to see such code contributed!

Visit http://triligon.org

Megha Barpande

Tuesday 15 February 2005 12:52:37 pm

Hi Olivier,

Thanks for the suggestion. Can you please contribute that code to community and also assist where I can find it? It would be a great help really.

Thanks,
Megha B

Olivier Pierret

Wednesday 16 February 2005 12:26:33 am

Hello

I will try to contribute the code on this site but I don't know yet how to contribute in the right section right now. I am asking the webmaster on how to do it...

Alternately in the mean time you could provide me email adresses where I could send you a zip of the module I wrote. I am not sure this is in the policy of this forum however. Let me know how to do.

It is definitely not practicable to write down the complete files here below.

rgds

Olivier

Olivier Pierret

Wednesday 16 February 2005 12:32:04 am

Hello

I will try to contribute the code on this site but I don't know yet how to contribute in the right section right now. I am asking the webmaster on how to do it...

Alternately in the mean time you could provide me email adresses where I could send you a zip of the module I wrote. I am not sure this is in the policy of this forum however. Let me know how to do.

It is definitely not practicable to write down the complete files here below.

rgds

Olivier

Gabriel Ambuehl

Wednesday 16 February 2005 1:15:54 am

You should probably upload the files to http://ez.no/community/contribs/import_export (there's a button at the bottom of the page). Quite simple, really.

ZIPs or tars are preferred so that everything's together.

Visit http://triligon.org

Olivier Pierret

Wednesday 16 February 2005 1:17:38 am

OK the code is available in :
http://ez.no/community/contribs/import_export

I forgot to mention in the contrib that the upload form should be accessible at

admin/importXMLData/form.php

Please feel free to cut and paste the useful part of the code into your own code if necessary. Well If you cut and paste dont forget to cut and paste the GPL License and copyright of course :).

Good luck

Olivier

Olivier Pierret

Wednesday 16 February 2005 6:08:34 am

New version uploaded - the previous one might not work due to last minute folder name changes.
O.

Megha Barpande

Wednesday 16 February 2005 12:22:52 pm

Hi Olivier,

Thanks for the help. I'm sure that I'll be able to workout something.

Regards,
Megha B

Megha Barpande

Wednesday 16 February 2005 1:30:00 pm

Hi Olivier,

Thanks for the code once again. I think its good and will definitely solve our issue. Just a couple of things. Is this code compatible with version 3.4.4 (we are using this version)?

Also we have three fields of datatype ezselection so will it work?

My VB application can generate the XML and I've identified all the values that will be required to create the object. But I'm still a little nervous how to upload this XML file or how the CMS will pick it up. I mean what will be the exact interface?

I'm totally new in this whole development process. I'm experienced using VB and ASP however have almost a negative knowledge in PHP. Please be patient with me.

Regards,
Megha B

Olivier Pierret

Thursday 17 February 2005 1:29:03 am

Hello Megha,

Here is my answers

Version 3.4.4: not tested but should work

Datatype ezselection: Unfortunately i don't think it would work like this: I guess selection values are encoded as index into the attribute and not as actual text value but not sure. If you give a try, please back up your data first!

Upload interface: the file form.tpl in the design/importXMLData directory implement the HTML form that will used to upload the file. You should be able to access the form at the url: http://<your_site>/index.php/admin/importXMLData/form.

Good luck

Olivier

PS: I notice that in the import/export contribs there is another module that looks like doing the same job but i didn't dig into it. Maybe you could have a look and select which one is best fit for you.

 

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