Adapt importexport for etemplate2

This commit is contained in:
Nathan Gray 2013-11-01 22:04:43 +00:00
parent 1e786ec974
commit 7f98f428a0
30 changed files with 719 additions and 559 deletions

View File

@ -16,6 +16,7 @@ require_once EGW_INCLUDE_ROOT.'/etemplate/inc/class.etemplate_widget_textbox.inc
require_once EGW_INCLUDE_ROOT.'/etemplate/inc/class.etemplate_widget_grid.inc.php';
require_once EGW_INCLUDE_ROOT.'/etemplate/inc/class.etemplate_widget_checkbox.inc.php';
require_once EGW_INCLUDE_ROOT.'/etemplate/inc/class.contact_widget.inc.php';
include_once EGW_INCLUDE_ROOT.'/importexport/inc/class.importexport_widget_filter.inc.php';
/**
* eTemplate widget baseclass

View File

@ -59,9 +59,8 @@ class importexport_definitions_ui
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
$GLOBALS['egw']->translation->add_app(self::_appname);
$GLOBALS['egw_info']['flags']['currentapp'] = self::_appname;
$GLOBALS['egw_info']['flags']['include_xajax'] = true;
$this->etpl = new etemplate();
$this->etpl = new etemplate_new();
$this->clock = html::image(self::_appname,'clock');
$this->steps = array(
'wizard_step10' => lang('Choose an application'),
@ -163,7 +162,6 @@ class importexport_definitions_ui
'no_cat' => true,
'no_filter' => true,
'no_filter2' => true,
'header_right' => 'importexport.definition_index.add',
'csv_fields' => false, // Disable CSV export, uses own export
'default_cols' => '!actions', // switch legacy actions column and row off by default
'row_id' => 'definition_id',
@ -189,7 +187,7 @@ class importexport_definitions_ui
}
if($msg) $content['msg'] = $msg;
$etpl = new etemplate(self::_appname.'.definition_index');
$etpl = new etemplate_new(self::_appname.'.definition_index');
return $etpl->exec( self::_appname.'.importexport_definitions_ui.index', $content, $sel_options, $readonlys, $preserv );
}
@ -489,32 +487,19 @@ class importexport_definitions_ui
function wizard($content = null, $msg='')
{
$GLOBALS['egw_info']['flags']['java_script'] .=
"<script type='text/javascript'>
function xajax_eT_wrapper_init() {
//window.resizeTo(document.documentElement.scrollWidth+20,document.documentElement.offsetHeight+40);
window.moveTo(screen.availWidth/2 - window.outerWidth/2,
screen.availHeight/2 - window.outerHeight/2);
}
</script>";
$this->etpl->read('importexport.wizardbox');
$this->wizard_content_template =& $this->etpl->children[0]['data'][1]['A'][2][1]['name'];
if(is_array($content) &&! $content['edit'])
{
if(self::_debug) error_log('importexport.wizard->$content '. print_r($content,true));
foreach($content as $key => $val) error_log(" $key : ".array2string($val));
// fetch plugin object
if($content['plugin'] && $content['application'])
{
$wizard_name = $content['application'] . '_wizard_' . str_replace($content['application'] . '_', '', $content['plugin']);
// we need to deal with the wizard object if exists
if (file_exists(EGW_SERVER_ROOT . '/'. $content['application'].'/importexport/class.wizard_'. $content['plugin'].'.inc.php'))
{
error_log('Deprecated location for importexport wizard. Please move it to app/inc/ and rename it to follow new conventions');
}
elseif (file_exists(EGW_SERVER_ROOT . '/'. $content['application']."/inc/class.$wizard_name.inc.php"))
if (file_exists(EGW_SERVER_ROOT . '/'. $content['application']."/inc/class.$wizard_name.inc.php"))
{
$wizard_plugin = $wizard_name;
}
@ -539,7 +524,8 @@ class importexport_definitions_ui
}
// post process submitted step
if($content['step']) {
if($content['step'])
{
if(!$this->can_edit($content))
{
// Each step changes definition, reload it
@ -549,30 +535,28 @@ class importexport_definitions_ui
}
if(!key_exists($content['step'],$this->steps))
{
$next_step = $this->plugin->$content['step']($content);
$next_step = $this->plugin->$content['step']($content,$sel_options,$readonlys,$preserv);
}
else
{
$next_step = $this->$content['step']($content);
$next_step = $this->$content['step']($content,$sel_options,$readonlys,$preserv);
}
} else {
}
else
{
die('Cannot find next step');
}
// pre precess next step
$sel_options = $readonlys = $preserv = array();
// Override next button on step 30, to do a regular submit for the file upload
if($next_step == 'wizard_step30')
{
$this->etpl->set_cell_attribute('button[next]', 'onclick', '');
}
// Disable finish button if required fields are missing
if(!$content['name'] || !$content['type'] || !$content['plugin']) {
$GLOBALS['egw']->js->set_onload("disable_button('exec[button][finish]');");
if(!$content['name'] || !$content['type'] || !$content['plugin'])
{
$readonlys['button[finish]'] = true;
}
do {
do
{
if(!key_exists($next_step,$this->steps))
{
$this->wizard_content_template = $this->plugin->$next_step($content,$sel_options,$readonlys,$preserv);
@ -593,25 +577,29 @@ class importexport_definitions_ui
}
}
} while($this->wizard_content_template == self::SKIP);
if(!$this->can_edit($content))
{
$readonlys[$this->wizard_content_template] = true;
$preserve = $content;
$GLOBALS['egw']->js->set_onload("disable_button('exec[button][finish]');");
$readonlys['button[finish]'] = true;
}
$html = $this->etpl->exec(self::_appname.'.importexport_definitions_ui.wizard',$content,$sel_options,$readonlys,$preserv,1);
unset($content['button']);
$content['wizard_content'] = $this->wizard_content_template;
error_log('------- STARTING EXEC --------');
$this->etpl->exec(self::_appname.'.importexport_definitions_ui.wizard',$content,$sel_options,$readonlys,$preserv);
error_log('------- DONE EXEC --------');
}
else
{
// initial content
$GLOBALS['egw']->js->set_onload("xajax_eT_wrapper_init();");
$GLOBALS['egw']->js->set_onload("disable_button('exec[button][previous]');");
$sel_options = $readonlys = $preserv = array();
$readonlys['button[previous]'] = true;
if($content['edit'])
{
unset ($content['edit']);
}
$this->wizard_content_template = $this->wizard_step10($content, $sel_options, $readonlys, $preserv);
@ -619,62 +607,11 @@ class importexport_definitions_ui
{
$readonlys[$this->wizard_content_template] = true;
$preserve = $content;
$GLOBALS['egw']->js->set_onload("disable_button('exec[button][finish]');");
$readonlys['button[finish]'] = true;
}
$html = $this->etpl->exec(self::_appname.'.importexport_definitions_ui.wizard',$content,$sel_options,$readonlys,$preserv,1);
}
if(class_exists('xajaxResponse'))
{
$this->response = new xajaxResponse();
egw_framework::include_css_js_response();
if ($content['closewindow'])
{
$this->response->addScript("opener.location.reload();");
$this->response->addScript("window.close();");
// If Browser can't close window we display a "close" buuton and
// need to disable normal buttons
$this->response->addAssign('exec[button][previous]','style.display', 'none');
$this->response->addAssign('exec[button][next]','style.display', 'none');
$this->response->addAssign('exec[button][finish]','style.display', 'none');
$this->response->addAssign('exec[button][cancel]','style.display', 'none');
}
$this->response->addAssign('contentbox', 'innerHTML', $html);
if (($onload = $GLOBALS['egw']->js->set_onload('')))
{
$this->response->addScript($onload);
}
$this->response->addAssign('picturebox', 'style.display', 'none');
$this->response->addScript("set_style_by_class('div','popupManual','display','inline');
popup_resize();
");
return $this->response->getXML();
}
else
{
$GLOBALS['egw']->js->set_onload("document.getElementById('picturebox').style.display = 'none';");
egw_framework::validate_file('.', 'etemplate', 'etemplate');
egw_framework::validate_file('.', 'etemplate', 'etemplate');
common::egw_header();
echo '<div id="divMain">'."\n";
echo '<div><h3>{Im|Ex}port Wizard</h3></div>';
// adding a manual icon to every popup
if ($GLOBALS['egw_info']['user']['apps']['manual'])
{
$manual = new etemplate('etemplate.popup.manual');
echo $manual->exec(self::_appname.'.importexport_definitions_ui.wizard',$content,$sel_options,$readonlys,$preserv,1);
unset($manual);
}
echo '<div id="contentbox">';
echo $html;
echo '</div></div>'."\n";
echo '<style type="text/css">#picturebox { position: absolute; right: 27px; top: 24px; }</style>'."\n";
echo '<div id="picturebox">'. $this->clock. '</div>';
return;
$content['wizard_content'] = $this->wizard_content_template;
$this->etpl->exec(self::_appname.'.importexport_definitions_ui.wizard',$content,$sel_options,$readonlys,$preserv);
}
}
@ -735,7 +672,7 @@ class importexport_definitions_ui
$sel_options['application'][$appname] = lang($appname);
}
}
$GLOBALS['egw']->js->set_onload("disable_button('exec[button][previous]');");
$readonlys['button[previous]'] = true;
$content['step'] = 'wizard_step10';
$preserv = $content;
unset ($preserv['button']);
@ -766,9 +703,7 @@ class importexport_definitions_ui
return $this->get_step($content['step'],1);
case 'previous' :
unset ($content['plugin']);
if(is_object($this->response)) {
$this->response->addScript("disable_button('exec[button][previous]');");
}
$readonlys['button[previous]'] = true;
return $this->get_step($content['step'],-1);
case 'finish':
return 'wizard_finish';
@ -900,8 +835,9 @@ class importexport_definitions_ui
// Set owner for non-admins
$content['just_me'] = ((!$content['allowed_users'] || !$content['allowed_users'][0] && count($content['allowed_users']) ==1) && $content['owner']);
//if(!$GLOBALS['egw_info']['user']['apps']['admin'] && !$GLOBALS['egw']->acl->check('share_definition', EGW_ACL_READ, 'importexport')) {
if(!$GLOBALS['egw']->acl->check('share_definition', EGW_ACL_READ, 'importexport') && !$GLOBALS['egw_info']['user']['apps']['admin']) {
$content['all_users'] = is_array($content['allowed_users']) && array_key_exists('0',$content['allowed_users']) || $content['allowed_users'] == 'all';
if(!$GLOBALS['egw']->acl->check('share_definition', EGW_ACL_READ, 'importexport') && !$GLOBALS['egw_info']['user']['apps']['admin'])
{
$content['allowed_users'] = array();
$readonlys['allowed_users'] = true;
$readonlys['just_me'] = true;
@ -919,10 +855,8 @@ class importexport_definitions_ui
$content['no_all_users'] = true;
}
unset ($preserv['button']);
$GLOBALS['egw']->js->set_onload("disable_button('exec[button][next]');");
if(is_object($this->response)) {
$this->response->addAssign('exec[button][next]','style.display', 'none');
}
$readonlys['button[next]'] = true;
return 'importexport.wizard_chooseallowedusers';
}
}
@ -939,7 +873,8 @@ class importexport_definitions_ui
$bodefinitions->save($content);
// This message is displayed if browser cant close window
$content['msg'] = lang('ImportExport wizard finished successfully!');
$content['closewindow'] = true;
egw_framework::refresh_opener('','importexport');
egw_framework::window_close();
return 'importexport.wizard_close';
}

View File

@ -48,7 +48,7 @@ class importexport_export_ui {
$readonlys = array();
$preserv = array();
$et = new etemplate(self::_appname. '.export_dialog');
$et = new etemplate_new(self::_appname. '.export_dialog');
$_appname = $_content['appname'] ? $_content['appname'] : $_GET['appname'];
$_definition = $_content['definition'] ? $_content['definition'] : $_GET['definition'];
$_plugin = $_content['plugin'] ? $_content['plugin'] : $_GET['plugin'];
@ -68,7 +68,7 @@ class importexport_export_ui {
$content['appname'] = $_appname;
$preserv['appname'] = $_appname;
if(empty($_appname)) {
$this->js->set_onload('$j("tr.select_definition").css("display","none");');
$et.setElementAttribute('select_definition','disabled',true);
}
// Check for preferred definition
@ -148,7 +148,7 @@ class importexport_export_ui {
if(!$sel_options['delimiter'][$content['delimiter']]) $sel_options['delimiter'][$content['delimiter']] = $content['delimiter'];
$sel_options['delimiter'][$content['delimiter']] = lang('Use default') . ' "' . $sel_options['delimiter'][$content['delimiter']] . '"';
if(!$_content['delimiter']) $this->js->set_onload('jQuery(\'[other_delimiter]\').hide();');
if(!$_content['delimiter']) $et->setElementAttribute('other_delimiter','disabled',true);
// Other delimiter (options)
if($_content['other_delimiter']) $_content['delimiter'] = $_content['other_delimiter'];
@ -223,11 +223,6 @@ class importexport_export_ui {
}
}
}
} elseif (!$_selection) {
$this->js->set_onload("
disable_button('exec[preview]');
disable_button('exec[export]');
");
}
$preserv['old_definition'] = $content['definition'];
@ -257,20 +252,14 @@ class importexport_export_ui {
$sel_options['appname'] = array('' => lang('Select one')) + array_combine($apps,$apps);
if(!$_application && !$selected_plugin) {
$content['plugin_selectors_html'] = $content['plugin_options_html'] =
lang('You need to select an app and format first!');
$this->js->set_onload("document.getElementById('importexport.export_dialog.options_tab-tab').style.visibility='hidden';");
$this->js->set_onload("document.getElementById('importexport.export_dialog.selection_tab-tab').style.visibility='hidden';");
lang('You need to select an app and format first!');
$readonlys[$tabs] = array('selection_tab' => true, 'options_tab' => true);
}
// disable preview box
$this->js->set_onload('$j(\'tr.preview-box\').hide();');
//xajax_eT_wrapper submit
if(class_exists('xajaxResponse'))
if($_content['preview'] || $_content['export'])
{
//error_log(__LINE__.__FILE__.'$_content: '.print_r($_content,true));
$response = new xajaxResponse();
$response = egw_json_response::get();
if ($_content['definition'] == 'expert') {
$definition = new importexport_definition();
@ -294,7 +283,7 @@ class importexport_export_ui {
// Set filter
// Note that because not all dates are DB dates, the plugin has to handle them
$filter = $definition->filter;
$filter = array();
if(is_array($_content['filter']))
{
foreach($_content['filter'] as $key => $value)
@ -317,6 +306,8 @@ class importexport_export_ui {
}
}
}
error_log(array2string($filter));
unset($_content['filter']);
$definition->filter = $filter;
@ -326,8 +317,8 @@ class importexport_export_ui {
);
if(!$definition->plugin_options['selection']) {
$response->addScript('alert("' . lang('No records selected') . '");');
return $response->getXML();
$response->alert( lang('No records selected'));
return;
}
$tmpfname = tempnam($GLOBALS['egw_info']['server']['temp_dir'],'export');
@ -352,11 +343,6 @@ class importexport_export_ui {
if(is_object($result) && method_exists($result, 'get_num_of_records'))
{
$record_count = $result->get_num_of_records();
if($record_count == 0)
{
$response->addScript('alert("' . lang('No matching records') . '");');
return $response->getXML();
}
}
// Store charset to use in header
@ -365,7 +351,6 @@ class importexport_export_ui {
if($_content['export'] == 'pressed') {
fclose($file);
$filename = pathinfo($tmpfname, PATHINFO_FILENAME);
$response->addScript("xajax_eT_wrapper();");
$link_query = array(
'menuaction' => 'importexport.importexport_export_ui.download',
'_filename' => $filename,
@ -379,9 +364,9 @@ class importexport_export_ui {
{
$link_query['filename'] = $plugin_filename;
}
$response->addScript("opener.location.href='". $GLOBALS['egw']->link('/index.php',$link_query)."'");
$response->addScript('window.setTimeout("window.close();", 100);');
return $response->getXML();
$response->redirect( $GLOBALS['egw']->link('/index.php',$link_query),true);
egw_framework::window_close();
return;
}
elseif($_content['preview'] == 'pressed') {
fseek($file, 0);
@ -392,7 +377,7 @@ class importexport_export_ui {
'[\030]','[\031]','[\032]','[\033]','[\034]','[\035]','[\036]','[\037]');
$replace = $preview = '';
while(!feof($file) && $item_count < 10) {
while(!feof($file) && $item_count < 30) {
$preview .= preg_replace($search,$replace,fgets($file,1024));
$item_count++;
}
@ -406,15 +391,10 @@ class importexport_export_ui {
$GLOBALS['egw']->translation->charset()
);
if($record_count)
{
$preview = "<div class='header'>".lang('Preview') . "<span class='count'>$record_count</span></div>".$preview;
}
$response->addAssign('exec[preview-box]','innerHTML',nl2br($preview));
$response->jquery('.preview_box','show');
$response->addScript("xajax_eT_wrapper();");
return $response->getXML();
$preview = "<div class='header'>".lang('Preview') . "<span class='count'>".(int)$record_count."</span></div>".$preview;
$et->setElementAttribute('preview-box', 'value', nl2br($preview));
return;
}
//nothing else expected!
throw new Exception('Error: unexpected submit in export_dialog!');
@ -441,7 +421,6 @@ class importexport_export_ui {
'type' => 'export',
'application' => $_appname
));
$response->addScript("clear_options('exec[definition]');");
foreach ((array)$definitions->get_definitions() as $identifier) {
try {
$definition = new importexport_definition($identifier);
@ -457,109 +436,33 @@ class importexport_export_ui {
}
unset($definitions);
$response->addScript("selectbox_add_option('exec[definition]','" . lang('Expert options') . "', 'expert',".($selected_plugin == $title ? 'true' : 'false').");");
if($selected_plugin == 'expert') {
$this->ajax_get_plugins($_appname, $response);
} else {
$response->jquery('tr.select_plugin','hide');
}
$response->addScript('export_dialog.change_definition(document.getElementById("exec[definition]"));');
$response->addScript('$j("tr.select_definition").css("display","table-row");');
return $no_return ? '' : $response->getXML();
}
public function ajax_get_plugins($_appname, xajaxResponse &$response = null) {
if(!is_null($response)) {
$no_return = true;
} else {
$response = new xajaxResponse();
}
if (!$_appname) {
$response->jquery('tr.select_plugin','hide');
return $no_return ? '' : $response->getXML();
}
public function ajax_get_definition_description($_definition) {
(array)$plugins = importexport_helper_functions::get_plugins($_appname,'export');
$sel_options['plugin'] = '';
$response->addScript("clear_options('exec[plugin]');");
foreach ($plugins[$_appname]['export'] as $plugin => $plugin_name) {
if (!$selected_plugin) $selected_plugin = $plugin;
$response->addScript("selectbox_add_option('exec[plugin]','$plugin_name', '$plugin',".($selected_plugin == $plugin ? 'true' : 'false').");");
$_response = egw_json_response::get();
$description = '';
if ($_definition)
{
$_object = new importexport_definition($_definition);
if (is_a($_object, 'importexport_definition')) {
$description = $_object->description;
}
unset ($_object);
}
$this->ajax_get_plugin_description($selected_plugin,$response);
$this->ajax_get_plugin_options($selected_plugin, $response, $_definition);
$this->ajax_get_plugin_selectors($selected_plugin, $response, $_definition);
$response->addScript('$j("tr.select_plugin").css("display","table-row");');
return $no_return ? '' : $response->getXML();
$_response->assign('importexport-export_dialog_plugin_description','innerHTML',$description);
}
public function ajax_get_definition_description($_definition, xajaxResponse &$response=null) {
$no_return = !is_null($response);
if(is_null($response)) {
$response = new xajaxResponse();
}
if (!$_definition) return $response->getXML();
$_object = new importexport_definition($_definition);
if (is_a($_object, 'importexport_definition')) {
$description = $_object->description;
$response->assign('exec[plugin_description]','innerHTML',$description);
}
unset ($_object);
return $no_return ? '' : $response->getXML();
}
public function ajax_get_plugin_description($_plugin,&$_response=false) {
$no_return = !is_null($_response);
if(is_null($_response)) {
$_response = new xajaxResponse();
}
if (!$_plugin) return $no_return ? '' : $response->getXML();
public function ajax_get_plugin_description($_plugin) {
$_respone = egw_json_response::get();
$plugin_object = new $_plugin;
if (is_a($plugin_object, 'importexport_iface_export_plugin')) {
$description = $plugin_object->get_description();
$_response->addAssign('exec[plugin_description]','innerHTML',$description);
if (isset($definition->plugin_options['selection'])) {
$_response->addScript("document.getElementById('importexport.export_dialog.selection_tab-tab').style.visibility='hidden';");
}
$this->ajax_get_plugin_options($_plugin, $_response);
}
$_response->addAssign('importexport-export_dialog_plugin_description','innerHTML',$description);
unset ($plugin_object);
return $no_return ? '' : $response->getXML();
}
public function ajax_get_plugin_options($_plugin,&$response=false, $definition = '') {
$no_return = !is_null($response);
if(is_null($response)) {
$response = new xajaxResponse();
}
if (!$_plugin) return $no_return ? '' : $response->getXML();
$plugin_object = new $_plugin;
if (is_a($plugin_object, 'importexport_iface_export_plugin')) {
$options = $plugin_object->get_options_etpl();
ob_start();
$template = new etemplate($options);
/*
$template->exec('importexport.importexport_export_ui.dialog', array(), array(), array(), array(), 2);
$html = ob_get_clean();
ob_end_clean();
*/
$html = $template->exec('importexport.importexport_export_ui.dialog', array(), array(), array(), array(), 1);
$html = preg_replace('|<input.+id="etemplate_exec_id".*/>|',
'',
$html
);
$response->addAssign('importexport.export_dialog.options_tab', 'innerHTML', $html);
}
unset ($plugin_object);
return $no_return ? '' : $response->getXML();
}
/**
@ -594,40 +497,4 @@ class importexport_export_ui {
// Try to avoid any extra finishing output
common::egw_exit();
}
public function ajax_get_plugin_selectors($_plugin,&$response=false, $definition = '') {
$no_return = !is_null($response);
if(is_null($response)) {
$response = new xajaxResponse();
}
if (!$_plugin) return $no_return ? '' : $response->getXML();
$plugin_object = new $_plugin;
if (is_a($plugin_object, 'importexport_iface_export_plugin')) {
$options = $plugin_object->get_selectors_etpl();
ob_start();
etemplate::$name_vars='exec';
$template = new etemplate($options);
$html = $template->exec('importexport.importexport_export_ui.dialog', array(), array(), array(), array(), 1);
//$html = ob_get_clean();
ob_end_clean();
$pattern = array(
'|<input.+id="etemplate_exec_id".*/>|',
'|<input(.+)name="exec[0-9]*\[|'
);
$html = preg_replace($pattern,
array('', '<input\\1name="exec['),
$html
);
$response->addAssign('importexport.export_dialog.selection_tab', 'innerHTML', $html);
}
unset ($plugin_object);
return $no_return ? '' : $response->getXML();
}
public function ajax_get_template($_name) {
}
} // end class uiexport

View File

@ -633,19 +633,19 @@ class importexport_helper_functions {
// This isn't quite right - there's only 2 options and you can select both
$settings['type'] = 'select-bool';
$settings['rows'] = 1;
$settings['enhance'] = true;
$settings['tags'] = true;
break;
case 'select-cat':
$settings['rows'] = "5,,,$app_name";
$settings['enhance'] = true;
$settings['tags'] = true;
break;
case 'select-account':
$settings['rows'] = '5,both';
$settings['enhance'] = true;
$settings['tags'] = true;
break;
case 'select':
$settings['rows'] = 5;
$settings['enhance'] = true;
$settings['tags'] = true;
break;
}
}

View File

@ -43,6 +43,8 @@
$appname = $_GET['appname'] ? $_GET['appname'] : $content['appname'];
$definition = $_GET['definition'] ? $_GET['definition'] : $content['definition'];
$template = new etemplate_new('importexport.import_dialog');
// Load application's translations
if($appname)
{
@ -115,10 +117,15 @@
$this->message .= '<b>' . lang('Import aborted').":</b><br />\n";
$definition_obj->plugin_options = (array)$definition_obj->plugin_options + array('dry_run' => true);
}
$this->message .= implode($check_message, "<br />\n") . "<br />\n";
if(count($check_message))
{
$this->message .= implode($check_message, "<br />\n") . "<br />\n";
}
if($content['dry-run'])
{
echo $this->preview($plugin, $file, $definition_obj);
$preview = $this->preview($plugin, $file, $definition_obj);
$template->setElementAttribute('preview', 'value', $preview);
if(trim($this->message) == '') return;
}
else
{
@ -138,7 +145,10 @@
$this->message .= lang('%1 records processed', $count);
// Refresh opening window
if(!$content['dry-run']) $GLOBALS['egw']->js->set_onload("window.opener.egw_refresh('".lang('%1 records processed',$count) . "','$appname',null,null,'$appname');");
if(!$content['dry-run'])
{
egw_framework::refresh_opener(lang('%1 records processed',$count), $appname, null,null,$appname);
}
$total_processed = 0;
foreach($plugin->get_results() as $action => $a_count) {
$this->message .= "<br />\n" . lang($action) . ": $a_count";
@ -197,7 +207,6 @@
if($_GET['appname']) $readonlys['appname'] = true;
$template = new etemplate('importexport.import_dialog');
$template->exec('importexport.importexport_import_ui.import_dialog', $data, $sel_options, $readonlys, $preserve, 2);
}
@ -317,7 +326,7 @@
if($count != $total_processed) $this->message .= "<br />\n".lang('Some records may not have been imported');
$this->message .= "<br />\n";
}
return '<h2>' . lang('Preview') . ' - ' . $plugin->get_name() . '</h2>' . $preview;
return '<div class="header">' . lang('Preview') . ' - ' . $plugin->get_name() . '</div>' . $preview;
}
/**

View File

@ -26,7 +26,7 @@
protected static $template;
public function __construct() {
$this->template = new etemplate();
$this->template = new etemplate_new();
}
public function index($content = array()) {

View File

@ -21,68 +21,55 @@
*
* Most text fields are ignored.
*/
class filter_widget extends customfields_widget
class importexport_widget_filter extends etemplate_widget_transformer
{
public $prefix = '';
public $human_name = array(
'filter' => 'Import|Export filter'
);
public function __construct($ui, $appname = null)
{
$this->advanced_search = true;
parent::__construct($ui, $appname);
}
protected static $prefix = '';
protected static $transformation = array(
'type' => 'customfields'
);
/**
* pre-processing of the extension
*
* This function is called before the extension gets rendered
*
* @param string $form_name form-name of the control
* @param mixed &$value value / existing content, can be modified
* @param array &$cell array with the widget, can be modified for ui-independent widgets
* @param array &$readonlys names of widgets as key, to be made readonly
* @param mixed &$extension_data data the extension can store persisten between pre- and post-process
* @param etemplate &$tmpl reference to the template we belong too
* @return boolean true if extra label is allowed, false otherwise
*/
public function pre_process($form_name,&$value,&$cell,&$readonlys,&$extension_data,$tmpl)
{
* Adapt the settings to custom fields widget
*
* @param string $cname
*/
public function beforeSendToClient($cname)
{
$form_name = self::form_name($cname, $this->id);
if($this->getElementAttribute($form_name, 'customfields'))
{
// Already done?
return;
}
$value =& self::get_array(self::$request->content, $form_name, true);
$fields = $value['fields'];
unset($value['fields']);
$relative_dates = $this->attrs['relative_dates'];
list($relative_dates) = explode(',',$cell['size']);
if($cell['relative_dates']) $relative_dates = true;
$this->setElementAttribute($form_name, 'prefix', self::$prefix);
// Fallback, so there's something there...
if(!is_array($fields))
{
$cell['type'] = 'label';
$cell['label'] = 'No fields';
return True;
}
// making the cell an empty grid
$cell['type'] = 'grid';
$cell['data'] = array(array());
$cell['rows'] = $cell['cols'] = 0;
$cell['size'] = '';
$n = 1;
foreach($fields as $lname => $field)
{
$new_row = null; boetemplate::add_child($cell,$new_row);
$row_class = 'row';
boetemplate::add_child($cell,$label =& boetemplate::empty_cell('label','',array(
'label' => $field['label'],
'no_lang' => substr(lang($field['label']),-1) == '*' ? 2 : 0,
'span' => $field['type'] === 'label' ? '2' : '',
)));
switch($field['type'])
{
error_log("$this has no fields");
self::$transformation = array(
'type' => 'label',
'label' => 'No fields'
);
return parent::beforeSendToClient($cname);
}
error_log(array2string(array_keys($fields)));
$n = 1;
foreach($fields as $lname => &$field)
{
$type =& $field['type'];
// No filters are required
$field['needed'] = false;
switch($type)
{
case 'date':
case 'date-time':
@ -90,7 +77,13 @@ class filter_widget extends customfields_widget
$options = '';
if($relative_dates)
{
$input = self::do_relative_date($lname, $value, $options, $readonly);
$type = 'select';
$field['values'] = array('', lang('all'));
foreach(importexport_helper_functions::$relative_dates as $label => $values)
{
$field['values'][$label] = lang($label);
}
$this->setElementAttribute($form_name.'['.self::$prefix.$lname.']', 'tags', TRUE);
}
else
{
@ -119,19 +112,7 @@ class filter_widget extends customfields_widget
}
$options = array_merge($options, array_intersect_key($field['values'], array_flip(ajax_select_widget::$known_options)));
$input = boetemplate::empty_cell('ajax_select', $lname, array(
'readonly' => $readonly,
'no_lang' => True,
'size' => $options
));
break;
case 'link-entry':
$input =& boetemplate::empty_cell('link-entry',$this->prefix.$lname,array(
'size' => $field['type'] == 'link-entry' ? '' : $field['type'],
));
// register post-processing of link widget to get eg. needed/required validation
etemplate_old::$request->set_to_process(etemplate_old::form_name($form_name,$this->prefix.$lname), 'ext-link');
break;
case 'select':
default:
@ -151,51 +132,37 @@ class filter_widget extends customfields_widget
// We don't want the 'All' or 'Select...' if it's there
unset($field['values']['']);
$input =& boetemplate::empty_cell($field['type'],$lname,array(
'sel_options' => $field['values'],
'size' => $field['rows'],
'enhance' => true,
'no_lang' => True,
));
$this->setElementAttribute($form_name.'['.self::$prefix.$lname.']', 'empty_label', '');
$this->setElementAttribute($form_name.'['.self::$prefix.$lname.']', 'tags', TRUE);
$this->setElementAttribute($form_name.'['.self::$prefix.$lname.']', 'multiple', TRUE);
}
elseif (in_array($field['type'], array_keys(egw_link::app_list())))
else
{
// Link entry to a specific app
$input =& boetemplate::empty_cell('link-entry',$lname,array(
'size' => $field['type'] == 'link-entry' ? '' : $field['type'],
));
// register post-processing of link widget to get eg. needed/required validation
etemplate_old::$request->set_to_process(etemplate_old::form_name($form_name,$lname), 'ext-link');
} else {
error_log('Trying to filter with unsupported field type: ' . $field['type']);
$input =& boetemplate::empty_cell($field['type'],$lname,array(
'sel_options' => $field['values'],
'size' => $field['rows'],
'no_lang' => True,
));
}
}
$cell['data'][0]['c'.$n++] = $row_class.',top';
if (!is_null($input))
error_log($type);
$widget = self::factory($type, '<'.$type.' type="'.$type.'" id="'.self::$prefix.$lname.'"/>', self::$prefix.$lname);
if(method_exists($widget, 'beforeSendToClient'))
{
if ($readonly) $input['readonly'] = true;
$input['needed'] = $cell['needed'] || $field['needed'];
if (!empty($field['help']) && $row_class != 'th')
$widget->id = self::$prefix.$lname;
$widget->attrs['type'] = $type;
if($type == 'link-to')
{
$input['help'] = $field['help'];
$input['no_lang'] = substr(lang($help),-1) == '*' ? 2 : 0;
$widget->attrs['only_app'] = $field['type'];
}
boetemplate::add_child($cell,$input);
unset($input);
$widget->beforeSendToClient($cname);
}
unset($label);
unset($widget);
}
$this->setElementAttribute($form_name, 'customfields', $fields);
$this->setElementAttribute($form_name, 'fields',array_fill_keys(array_keys($fields), true));
error_log($this);
parent::beforeSendToClient($cname);
return false;
}
@ -258,4 +225,24 @@ error_log('Trying to filter with unsupported field type: ' . $field['type']);
boetemplate::add_child($input, $to);
return $input;
}
public function validate($cname, array $expand, array $content, &$validated=array())
{
$form_name = self::form_name($cname, $this->id, $expand);
error_log('Validating ' . $form_name);
if (!$this->is_readonly($cname, $form_name))
{
$value_in = self::get_array($content, $form_name);
$valid =& self::get_array($validated, $this->id ? $form_name : $field, true);
foreach($value_in as $key => $value)
{
// Client side cf widget automatically prefixes #
$valid[substr($key,strlen(self::$prefix))] = $value;
}
}
}
}
// Register, or it won't be found
etemplate_widget::registerWidget('importexport_widget_filter', array('filter'));

View File

@ -269,6 +269,8 @@ class importexport_wizard_basic_export_csv
$preserv = $content;
unset ($preserv['button']);
error_log('-------');
error_log('Filter ' . array2string($content['filter']));
$content['set_filter']['fields'] = importexport_helper_functions::get_filter_fields(
$content['application'],$content['plugin'],$this
);
@ -278,6 +280,8 @@ class importexport_wizard_basic_export_csv
$content['set_filter'][$field] = $content['filter'][$field];
}
error_log('SET FILTER ' . array2string($content['set_filter']));
error_log('----------');
if(!$content['set_filter']['fields'])
{
// No fields

View File

@ -79,9 +79,7 @@ class importexport_wizard_basic_import_csv
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',$content['application'],$csvfile);
$GLOBALS['egw']->session->appsession('csvfile',$content['application'],$content['file']['tmp_name']);
}
unset($content['file']);
return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1);
@ -126,6 +124,7 @@ class importexport_wizard_basic_import_csv
// Process sample file for fields
if (($handle = fopen($GLOBALS['egw']->session->appsession('csvfile',$content['application']), "rb")) !== FALSE) {
$data = fgetcsv($handle, 8000, $content['fieldsep']);
error_log($data);
fclose($handle);
// Remove & forget file
@ -270,31 +269,24 @@ class importexport_wizard_basic_import_csv
// return from step50
if ($content['step'] == 'wizard_step50')
{
for($i = 0; $i <= count($content['csv_fields']); $i++) {
unset($content[$i]);
}
if(!$content['csv_fields'][0]) {
array_shift($content['csv_fields']);
}
// Need to move everything down 1 to remove header, but shift will re-key
if(!$content['field_mapping'][0] || $content['field_mapping'][0] == $content['field_mapping'][1]) {
unset($content['field_mapping'][0]);
if(is_array($content['field_conversion'])) unset($content['field_conversion'][0]);
foreach(array('field_mapping', 'field_conversion') as $field) {
ksort($content[$field]);
foreach($content[$field] as $key => $value)
unset($content['field_mapping']);
unset($content['field_conversion']);
foreach($content['mapping'] as $field)
{
$index = $field['index'];
foreach(array('conversion'=>'field_conversion', 'field' => 'field_mapping') as $id => $dest)
{
if(trim($field[$id]) != '')
{
if($value && $value != '--NONE--') {
$content[$field][$key-1] = $content[$field][$key];
}
unset($content[$field][$key]);
$content[$dest][$index] = trim($field[$id]);
}
ksort($content[$field]);
}
}
foreach($content['field_conversion'] as $field => $convert) {
if(!trim($convert)) unset($content['field_conversion'][$field]);
foreach($content['csv_fields'] as $index => $title)
{
error_log("$index: $title => {$content['field_mapping'][$index]}");
}
unset($content['mapping']);
switch (array_search('pressed', $content['button']))
{
case 'next':
@ -312,41 +304,19 @@ class importexport_wizard_basic_import_csv
{
$content['msg'] = $this->steps['wizard_step50'];
$content['step'] = 'wizard_step50';
$content['mapping'] = array(false);
foreach($content['csv_fields'] as $index => $title)
{
$content['mapping'][] = array(
'index' => $index,
'title' => $title,
'field' => $content['field_mapping'][$index],
'conversion' => $content['field_conversion'][$index]
);
}
$preserv = $content;
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'));
// Need to move everything down 1 to make room for header, but unshift will re-key
// which causes problems if you skip a field.
foreach(array('field_mapping', 'field_conversion') as $field) {
foreach(array_reverse($content[$field], true) as $key => $value)
{
if($value) {
$content[$field][$key+1] = $content[$field][$key];
}
unset($content[$field][$key]);
}
ksort($content[$field]);
}
$j = 1;
$i = 0;
foreach ($content['csv_fields'] as $field)
{
$content[++$i]['index'] = $i - 1;
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('--NONE--' => lang('none')) + $this->mapping_fields;
$sel_options['field'] = array('--NONE--' => lang('none')) + $this->mapping_fields;
$GLOBALS['egw']->js->set_onload('$j("option[value=\'--NONE--\']:selected").closest("tr").animate({backgroundColor: "#ffff99"}, 1000);');
unset ($preserv['button']);
return $this->step_templates[$content['step']];

97
importexport/js/app.js Normal file
View File

@ -0,0 +1,97 @@
/**
* EGroupware - Import/Export - Javascript UI
*
* @link http://www.egroupware.org
* @package importexport
* @author Nathan Gray
* @copyright (c) 2013 Nathan Gray
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
/**
* JS for Import/Export
*
* @augments AppJS
*/
app.importexport = AppJS.extend(
{
appname: 'importexport',
/**
* Constructor
*
* @memberOf app.timesheet
*/
init: function()
{
// call parent
this._super.apply(this, arguments);
},
/**
* Destructor
*/
destroy: function()
{
// call parent
this._super.apply(this, arguments);
},
/**
* This function is called when the etemplate2 object is loaded
* and ready. If you must store a reference to the et2 object,
* make sure to clean it up in destroy().
*
* @param et2 etemplate2 Newly ready object
*/
et2_ready: function(et2)
{
// call parent
this._super.apply(this, arguments);
if(this.et2.getWidgetById('export') && !this.et2.getArrayMgr("content").getEntry("definition"))
{
// et2 doesn't understand a disabled button in the normal sense
$j(this.et2.getWidgetById('export').getDOMNode()).attr('disabled','disabled');
$j(this.et2.getWidgetById('preview').getDOMNode()).attr('disabled','disabled');
}
},
export_preview: function(event, widget)
{
var preview = $j(widget.getRoot().getWidgetById('preview_box').getDOMNode());
$j('.content',preview).empty();
preview
.addClass('loading')
.show(100, jQuery.proxy(function() {
widget.clicked = true;
widget.getInstanceManager().submit(false, true);
widget.clicked = false;
$j(widget.getRoot().getWidgetById('preview_box').getDOMNode())
.removeClass('loading');
},this));
return false;
},
import_preview: function(event, widget)
{
var test = widget.getRoot().getWidgetById('dry-run');
if(!test.getValue()) return true;
// Show preview
var preview = $j(widget.getRoot().getWidgetById('preview_box').getDOMNode());
$j('.content',preview).empty();
preview
.addClass('loading')
.show(100, jQuery.proxy(function() {
widget.clicked = true;
widget.getInstanceManager().submit(false, true);
widget.clicked = false;
$j(widget.getRoot().getWidgetById('preview_box').getDOMNode())
.removeClass('loading');
},this));
return false;
}
});

View File

@ -1,37 +0,0 @@
/**
* eGroupWare
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package importexport
* @link http://www.egroupware.org
* @author Cornelius Weiss <nelius@cwtech.de>
* @copyright Cornelius Weiss <nelius@cwtech.de>
* @version $Id:$
*/
function export_dialog() {
this.change_definition = function(sel_obj) {
if(sel_obj.value == 'expert') {
xajax_doXMLHTTP('importexport.importexport_export_ui.ajax_get_plugins',document.getElementById('exec[appname]') ? document.getElementById('exec[appname]').value : this.appname);
// next two lines fix some strange layout bug
//set_style_by_class('tr','select_definition','display','none');
//set_style_by_class('tr','select_definition','display','inline');
set_style_by_class('tr','select_plugin','display','table-row');
set_style_by_class('tr','save_definition','display','inline');
document.getElementById('importexport.export_dialog.selection_tab-tab').style.visibility='visible';
document.getElementById('importexport.export_dialog.options_tab-tab').style.visibility='visible';
}
else {
xajax_doXMLHTTP('importexport.importexport_export_ui.ajax_get_definition_description',sel_obj.value);
set_style_by_class('tr','select_plugin','display','none');
set_style_by_class('tr','save_definition','display','none');
// document.getElementById('importexport.export_dialog.selection_tab-tab').style.visibility='hidden';
// document.getElementById('importexport.export_dialog.options_tab-tab').style.visibility='hidden';
enable_button('exec[export]');
enable_button('exec[preview]');
}
};
this.appname = '';
}
var export_dialog = new export_dialog();

View File

@ -1,17 +0,0 @@
/**
* Common functions for import / export
*/
/**
* Clear a selectbox
*/
function clear_options(id) {
var list = document.getElementById(id);
for(var count = list.options.length - 1; count >= 0; count--) {
list.options[count] = null;
}
if($j().chosen && list) {
$j(list).trigger("liszt:updated");
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,36 @@
div.preview {
position: absolute;
top: 0px;
left: 0px;
width: 97%;
height: 95%;
overflow: hidden;
background-color: white;
z-index: 999;
display: none;
border: 1px solid black;
margin: 1.5%;
}
div.preview .content {
overflow: auto;
max-height: 99%;
display: block;
}
.preview_box .header, .preview .header {
font-size: 150%;
margin-bottom: 5px;
padding: 5px;
border-bottom: 1px outset;
}
.preview tr{
vertical-align: top;
}
.preview div[id$='buttons'] {
position: absolute;
bottom: 0px;
width: 100%;
margin-left: 50%;
}

View File

@ -4,13 +4,13 @@
<template id="importexport.definition_index.row" template="" lang="" group="0" version="1.9.002">
<grid width="100%">
<columns>
<column width="20px"/>
<column/>
<column/>
<column/>
<column/>
<column/>
<column/>
<column disabled="@no_actions"/>
<column width="150px"/>
<column width="150px"/>
<column width="150px"/>
<column width="10px"/>
<column width="10px" disabled="@no_actions"/>
</columns>
<rows>
<row class="th">
@ -59,7 +59,7 @@
<description align="center" id="msg" no_lang="1" span="all" class="message"/>
</row>
<row>
<nextmatch cols="6" id="nm" rows="2" options="importexport.definition_index.row"/>
<nextmatch id="nm" template="importexport.definition_index.row"/>
</row>
<row disabled="!@nm[selectcols]=/actions/">
<hbox align="right">
@ -68,13 +68,13 @@
</hbox>
</row>
<row>
<hbox>
<box class="action_popup prompt" id="owner_popup">
<vbox>
<description value="Change owner" class="promptheader"/>
<box>
<box id="owner_popup" class="action_popup prompt">
<description value="Change owner" class="promptheader"/>
<vbox class="action_popup-content">
<description value="Select owner"/>
<menulist class="action_popup-content">
<menupopup type="select-account" id="owner" options="None,accounts"/>
<menulist>
<menupopup type="select-account" class="action_popup-content" id="owner" options="None,accounts"/>
</menulist>
<hbox>
<button label="Save" onclick="nm_submit_popup(this); return false;"/>
@ -82,7 +82,7 @@
</hbox>
</vbox>
</box>
<box class="action_popup prompt" id="allowed_popup">
<box id="allowed_popup" class="action_popup prompt">
<vbox>
<description value="Change allowed users" class="promptheader"/>
<description value="Select groups"/>
@ -95,12 +95,12 @@
</hbox>
</vbox>
</box>
</hbox>
</box>
</row>
</rows>
</grid>
<styles>
.redItalic { color:red; font-style:italic;} td.lr_padding { padding-left: 5px; padding-right: 5px; }
td.lr_padding { padding-left: 5px; padding-right: 5px; }
.button {
cursor: pointer;

View File

@ -13,10 +13,10 @@
<row>
<radio label="Use search results" id="selection" options="search"/>
</row>
<row>
<radio label="Use definition filter" id="selection" onclick="\$j('div.filters').show();" options="filter"/>
<row disabled="@no_filter">
<radio label="Use definition filter" id="selection" onclick="jQuery('div.filters').show();" options="filter"/>
</row>
</rows>
</grid>
</template>
</overlay>
</overlay>

View File

@ -30,8 +30,8 @@
</menulist>
</row>
<row>
<box id="plugin_description" needed="1" span="all">
<description id="description" needed="1" no_lang="1" span="all"/>
<box id="plugin_description" span="all">
<description id="description" no_lang="1" span="all"/>
</box>
</row>
</rows>
@ -74,7 +74,7 @@
</row>
<row valign="top" disabled="!@plugin_selectors_template">
<template id="@plugin_selectors_template"/>
<box onclick="\$j('input[value=\'filter\']').not(':checked').attr('checked',true).parent().effect('highlight',{},2000);" class="filters">
<box onclick="jQuery('input[value=\'filter\']').not(':checked').attr('checked',true).parent().effect('highlight',{},2000);" class="filters">
<filter id="filter"/>
</box>
</row>
@ -159,26 +159,24 @@
<row>
<hbox span="all">
<hbox>
<button label="Export" id="export" onclick="xajax_eT_wrapper(this);return false;"/>
<button label="Preview" id="preview" onclick="xajax_eT_wrapper(this);return false;"/>
<button label="Export" id="export"/>
<button label="Preview" id="preview" onclick="app.importexport.export_preview"/>
</hbox>
<button align="right" label="Cancel" id="cancel" onclick="window.close(); return false;"/>
</hbox>
</row>
<row>
<box id="preview_box" span="all" class="preview_box">
<box id="preview-box" needed="1" class="content">
<description/>
</box>
<html id="preview-box" class="content"/>
<box align="center" id="preview-box-buttons" class="preview-box-buttons">
<button align="center" label="OK" onclick="document.getElementById(form::name('preview_box')).style.display='none'; return false;"/>
<button align="center" label="OK" onclick="jQuery(this).parents('div.preview_box').css('display','none'); return false;"/>
</box>
</box>
</row>
</rows>
</grid>
<styles>
.preview_box {
div.preview_box {
position: absolute;
top: 0px;
left: 0px;

View File

@ -0,0 +1,60 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="importexport.import_dialog" template="" lang="" group="0" version="1.9.005">
<grid>
<columns>
<column/>
<column/>
</columns>
<rows>
<row disabled="!@msg">
<html id="msg" span="all" class="message"/>
<description/>
</row>
<row>
<description value="Application"/>
<menulist>
<menupopup id="appname" onchange="1"/>
</menulist>
</row>
<row>
<description value="Import definition"/>
<menulist>
<menupopup id="definition"/>
</menulist>
</row>
<row>
<description value="Delimiter"/>
<hbox no_lang="1" options="0,0">
<menulist>
<menupopup id="delimiter" no_lang="1" onchange="var _this = jQuery(this); var text = _this.parent().parent().find('input'); if(_this.val() =='other') {text.val('');text.show(); text.focus();} else {text.hide();}"/>
</menulist>
<textbox id="other_delimiter" size="2" maxlength="1" class="hide"/>
</hbox>
</row>
<row>
<description value="Please select file to import"/>
<file id="file"/>
</row>
<row>
<box id="preview_box" readonly="true" span="all" class="preview">
<html id="preview" readonly="true" class="content"/>
<box align="center" id="buttons">
<buttononly align="center" label="OK" onclick="jQuery(this).parents('div.preview').css('display','none'); return false;"/>
</box>
</box>
<description/>
</row>
<row>
<hbox span="all">
<button label="Import" id="import" onclick="app.importexport.import_preview"/>
<button label="Cancel" id="cancel" onclick="window.close();"/>
<checkbox align="right" label="No notifications" id="no_notifications"/>
<checkbox align="right" label="Test only" id="dry-run"/>
</hbox>
</row>
</rows>
</grid>
</template>
</overlay>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="importexport.schedule_edit" template="" lang="" group="0" version="1.9.003">
<template id="importexport.schedule_edit" template="" lang="" group="0" version="1.9.004">
<grid>
<columns>
<column/>
@ -21,13 +21,13 @@
<row>
<description value="Application"/>
<menulist>
<menupopup id="appname" onchange="xajax_doXMLHTTP('importexport.importexport_schedule_ui.ajax_get_plugins', document.getElementById(form::name('type')).value, this.value);"/>
<menupopup id="appname" onchange="1"/>
</menulist>
</row>
<row>
<description value="Plugin"/>
<menulist>
<menupopup id="plugin" onchange="xajax_doXMLHTTP('importexport.importexport_schedule_ui.ajax_get_definitions', document.getElementById(form::name('appname')).value, this.value);" options="Select..."/>
<menupopup id="plugin" onchange="1" options="Select..."/>
</menulist>
</row>
<row>

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="importexport.schedule_index" template="" lang="" group="0" version="1.9.001">
<grid>
<template id="importexport.schedule_index" template="" lang="" group="0" version="1.9.002">
<grid width="100%">
<columns>
<column/>
</columns>
@ -73,8 +73,8 @@
<description id="times" no_lang="1"/>
</vbox>
<hbox options="0,0">
<button id="edit[{$cont[id]}]" onclick="window.open(egw::link('/index.php','menuaction=importexport.importexport_schedule_ui.edit&amp;id={$cont[id]}'),'_blank','dependent=yes,width=600,height=450,scrollbars=yes,status=yes'); return false;" image="edit"/>
<button id="delete[{$cont[id]}]" image="delete"/>
<button id="edit[{$_cont[id]}]" onclick="window.open(egw::link('/index.php','menuaction=importexport.importexport_schedule_ui.edit&amp;id={$_cont[id]}'),'_blank','dependent=yes,width=600,height=450,scrollbars=yes,status=yes'); return false;" image="edit"/>
<button id="delete[{$_cont[id]}]" image="delete"/>
</hbox>
</row>
<row class="th" disabled="!@result">

View File

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="importexport.wizard_basic_export_csv.choosesepncharset" template="" lang="" group="0" version="1.9.001">
<grid>
<columns>
<column/>
<column width="180px"/>
</columns>
<rows>
<row>
<description id="msg" no_lang="1" span="all"/>
</row>
<row>
<description value="Fieldseperator"/>
<textbox id="delimiter" no_lang="1" size="1"/>
</row>
<row>
<description value="Charset of file"/>
<menulist class="width180">
<menupopup id="charset" no_lang="1"/>
</menulist>
</row>
<row>
<description value="Include header"/>
<menulist>
<menupopup id="begin_with_fieldnames"/>
</menulist>
</row>
<row>
<description value="Export data as"/>
<menulist>
<menupopup id="convert"/>
</menulist>
</row>
</rows>
</grid>
<styles>
.width180 select { width:150px;}
</styles>
</template>
</overlay>

View File

@ -11,7 +11,7 @@
<description id="msg"/>
</row>
<row>
<filter id="set_filter" options="1"/>
<filter id="set_filter" relative_dates="true"/>
</row>
</rows>
</grid>

View File

@ -0,0 +1,46 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="importexport.wizard_basic_import_csv.choosesepncharset" template="" lang="" group="0" version="1.9.001">
<grid>
<columns>
<column/>
<column width="180px"/>
</columns>
<rows>
<row>
<description id="msg" no_lang="1" span="all"/>
</row>
<row>
<description value="Fieldseperator"/>
<textbox id="fieldsep" no_lang="1" size="1"/>
</row>
<row>
<description value="Charset of file"/>
<menulist class="width180">
<menupopup id="charset" no_lang="1"/>
</menulist>
</row>
<row>
<description value="Header lines to skip"/>
<textbox type="integer" id="num_header_lines" min="0"/>
</row>
<row disabled="@no_cats">
<description value="Update categories"/>
<menulist>
<menupopup id="update_cats"/>
</menulist>
</row>
<row>
<description value="Import data is"/>
<menulist>
<menupopup id="convert"/>
</menulist>
</row>
</rows>
</grid>
<styles>
.width180 select { width:150px;}
</styles>
</template>
</overlay>

View File

@ -0,0 +1,50 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="importexport.wizard_basic_import_csv.fieldmapping" template="" lang="" group="0" version="1.9.001">
<grid>
<columns>
<column/>
</columns>
<rows>
<row>
<description id="msg" no_lang="1" span="all"/>
</row>
<row>
<grid overflow="auto" id="mapping">
<columns>
<column/>
<column/>
<column/>
<column/>
<column/>
</columns>
<rows>
<row class="th">
<description/>
<description/>
<description value="CSV Field"/>
<description value="Target Field"/>
<description value="Translation"/>
</row>
<row>
<description value="${row}[index]" no_lang="1"/>
<description value="${row_cont[index]}" no_lang="1"/>
<description value="{$row_cont[title]}" no_lang="1"/>
<menulist>
<menupopup id="{$row}[field]" no_lang="1"/>
</menulist>
<textbox id="{$row}[conversion]"/>
</row>
</rows>
</grid>
</row>
</rows>
</grid>
<styles>
.et2_grid[id$='mapping'] td:first-child {
display:none;
}
</styles>
</template>
</overlay>

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="importexport.wizard_basic_import_csv.sample_file" template="" lang="" group="0" version="0.0.1">
<grid>
<columns>
<column/>
</columns>
<rows>
<row>
<description id="msg" no_lang="1"/>
</row>
<row>
<file id="file"/>
</row>
</rows>
</grid>
</template>
</overlay>

View File

@ -17,7 +17,7 @@
<checkbox label="%s All users" id="all_users"/>
</row>
<row>
<listbox type="select-account" id="allowed_users" rows="5" options="groups"/>
<listbox type="select-account" id="allowed_users" rows="5" account_type="groups"/>
</row>
</rows>
</grid>

View File

@ -0,0 +1,21 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="importexport.wizard_chooseapp" template="" lang="" group="0" version="0.0.1">
<grid>
<columns>
<column/>
</columns>
<rows>
<row>
<description id="msg" no_lang="1"/>
</row>
<row>
<menulist>
<menupopup id="application" no_lang="1"/>
</menulist>
</row>
</rows>
</grid>
</template>
</overlay>

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="importexport.wizard_choosename" template="" lang="" group="0" version="0.0.1">
<grid>
<columns>
<column/>
</columns>
<rows>
<row>
<description id="msg" no_lang="1"/>
</row>
<row>
<textbox id="name"/>
</row>
</rows>
</grid>
</template>
</overlay>

View File

@ -0,0 +1,21 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="importexport.wizard_chooseplugin" template="" lang="" group="0" version="0.0.1">
<grid>
<columns>
<column/>
</columns>
<rows>
<row>
<description id="msg" no_lang="1"/>
</row>
<row>
<menulist>
<menupopup id="plugin" no_lang="1"/>
</menulist>
</row>
</rows>
</grid>
</template>
</overlay>

View File

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="importexport.wizardbox" template="" lang="" group="0" version="0.0.2">
<grid width="100%" height="400">
<columns>
<column width="100%"/>
</columns>
<rows>
<row valign="top">
<hbox no_lang="1">
<image src="importexport"/>
<vbox>
<description/>
<box class="wizard_content">
<template id="@wizard_content"/>
</box>
</vbox>
</hbox>
</row>
<row valign="bottom">
<hbox span="all">
<hbox>
<button label="previous" id="button[previous]"/>
<button label="next" id="button[next]"/>
<button label="finish" id="button[finish]"/>
</hbox>
<button align="right" label="cancel" id="button[cancel]" onclick="window.close(); return false;"/>
</hbox>
</row>
</rows>
</grid>
<styles>
.wizard_content {
height: 365px;
width: 370px;
max-height:365px;
overflow:auto;
}
</styles>
</template>
</overlay>