diff --git a/timesheet/inc/class.timesheet_export_csv.inc.php b/timesheet/inc/class.timesheet_export_csv.inc.php index a35baf0906..473a0ebb1f 100644 --- a/timesheet/inc/class.timesheet_export_csv.inc.php +++ b/timesheet/inc/class.timesheet_export_csv.inc.php @@ -8,7 +8,7 @@ * @link http://www.egroupware.org * @author Knut Moeller * @copyright Knut Moeller - * @version $Id: $ + * @version $Id$ */ /** @@ -27,10 +27,15 @@ class timesheet_export_csv implements importexport_iface_export_plugin { $uitimesheet = new timesheet_ui(); $selection = array(); - $query = $GLOBALS['egw']->session->appsession('index',TIMESHEET_APP); - $query['num_rows'] = -1; // all + if($options['selection'] == 'selected') { + $query = $GLOBALS['egw']->session->appsession('index',TIMESHEET_APP); + $query['num_rows'] = -1; // all records + $uitimesheet->get_rows($query,$selection,$readonlys,true); // true = only return the id's + } elseif($options['selection'] == 'all') { + $query = array('num_rows' => -1); + $uitimesheet->get_rows($query,$selection,$readonlys,true); // true = only return the id's + } - $uitimesheet->get_rows($query,$selection,$readonlys,true); // true = only return the id's $options['begin_with_fieldnames'] = true; $export_object = new importexport_export_csv($_stream, (array)$options); @@ -67,7 +72,7 @@ class timesheet_export_csv implements importexport_iface_export_plugin { * @return string descriprion */ public static function get_description() { - return lang("Exports entries from your Timesheet into a CSV File. CSV means 'Comma Seperated Values'. However in the options Tab you can also choose other seperators."); + return lang("Exports entries from your Timesheet into a CSV File. "); } /** @@ -90,7 +95,7 @@ class timesheet_export_csv implements importexport_iface_export_plugin { * @return string html */ public function get_options_etpl() { - return 'timesheet.export_csv_options'; + return false; } /** @@ -98,6 +103,6 @@ class timesheet_export_csv implements importexport_iface_export_plugin { * */ public function get_selectors_etpl() { - return 'Selectors:'; + return 'timesheet.export_csv_selectors'; } } diff --git a/timesheet/inc/class.timesheet_import_csv.inc.php b/timesheet/inc/class.timesheet_import_csv.inc.php new file mode 100644 index 0000000000..657fd704dc --- /dev/null +++ b/timesheet/inc/class.timesheet_import_csv.inc.php @@ -0,0 +1,448 @@ + conversion) + 'field_mapping', // array( $csv_col_num => adb_filed) + 'conditions', /* => array containing condition arrays: + 'type' => exists, // exists + 'string' => '#kundennummer', + 'true' => array( + 'action' => update, + 'last' => true, + ), + 'false' => array( + 'action' => insert, + 'last' => true, + ),*/ + + ); + + public static $special_fields = array( + 'addressbook' => 'Link to Addressbook, use nlast,nfirst[,org] or contact_id from addressbook', + 'link_1' => '1. link: appname:appid the entry should be linked to, eg.: addressbook:123', + 'link_2' => '2. link: appname:appid the entry should be linked to, eg.: addressbook:123', + 'link_3' => '3. link: appname:appid the entry should be linked to, eg.: addressbook:123', + ); + + /** + * actions wich could be done to data entries + */ + protected static $actions = array( 'none', 'update', 'insert', 'delete', ); + + /** + * conditions for actions + * + * @var array + */ + protected static $conditions = array( 'exists' ); + + /** + * @var definition + */ + private $definition; + + /** + * @var business object + */ + private $bo; + + /** + * For figuring out if a record has changed + */ + protected $tracking; + + /** + * @var bool + */ + private $dry_run = false; + + /** + * @var int + */ + private $user = null; + + /** + * List of import errors + */ + protected $errors = array(); + + /** + * List of actions, and how many times that action was taken + */ + protected $results = array(); + + /** + * imports entries according to given definition object. + * @param resource $_stream + * @param string $_charset + * @param definition $_definition + */ + public function import( $_stream, importexport_definition $_definition ) { + $import_csv = new importexport_import_csv( $_stream, array( + 'fieldsep' => $_definition->plugin_options['fieldsep'], + 'charset' => $_definition->plugin_options['charset'], + )); + + $this->definition = $_definition; + + $this->user = $GLOBALS['egw_info']['user']['account_id']; + + // dry run? + $this->dry_run = isset( $_definition->plugin_options['dry_run'] ) ? $_definition->plugin_options['dry_run'] : false; + + // fetch the bo + $this->bo = new timesheet_bo(); + + // Get the tracker for changes + $this->tracking = new timesheet_tracking($this->bo); + + // set FieldMapping. + $import_csv->mapping = $_definition->plugin_options['field_mapping']; + + // set FieldConversion + $import_csv->conversion = $_definition->plugin_options['field_conversion']; + + // Add extra conversions + $import_csv->conversion_class = $this; + + //check if file has a header lines + if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) { + $import_csv->skip_records($_definition->plugin_options['num_header_lines']); + } elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) { + // First method is preferred + $import_csv->skip_records(1); + } + + // set Owner + $_definition->plugin_options['creator'] = isset( $_definition->plugin_options['creator'] ) ? + $_definition->plugin_options['creator'] : $this->user; + + // Used to try to automatically match names to account IDs + $addressbook = new addressbook_so(); + + // For converting human-friendly lookups + $categories = new categories('timesheet'); + $lookups = array( + 'ts_status' => $bo->status_labels, + 'cat_id' => $categories->return_sorted_array(0,False,'','','',true) + ); + + // Start counting successes + $count = 0; + $this->results = array(); + + // Failures + $this->errors = array(); + + while ( $record = $import_csv->get_record() ) { + $success = false; + + // don't import empty records + if( count( array_unique( $record ) ) < 2 ) continue; + + // Set creator, unless it's supposed to come from CSV file + if($_definition->plugin_options['creator_from_csv']) { + if(!is_numeric($record['ts_owner'])) { + $this->errors[$import_csv->get_current_position()] = lang( + 'Invalid owner ID: %1. Might be a bad field translation. Used %2 instead.', + $record['ts_owner'], + $_definition->plugin_options['creator'] + ); + $record['ts_owner'] = $_definition->plugin_options['creator']; + } + } elseif ($_definition->plugin_options['creator']) { + $record['ts_owner'] = $_definition->plugin_options['creator']; + } + + // Check account IDs + foreach(array('ts_owner','ts_modifier') as $field) { + if($record[$field] && !is_numeric($record[$field])) { + // Try an automatic conversion + $contact_id = self::addr_id($record[$field]); + if($contact_id) { + $contact = $addressbook->read($contact_id); + $account_id = $contact['account_id']; + } else { + $accounts = $GLOBALS['egw']->accounts->search(array('type' => 'both','query'=>$record[$field])); + if($accounts) $account_id = key($accounts); + } + if($account_id && common::grab_owner_name($account_id) == $record[$field]) { + $record[$field] = $account_id; + } else { + $this->errors[$import_csv->get_current_position()] = lang( + 'Invalid field: %1 = %2, it needs to be a number.', $field, $record[$field] + ); + continue 2; + } + } + } + + // Lookups - from human friendly to integer + foreach(array_keys($lookups) as $field) { + if(!is_numeric($record[$field]) && $key = array_search($record[$field], $lookups[$field])) { + $record[$field] = $key; + } + } + + // Special values + if ($record['addressbook'] && !is_numeric($record['addressbook'])) + { + list($lastname,$firstname,$org_name) = explode(',',$record['addressbook']); + $record['addressbook'] = self::addr_id($lastname,$firstname,$org_name); + } + + if ( $_definition->plugin_options['conditions'] ) { + foreach ( $_definition->plugin_options['conditions'] as $condition ) { + switch ( $condition['type'] ) { + // exists + case 'exists' : + $results = $this->bo->search(array($condition['string'] => $record[$condition['string']])); + + if ( is_array( $results ) && count( array_keys( $results ) >= 1 ) ) { + // apply action to all records matching this exists condition + $action = $condition['true']; + foreach ( (array)$results as $result ) { + $record['ts_id'] = $result['ts_id']; + if ( $_definition->plugin_options['update_cats'] == 'add' ) { + if ( !is_array( $result['cat_id'] ) ) $result['cat_id'] = explode( ',', $result['cat_id'] ); + if ( !is_array( $record['cat_id'] ) ) $record['cat_id'] = explode( ',', $record['cat_id'] ); + $record['cat_id'] = implode( ',', array_unique( array_merge( $record['cat_id'], $result['cat_id'] ) ) ); + } + $success = $this->action( $action['action'], $record, $import_csv->get_current_position() ); + } + } else { + $action = $condition['false']; + $success = ($this->action( $action['action'], $record, $import_csv->get_current_position() )); + } + break; + + // not supported action + default : + die('condition / action not supported!!!'); + break; + } + if ($action['last']) break; + } + } else { + // unconditional insert + $success = $this->action( 'insert', $record, $import_csv->get_current_position() ); + } + if($success) $count++; + } + return $count; + } + + /** + * perform the required action + * + * @param int $_action one of $this->actions + * @param array $_data tracker data for the action + * @return bool success or not + */ + private function action ( $_action, $_data, $record_num = 0 ) { + $result = true; + switch ($_action) { + case 'none' : + return true; + case 'update' : + // Only update if there are changes + $old = $this->bo->read($_data['ts_id']); + + if(!$this->definition->plugin_options['change_creator']) { + // Don't change creator of an existing ticket + unset($_data['ts_owner']); + } + + // Merge to deal with fields not in import record + $_data = array_merge($old, $_data); + $changed = $this->tracking->changed_fields($_data, $old); + if(count($changed) == 0 && !$this->definition->plugin_options['update_timestamp']) { + break; + } + + // Fall through + case 'insert' : + if ( $this->dry_run ) { + //print_r($_data); + $this->results[$_action]++; + break; + } else { + $result = $this->bo->save( $_data); + if($result) { + $this->errors[$record_num] = lang('Permissions error - %1 could not %2', + $GLOBALS['egw']->accounts->id2name($_data['owner']), + lang($_action) + ) . $result; + } else { + $this->results[$_action]++; + $result = $this->bo->data['ts_id']; + } + break; + } + default: + throw new egw_exception('Unsupported action'); + } + + // Process some additional fields + if(!is_numeric($result)) { + return $result; + } + $_link_id = false; + foreach(self::$special_fields as $field => $desc) { + if(!$_data[$field]) continue; + + // Links + if(strpos('link', $field) === 0) { + list($app, $id) = explode(':', $_data[$field]); + } else { + $app = $field; + $id = $_data[$field]; + } + if ($app && $app_id) { + $link_id = egw_link::link('timesheet',$id,$app,$app_id); + } + } + return $result; + } + + /** + * returns translated name of plugin + * + * @return string name + */ + public static function get_name() { + return lang('Timesheet CSV import'); + } + + /** + * returns translated (user) description of plugin + * + * @return string descriprion + */ + public static function get_description() { + return lang("Imports entries into the timesheet from a CSV File. "); + } + + /** + * retruns file suffix(s) plugin can handle (e.g. csv) + * + * @return string suffix (comma seperated) + */ + public static function get_filesuffix() { + return 'csv'; + } + + /** + * return etemplate components for options. + * @abstract We can't deal with etemplate objects here, as an uietemplate + * objects itself are scipt orientated and not "dialog objects" + * + * @return array ( + * name => string, + * content => array, + * sel_options => array, + * preserv => array, + * ) + */ + public function get_options_etpl() { + // lets do it! + } + + /** + * returns etemplate name for slectors of this plugin + * + * @return string etemplate name + */ + public function get_selectors_etpl() { + // lets do it! + } + + /** + * Returns errors that were encountered during importing + * Maximum of one error message per record, but you can append if you need to + * + * @return Array ( + * record_# => error message + * ) + */ + public function get_errors() { + return $this->errors; + } + + /** + * Returns a list of actions taken, and the number of records for that action. + * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. + * + * @return Array ( + * action => record count + * ) + */ + public function get_results() { + return $this->results; + } + // end of iface_export_plugin + + // Extra conversion functions - must be static + public static function addr_id( $n_family,$n_given=null,$org_name=null ) { + + // find in Addressbook, at least n_family AND (n_given OR org_name) have to match + static $contacts; + if (is_null($n_given) && is_null($org_name)) + { + // Maybe all in one + list($n_family, $n_given, $org_name) = explode(',', $n_family); + } + $n_family = trim($n_family); + if(!is_null($n_given)) $n_given = trim($n_given); + if (!is_object($contacts)) + { + $contacts =& CreateObject('phpgwapi.contacts'); + } + if (!is_null($org_name)) // org_name given? + { + $org_name = trim($org_name); + $addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,n_given=$n_given,org_name=$org_name" ); + if (!count($addrs)) + { + $addrs = $contacts->read( 0,0,array('id'),'',"n_family=$n_family,org_name=$org_name",'','n_family,org_name'); + } + } + if (!is_null($n_given) && (is_null($org_name) || !count($addrs))) // first name given and no result so far + { + $addrs = $contacts->search(array('n_family' => $n_family, 'n_given' => $n_given)); + } + if (is_null($n_given) && is_null($org_name)) // just one name given, check against fn (= full name) + { + $addrs = $contacts->read( 0,0,array('id'),'',"n_fn=$n_family",'','n_fn' ); + } + if (count($addrs)) + { + return $addrs[0]['id']; + } + return False; + } +} +?> diff --git a/timesheet/inc/class.timesheet_wizard_export_csv.inc.php b/timesheet/inc/class.timesheet_wizard_export_csv.inc.php new file mode 100644 index 0000000000..8ae75fea0e --- /dev/null +++ b/timesheet/inc/class.timesheet_wizard_export_csv.inc.php @@ -0,0 +1,29 @@ +export_fields = array('ts_id' => 'Timesheet ID') + $bo->field2label; + + // Custom fields + unset($this->export_fields['customfields']); + $custom = config::get_customfields('timesheet', true); + foreach($custom as $name => $data) { + $this->export_fields['#'.$name] = $data['label']; + } + } +} diff --git a/timesheet/inc/class.timesheet_wizard_import_csv.inc.php b/timesheet/inc/class.timesheet_wizard_import_csv.inc.php new file mode 100644 index 0000000000..5df17fbf8e --- /dev/null +++ b/timesheet/inc/class.timesheet_wizard_import_csv.inc.php @@ -0,0 +1,112 @@ +steps += array( + 'wizard_step50' => lang('Manage mapping'), + 'wizard_step60' => lang('Choose \'creator\' of imported data'), + ); + + // Field mapping + $bo = new timesheet_bo(); + $this->mapping_fields = array('ts_id' => lang('Timesheet ID')) + $bo->field2label; + + // These aren't in the list + $this->mapping_fields += array( + 'ts_modified' => lang('Modified'), + ); + + // List each custom field + unset($this->mapping_fields['customfields']); + $custom = config::get_customfields('timesheet'); + foreach($custom as $name => $data) { + $this->mapping_fields['#'.$name] = $data['label']; + } + + $this->mapping_fields += tracker_import_csv::$special_fields; + + // Actions + $this->actions = array( + 'none' => lang('none'), + 'update' => lang('update'), + 'insert' => lang('insert'), + 'delete' => lang('delete'), + ); + + // Conditions + $this->conditions = array( + 'exists' => lang('exists'), + ); + } + + function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv) + { + $result = parent::wizard_step50($content, $sel_options, $readonlys, $preserv); + + return $result; + } + + function wizard_step60(&$content, &$sel_options, &$readonlys, &$preserv) + { + if($this->debug) error_log(__METHOD__.'->$content '.print_r($content,true)); + unset($content['no_owner_map']); + + // return from step60 + if ($content['step'] == 'wizard_step60') + { + switch (array_search('pressed', $content['button'])) + { + case 'next': + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); + case 'previous' : + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); + case 'finish': + return 'wizard_finish'; + default : + return $this->wizard_step60($content,$sel_options,$readonlys,$preserv); + } + } + // init step60 + else + { + $content['msg'] = $this->steps['wizard_step60']; + $content['step'] = 'wizard_step60'; + if(!array_key_exists($content['creator']) && $content['plugin_options']) { + $content['creator'] = $content['plugin_options']['creator']; + } + if(!array_key_exists($content['creator_from_csv']) && $content['plugin_options']) { + $content['creator_from_csv'] = $content['plugin_options']['creator_from_csv']; + } + if(!array_key_exists($content['change_creator']) && $content['plugin_options']) { + $content['change_creator'] = $content['plugin_options']['change_creator']; + } + + if(!in_array('ts_creator', $content['field_mapping'])) { + $content['no_owner_map'] = true; + } + + $preserv = $content; + unset ($preserv['button']); + return 'infolog.importexport_wizard_chooseowner'; + } + + } +} diff --git a/timesheet/setup/etemplates.inc.php b/timesheet/setup/etemplates.inc.php index 5e28f498a8..399d14588c 100644 --- a/timesheet/setup/etemplates.inc.php +++ b/timesheet/setup/etemplates.inc.php @@ -2,7 +2,7 @@ /** * eGroupWare - eTemplates for Application timesheet * http://www.egroupware.org - * generated by soetemplate::dump4setup() 2010-12-10 10:59 + * generated by soetemplate::dump4setup() 2011-01-25 15:54 * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @package timesheet @@ -37,6 +37,8 @@ $templ_data[] = array('name' => 'timesheet.edit.notes','template' => '','lang' = $templ_data[] = array('name' => 'timesheet.editstatus','template' => '','lang' => '','group' => '0','version' => '1.7.004','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:3:{s:1:"D";s:3:"30%";s:1:"A";s:3:"100";s:2:"h1";s:6:",!@msg";}i:1;a:4:{s:1:"A";a:4:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";s:4:"span";s:13:"all,redItalic";s:5:"align";s:6:"center";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}}i:2;a:4:{s:1:"A";a:6:{s:4:"type";s:8:"groupbox";s:4:"data";a:2:{i:0;a:1:{s:2:"h1";s:6:",!@msg";}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:1:"1";i:1;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:3:{s:1:"D";s:3:"30%";s:2:"c1";s:7:"row,top";s:1:"A";s:3:"100";}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:6:"Status";}s:1:"B";a:8:{s:4:"type";s:4:"grid";s:4:"size";s:17:"100%,280,,,,,auto";s:4:"span";s:3:"all";s:4:"name";s:6:"statis";s:4:"data";a:3:{i:0;a:3:{s:2:"c1";s:2:"th";s:2:"c2";s:3:"row";s:1:"E";s:2:"5%";}i:1;a:5:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:2:"ID";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Name";}s:1:"C";a:2:{s:4:"type";s:5:"label";s:5:"label";s:6:"Parent";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:10:"Only Admin";}s:1:"E";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Actions";}}i:2;a:5:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"name";s:10:"${row}[id]";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:4:"size";s:6:"80,150";s:4:"blur";s:18:"--> enter new name";s:4:"name";s:12:"${row}[name]";}s:1:"C";a:3:{s:4:"type";s:6:"select";s:4:"name";s:14:"${row}[parent]";s:4:"size";s:13:"please select";}s:1:"D";a:3:{s:4:"type";s:8:"checkbox";s:4:"name";s:13:"${row}[admin]";s:4:"help";s:33:"Only Admin can change this Status";}s:1:"E";a:7:{s:4:"type";s:6:"button";s:4:"size";s:6:"delete";s:5:"label";s:6:"Delete";s:5:"align";s:6:"center";s:4:"name";s:21:"delete[$row_cont[id]]";s:4:"help";s:18:"Delete this status";s:7:"onclick";s:37:"return confirm(\'Delete this status\');";}}}s:4:"rows";i:2;s:4:"cols";i:5;s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"280";i:6;s:4:"auto";}}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:4;s:4:"size";s:17:"100%,300,,,,,auto";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}}i:3;a:4:{s:1:"A";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";s:4:"span";s:1:"2";i:1;a:3:{s:4:"type";s:6:"button";s:5:"label";s:4:"Save";s:4:"name";s:12:"button[save]";}i:2;a:3:{s:4:"type";s:6:"button";s:4:"name";s:13:"button[apply]";s:5:"label";s:5:"Apply";}i:3;a:3:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:4:"name";s:14:"button[cancel]";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:3;s:4:"cols";i:4;s:4:"size";s:17:"100%,450,,,,,auto";s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"450";i:6;s:4:"auto";}}}','size' => '100%,450,,,,,auto','style' => '','modified' => '1252352154',); +$templ_data[] = array('name' => 'timesheet.export_csv_selectors','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:5:"radio";s:5:"label";s:7:"Use all";s:4:"size";s:3:"all";s:4:"name";s:9:"selection";}}i:2;a:1:{s:1:"A";a:4:{s:4:"type";s:5:"radio";s:5:"label";s:18:"Use search results";s:4:"name";s:9:"selection";s:4:"size";s:8:"selected";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1295995750',); + $templ_data[] = array('name' => 'timesheet.index','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:4:{s:2:"h1";s:6:",!@msg";s:2:"h2";s:2:",1";s:2:"c4";s:7:"noPrint";s:2:"h5";s:2:",1";}i:1;a:2:{s:1:"A";a:5:{s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";s:5:"align";s:6:"center";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:2:{s:4:"type";s:8:"template";s:4:"name";s:5:"dates";}i:2;a:3:{s:4:"type";s:8:"template";s:4:"name";s:3:"add";s:5:"align";s:5:"right";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:3;a:2:{s:1:"A";a:4:{s:4:"type";s:9:"nextmatch";s:4:"name";s:2:"nm";s:4:"size";s:20:"timesheet.index.rows";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:4;a:2:{s:1:"A";a:4:{s:4:"type";s:6:"button";s:5:"label";s:3:"Add";s:4:"name";s:3:"add";s:7:"onclick";s:164:"window.open(egw::link(\'/index.php\',\'menuaction=timesheet.timesheet_ui.edit\'),\'_blank\',\'dependent=yes,width=600,height=400,scrollbars=yes,status=yes\'); return false;";}s:1:"B";a:7:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"4";s:5:"align";s:5:"right";i:1;a:5:{s:4:"type";s:8:"checkbox";s:4:"name";s:7:"use_all";s:5:"label";s:11:"whole query";s:8:"onchange";s:128:"if (this.checked==true && !confirm(\'Apply the action on the whole query, NOT only the shown timesheets!!!\')) this.checked=false;";s:4:"help";s:69:"Apply the action on the whole query, NOT only the shown timesheets!!!";}i:2;a:5:{s:4:"type";s:3:"box";s:4:"name";s:9:"cat_popup";s:4:"size";s:1:"1";s:4:"span";s:20:",action_popup prompt";i:1;a:5:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"3";i:1;a:3:{s:4:"type";s:5:"label";s:4:"span";s:13:",promptheader";s:5:"label";s:15:"Change category";}i:2;a:5:{s:4:"type";s:10:"select-cat";s:4:"span";s:21:",action_popup-content";s:4:"name";s:3:"cat";s:4:"size";s:16:"None,,,timesheet";s:5:"label";s:19:"Select new category";}i:3;a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:3:{s:4:"type";s:6:"button";s:5:"label";s:5:"Apply";s:4:"name";s:10:"change_cat";}i:2;a:3:{s:4:"type";s:10:"buttononly";s:5:"label";s:6:"Cancel";s:7:"onclick";s:29:"hide_popup(this,\'cat_popup\');";}}}}i:3;a:5:{s:4:"type";s:6:"select";s:8:"onchange";s:16:"do_action(this);";s:4:"size";s:13:"Select action";s:4:"name";s:6:"action";s:4:"help";s:13:"Select action";}i:4;a:8:{s:4:"type";s:6:"button";s:4:"size";s:9:"arrow_ltr";s:5:"label";s:9:"Check all";s:4:"name";s:9:"check_all";s:4:"help";s:9:"Check all";s:7:"onclick";s:70:"toggle_all(this.form,form::name(\'nm[rows][checked][]\')); return false;";s:6:"needed";s:1:"1";s:4:"span";s:14:",checkAllArrow";}}}i:5;a:2:{s:1:"A";a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Export";s:7:"onclick";s:33:"timesheet_export(); return false;";s:4:"name";s:6:"export";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:5;s:4:"cols";i:2;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '/** * Add / remove link or category popup used for actions on multiple entries */