diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php index 5f99842945..df5a2543eb 100644 --- a/mail/inc/class.mail_hooks.inc.php +++ b/mail/inc/class.mail_hooks.inc.php @@ -807,16 +807,14 @@ class mail_hooks #$mailPreferences = ExecMethod('mail.bopreferences.getPreferences'); $menu_title = lang('Preferences'); // ToDo: remove Preferences sub-menu from sidebox $file = array(); -/* + if($preferences->userDefinedAccounts || $preferences->userDefinedIdentities) { $linkData = array ( - 'menuaction' => 'mail.uipreferences.listAccountData', + 'menuaction' => 'mail.mail_uipreferences.index', ); $file['Manage eMail Accounts and Identities'] = egw::link('/index.php',$linkData); } -*/ - if ($preferences->preferences['prefcontroltestconnection'] <> 'none') $file['Test Connection'] = egw::link('/index.php','menuaction=mail.mail_ui.TestConnection&appname=mail'); if($preferences->ea_user_defined_signatures) { $linkData = array ( @@ -824,6 +822,9 @@ class mail_hooks ); $file['Manage Signatures'] = egw::link('/index.php',$linkData); } + + if ($preferences->preferences['prefcontroltestconnection'] <> 'none') $file['Test Connection'] = egw::link('/index.php','menuaction=mail.mail_ui.TestConnection&appname=mail'); + /* if(empty($preferences->preferences['prefpreventmanagefolders']) || $preferences->preferences['prefpreventmanagefolders'] == 0) { $file['Manage Folders'] = egw::link('/index.php',array('menuaction'=>'mail.uipreferences.listFolder')); diff --git a/mail/inc/class.mail_signatures.inc.php b/mail/inc/class.mail_signatures.inc.php index e03a9e33d6..ddd8f196c5 100644 --- a/mail/inc/class.mail_signatures.inc.php +++ b/mail/inc/class.mail_signatures.inc.php @@ -1,6 +1,6 @@ True, + 'edit' => True, ); /** diff --git a/mail/inc/class.mail_uipreferences.inc.php b/mail/inc/class.mail_uipreferences.inc.php new file mode 100644 index 0000000000..91871572f7 --- /dev/null +++ b/mail/inc/class.mail_uipreferences.inc.php @@ -0,0 +1,161 @@ + + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ +include_once(EGW_INCLUDE_ROOT.'/etemplate/inc/class.etemplate.inc.php'); + +class mail_uipreferences +{ + var $public_functions = array + ( + 'index' => True, + 'edit' => True, + ); + + /** + * nextMatch name for index + * + * @var string + */ + static $nm_index = 'acc'; + + /** + * Reference to felamimail_bo + * + * @var felamimail_bo + */ + var $mail_bo; + + + /** + * Constructor + * + */ + function __construct($_signatureID = NULL) + { + $this->accountID = $GLOBALS['egw_info']['user']['account_id']; + $this->mail_bo = mail_bo::getInstance(true,$icServerID); + $this->bopreferences = $this->mail_bo->bopreferences; + + + } + + /** + * Main signature list page + * + * @param array $content=null + * @param string $msg=null + */ + function index(array $content=null,$msg=null) + { + //Instantiate an etemplate_new object + $tmpl = new etemplate_new('mail.accounts.index'); + if (!is_array($content)) + { + $content['acc']= $this->get_rows($rows,$readonlys); + + // Set content-menu actions + $tmpl->set_cell_attribute('acc', 'actions',$this->get_actions()); + + $sel_options = array( + 'status' => array( + 'ENABLED' => lang('Enabled'), + 'DISABLED' => lang('Disabled'), + ) + ); + } + if ($msg) + { + $content['msg'] = $msg; + } + else + { + unset($msg); + unset($content['msg']); + } + $tmpl->exec('mail.mail_uipreferences.index',$content,$sel_options,$readonlys); + + } + + /** + * Get actions / context menu for index + * + * Changes here, require to log out, as $content[self::$nm_index] get stored in session! + * @var &$action_links + * + * @return array see nextmatch_widget::egw_actions() + */ + private function get_actions(array &$action_links=array()) + { + $actions = array( + 'open' => array( + 'caption' => lang('Open'), + 'icon' => 'view', + 'group' => ++$group, + 'onExecute' => 'javaScript:app.mail.account_open', + 'allowOnMultiple' => false, + 'default' => true, + ), + 'delete' => array( + 'caption' => lang('delete'), + 'icon' => 'delete', + 'group' => ++$group, + 'onExecute' => 'javaScript:app.mail.account_delete', + 'allowOnMultiple' => false, + ), + ); + return $actions; + } + + /** + * Callback to fetch the rows for the nextmatch widget + * + * @param array $query + * @param array &$rows + * @param array &$readonlys + */ + function get_rows($query,&$rows) + { + if (!isset($this->bopreferences)) $this->bopreferences = CreateObject('mail_bopreferences'); + $preferences =& $this->bopreferences->getPreferences(); + $allAccountData = $this->bopreferences->getAllAccountData($preferences); + if ($allAccountData) { + foreach ($allAccountData as $tmpkey => $accountData) + { + $identity =& $accountData['identity']; + + #_debug_array($identity); + + foreach($identity as $key => $value) { + if(is_object($value) || is_array($value)) { + continue; + } + switch($key) { + default: + $tempvar[$key] = $value; + } + } + $tempvar['id_key']=$tmpkey; + $accountArray[]=$tempvar; + } + } + $rows =$accountArray;//we are fetching the rows here + foreach ($rows as $i => &$row) + { + $row['row_id']='account::'.($row['fm_accountid']?$row['fm_accountid']:$this->accountID).'::'.$row['id']; + $row['description'] = mail_bo::generateIdentityString($allAccountData[$row['id_key']]['identity']); + $row['default'] = ($row['default']?'Default':''); + } + array_unshift($rows,array(''=> '')); +//_debug_array($rows); + return $rows; + } +} +?> diff --git a/mail/templates/default/accounts.index.xet b/mail/templates/default/accounts.index.xet new file mode 100644 index 0000000000..5597033b44 --- /dev/null +++ b/mail/templates/default/accounts.index.xet @@ -0,0 +1,41 @@ + + + + +