mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:29 +01:00
Some documentation updates
This commit is contained in:
parent
8c74ba7383
commit
d92a2315cb
@ -10,17 +10,21 @@ applications and its specific definitions.
|
||||
Attending importeport framework with you application is pretty easy.
|
||||
|
||||
You just need to have your plugins in files which start with
|
||||
class.import_<name> or
|
||||
class.export_<name>
|
||||
class.<app>_import_<name> or
|
||||
class.<app>_export_<name>
|
||||
in
|
||||
EGW_INCLUDE_ROOT/YourApp/importexport/
|
||||
EGW_INCLUDE_ROOT/YourApp/inc/
|
||||
|
||||
These pulugins only need to implement the corresponding interface
|
||||
These plugins only need to implement the corresponding interface
|
||||
EGW_INCLUDE_ROOT/importexport/inc/class.iface_import_plugin.inc.php or
|
||||
EGW_INCLUDE_ROOT/importexport/inc/class.iface_export_plugin.inc.php
|
||||
|
||||
Thats all, pretty easy, isn't it?
|
||||
|
||||
For CSV, just extend importexport/inc/class.importexport_basic_import_csv.inc.php
|
||||
and override the init(), import_record() and action() methods. You'll get common
|
||||
functionallity for very little extra effort.
|
||||
|
||||
== definitions ==
|
||||
The bases of all imports and exports is the '''definition'''.
|
||||
|
||||
@ -34,24 +38,23 @@ That means, that your plugin can not work w.o. a definition. However, your plugi
|
||||
need to parse that definition. This is up to you.
|
||||
|
||||
Definitions can be created in admin->importexport->define{im|ex}ports. They are stored
|
||||
in the databasae but could be {im|ex}ported itselve.
|
||||
in the database but can also be {im|ex}ported to / from other systems.
|
||||
|
||||
Definitions (as xml files) residing in the folder <yourapp/importexport/definitions>
|
||||
Definitions (as xml files) residing in the folder <yourapp/setup/*.xml>
|
||||
will be imported at apps installation time automatically.
|
||||
|
||||
|
||||
== import ==
|
||||
|
||||
== export ==
|
||||
Starting an export is as easy as just putting a button in your app with:
|
||||
onClick="importexport.uiexport.export_dialog&appname=<appname>&have_selection=<{true|false}>"
|
||||
If parameter "have_selection" if true, export askes (javascript) opener.get_selection();to retreave
|
||||
a list of identifiers of selected records.
|
||||
Starting an export is as easy as using the sidebox button. Once your plugins are detected
|
||||
(they are cached and refreshed hourly), Import/Export will add the needed entries to the sidebox.
|
||||
Alternatively, you can go to Admin -> Define Imports | Exports.
|
||||
|
||||
NOTE: javascript function get_selection() is the only function which is not part of an interface yet.
|
||||
|
||||
==Discussion of interfaces==
|
||||
To make live easy there are several general plugins which can be found
|
||||
To make life easy there are several general plugins which can be found
|
||||
EGW_INCLUDE_ROOT/importexport/inc/import_...
|
||||
EGW_INCLUDE_ROOT/importexport/inc/export_...
|
||||
|
||||
|
@ -248,8 +248,14 @@
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the interpretation of the file for dry runs
|
||||
* Return an interpretation of the file for dry runs
|
||||
*
|
||||
* If the plugin has a preview, use that. Otherwise, try a simple CSV => HTML table
|
||||
*
|
||||
* @param importexport_iface_import_plugin $plugin Instance of plugin to be used
|
||||
* @param resource $stream
|
||||
* @param importexport_definition $definition
|
||||
* @return String HTML fragment illustrating how the data will be understood by egw
|
||||
*/
|
||||
protected function preview(importexport_iface_import_plugin &$plugin, &$stream, importexport_definition &$definition_obj)
|
||||
{
|
||||
@ -284,6 +290,14 @@
|
||||
* Simple check to see if the file at least matches the definition
|
||||
*
|
||||
* Checks that column headers match
|
||||
* @note Currently only works for CSV
|
||||
*
|
||||
* @param resource $file
|
||||
* @param importexport_definition $definition
|
||||
* @param Array message Will be filled with any warnings or errors detected
|
||||
* @param String Temporary file location, so user doesn't have to keep uploading
|
||||
*
|
||||
* @return boolean Ok to import
|
||||
*/
|
||||
public static function check_file(&$file, &$definition, &$message = array(), $dst_file = false)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user