diff --git a/importexport/inc/class.importexport_admin_prefs_sidebox_hooks.inc.php b/importexport/inc/class.importexport_admin_prefs_sidebox_hooks.inc.php index ffa7b78766..d4389c3699 100644 --- a/importexport/inc/class.importexport_admin_prefs_sidebox_hooks.inc.php +++ b/importexport/inc/class.importexport_admin_prefs_sidebox_hooks.inc.php @@ -43,7 +43,8 @@ class importexport_admin_prefs_sidebox_hooks 'icon' => 'export' ); } - if($GLOBALS['egw']->acl->check('definition', EGW_ACL_EDIT, $appname)) + $config = config::read($appname); + if($config['users_create_definitions']) { $file['Define imports|exports'] = egw::link('/index.php',array( 'menuaction' => 'importexport.importexport_definitions_ui.index', diff --git a/importexport/inc/class.importexport_definitions_ui.inc.php b/importexport/inc/class.importexport_definitions_ui.inc.php index 650cf8e89f..2129c212b0 100644 --- a/importexport/inc/class.importexport_definitions_ui.inc.php +++ b/importexport/inc/class.importexport_definitions_ui.inc.php @@ -80,11 +80,12 @@ class importexport_definitions_ui { $filter = array('name' => '*'); - if(!$GLOBALS['egw_info']['user']['apps']['admin']) { + if($GLOBALS['egw_info']['user']['apps']['admin']) { + // Any public definition + $filter[] = '!owner OR owner IS NULL OR allowed_users IS NOT NULL'; + } else { // Filter private definitions $filter['owner'] = $GLOBALS['egw_info']['user']['account_id']; - } else { - $filter[] = '!owner || owner IS NULL'; } $config = config::read('phpgwapi'); if($config['export_limit'] == 'no') { @@ -154,7 +155,6 @@ class importexport_definitions_ui $definition = array('name' => $_definition); $bodefinitions = new importexport_definitions_bo(); $definition = $bodefinitions->read($definition); - $definition['edit'] = true; $this->wizard($definition); } @@ -459,7 +459,11 @@ class importexport_definitions_ui // return from step90 if ($content['step'] == 'wizard_step90') { - $content['allowed_users'] = implode(',',$content['allowed_users']); + $content['owner'] = $content['just_me'] || !$GLOBALS['egw']->acl->check('share_definitions', EGW_ACL_READ,'importexport') ? + ($content['owner'] ? $content['owner'] : $GLOBALS['egw_info']['user']['account_id']) : + null; + $content['allowed_users'] = $content['just_me'] ? '' : implode(',',$content['allowed_users']); + unset($content['just_me']); // workaround for some ugly bug related to readonlys; switch (array_search('pressed', $content['button'])) @@ -479,6 +483,17 @@ class importexport_definitions_ui $content['msg'] = $this->steps['wizard_step90']; $content['step'] = 'wizard_step90'; $preserv = $content; + + // Set owner for non-admins + $content['just_me'] = ((!$content['allowed_users'] || !$content['allowed_users'][0] && count($content['allowed_users']) ==1) && $content['owner']); + //if(!$GLOBALS['egw_info']['user']['apps']['admin'] && !$GLOBALS['egw']->acl->check('share_definition', EGW_ACL_READ, 'importexport')) { + if(!$GLOBALS['egw']->acl->check('share_definition', EGW_ACL_READ, 'importexport') && !$GLOBALS['egw_info']['user']['apps']['admin']) { + $content['allowed_users'] = array(); + $readonlys['allowed_users'] = true; + $readonlys['just_me'] = true; + $content['just_me'] = true; + } + unset ($preserv['button']); $GLOBALS['egw']->js->set_onload("disable_button('exec[button][next]');"); if(is_object($this->response)) { @@ -497,10 +512,6 @@ class importexport_definitions_ui unset($content['button']); $bodefinitions = new importexport_definitions_bo(); - // Set owner for non-admins - if(!$GLOBALS['egw_info']['user']['apps']['admin']) { - $content['owner'] = $GLOBALS['egw_info']['user']['account_id']; - } $bodefinitions->save($content); // This message is displayed if browser cant close window $content['msg'] = lang('ImportExport wizard finished successfully!'); @@ -539,13 +550,14 @@ class importexport_definitions_ui // ACL $GLOBALS['egw']->acl->delete_repository(self::_appname, 'definition',false); - if($content['create_definition_users']) + $GLOBALS['egw']->acl->delete_repository(self::_appname, 'share_definition',false); + if($content['share_definition']) { - $GLOBALS['egw']->acl->add_repository(self::_appname, 'definition', $content['create_definition_users'], - EGW_ACL_ADD | EGW_ACL_EDIT + $GLOBALS['egw']->acl->add_repository(self::_appname, 'share_definition', $content['share_definition'], + EGW_ACL_READ ); } - unset($content['create_definition_users']); + unset($content['share_definition']); // Other config foreach($content as $key=>$value) @@ -557,7 +569,7 @@ class importexport_definitions_ui } $data = config::read(self::_appname); - $data['create_definition_users'] = $GLOBALS['egw']->acl->get_ids_for_location('definition', EGW_ACL_ADD | EGW_ACL_EDIT, self::_appname); + $data['share_definition'] = $GLOBALS['egw']->acl->get_ids_for_location('share_definition', EGW_ACL_READ, self::_appname); $GLOBALS['egw_info']['flags']['app_header'] = lang('Site configuration') . ' - ' . lang(self::_appname); $etpl = new etemplate(self::_appname.'.config'); diff --git a/importexport/lang/egw_en.lang b/importexport/lang/egw_en.lang index 4e360dbf66..690f033d7a 100644 --- a/importexport/lang/egw_en.lang +++ b/importexport/lang/egw_en.lang @@ -26,6 +26,7 @@ import definitions (attension: existing definitions with equal names will be ove importexport common en Import / Export importexport wizard finished successfully! importexport en ImportExport wizard finished successfully! imports information from a csv file. this is only a base class, and doesn't do anything on its own. importexport en Imports information from a CSV file. This is only a base class, and doesn't do anything on its own. +just me importexport en Just me load sample file importexport en Load Sample file manage mapping importexport en Manage mapping next importexport en next diff --git a/importexport/setup/etemplates.inc.php b/importexport/setup/etemplates.inc.php index 334e66e0ce..cdb97ba8d6 100644 --- a/importexport/setup/etemplates.inc.php +++ b/importexport/setup/etemplates.inc.php @@ -2,7 +2,7 @@ /** * eGroupWare - eTemplates for Application importexport * http://www.egroupware.org - * generated by soetemplate::dump4setup() 2011-02-22 10:10 + * generated by soetemplate::dump4setup() 2011-02-23 15:58 * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @package importexport @@ -12,7 +12,7 @@ $templ_version=1; -$templ_data[] = array('name' => 'importexport.config','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:45:"Users allowed to create their own definitions";}s:1:"B";a:3:{s:4:"type";s:14:"select-account";s:4:"size";s:6:"5,both";s:4:"name";s:23:"create_definition_users";}}i:2;a:2:{s:1:"A";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"1";s:4:"span";s:3:"all";i:1;a:4:{s:4:"type";s:6:"button";s:4:"span";s:3:"all";s:5:"label";s:4:"Save";s:4:"name";s:4:"save";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:2;s:4:"cols";i:2;}}','size' => '','style' => '','modified' => '1298390222',); +$templ_data[] = array('name' => 'importexport.config','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:1:{s:2:"c2";s:4:",top";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:45:"Users allowed to create their own definitions";}s:1:"B";a:2:{s:4:"type";s:8:"checkbox";s:4:"name";s:24:"users_create_definitions";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:44:"Users allowed to share their own definitions";}s:1:"B";a:3:{s:4:"type";s:14:"select-account";s:4:"size";s:6:"5,both";s:4:"name";s:16:"share_definition";}}i:3;a:2:{s:1:"A";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"1";s:4:"span";s:3:"all";i:1;a:4:{s:4:"type";s:6:"button";s:4:"span";s:3:"all";s:5:"label";s:4:"Save";s:4:"name";s:4:"save";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:3;s:4:"cols";i:2;}}','size' => '','style' => '','modified' => '1298390222',); $templ_data[] = array('name' => 'importexport.definition_index','template' => '','lang' => '','group' => '0','version' => '1.9.001','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:226:"window.open(egw::link(\'/index.php\',\'menuaction=importexport.importexport_definitions_ui.wizard\'),\'\',\'dependent=yes,width=500,height=500,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:5:{s:7:"no_lang";s:1:"1";s:4:"type";s:5:"image";s:4:"span";s:18:",lr_padding button";s:4:"name";s:12:"${row}[type]";s:7:"onclick";s:222:"window.open(egw::link(\'/index.php\',\'menuaction=${row_cont[menuaction]}&appname=${row_cont[application]}&definition=${row_cont[name]}\'),\'_blank\',\'dependent=yes,width=850,height=440,scrollbars=yes,status=yes\'); return false;";}s:1:"B";a:5:{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:4:"size";s:1:",";}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:263:"window.open(egw::link(\'/index.php\',\'menuaction=importexport.importexport_definitions_ui.edit&definition=$row_cont[name]\'),\'\',\'dependent=yes,width=500,height=500,location=no,menubar=no,toolbar=no,scrollbars=yes,resizable=1,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; } @@ -77,7 +77,7 @@ $templ_data[] = array('name' => 'importexport.wizard_basic_import_csv.fieldmappi $templ_data[] = array('name' => 'importexport.wizard_basic_import_csv.sample_file','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";s:7:"no_lang";s:1:"1";}}i:2;a:1:{s:1:"A";a:2:{s:4:"type";s:4:"file";s:4:"name";s:4:"file";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1268236654',); -$templ_data[] = array('name' => 'importexport.wizard_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.wizard_chooseallowedusers','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{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:4:{s:4:"type";s:8:"checkbox";s:5:"label";s:10:"%s Just me";s:4:"name";s:7:"just_me";s:8:"onchange";i:1;}}i:3;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:3;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1298497551',); $templ_data[] = array('name' => 'importexport.wizard_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',); diff --git a/importexport/templates/default/config.xet b/importexport/templates/default/config.xet index 578894a1dc..d72d18143b 100644 --- a/importexport/templates/default/config.xet +++ b/importexport/templates/default/config.xet @@ -10,7 +10,11 @@ - + + + + +