mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Add some base classes to make it easier for other applications to implement importing CSVs
To use them, you need to create two files in the app/importexport directory, 'class.import_appname_csv.inc.php' and 'class.wizzard_import_appname_csv.inc.php'. The minimum required files are shown below, but they can be modified as needed to override the basics and add capabilities. class.import_appname_csv.inc.php: <?php require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.basic_import_csv.inc.php'); class import_appname_csv extends basic_import_csv { protected function import_record(&$record, &$import_csv) { // Handle one record here. Handle conditions and call action() as appropriate. // See basic_import_csv. } protected function action($action, Array $record, $record_num = 0) { // Take the given action (none, insert, delete, update) etc. as understood for your app. // See basic_import_csv. } } ?> class.wizzard_import_appname_csv.inc.php: <?php require_once(EGW_INCLUDE_ROOT . '/appname/importexport/class.import_appname_csv.inc.php'); require_once(EGW_INCLUDE_ROOT . '/importexport/inc/class.wizzard_basic_import_csv.inc.php'); class wizzard_import_appname_csv extends wizzard_basic_import_csv { public function __construct() { $this->mapping_fields = array( // List of destination fields available in appname 'field' => lang('name') ); $this->conditions = array( // List of conditions supported by import_appname_csv 'field' => lang('name') ); $this->actions = array( // List of actions supported by import_appname_csv 'field' => lang('name') ); } } ?>
This commit is contained in:
parent
f7ee51f53b
commit
54b4454d51
282
importexport/inc/class.basic_import_csv.inc.php
Normal file
282
importexport/inc/class.basic_import_csv.inc.php
Normal file
@ -0,0 +1,282 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package importexport
|
||||
* @link http://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
*/
|
||||
|
||||
require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.iface_import_plugin.inc.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/importexport/inc/class.import_csv.inc.php');
|
||||
|
||||
|
||||
/**
|
||||
* A basic CSV import plugin.
|
||||
*
|
||||
* You should extend this class to implement the various bits, but combined with the basic wizard
|
||||
* should get you started on building a CSV plugin for an application fairly quickly.
|
||||
*
|
||||
* NB: The name of your import plugin must start with import_.
|
||||
*/
|
||||
abstract class basic_import_csv implements iface_import_plugin {
|
||||
|
||||
protected static $plugin_options = array(
|
||||
'fieldsep', // char
|
||||
'charset', // string
|
||||
'contact_owner', // int
|
||||
'update_cats', // string {override|add} overides record
|
||||
// with cat(s) from csv OR add the cat from
|
||||
// csv file to exeisting cat(s) of record
|
||||
'num_header_lines', // int number of header lines
|
||||
'field_conversion', // array( $csv_col_num => 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,
|
||||
),*/
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* Actions wich could be done to data entries
|
||||
* If your plugin supports different actions, be sure to modify this array
|
||||
*/
|
||||
protected static $actions = array( 'none', 'update', 'insert', 'delete', );
|
||||
|
||||
/**
|
||||
* Conditions for actions
|
||||
* If your plugin supports different conditions, be sure to modify this array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $conditions = array( 'exists', 'greater', 'greater or equal', );
|
||||
|
||||
/**
|
||||
* This is the definition that will be used to deal with the CSV file
|
||||
* @var definition
|
||||
*/
|
||||
protected $definition;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $dry_run = false;
|
||||
|
||||
/**
|
||||
* @var bool is current user admin?
|
||||
*/
|
||||
protected $is_admin = false;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $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, definition $_definition ) {
|
||||
$import_csv = new import_csv( $_stream, array(
|
||||
'fieldsep' => $_definition->plugin_options['fieldsep'],
|
||||
'charset' => $_definition->plugin_options['charset'],
|
||||
));
|
||||
|
||||
$this->definition = $_definition;
|
||||
|
||||
// user, is admin ?
|
||||
$this->is_admin = isset( $GLOBALS['egw_info']['user']['apps']['admin'] ) && $GLOBALS['egw_info']['user']['apps']['admin'];
|
||||
$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;
|
||||
|
||||
// set FieldMapping.
|
||||
$import_csv->mapping = $_definition->plugin_options['field_mapping'];
|
||||
|
||||
// set FieldConversion
|
||||
$import_csv->conversion = $_definition->plugin_options['field_conversion'];
|
||||
|
||||
//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 eventOwner
|
||||
$_definition->plugin_options['contact_owner'] = isset( $_definition->plugin_options['contact_owner'] ) ?
|
||||
$_definition->plugin_options['contact_owner'] : $this->user;
|
||||
|
||||
// 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;
|
||||
|
||||
$record['owner'] = $this->_definition->plugin_options['contact_owner'];
|
||||
|
||||
$success = $this->import_record($record, $import_csv);
|
||||
if($success) $count++;
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Import a single record
|
||||
*
|
||||
* You don't need to worry about mappings or translations, they've been done already.
|
||||
* You do need to handle the conditions and the actions taken.
|
||||
*/
|
||||
protected abstract function import_record(&$record, &$import_csv);
|
||||
/* Example stub:
|
||||
{
|
||||
if ( $this->_definition->plugin_options['conditions'] ) {
|
||||
foreach ( $this->_definition->plugin_options['conditions'] as $condition ) {
|
||||
switch ( $condition['type'] ) {
|
||||
// exists
|
||||
case 'exists' :
|
||||
// Check for that record
|
||||
// Apply true action to any matching records found
|
||||
$action = $condition['true'];
|
||||
$success = ($this->action( $action['action'], $record, $import_csv->get_current_position() ));
|
||||
// Apply false action if no matching records found
|
||||
$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() );
|
||||
}
|
||||
|
||||
return $success;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* perform the required action
|
||||
*
|
||||
* Make sure you record any errors you encounter here:
|
||||
* $this->errors[$record_num] = error message;
|
||||
*
|
||||
* @param int $_action one of $this->actions
|
||||
* @param array $_data contact data for the action
|
||||
* @param int $record_num Which record number is being dealt with. Used for error messages.
|
||||
* @return bool success or not
|
||||
*/
|
||||
protected abstract function action ( $_action, Array $_data, $record_num = 0 );
|
||||
|
||||
/**
|
||||
* returns translated name of plugin
|
||||
*
|
||||
* @return string name
|
||||
*/
|
||||
public static function get_name() {
|
||||
return lang('Basic CSV import');
|
||||
}
|
||||
|
||||
/**
|
||||
* returns translated (user) description of plugin
|
||||
*
|
||||
* @return string descriprion
|
||||
*/
|
||||
public static function get_description() {
|
||||
return lang("Imports information from a CSV file. This is only a base class, and doesn't do anything on its own.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
?>
|
307
importexport/inc/class.wizzard_basic_import_csv.inc.php
Normal file
307
importexport/inc/class.wizzard_basic_import_csv.inc.php
Normal file
@ -0,0 +1,307 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - A basic implementation of a wizard to go with the basic CSV plugin.
|
||||
*
|
||||
* To add or remove steps, change $this->steps appropriately. The key is the function, the value is the title.
|
||||
* Don't go past 80, as that's where the wizard picks it back up again to finish it off.
|
||||
*
|
||||
* For the mapping to work properly, you will have to fill $mapping_fields with the target fields for your application.
|
||||
*
|
||||
* NB: Your wizard class must be in <appname>/importexport/class.wizzard_<plugin_name>.inc.php
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package importexport
|
||||
* @link http://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
*/
|
||||
|
||||
require_once(EGW_INCLUDE_ROOT.'/importexport/inc/class.basic_import_csv.inc.php');
|
||||
|
||||
class wizzard_basic_import_csv
|
||||
{
|
||||
|
||||
const TEMPLATE_MARKER = '-eTemplate-';
|
||||
|
||||
/**
|
||||
* List of steps. Key is the function, value is the translated title.
|
||||
*/
|
||||
public $steps;
|
||||
|
||||
/**
|
||||
* List of eTemplates to use for each step. You can override this with your own etemplates steps.
|
||||
*/
|
||||
protected $step_templates = array(
|
||||
'wizzard_step30' => 'importexport.wizard_basic_import_csv.sample_file',
|
||||
'wizzard_step40' => 'importexport.wizard_basic_import_csv.choosesepncharset',
|
||||
'wizzard_step50' => 'importexport.wizard_basic_import_csv.fieldmapping',
|
||||
'wizzard_step55' => 'importexport.wizard_basic_import_csv.conditions'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Destination fields for the mapping
|
||||
* Key is the field name, value is the human version
|
||||
*/
|
||||
protected $mapping_fields = array();
|
||||
|
||||
/**
|
||||
* List of conditions your plugin supports
|
||||
*/
|
||||
protected $conditions = array();
|
||||
|
||||
/**
|
||||
* List of actions your plugin supports
|
||||
*/
|
||||
protected $actions = array();
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->steps = array(
|
||||
'wizzard_step30' => lang('Load Sample file'),
|
||||
'wizzard_step40' => lang('Choose seperator and charset'),
|
||||
'wizzard_step50' => lang('Manage mapping'),
|
||||
'wizzard_step55' => lang('Edit conditions'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take a sample CSV file. It will be processed in later steps
|
||||
*/
|
||||
function wizzard_step30(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||
{
|
||||
if($this->debug) error_log(get_class($this) . '::wizzard_step30->$content '.print_r($content,true));
|
||||
// return from step30
|
||||
if ($content['step'] == 'wizzard_step30')
|
||||
{
|
||||
switch (array_search('pressed', $content['button']))
|
||||
{
|
||||
case 'next':
|
||||
// Move sample file to temp
|
||||
if($content['file']['tmp_name']) {
|
||||
$csvfile = tempnam($GLOBALS['egw_info']['server']['temp_dir'],$content['plugin']."_");
|
||||
move_uploaded_file($content['file']['tmp_name'], $csvfile);
|
||||
$GLOBALS['egw']->session->appsession('csvfile','',$csvfile);
|
||||
}
|
||||
unset($content['file']);
|
||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],1);
|
||||
case 'previous' :
|
||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],-1);
|
||||
case 'finish':
|
||||
return 'wizzard_finish';
|
||||
default :
|
||||
return $this->wizzard_step30($content,$sel_options,$readonlys,$preserv);
|
||||
}
|
||||
}
|
||||
// init step30
|
||||
else
|
||||
{
|
||||
$content['msg'] = $this->steps['wizzard_step30'];
|
||||
$content['step'] = 'wizzard_step30';
|
||||
$preserv = $content;
|
||||
unset ($preserv['button']);
|
||||
$GLOBALS['egw']->js->set_onload("var btn = document.getElementById('exec[button][next]'); btn.attributes.removeNamedItem('onclick');");
|
||||
return $this->step_templates[$content['step']];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* choose fieldseperator, charset and headerline
|
||||
*
|
||||
* @param array $content
|
||||
* @param array $sel_options
|
||||
* @param array $readonlys
|
||||
* @param array $preserv
|
||||
* @return string template name
|
||||
*/
|
||||
function wizzard_step40(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||
{
|
||||
if($this->debug) error_log(get_class($this) . '::wizzard_step40->$content '.print_r($content,true));
|
||||
// return from step40
|
||||
if ($content['step'] == 'wizzard_step40') {
|
||||
switch (array_search('pressed', $content['button']))
|
||||
{
|
||||
case 'next':
|
||||
// Process sample file for fields
|
||||
if (($handle = fopen($GLOBALS['egw']->session->appsession('csvfile'), "rb")) !== FALSE) {
|
||||
$data = fgetcsv($handle, 8000, $content['fieldsep']);
|
||||
$content['csv_fields'] = translation::convert($data,$content['charset']);
|
||||
} elseif($content['plugin_options']['csv_fields']) {
|
||||
$content['csv_fields'] = $content['plugin_options']['csv_fields'];
|
||||
}
|
||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],1);
|
||||
case 'previous' :
|
||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],-1);
|
||||
case 'finish':
|
||||
return 'wizzard_finish';
|
||||
default :
|
||||
return $this->wizzard_step40($content,$sel_options,$readonlys,$preserv);
|
||||
}
|
||||
}
|
||||
// init step40
|
||||
else
|
||||
{
|
||||
$content['msg'] = $this->steps['wizzard_step40'];
|
||||
$content['step'] = 'wizzard_step40';
|
||||
|
||||
// If editing an existing definition, these will be in plugin_options
|
||||
if(!$content['fieldsep'] && $content['plugin_options']['fieldsep']) {
|
||||
$content['fieldsep'] = $content['plugin_options']['fieldsep'];
|
||||
} elseif (!$content['fieldsep']) {
|
||||
$content['fieldsep'] = ';';
|
||||
}
|
||||
if(!$content['charset'] && $content['plugin_options']['charset']) {
|
||||
$content['charset'] = $content['plugin_options']['charset'];
|
||||
}
|
||||
if(!$content['has_header_line'] && $content['plugin_options']['has_header_line']) {
|
||||
$content['num_header_lines'] = 1;
|
||||
}
|
||||
if(!$content['num_header_lines'] && $content['plugin_options']['num_header_lines']) {
|
||||
$content['num_header_lines'] = $content['plugin_options']['num_header_lines'];
|
||||
}
|
||||
|
||||
$sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets()+
|
||||
array('utf-8' => 'utf-8 (Unicode)');
|
||||
$preserv = $content;
|
||||
unset ($preserv['button']);
|
||||
return $this->step_templates[$content['step']];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the sample file, get the fields out of it, then allow them to be mapped onto
|
||||
* the fields the destination understands. Also, set any translations to be done to the field.
|
||||
*
|
||||
* You can use the eTemplate
|
||||
*/
|
||||
function wizzard_step50(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||
{
|
||||
if($this->debug) error_log(get_class($this) . '::wizzard_step50->$content '.print_r($content,true));
|
||||
// return from step50
|
||||
if ($content['step'] == 'wizzard_step50')
|
||||
{
|
||||
array_shift($content['csv_fields']);
|
||||
array_shift($content['field_mapping']);
|
||||
array_shift($content['field_conversion']);
|
||||
|
||||
foreach($content['field_conversion'] as $field => $convert) {
|
||||
if(!trim($convert)) unset($content['field_conversion'][$field]);
|
||||
}
|
||||
|
||||
switch (array_search('pressed', $content['button']))
|
||||
{
|
||||
case 'next':
|
||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],1);
|
||||
case 'previous' :
|
||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],-1);
|
||||
case 'finish':
|
||||
return 'wizzard_finish';
|
||||
default :
|
||||
return $this->wizzard_step50($content,$sel_options,$readonlys,$preserv);
|
||||
}
|
||||
}
|
||||
// init step50
|
||||
else
|
||||
{
|
||||
$content['msg'] = $this->steps['wizzard_step50'];
|
||||
$content['step'] = 'wizzard_step50';
|
||||
|
||||
if(!$content['field_mapping'] && $content['plugin_options']) {
|
||||
$content['field_mapping'] = $content['plugin_options']['field_mapping'];
|
||||
$content['field_conversion'] = $content['plugin_options']['field_conversion'];
|
||||
}
|
||||
array_unshift($content['csv_fields'],array('row0'));
|
||||
array_unshift($content['field_mapping'],array('row0'));
|
||||
array_unshift($content['field_conversion'],array('row0'));
|
||||
|
||||
$j = 1;
|
||||
foreach ($content['csv_fields'] as $field)
|
||||
{
|
||||
if(strstr($field,'no_csv_')) $j++;
|
||||
}
|
||||
while ($j <= 3)
|
||||
{
|
||||
$content['csv_fields'][] = 'no_csv_'.$j;
|
||||
$content['field_mapping'][] = $content['field_conversion'][] = '';
|
||||
$j++;
|
||||
}
|
||||
$sel_options['field_mapping'] = array('' => lang('none')) + $this->mapping_fields;
|
||||
$preserv = $content;
|
||||
unset ($preserv['button']);
|
||||
return $this->step_templates[$content['step']];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit conditions
|
||||
*/
|
||||
function wizzard_step55(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||
{
|
||||
if($this->debug) error_log(get_class($this) . '::wizzard_step55->$content '.print_r($content,true));
|
||||
// return from step55
|
||||
if ($content['step'] == 'wizzard_step55')
|
||||
{
|
||||
array_shift($content['conditions']);
|
||||
|
||||
foreach($content['conditions'] as $key => &$condition) {
|
||||
// Clear empties
|
||||
if($condition['string'] == '') {
|
||||
unset($content['conditions'][$key]);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
switch (array_search('pressed', $content['button']))
|
||||
{
|
||||
case 'next':
|
||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],1);
|
||||
case 'previous' :
|
||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],-1);
|
||||
case 'finish':
|
||||
return 'wizzard_finish';
|
||||
case 'add':
|
||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],0);
|
||||
default :
|
||||
return $this->wizzard_step55($content,$sel_options,$readonlys,$preserv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// init step55
|
||||
$content['msg'] = $this->steps['wizzard_step55'];
|
||||
$content['step'] = 'wizzard_step55';
|
||||
|
||||
if(!$content['conditions'] && $content['plugin_options']['conditions']) {
|
||||
$content['conditions'] = $content['plugin_options']['conditions'];
|
||||
}
|
||||
|
||||
foreach($content['field_mapping'] as $field) {
|
||||
$sel_options['string'][$field] = $this->mapping_fields[$field];
|
||||
}
|
||||
$sel_options['type'] = array_combine($this->conditions, $this->conditions);
|
||||
$sel_options['action'] = array_combine($this->actions, $this->actions);
|
||||
|
||||
// Make 3 empty conditions
|
||||
$j = 1;
|
||||
foreach ($content['conditions'] as $condition)
|
||||
{
|
||||
if(!$condition['string']) $j++;
|
||||
}
|
||||
while ($j <= 3)
|
||||
{
|
||||
$content['conditions'][] = array('string' => '');
|
||||
$j++;
|
||||
}
|
||||
|
||||
// Leave room for heading
|
||||
array_unshift($content['conditions'], false);
|
||||
|
||||
$preserv = $content;
|
||||
unset ($preserv['button']);
|
||||
return $this->step_templates[$content['step']];
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* eGroupWare - eTemplates for Application importexport
|
||||
* http://www.egroupware.org
|
||||
* generated by soetemplate::dump4setup() 2010-03-09 09:25
|
||||
* generated by soetemplate::dump4setup() 2010-03-10 09:01
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package importexport
|
||||
@ -52,6 +52,14 @@ $templ_data[] = array('name' => 'importexport.schedule_edit','template' => '','l
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.schedule_index','template' => '','lang' => '','group' => '0','version' => '1.7.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{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:4:"span";s:11:"all,message";s:4:"name";s:4:"@msg";}}i:2;a:1:{s:1:"A";a:6:{s:4:"type";s:4:"grid";s:4:"name";s:9:"scheduled";s:7:"options";a:0:{}s:4:"data";a:3:{i:0;a:2:{s:2:"c1";s:2:"th";s:2:"c2";s:4:",top";}i:1;a:8:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Type";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:11:"Application";}s:1:"C";a:2:{s:4:"type";s:5:"label";s:5:"label";s:6:"Plugin";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:10:"Definition";}s:1:"E";a:2:{s:4:"type";s:5:"label";s:5:"label";s:6:"Target";}s:1:"F";a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Last Run";}s:1:"G";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:6:"2,,0,0";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Next Run";}i:2;a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Schedule";}}s:1:"H";a:1:{s:4:"type";s:5:"label";}}i:2;a:8:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"name";s:12:"${row}[type]";}s:1:"B";a:3:{s:4:"type";s:10:"select-app";s:4:"name";s:15:"${row}[appname]";s:8:"readonly";s:1:"1";}s:1:"C";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:14:"${row}[plugin]";s:8:"readonly";s:1:"1";}s:1:"D";a:3:{s:4:"type";s:6:"select";s:4:"name";s:18:"${row}[definition]";s:8:"readonly";s:1:"1";}s:1:"E";a:3:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:14:"${row}[target]";}s:1:"F";a:6:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"4";i:1;a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:16:"${row}[last_run]";s:8:"readonly";s:1:"1";}i:2;a:3:{s:4:"type";s:5:"label";s:4:"name";s:20:"${row}[record_count]";s:7:"no_lang";s:1:"1";}i:3;a:3:{s:4:"type";s:5:"label";s:4:"name";s:14:"${row}[result]";s:7:"no_lang";s:1:"1";}i:4;a:2:{s:4:"type";s:5:"label";s:4:"name";s:14:"${row}[errors]";}}s:1:"G";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:6:"2,,0,0";i:1;a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:12:"${row}[next]";s:8:"readonly";s:1:"1";}i:2;a:3:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:13:"${row}[times]";}}s:1:"H";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:4:{s:4:"type";s:6:"button";s:4:"size";s:4:"edit";s:4:"name";s:21:"edit[${row_cont[id]}]";s:7:"onclick";s:198:"window.open(egw::link(\'/index.php\',\'menuaction=importexport.importexport_schedule_ui.edit&id={$row_cont[id]}\'),\'_blank\',\'dependent=yes,width=600,height=450,scrollbars=yes,status=yes\'); return false;";}i:2;a:3:{s:4:"type";s:6:"button";s:4:"size";s:6:"delete";s:4:"name";s:23:"delete[{$row_cont[id]}]";}}}}s:4:"rows";i:2;s:4:"cols";i:8;}}i:3;a:1:{s:1:"A";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"1";s:4:"span";s:3:"all";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:3:"add";s:4:"name";s:3:"add";s:7:"onclick";s:179:"window.open(egw::link(\'/index.php\',\'menuaction=importexport.importexport_schedule_ui.edit\'),\'_blank\',\'dependent=yes,width=600,height=450,scrollbars=yes,status=yes\'); return false;";}}}}s:4:"rows";i:3;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1267034207',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.wizard_basic_import_csv.choosesepncharset','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:5:{i:0;a:1:{s:1:"B";s:5:"180px";}i:1;a:2:{s:1:"A";a:4:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:14:"Fieldseperator";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:7:"no_lang";s:1:"1";s:4:"name";s:8:"fieldsep";s:4:"size";s:1:"1";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:15:"Charset of file";}s:1:"B";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:7:"charset";s:4:"span";s:9:",width180";}}i:4;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:20:"Header lines to skip";}s:1:"B";a:3:{s:4:"type";s:3:"int";s:4:"name";s:16:"num_header_lines";s:4:"size";s:1:"0";}}}s:4:"rows";i:4;s:4:"cols";i:2;}}','size' => '','style' => '.width180 select { width:150px;}','modified' => '1268236708',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.wizard_basic_import_csv.conditions','template' => '','lang' => '','group' => '0','version' => '0.01','data' => 'a:1:{i:0;a:7:{s:4:"type";s:4:"vbox";s:4:"data";a:2:{i:0;a:0:{}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:6:"select";s:4:"name";s:14:"${row}[string]";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:2:{s:4:"type";s:6:"select";s:4:"name";s:12:"${row}[type]";}i:2;a:2:{s:4:"type";s:4:"text";s:4:"name";s:12:"${row}[op_2]";}}s:1:"C";a:2:{s:4:"type";s:6:"select";s:4:"name";s:12:"${row}[true]";}s:1:"D";a:2:{s:4:"type";s:6:"select";s:4:"name";s:13:"${row}[false]";}}}s:4:"rows";i:1;s:4:"cols";i:4;s:4:"size";s:1:"2";i:1;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:1:{s:2:"c1";s:2:"th";}i:1;a:6:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Field";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Condition";}s:1:"C";a:5:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";s:4:"span";s:1:"2";i:1;a:4:{s:4:"type";s:5:"label";s:4:"span";s:1:"2";s:5:"label";s:4:"True";s:5:"align";s:6:"center";}i:2;a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,2,0";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:6:"Action";}i:2;a:3:{s:4:"type";s:5:"label";s:5:"label";s:4:"Stop";s:5:"align";s:5:"right";}}}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:5:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";s:4:"span";s:1:"2";i:1;a:4:{s:4:"type";s:5:"label";s:4:"span";s:1:"2";s:5:"label";s:5:"False";s:5:"align";s:6:"center";}i:2;a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,2,0";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:6:"Action";}i:2;a:3:{s:4:"type";s:5:"label";s:5:"label";s:4:"Stop";s:5:"align";s:5:"right";}}}s:1:"F";a:1:{s:4:"type";s:5:"label";}}i:2;a:6:{s:1:"A";a:2:{s:4:"type";s:6:"select";s:4:"name";s:14:"${row}[string]";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:2:{s:4:"type";s:6:"select";s:4:"name";s:12:"${row}[type]";}i:2;a:2:{s:4:"type";s:4:"text";s:4:"name";s:12:"${row}[op_2]";}}s:1:"C";a:2:{s:4:"type";s:6:"select";s:4:"name";s:20:"${row}[true][action]";}s:1:"D";a:3:{s:4:"type";s:8:"checkbox";s:5:"align";s:6:"center";s:4:"name";s:18:"${row}[true][stop]";}s:1:"E";a:2:{s:4:"type";s:6:"select";s:4:"name";s:21:"${row}[false][action]";}s:1:"F";a:3:{s:4:"type";s:8:"checkbox";s:5:"align";s:6:"center";s:4:"name";s:19:"${row}[false][stop]";}}}s:4:"rows";i:2;s:4:"cols";i:6;s:4:"name";s:10:"conditions";s:7:"options";a:0:{}}i:2;a:5:{s:4:"type";s:6:"button";s:4:"name";s:3:"add";s:5:"label";s:3:"add";s:4:"help";s:59:"This causes a segfault... haven\'t figured out how to fix it";s:8:"disabled";s:1:"1";}}}','size' => '','style' => '','modified' => '1268236762',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.wizard_basic_import_csv.fieldmapping','template' => '','lang' => '','group' => '0','version' => '0.0.1','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:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";s:4:"span";s:3:"all";}}i:2;a:1:{s:1:"A";a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:1:{s:2:"c1";s:2:"th";}i:1;a:4:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"CSV Field";}s:1:"C";a:2:{s:4:"type";s:5:"label";s:5:"label";s:12:"Target Field";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:11:"Translation";}}i:2;a:4:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:6:"${row}";s:7:"no_lang";s:1:"1";}s:1:"B";a:3:{s:4:"type";s:5:"label";s:4:"name";s:16:"csv_fields[$row]";s:7:"no_lang";s:1:"1";}s:1:"C";a:3:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:19:"field_mapping[$row]";}s:1:"D";a:2:{s:4:"type";s:4:"text";s:4:"name";s:22:"field_conversion[$row]";}}}s:4:"rows";i:2;s:4:"cols";i:4;s:4:"size";s:10:",,,,,,auto";s:7:"options";a:1:{i:6;s:4:"auto";}}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1268236373',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.wizard_basic_import_csv.sample_file','template' => '','lang' => '','group' => '0','version' => '0.0.1','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:3:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";s:7:"no_lang";s:1:"1";}}i:2;a:1:{s:1:"A";a:2:{s:4:"type";s:4:"file";s:4:"name";s:4:"file";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1268236654',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.wizzardbox','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:3:{s:2:"c2";s:7:",bottom";s:2:"c1";s:4:",top";s:1:"A";s:4:"100%";}i:1;a:1:{s:1:"A";a:5:{s:4:"type";s:4:"hbox";s:7:"no_lang";s:1:"1";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:4:"hbox";s:7:"no_lang";s:1:"1";s:4:"size";s:1:"1";i:1;a:3:{s:4:"type";s:5:"image";s:7:"no_lang";s:1:"1";s:4:"name";s:12:"importexport";}}i:2;a:4:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"1";i:1;a:2:{s:4:"type";s:8:"template";s:4:"name";s:15:"wizzard_content";}s:4:"span";s:16:",wizzard_content";}}}i:2;a:1:{s:1:"A";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:3:"all";i:1;a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:4:{s:4:"type";s:6:"button";s:4:"name";s:16:"button[previous]";s:5:"label";s:8:"previous";s:7:"onclick";s:37:"xajax_eT_wrapper(this); return false;";}i:2;a:4:{s:4:"type";s:6:"button";s:4:"name";s:12:"button[next]";s:5:"label";s:4:"next";s:7:"onclick";s:37:"xajax_eT_wrapper(this); return false;";}i:3;a:4:{s:4:"type";s:6:"button";s:4:"name";s:14:"button[finish]";s:5:"label";s:6:"finish";s:7:"onclick";s:37:"xajax_eT_wrapper(this); return false;";}}i:2;a:5:{s:4:"type";s:6:"button";s:4:"name";s:14:"button[cancel]";s:5:"label";s:6:"cancel";s:7:"onclick";s:29:"window.close(); return false;";s:5:"align";s:5:"right";}s:5:"align";s:5:"right";}}}s:4:"rows";i:2;s:4:"cols";i:1;s:4:"size";s:4:",400";s:7:"options";a:1:{i:1;s:3:"400";}}}','size' => ',400','style' => '.wizzard_content fieldset {
|
||||
height: 347px;
|
||||
width: 250px;
|
||||
|
Loading…
Reference in New Issue
Block a user