forked from extern/egroupware
initial import of my importexport work,
export is quite clean at the moment, but import needs lots of work, all the stuff is not really for production yet, but i import it now, so that the guy from metaways can also work on it. most pending tasks: - implement conversions based on regular expressions - implement options of plugin - rework import part (mostly ui)
This commit is contained in:
parent
fcc21fec4c
commit
b7d62c7b09
37
importexport/doc/README.developers
Normal file
37
importexport/doc/README.developers
Normal file
@ -0,0 +1,37 @@
|
||||
=importexport=
|
||||
|
||||
Importexport is a framework for egroupware to handle imports and exports.
|
||||
The idea behind importexport is to have a common userinterface in all apps regarding
|
||||
import and export stuff AND to have common backends whitch handle the stuff.
|
||||
Importexport can nothing without the plugins of the applications.
|
||||
|
||||
Attending importeport framework with you application is pretty easy.
|
||||
|
||||
You just need to have your plugins in files which start with
|
||||
class.import_<type> or
|
||||
class.export_<type>
|
||||
in
|
||||
EGW_INCLUDE_ROOT/YourApp/inc/
|
||||
|
||||
== definitions ==
|
||||
The bases of all imports and exports is the '''definition'''.
|
||||
A definition defines all nessesary parameters to perform the desired action.
|
||||
Moreover definitions can be stored and thus the same import / export can be redone
|
||||
by loading the definition. Definitions are also reachable by the importexport
|
||||
'''command line interface'''.
|
||||
|
||||
== export ==
|
||||
Starting an export is as easy as just putting a button in your app with:
|
||||
onClick="importexport.uiexport.export_dialog&appname=<appname>&have_selection=<{true|false}>"
|
||||
If parameter "have_selection" if true, export askes (javascript) opener.get_selection();to retreave
|
||||
a list of identifiers of selected records.
|
||||
|
||||
NOTE: javascript function get_selection() is the only function which is not part of an interface yet.
|
||||
|
||||
==Discussion of interfaces==
|
||||
To make live easy there are several general plugins which can be found
|
||||
EGW_INCLUDE_ROOT/importexport/inc/import_...
|
||||
EGW_INCLUDE_ROOT/importexport/inc/export_...
|
||||
|
||||
|
||||
|
159
importexport/importexport_cli.php
Executable file
159
importexport/importexport_cli.php
Executable file
@ -0,0 +1,159 @@
|
||||
#!/usr/bin/php -q
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - importexport
|
||||
*
|
||||
* @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>
|
||||
* @version $Id: $
|
||||
*/
|
||||
|
||||
$path_to_egroupware = realpath(dirname(__FILE__).'/..');
|
||||
|
||||
$usage = "usage:
|
||||
--definition <name of definition>
|
||||
--file <name of file>
|
||||
--user <eGW username>
|
||||
--password <password for user>
|
||||
--domain <domain name> \n";
|
||||
|
||||
if (php_sapi_name() != 'cli')
|
||||
{
|
||||
die('This script only runs form command line');
|
||||
}
|
||||
|
||||
// Include PEAR::Console_Getopt
|
||||
require_once 'Console/Getopt.php';
|
||||
|
||||
// Define exit codes for errors
|
||||
define('HEADER_NOT_FOUND',9);
|
||||
define('NO_ARGS',10);
|
||||
define('INVALID_OPTION',11);
|
||||
|
||||
// Reading the incoming arguments - same as $argv
|
||||
$args = Console_Getopt::readPHPArgv();
|
||||
|
||||
// Make sure we got them (for non CLI binaries)
|
||||
if (PEAR::isError($args)) {
|
||||
fwrite(STDERR,"importexport_cli: ".$args->getMessage()."\n".$usage);
|
||||
exit(NO_ARGS);
|
||||
}
|
||||
|
||||
// Short options
|
||||
$short_opts = 'f:d:';
|
||||
|
||||
// Long options
|
||||
$long_opts = array(
|
||||
'definition=',
|
||||
'file=',
|
||||
'user=',
|
||||
'password=',
|
||||
'domain='
|
||||
);
|
||||
|
||||
// Convert the arguments to options - check for the first argument
|
||||
if ( realpath($_SERVER['argv'][0]) == __FILE__ ) {
|
||||
$options = Console_Getopt::getOpt($args,$short_opts,$long_opts);
|
||||
} else {
|
||||
$options = Console_Getopt::getOpt2($args,$short_opts,$long_opts);
|
||||
}
|
||||
|
||||
// Check the options are valid
|
||||
if (PEAR::isError($options)) {
|
||||
fwrite(STDERR,"importexport_cli: ".$options->getMessage()."\n".$usage."\n");
|
||||
exit(INVALID_OPTION);
|
||||
}
|
||||
|
||||
$domain = 'default';
|
||||
foreach ($options[0] as $option)
|
||||
{
|
||||
switch ($option[0])
|
||||
{
|
||||
case '--file' :
|
||||
$file = $option[1];
|
||||
break;
|
||||
case '--definition' :
|
||||
$definition = $option[1];
|
||||
break;
|
||||
case '--domain' :
|
||||
$domain = $option[1];
|
||||
break;
|
||||
case '--user' :
|
||||
$user = $option[1];
|
||||
break;
|
||||
case '--password' :
|
||||
$password = $option[1];
|
||||
break;
|
||||
default :
|
||||
fwrite (STDERR,$usage."\n");
|
||||
exit(INVALID_OPTION);
|
||||
}
|
||||
}
|
||||
// check file
|
||||
if (!$user || !$password)
|
||||
{
|
||||
fwrite(STDERR,'importexport_cli: You have to supply a username / password'."\n".$usage);
|
||||
exit(INVALID_OPTION);
|
||||
}
|
||||
|
||||
$GLOBALS['egw_info']['flags'] = array(
|
||||
'disable_Template_class' => True,
|
||||
'noheader' => True,
|
||||
'nonavbar' => True,
|
||||
'currentapp' => 'importexport',
|
||||
'autocreate_session_callback' => 'import_export_access',
|
||||
'login' => $user,
|
||||
'passwd' => $password,
|
||||
'noapi' => True,
|
||||
);
|
||||
if (!is_readable($path_to_egroupware.'/header.inc.php'))
|
||||
{
|
||||
fwrite(STDERR,"importexport.php: Could not find '$path_to_egroupware/header.inc.php', exiting !!!\n");
|
||||
exit(HEADER_NOT_FOUND);
|
||||
}
|
||||
include($path_to_egroupware.'/header.inc.php');
|
||||
unset($GLOBALS['egw_info']['flags']['noapi']);
|
||||
|
||||
// check domain
|
||||
$db_type = $GLOBALS['egw_domain'][$domain]['db_type'];
|
||||
if (!isset($GLOBALS['egw_domain'][$domain]) || empty($db_type))
|
||||
{
|
||||
fwrite(STDERR,"importexport_cli: ". $domain. ' is not a valid domain name'."\n");
|
||||
exit(INVALID_OPTION);
|
||||
}
|
||||
$GLOBALS['egw_info']['server']['sessions_type'] = 'db'; // no php4-sessions availible for cgi
|
||||
|
||||
include(PHPGW_API_INC.'/functions.inc.php');
|
||||
|
||||
// check file
|
||||
if (!is_readable($file))
|
||||
{
|
||||
fwrite(STDERR,"importexport_cli: ". $file. ' is not readable'."\n");
|
||||
exit(INVALID_OPTION);
|
||||
}
|
||||
|
||||
require_once('./inc/class.definition.inc.php');
|
||||
try {
|
||||
$definition = new definition($definition);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
fwrite(STDERR,"importexport_cli: ". $e->getMessage(). "\n");
|
||||
exit(INVALID_OPTION);
|
||||
}
|
||||
|
||||
require_once("$path_to_egroupware/$definition->application/inc/class.$definition->plugin.inc.php");
|
||||
$po = new $definition->plugin;
|
||||
$type = $definition->type;
|
||||
$po->$type($definition,array('file' => $file));
|
||||
|
||||
$GLOBALS['egw']->common->phpgw_exit();
|
||||
|
||||
function import_export_access(&$account)
|
||||
{
|
||||
$account['login'] = $GLOBALS['egw_info']['flags']['login'];
|
||||
$account['passwd'] = $GLOBALS['egw_info']['flags']['passwd'];
|
||||
$account['passwd_type'] = 'text';
|
||||
return true;
|
||||
}
|
BIN
importexport/inc/.class.bodefinitions.inc.php.swp
Normal file
BIN
importexport/inc/.class.bodefinitions.inc.php.swp
Normal file
Binary file not shown.
208
importexport/inc/class.bodefinitions.inc.php
Normal file
208
importexport/inc/class.bodefinitions.inc.php
Normal file
@ -0,0 +1,208 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - importexport
|
||||
*
|
||||
* @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: $
|
||||
*/
|
||||
|
||||
require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.definition.inc.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/etemplate/inc/class.so_sql.inc.php');
|
||||
|
||||
/** bo to define {im|ex}ports
|
||||
*
|
||||
* @todo make this class an egw_record_pool!
|
||||
*/
|
||||
class bodefinitions {
|
||||
|
||||
const _appname = 'importexport';
|
||||
const _defintion_talbe = 'egw_importexport_definitions';
|
||||
|
||||
/**
|
||||
* holds so_sql
|
||||
*
|
||||
* @var so_sql
|
||||
*/
|
||||
private $so_sql;
|
||||
private $definitions;
|
||||
|
||||
public function __construct($_query=false)
|
||||
{
|
||||
$this->so_sql = new so_sql(self::_appname, self::_defintion_talbe );
|
||||
if ($_query) {
|
||||
$definitions = $this->so_sql->search($_query, true);
|
||||
foreach ((array)$definitions as $definition) {
|
||||
$this->definitions[] = $definition['definition_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function get_definitions() {
|
||||
return $this->definitions;
|
||||
}
|
||||
|
||||
/**
|
||||
* reads a definition from database
|
||||
*
|
||||
* @param mixed &$definition
|
||||
* @return bool success or not
|
||||
*/
|
||||
public function read(&$definition)
|
||||
{
|
||||
if(is_int($definition)) $definition = array('definition_id' => $definition);
|
||||
elseif(is_string($definition)) $definition = array('name' => $definition);
|
||||
if(!$definition = $this->so_sql->read($definition)) return false;
|
||||
$definition += (array)unserialize($definition['plugin_options']);
|
||||
unset($definition['plugin_options']);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function save($content)
|
||||
{
|
||||
$plugin = $content['plugin'];
|
||||
if (!$plugin) return false;
|
||||
|
||||
$definition = array_intersect_key($content,array_flip($this->so_sql->db_cols));
|
||||
|
||||
if(is_object($this->plugin) && $this->plugin->plugin_info['plugin'] == $plugin)
|
||||
{
|
||||
$plugin_options = array_intersect_key($content,array_flip($this->plugin->plugin_options));
|
||||
}
|
||||
else
|
||||
{
|
||||
// we come eg. from definition import
|
||||
$file = EGW_SERVER_ROOT . SEP . $definition['application'] . SEP . 'inc' . SEP . 'importexport'. SEP . 'class.'.$definition['plugin'].'.inc.php';
|
||||
if (is_file($file))
|
||||
{
|
||||
@include_once($file);
|
||||
$obj = new $plugin;
|
||||
$plugin_options = array_intersect_key($content,array_flip($obj->plugin_options));
|
||||
unset($obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ($this->so_sql->db_cols as $col) unset($content[$col]);
|
||||
$plugin_options = $content;
|
||||
|
||||
}
|
||||
}
|
||||
$definition['plugin_options'] = serialize($plugin_options);
|
||||
$this->so_sql->data = $definition;
|
||||
//print_r($definition);
|
||||
return $this->so_sql->save();
|
||||
}
|
||||
|
||||
public function delete($keys)
|
||||
{
|
||||
$this->so_sql->delete(array('definition_id' => $keys));
|
||||
}
|
||||
|
||||
/**
|
||||
* checkes if user if permitted to access given definition
|
||||
*
|
||||
* @param array $_definition
|
||||
* @return bool
|
||||
*/
|
||||
static public function is_permitted($_definition) {
|
||||
$allowed_user = explode(',',$_definition['allowed_users']);
|
||||
$this_user_id = $GLOBALS['egw_info']['user']['userid'];
|
||||
$this_membership = $GLOBALS['egw']->accounts->membership($this_user_id);
|
||||
$this_membership[] = array('account_id' => $this_user_id);
|
||||
//echo $this_user_id;
|
||||
//echo ' '.$this_membership;
|
||||
foreach ((array)$this_membership as $account)
|
||||
{
|
||||
$this_membership_array[] = $account['account_id'];
|
||||
}
|
||||
$alluser = array_intersect($allowed_user,$this_membership_array);
|
||||
return in_array($this_user_id,$alluser) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* searches and registers plugins from all apps
|
||||
*
|
||||
* @deprecated see import_export_helperfunctions::get_plugins
|
||||
* @return array $info info about existing plugins
|
||||
*/
|
||||
static public function plugins()
|
||||
{
|
||||
if (!key_exists('apps',$GLOBALS['egw_info'])) return false;
|
||||
foreach (array_keys($GLOBALS['egw_info']['apps']) as $appname)
|
||||
{
|
||||
$dir = EGW_INCLUDE_ROOT . "/$appname/inc";
|
||||
if(!$d = @opendir($dir)) continue;
|
||||
while (false !== ($file = readdir($d)))
|
||||
{
|
||||
//echo $file."\n";
|
||||
$pnparts = explode('.',$file);
|
||||
if(!is_file($file = "$dir/$file") || substr($pnparts[1],0,7) != 'wizzard' || $pnparts[count($pnparts)-1] != 'php') continue;
|
||||
$plugin_classname = $pnparts[1];
|
||||
include_once($file);
|
||||
if (!is_object($GLOBALS['egw']->$plugin_classname))
|
||||
$GLOBALS['egw']->$plugin_classname = new $plugin_classname;
|
||||
$info[$appname][$GLOBALS['egw']->$plugin_classname->plugin_info['plugin']] = $GLOBALS['egw']->$plugin_classname->plugin_info;
|
||||
}
|
||||
closedir($d);
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* exports definitions
|
||||
*
|
||||
* @param array $keys to export
|
||||
*/
|
||||
public function export($keys)
|
||||
{
|
||||
$export_data = array('metainfo' => array(
|
||||
'type' => 'importexport definitions',
|
||||
'charset' => 'bal',
|
||||
'entries' => count($keys),
|
||||
));
|
||||
|
||||
foreach ($keys as $definition_id)
|
||||
{
|
||||
$definition = array('definition_id' => $definition_id);
|
||||
$this->read($definition);
|
||||
unset($definition['definition_id']);
|
||||
$export_data[$definition['name']] = $definition;
|
||||
}
|
||||
/* This is no fun as import -> export cycle in xmltools results in different datas :-(
|
||||
$xml =& CreateObject('etemplate.xmltool','root');
|
||||
$xml->import_var('importexport.definitions', $export_data);
|
||||
$xml_data = $xml->export_xml();
|
||||
|
||||
we export serialised arrays in the meantime
|
||||
*/
|
||||
return serialize($export_data);
|
||||
}
|
||||
|
||||
public function import($import_file)
|
||||
{
|
||||
if (!is_file($import_file['tmp_name'])) return false;
|
||||
$f = fopen($import_file['tmp_name'],'r');
|
||||
$data = fread($f,100000);
|
||||
fclose($f);
|
||||
if (($data = unserialize($data)) === false) return false;
|
||||
$metainfo = $data['metainfo'];
|
||||
unset($data['metainfo']);
|
||||
|
||||
foreach ($data as $name => $definition)
|
||||
{
|
||||
error_log(print_r($definition,true));
|
||||
//if (($ext = $this->search(array('name' => $name),'definition_id')) !== false)
|
||||
//{
|
||||
// error_log(print_r($ext,true));
|
||||
// $definition['definition_id'] = $ext[0]['definition_id'];
|
||||
//}
|
||||
$this->save($definition);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
302
importexport/inc/class.definition.inc.php
Normal file
302
importexport/inc/class.definition.inc.php
Normal file
@ -0,0 +1,302 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare importexport
|
||||
*
|
||||
* @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: $
|
||||
*/
|
||||
|
||||
require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.iface_egw_record.inc.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/etemplate/inc/class.so_sql.inc.php');
|
||||
|
||||
/**
|
||||
* class definition
|
||||
*
|
||||
* definitions are ojects with all nessesary information to do
|
||||
* complete import or export. All options needed for an explicit {Im|Ex}port
|
||||
* are in one assiozative array which is complely managed by {Im|Ex}port plugins
|
||||
* @todo testing
|
||||
*/
|
||||
class definition implements iface_egw_record {
|
||||
|
||||
const _appname = 'importexport';
|
||||
const _defintion_talbe = 'egw_importexport_definitions';
|
||||
|
||||
private $attributes = array(
|
||||
'definition_id' => 'string',
|
||||
'name' => 'string',
|
||||
'application' => 'string',
|
||||
'plugin' => 'string',
|
||||
'type' => 'string',
|
||||
'allowed_users' => 'array',
|
||||
'options' => 'array',
|
||||
'owner' => 'int',
|
||||
);
|
||||
|
||||
/**
|
||||
* holds so_sql object
|
||||
*
|
||||
* @var so_sql
|
||||
*/
|
||||
private $so_sql;
|
||||
|
||||
/**
|
||||
* internal representation of definition
|
||||
*
|
||||
* @var unknown_type
|
||||
*/
|
||||
private $definition = array();
|
||||
|
||||
/**
|
||||
* holds current user
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* is current user an admin?
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private $is_admin;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* reads record from backend if identifier is given.
|
||||
*
|
||||
* @param string $_identifier
|
||||
*/
|
||||
public function __construct( $_identifier='' ) {
|
||||
$this->so_sql = new so_sql(self::_appname ,self::_defintion_talbe);
|
||||
$this->user = $GLOBALS['egw_info']['user']['user_id'];
|
||||
$this->is_admin = $GLOBALS['egw_info']['user']['apps']['admin'] ? true : false;
|
||||
// compability to string identifiers
|
||||
if (is_string($_identifier) && strlen($_identifier) > 3) $_identifier = $this->name2identifier($_identifier);
|
||||
|
||||
if ((int)$_identifier != 0) {
|
||||
$this->so_sql->read(array('definition_id' => $_identifier));
|
||||
if (empty($this->so_sql->data)) {
|
||||
throw new Exception('Error: No such definition with identifier :"'.$_identifier.'"!');
|
||||
}
|
||||
if (!(in_array($this->user,$this->get_allowed_users()) || $this->get_owner() == $this->user || $this->is_admin)) {
|
||||
throw new Exception('Error: User "'.$this->user.'" is not permitted to get definition with identifier "'.$_identifier.'"!');
|
||||
$this->definition = $this->so_sql->data;
|
||||
}
|
||||
$this->definition = $this->so_sql->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* compability function for string identifiers e.g. used by cli
|
||||
*
|
||||
* @param string $_name
|
||||
* @return int
|
||||
*/
|
||||
private function name2identifier($_name) {
|
||||
$identifiers = $this->so_sql->search(array('name' => $_name),true);
|
||||
if (isset($identifiers[1])) {
|
||||
throw new Exception('Error: Definition: "'.$_name. '" is not unique! Can\'t convert to identifier');
|
||||
}
|
||||
return $identifiers[0]['definition_id'];
|
||||
}
|
||||
|
||||
public function __get($_attribute_name) {
|
||||
if (!array_key_exists($_attribute_name,$this->attributes)) {
|
||||
throw new Exception('Error: "'. $_attribute_name. '" is not an attribute defintion');
|
||||
}
|
||||
switch ($_attribute_name) {
|
||||
case 'allowed_users' :
|
||||
return $this->get_allowed_users();
|
||||
case 'options' :
|
||||
return $this->get_options();
|
||||
default :
|
||||
return $this->definition[$_attribute_name];
|
||||
}
|
||||
}
|
||||
|
||||
public function __set($_attribute_name,$_data) {
|
||||
if (!array_key_exists($_attribute_name,$this->attributes)) {
|
||||
throw new Exception('Error: "'. $_attribute_name. '" is not an attribute defintion');
|
||||
}
|
||||
switch ($_attribute_name) {
|
||||
case 'allowed_users' :
|
||||
return $this->set_allowed_users($_data);
|
||||
case 'options' :
|
||||
return $this->set_options($_data);
|
||||
default :
|
||||
$this->definition[$_attribute_name] = $_data;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gets users who are allowd to use this definition
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function get_allowed_users() {
|
||||
return explode(',',$this->definition['allowed_users']);
|
||||
}
|
||||
|
||||
/**
|
||||
* sets allowed users
|
||||
*
|
||||
* @param array $_allowed_users
|
||||
*/
|
||||
private function set_allowed_users($_allowed_users) {
|
||||
$this->definition['allowed_users'] = implode(',',(array)$_allowed_users);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function get_options() {
|
||||
// oh compat funct to be removed!
|
||||
if(array_key_exists('plugin_options',$this->definition)) {
|
||||
$this->definition['options'] = $this->definition['plugin_options'];
|
||||
unset($this->definition['plugin_options']);
|
||||
}
|
||||
return unserialize($this->definition['options']);
|
||||
}
|
||||
|
||||
/**
|
||||
* sets options
|
||||
*
|
||||
* @param array $options
|
||||
*/
|
||||
private function set_options(array $_options) {
|
||||
$this->definition['options'] = serialize($_options);
|
||||
}
|
||||
|
||||
/**
|
||||
* converts this object to array.
|
||||
* @abstract We need such a function cause PHP5
|
||||
* dosn't allow objects do define it's own casts :-(
|
||||
* once PHP can deal with object casts we will change to them!
|
||||
*
|
||||
* @return array complete record as associative array
|
||||
*/
|
||||
public function get_record_array() {
|
||||
$definition = $this->definition;
|
||||
$definition['allowed_users'] = $this->get_allowed_users();
|
||||
$definition['options'] = $this->get_options();
|
||||
return $definition;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets title of record
|
||||
*
|
||||
*@return string tiltle
|
||||
*/
|
||||
public function get_title() {
|
||||
return $this->definition['name'];
|
||||
}
|
||||
|
||||
/**
|
||||
* sets complete record from associative array
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set_record(array $_record) {
|
||||
$this->definition = $_record;
|
||||
}
|
||||
|
||||
/**
|
||||
* gets identifier of this record
|
||||
*
|
||||
* @return string identifier of this record
|
||||
*/
|
||||
public function get_identifier() {
|
||||
return $this->definition['definition_id'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* saves record into backend
|
||||
*
|
||||
* @return string identifier
|
||||
*/
|
||||
public function save ( $_dst_identifier ) {
|
||||
if ($owner = $this->get_owner() && $owner != $this->user && !$this->is_admin) {
|
||||
throw ('Error: User '. $this->user. ' is not allowed to save this definition!');
|
||||
}
|
||||
if ($this->so_sql->save($_dst_identifier)) {
|
||||
throw('Error: so_sql was not able to save definition: '.$this->get_identifier());
|
||||
}
|
||||
return $this->definition['definition_id'];
|
||||
}
|
||||
|
||||
/**
|
||||
* copys current record to record identified by $_dst_identifier
|
||||
*
|
||||
* @param string $_dst_identifier
|
||||
* @return string dst_identifier
|
||||
*/
|
||||
public function copy ( $_dst_identifier ) {
|
||||
$dst_object = clone $this;
|
||||
try {
|
||||
$dst_object->set_owner($this->user);
|
||||
$dst_identifier = $dst_object->save($_dst_identifier);
|
||||
}
|
||||
catch(exception $Exception) {
|
||||
unset($dst_object);
|
||||
throw $Exception;
|
||||
}
|
||||
unset ($dst_object);
|
||||
return $dst_identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* moves current record to record identified by $_dst_identifier
|
||||
* $this will become moved record
|
||||
*
|
||||
* @param string $_dst_identifier
|
||||
* @return string dst_identifier
|
||||
*/
|
||||
public function move ( $_dst_identifier ) {
|
||||
if ($this->user != $this->get_owner() && !$this->is_admin) {
|
||||
throw('Error: User '. $this->user. 'does not have permissions to move definition '.$this->get_identifier());
|
||||
}
|
||||
$old_object = clone $this;
|
||||
try {
|
||||
$dst_identifier = $this->save($_dst_identifier);
|
||||
$old_object->delete();
|
||||
}
|
||||
catch(exception $Exception) {
|
||||
unset($old_object);
|
||||
throw $Exception;
|
||||
}
|
||||
unset($old_object);
|
||||
return $dst_identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* delets current record from backend
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function delete () {
|
||||
if($this->user != $this->get_owner() && !$this->is_admin) {
|
||||
throw('Error: User '. $this->user. 'does not have permissions to delete definition '.$this->get_identifier());
|
||||
}
|
||||
if(!$this->so_sql->delete()) {
|
||||
throw('Error: so_sql was not able to delete definition: '.$this->get_identifier());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* destructor
|
||||
*
|
||||
*/
|
||||
public function __destruct() {
|
||||
unset($this->so_sql);
|
||||
}
|
||||
|
||||
}
|
200
importexport/inc/class.export_csv.inc.php
Normal file
200
importexport/inc/class.export_csv.inc.php
Normal file
@ -0,0 +1,200 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare importexport
|
||||
*
|
||||
* @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: $
|
||||
*/
|
||||
|
||||
require_once('class.iface_export_record.inc.php');
|
||||
require_once('class.import_export_helper_functions.inc.php');
|
||||
require_once('class.iface_egw_record.inc.php');
|
||||
|
||||
/**
|
||||
* class export_csv
|
||||
* This an record exporter.
|
||||
* An record is e.g. a single address or or single event.
|
||||
* No mater where the records come from, at the end export_entry
|
||||
* stores it into the stream
|
||||
*/
|
||||
class export_csv implements iface_export_record
|
||||
{
|
||||
|
||||
/** Aggregations: */
|
||||
|
||||
/** Compositions: */
|
||||
|
||||
/**
|
||||
* array with field mapping in form egw_field_name => exported_field_name
|
||||
* @var array
|
||||
*/
|
||||
protected $mapping = array();
|
||||
|
||||
/**
|
||||
* array with conversions to be done in form: egw_field_name => conversion_string
|
||||
* @var array
|
||||
*/
|
||||
protected $conversion = array();
|
||||
|
||||
/**
|
||||
* array holding the current record
|
||||
* @access protected
|
||||
*/
|
||||
protected $record = array();
|
||||
|
||||
/**
|
||||
* holds (charset) translation object
|
||||
* @var object
|
||||
*/
|
||||
protected $translation;
|
||||
|
||||
/**
|
||||
* charset of csv file
|
||||
* @var string
|
||||
*/
|
||||
protected $csv_charset;
|
||||
|
||||
/**
|
||||
* holds number of exported records
|
||||
* @var unknown_type
|
||||
*/
|
||||
protected $num_of_records = 0;
|
||||
|
||||
/**
|
||||
* stream resource of csv file
|
||||
* @var resource
|
||||
*/
|
||||
protected $handle;
|
||||
|
||||
/**
|
||||
* csv specific options
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $csv_options = array(
|
||||
'delimiter' => ';',
|
||||
'enclosure' => '"',
|
||||
);
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param object _handle resource where records are exported to.
|
||||
* @param string _charset charset the records are exported to.
|
||||
* @param array _options options for specific backends
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
public function __construct( $_handle, $_charset, array $_options=array() ) {
|
||||
$this->translation &= $GLOBALS['egw']->translation;
|
||||
$this->handle = $_handle;
|
||||
$this->csv_charset = $_charset;
|
||||
if (!empty($_options)) {
|
||||
$this->csv_options = array_merge($this->csv_options,$_options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* sets field mapping
|
||||
*
|
||||
* @param array $_mapping egw_field_name => csv_field_name
|
||||
*/
|
||||
public function set_mapping( array $_mapping) {
|
||||
if ($this->num_of_records > 0) {
|
||||
throw new Exception('Error: Field mapping can\'t be set during ongoing export!');
|
||||
}
|
||||
foreach ($_mapping as $egw_filed => $csv_field) {
|
||||
$this->mapping[$egw_filed] = $this->translation->convert($csv_field, $this->csv_charset);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets conversion.
|
||||
* See import_export_helper_functions::conversion.
|
||||
*
|
||||
* @param array $_conversion
|
||||
*/
|
||||
public function set_conversion( array $_conversion) {
|
||||
$this->conversion = $_conversion;
|
||||
}
|
||||
|
||||
/**
|
||||
* exports a record into resource of handle
|
||||
*
|
||||
* @param iface_egw_record record
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
public function export_record( iface_egw_record $_record ) {
|
||||
$record_data = $_record->get_record_array();
|
||||
|
||||
if (empty($this->mapping)) {
|
||||
$this->mapping = array_combine(array_keys($record_data),array_keys($record_data));
|
||||
}
|
||||
|
||||
if ($this->num_of_records == 0 && $this->csv_options['begin_with_fieldnames'] && !empty($this->mapping)) {
|
||||
fputcsv($this->handle,array_values($this->mapping),$this->csv_options['delimiter'],$this->csv_options['enclosure']);
|
||||
}
|
||||
|
||||
// do conversions
|
||||
if ($this->conversion[$egw_field]) {
|
||||
$record_data[$egw_field] = import_export_helper_functions::conversion($record_data,$this->conversion);
|
||||
}
|
||||
|
||||
// do fieldmapping
|
||||
foreach ($this->mapping as $egw_field => $csv_field) {
|
||||
$this->record[$csv_field] = $record_data[$egw_field];
|
||||
}
|
||||
|
||||
$this->fputcsv($this->handle,$this->record,$this->csv_options['delimiter'],$this->csv_options['enclosure']);
|
||||
$this->num_of_records++;
|
||||
$this->record = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retruns total number of exported records.
|
||||
*
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
public function get_num_of_records() {
|
||||
return $this->num_of_records;
|
||||
}
|
||||
|
||||
/**
|
||||
* destructor
|
||||
*
|
||||
* @return
|
||||
* @access public
|
||||
*/
|
||||
public function __destruct() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The php build in fputcsv function is buggy, so we need an own one :-(
|
||||
*
|
||||
* @param resource $filePointer
|
||||
* @param array $dataArray
|
||||
* @param char $delimiter
|
||||
* @param char $enclosure
|
||||
*/
|
||||
protected function fputcsv($filePointer, $dataArray, $delimiter, $enclosure){
|
||||
$string = "";
|
||||
$writeDelimiter = false;
|
||||
foreach($dataArray as $dataElement) {
|
||||
if($writeDelimiter) $string .= $delimiter;
|
||||
$string .= $enclosure . $dataElement . $enclosure;
|
||||
$writeDelimiter = true;
|
||||
}
|
||||
$string .= "\n";
|
||||
|
||||
fwrite($filePointer, $string);
|
||||
|
||||
}
|
||||
} // end export_csv_record
|
||||
?>
|
123
importexport/inc/class.iface_egw_record.inc.php
Normal file
123
importexport/inc/class.iface_egw_record.inc.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/**
|
||||
* 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: $
|
||||
*/
|
||||
|
||||
/**
|
||||
* class iface_egw_record
|
||||
* This a the abstract interface of an egw record.
|
||||
* A record is e.g. a single address or or single event.
|
||||
* The idea behind is that we can have metaoperation over differnt apps by
|
||||
* having a common interface.
|
||||
* A record is identified by a identifier. As we are a Webapp and want to
|
||||
* deal with the objects in the browser, identifier should be a string!
|
||||
*
|
||||
* @todo lots! of discussion with other developers
|
||||
* @todo move to api once developers accepted it!
|
||||
* @todo functions for capabilities of object
|
||||
* @todo caching. e.g. only read name of object
|
||||
*/
|
||||
interface iface_egw_record
|
||||
{
|
||||
|
||||
/**
|
||||
* constructor
|
||||
* reads record from backend if identifier is given.
|
||||
*
|
||||
* @param string $_identifier
|
||||
*/
|
||||
public function __construct( $_identifier );
|
||||
|
||||
/**
|
||||
* magic method to set attributes of record
|
||||
*
|
||||
* @param string $_attribute_name
|
||||
*/
|
||||
public function __get($_attribute_name);
|
||||
|
||||
/**
|
||||
* magig method to set attributes of record
|
||||
*
|
||||
* @param string $_attribute_name
|
||||
* @param data $data
|
||||
*/
|
||||
public function __set($_attribute_name, $data);
|
||||
|
||||
/**
|
||||
* converts this object to array.
|
||||
* @abstract We need such a function cause PHP5
|
||||
* dosn't allow objects do define it's own casts :-(
|
||||
* once PHP can deal with object casts we will change to them!
|
||||
*
|
||||
* @return array complete record as associative array
|
||||
*/
|
||||
public function get_record_array();
|
||||
|
||||
/**
|
||||
* gets title of record
|
||||
*
|
||||
*@return string tiltle
|
||||
*/
|
||||
public function get_title();
|
||||
|
||||
/**
|
||||
* sets complete record from associative array
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set_record(array $_record);
|
||||
|
||||
/**
|
||||
* gets identifier of this record
|
||||
*
|
||||
* @return string identifier of this record
|
||||
*/
|
||||
public function get_identifier();
|
||||
|
||||
|
||||
/**
|
||||
* saves record into backend
|
||||
*
|
||||
* @return string identifier
|
||||
*/
|
||||
public function save ( $_dst_identifier );
|
||||
|
||||
/**
|
||||
* copys current record to record identified by $_dst_identifier
|
||||
*
|
||||
* @param string $_dst_identifier
|
||||
* @return string dst_identifier
|
||||
*/
|
||||
public function copy ( $_dst_identifier );
|
||||
|
||||
/**
|
||||
* moves current record to record identified by $_dst_identifier
|
||||
* $this will become moved record
|
||||
*
|
||||
* @param string $_dst_identifier
|
||||
* @return string dst_identifier
|
||||
*/
|
||||
public function move ( $_dst_identifier );
|
||||
|
||||
/**
|
||||
* delets current record from backend
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function delete ();
|
||||
|
||||
/**
|
||||
* destructor
|
||||
*
|
||||
*/
|
||||
public function __destruct();
|
||||
|
||||
} // end of iface_egw_record
|
||||
?>
|
92
importexport/inc/class.iface_export_plugin.inc.php
Normal file
92
importexport/inc/class.iface_export_plugin.inc.php
Normal file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* 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: $
|
||||
*/
|
||||
|
||||
//require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.iface_egw_record.inc.php');
|
||||
|
||||
/**
|
||||
* class iface_export_plugin
|
||||
* This a the abstract interface for an export plugin of importexport
|
||||
*
|
||||
* You need to implement this class in
|
||||
* EGW_INCLUDE_ROOT/appname/inc/class.export_<type>.inc.php
|
||||
* to attend the importexport framwork with your export.
|
||||
*
|
||||
* NOTE: This is an easy interface, cause plugins live in theire own
|
||||
* space. Means that they are respnsible for generationg a defintion AND
|
||||
* working on that definition.
|
||||
* So this interface just garanties the interaction with userinterfaces. It
|
||||
* has nothing to do with datatypes.
|
||||
*
|
||||
* JS:
|
||||
* required function in opener:
|
||||
*
|
||||
*
|
||||
* // returns array of identifiers
|
||||
* // NOTE: identifiers need to b
|
||||
* get_selection();
|
||||
*
|
||||
* get_selector(); //returns array
|
||||
*/
|
||||
interface iface_export_plugin {
|
||||
|
||||
/**
|
||||
* exports entries according to given definition object.
|
||||
*
|
||||
* @param definition $_definition
|
||||
*/
|
||||
public static function export($_stream, $_charset, definition $_definition);
|
||||
|
||||
/**
|
||||
* returns translated name of plugin
|
||||
*
|
||||
* @return string name
|
||||
*/
|
||||
public static function get_name();
|
||||
|
||||
/**
|
||||
* returns translated (user) description of plugin
|
||||
*
|
||||
* @return string descriprion
|
||||
*/
|
||||
public static function get_description();
|
||||
|
||||
/**
|
||||
* retruns file suffix for exported file (e.g. csv)
|
||||
*
|
||||
* @return string suffix
|
||||
*/
|
||||
public static function get_filesuffix();
|
||||
|
||||
/**
|
||||
* 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 static function get_options_etpl();
|
||||
|
||||
/**
|
||||
* returns etemplate name for slectors of this plugin
|
||||
*
|
||||
* @return string etemplate name
|
||||
*/
|
||||
public static function get_selectors_etpl();
|
||||
|
||||
} // end of iface_export_plugin
|
||||
?>
|
71
importexport/inc/class.iface_export_record.inc.php
Normal file
71
importexport/inc/class.iface_export_record.inc.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* 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: $
|
||||
*/
|
||||
|
||||
/**
|
||||
* class iface_export_record
|
||||
* This a the abstract interface for an record exporter.
|
||||
* An record is e.g. a single address or or single event.
|
||||
* No mater where the records come from, at the end export_entry
|
||||
* stores it into the stream
|
||||
* NOTE: we don't give records the type "egw_reocrd". Thats becuase
|
||||
* PHP5 dosn't allow objects do define it's own casts :-(
|
||||
*
|
||||
* NOTE: You are not forced to implement this interface to attend importexport
|
||||
* framework. However if you plugin implements this interface it might also be
|
||||
* usable for other tasks.
|
||||
*
|
||||
*/
|
||||
interface iface_export_record
|
||||
{
|
||||
|
||||
/** Aggregations: */
|
||||
|
||||
/** Compositions: */
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param object _handle resource where records are exported to.
|
||||
* @param string _charset charset the records are exported to.
|
||||
* @param array _options options for specific backends
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
public function __construct( $_handle, $_charset, array $_options );
|
||||
|
||||
/**
|
||||
* exports a record into resource of handle
|
||||
*
|
||||
* @param object of interface egw_record _record
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
public function export_record( iface_egw_record $_record );
|
||||
|
||||
/**
|
||||
* Retruns total number of exported records.
|
||||
*
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
public function get_num_of_records( );
|
||||
|
||||
/**
|
||||
* destructor
|
||||
*
|
||||
* @return
|
||||
* @access public
|
||||
*/
|
||||
public function __destruct( );
|
||||
|
||||
} // end of iface_export_record
|
||||
?>
|
76
importexport/inc/class.iface_import_record.inc.php
Normal file
76
importexport/inc/class.iface_import_record.inc.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* 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: $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* class iface_import_record
|
||||
* This a the abstract interface for an record importer.
|
||||
* An record is e.g. a single address or or single event.
|
||||
* No mater where the records come from, at the end the get_entry method comes out
|
||||
*/
|
||||
interface iface_import_record
|
||||
{
|
||||
|
||||
/** Aggregations: */
|
||||
|
||||
/** Compositions: */
|
||||
|
||||
/**
|
||||
* Opens resource, returns false if something fails
|
||||
*
|
||||
* @param string _resource resource containing data. Differs according to the implementations
|
||||
* @param array _options options for the resource
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
public function __construct( $_resource, $_options );
|
||||
|
||||
/**
|
||||
* cleanup
|
||||
*
|
||||
* @return
|
||||
* @access public
|
||||
*/
|
||||
public function __destruct( );
|
||||
|
||||
/**
|
||||
* Returns array with the record found at position and updates the position
|
||||
*
|
||||
* @param string _position may be: {first|last|next|previous|somenumber}
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
public function get_record( $_position = 'next' );
|
||||
|
||||
/**
|
||||
* Retruns total number of records for the open resource.
|
||||
*
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
public function get_num_of_records( );
|
||||
|
||||
/**
|
||||
* Returns pointer of current position
|
||||
*
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
public function get_current_position( );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // end of iface_import_record
|
||||
?>
|
299
importexport/inc/class.import_csv.inc.php
Executable file
299
importexport/inc/class.import_csv.inc.php
Executable file
@ -0,0 +1,299 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - importexport
|
||||
* General Comma Serperated Values (CSV) record importer (abstract class)
|
||||
*
|
||||
* @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: $
|
||||
*/
|
||||
|
||||
require_once('class.iface_import_record.inc.php');
|
||||
require_once('class.import_export_helper_functions.inc.php');
|
||||
|
||||
/**
|
||||
* class import_csv
|
||||
* This a an abstract implementation of interface iface_import_record
|
||||
* An record is e.g. a single address or or single event.
|
||||
* No mater where the records come from, at the end the get_record method comes out
|
||||
* @todo whipe out the bool returns and use exeptions instead!!!
|
||||
* @todo do we realy need the stepping? otherwise we also could deal with stream resources.
|
||||
* The advantage of resources is, that we don't need to struggle whth stream options!
|
||||
* @todo just checked out iterators, but not shure if we can use it.
|
||||
* they iterate over public functions and not over datastructures :-(
|
||||
*/
|
||||
class import_csv implements iface_import_record { //, Iterator {
|
||||
|
||||
const csv_max_linelength = 8000;
|
||||
|
||||
/** Aggregations: */
|
||||
|
||||
/** Compositions: */
|
||||
|
||||
/**
|
||||
* @static import_export_helper_functions
|
||||
*/
|
||||
|
||||
/*** Attributes: ***/
|
||||
|
||||
/**
|
||||
* array holding the current record
|
||||
* @access protected
|
||||
*/
|
||||
protected $record = array();
|
||||
|
||||
/**
|
||||
* current position counter
|
||||
* @access protected
|
||||
*/
|
||||
protected $current_position = 0;
|
||||
|
||||
/**
|
||||
* holds total number of records
|
||||
* @access private
|
||||
* @var int
|
||||
*/
|
||||
protected $num_of_records = 0;
|
||||
|
||||
/**
|
||||
* array with field mapping in form column number => new_field_name
|
||||
* @access protected
|
||||
*/
|
||||
protected $mapping = array();
|
||||
|
||||
/**
|
||||
* array with conversions to be done in form: new_field_name => conversion_string
|
||||
* @access protected
|
||||
*/
|
||||
protected $conversion = array();
|
||||
|
||||
/**
|
||||
* csv resource
|
||||
* @access private
|
||||
*/
|
||||
private $resource;
|
||||
|
||||
/**
|
||||
* holds the string of the resource
|
||||
* needed e.g. to reopen resource
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
private $csv_resourcename = '';
|
||||
|
||||
/**
|
||||
* fieldseperator for csv file
|
||||
* @access private
|
||||
* @var char
|
||||
*/
|
||||
private $csv_fieldsep;
|
||||
|
||||
/**
|
||||
* charset of csv file
|
||||
* @var string
|
||||
* @access privat
|
||||
*/
|
||||
private $csv_charset;
|
||||
|
||||
/**
|
||||
* Opens resource, returns false if something fails
|
||||
*
|
||||
* @param string _resource resource containing data. May be each valid php-stream
|
||||
* @param array _options options for the resource array with keys: charset and fieldsep
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
public function __construct( $_resource, $_options = array() ) {
|
||||
$this->csv_resourcename = $_resource;
|
||||
$this->csv_fieldsep = $_options['fieldsep'];
|
||||
$this->csv_charset = $_options['charset'];
|
||||
|
||||
//return $this->open_resource();
|
||||
} // end of member function __construct
|
||||
|
||||
/**
|
||||
* cleanup
|
||||
*
|
||||
* @return
|
||||
* @access public
|
||||
*/
|
||||
public function __destruct( ) {
|
||||
//$this->close_resource();
|
||||
} // end of member function __destruct
|
||||
|
||||
/**
|
||||
* Returns array with the record found at position and updates the position
|
||||
*
|
||||
* @param mixed _position may be: {current|first|last|next|previous|somenumber}
|
||||
* @return array
|
||||
* @access public
|
||||
*/
|
||||
public function get_record( $_position = 'next' ) {
|
||||
$this->get_raw_record( $_position );
|
||||
$this->do_fieldmapping();
|
||||
$this->do_conversions();
|
||||
return $this->record;
|
||||
} // end of member function get_record
|
||||
|
||||
|
||||
/**
|
||||
* updates $this->record
|
||||
*
|
||||
* @param mixed $_position
|
||||
* @return bool
|
||||
*/
|
||||
private function get_raw_record( $_position = 'next' ) {
|
||||
switch ($_position) {
|
||||
case 'current' :
|
||||
if ($this->current_position == 0) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'first' :
|
||||
if (!$this->current_position == 0) {
|
||||
$this->close_resource();
|
||||
$this->open_resource();
|
||||
}
|
||||
|
||||
case 'next' :
|
||||
$csv_data = fgetcsv( $this->resource, self::csv_max_linelength, $this->csv_fieldsep);
|
||||
if (!is_array($csv_data)) {
|
||||
return false;
|
||||
}
|
||||
$this->current_position++;
|
||||
$this->record = $csv_data;
|
||||
//$this->record = $GLOBALS['egw']->translation->convert($csv_data, $this->csv_charset);
|
||||
break;
|
||||
|
||||
case 'previous' :
|
||||
if ($this->current_position < 2) {
|
||||
return false;
|
||||
}
|
||||
$final_position = --$this->current_position;
|
||||
$this->close_resource();
|
||||
$this->open_resource();
|
||||
while ($this->current_position !== $final_position) {
|
||||
$this->get_raw_record();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'last' :
|
||||
while ($this->get_raw_record()) {}
|
||||
break;
|
||||
|
||||
default: //somenumber
|
||||
if (!is_int($_position)) return false;
|
||||
if ($_position == $this->current_position) {
|
||||
break;
|
||||
}
|
||||
elseif ($_position < $this->current_position) {
|
||||
$this->close_resource();
|
||||
$this->open_resource();
|
||||
}
|
||||
while ($this->current_position !== $_position) {
|
||||
$this->get_raw_record();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
} // end of member function get_raw_record
|
||||
|
||||
/**
|
||||
* Retruns total number of records for the open resource.
|
||||
*
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
public function get_num_of_records( ) {
|
||||
if ($this->num_of_records > 0) {
|
||||
return $this->num_of_records;
|
||||
}
|
||||
$current_position = $this->current_position;
|
||||
while ($this->get_raw_record()) {}
|
||||
$this->num_of_records = $this->current_position;
|
||||
$this->get_record($current_position);
|
||||
return $this->num_of_records;
|
||||
} // end of member function get_num_of_records
|
||||
|
||||
/**
|
||||
* Returns pointer of current position
|
||||
*
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
public function get_current_position( ) {
|
||||
|
||||
return $this->current_position;
|
||||
|
||||
} // end of member function get_current_position
|
||||
|
||||
|
||||
/**
|
||||
* does fieldmapping according to $this->mapping
|
||||
*
|
||||
* @return
|
||||
* @access protected
|
||||
*/
|
||||
protected function do_fieldmapping( ) {
|
||||
foreach ($this->mapping as $cvs_idx => $new_idx) {
|
||||
$record = $this->record;
|
||||
$this->record = array();
|
||||
$this->record[$new_idx] = $record[$cvs_idx];
|
||||
return true;
|
||||
}
|
||||
} // end of member function do_fieldmapping
|
||||
|
||||
/**
|
||||
* does conversions according to $this->conversion
|
||||
*
|
||||
* @return bool
|
||||
* @access protected
|
||||
*/
|
||||
protected function do_conversions( ) {
|
||||
if ( $record = import_export_helper_functions::conversion( $this->record, $this->conversion )) {
|
||||
$this->record = $record;
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
} // end of member function do_conversions
|
||||
|
||||
|
||||
/**
|
||||
* opens the csv resource (php-stream)
|
||||
*
|
||||
* @param string _resource resource containing data. May be each valid php-stream
|
||||
* @param array _options options for the resource array with keys: charset and fieldsep
|
||||
* @return
|
||||
* @access private
|
||||
*/
|
||||
private function open_resource() {
|
||||
if ( !is_readable ( $this->csv_resourcename )) {
|
||||
error_log('error: file '. $this->csv_resourcename .' is not readable by webserver '.__FILE__.__LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->resource = fopen ($this->csv_resourcename, 'rb');
|
||||
|
||||
if (!is_resource($this->resource)) {
|
||||
// some error handling
|
||||
return false;
|
||||
}
|
||||
$this->current_position = 0;
|
||||
return true;
|
||||
} // end of member function open_resource
|
||||
|
||||
/**
|
||||
* closes the csv resource (php-stream)
|
||||
*
|
||||
* @return bool
|
||||
* @access private
|
||||
*/
|
||||
private function close_resource() {
|
||||
return fclose( $this->resource );
|
||||
} // end of member function close_resource
|
||||
|
||||
} // end of import_csv
|
||||
?>
|
287
importexport/inc/class.import_export_helper_functions.inc.php
Executable file
287
importexport/inc/class.import_export_helper_functions.inc.php
Executable file
@ -0,0 +1,287 @@
|
||||
<?php
|
||||
/**
|
||||
* 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: $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* class import_export_helper_functions (only static methods)
|
||||
* use import_export_helper_functions::method
|
||||
*/
|
||||
class import_export_helper_functions
|
||||
{
|
||||
|
||||
/** Aggregations: */
|
||||
|
||||
/** Compositions: */
|
||||
|
||||
/*** Attributes: ***/
|
||||
|
||||
/**
|
||||
* nothing to construct here, only static functions!
|
||||
*
|
||||
* @return bool false
|
||||
*/
|
||||
public function __construct() {
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* converts accound_lid to account_id
|
||||
*
|
||||
* @param string _account_lid comma seperated list
|
||||
* @return string comma seperated list
|
||||
* @static
|
||||
* @access public
|
||||
*/
|
||||
public static function account_lid2id( $_account_lids ) {
|
||||
$account_lids = explode( ',', $_account_lids );
|
||||
foreach ( $account_lids as $account_lid ) {
|
||||
if ( $account_id = $GLOBALS['egw']->accounts->name2id( $account_lid )) {
|
||||
$account_ids[] = $account_id;
|
||||
}
|
||||
}
|
||||
return implode( ',', $account_ids );
|
||||
|
||||
} // end of member function account_lid2id
|
||||
|
||||
/**
|
||||
* converts account_ids to account_lids
|
||||
*
|
||||
* @param int _account_ids comma seperated list
|
||||
* @return string comma seperated list
|
||||
* @static
|
||||
* @access public
|
||||
*/
|
||||
public static function account_id2lid( $_account_id ) {
|
||||
$account_ids = explode( ',', $_account_id );
|
||||
foreach ( $account_ids as $account_id ) {
|
||||
if ( $account_lid = $GLOBALS['egw']->accounts->id2name( $account_id )) {
|
||||
$account_lids[] = $account_lid;
|
||||
}
|
||||
}
|
||||
return implode( ',', $account_lids );
|
||||
} // end of member function account_id2lid
|
||||
|
||||
/**
|
||||
* converts cat_id to a cat_name
|
||||
*
|
||||
* @param int _cat_ids comma seperated list
|
||||
* @return mixed string cat_name
|
||||
* @static
|
||||
* @access public
|
||||
*/
|
||||
public static function cat_id2name( $_cat_ids ) {
|
||||
if ( !is_object($GLOBALS['egw']->categories) ) {
|
||||
$GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories');
|
||||
}
|
||||
$cat_ids = explode( ',', $_cat_id );
|
||||
foreach ( $cat_ids as $cat_id ) {
|
||||
$cat_names[] = $GLOBALS['egw']->categories->id2name( (int)$cat_id );
|
||||
}
|
||||
return implode(',',$cat_names);
|
||||
} // end of member function category_id2name
|
||||
|
||||
/**
|
||||
* converts cat_name to a cat_id.
|
||||
* If a cat isn't found, it will be created.
|
||||
*
|
||||
* @param string _cat_names comma seperated list.
|
||||
* @return mixed int / string (comma seperated cat id's)
|
||||
* @static
|
||||
* @access public
|
||||
*/
|
||||
public static function cat_name2id( $_cat_names, $_create = true ) {
|
||||
if (!is_object($GLOBALS['egw']->categories)) {
|
||||
$GLOBALS['egw']->categories =& CreateObject( 'phpgwapi.categories' );
|
||||
}
|
||||
$cat_names = explode( ',', $_cat_names );
|
||||
foreach ( $cat_names as $cat_name ) {
|
||||
if ( $cat_id = $GLOBALS['egw']->categories->name2id( addslashes( $cat_name ))) { }
|
||||
elseif ($_create) $cat_id = $GLOBALS['egw']->categories->add( array( 'name' => $cat_name,'descr' => $cat_name ));
|
||||
else continue;
|
||||
$cat_ids[] = $cat_id;
|
||||
}
|
||||
return implode( ',', $cat_ids );
|
||||
|
||||
} // end of member function category_name2id
|
||||
|
||||
/**
|
||||
* conversion
|
||||
*
|
||||
* Conversions enable you to change / adapt the content of each _record field for your needs.
|
||||
* General syntax is: pattern1 |> replacement1 || ... || patternN |> replacementN
|
||||
* If the pattern-part of a pair is ommited it will match everything ('^.*$'), which
|
||||
* is only usefull for the last pair, as they are worked from left to right.
|
||||
* Example: 1|>private||public
|
||||
* This will translate a '1' in the _record field to 'privat' and everything else to 'public'.
|
||||
*
|
||||
* In addintion to the fields assign by the pattern of the reg.exp.
|
||||
* you can use all other _record fields, with the syntax |[FIELDNAME].
|
||||
* Example:
|
||||
* .+|>|[Company]: |[NFamily], |[NGiven]|||[NFamily], |[NGiven]
|
||||
* It is used on the _record field 'Company' and constructs a something like
|
||||
* Company: FamilyName, GivenName or FamilyName, GivenName if 'Company' is empty.
|
||||
*
|
||||
* Moreover the helper function of this class can be used using the '@' operator.
|
||||
* @cat_name2id(Cat1,...,CatN) returns a (','-separated) list with the cat_id's. If a
|
||||
* category isn't found, it will be automaticaly added.
|
||||
*
|
||||
* Patterns as well as the replacement can be regular expressions (the replacement is done
|
||||
* via ereg_replace).
|
||||
*
|
||||
* If, after all replacements, the value starts with an '@' the whole
|
||||
* value is eval()'ed, so you may use all php, phpgw plus your own functions. This is quiet
|
||||
* powerfull, but circumvents all ACL. Therefor this feature is only availible to
|
||||
* Adminstrators.
|
||||
*
|
||||
* Example using regular expressions and '@'-eval():
|
||||
* ||0?([0-9]+)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*)[ .:-]+0?([0-9]*).*|>@mktime(|#4,|#5,|#6,|#2,|#3,|#1)
|
||||
* It will read a date of the form '2001-05-20 08:00:00.00000000000000000' (and many more,
|
||||
* see the regular expr.). The [ .:-]-separated fields are read and assigned in different
|
||||
* order to @mktime(). Please note to use |# insted of a backslash (I couldn't get backslash
|
||||
* through all the involved templates and forms.) plus the field-number of the pattern.
|
||||
*
|
||||
* @param array _record reference with record to do the conversion with
|
||||
* @param array _conversion array with conversion description
|
||||
* @return bool
|
||||
* @static
|
||||
* @access public
|
||||
*/
|
||||
public static function conversion( $_record, $_conversion ) {
|
||||
|
||||
$PSep = '||'; // Pattern-Separator, separats the pattern-replacement-pairs in conversion
|
||||
$ASep = '|>'; // Assignment-Separator, separats pattern and replacesment
|
||||
$VPre = '|#'; // Value-Prefix, is expanded to \ for ereg_replace
|
||||
$CPre = '|['; $CPreReg = '\|\['; // |{_record-fieldname} is expanded to the value of the _record-field
|
||||
$CPos = ']'; $CPosReg = '\]'; // if used together with @ (replacement is eval-ed) value gets autom. quoted
|
||||
|
||||
foreach ( $_record as $record_idx => $record_value ) {
|
||||
$pat_reps = explode($PSep,stripslashes($_conversion[$record_idx]));
|
||||
$replaces = ''; $rvalues = '';
|
||||
if($pat_reps[0] != '')
|
||||
{
|
||||
foreach($pat_reps as $k => $pat_rep)
|
||||
{
|
||||
list($pattern,$replace) = explode($ASep,$pat_rep,2);
|
||||
if($replace == '')
|
||||
{
|
||||
$replace = $pattern; $pattern = '^.*$';
|
||||
}
|
||||
$rvalues[$pattern] = $replace; // replace two with only one, added by the form
|
||||
$replaces .= ($replaces != '' ? $PSep : '') . $pattern . $ASep . $replace;
|
||||
}
|
||||
//$_conversion[$record_idx] = $rvalues;
|
||||
$conv_record = $rvalues;
|
||||
}
|
||||
else
|
||||
{
|
||||
//unset($_conversion[$record_idx] );
|
||||
}
|
||||
|
||||
if(!empty($_conversion[$record_idx]))
|
||||
{
|
||||
//$conv_record = $_conversion[$record_idx];
|
||||
while(list($pattern,$replace) = each($conv_record))
|
||||
{
|
||||
if(ereg((string) $pattern,$val))
|
||||
{
|
||||
$val = ereg_replace((string) $pattern,str_replace($VPre,'\\',$replace),(string) $val);
|
||||
|
||||
$reg = $CPreReg.'([a-zA-Z_0-9]+)'.$CPosReg;
|
||||
while(ereg($reg,$val,$vars))
|
||||
{ // expand all _record fields
|
||||
$val = str_replace($CPre . $vars[1] . $CPos, $val[0] == '@' ? "'"
|
||||
. addslashes($fields[array_search($vars[1], array_keys($_record))])
|
||||
. "'" : $fields[array_search($vars[1], array_keys($_record))], $val);
|
||||
}
|
||||
if($val[0] == '@')
|
||||
{
|
||||
if (!$GLOBALS['egw_info']['user']['apps']['admin'])
|
||||
{
|
||||
error_log(__FILE__.__LINE__. lang('@-eval() is only availible to admins!!!'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// removing the $ to close security hole of showing vars, which contain eg. passwords
|
||||
$val = substr(str_replace('$','',$val),1).';';
|
||||
$val = 'return '. (substr($val,0,6) == 'cat_id' ? '$this->'.$val : $val);
|
||||
// echo "<p>eval('$val')=";
|
||||
$val = eval($val);
|
||||
// echo "'$val'</p>";
|
||||
}
|
||||
}
|
||||
if($pattern[0] != '@' || $val)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$values[$record_idx] = $val;
|
||||
}
|
||||
return $values;
|
||||
} // end of member function conversion
|
||||
|
||||
/**
|
||||
* returns a list of importexport plugins
|
||||
*
|
||||
* @param string $_tpye {import | export | all}
|
||||
* @param string $_appname {<appname> | all}
|
||||
* @return array(<appname> => array( <type> => array(<plugin> => <title>)))
|
||||
*/
|
||||
public static function get_plugins($_appname, $_type){
|
||||
$appnames = $_appname == 'all' ? array_keys($GLOBALS['egw_info']['apps']) : (array)$_appname;
|
||||
$types = $_types == 'all' ? array('import','export') : (array)$_type;
|
||||
$plugins = array();
|
||||
|
||||
foreach ($appnames as $appname) {
|
||||
$appdir = EGW_INCLUDE_ROOT. "/$appname/inc";
|
||||
if(!is_dir($appdir)) continue;
|
||||
$d = dir($appdir);
|
||||
|
||||
// step through each file in appdir
|
||||
while (false !== ($entry = $d->read())) {
|
||||
list( ,$classname, ,$extension) = explode('.',$entry);
|
||||
$file = $appdir. '/'. $entry;
|
||||
|
||||
foreach ($types as $type) {
|
||||
if(!is_file($file) || substr($classname,0,7) != $type.'_' || $extension != 'php') continue;
|
||||
require_once($file);
|
||||
|
||||
try {
|
||||
$plugin_object = @new $classname;
|
||||
}
|
||||
catch (Exception $exception) {
|
||||
continue;
|
||||
}
|
||||
if (is_a($plugin_object,'iface_'.$type.'_plugin')) {
|
||||
$plugins[$appname][$type][$classname] = $plugin_object->get_name();
|
||||
}
|
||||
unset ($plugin_object);
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
}
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns list of apps which have plugins of given type.
|
||||
*
|
||||
* @param string $_type
|
||||
* @return array $num => $appname
|
||||
*/
|
||||
public static function get_apps($_type) {
|
||||
return array_keys(self::get_plugins('all',$_type));
|
||||
}
|
||||
|
||||
} // end of import_export_helper_functions
|
||||
?>
|
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - importexport
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package importexport
|
||||
* @link http://www.egroupware.org
|
||||
* @copyright Cornelius Weiss <nelius@cwtech.de>
|
||||
* @version $Id: $
|
||||
*/
|
||||
|
||||
if (!defined('IMPORTEXPORT_APP'))
|
||||
{
|
||||
define('IMPORTEXPORT_APP','importexport');
|
||||
}
|
||||
|
||||
class importexport_admin_prefs_sidebox_hooks
|
||||
{
|
||||
var $config = array();
|
||||
|
||||
function importexport_admin_prefs_sidebox_hooks()
|
||||
{
|
||||
$config =& CreateObject('phpgwapi.config',IMPORTEXPORT_APP);
|
||||
$config->read_repository();
|
||||
$this->config =& $config->config_data;
|
||||
unset($config);
|
||||
}
|
||||
|
||||
function all_hooks($args)
|
||||
{
|
||||
$appname = IMPORTEXPORT_APP;
|
||||
$location = is_array($args) ? $args['location'] : $args;
|
||||
|
||||
if ($location == 'sidebox_menu')
|
||||
{
|
||||
$file = array(
|
||||
'Import definitions' => $GLOBALS['egw']->link('/index.php','menuaction=importexport.uidefinitions.import_definition'),
|
||||
);
|
||||
display_sidebox($appname,$GLOBALS['egw_info']['apps'][$appname]['title'].' '.lang('Menu'),$file);
|
||||
}
|
||||
|
||||
if ($GLOBALS['egw_info']['user']['apps']['preferences'] && $location != 'admin')
|
||||
{
|
||||
$file = array(
|
||||
// 'Preferences' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uisettings.index&appname='.$appname),
|
||||
// 'Grant Access' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
|
||||
// 'Edit Categories' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
|
||||
);
|
||||
if ($location == 'preferences')
|
||||
{
|
||||
display_section($appname,$file);
|
||||
}
|
||||
else
|
||||
{
|
||||
display_sidebox($appname,lang('Preferences'),$file);
|
||||
}
|
||||
}
|
||||
|
||||
if ($GLOBALS['egw_info']['user']['apps']['admin'] && $location != 'preferences')
|
||||
{
|
||||
$file = Array(
|
||||
'Define {im|ex}ports' => $GLOBALS['egw']->link('/index.php',array(
|
||||
'menuaction' => 'importexport.uidefinitions.index',
|
||||
)),
|
||||
);
|
||||
if ($location == 'admin')
|
||||
{
|
||||
display_section($appname,$file);
|
||||
}
|
||||
else
|
||||
{
|
||||
display_sidebox($appname,lang('Admin'),$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* populates $GLOBALS['settings'] for the preferences
|
||||
*/
|
||||
function settings()
|
||||
{
|
||||
$this->check_set_default_prefs();
|
||||
|
||||
return true; // otherwise prefs say it cant find the file ;-)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if reasonable default preferences are set and set them if not
|
||||
*
|
||||
* It sets a flag in the app-session-data to be called only once per session
|
||||
*/
|
||||
function check_set_default_prefs()
|
||||
{
|
||||
if ($GLOBALS['egw']->session->appsession('default_prefs_set',IMPORTEXPORT_APP))
|
||||
{
|
||||
return;
|
||||
}
|
||||
$GLOBALS['egw']->session->appsession('default_prefs_set',IMPORTEXPORT_APP,'set');
|
||||
|
||||
$default_prefs =& $GLOBALS['egw']->preferences->default[IMPORTEXPORT_APP];
|
||||
|
||||
$defaults = array(
|
||||
);
|
||||
foreach($defaults as $var => $default)
|
||||
{
|
||||
if (!isset($default_prefs[$var]) || $default_prefs[$var] === '')
|
||||
{
|
||||
$GLOBALS['egw']->preferences->add(IMPORTEXPORT_APP,$var,$default,'default');
|
||||
$need_save = True;
|
||||
}
|
||||
}
|
||||
if ($need_save)
|
||||
{
|
||||
$GLOBALS['egw']->preferences->save_repository(False,'default');
|
||||
}
|
||||
}
|
||||
}
|
461
importexport/inc/class.uidefinitions.inc.php
Normal file
461
importexport/inc/class.uidefinitions.inc.php
Normal file
@ -0,0 +1,461 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - importexport
|
||||
*
|
||||
* @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: $
|
||||
*/
|
||||
|
||||
require_once(EGW_INCLUDE_ROOT.'/etemplate/inc/class.uietemplate.inc.php');
|
||||
require_once('class.bodefinitions.inc.php');
|
||||
|
||||
if (!defined('IMPORTEXPORT_APP'))
|
||||
{
|
||||
define('IMPORTEXPORT_APP','importexport');
|
||||
}
|
||||
|
||||
/**
|
||||
* Userinterface to define {im|ex}ports
|
||||
*
|
||||
* @package importexport
|
||||
*/
|
||||
class uidefinitions
|
||||
{
|
||||
const _debug = true;
|
||||
|
||||
public $public_functions = array(
|
||||
'edit' => true,
|
||||
'index' => true,
|
||||
'wizzard' => true,
|
||||
'import_definition' => true,
|
||||
);
|
||||
|
||||
/**
|
||||
* holds all available plugins
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
var $plugins;
|
||||
|
||||
/**
|
||||
* holds user chosen plugin after step20
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
var $plugin;
|
||||
|
||||
/**
|
||||
* xajax response object
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
var $response = true;
|
||||
|
||||
function uidefinitions()
|
||||
{
|
||||
// we cant deal with notice and warnings, as we are on ajax!
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
|
||||
$GLOBALS['egw']->translation->add_app(IMPORTEXPORT_APP);
|
||||
$GLOBALS['egw_info']['flags']['currentapp'] = IMPORTEXPORT_APP;
|
||||
|
||||
$GLOBALS['egw_info']['flags']['include_xajax'] = true;
|
||||
if(!@is_object($GLOBALS['egw']->js))
|
||||
{
|
||||
$GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript');
|
||||
}
|
||||
$this->etpl =& new etemplate();
|
||||
$this->clock = $GLOBALS['egw']->html->image(IMPORTEXPORT_APP,'clock');
|
||||
$this->steps = array(
|
||||
'wizzard_step10' => lang('Choose an application'),
|
||||
'wizzard_step20' => lang('Choose a plugin'),
|
||||
'wizzard_step80' => lang('Which useres are allowed for this definition'),
|
||||
'wizzard_step90' => lang('Choose a name for this definition'),
|
||||
'wizzard_finish' => '',
|
||||
);
|
||||
//register plugins (depricated)
|
||||
$this->plugins = bodefinitions::plugins();
|
||||
}
|
||||
|
||||
/**
|
||||
* List defined {im|ex}ports
|
||||
*
|
||||
* @param array $content=null
|
||||
*/
|
||||
function index($content = null,$msg='')
|
||||
{
|
||||
$bodefinitions = new bodefinitions(array('name' => '*'));
|
||||
if (is_array($content))
|
||||
{
|
||||
if (isset($content['delete']))
|
||||
{
|
||||
$bodefinitions->delete(array_keys($content['delete'],'pressed'));
|
||||
}
|
||||
elseif(($button = array_search('pressed',$content)) !== false)
|
||||
{
|
||||
$selected = array_keys($content['selected'],1);
|
||||
if(count($selected) < 1 || !is_array($selected)) exit();
|
||||
switch ($button)
|
||||
{
|
||||
case 'delete_selected' :
|
||||
$bodefinitions->delete($selected);
|
||||
break;
|
||||
|
||||
case 'export_selected' :
|
||||
$mime_type = ($GLOBALS['egw']->html->user_agent == 'msie' || $GLOBALS['egw']->html->user_agent == 'opera') ?
|
||||
'application/octetstream' : 'application/octet-stream';
|
||||
$name = 'importexport.definition';
|
||||
header('Content-Type: ' . $mime_type);
|
||||
header('Content-Disposition: attachment; filename="'.$name.'"');
|
||||
echo $bodefinitions->export($selected);
|
||||
exit();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$etpl =& new etemplate(IMPORTEXPORT_APP.'.definition_index');
|
||||
|
||||
// we need an offset because of autocontinued rows in etemplate ...
|
||||
$definitions = array('row0');
|
||||
|
||||
foreach ($bodefinitions->get_definitions() as $identifier) {
|
||||
$definition = new definition($identifier);
|
||||
$definitions[] = $definition->get_record_array();
|
||||
unset($definition);
|
||||
}
|
||||
$content = $definitions;
|
||||
return $etpl->exec(IMPORTEXPORT_APP.'.uidefinitions.index',$content,array(),$readonlys,$preserv);
|
||||
}
|
||||
|
||||
function edit()
|
||||
{
|
||||
if(!$_definition = $_GET['definition'])
|
||||
{
|
||||
//close window
|
||||
}
|
||||
$definition = array('name' => $_definition);
|
||||
$bodefinitions = new bodefinitions();
|
||||
$bodefinitions->read($definition);
|
||||
$definition['edit'] = true;
|
||||
$this->wizzard($definition);
|
||||
}
|
||||
|
||||
function wizzard($content = null, $msg='')
|
||||
{
|
||||
$GLOBALS['egw_info']['flags']['java_script'] .=
|
||||
"<script LANGUAGE='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.wizzardbox');
|
||||
$this->wizzard_content_template =& $this->etpl->children[0]['data'][1]['A'][2][1]['name'];
|
||||
|
||||
if(is_array($content) &&! $content['edit'])
|
||||
{
|
||||
if(self::_debug) error_log('importexport.wizzard->$content '. print_r($content,true));
|
||||
// fetch plugin object
|
||||
if($content['plugin'] && $content['application'])
|
||||
{
|
||||
// we need to deal with the wizzard object if exists
|
||||
if (file_exists(EGW_SERVER_ROOT . '/'. $content['application'].'/inc/class.wizzard_'. $content['plugin'].'.inc.php'))
|
||||
{
|
||||
$wizzard_plugin = 'wizzard_'.$content['plugin'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$wizzard_plugin = $content['plugin'];
|
||||
}
|
||||
$this->plugin = is_object($GLOBALS['egw']->$wizzard_plugin) ? $GLOBALS['egw']->$wizzard_plugin : new $wizzard_plugin;
|
||||
if(!is_object($GLOBALS['egw']->uidefinitions)) $GLOBALS['egw']->uidefinitions =& $this;
|
||||
}
|
||||
// deal with buttons even if we are not on ajax
|
||||
if(isset($content['button']) && array_search('pressed',$content['button']) === false && count($content['button']) == 1)
|
||||
{
|
||||
$button = array_keys($content['button']);
|
||||
$content['button'] = array($button[0] => 'pressed');
|
||||
}
|
||||
|
||||
// post process submitted step
|
||||
if(!key_exists($content['step'],$this->steps))
|
||||
$next_step = $this->plugin->$content['step']($content);
|
||||
else
|
||||
$next_step = $this->$content['step']($content);
|
||||
|
||||
// pre precess next step
|
||||
$sel_options = $readonlys = $preserv = array();
|
||||
if(!key_exists($next_step,$this->steps))
|
||||
{
|
||||
$this->wizzard_content_template = $this->plugin->$next_step($content,$sel_options,$readonlys,$preserv);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->wizzard_content_template = $this->$next_step($content,$sel_options,$readonlys,$preserv);
|
||||
}
|
||||
|
||||
$html = $this->etpl->exec(IMPORTEXPORT_APP.'.uidefinitions.wizzard',$content,$sel_options,$readonlys,$preserv,1);
|
||||
}
|
||||
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();
|
||||
if($content['edit'])
|
||||
unset ($content['edit']);
|
||||
|
||||
$this->wizzard_content_template = $this->wizzard_step10($content, $sel_options, $readonlys, $preserv);
|
||||
$html = $this->etpl->exec(IMPORTEXPORT_APP.'.uidefinitions.wizzard',$content,$sel_options,$readonlys,$preserv,1);
|
||||
}
|
||||
|
||||
if(class_exists('xajaxResponse'))
|
||||
{
|
||||
$this->response =& new xajaxResponse();
|
||||
|
||||
if ($content['closewindow'])
|
||||
{
|
||||
$this->response->addScript("window.close();");
|
||||
$this->response->addScript("opener.location.reload();");
|
||||
// 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 (is_object($GLOBALS['egw']->js) && $GLOBALS['egw']->js->body['onLoad'])
|
||||
{
|
||||
$this->response->addScript($GLOBALS['egw']->js->body['onLoad']);
|
||||
}
|
||||
$this->response->addAssign('picturebox', 'style.display', 'none');
|
||||
$this->response->addScript("set_style_by_class('div','popupManual','display','inline');");
|
||||
|
||||
return $this->response->getXML();
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['egw']->js->set_onload("document.getElementById('picturebox').style.display = 'none';");
|
||||
$GLOBALS['egw']->common->egw_header();
|
||||
echo '<div id="divMain">'."\n";
|
||||
echo '<div><h3>{Im|Ex}port Wizzard</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(IMPORTEXPORT_APP.'.uidefinitions.wizzard',$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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gets name of next step
|
||||
*
|
||||
* @param string $curr_step
|
||||
* @param int $step_width
|
||||
* @return string containing function name of next step
|
||||
*/
|
||||
function get_step ($curr_step, $step_width)
|
||||
{
|
||||
/*if($content['plugin'] && $content['application']&& !is_object($this->plugin))
|
||||
{
|
||||
$plugin_definition = $this->plugins[$content['application']][$content['plugin']]['definition'];
|
||||
if($plugin_definition) $this->plugin =& new $plugin_definition;
|
||||
}*/
|
||||
if(is_object($this->plugin))
|
||||
{
|
||||
$steps = array_merge($this->steps,$this->plugin->steps);
|
||||
$steps = array_flip($steps); asort($steps); $steps = array_flip($steps);
|
||||
}
|
||||
else
|
||||
{
|
||||
$steps = $this->steps;
|
||||
}
|
||||
$step_keys = array_keys($steps);
|
||||
$nn = array_search($curr_step,$step_keys)+(int)$step_width;
|
||||
return (key_exists($nn,$step_keys)) ? $step_keys[$nn] : false;
|
||||
}
|
||||
|
||||
|
||||
function wizzard_step10(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||
{
|
||||
if(self::_debug) error_log('addressbook.importexport.addressbook_csv_import::wizzard_step10->$content '.print_r($content,true));
|
||||
|
||||
// return from step10
|
||||
if ($content['step'] == 'wizzard_step10')
|
||||
{
|
||||
switch (array_search('pressed', $content['button']))
|
||||
{
|
||||
case 'next':
|
||||
return $this->get_step($content['step'],1);
|
||||
case 'finish':
|
||||
return 'wizzard_finish';
|
||||
default :
|
||||
return $this->wizzard_step10($content,$sel_options,$readonlys,$preserv);
|
||||
}
|
||||
|
||||
}
|
||||
// init step10
|
||||
else
|
||||
{
|
||||
$content['msg'] = $this->steps['wizzard_step10'];
|
||||
foreach ($this->plugins as $appname => $options) $sel_options['application'][$appname] = lang($appname);
|
||||
$GLOBALS['egw']->js->set_onload("disable_button('exec[button][previous]');");
|
||||
$content['step'] = 'wizzard_step10';
|
||||
$preserv = $content;
|
||||
unset ($preserv['button']);
|
||||
return 'importexport.wizzard_chooseapp';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// get plugin
|
||||
function wizzard_step20(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||
{
|
||||
if(self::_debug) error_log('addressbook.importexport.addressbook_csv_import::wizzard_step20->$content '.print_r($content,true));
|
||||
|
||||
// return from step20
|
||||
if ($content['step'] == 'wizzard_step20')
|
||||
{
|
||||
switch (array_search('pressed', $content['button']))
|
||||
{
|
||||
case 'next':
|
||||
$content['type'] = $this->plugin->plugin_info['type'];
|
||||
return $this->get_step($content['step'],1);
|
||||
case 'previous' :
|
||||
unset ($content['plugin']);
|
||||
$this->response->addScript("disable_button('exec[button][previous]');");
|
||||
return $this->get_step($content['step'],-1);
|
||||
case 'finish':
|
||||
return 'wizzard_finish';
|
||||
default :
|
||||
return $this->wizzard_step20($content,$sel_options,$readonlys,$preserv);
|
||||
}
|
||||
}
|
||||
// init step20
|
||||
else
|
||||
{
|
||||
$content['msg'] = $this->steps['wizzard_step20'];
|
||||
foreach ($this->plugins[$content['application']] as $plugin => $info) $sel_options['plugin'][$plugin] = $info['name'];
|
||||
$content['step'] = 'wizzard_step20';
|
||||
$preserv = $content;
|
||||
unset ($preserv['button']);
|
||||
return 'importexport.wizzard_chooseplugin';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// allowed users
|
||||
function wizzard_step80(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||
{
|
||||
if(self::_debug) error_log('importexport.uidefinitions::wizzard_step80->$content '.print_r($content,true));
|
||||
|
||||
// return from step80
|
||||
if ($content['step'] == 'wizzard_step80')
|
||||
{
|
||||
$content['allowed_users'] = implode(',',$content['allowed_users']);
|
||||
|
||||
switch (array_search('pressed', $content['button']))
|
||||
{
|
||||
case 'next':
|
||||
return $this->get_step($content['step'],1);
|
||||
case 'previous' :
|
||||
return $this->get_step($content['step'],-1);
|
||||
case 'finish':
|
||||
return 'wizzard_finish';
|
||||
default :
|
||||
return $this->wizzard_step80($content,$sel_options,$readonlys,$preserv);
|
||||
}
|
||||
}
|
||||
// init step80
|
||||
else
|
||||
{
|
||||
$content['msg'] = $this->steps['wizzard_step80'];
|
||||
$content['step'] = 'wizzard_step80';
|
||||
$preserv = $content;
|
||||
unset ($preserv['button']);
|
||||
return 'importexport.wizzard_chooseallowedusers';
|
||||
}
|
||||
}
|
||||
|
||||
// name
|
||||
function wizzard_step90(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||
{
|
||||
if(self::_debug) error_log('importexport.uidefinitions::wizzard_step90->$content '.print_r($content,true));
|
||||
|
||||
// return from step90
|
||||
if ($content['step'] == 'wizzard_step90')
|
||||
{
|
||||
// workaround for some ugly bug related to readonlys;
|
||||
unset($content['button']['next']);
|
||||
switch (array_search('pressed', $content['button']))
|
||||
{
|
||||
case 'previous' :
|
||||
return $this->get_step($content['step'],-1);
|
||||
case 'finish':
|
||||
return 'wizzard_finish';
|
||||
default :
|
||||
return $this->wizzard_step90($content,$sel_options,$readonlys,$preserv);
|
||||
}
|
||||
}
|
||||
// init step90
|
||||
else
|
||||
{
|
||||
$content['msg'] = $this->steps['wizzard_step90'];
|
||||
$content['step'] = 'wizzard_step90';
|
||||
$preserv = $content;
|
||||
unset ($preserv['button']);
|
||||
$GLOBALS['egw']->js->set_onload("disable_button('exec[button][next]');");
|
||||
return 'importexport.wizzard_choosename';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function wizzard_finish(&$content)
|
||||
{
|
||||
if(self::_debug) error_log('importexport.uidefinitions::wizzard_finish->$content '.print_r($content,true));
|
||||
$bodefinitions = new bodefinitions();
|
||||
$bodefinitions->save($content);
|
||||
// This message is displayed if browser cant close window
|
||||
$content['msg'] = lang('ImportExport wizard finished successfully!');
|
||||
$content['closewindow'] = true;
|
||||
return 'importexport.wizzard_close';
|
||||
}
|
||||
|
||||
function import_definition($content='')
|
||||
{
|
||||
$bodefinitions = new bodefinitions();
|
||||
if (is_array($content))
|
||||
{
|
||||
$bodefinitions->import($content['import_file']);
|
||||
// TODO make redirect here!
|
||||
return $this->index();
|
||||
}
|
||||
else
|
||||
{
|
||||
$etpl =& new etemplate(IMPORTEXPORT_APP.'.import_definition');
|
||||
return $etpl->exec(IMPORTEXPORT_APP.'.uidefinitions.import_definition',$content,array(),$readonlys,$preserv);
|
||||
}
|
||||
}
|
||||
}
|
285
importexport/inc/class.uiexport.inc.php
Normal file
285
importexport/inc/class.uiexport.inc.php
Normal file
@ -0,0 +1,285 @@
|
||||
<?php
|
||||
/**
|
||||
* 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: $
|
||||
*/
|
||||
|
||||
require_once(EGW_INCLUDE_ROOT. '/etemplate/inc/class.etemplate.inc.php');
|
||||
require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.import_export_helper_functions.inc.php');
|
||||
require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.bodefinitions.inc.php');
|
||||
require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.definition.inc.php');
|
||||
|
||||
|
||||
/**
|
||||
* userinterface for exports
|
||||
*
|
||||
*/
|
||||
class uiexport {
|
||||
const _appname = 'importexport';
|
||||
|
||||
public $public_functions = array(
|
||||
'export_dialog' => true,
|
||||
'download' => true,
|
||||
);
|
||||
|
||||
private $js;
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* holds all export plugins from all apps
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $export_plugins;
|
||||
|
||||
public function __construct() {
|
||||
$this->js = $GLOBALS['egw']->js = is_object($GLOBALS['egw']->js) ? $GLOBALS['egw']->js : CreateObject('phpgwapi.javascript');
|
||||
$this->user = $GLOBALS['egw_info']['user']['user_id'];
|
||||
$this->export_plugins = import_export_helper_functions::get_plugins('all','export');
|
||||
$GLOBALS['egw_info']['flags']['include_xajax'] = true;
|
||||
|
||||
}
|
||||
|
||||
public function export_dialog($_content=array()) {
|
||||
$tabs = 'general_tab|selection_tab|options_tab|templates_tab';
|
||||
$content = array();
|
||||
$sel_options = array();
|
||||
$readonlys = array();
|
||||
$preserv = array();
|
||||
|
||||
if(empty($_content)) {
|
||||
$et = new etemplate(self::_appname. '.export_dialog');
|
||||
$_appname = $_GET['appname'];
|
||||
$_plugin = $_GET['plugin'];
|
||||
$_selection = $_GET['selection'];
|
||||
|
||||
// if appname is given and valid, list available plugins (if no plugin is given)
|
||||
if (!empty($_appname) && $GLOBALS['egw']->acl->check('run',1,$_appname)) {
|
||||
$content['appname'] = $_appname;
|
||||
$preserv['appname'] = $_appname;
|
||||
$readonlys['appname'] = true;
|
||||
$this->js->set_onload("set_style_by_class('tr','select_appname','display','none');");
|
||||
|
||||
(array)$plugins = $this->export_plugins[$_appname]['export'];
|
||||
if(isset($plugins[$_plugin])) {
|
||||
$content['plugin'] = $_plugin;
|
||||
$selected_plugin = $_plugin;
|
||||
$this->js->set_onload("set_style_by_class('tr','select_plugin','display','none');");
|
||||
}
|
||||
else {
|
||||
$plugins_classnames = array_keys($plugins);
|
||||
$selected_plugin = $plugins_classnames[0];
|
||||
$sel_options['plugin'] = $plugins;
|
||||
}
|
||||
|
||||
if (!empty($selected_plugin)) {
|
||||
$plugin_object = new $selected_plugin;
|
||||
|
||||
$content['plugin_description'] = $plugin_object->get_description();
|
||||
|
||||
// fill options tab
|
||||
// TODO: do we need all options templates online?
|
||||
// NO, we can manipulate the session array of template id on xajax request
|
||||
// however, there might be other solutions... we solve this in 1.3
|
||||
$content['plugin_options_html'] = $plugin_object->get_options_etpl();
|
||||
|
||||
// fill selection tab
|
||||
if ($_selection) {
|
||||
$readonlys[$tabs]['selection_tab'] = true;
|
||||
$content['selection'] = $_selection;
|
||||
$preserv['selection'] = $_selection;
|
||||
}
|
||||
else {
|
||||
// ToDo: I need to think abaout it...
|
||||
// are selectors abstracted in the iface_egw_record_entity ?
|
||||
// if so, we might not want to have html here ?
|
||||
$content['plugin_selectors_html'] = $plugin_object->get_selectors_html();
|
||||
}
|
||||
unset ($plugin_object);
|
||||
}
|
||||
}
|
||||
// if no appname is supplied, list apps which can export
|
||||
else {
|
||||
(array)$apps = import_export_helper_functions::get_apps('export');
|
||||
$sel_options['appname'] = array('' => lang('Select one')) + array_combine($apps,$apps);
|
||||
$this->js->set_onload("set_style_by_class('tr','select_plugin','display','none');");
|
||||
$content['plugin_selectors_html'] = $content['plugin_options_html'] =
|
||||
lang('You need to select an app and format first!');
|
||||
}
|
||||
|
||||
if (!$_selection) {
|
||||
$this->js->set_onload("
|
||||
disable_button('exec[preview]');
|
||||
disable_button('exec[export]');
|
||||
");
|
||||
}
|
||||
|
||||
// fill templates_tab
|
||||
$sel_options['templates'] = array();
|
||||
$definitions = new bodefinitions(array(
|
||||
'type' => 'export',
|
||||
'application' => isset($content['appname']) ? $content['appname'] : '%'
|
||||
));
|
||||
foreach ((array)$definitions->get_definitions() as $identifier) {
|
||||
$definition = new definition($identifier);
|
||||
if ($title = $definition->get_title()) {
|
||||
$sel_options['templates'][$title] = $title;
|
||||
}
|
||||
unset($definition);
|
||||
}
|
||||
unset($definitions);
|
||||
if (empty($sel_options['templates'])) {
|
||||
$readonlys[$tabs]['templates_tab'] = true;
|
||||
}
|
||||
// disable preview box
|
||||
$this->js->set_onload("set_style_by_class('tr','preview-box','display','none');");
|
||||
}
|
||||
//xajax_eT_wrapper submit
|
||||
elseif(class_exists('xajaxResponse'))
|
||||
{
|
||||
//error_log(__LINE__.__FILE__.'$_content: '.print_r($_content,true));
|
||||
$response =& new xajaxResponse();
|
||||
|
||||
$definition = new definition();
|
||||
$definition->definition_id = $_content['definition_id'] ? $_content['definition_id'] : '';
|
||||
$definition->name = $_content['name'] ? $_content['name'] : '';
|
||||
$definition->application = $_content['appname'];
|
||||
$definition->plugin = $_content['plugin'];
|
||||
$definition->type = 'export';
|
||||
$definition->allowed_users = $_content['allowed_users'] ? $_content['allowed_users'] : $this->user;
|
||||
$definition->owner = $_content['owner'] ? $_content['owner'] : $this->user;
|
||||
|
||||
//$definition->options = parse(...)
|
||||
$definition->options = array(
|
||||
'selection' => $_content['selection'],
|
||||
);
|
||||
$tmpfname = tempnam('/tmp','export');
|
||||
$file = fopen($tmpfname, "w+");
|
||||
if (! $charset = $definition->options['charset']) {
|
||||
$charset = $GLOBALS['egw']->translation->charset();
|
||||
}
|
||||
$plugin_object = new $_content['plugin'];
|
||||
$plugin_object->export($file, $charset, $definition);
|
||||
|
||||
if($_content['export'] == 'pressed') {
|
||||
fclose($file);
|
||||
$response->addScript("xajax_eT_wrapper();");
|
||||
$response->addScript("opener.location.href='". $GLOBALS['egw']->link('/index.php','menuaction=importexport.uiexport.download&_filename='. $tmpfname.'&_appname='. $definition->application). "&_suffix=". $plugin_object->get_filesuffix(). "';");
|
||||
$response->addScript('window.setTimeout("window.close();", 100);');
|
||||
return $response->getXML();
|
||||
}
|
||||
elseif($_content['preview'] == 'pressed') {
|
||||
fseek($file, 0);
|
||||
$item_count = 1;
|
||||
$preview = '';
|
||||
$search = array('[\016]','[\017]',
|
||||
'[\020]','[\021]','[\022]','[\023]','[\024]','[\025]','[\026]','[\027]',
|
||||
'[\030]','[\031]','[\032]','[\033]','[\034]','[\035]','[\036]','[\037]');
|
||||
$replace = $preview = '';
|
||||
|
||||
while(!feof($file) && $item_count < 10) {
|
||||
$preview .= preg_replace($search,$replace,fgets($file,1024));
|
||||
$item_count++;
|
||||
}
|
||||
|
||||
fclose($file);
|
||||
unlink($tmpfname);
|
||||
$response->addAssign('exec[preview-box]','innerHTML',$preview);
|
||||
$response->addAssign('divPoweredBy','style.display','none');
|
||||
$response->addAssign('exec[preview-box]','style.display','inline');
|
||||
$response->addAssign('exec[preview-box-buttons]','style.display','inline');
|
||||
|
||||
$response->addScript("xajax_eT_wrapper();");
|
||||
return $response->getXML();
|
||||
}
|
||||
//nothing else expected!
|
||||
throw new Exception('Error: unexpected submit in export_dialog!');
|
||||
}
|
||||
return $et->exec(self::_appname. '.uiexport.export_dialog',$content,$sel_options,$readonlys,$preserv,2);
|
||||
}
|
||||
|
||||
public function ajax_get_plugins($_appname) {
|
||||
$response = new xajaxResponse();
|
||||
if (!$_appname) {
|
||||
$response->addScript("set_style_by_class('tr','select_plugin','display','none');");
|
||||
return $response->getXML();
|
||||
}
|
||||
|
||||
(array)$plugins = import_export_helper_functions::get_plugins($_appname,'export');
|
||||
$sel_options['plugin'] = '';
|
||||
foreach ($plugins[$_appname]['export'] as $plugin => $plugin_name) {
|
||||
if (!$selected_plugin) $selected_plugin = $plugin;
|
||||
$sel_options['plugin'] .= '<option value="'. $plugin. '" >'. $plugin_name. '</option>';
|
||||
}
|
||||
|
||||
$this->ajax_get_plugin_description($selected_plugin,$response);
|
||||
$response->addAssign('exec[plugin]','innerHTML',$sel_options['plugin']);
|
||||
$response->addScript("set_style_by_class('tr','select_plugin','display','table-row');");
|
||||
return $response->getXML();
|
||||
}
|
||||
|
||||
public function ajax_get_plugin_description($_plugin,$_response=false) {
|
||||
$response = $_response ? $_response : new xajaxResponse();
|
||||
if (!$_plugin) return $response->getXML();
|
||||
|
||||
$plugin_object = new $_plugin;
|
||||
if (is_a($plugin_object, 'iface_export_plugin')) {
|
||||
$description = $plugin_object->get_description();
|
||||
$_response->addAssign('plugin_description','style.width','300px');
|
||||
$_response->addAssign('plugin_description','innerHTML',$description);
|
||||
}
|
||||
unset ($plugin_object);
|
||||
|
||||
return $_response ? '' : $response->getXML();
|
||||
}
|
||||
|
||||
public function ajax_get_plugin_options($_plugin,$_response=false) {
|
||||
$response = $_response ? $_response : new xajaxResponse();
|
||||
if (!$_plugin) return $response->getXML();
|
||||
|
||||
$plugin_object = new $_plugin;
|
||||
if (is_a($plugin_object, 'iface_export_plugin')) {
|
||||
$options = $plugin_object->get_options_etpl();
|
||||
}
|
||||
unset ($plugin_object);
|
||||
|
||||
return $_response ? '' : $response->getXML();
|
||||
}
|
||||
|
||||
/**
|
||||
* downloads file to client and deletes it.
|
||||
*
|
||||
* @param sting $_tmpfname
|
||||
* @todo we need a suffix atibute in plugins e.g. .csv
|
||||
*/
|
||||
public function download($_tmpfname = '') {
|
||||
$tmpfname = $_tmpfname ? $_tmpfname : $_GET['_filename'];
|
||||
if (!is_readable($tmpfname)) die();
|
||||
|
||||
$appname = $_GET['_appname'];
|
||||
$nicefname = 'egw_export_'.$appname.'-'.date('y-m-d');
|
||||
|
||||
header('Content-type: application/text');
|
||||
header('Content-Disposition: attachment; filename="'.$nicefname.'.'.$_GET['_suffix'].'"');
|
||||
$file = fopen($tmpfname,'r');
|
||||
while(!feof($file))
|
||||
echo fgets($file,1024);
|
||||
fclose($file);
|
||||
|
||||
unlink($tmpfname);
|
||||
}
|
||||
|
||||
public function ajax_get_plugin_selectors() {
|
||||
|
||||
}
|
||||
|
||||
public function ajax_get_template($_name) {
|
||||
|
||||
}
|
||||
} // end class uiexport
|
53
importexport/setup/default_records.inc.php
Normal file
53
importexport/setup/default_records.inc.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - importexport
|
||||
*
|
||||
* @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>
|
||||
* @version $Id: $
|
||||
*/
|
||||
|
||||
$definition_table = 'egw_importexport_definitions';
|
||||
|
||||
// Add two rooms to give user an idea of what resources is...
|
||||
$plugin_options = serialize(array(
|
||||
'fieldsep' => ',',
|
||||
'charset' => 'ISO-8859-1',
|
||||
'addressbook' => 'n',
|
||||
'owner' => 5,
|
||||
'field_mapping' => array(
|
||||
0 => '#kundennummer',
|
||||
1 => 'n_given',
|
||||
2 => 'n_family',
|
||||
3 => 'adr_one_street',
|
||||
4 => 'adr_one_countryname',
|
||||
5 => 'adr_one_postalcode',
|
||||
6 => 'adr_one_locality',
|
||||
7 => 'tel_work',
|
||||
8 => '',
|
||||
9 => '',
|
||||
10 => '',
|
||||
11 => '',
|
||||
),
|
||||
'field_tanslation' => array(),
|
||||
'has_header_line' => false,
|
||||
'max' => false,
|
||||
'conditions' => array(
|
||||
0 => array(
|
||||
'type' => 0, // exists
|
||||
'string' => '#kundennummer',
|
||||
'true' => array(
|
||||
'action' => 1, // update
|
||||
'last' => true,
|
||||
),
|
||||
'false' => array(
|
||||
'action' => 2, // insert
|
||||
'last' => true,
|
||||
),
|
||||
|
||||
)),
|
||||
));
|
||||
$oProc->query("INSERT INTO {$definition_table } (name,application,plugin,type,allowed_users,plugin_options) VALUES ( 'oelheld','addressbook','addressbook_csv_import','import','5','$plugin_options')");
|
||||
|
67
importexport/setup/etemplates.inc.php
Normal file
67
importexport/setup/etemplates.inc.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - eTemplates for Application importexport
|
||||
* http://www.egroupware.org
|
||||
* generated by soetemplate::dump4setup() 2006-11-10 16:25
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package importexport
|
||||
* @subpackage setup
|
||||
* @version $Id: class.soetemplate.inc.php 22413 2006-09-12 07:32:34Z ralfbecker $
|
||||
*/
|
||||
|
||||
$templ_version=1;
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.definition_index','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:1:{s:2:"h1";s:6:",!@msg";}i:1;a:1:{s:1:"A";a:4:{s:4:"span";s:13:"all,redItalic";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";s:4:"type";s:5:"label";}}i:2;a:1:{s:1:"A";a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:2:{s:2:"c1";s:2:"th";s:2:"c2";s:7:"row,top";}i:1;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:4:"Type";s:4:"span";s:11:",lr_padding";}s:1:"B";a:3:{s:4:"type";s:5:"label";s:5:"label";s:4:"Name";s:4:"span";s:11:",lr_padding";}s:1:"C";a:3:{s:4:"type";s:5:"label";s:5:"label";s:11:"Application";s:4:"span";s:11:",lr_padding";}s:1:"D";a:4:{s:5:"align";s:6:"center";s:4:"type";s:5:"label";s:5:"label";s:13:"Allowed users";s:4:"span";s:11:",lr_padding";}s:1:"E";a:5:{s:5:"label";s:3:"Add";s:5:"align";s:6:"center";s:4:"type";s:6:"button";s:4:"span";s:11:",lr_padding";s:7:"onclick";s:213:"window.open(egw::link(\'/index.php\',\'menuaction=importexport.uidefinitions.wizzard\'),\'\',\'dependent=yes,width=400,height=400,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes\'); return false; return false;";}s:1:"F";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:6:{s:5:"label";s:6:"Delete";s:4:"name";s:15:"delete_selected";s:4:"type";s:6:"button";s:4:"help";s:31:"delete ALL selected definitions";s:4:"size";s:6:"delete";s:7:"onclick";s:65:"return confirm(\'Do you really want to DELETE this definitions?\');";}i:2;a:5:{s:5:"label";s:6:"Export";s:4:"name";s:15:"export_selected";s:4:"type";s:6:"button";s:4:"help";s:31:"export ALL selected definitions";s:4:"size";s:10:"fileexport";}}}i:2;a:6:{s:1:"A";a:4:{s:7:"no_lang";s:1:"1";s:4:"type";s:5:"image";s:4:"span";s:11:",lr_padding";s:4:"name";s:12:"${row}[type]";}s:1:"B";a:4:{s:7:"no_lang";s:1:"1";s:4:"name";s:12:"${row}[name]";s:4:"type";s:5:"label";s:4:"span";s:11:",lr_padding";}s:1:"C";a:4:{s:7:"no_lang";s:1:"1";s:4:"name";s:19:"${row}[application]";s:4:"type";s:5:"label";s:4:"span";s:11:",lr_padding";}s:1:"D";a:6:{s:7:"no_lang";s:1:"1";s:4:"type";s:14:"select-account";s:4:"span";s:11:",lr_padding";s:8:"readonly";s:1:"1";s:4:"name";s:21:"${row}[allowed_users]";s:4:"size";s:1:"5";}s:1:"E";a:5:{s:5:"align";s:6:"center";s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:4:{s:5:"label";s:4:"Edit";s:4:"type";s:6:"button";s:4:"size";s:4:"edit";s:7:"onclick";s:237:"window.open(egw::link(\'/index.php\',\'menuaction=importexport.uidefinitions.edit&definition=$row_cont[name]\'),\'\',\'dependent=yes,width=400,height=400,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes\'); return false; return false;";}i:2;a:6:{s:5:"label";s:6:"Delete";s:7:"onclick";s:41:"return confirm(\'Delete this definition\');";s:4:"name";s:32:"delete[$row_cont[definition_id]]";s:4:"type";s:6:"button";s:4:"size";s:6:"delete";s:4:"help";s:21:"Delete this eTemplate";}}s:1:"F";a:4:{s:5:"align";s:6:"center";s:4:"name";s:34:"selected[$row_cont[definition_id]]";s:4:"type";s:8:"checkbox";s:4:"help";s:34:"select this eTemplate to delete it";}}}s:4:"cols";i:6;s:4:"rows";i:2;}}}s:4:"cols";i:1;s:4:"rows";i:2;s:4:"size";s:4:"100%";}}','size' => '100%','style' => '.redItalic { color:red; font-style:italic;} td.lr_padding { padding-left: 5px; padding-right: 5px; }','modified' => '1145972373',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.export_dialog','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:7:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";}}i:2;a:1:{s:1:"A";a:3:{s:4:"type";s:3:"tab";s:5:"label";s:35:"General|Selection|Options|Templates";s:4:"name";s:51:"general_tab|selection_tab|options_tab|templates_tab";}}i:3;a:1:{s:1:"A";a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:16:"Save as template";s:4:"name";s:16:"save_as_template";}}i:4;a:1:{s:1:"A";a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:3:"all";i:1;a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Export";s:4:"name";s:6:"export";s:7:"onclick";s:36:"xajax_eT_wrapper(this);return false;";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:7:"Preview";s:4:"name";s:7:"preview";s:7:"onclick";s:36:"xajax_eT_wrapper(this);return false;";}}i:2;a:5:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:5:"align";s:5:"right";s:4:"name";s:6:"cancel";s:7:"onclick";s:29:"window.close(); return false;";}}}i:5;a:1:{s:1:"A";a:6:{s:4:"type";s:3:"box";s:4:"size";s:1:"1";s:4:"name";s:11:"preview-box";s:6:"needed";s:1:"1";i:1;a:1:{s:4:"type";s:5:"label";}s:4:"span";s:12:",preview-box";}}i:6;a:1:{s:1:"A";a:7:{s:4:"type";s:3:"box";s:4:"size";s:1:"1";s:4:"span";s:20:",preview-box-buttons";s:4:"name";s:19:"preview-box-buttons";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:2:"OK";s:5:"align";s:6:"center";s:7:"onclick";s:230:"document.getElementById(\'divPoweredBy\').style.display=\'block\'; document.getElementById(form::name(\'preview-box\')).style.display=\'none\'; document.getElementById(form::name(\'preview-box-buttons\')).style.display=\'none\'; return false;";}s:6:"needed";s:1:"1";s:5:"align";s:6:"center";}}}s:4:"rows";i:6;s:4:"cols";i:1;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '.preview-box {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 400px;
|
||||
height: 360px;
|
||||
overflow: scroll;
|
||||
background-color: white;
|
||||
z-index: 999;
|
||||
display: none;
|
||||
}
|
||||
.preview-box-buttons {
|
||||
position: absolute;
|
||||
top: 365px;
|
||||
left: 0px;
|
||||
width: 400px;
|
||||
height: 20px;
|
||||
|
||||
z-index: 999;
|
||||
display: none;
|
||||
}','modified' => '1158220473',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.export_dialog.general_tab','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:1:{s:2:"c1";s:4:",top";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"image";s:4:"name";s:6:"export";}s:1:"B";a:2:{s:4:"type";s:8:"template";s:4:"name";s:46:"importexport.export_dialog.general_tab_content";}}}s:4:"rows";i:1;s:4:"cols";i:2;s:4:"size";s:6:",200px";s:7:"options";a:1:{i:1;s:5:"200px";}}}','size' => ',200px','style' => '','modified' => '1158223670',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.export_dialog.general_tab_content','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:5:{i:0;a:2:{s:2:"c2";s:14:"select_appname";s:2:"c3";s:13:"select_plugin";}i:1;a:2:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"span";s:3:"all";s:5:"label";s:14:"some nice text";}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:18:"Select application";}s:1:"B";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:7:"appname";s:8:"onchange";s:69:"xajax_doXMLHTTP(\'importexport.uiexport.ajax_get_plugins\',this.value);";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:13:"Select format";}s:1:"B";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:6:"plugin";s:8:"onchange";s:76:"xajax_doXMLHTTP(\'importexport.uiexport.ajax_get_plugin_options\',this.value);";}}i:4;a:2:{s:1:"A";a:6:{s:4:"type";s:3:"box";s:4:"span";s:3:"all";s:4:"name";s:18:"plugin_description";s:6:"needed";s:1:"1";s:4:"size";s:1:"1";i:1;a:7:{s:4:"type";s:5:"label";s:4:"span";s:3:"all";s:6:"needed";s:1:"1";i:1;a:4:{s:4:"type";s:5:"label";s:4:"span";s:3:"all";s:6:"needed";s:1:"1";s:5:"label";s:11:"Description";}i:2;a:2:{s:4:"type";s:5:"label";s:4:"name";s:18:"plugin_description";}s:4:"name";s:18:"plugin_description";s:7:"no_lang";s:1:"1";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:4;s:4:"cols";i:2;}}','size' => '','style' => '','modified' => '1158223021',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.export_dialog.options_tab','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:1:{s:2:"c1";s:4:",top";}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:4:"html";s:4:"name";s:19:"plugin_options_html";s:7:"no_lang";s:1:"1";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:6:",200px";s:7:"options";a:1:{i:1;s:5:"200px";}}}','size' => ',200px','style' => '','modified' => '1158223824',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.export_dialog.selection_tab','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:1:{s:2:"c1";s:4:",top";}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:4:"html";s:4:"name";s:21:"plugin_selectors_html";s:7:"no_lang";s:1:"1";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:6:",200px";s:7:"options";a:1:{i:1;s:5:"200px";}}}','size' => ',200px','style' => '','modified' => '1158223796',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.export_dialog.templates_tab','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:17:"Select a template";}}i:2;a:1:{s:1:"A";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:9:"templates";s:4:"size";s:1:"5";}}i:3;a:1:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:11:"Description";}}i:4;a:1:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"name";s:11:"description";}}i:5;a:1:{s:1:"A";a:3:{s:4:"type";s:6:"button";s:5:"label";s:4:"Load";s:4:"name";s:4:"load";}}}s:4:"rows";i:5;s:4:"cols";i:1;s:4:"size";s:6:",200px";s:7:"options";a:1:{i:1;s:5:"200px";}}}','size' => ',200px','style' => '','modified' => '1158223945',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.import_definition','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:4:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:92:"Import definitions (Attension: Existing definitions with equal names will be overwritten!!!)";}}i:2;a:1:{s:1:"A";a:2:{s:4:"type";s:4:"file";s:4:"name";s:11:"import_file";}}i:3;a:1:{s:1:"A";a:3:{s:4:"type";s:6:"button";s:5:"label";s:6:"Import";s:4:"name";s:6:"import";}}}s:4:"rows";i:3;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1150533844',);
|
||||
|
||||
$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;
|
||||
max-height:347px;
|
||||
overflow:auto;
|
||||
}','modified' => '1145975378',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.wizzard_chooseallowedusers','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:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";}}i:2;a:1:{s:1:"A";a:3:{s:4:"type";s:14:"select-account";s:4:"name";s:13:"allowed_users";s:4:"size";s:8:"5,groups";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1146312041',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.wizzard_chooseapp','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:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";}}i:2;a:1:{s:1:"A";a:3:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:11:"application";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1145976439',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.wizzard_choosename','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:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";}}i:2;a:1:{s:1:"A";a:2:{s:4:"type";s:4:"text";s:4:"name";s:4:"name";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1146317310',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.wizzard_chooseplugin','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:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";}}i:2;a:1:{s:1:"A";a:3:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:6:"plugin";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1145976573',);
|
||||
|
||||
$templ_data[] = array('name' => 'importexport.wizzard_close','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:2:{i:0;a:0:{}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;}}','size' => '','style' => '','modified' => '1146648383',);
|
||||
|
7
importexport/setup/phpgw_de.lang
Normal file
7
importexport/setup/phpgw_de.lang
Normal file
@ -0,0 +1,7 @@
|
||||
choose a name for this definition importexport de Wählen sie einen Namen für diese Definition.
|
||||
choose a plugin importexport de Wählen sie ein Plugin.
|
||||
choose an application importexport de Wählen sei eine Anwendung.
|
||||
finish importexport de Fertig
|
||||
next importexport de Weiter
|
||||
previous importexport de Zurück
|
||||
which useres are allowed for this definition importexport de Welche Benutzer dürden diese Definition verwenden?
|
8
importexport/setup/phpgw_en.lang
Normal file
8
importexport/setup/phpgw_en.lang
Normal file
@ -0,0 +1,8 @@
|
||||
allowed users importexport en Allowed users
|
||||
choose a name for this definition importexport en Choose a name for this definition
|
||||
choose a plugin importexport en Choose a plugin
|
||||
choose an application importexport en Choose an application
|
||||
finish importexport en finish
|
||||
next importexport en next
|
||||
previous importexport en previous
|
||||
which useres are allowed for this definition importexport en Which useres are allowed for this definition
|
46
importexport/setup/setup.inc.php
Normal file
46
importexport/setup/setup.inc.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* importexport
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package importexport
|
||||
* @author Cornelius Weiss <nelius@cwtech.de>
|
||||
* @version $Id: $
|
||||
*/
|
||||
|
||||
$setup_info['importexport']['name'] = 'importexport';
|
||||
$setup_info['importexport']['version'] = '0.002';
|
||||
$setup_info['importexport']['app_order'] = 2;
|
||||
$setup_info['importexport']['enable'] = 2;
|
||||
$setup_info['importexport']['tables'] = array('egw_importexport_definitions');
|
||||
|
||||
$setup_info['importexport']['author'] =
|
||||
$setup_info['importexport']['maintainer'] = array(
|
||||
'name' => 'Cornelius Weiss',
|
||||
'email' => 'nelius@cwtech.de'
|
||||
);
|
||||
$setup_info['importexport']['license'] = 'GPL';
|
||||
$setup_info['importexport']['description'] =
|
||||
'';
|
||||
$setup_info['importexport']['note'] =
|
||||
'';
|
||||
|
||||
/* The hooks this app includes, needed for hooks registration */
|
||||
//$setup_info['importexport']['hooks']['preferences'] = 'importexport'.'.admin_prefs_sidebox_hooks.all_hooks';
|
||||
//$setup_info['importexport']['hooks']['settings'] = 'importexport'.'.admin_prefs_sidebox_hooks.settings';
|
||||
$setup_info['importexport']['hooks']['admin'] = 'importexport'.'.importexport_admin_prefs_sidebox_hooks.all_hooks';
|
||||
$setup_info['importexport']['hooks']['sidebox_menu'] = 'importexport'.'.importexport_admin_prefs_sidebox_hooks.all_hooks';
|
||||
//$setup_info['importexport']['hooks']['search_link'] = 'importexport'.'.bomyterra.search_link';
|
||||
|
||||
/* Dependencies for this app to work */
|
||||
$setup_info['importexport']['depends'][] = array(
|
||||
'appname' => 'phpgwapi',
|
||||
'versions' => Array('1.2','1.3')
|
||||
);
|
||||
$setup_info['importexport']['depends'][] = array(
|
||||
'appname' => 'etemplate',
|
||||
'versions' => Array('1.2','1.3')
|
||||
);
|
||||
|
||||
|
||||
|
33
importexport/setup/tables_current.inc.php
Normal file
33
importexport/setup/tables_current.inc.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - Setup *
|
||||
* http://www.eGroupWare.org *
|
||||
* Created by eTemplates DB-Tools written by ralfbecker@outdoor-training.de *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id: class.db_tools.inc.php,v 1.33 2005/12/19 04:27:19 ralfbecker Exp $ */
|
||||
|
||||
|
||||
$phpgw_baseline = array(
|
||||
'egw_importexport_definitions' => array(
|
||||
'fd' => array(
|
||||
'definition_id' => array('type' => 'auto'),
|
||||
'name' => array('type' => 'varchar','precision' => '255'),
|
||||
'application' => array('type' => 'varchar','precision' => '50'),
|
||||
'plugin' => array('type' => 'varchar','precision' => '100'),
|
||||
'type' => array('type' => 'varchar','precision' => '20'),
|
||||
'allowed_users' => array('type' => 'varchar','precision' => '255'),
|
||||
'plugin_options' => array('type' => 'longtext'),
|
||||
'owner' => array('type' => 'int','precision' => '20')
|
||||
),
|
||||
'pk' => array('definition_id'),
|
||||
'fk' => array(),
|
||||
'ix' => array('name'),
|
||||
'uc' => array('name')
|
||||
)
|
||||
);
|
120
importexport/templates/default/export_dialog.old.xet
Normal file
120
importexport/templates/default/export_dialog.old.xet
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="importexport.export_dialog.general_tab_content" template="" lang="" group="0" version="">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<description span="all" value="some nice text"/>
|
||||
</row>
|
||||
<row class="select_appname" disabled="@appname">
|
||||
<description value="Select application"/>
|
||||
<menulist>
|
||||
<menupopup no_lang="1" id="appname"/>
|
||||
</menulist>
|
||||
</row>
|
||||
<row class="select_plugin">
|
||||
<description value="Select format"/>
|
||||
<menulist>
|
||||
<menupopup no_lang="1" id="plugin"/>
|
||||
</menulist>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="importexport.export_dialog.general_tab" template="" lang="" group="0" version="">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row valign="top">
|
||||
<hbox>
|
||||
<image options="export_dialog"/>
|
||||
<template id="importexport.export_dialog.general_tab_content"/>
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="importexport.export_dialog.selection_tab" template="" lang="" group="0" version="">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<description/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="importexport.export_dialog.options_tab" template="" lang="" group="0" version="">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<description/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="importexport.export_dialog.templates_tab" template="" lang="" group="0" version="">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<description/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="importexport.export_dialog" template="" lang="" group="0" version="">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<description id="msg"/>
|
||||
</row>
|
||||
<row>
|
||||
<tabbox>
|
||||
<tabs>
|
||||
<tab label="General" statustext=""/>
|
||||
<tab label="Selection" statustext=""/>
|
||||
<tab label="Options" statustext=""/>
|
||||
<tab label="Templates" statustext=""/>
|
||||
</tabs>
|
||||
<tabpanels>
|
||||
<template id="importexport.export_dialog.general_tab"/>
|
||||
<template id="importexport.export_dialog.selection_tab"/>
|
||||
<template id="importexport.export_dialog.options_tab"/>
|
||||
<template id="importexport.export_dialog.templates_tab"/>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
</row>
|
||||
<row>
|
||||
<checkbox label="Save as template" id="save_as_template"/>
|
||||
</row>
|
||||
<row>
|
||||
<hbox span="all">
|
||||
<hbox>
|
||||
<button label="Export" id="export"/>
|
||||
<button label="Preview" id="preview"/>
|
||||
</hbox>
|
||||
<button label="Cancel" align="right" id="cancel"/>
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
</overlay>
|
169
importexport/templates/default/export_dialog.xet
Normal file
169
importexport/templates/default/export_dialog.xet
Normal file
@ -0,0 +1,169 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="importexport.export_dialog.general_tab_content" template="" lang="" group="0" version="">
|
||||
<grid height="200px">
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<description span="all" value="some nice text"/>
|
||||
</row>
|
||||
<row class="select_appname">
|
||||
<description value="Select application"/>
|
||||
<menulist>
|
||||
<menupopup no_lang="1" id="appname" onchange="xajax_doXMLHTTP('importexport.uiexport.ajax_get_plugins',this.value);"/>
|
||||
</menulist>
|
||||
</row>
|
||||
<row class="select_plugin">
|
||||
<description value="Select format"/>
|
||||
<menulist>
|
||||
<menupopup no_lang="1" id="plugin" onchange="xajax_doXMLHTTP('importexport.uiexport.ajax_get_plugin_options',this.value);"/>
|
||||
</menulist>
|
||||
</row>
|
||||
<row>
|
||||
<box span="all" id="plugin_description" needed="1">
|
||||
<description span="all" needed="1" id="plugin_description" no_lang="1"/>
|
||||
</box>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="importexport.export_dialog.general_tab" template="" lang="" group="0" version="">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row valign="top">
|
||||
<image src="export"/>
|
||||
<template id="importexport.export_dialog.general_tab_content"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="importexport.export_dialog.selection_tab" template="" lang="" group="0" version="">
|
||||
<grid height="200px">
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row valign="top">
|
||||
<html id="plugin_selectors_html" no_lang="1"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="importexport.export_dialog.options_tab" template="" lang="" group="0" version="">
|
||||
<grid height="200px">
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row valign="top">
|
||||
<html id="plugin_options_html" no_lang="1"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="importexport.export_dialog.templates_tab" template="" lang="" group="0" version="">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<description value="Select a template"/>
|
||||
</row>
|
||||
<row>
|
||||
<listbox no_lang="1" id="templates" rows="5"/>
|
||||
</row>
|
||||
<row>
|
||||
<description value="Description"/>
|
||||
</row>
|
||||
<row>
|
||||
<description id="description"/>
|
||||
</row>
|
||||
<row>
|
||||
<button label="Load" id="load"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="importexport.export_dialog" template="" lang="" group="0" version="">
|
||||
<grid width="100%">
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<description id="msg"/>
|
||||
</row>
|
||||
<row>
|
||||
<tabbox>
|
||||
<tabs>
|
||||
<tab label="General" statustext=""/>
|
||||
<tab label="Selection" statustext=""/>
|
||||
<tab label="Options" statustext=""/>
|
||||
<tab label="Templates" statustext=""/>
|
||||
</tabs>
|
||||
<tabpanels>
|
||||
<template id="importexport.export_dialog.general_tab"/>
|
||||
<template id="importexport.export_dialog.selection_tab"/>
|
||||
<template id="importexport.export_dialog.options_tab"/>
|
||||
<template id="importexport.export_dialog.templates_tab"/>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
</row>
|
||||
<row>
|
||||
<checkbox label="Save as template" id="save_as_template"/>
|
||||
</row>
|
||||
<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;"/>
|
||||
</hbox>
|
||||
<button label="Cancel" align="right" id="cancel" onclick="window.close(); return false;"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row>
|
||||
<box id="preview-box" needed="1" class="preview-box">
|
||||
<description/>
|
||||
</box>
|
||||
</row>
|
||||
<row>
|
||||
<box class="preview-box-buttons" id="preview-box-buttons" needed="1" align="center">
|
||||
<button label="OK" align="center" onclick="document.getElementById('divPoweredBy').style.display='block'; document.getElementById(form::name('preview-box')).style.display='none'; document.getElementById(form::name('preview-box-buttons')).style.display='none'; return false;"/>
|
||||
</box>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<styles>
|
||||
.preview-box {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
width: 400px;
|
||||
height: 360px;
|
||||
overflow: scroll;
|
||||
background-color: white;
|
||||
z-index: 999;
|
||||
display: none;
|
||||
}
|
||||
.preview-box-buttons {
|
||||
position: absolute;
|
||||
top: 365px;
|
||||
left: 0px;
|
||||
width: 400px;
|
||||
height: 20px;
|
||||
|
||||
z-index: 999;
|
||||
display: none;
|
||||
}
|
||||
</styles>
|
||||
</template>
|
||||
</overlay>
|
BIN
importexport/templates/default/images/export.png
Executable file
BIN
importexport/templates/default/images/export.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
importexport/templates/default/images/fileexport.png
Normal file
BIN
importexport/templates/default/images/fileexport.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 626 B |
BIN
importexport/templates/default/images/fileimport.png
Normal file
BIN
importexport/templates/default/images/fileimport.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 851 B |
BIN
importexport/templates/default/images/import.png
Executable file
BIN
importexport/templates/default/images/import.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
importexport/templates/default/images/importexport.jpg
Normal file
BIN
importexport/templates/default/images/importexport.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
importexport/templates/default/images/importexport.xcf
Executable file
BIN
importexport/templates/default/images/importexport.xcf
Executable file
Binary file not shown.
BIN
importexport/templates/default/images/navbar.png
Normal file
BIN
importexport/templates/default/images/navbar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Loading…
Reference in New Issue
Block a user