forked from extern/egroupware
bringing importexport to egw 1.4
This commit is contained in:
commit
99cbb28d32
@ -1,25 +1,47 @@
|
||||
=importexport=
|
||||
= 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.
|
||||
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 and its specific definitions.
|
||||
|
||||
== plugins ==
|
||||
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>
|
||||
class.import_<name> or
|
||||
class.export_<name>
|
||||
in
|
||||
EGW_INCLUDE_ROOT/YourApp/inc/
|
||||
EGW_INCLUDE_ROOT/YourApp/importexport/
|
||||
|
||||
These pulugins only need to implement the corresponding interface
|
||||
EGW_INCLUDE_ROOT/importexport/inc/class.iface_import_plugin.inc.php or
|
||||
EGW_INCLUDE_ROOT/importexport/inc/class.iface_export_plugin.inc.php
|
||||
|
||||
Thats all, pretty easy, isn't it?
|
||||
|
||||
== 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'''.
|
||||
|
||||
An important point is, that the ACLs for import/export actions are given by the definitions.
|
||||
That means, that your plugin can not work w.o. a definition. However, your plugin don't
|
||||
need to parse that definition. This is up to you.
|
||||
|
||||
Definitions can be created in admin->importexport->define{im|ex}ports. They are stored
|
||||
in the databasae but could be {im|ex}ported itselve.
|
||||
|
||||
Definitions (as xml files) residing in the folder <yourapp/importexport/definitions>
|
||||
will be imported at apps installation time automatically.
|
||||
|
||||
|
||||
== import ==
|
||||
|
||||
== 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}>"
|
@ -19,8 +19,7 @@
|
||||
--password <password for user>
|
||||
--domain <domain name> \n";
|
||||
|
||||
if (php_sapi_name() != 'cli')
|
||||
{
|
||||
if (php_sapi_name() != 'cli') {
|
||||
die('This script only runs form command line');
|
||||
}
|
||||
|
||||
@ -67,10 +66,8 @@
|
||||
}
|
||||
|
||||
$domain = 'default';
|
||||
foreach ($options[0] as $option)
|
||||
{
|
||||
switch ($option[0])
|
||||
{
|
||||
foreach ($options[0] as $option) {
|
||||
switch ($option[0]) {
|
||||
case '--file' :
|
||||
$file = $option[1];
|
||||
break;
|
||||
@ -92,8 +89,7 @@
|
||||
}
|
||||
}
|
||||
// check file
|
||||
if (!$user || !$password)
|
||||
{
|
||||
if ( !$user || !$password ) {
|
||||
fwrite(STDERR,'importexport_cli: You have to supply a username / password'."\n".$usage);
|
||||
exit(INVALID_OPTION);
|
||||
}
|
||||
@ -134,7 +130,7 @@
|
||||
exit(INVALID_OPTION);
|
||||
}
|
||||
|
||||
require_once('./inc/class.definition.inc.php');
|
||||
require_once('inc/class.definition.inc.php');
|
||||
try {
|
||||
$definition = new definition($definition);
|
||||
}
|
||||
@ -143,10 +139,12 @@
|
||||
exit(INVALID_OPTION);
|
||||
}
|
||||
|
||||
require_once("$path_to_egroupware/$definition->application/inc/class.$definition->plugin.inc.php");
|
||||
require_once("$path_to_egroupware/$definition->application/importexport/class.$definition->plugin.inc.php");
|
||||
$po = new $definition->plugin;
|
||||
$type = $definition->type;
|
||||
$po->$type($definition,array('file' => $file));
|
||||
|
||||
$resource = fopen( $file, 'r' );
|
||||
$po->$type( $resource, $definition );
|
||||
|
||||
$GLOBALS['egw']->common->phpgw_exit();
|
||||
|
||||
|
111
importexport/inc/class.arrayxml.inc.php
Normal file
111
importexport/inc/class.arrayxml.inc.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?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 arrayxml
|
||||
* easy to use array2xml and xml2array functions. Presumably this is the n+1
|
||||
* class of this kind out there, but i wasn't able to find a wokring one...
|
||||
*
|
||||
* @abstract PHP allowes array keys to be numeric while XML prohibits this.
|
||||
* Therefore the XML structur of this class is a bit uncommon but nessesary!
|
||||
* @todo deal with other types like objects
|
||||
* @static only namespace here
|
||||
*/
|
||||
class arrayxml {
|
||||
|
||||
/**
|
||||
* converts a php array to an xml string
|
||||
*
|
||||
* @param mixed $_data
|
||||
* @param string $_name
|
||||
* @param DOMElement $_node
|
||||
* @return string XML string
|
||||
*/
|
||||
public static function array2xml ( $_data, $_name = 'root', $_node=null ) {
|
||||
$returnXML = false;
|
||||
if ( $_node === null ) {
|
||||
$_node = new DOMDocument( '1.0', 'utf-8' );
|
||||
$_node->formatOutput = true;
|
||||
$returnXML = true;
|
||||
}
|
||||
|
||||
$datatype = gettype( $_data );
|
||||
switch ( $datatype ) {
|
||||
case 'array' :
|
||||
$subnode = new DOMElement( 'entry' );
|
||||
$_node->appendChild( $subnode );
|
||||
$subnode->setAttribute( 'type', $datatype );
|
||||
$subnode->setAttribute( 'name' , $_name );
|
||||
|
||||
foreach ( $_data as $ikey => $ivalue ) {
|
||||
self::array2xml( $ivalue, $ikey, $subnode );
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
switch ( $datatype ) {
|
||||
case 'boolean' :
|
||||
$data = $_data !== false ? 'TRUE' : 'FALSE';
|
||||
break;
|
||||
default:
|
||||
$data = &$_data;
|
||||
}
|
||||
$subnode = new DOMElement( 'entry' , $data );
|
||||
$_node->appendChild( $subnode );
|
||||
$subnode->setAttribute( 'type', $datatype );
|
||||
$subnode->setAttribute( 'name' , $_name );
|
||||
break;
|
||||
}
|
||||
return $returnXML ? $_node->saveXML() : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* converts XML string into php array
|
||||
*
|
||||
* @param string $_xml
|
||||
* @return array
|
||||
*/
|
||||
public static function xml2array( $_xml ) {
|
||||
if ( $_xml instanceof DOMElement ) {
|
||||
$n = &$_xml;
|
||||
} else {
|
||||
$n = new DOMDocument;
|
||||
$n->loadXML($_xml);
|
||||
}
|
||||
$xml_array = array();
|
||||
|
||||
foreach($n->childNodes as $nc) {
|
||||
|
||||
if ( $nc->nodeType != XML_ELEMENT_NODE ) continue;
|
||||
|
||||
$name = $nc->attributes->getNamedItem('name')->nodeValue;
|
||||
$type = $nc->attributes->getNamedItem('type')->nodeValue;
|
||||
|
||||
//echo $nc->nodeType. "(length ): ". $nc->nodeName. " => ". $nc->nodeValue. "; Attriubtes: name=$name, type=$type \n ";
|
||||
if( $nc->childNodes->length >= 2) {
|
||||
$xml_array[$name] = self::xml2array($nc);
|
||||
} else {
|
||||
switch ( $type ) {
|
||||
case 'boolean' :
|
||||
$value = $nc->nodeValue == 'FALSE' ? false : true;
|
||||
break;
|
||||
default :
|
||||
$value = $nc->nodeValue;
|
||||
}
|
||||
$xml_array[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $xml_array;
|
||||
}
|
||||
}
|
||||
?>
|
@ -11,6 +11,8 @@
|
||||
*/
|
||||
|
||||
require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.definition.inc.php');
|
||||
require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.arrayxml.inc.php');
|
||||
require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.import_export_helper_functions.inc.php');
|
||||
require_once(EGW_INCLUDE_ROOT.'/etemplate/inc/class.so_sql.inc.php');
|
||||
|
||||
/** bo to define {im|ex}ports
|
||||
@ -23,11 +25,13 @@ class bodefinitions {
|
||||
const _defintion_talbe = 'egw_importexport_definitions';
|
||||
|
||||
/**
|
||||
* holds so_sql
|
||||
*
|
||||
* @var so_sql
|
||||
* @var so_sql holds so_sql
|
||||
*/
|
||||
private $so_sql;
|
||||
|
||||
/**
|
||||
* @var array hold definitions
|
||||
*/
|
||||
private $definitions;
|
||||
|
||||
public function __construct($_query=false)
|
||||
@ -41,6 +45,11 @@ class bodefinitions {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gets array of definition ids
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_definitions() {
|
||||
return $this->definitions;
|
||||
}
|
||||
@ -48,11 +57,11 @@ class bodefinitions {
|
||||
/**
|
||||
* reads a definition from database
|
||||
*
|
||||
* @deprecated see class.definition.inc.php
|
||||
* @param mixed &$definition
|
||||
* @return bool success or not
|
||||
*/
|
||||
public function read(&$definition)
|
||||
{
|
||||
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;
|
||||
@ -61,45 +70,14 @@ class bodefinitions {
|
||||
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)
|
||||
{
|
||||
/**
|
||||
* deletes a defintion
|
||||
*
|
||||
* @param array $keys
|
||||
*/
|
||||
public function delete($keys) {
|
||||
$this->so_sql->delete(array('definition_id' => $keys));
|
||||
// clear private cach
|
||||
// clear private cache
|
||||
foreach ($keys as $key) {
|
||||
unset($this->definitions[array_search($key,$this->definitions)]);
|
||||
}
|
||||
@ -126,36 +104,6 @@ class bodefinitions {
|
||||
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
|
||||
*
|
||||
@ -169,41 +117,65 @@ class bodefinitions {
|
||||
'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;
|
||||
$export_data['definitions'] = array();
|
||||
foreach ($keys as $definition_id) {
|
||||
$definition = new definition( $definition_id );
|
||||
$export_data['definitions'][$definition->name] = $definition->get_record_array();
|
||||
$export_data['definitions'][$definition->name]['allowed_users'] =
|
||||
import_export_helper_functions::account_id2name(
|
||||
$export_data['definitions'][$definition->name]['allowed_users']
|
||||
);
|
||||
$export_data['definitions'][$definition->name]['owner'] =
|
||||
import_export_helper_functions::account_id2name(
|
||||
$export_data['definitions'][$definition->name]['owner']
|
||||
);
|
||||
unset($export_data['definitions'][$definition->name]['definition_id']);
|
||||
unset($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);
|
||||
|
||||
$xml = new arrayxml();
|
||||
return $xml->array2xml($export_data, 'importExportDefinitions');
|
||||
}
|
||||
|
||||
public function import($import_file)
|
||||
/**
|
||||
* imports definitions from file
|
||||
*
|
||||
* @param string $import_file
|
||||
* @throws Exeption
|
||||
* @return void
|
||||
*/
|
||||
public static function import( $_import_file )
|
||||
{
|
||||
// read given file and check if its a valid definition
|
||||
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']);
|
||||
if ( !is_file( $_import_file ) ) {
|
||||
throw new Exception("'$_import_file' is not a valid file" );
|
||||
}
|
||||
|
||||
$data = arrayxml::xml2array( file_get_contents( $_import_file ) );
|
||||
|
||||
$metainfo = $data['importExportDefinitions']['metainfo'];
|
||||
$definitions = $data['importExportDefinitions']['definitions'];
|
||||
unset ( $data );
|
||||
|
||||
// convert charset into internal used charset
|
||||
$data = $GLOBALS['egw']->translation->convert($data,$metainfo['charset'],$GLOBALS['egw']->translation->charset());
|
||||
$definitions = $GLOBALS['egw']->translation->convert(
|
||||
$definitions,
|
||||
$metainfo['charset'],
|
||||
$GLOBALS['egw']->translation->charset()
|
||||
);
|
||||
|
||||
// save definition(s) into internal table
|
||||
foreach ($data as $name => $definition)
|
||||
foreach ( $definitions as $name => $definition_data )
|
||||
{
|
||||
$this->save($definition);
|
||||
// convert allowed_user
|
||||
$definition_data['allowed_users'] = import_export_helper_functions::account_name2id( $definition_data['allowed_users'] );
|
||||
$definition_data['owner'] = import_export_helper_functions::account_name2id( $definition_data['owner'] );
|
||||
|
||||
$definition = new definition( $definition_data['name'] );
|
||||
$definition_id = $definition->get_identifier() ? $definition->get_identifier() : NULL;
|
||||
|
||||
$definition->set_record( $definition_data );
|
||||
$definition->save( $definition_id );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,8 @@
|
||||
*/
|
||||
|
||||
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');
|
||||
require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.arrayxml.inc.php');
|
||||
require_once(EGW_INCLUDE_ROOT. '/etemplate/inc/class.so_sql.inc.php');
|
||||
|
||||
/**
|
||||
* class definition
|
||||
@ -33,36 +34,28 @@ class definition implements iface_egw_record {
|
||||
'plugin' => 'string',
|
||||
'type' => 'string',
|
||||
'allowed_users' => 'array',
|
||||
'options' => 'array',
|
||||
'plugin_options' => 'array',
|
||||
'owner' => 'int',
|
||||
'description' => 'string',
|
||||
);
|
||||
|
||||
/**
|
||||
* holds so_sql object
|
||||
*
|
||||
* @var so_sql
|
||||
* @var so_sql holds so_sql object
|
||||
*/
|
||||
private $so_sql;
|
||||
|
||||
/**
|
||||
* internal representation of definition
|
||||
*
|
||||
* @var unknown_type
|
||||
* @var array internal representation of definition
|
||||
*/
|
||||
private $definition = array();
|
||||
|
||||
/**
|
||||
* holds current user
|
||||
*
|
||||
* @var int
|
||||
* @var int holds current user
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* is current user an admin?
|
||||
*
|
||||
* @var bool
|
||||
* @var bool is current user an admin?
|
||||
*/
|
||||
private $is_admin;
|
||||
|
||||
@ -80,15 +73,15 @@ class definition implements iface_egw_record {
|
||||
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)) {
|
||||
$this->definition = $this->so_sql->read(array('definition_id' => $_identifier));
|
||||
if ( empty( $this->definition ) ) {
|
||||
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)) {
|
||||
if ( !( in_array( $this->user, $this->get_allowed_users() ) || $this->definition['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;
|
||||
$options_data = arrayxml::xml2array( $this->definition['plugin_options'] );
|
||||
$this->definition['plugin_options'] = $options_data['root'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +91,7 @@ class definition implements iface_egw_record {
|
||||
* @param string $_name
|
||||
* @return int
|
||||
*/
|
||||
private function name2identifier($_name) {
|
||||
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');
|
||||
@ -113,7 +106,7 @@ class definition implements iface_egw_record {
|
||||
switch ($_attribute_name) {
|
||||
case 'allowed_users' :
|
||||
return $this->get_allowed_users();
|
||||
case 'options' :
|
||||
case 'plugin_options' :
|
||||
return $this->get_options();
|
||||
default :
|
||||
return $this->definition[$_attribute_name];
|
||||
@ -127,7 +120,7 @@ class definition implements iface_egw_record {
|
||||
switch ($_attribute_name) {
|
||||
case 'allowed_users' :
|
||||
return $this->set_allowed_users($_data);
|
||||
case 'options' :
|
||||
case 'plugin_options' :
|
||||
return $this->set_options($_data);
|
||||
default :
|
||||
$this->definition[$_attribute_name] = $_data;
|
||||
@ -149,7 +142,7 @@ class definition implements iface_egw_record {
|
||||
*
|
||||
* @param array $_allowed_users
|
||||
*/
|
||||
private function set_allowed_users($_allowed_users) {
|
||||
private function set_allowed_users( $_allowed_users ) {
|
||||
$this->definition['allowed_users'] = implode(',',(array)$_allowed_users);
|
||||
}
|
||||
|
||||
@ -159,12 +152,7 @@ class definition implements iface_egw_record {
|
||||
* @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']);
|
||||
return $this->definition['plugin_options'];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -172,8 +160,8 @@ class definition implements iface_egw_record {
|
||||
*
|
||||
* @param array $options
|
||||
*/
|
||||
private function set_options(array $_options) {
|
||||
$this->definition['options'] = serialize($_options);
|
||||
private function set_options(array $_plugin_options) {
|
||||
$this->definition['plugin_options'] = $_plugin_options;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -187,7 +175,7 @@ class definition implements iface_egw_record {
|
||||
public function get_record_array() {
|
||||
$definition = $this->definition;
|
||||
$definition['allowed_users'] = $this->get_allowed_users();
|
||||
$definition['options'] = $this->get_options();
|
||||
$definition['plugin_options'] = $this->get_options();
|
||||
return $definition;
|
||||
}
|
||||
|
||||
@ -205,8 +193,20 @@ class definition implements iface_egw_record {
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function set_record(array $_record) {
|
||||
$this->definition = $_record;
|
||||
public function set_record( array $_record ) {
|
||||
$this->definition = array_intersect_key( $_record, $this->attributes );
|
||||
|
||||
// anything which is not an attribute is perhaps a plugin_option.
|
||||
// If not, it gets whiped out on save time.
|
||||
foreach ( $_record as $attribute => $value) {
|
||||
if ( !array_key_exists( $attribute, $this->attributes ) ) {
|
||||
$this->definition['plugin_options'][$attribute] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
// convert plugin_options into internal representation
|
||||
$this->set_allowed_users( $this->definition['allowed_users'] );
|
||||
$this->set_options( $this->definition['plugin_options'] );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -225,12 +225,16 @@ class definition implements iface_egw_record {
|
||||
* @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 ( strlen($this->definition['name']) < 3 ) {
|
||||
throw new Exception('Error: Can\'t save definition, no valid name given!');
|
||||
}
|
||||
if ($this->so_sql->save($_dst_identifier)) {
|
||||
throw('Error: so_sql was not able to save definition: '.$this->get_identifier());
|
||||
|
||||
$this->so_sql->data = $this->definition;
|
||||
$this->so_sql->data['plugin_options'] = arrayxml::array2xml( $this->definition['plugin_options'] );
|
||||
if ($this->so_sql->save( array( 'definition_id' => $_dst_identifier ))) {
|
||||
throw new Exception('Error: so_sql was not able to save definition: '.$this->get_identifier());
|
||||
}
|
||||
|
||||
return $this->definition['definition_id'];
|
||||
}
|
||||
|
||||
|
@ -24,57 +24,43 @@ require_once(EGW_INCLUDE_ROOT. '/phpgwapi/inc/class.translation.inc.php');
|
||||
*/
|
||||
class export_csv implements iface_export_record
|
||||
{
|
||||
|
||||
/** Aggregations: */
|
||||
|
||||
/** Compositions: */
|
||||
|
||||
/**
|
||||
* array with field mapping in form egw_field_name => exported_field_name
|
||||
* @var array
|
||||
* @var array array with field mapping in form egw_field_name => exported_field_name
|
||||
*/
|
||||
protected $mapping = array();
|
||||
|
||||
/**
|
||||
* array with conversions to be done in form: egw_field_name => conversion_string
|
||||
* @var array
|
||||
* @var array array with conversions to be done in form: egw_field_name => conversion_string
|
||||
*/
|
||||
protected $conversion = array();
|
||||
|
||||
/**
|
||||
* array holding the current record
|
||||
* @access protected
|
||||
* @var array holding the current record
|
||||
*/
|
||||
protected $record = array();
|
||||
|
||||
/**
|
||||
* holds (charset) translation object
|
||||
* @var object
|
||||
* @var translation holds (charset) translation object
|
||||
*/
|
||||
protected $translation;
|
||||
|
||||
/**
|
||||
* charset of csv file
|
||||
* @var string
|
||||
* @var string charset of csv file
|
||||
*/
|
||||
protected $csv_charset;
|
||||
|
||||
/**
|
||||
* holds number of exported records
|
||||
* @var unknown_type
|
||||
* @var int holds number of exported records
|
||||
*/
|
||||
protected $num_of_records = 0;
|
||||
|
||||
/**
|
||||
* stream resource of csv file
|
||||
* @var resource
|
||||
* @var stream stream resource of csv file
|
||||
*/
|
||||
protected $handle;
|
||||
|
||||
/**
|
||||
* csv specific options
|
||||
*
|
||||
* @var array
|
||||
* @var array csv specific options
|
||||
*/
|
||||
protected $csv_options = array(
|
||||
'delimiter' => ';',
|
||||
@ -84,21 +70,19 @@ class export_csv implements iface_export_record
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param object _handle resource where records are exported to.
|
||||
* @param string _charset charset the records are exported to.
|
||||
* @param stram $_stream resource where records are exported to.
|
||||
* @param array _options options for specific backends
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
public function __construct( $_handle, $_charset, array $_options=array() ) {
|
||||
public function __construct( $_stream, $_options ) {
|
||||
if (!is_object($GLOBALS['egw']->translation)) {
|
||||
$GLOBALS['egw']->translation = new translation();
|
||||
}
|
||||
$this->translation = &$GLOBALS['egw']->translation;
|
||||
$this->handle = $_handle;
|
||||
$this->csv_charset = $_charset;
|
||||
if (!empty($_options)) {
|
||||
$this->csv_options = array_merge($this->csv_options,$_options);
|
||||
$this->handle = $_stream;
|
||||
$this->csv_charset = $_options['charset'] ? $_options['charset'] : 'utf-8';
|
||||
if ( !empty( $_options ) ) {
|
||||
$this->csv_options = array_merge( $this->csv_options, $_options );
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,9 +95,7 @@ class export_csv implements iface_export_record
|
||||
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->translation->charset(), $this->csv_charset);
|
||||
}
|
||||
$this->mapping = $_mapping;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,45 +113,42 @@ class export_csv implements iface_export_record
|
||||
*
|
||||
* @param iface_egw_record record
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
public function export_record( iface_egw_record $_record ) {
|
||||
$record_data = $_record->get_record_array();
|
||||
$this->record = $_record->get_record_array();
|
||||
|
||||
if (empty($this->mapping)) {
|
||||
$this->mapping = array_combine(array_keys($record_data),array_keys($record_data));
|
||||
}
|
||||
|
||||
// just for debug...
|
||||
$this->mapping = $this->translation->convert($this->mapping, 'utf-8', 'iso-8859-1');//$this->translation->charset());
|
||||
|
||||
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']);
|
||||
// begin with fieldnames ?
|
||||
if ($this->num_of_records == 0 && $this->csv_options['begin_with_fieldnames'] ) {
|
||||
$mapping = ! empty( $this->mapping ) ? $this->mapping : array_keys ( $this->record );
|
||||
$mapping = $this->translation->convert( $mapping, $this->translation->charset(), $this->csv_charset );
|
||||
fputcsv( $this->handle ,$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);
|
||||
if ( !empty( $this->conversion )) {
|
||||
$this->record = import_export_helper_functions::conversion( $this->record, $this->conversion );
|
||||
}
|
||||
|
||||
// do fieldmapping
|
||||
if ( !empty( $this->mapping ) ) {
|
||||
$record_data = $this->record;
|
||||
$this->record = array();
|
||||
foreach ($this->mapping as $egw_field => $csv_field) {
|
||||
$this->record[$csv_field] = $record_data[$egw_field];
|
||||
}
|
||||
}
|
||||
|
||||
// do charset translation
|
||||
$record_data = $this->translation->convert($record_data, $this->translation->charset(), $this->csv_charset);
|
||||
$this->record = $this->translation->convert( $this->record, $this->translation->charset(), $this->csv_charset );
|
||||
|
||||
// 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->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;
|
||||
@ -179,7 +158,6 @@ class export_csv implements iface_export_record
|
||||
* destructor
|
||||
*
|
||||
* @return
|
||||
* @access public
|
||||
*/
|
||||
public function __destruct() {
|
||||
|
||||
|
@ -10,14 +10,12 @@
|
||||
* @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
|
||||
* EGW_INCLUDE_ROOT/appname/inc/importexport/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
|
||||
@ -41,9 +39,10 @@ interface iface_export_plugin {
|
||||
/**
|
||||
* exports entries according to given definition object.
|
||||
*
|
||||
* @param stream $_stream
|
||||
* @param definition $_definition
|
||||
*/
|
||||
public static function export($_stream, $_charset, definition $_definition);
|
||||
public function export($_stream, definition $_definition);
|
||||
|
||||
/**
|
||||
* returns translated name of plugin
|
||||
@ -78,14 +77,14 @@ interface iface_export_plugin {
|
||||
* preserv => array,
|
||||
* )
|
||||
*/
|
||||
public static function get_options_etpl();
|
||||
public function get_options_etpl();
|
||||
|
||||
/**
|
||||
* returns etemplate name for slectors of this plugin
|
||||
*
|
||||
* @return string etemplate name
|
||||
*/
|
||||
public static function get_selectors_etpl();
|
||||
public function get_selectors_etpl();
|
||||
|
||||
} // end of iface_export_plugin
|
||||
?>
|
||||
|
@ -26,28 +26,20 @@
|
||||
*/
|
||||
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
|
||||
* @param stream $_stream resource where records are exported to.
|
||||
* @param array $_options options for specific backends
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
public function __construct( $_handle, $_charset, array $_options=array() );
|
||||
public function __construct( $_stream, 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 );
|
||||
|
||||
@ -55,7 +47,6 @@ interface iface_export_record
|
||||
* Retruns total number of exported records.
|
||||
*
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
public function get_num_of_records( );
|
||||
|
||||
@ -63,7 +54,6 @@ interface iface_export_record
|
||||
* destructor
|
||||
*
|
||||
* @return
|
||||
* @access public
|
||||
*/
|
||||
public function __destruct( );
|
||||
|
||||
|
80
importexport/inc/class.iface_import_plugin.inc.php
Normal file
80
importexport/inc/class.iface_import_plugin.inc.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?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_plugin
|
||||
* This a the abstract interface for an import plugin of importexport
|
||||
*
|
||||
* You need to implement this class in
|
||||
* EGW_INCLUDE_ROOT/appname/inc/importexport/class.import_<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 responsible for generating a defintion AND
|
||||
* working on that definition.
|
||||
* So this interface just garanties the interaction with userinterfaces. It
|
||||
* has nothing to do with datatypes.
|
||||
*/
|
||||
interface iface_import_plugin {
|
||||
|
||||
/**
|
||||
* imports entries according to given definition object.
|
||||
*
|
||||
* @param stram $_stram
|
||||
* @param definition $_definition
|
||||
*/
|
||||
public function import( $_stream, 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(s) plugin can handle (e.g. csv)
|
||||
*
|
||||
* @return string suffix (comma seperated)
|
||||
*/
|
||||
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 function get_options_etpl();
|
||||
|
||||
/**
|
||||
* returns etemplate name for slectors of this plugin
|
||||
*
|
||||
* @return string etemplate name
|
||||
*/
|
||||
public function get_selectors_etpl();
|
||||
|
||||
} // end of iface_export_plugin
|
||||
?>
|
@ -20,26 +20,19 @@
|
||||
*/
|
||||
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
|
||||
* @param stream $_stream resource containing data. Differs according to the implementations
|
||||
* @param array $_options options for specific backends
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
public function __construct( $_resource, $_options );
|
||||
public function __construct( $_stream, array $_options );
|
||||
|
||||
/**
|
||||
* cleanup
|
||||
*
|
||||
* @return
|
||||
* @access public
|
||||
*/
|
||||
public function __destruct( );
|
||||
|
||||
@ -48,7 +41,6 @@ interface iface_import_record
|
||||
*
|
||||
* @param string _position may be: {first|last|next|previous|somenumber}
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
public function get_record( $_position = 'next' );
|
||||
|
||||
@ -56,7 +48,6 @@ interface iface_import_record
|
||||
* Retruns total number of records for the open resource.
|
||||
*
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
public function get_num_of_records( );
|
||||
|
||||
@ -64,7 +55,6 @@ interface iface_import_record
|
||||
* Returns pointer of current position
|
||||
*
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
public function get_current_position( );
|
||||
|
||||
|
@ -19,55 +19,40 @@ require_once('class.import_export_helper_functions.inc.php');
|
||||
* 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 Throw away spechial chars and trim() entries ?
|
||||
* @todo Check for XSS like userinput! (see common_functions)
|
||||
*/
|
||||
class import_csv implements iface_import_record { //, Iterator {
|
||||
|
||||
const csv_max_linelength = 8000;
|
||||
|
||||
/** Aggregations: */
|
||||
|
||||
/** Compositions: */
|
||||
|
||||
/**
|
||||
* @static import_export_helper_functions
|
||||
*/
|
||||
|
||||
/*** Attributes: ***/
|
||||
|
||||
/**
|
||||
* array with field mapping in form column number => new_field_name
|
||||
* @access public
|
||||
* @var array array with field mapping in form column number => new_field_name
|
||||
*/
|
||||
public $mapping = array();
|
||||
|
||||
/**
|
||||
* array with conversions to be done in form: new_field_name => conversion_string
|
||||
* @access public
|
||||
* @var array with conversions to be done in form: new_field_name => conversion_string
|
||||
*/
|
||||
public $conversion = array();
|
||||
|
||||
/**
|
||||
* array holding the current record
|
||||
* @access protected
|
||||
* @var array holding the current record
|
||||
*/
|
||||
protected $record = array();
|
||||
|
||||
/**
|
||||
* current position counter
|
||||
* @access protected
|
||||
* @var int current position counter
|
||||
*/
|
||||
protected $current_position = 0;
|
||||
|
||||
/**
|
||||
* holds total number of records
|
||||
* @access private
|
||||
* @var int
|
||||
* @var int holds total number of records
|
||||
*/
|
||||
protected $num_of_records = 0;
|
||||
|
||||
/**
|
||||
* csv resource
|
||||
* @access private
|
||||
* @var stream
|
||||
*/
|
||||
private $resource;
|
||||
|
||||
@ -79,18 +64,16 @@ class import_csv implements iface_import_record { //, Iterator {
|
||||
private $csv_fieldsep;
|
||||
|
||||
/**
|
||||
* charset of csv file
|
||||
* @var string
|
||||
* @access privat
|
||||
*
|
||||
* @var string charset of csv file
|
||||
*/
|
||||
private $csv_charset;
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @access public
|
||||
* @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
|
||||
*/
|
||||
public function __construct( $_resource, $_options = array() ) {
|
||||
public function __construct( $_resource, $_options ) {
|
||||
$this->resource = $_resource;
|
||||
$this->csv_fieldsep = $_options['fieldsep'];
|
||||
$this->csv_charset = $_options['charset'];
|
||||
@ -99,9 +82,6 @@ class import_csv implements iface_import_record { //, Iterator {
|
||||
|
||||
/**
|
||||
* cleanup
|
||||
*
|
||||
* @return
|
||||
* @access public
|
||||
*/
|
||||
public function __destruct( ) {
|
||||
} // end of member function __destruct
|
||||
@ -111,21 +91,20 @@ class import_csv implements iface_import_record { //, Iterator {
|
||||
*
|
||||
* @param mixed _position may be: {current|first|last|next|previous|somenumber}
|
||||
* @return mixed array with data / false if no furtor records
|
||||
* @access public
|
||||
*/
|
||||
public function get_record( $_position = 'next' ) {
|
||||
if ($this->get_raw_record( $_position ) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !empty( $this->mapping ) ) {
|
||||
$this->do_fieldmapping();
|
||||
}
|
||||
|
||||
if ( !empty( $this->conversion ) ) {
|
||||
$this->do_conversions();
|
||||
}
|
||||
|
||||
if ( !empty( $this->mapping ) ) {
|
||||
$this->do_fieldmapping();
|
||||
}
|
||||
|
||||
return $this->record;
|
||||
} // end of member function get_record
|
||||
|
||||
@ -197,7 +176,6 @@ class import_csv implements iface_import_record { //, Iterator {
|
||||
* 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) {
|
||||
@ -214,7 +192,6 @@ class import_csv implements iface_import_record { //, Iterator {
|
||||
* Returns pointer of current position
|
||||
*
|
||||
* @return int
|
||||
* @access public
|
||||
*/
|
||||
public function get_current_position( ) {
|
||||
|
||||
@ -227,7 +204,6 @@ class import_csv implements iface_import_record { //, Iterator {
|
||||
* does fieldmapping according to $this->mapping
|
||||
*
|
||||
* @return
|
||||
* @access protected
|
||||
*/
|
||||
protected function do_fieldmapping( ) {
|
||||
$record = $this->record;
|
||||
@ -235,14 +211,13 @@ class import_csv implements iface_import_record { //, Iterator {
|
||||
foreach ($this->mapping as $cvs_idx => $new_idx) {
|
||||
$this->record[$new_idx] = $record[$cvs_idx];
|
||||
}
|
||||
return;
|
||||
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 )) {
|
||||
|
@ -10,20 +10,11 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* class import_export_helper_functions (only static methods)
|
||||
* use import_export_helper_functions::method
|
||||
*/
|
||||
class import_export_helper_functions
|
||||
{
|
||||
|
||||
/** Aggregations: */
|
||||
|
||||
/** Compositions: */
|
||||
|
||||
/*** Attributes: ***/
|
||||
class import_export_helper_functions {
|
||||
|
||||
/**
|
||||
* nothing to construct here, only static functions!
|
||||
@ -32,80 +23,75 @@ class import_export_helper_functions
|
||||
/**
|
||||
* converts accound_lid to account_id
|
||||
*
|
||||
* @param string _account_lid comma seperated list
|
||||
* @return string comma seperated list
|
||||
* @static
|
||||
* @access public
|
||||
* @param mixed $_account_lid comma seperated list or array with lids
|
||||
* @return mixed comma seperated list or array with ids
|
||||
*/
|
||||
public static function account_lid2id( $_account_lids ) {
|
||||
$account_lids = explode( ',', $_account_lids );
|
||||
public static function account_name2id( $_account_lids ) {
|
||||
$account_lids = is_array( $_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 );
|
||||
return is_array( $_account_lids ) ? $account_ids : 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
|
||||
* @param mixed $_account_ids comma seperated list or array with ids
|
||||
* @return mixed comma seperated list or array with lids
|
||||
*/
|
||||
public static function account_id2lid( $_account_id ) {
|
||||
$account_ids = explode( ',', $_account_id );
|
||||
public static function account_id2name( $_account_id ) {
|
||||
$account_ids = is_array( $_account_id ) ? $_account_id : 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 );
|
||||
return is_array( $_account_id ) ? $account_lids : 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
|
||||
* @param mixed _cat_ids comma seperated list or array
|
||||
* @return mixed comma seperated list or array with cat_names
|
||||
*/
|
||||
public static function cat_id2name( $_cat_ids ) {
|
||||
if ( !is_object($GLOBALS['egw']->categories) ) {
|
||||
$GLOBALS['egw']->categories =& CreateObject('phpgwapi.categories');
|
||||
}
|
||||
$cat_ids = explode( ',', $_cat_id );
|
||||
$cats = &CreateObject( 'phpgwapi.categories' );
|
||||
|
||||
$cat_ids = is_array( $_cat_ids ) ? $_cat_ids : explode( ',', $_cat_ids );
|
||||
foreach ( $cat_ids as $cat_id ) {
|
||||
$cat_names[] = $GLOBALS['egw']->categories->id2name( (int)$cat_id );
|
||||
$cat_names[] = $cats->id2name( (int)$cat_id );
|
||||
}
|
||||
return implode(',',$cat_names);
|
||||
return is_array( $_cat_ids ) ? $cat_names : 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
|
||||
* @param mixed $_cat_names comma seperated list or array.
|
||||
* @return mixed comma seperated list or array with cat_ids
|
||||
*/
|
||||
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 );
|
||||
public static function cat_name2id( $_cat_names ) {
|
||||
$cats = &CreateObject( 'phpgwapi.categories' );
|
||||
$cats->app_name = 'phpgw';
|
||||
|
||||
$cat_names = is_array( $_cat_names ) ? $_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;
|
||||
if ( $cat_id = $cats->name2id( addslashes( $cat_name ))) { }
|
||||
else $cat_id = $cats->add( array(
|
||||
'name' => $cat_name,
|
||||
'access' => 'public',
|
||||
'descr' => $cat_name. ' ('. lang('Automatically created by importexport'). ')'
|
||||
));
|
||||
$cat_ids[] = $cat_id;
|
||||
}
|
||||
return implode( ',', $cat_ids );
|
||||
return $_cat_names ? $cat_ids : implode( ',', $cat_ids );
|
||||
|
||||
} // end of member function category_name2id
|
||||
|
||||
@ -120,115 +106,90 @@ class import_export_helper_functions
|
||||
* 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].
|
||||
* you can use all other _record fields, with the syntax |[FIELDINDEX].
|
||||
* 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.
|
||||
* Your record is:
|
||||
* array( 0 => Company, 1 => NFamily, 2 => NGiven
|
||||
* Your conversion string for field 0 (Company):
|
||||
* .+|>|[0]: |[1], |[2]|||[1], |[2]
|
||||
* This constructs 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
|
||||
* Moreover the two helper function cat() and account() can be used.
|
||||
* cat(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
|
||||
* @param object &$cclass calling class to process the '@ evals' (not impelmeted yet)
|
||||
* @return bool
|
||||
* @static
|
||||
* @access public
|
||||
* @todo replace this function with a function dealing with reg expressions!
|
||||
*/
|
||||
public static function conversion( $_record, $_conversion ) {
|
||||
public static function conversion( $_record, $_conversion, &$_cclass = null ) {
|
||||
if (empty( $_conversion ) ) return $_record;
|
||||
$values = $_record;
|
||||
|
||||
$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
|
||||
$CPre = '|['; $CPos = ']'; // |[_record-idx] is expanded to the corespondig value
|
||||
|
||||
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;
|
||||
foreach ( $_conversion as $idx => $conversion_string ) {
|
||||
|
||||
if ( empty( $conversion_string ) ) continue;
|
||||
|
||||
// fetch patterns ($rvalues)
|
||||
$pat_reps = explode( $PSep, stripslashes( $conversion_string ) );
|
||||
foreach( $pat_reps as $k => $pat_rep ) {
|
||||
list( $pattern, $replace ) = explode( $ASep, $pat_rep, 2 );
|
||||
if( $replace == '' ) {
|
||||
$replace = $pattern; $pattern = '^.*$';
|
||||
}
|
||||
//$_conversion[$record_idx] = $rvalues;
|
||||
$conv_record = $rvalues;
|
||||
}
|
||||
else
|
||||
{
|
||||
//unset($_conversion[$record_idx] );
|
||||
$rvalues[$pattern] = $replace; // replace two with only one, added by the form
|
||||
}
|
||||
|
||||
$val = $record_value;
|
||||
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);
|
||||
// conversion list may be longer than $_record (no_csv)
|
||||
$val = array_key_exists( $idx, $_record ) ? $_record[$idx] : '';
|
||||
|
||||
$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;
|
||||
}
|
||||
foreach ( $rvalues as $pattern => $replace ) {
|
||||
if( ereg( (string)$pattern, $val) ) {
|
||||
|
||||
$val = ereg_replace( (string)$pattern, $replace, (string)$val );
|
||||
|
||||
$reg = '\|\[([a-zA-Z_0-9]+)\]';
|
||||
while( ereg( $reg, $val, $vars ) ) {
|
||||
// expand all _record fields
|
||||
$val = str_replace(
|
||||
$CPre . $vars[1] . $CPos,
|
||||
$_record[array_search($vars[1], array_keys($_record))],
|
||||
$val
|
||||
);
|
||||
}
|
||||
|
||||
$val = preg_replace_callback( "/(cat|account)\(([^)]+)\)/i", array( self, 'c2_dispatcher') , $val );
|
||||
}
|
||||
}
|
||||
$values[$record_idx] = $val;
|
||||
$values[$idx] = $val;
|
||||
}
|
||||
return $values;
|
||||
} // end of member function conversion
|
||||
|
||||
/**
|
||||
* callback for preg_replace_callback from self::conversion.
|
||||
* This function gets called when 2nd level conversions are made,
|
||||
* like the cat() and account() statements in the conversions.
|
||||
*
|
||||
* @param array $_matches
|
||||
*/
|
||||
private static function c2_dispatcher( $_matches ) {
|
||||
$action = &$_matches[1]; // cat or account ...
|
||||
$data = &$_matches[2]; // datas for action
|
||||
|
||||
$method = (string)$action. ( is_int( $data ) ? '_id2name' : '_name2id' );
|
||||
return self::$method( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a list of importexport plugins
|
||||
*
|
||||
@ -236,13 +197,13 @@ class import_export_helper_functions
|
||||
* @param string $_appname {<appname> | all}
|
||||
* @return array(<appname> => array( <type> => array(<plugin> => <title>)))
|
||||
*/
|
||||
public static function get_plugins($_appname, $_type){
|
||||
public static function get_plugins( $_appname = 'all', $_type = 'all' ) {
|
||||
$appnames = $_appname == 'all' ? array_keys($GLOBALS['egw_info']['apps']) : (array)$_appname;
|
||||
$types = $_types == 'all' ? array('import','export') : (array)$_type;
|
||||
$types = $_type == 'all' ? array('import','export') : (array)$_type;
|
||||
$plugins = array();
|
||||
|
||||
foreach ($appnames as $appname) {
|
||||
$appdir = EGW_INCLUDE_ROOT. "/$appname/inc";
|
||||
$appdir = EGW_INCLUDE_ROOT. "/$appname/importexport";
|
||||
if(!is_dir($appdir)) continue;
|
||||
$d = dir($appdir);
|
||||
|
||||
@ -252,7 +213,7 @@ class import_export_helper_functions
|
||||
$file = $appdir. '/'. $entry;
|
||||
|
||||
foreach ($types as $type) {
|
||||
if(!is_file($file) || substr($classname,0,7) != $type.'_' || $extension != 'php') continue;
|
||||
if( !is_file($file) || substr($classname,0,7) != $type.'_' || $extension != 'php' ) continue;
|
||||
require_once($file);
|
||||
|
||||
try {
|
||||
@ -269,6 +230,7 @@ class import_export_helper_functions
|
||||
}
|
||||
$d->close();
|
||||
}
|
||||
//error_log(__CLASS__.__FUNCTION__.print_r($plugins,true));
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
@ -282,5 +244,8 @@ class import_export_helper_functions
|
||||
return array_keys(self::get_plugins('all',$_type));
|
||||
}
|
||||
|
||||
public static function guess_filetype( $_file ) {
|
||||
|
||||
}
|
||||
} // end of import_export_helper_functions
|
||||
?>
|
||||
|
@ -13,11 +13,6 @@
|
||||
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
|
||||
*
|
||||
@ -27,6 +22,8 @@ class uidefinitions
|
||||
{
|
||||
const _debug = true;
|
||||
|
||||
const _appname = 'importexport';
|
||||
|
||||
public $public_functions = array(
|
||||
'edit' => true,
|
||||
'index' => true,
|
||||
@ -59,8 +56,8 @@ class 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']->translation->add_app(self::_appname);
|
||||
$GLOBALS['egw_info']['flags']['currentapp'] = self::_appname;
|
||||
|
||||
$GLOBALS['egw_info']['flags']['include_xajax'] = true;
|
||||
if(!@is_object($GLOBALS['egw']->js))
|
||||
@ -68,7 +65,7 @@ class uidefinitions
|
||||
$GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript');
|
||||
}
|
||||
$this->etpl =& new etemplate();
|
||||
$this->clock = $GLOBALS['egw']->html->image(IMPORTEXPORT_APP,'clock');
|
||||
$this->clock = $GLOBALS['egw']->html->image(self::_appname,'clock');
|
||||
$this->steps = array(
|
||||
'wizzard_step10' => lang('Choose an application'),
|
||||
'wizzard_step20' => lang('Choose a plugin'),
|
||||
@ -77,7 +74,7 @@ class uidefinitions
|
||||
'wizzard_finish' => '',
|
||||
);
|
||||
//register plugins (depricated)
|
||||
$this->plugins = bodefinitions::plugins();
|
||||
//$this->plugins = bodefinitions::plugins();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,7 +104,7 @@ class uidefinitions
|
||||
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';
|
||||
$name = 'importexport_definition.xml';
|
||||
header('Content-Type: ' . $mime_type);
|
||||
header('Content-Disposition: attachment; filename="'.$name.'"');
|
||||
echo $bodefinitions->export($selected);
|
||||
@ -120,7 +117,7 @@ class uidefinitions
|
||||
}
|
||||
|
||||
}
|
||||
$etpl =& new etemplate(IMPORTEXPORT_APP.'.definition_index');
|
||||
$etpl =& new etemplate(self::_appname.'.definition_index');
|
||||
|
||||
// we need an offset because of autocontinued rows in etemplate ...
|
||||
$definitions = array('row0');
|
||||
@ -131,7 +128,7 @@ class uidefinitions
|
||||
unset($definition);
|
||||
}
|
||||
$content = $definitions;
|
||||
return $etpl->exec(IMPORTEXPORT_APP.'.uidefinitions.index',$content,array(),$readonlys,$preserv);
|
||||
return $etpl->exec( self::_appname.'.uidefinitions.index', $content, array(), $readonlys, $preserv );
|
||||
}
|
||||
|
||||
function edit()
|
||||
@ -203,7 +200,7 @@ class uidefinitions
|
||||
$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);
|
||||
$html = $this->etpl->exec(self::_appname.'.uidefinitions.wizzard',$content,$sel_options,$readonlys,$preserv,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -216,7 +213,7 @@ class uidefinitions
|
||||
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);
|
||||
$html = $this->etpl->exec(self::_appname.'.uidefinitions.wizzard',$content,$sel_options,$readonlys,$preserv,1);
|
||||
}
|
||||
|
||||
if(class_exists('xajaxResponse'))
|
||||
@ -254,7 +251,7 @@ class uidefinitions
|
||||
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);
|
||||
echo $manual->exec(self::_appname.'.uidefinitions.wizzard',$content,$sel_options,$readonlys,$preserv,1);
|
||||
unset($manual);
|
||||
}
|
||||
|
||||
@ -448,14 +445,14 @@ class uidefinitions
|
||||
$bodefinitions = new bodefinitions();
|
||||
if (is_array($content))
|
||||
{
|
||||
$bodefinitions->import($content['import_file']);
|
||||
$bodefinitions->import($content['import_file']['tmp_name']);
|
||||
// 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);
|
||||
$etpl =& new etemplate(self::_appname.'.import_definition');
|
||||
return $etpl->exec(self::_appname.'.uidefinitions.import_definition',$content,array(),$readonlys,$preserv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,10 +57,11 @@ class uiexport {
|
||||
if(empty($_content)) {
|
||||
$et = new etemplate(self::_appname. '.export_dialog');
|
||||
$_appname = $_GET['appname'];
|
||||
$_definition =$_GET['definition'];
|
||||
$_definition =$_GET['definition'] = 'expert';
|
||||
$_plugin = $_GET['plugin']; // NOTE: definition _must_ be 'expert' if for plugin to be used!
|
||||
$_selection = $_GET['selection'];
|
||||
|
||||
error_log(__FILE__.__FUNCTION__. '::$_GET[\'appname\']='. $_appname. ',$_GET[\'definition\']='. $_definition. ',$_GET[\'plugin\']='.$_plugin. ',$_GET[\'selection\']='.$_selection);
|
||||
// if appname is given and valid, list available definitions (if no definition is given)
|
||||
if (!empty($_appname) && $GLOBALS['egw']->acl->check('run',1,$_appname)) {
|
||||
$content['appname'] = $_appname;
|
||||
@ -84,7 +85,7 @@ class uiexport {
|
||||
unset($definitions);
|
||||
$sel_options['definition']['expert'] = lang('Expert options');
|
||||
|
||||
if(isset($_definition) && array_key_exists($_definition,$sel_options[$_definition])) {
|
||||
if(isset($_definition) && array_key_exists($_definition,$sel_options)) {
|
||||
$content['definition'] = $_definition;
|
||||
}
|
||||
else {
|
||||
@ -101,6 +102,7 @@ class uiexport {
|
||||
if(isset($_plugin) && array_key_exists($_plugin,$sel_options['plugin'])) {
|
||||
$content['plugin'] = $_plugin;
|
||||
$selected_plugin = $_plugin;
|
||||
error_log('hallo');
|
||||
}
|
||||
else {
|
||||
$plugins_classnames = array_keys($plugins);
|
||||
@ -181,23 +183,23 @@ class uiexport {
|
||||
$definition = new definition($_content['definition']);
|
||||
}
|
||||
|
||||
if (isset($definition->options['selection'])) {
|
||||
//$definition->options = parse(...)
|
||||
if (isset($definition->plugin_options['selection'])) {
|
||||
//$definition->plugin_options = parse(...)
|
||||
}
|
||||
else {
|
||||
$definition->options = array_merge(
|
||||
$definition->options,
|
||||
$definition->plugin_options = array_merge(
|
||||
$definition->plugin_options,
|
||||
array('selection' => $_content['selection'])
|
||||
);
|
||||
}
|
||||
|
||||
$tmpfname = tempnam('/tmp','export');
|
||||
$file = fopen($tmpfname, "w+");
|
||||
if (! $charset = $definition->options['charset']) {
|
||||
if (! $charset = $definition->plugin_options['charset']) {
|
||||
$charset = $GLOBALS['egw']->translation->charset();
|
||||
}
|
||||
$plugin_object = new $definition->plugin;
|
||||
$plugin_object->export($file, $charset, $definition);
|
||||
$plugin_object->export( $file, $definition );
|
||||
|
||||
if($_content['export'] == 'pressed') {
|
||||
fclose($file);
|
||||
@ -222,9 +224,16 @@ class uiexport {
|
||||
|
||||
fclose($file);
|
||||
unlink($tmpfname);
|
||||
$preview = $GLOBALS['egw']->translation->convert($preview,'iso-8859-1','utf-8');
|
||||
|
||||
// NOTE: $definition->plugin_options['charset'] may not be set,
|
||||
// but it's the best guess atm.
|
||||
$preview = $GLOBALS['egw']->translation->convert( $preview,
|
||||
$definition->plugin_options['charset'],
|
||||
$GLOBALS['egw']->translation->charset()
|
||||
);
|
||||
|
||||
$response->addAssign('exec[preview-box]','innerHTML',$preview);
|
||||
$response->addAssign('divPoweredBy','style.display','none');
|
||||
//$response->addAssign('divPoweredBy','style.display','none');
|
||||
$response->addAssign('exec[preview-box]','style.display','inline');
|
||||
$response->addAssign('exec[preview-box-buttons]','style.display','inline');
|
||||
|
||||
@ -234,6 +243,7 @@ class uiexport {
|
||||
//nothing else expected!
|
||||
throw new Exception('Error: unexpected submit in export_dialog!');
|
||||
}
|
||||
//error_log(print_r($content,true));
|
||||
return $et->exec(self::_appname. '.uiexport.export_dialog',$content,$sel_options,$readonlys,$preserv,2);
|
||||
}
|
||||
|
||||
|
28
importexport/js/export_dialog.js
Normal file
28
importexport/js/export_dialog.js
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* eGroupWare
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package importexport
|
||||
* @link http://www.egroupware.org
|
||||
* @author Cornelius Weiss <nelius@cwtech.de>
|
||||
* @copyright Cornelius Weiss <nelius@cwtech.de>
|
||||
* @version $Id:$
|
||||
*/
|
||||
|
||||
function export_dialog() {
|
||||
|
||||
this.change_definition = function(sel_obj) {
|
||||
if(sel_obj.value == 'expert') {
|
||||
// next two lines fix some strange layout bug
|
||||
set_style_by_class('tr','select_definition','display','none');
|
||||
set_style_by_class('tr','select_definition','display','inline');
|
||||
set_style_by_class('tr','select_plugin','display','inline');
|
||||
set_style_by_class('tr','save_definition','display','inline');
|
||||
}
|
||||
else {
|
||||
set_style_by_class('tr','select_plugin','display','none');
|
||||
set_style_by_class('tr','save_definition','display','none');
|
||||
}
|
||||
};
|
||||
}
|
||||
var export_dialog = new export_dialog();
|
@ -1,53 +1,31 @@
|
||||
<?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$
|
||||
*/
|
||||
/**
|
||||
* 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';
|
||||
require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.bodefinitions.inc.php');
|
||||
|
||||
// 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,
|
||||
),
|
||||
// apps, whose definitions should be installed automatically
|
||||
$appnames = array (
|
||||
'addressbook',
|
||||
);
|
||||
|
||||
)),
|
||||
));
|
||||
$oProc->query("INSERT INTO {$definition_table } (name,application,plugin,type,allowed_users,plugin_options) VALUES ( 'oelheld','addressbook','addressbook_csv_import','import','5','$plugin_options')");
|
||||
foreach ($appnames as $appname) {
|
||||
$defdir = EGW_INCLUDE_ROOT. "/$appname/importexport/definitions";
|
||||
if(!is_dir($defdir)) continue;
|
||||
$d = dir($defdir);
|
||||
|
||||
// step through each file in appdir
|
||||
while (false !== ($entry = $d->read())) {
|
||||
$file = $appdir. '/'. $entry;
|
||||
list( $filename, $extension) = explode('.',$entry);
|
||||
if ( $extension != 'xml' ) continue;
|
||||
bodefinitions::import( $file );
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* eGroupWare - eTemplates for Application importexport
|
||||
* http://www.egroupware.org
|
||||
* generated by soetemplate::dump4setup() 2006-11-16 12:03
|
||||
* generated by soetemplate::dump4setup() 2007-06-09 17:40
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package importexport
|
||||
@ -12,9 +12,9 @@
|
||||
|
||||
$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.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:6:"5,both";}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:1:{s:2:"c3";s:15:"save_definition";}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:25:"General|Selection|Options";s:4:"name";s:37:"general_tab|selection_tab|options_tab";}}i:3;a:1:{s:1:"A";a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:18:"Save as definition";s:4:"name";s:18:"save_as_definition";}}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 {
|
||||
$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:1:{s:2:"c3";s:15:"save_definition";}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:25:"General|Selection|Options";s:4:"name";s:37:"general_tab|selection_tab|options_tab";}}i:3;a:1:{s:1:"A";a:3:{s:4:"type";s:8:"checkbox";s:5:"label";s:18:"Save as definition";s:4:"name";s:18:"save_as_definition";}}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:167:"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;
|
||||
|
@ -1,7 +1,18 @@
|
||||
allowed users importexport de Erlaubte Benutzer
|
||||
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.
|
||||
delete all selected definitions importexport de Alle ausgewählten Definitionen löschen
|
||||
export importexport de Exportieren
|
||||
export all selected definitions importexport de Alle ausgewählten Definitionen exportieren
|
||||
finish importexport de Fertig
|
||||
general importexport de Generell
|
||||
import definitions (attension: existing definitions with equal names will be overwritten!!!) importexport de Definitionen importieren (Achtung: Alle gleichnamigen existierenden Definitionen werden überschrieben!)
|
||||
next importexport de Weiter
|
||||
preview importexport de Vorschau
|
||||
previous importexport de Zurück
|
||||
save as definition importexport de Als Definition speichern
|
||||
select definition importexport de Definition auswählen
|
||||
select plugin importexport de Plugin auswählen
|
||||
some nice text importexport de Ein schöner Text
|
||||
which useres are allowed for this definition importexport de Welche Benutzer dürden diese Definition verwenden?
|
||||
|
@ -2,7 +2,17 @@ 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
|
||||
delete all selected definitions importexport en delete ALL selected definitions
|
||||
export importexport en Export
|
||||
export all selected definitions importexport en export ALL selected definitions
|
||||
finish importexport en finish
|
||||
general importexport en General
|
||||
import definitions (attension: existing definitions with equal names will be overwritten!!!) importexport en Import definitions (Attension: Existing definitions with equal names will be overwritten!!!)
|
||||
next importexport en next
|
||||
preview importexport en Preview
|
||||
previous importexport en previous
|
||||
save as definition importexport en Save as definition
|
||||
select definition importexport en Select definition
|
||||
select plugin importexport en Select plugin
|
||||
some nice text importexport en some nice text
|
||||
which useres are allowed for this definition importexport en Which useres are allowed for this definition
|
||||
|
8
importexport/setup/phpgw_fi.lang
Normal file
8
importexport/setup/phpgw_fi.lang
Normal file
@ -0,0 +1,8 @@
|
||||
allowed users importexport fi Sallittu käyttäjille
|
||||
choose a name for this definition importexport fi Valitse nimi tälle selitteelle
|
||||
choose a plugin importexport fi Valitse liitännäinen
|
||||
choose an application importexport fi Valitse sovellus
|
||||
finish importexport fi Valmis
|
||||
next importexport fi Seuraava
|
||||
previous importexport fi Edellinen
|
||||
which useres are allowed for this definition importexport fi Ketkä käyttäjät saavat käyttää tätä selitettä
|
8
importexport/setup/phpgw_fr.lang
Normal file
8
importexport/setup/phpgw_fr.lang
Normal file
@ -0,0 +1,8 @@
|
||||
allowed users importexport fr Utilisateurs autorisés
|
||||
choose a name for this definition importexport fr Choisissez un nom pour cette définition
|
||||
choose a plugin importexport fr Choisissez un module enfichable
|
||||
choose an application importexport fr Choisissez une application
|
||||
finish importexport fr terminer
|
||||
next importexport fr prochain
|
||||
previous importexport fr précédent
|
||||
which useres are allowed for this definition importexport fr Quels utilisateurs sont autorisés pour cette définition
|
8
importexport/setup/phpgw_pl.lang
Normal file
8
importexport/setup/phpgw_pl.lang
Normal file
@ -0,0 +1,8 @@
|
||||
allowed users importexport pl U¿ytkownicy z dostêpem
|
||||
choose a name for this definition importexport pl Wybierz nazwê dla tej definicji
|
||||
choose a plugin importexport pl Wybierz wtyczkê
|
||||
choose an application importexport pl Wybierz aplikacjê
|
||||
finish importexport pl zakoñcz
|
||||
next importexport pl nastêpny
|
||||
previous importexport pl poprzedni
|
||||
which useres are allowed for this definition importexport pl Którzy u¿ytkownicy maj± dostêp do tej definicji?
|
8
importexport/setup/phpgw_sk.lang
Normal file
8
importexport/setup/phpgw_sk.lang
Normal file
@ -0,0 +1,8 @@
|
||||
allowed users importexport sk Oprávnení pou¾ívatelia
|
||||
choose a name for this definition importexport sk Zvoµte názov pre túto definíciu
|
||||
choose a plugin importexport sk Zvoµte zásuvný modul (plugin)
|
||||
choose an application importexport sk Zvoµte aplikáciu
|
||||
finish importexport sk Dokonèi»
|
||||
next importexport sk Ïal¹ie
|
||||
previous importexport sk Predchádzajúce
|
||||
which useres are allowed for this definition importexport sk Ktorí pou¾ívatelia sú oprávnení pre túto definíciu
|
@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
$setup_info['importexport']['name'] = 'importexport';
|
||||
$setup_info['importexport']['version'] = '0.003';
|
||||
$setup_info['importexport']['version'] = '1.4';
|
||||
$setup_info['importexport']['app_order'] = 2;
|
||||
$setup_info['importexport']['enable'] = 2;
|
||||
$setup_info['importexport']['tables'] = array('egw_importexport_definitions');
|
||||
@ -35,11 +35,11 @@
|
||||
/* Dependencies for this app to work */
|
||||
$setup_info['importexport']['depends'][] = array(
|
||||
'appname' => 'phpgwapi',
|
||||
'versions' => Array('1.2','1.3')
|
||||
'versions' => Array('1.3','1.4','1.5')
|
||||
);
|
||||
$setup_info['importexport']['depends'][] = array(
|
||||
'appname' => 'etemplate',
|
||||
'versions' => Array('1.2','1.3')
|
||||
'versions' => Array('1.3','1.4','1.5')
|
||||
);
|
||||
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
$test[] = '0.003';
|
||||
function importexport_upgrade0_003()
|
||||
{
|
||||
|
||||
return $GLOBALS['setup_info']['importexport']['currentver'] = '0.003';
|
||||
return $GLOBALS['setup_info']['importexport']['currentver'] = '1.4';
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user