When exporting from list view, default selection options to listview settings

This commit is contained in:
Nathan Gray 2011-11-08 22:01:41 +00:00
parent f37f8578cf
commit a2c0da6ccc
2 changed files with 32 additions and 7 deletions

View File

@ -187,27 +187,51 @@ class calendar_export_csv implements importexport_iface_export_plugin {
*/ */
public function get_selectors_etpl($definition = null) { public function get_selectors_etpl($definition = null) {
$states = $GLOBALS['egw']->session->appsession('session_data','calendar'); $states = $GLOBALS['egw']->session->appsession('session_data','calendar');
$start= new egw_time($states['date']); $start= new egw_time($states['date']);
if($states['view'] == 'week') { if($states['view'] == 'week')
{
$days = isset($_GET['days']) ? $_GET['days'] : $GLOBALS['egw_info']['user']['preferences']['calendar']['days_in_weekview']; $days = isset($_GET['days']) ? $_GET['days'] : $GLOBALS['egw_info']['user']['preferences']['calendar']['days_in_weekview'];
if ($days != 5) $days = 7; if ($days != 5) $days = 7;
$end = "+$days days"; $end = "+$days days";
} else { $end = strtotime($end, $start->format('ts'))-1;
}
elseif ($states['view'] == 'listview')
{
$list = $GLOBALS['egw']->session->appsession('calendar_list','calendar');
// Use UI to get dates
$ui = new calendar_uilist();
$ui->get_rows($list);
if($ui->first) $start = $ui->first;
if($ui->last) $end = $ui->last;
// Special handling
if($list['filter'] == 'all') $start = $end = null;
if($list['filter'] == 'before')
{
$end = $start;
$start = null;
}
$ui = null;
}
else
{
$end = '+1 ' . $states['view']; $end = '+1 ' . $states['view'];
$end = strtotime($end, $start->format('ts'))-1;
} }
$prefs = unserialize($GLOBALS['egw_info']['user']['preferences']['importexport'][$definition->definition_id]); $prefs = unserialize($GLOBALS['egw_info']['user']['preferences']['importexport'][$definition->definition_id]);
return array( $data = array(
'name' => 'calendar.export_csv_select', 'name' => 'calendar.export_csv_select',
'content' => array( 'content' => array(
'plugin_override' => true, // Plugin overrides preferences 'plugin_override' => true, // Plugin overrides preferences
'select' => $prefs['selection']['select'] ? $prefs['selection']['select'] : 'criteria', 'select' => $prefs['selection']['select'] ? $prefs['selection']['select'] : 'criteria',
'start' => $start->format('ts'), 'start' => is_object($start) ? $start->format('ts') : $start,
'end' => strtotime($end, $start->format('ts'))-1, 'end' => $end,
'owner' => $states['owner'] 'owner' => $states['owner']
) )
); );
return $data;
} }
/** /**

View File

@ -168,7 +168,8 @@ class calendar_import_csv implements importexport_iface_import_plugin {
if( count( array_unique( $record ) ) < 2 ) continue; if( count( array_unique( $record ) ) < 2 ) continue;
// Automatic conversions // Automatic conversions
importexport_import_csv::convert($record, calendar_egw_record::$types, 'calendar', $lookups); importexport_import_csv::convert($record, calendar_egw_record::$types, 'calendar', $lookups,
$_definition->plugin_options['convert'] || 1);
// Set owner, unless it's supposed to come from CSV file // Set owner, unless it's supposed to come from CSV file
if($_definition->plugin_options['owner_from_csv']) { if($_definition->plugin_options['owner_from_csv']) {