fix issue for changed default param for emailadmin_bo contructor; always use setDefaultProfile if there is NO profile available at all; fix issue regarding missing control of group ownership on edit.general

This commit is contained in:
Klaus Leithoff 2012-04-25 10:11:16 +00:00
parent 493cb249ba
commit b48b67f2d8
4 changed files with 17 additions and 22 deletions

View File

@ -451,26 +451,20 @@ class emailadmin_bo extends so_sql
list($found,$data) = each($profileData); list($found,$data) = each($profileData);
$this->profileID = $_profileID = $data['profileID']; $this->profileID = $_profileID = $data['profileID'];
} elseif ($GLOBALS['egw_info']['server']['smtp_server']) { // create a default profile, from the data in the api config } elseif ($GLOBALS['egw_info']['server']['smtp_server']) { // create a default profile, from the data in the api config
$this->profileID = $_profileID = $this->soemailadmin->addProfile(array( $this->profileID = $_profileID = $this->setDefaultProfile(array(
'description' => $GLOBALS['egw_info']['server']['smtp_server'], 'description' => $GLOBALS['egw_info']['server']['smtp_server'],
'defaultDomain' => $GLOBALS['egw_info']['server']['mail_suffix'], 'defaultDomain' => $GLOBALS['egw_info']['server']['mail_suffix'],
'organisationName' => '', 'organisationName' => '',
'userDefinedAccounts' => '', 'smtp_server' => $GLOBALS['egw_info']['server']['smtp_server'],
'userDefinedIdentities' => '', 'smtp_port' => $GLOBALS['egw_info']['server']['smtp_port'],
),array( 'smtpAuth' => $GLOBALS['egw_info']['server']['smtpAuth'],
'smtpServer' => $GLOBALS['egw_info']['server']['smtp_server'], 'smtp_auth_user' => $GLOBALS['egw_info']['server']['smtp_auth_user'],
'smtpPort' => $GLOBALS['egw_info']['server']['smtp_port'], 'smtp_auth_passwd' => $GLOBALS['egw_info']['server']['smtp_auth_passwd'],
'smtpAuth' => '', 'mail_server' => $GLOBALS['egw_info']['server']['mail_server'], // ? DO NOT USE THE SMTP Server, as no IMAP Server may be intentional
'smtpType' => 'defaultsmtp', // $GLOBALS['egw_info']['server']['mail_server'] : $GLOBALS['egw_info']['server']['smtp_server'],
),array( 'mail_server_type' => $GLOBALS['egw_info']['server']['mail_server_type'],
'imapServer' => $GLOBALS['egw_info']['server']['mail_server'] ? 'mail_login_type' => $GLOBALS['egw_info']['server']['mail_login_type'] ?
$GLOBALS['egw_info']['server']['mail_server'] : $GLOBALS['egw_info']['server']['smtp_server'],
'imapPort' => '143',
'imapType' => 'defaultimap', // imap
'imapLoginType' => $GLOBALS['egw_info']['server']['mail_login_type'] ?
$GLOBALS['egw_info']['server']['mail_login_type'] : 'standard', $GLOBALS['egw_info']['server']['mail_login_type'] : 'standard',
'imapTLSEncryption' => '0',
'imapTLSAuthentication' => '',
)); ));
$profileData[$found = 0] = array( $profileData[$found = 0] = array(
'smtpType' => 'defaultsmtp', 'smtpType' => 'defaultsmtp',
@ -910,10 +904,11 @@ class emailadmin_bo extends so_sql
$profile = array_merge($profile,array_diff_assoc($settings,$to_parse)); $profile = array_merge($profile,array_diff_assoc($settings,$to_parse));
//error_log(__METHOD__.__LINE__.' Profile to Save:'.array2string($profile)); //error_log(__METHOD__.__LINE__.' Profile to Save:'.array2string($profile));
//error_log(__METHOD__.__LINE__.' Profile to Parse:'.array2string($to_parse)); //error_log(__METHOD__.__LINE__.' Profile to Parse:'.array2string($to_parse));
$this->soemailadmin->updateProfile($profile); $profileID = $this->soemailadmin->updateProfile($profile);
self::$sessionData['profile'] = array(); self::$sessionData['profile'] = array();
$this->saveSessionData(); $this->saveSessionData();
//echo "<p>EMailAdmin profile update: ".print_r($profile,true)."</p>\n"; exit; //echo "<p>EMailAdmin profile update: ".print_r($profile,true)."</p>\n"; exit;
return $profileID;
} }
function saveSessionData() function saveSessionData()

View File

@ -2,7 +2,7 @@
/** /**
* EGroupware - eTemplates for Application emailadmin * EGroupware - eTemplates for Application emailadmin
* http://www.egroupware.org * http://www.egroupware.org
* generated by soetemplate::dump4setup() 2012-04-10 13:44 * generated by soetemplate::dump4setup() 2012-04-25 10:53
* *
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package emailadmin * @package emailadmin
@ -14,7 +14,7 @@ $templ_version=1;
$templ_data[] = array('name' => 'emailadmin.edit','template' => '','lang' => '','group' => '0','version' => '1.7.003','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:5:{i:0;a:2:{s:2:"h1";s:6:",!@msg";s:1:"A";s:4:"100%";}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:5:"label";s:5:"align";s:6:"center";s:4:"name";s:3:"msg";s:4:"span";s:10:",redItalic";}}i:2;a:1:{s:1:"A";a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:3:{s:1:"C";s:3:"50%";s:1:"B";s:3:"40%";s:1:"D";s:2:"5%";}i:1;a:4:{s:1:"A";a:4:{s:4:"type";s:4:"text";s:5:"label";s:2:"ID";s:4:"name";s:13:"ea_profile_id";s:8:"readonly";s:1:"1";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:12:"Profile Name";}s:1:"C";a:3:{s:4:"type";s:4:"text";s:4:"name";s:14:"ea_description";s:5:"align";s:5:"right";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"align";s:5:"right";}}}s:4:"rows";i:1;s:4:"cols";i:4;s:4:"size";s:3:"98%";s:7:"options";a:1:{i:0;s:3:"98%";}}}i:3;a:1:{s:1:"A";a:3:{s:4:"type";s:3:"tab";s:5:"label";s:45:"Global|SMTP|IMAP|Signature|Stationery|History";s:4:"name";s:50:"tabs=global|SMTP|IMAP|signature|stationery|history";}}i:4;a:1:{s:1:"A";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:3:{s:4:"type";s:6:"button";s:4:"name";s:4:"save";s:5:"label";s:4:"Save";}i:2;a:3:{s:4:"type";s:6:"button";s:5:"label";s:5:"Apply";s:4:"name";s:5:"apply";}i:3;a:3:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:4:"name";s:6:"cancel";}}i:2;a:5:{s:4:"type";s:6:"button";s:4:"name";s:6:"delete";s:5:"label";s:6:"Delete";s:5:"align";s:5:"right";s:7:"onclick";s:60:"return confirm(\'Do you really want to delete this Profile\');";}}}}s:4:"rows";i:4;s:4:"cols";i:1;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '.redItalic { color: red; font-style: italics; }','modified' => '1255612671',); $templ_data[] = array('name' => 'emailadmin.edit','template' => '','lang' => '','group' => '0','version' => '1.7.003','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:5:{i:0;a:2:{s:2:"h1";s:6:",!@msg";s:1:"A";s:4:"100%";}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:5:"label";s:5:"align";s:6:"center";s:4:"name";s:3:"msg";s:4:"span";s:10:",redItalic";}}i:2;a:1:{s:1:"A";a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:3:{s:1:"C";s:3:"50%";s:1:"B";s:3:"40%";s:1:"D";s:2:"5%";}i:1;a:4:{s:1:"A";a:4:{s:4:"type";s:4:"text";s:5:"label";s:2:"ID";s:4:"name";s:13:"ea_profile_id";s:8:"readonly";s:1:"1";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:12:"Profile Name";}s:1:"C";a:3:{s:4:"type";s:4:"text";s:4:"name";s:14:"ea_description";s:5:"align";s:5:"right";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"align";s:5:"right";}}}s:4:"rows";i:1;s:4:"cols";i:4;s:4:"size";s:3:"98%";s:7:"options";a:1:{i:0;s:3:"98%";}}}i:3;a:1:{s:1:"A";a:3:{s:4:"type";s:3:"tab";s:5:"label";s:45:"Global|SMTP|IMAP|Signature|Stationery|History";s:4:"name";s:50:"tabs=global|SMTP|IMAP|signature|stationery|history";}}i:4;a:1:{s:1:"A";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:5:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";i:1;a:3:{s:4:"type";s:6:"button";s:4:"name";s:4:"save";s:5:"label";s:4:"Save";}i:2;a:3:{s:4:"type";s:6:"button";s:5:"label";s:5:"Apply";s:4:"name";s:5:"apply";}i:3;a:3:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:4:"name";s:6:"cancel";}}i:2;a:5:{s:4:"type";s:6:"button";s:4:"name";s:6:"delete";s:5:"label";s:6:"Delete";s:5:"align";s:5:"right";s:7:"onclick";s:60:"return confirm(\'Do you really want to delete this Profile\');";}}}}s:4:"rows";i:4;s:4:"cols";i:1;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '.redItalic { color: red; font-style: italics; }','modified' => '1255612671',);
$templ_data[] = array('name' => 'emailadmin.edit.global','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"groupbox";s:5:"label";s:12:"Organisation";s:4:"size";s:1:"1";i:1;a:5:{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:50:"enter your default mail domain (from: user@domain)";}s:1:"B";a:2:{s:4:"type";s:4:"text";s:4:"name";s:17:"ea_default_domain";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:20:"name of organisation";}s:1:"B";a:2:{s:4:"type";s:4:"text";s:4:"name";s:20:"ea_organisation_name";}}}s:4:"rows";i:2;s:4:"cols";i:2;s:7:"options";a:0:{}}}}i:2;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"1";s:5:"label";s:21:"profile access rights";i:1;a:5:{s:4:"type";s:4:"grid";s:7:"options";a:0:{}s:4:"data";a:4:{i:0;a:1:{s:2:"h2";s:9:",@ea_user";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:26:"can be used by application";}s:1:"B";a:3:{s:4:"type";s:6:"select";s:4:"name";s:10:"ea_appname";s:4:"size";s:15:"any application";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:20:"can be used by group";}s:1:"B";a:3:{s:4:"type";s:14:"select-account";s:4:"size";s:16:"any group,groups";s:4:"name";s:8:"ea_group";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:19:"can be used by user";}s:1:"B";a:3:{s:4:"type";s:14:"select-account";s:4:"size";s:17:"any user,accounts";s:4:"name";s:7:"ea_user";}}}s:4:"rows";i:3;s:4:"cols";i:2;}}}i:3;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"1";s:5:"label";s:14:"global options";i:1;a:5:{s:4:"type";s:4:"grid";s:7:"options";a:0:{}s:4:"data";a:5:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:17:"profile is active";}s:1:"B";a:2:{s:4:"type";s:8:"checkbox";s:4:"name";s:9:"ea_active";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:37:"users can define their own identities";}s:1:"B";a:3:{s:4:"type";s:8:"checkbox";s:4:"name";s:26:"ea_user_defined_identities";s:4:"size";s:6:"yes,no";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:40:"users can define their own emailaccounts";}s:1:"B";a:3:{s:4:"type";s:8:"checkbox";s:4:"name";s:24:"ea_user_defined_accounts";s:4:"size";s:6:"yes,no";}}i:4;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"order";}s:1:"B";a:2:{s:4:"type";s:3:"int";s:4:"name";s:8:"ea_order";}}}s:4:"rows";i:4;s:4:"cols";i:2;}}}}s:4:"rows";i:3;s:4:"cols";i:1;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '','modified' => '1334058065',); $templ_data[] = array('name' => 'emailadmin.edit.global','template' => '','lang' => '','group' => '0','version' => '1.9.002','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"groupbox";s:5:"label";s:12:"Organisation";s:4:"size";s:1:"1";i:1;a:5:{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:50:"enter your default mail domain (from: user@domain)";}s:1:"B";a:2:{s:4:"type";s:4:"text";s:4:"name";s:17:"ea_default_domain";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:20:"name of organisation";}s:1:"B";a:2:{s:4:"type";s:4:"text";s:4:"name";s:20:"ea_organisation_name";}}}s:4:"rows";i:2;s:4:"cols";i:2;s:7:"options";a:0:{}}}}i:2;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"1";s:5:"label";s:21:"profile access rights";i:1;a:5:{s:4:"type";s:4:"grid";s:7:"options";a:0:{}s:4:"data";a:4:{i:0;a:1:{s:2:"h2";s:9:",@ea_user";}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:26:"can be used by application";}s:1:"B";a:3:{s:4:"type";s:6:"select";s:4:"name";s:10:"ea_appname";s:4:"size";s:15:"any application";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:20:"can be used by group";}s:1:"B";a:3:{s:4:"type";s:14:"select-account";s:4:"size";s:16:"any group,groups";s:4:"name";s:8:"ea_group";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:19:"can be used by user";}s:1:"B";a:4:{s:4:"type";s:14:"select-account";s:4:"size";s:17:"any user,accounts";s:4:"name";s:7:"ea_user";s:8:"onchange";s:23:"disableGroupSelector();";}}}s:4:"rows";i:3;s:4:"cols";i:2;}}}i:3;a:1:{s:1:"A";a:4:{s:4:"type";s:8:"groupbox";s:4:"size";s:1:"1";s:5:"label";s:14:"global options";i:1;a:5:{s:4:"type";s:4:"grid";s:7:"options";a:0:{}s:4:"data";a:5:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:17:"profile is active";}s:1:"B";a:2:{s:4:"type";s:8:"checkbox";s:4:"name";s:9:"ea_active";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:37:"users can define their own identities";}s:1:"B";a:3:{s:4:"type";s:8:"checkbox";s:4:"name";s:26:"ea_user_defined_identities";s:4:"size";s:6:"yes,no";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:40:"users can define their own emailaccounts";}s:1:"B";a:3:{s:4:"type";s:8:"checkbox";s:4:"name";s:24:"ea_user_defined_accounts";s:4:"size";s:6:"yes,no";}}i:4;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"order";}s:1:"B";a:2:{s:4:"type";s:3:"int";s:4:"name";s:8:"ea_order";}}}s:4:"rows";i:4;s:4:"cols";i:2;}}}}s:4:"rows";i:3;s:4:"cols";i:1;s:4:"size";s:4:"100%";s:7:"options";a:1:{i:0;s:4:"100%";}}}','size' => '100%','style' => '','modified' => '1335343968',);
$templ_data[] = array('name' => 'emailadmin.edit.history','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:2:{s:4:"type";s:10:"historylog";s:4:"name";s:7:"history";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:17:"100%,400,,,,,auto";s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"400";i:6;s:4:"auto";}}}','size' => '100%,400,,,,,auto','style' => '','modified' => '1283865538',); $templ_data[] = array('name' => 'emailadmin.edit.history','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:2:{s:4:"type";s:10:"historylog";s:4:"name";s:7:"history";}}}s:4:"rows";i:1;s:4:"cols";i:1;s:4:"size";s:17:"100%,400,,,,,auto";s:7:"options";a:3:{i:0;s:4:"100%";i:1;s:3:"400";i:6;s:4:"auto";}}}','size' => '100%,400,,,,,auto','style' => '','modified' => '1283865538',);

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- $Id$ --> <!-- $Id$ -->
<overlay> <overlay>
<template id="emailadmin.edit.global" template="" lang="" group="0" version="1.9.001"> <template id="emailadmin.edit.global" template="" lang="" group="0" version="1.9.002">
<grid width="100%"> <grid width="100%">
<columns> <columns>
<column/> <column/>
@ -43,7 +43,7 @@
<menupopup id="ea_appname" options="any application"/> <menupopup id="ea_appname" options="any application"/>
</menulist> </menulist>
</row> </row>
<row> <row disabled="@ea_user">
<description value="can be used by group"/> <description value="can be used by group"/>
<menulist> <menulist>
<menupopup type="select-account" id="ea_group" options="any group,groups"/> <menupopup type="select-account" id="ea_group" options="any group,groups"/>

View File

@ -209,7 +209,7 @@ function do_emailadmin()
} }
$config['smtpAuth'] = $config['smtp_auth_user'] ? 'yes' : null; $config['smtpAuth'] = $config['smtp_auth_user'] ? 'yes' : null;
$emailadmin = new emailadmin_bo(-1,false); // false=no session stuff $emailadmin = new emailadmin_bo(false,false); // false=no session stuff
$emailadmin->setDefaultProfile($config); $emailadmin->setDefaultProfile($config);
echo "\n".lang('EMailAdmin profile updated:')."\n"; echo "\n".lang('EMailAdmin profile updated:')."\n";