- Export plugins now specify the export record class

- Projectmanager now has filters
This commit is contained in:
Nathan Gray 2016-05-04 19:34:30 +00:00
parent f9b551236c
commit 0eeb8b56c0
12 changed files with 119 additions and 23 deletions

View File

@ -422,6 +422,15 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
$this->selects['tid'][$tid] = $data['name']; $this->selects['tid'][$tid] = $data['name'];
} }
} }
/**
* Get the class name for the egw_record to use while exporting
*
* @return string;
*/
public static function get_egw_record_class()
{
return 'addressbook_egw_record';
}
/** /**
* Adjust automatically generated filter fields * Adjust automatically generated filter fields

View File

@ -142,4 +142,13 @@ class addressbook_export_vcard implements importexport_iface_export_plugin {
'content' => 'all', 'content' => 'all',
); );
} }
/**
* Get the class name for the egw_record to use while exporting
*
* @return string;
*/
public static function get_egw_record_class()
{
return 'addressbook_egw_record';
}
} }

View File

@ -103,4 +103,14 @@ class admin_export_groups_csv implements importexport_iface_export_plugin
'preserv' => array('no_error_for_no_selection'), 'preserv' => array('no_error_for_no_selection'),
); );
} }
/**
* Get the class name for the egw_record to use while exporting
*
* @return string;
*/
public static function get_egw_record_class()
{
return 'admin_egw_group_record';
}
} }

View File

@ -109,4 +109,13 @@ class admin_export_users_csv implements importexport_iface_export_plugin
'preserv' => array('no_error_for_all'), 'preserv' => array('no_error_for_all'),
); );
} }
/**
* Get the class name for the egw_record to use while exporting
*
* @return string;
*/
public static function get_egw_record_class()
{
return 'admin_egw_user_record';
}
} }

View File

@ -423,4 +423,14 @@ class calendar_export_csv implements importexport_iface_export_plugin {
} }
} }
} /**
* Get the class name for the egw_record to use while exporting
*
* @return string;
*/
public static function get_egw_record_class()
{
return 'calendar_egw_record';
}
}

View File

@ -170,4 +170,13 @@ class calendar_export_ical extends calendar_export_csv {
$data = parent::get_selectors_etpl($definition); $data = parent::get_selectors_etpl($definition);
return $data; return $data;
} }
/**
* Get the class name for the egw_record to use while exporting
*
* @return string;
*/
public static function get_egw_record_class()
{
return 'calendar_egw_record';
}
} }

View File

@ -68,7 +68,7 @@ class importexport_export_ui {
$content['appname'] = $_appname; $content['appname'] = $_appname;
$preserv['appname'] = $_appname; $preserv['appname'] = $_appname;
if(empty($_appname)) { if(empty($_appname)) {
$et.setElementAttribute('select_definition','disabled',true); $et->setElementAttribute('select_definition','disabled',true);
} }
// Check for preferred definition // Check for preferred definition

View File

@ -596,12 +596,12 @@ class importexport_helper_functions {
{ {
$fields = array(); $fields = array();
try { try {
if($record_classname == null) $record_classname = $app_name . '_egw_record';
if(!class_exists($record_classname)) throw new Exception('Bad class name ' . $record_classname);
$plugin = is_object($plugin_name) ? $plugin_name : new $plugin_name(); $plugin = is_object($plugin_name) ? $plugin_name : new $plugin_name();
$plugin_name = get_class($plugin); $plugin_name = get_class($plugin);
if($record_classname == null) $record_classname = $plugin::get_egw_record_class();
if(!class_exists($record_classname)) throw new Exception('Bad class name ' . $record_classname);
if(!$wizard_plugin) if(!$wizard_plugin)
{ {
$wizard_name = $app_name . '_wizard_' . str_replace($app_name . '_', '', $plugin_name); $wizard_name = $app_name . '_wizard_' . str_replace($app_name . '_', '', $plugin_name);

View File

@ -13,26 +13,26 @@
/** /**
* class importexport_iface_export_plugin * class importexport_iface_export_plugin
* This a the abstract interface for an export plugin of importexport * This a the abstract interface for an export plugin of importexport
* *
* You need to implement this class in * You need to implement this class in
* EGW_INCLUDE_ROOT/appname/inc/importexport/class.export_<type>.inc.php * EGW_INCLUDE_ROOT/appname/inc/importexport/class.export_<type>.inc.php
* to attend the importexport framwork with your export. * to attend the importexport framwork with your export.
* *
* NOTE: This is an easy interface, cause plugins live in theire own * NOTE: This is an easy interface, cause plugins live in theire own
* space. Means that they are responsible for generating a defintion AND * space. Means that they are responsible for generating a defintion AND
* working on that definition. * working on that definition.
* So this interface just garanties the interaction with userinterfaces. It * So this interface just garanties the interaction with userinterfaces. It
* has nothing to do with datatypes. * has nothing to do with datatypes.
* *
* JS: * JS:
* required function in opener: * required function in opener:
* *
* *
* // returns array of identifiers * // returns array of identifiers
* // NOTE: identifiers need to b * // NOTE: identifiers need to b
* get_selection(); * get_selection();
* *
* get_selector(); //returns array * get_selector(); //returns array
*/ */
interface importexport_iface_export_plugin { interface importexport_iface_export_plugin {
@ -76,7 +76,7 @@ interface importexport_iface_export_plugin {
* return etemplate components for options. * return etemplate components for options.
* @abstract We can't deal with etemplate objects here, as an uietemplate * @abstract We can't deal with etemplate objects here, as an uietemplate
* objects itself are scipt orientated and not "dialog objects" * objects itself are scipt orientated and not "dialog objects"
* *
* @return array ( * @return array (
* name => string, * name => string,
* content => array, * content => array,
@ -100,5 +100,15 @@ interface importexport_iface_export_plugin {
*/ */
public function get_selectors_etpl(); public function get_selectors_etpl();
/**
* Get the class name for the egw_record to use while exporting
*
* importexport_iface_egw_record classes are used for a lot of field detection
* and automatic conversions. In most cases they are named <appname>_egw_record,
* but projectmanager is an exception to this.
*
* @return string;
*/
public static function get_egw_record_class();
} // end of iface_export_plugin } // end of iface_export_plugin
?> ?>

View File

@ -266,4 +266,14 @@ class infolog_export_csv implements importexport_iface_export_plugin {
public static function convert(infolog_egw_record &$record) { public static function convert(infolog_egw_record &$record) {
// Stub, for now // Stub, for now
} }
/**
* Get the class name for the egw_record to use while exporting
*
* @return string;
*/
public static function get_egw_record_class()
{
return 'infolog_egw_record';
}
} }

View File

@ -174,8 +174,8 @@ class resources_export_csv implements importexport_iface_export_plugin {
/** /**
* Customize automatically generated filter fields * Customize automatically generated filter fields
*/ */
public function get_filter_fields(Array &$filters) public function get_filter_fields(Array &$filters)
{ {
// In resources, not all categories are used // In resources, not all categories are used
$filters['cat_id']['type'] = 'select'; $filters['cat_id']['type'] = 'select';
$filters['cat_id']['name'] = 'filter'; $filters['cat_id']['name'] = 'filter';
@ -189,9 +189,20 @@ class resources_export_csv implements importexport_iface_export_plugin {
'rows' => 5, 'rows' => 5,
'values' => resources_bo::$filter_options 'values' => resources_bo::$filter_options
); );
foreach($filters as $field_name => &$settings) foreach($filters as $field_name => &$settings)
{ {
if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name]; if($this->selects[$field_name]) $settings['values'] = $this->selects[$field_name];
} }
} }
/**
* Get the class name for the egw_record to use while exporting
*
* @return string;
*/
public static function get_egw_record_class()
{
return 'resources_egw_record';
}
} }

View File

@ -169,4 +169,13 @@ class timesheet_export_csv implements importexport_iface_export_plugin {
} }
} }
/**
* Get the class name for the egw_record to use while exporting
*
* @return string;
*/
public static function get_egw_record_class()
{
return 'timesheet_egw_record';
}
} }