in reference to this thread
, I propose a structure for an import-component. I'm not sure wether I will be able to code something like this myself (not able cause of lack of time and probably experience), but I think it will be worth to discuss.
The idea is to make it as modular as possible, which means in the end, you can import every file to every database-storage target. For example importing an open-office-document into a content-item or a excel-table into a numbering component.
In order to achieve this, the component itself has only a few API-functions (Placing Headings into their respective HTML-tags, reading the xml-file for the target, calling the interpreter-class), everything else is optional stuff.
Just outlining the process:
- Import-component gets called
- different, available target-formats are read from the db, corresponding source-formats are read from the db
- Import-screen gets shown, possibility to choose which component should be the receiver, displays possible input-formats for this component
- user specifies file and upload
- API reads file into buffer and calls interpreter with buffername and profilename.
- Interpreter reads buffer, interprets data according to xml-profile
- API fills db with the variables with the different objects of the chosen component.
In the root folder of the component you find the API, the interface and all classes for importable types, in subfolders you find xml-files that control the API and the interpreter classes. For every component that can import data (it does not do this itself) there is a xml-file with the target-db-tables, structure of these, etc. For every interpreter there has to be a xml-file in that component-folder how to read the file. Only if a target-xml-file and a source-xml-file exist, the interpreter is able to add content to the db. One target-xml, several source-xml (for every supported file-format one) If a dev wants to add support for his component, he just has to write a target-xml and define source-xmls (which would be handled as profiles)
I know this is not very professional how I look at it, but its the way I picture how it can be done. It would also enable several devs to work on this...
Lets see what we can make of it and if I will find time to devote to this project. At the moment I still have to work on ACL and I've got two other ideas I want to realise first, but then...
Comments as allways appreciated