* eMail: improvements regarding the handling of no emailprofile available

This commit is contained in:
Klaus Leithoff 2010-11-30 14:22:49 +00:00
parent c676cf3cc3
commit b33ace9bba
5 changed files with 163 additions and 104 deletions

View File

@ -85,8 +85,9 @@
} }
} }
function bofelamimail($_displayCharset='iso-8859-1',$_restoreSession=true) function bofelamimail($_displayCharset='iso-8859-1',$_restoreSession=true, $_profileID=0)
{ {
$this->profileID = $_profileID;
if ($_restoreSession) if ($_restoreSession)
{ {
//error_log(__METHOD__." Session restore ".function_backtrace()); //error_log(__METHOD__." Session restore ".function_backtrace());
@ -112,8 +113,8 @@
$this->mailPreferences = $this->bopreferences->getPreferences(); $this->mailPreferences = $this->bopreferences->getPreferences();
if ($this->mailPreferences) { if ($this->mailPreferences) {
$this->icServer = $this->mailPreferences->getIncomingServer(0); $this->icServer = $this->mailPreferences->getIncomingServer($this->profileID);
$this->ogServer = $this->mailPreferences->getOutgoingServer(0); $this->ogServer = $this->mailPreferences->getOutgoingServer($this->profileID);
$this->htmlOptions = $this->mailPreferences->preferences['htmlOptions']; $this->htmlOptions = $this->mailPreferences->preferences['htmlOptions'];
} }
#_debug_array($this->mailPreferences->preferences); #_debug_array($this->mailPreferences->preferences);
@ -129,6 +130,8 @@
{ {
// this should be under user preferences // this should be under user preferences
// sessionData empty // sessionData empty
// store active profileID
$this->sessionData['profileID'] = $_profileID;
// no filter active // no filter active
$this->sessionData['activeFilter'] = "-1"; $this->sessionData['activeFilter'] = "-1";
// default mailbox INBOX // default mailbox INBOX
@ -220,7 +223,7 @@
* this function is a wrapper function for emailadmin * this function is a wrapper function for emailadmin
* *
* @param _hookValues contains the hook values as array * @param _hookValues contains the hook values as array
* @returns nothing * @return nothing
*/ */
function addAccount($_hookValues) function addAccount($_hookValues)
{ {
@ -268,7 +271,7 @@
* @param string _body the body of the message * @param string _body the body of the message
* @param string _flags the imap flags to set for the saved message * @param string _flags the imap flags to set for the saved message
* *
* @returns the id of the message appended or false * @return the id of the message appended or false
*/ */
function appendMessage($_folderName, $_header, $_body, $_flags) function appendMessage($_folderName, $_header, $_body, $_flags)
{ {
@ -291,7 +294,7 @@
* remove any messages from the trashfolder * remove any messages from the trashfolder
* *
* @param string _folderName the foldername * @param string _folderName the foldername
* @returns nothing * @return nothing
*/ */
function compressFolder($_folderName = false) function compressFolder($_folderName = false)
{ {
@ -316,7 +319,7 @@
* @param string _folderName the new foldername * @param string _folderName the new foldername
* @param bool _subscribe subscribe to the new folder * @param bool _subscribe subscribe to the new folder
* *
* @returns mixed name of the newly created folder or false on error * @return mixed name of the newly created folder or false on error
*/ */
function createFolder($_parent, $_folderName, $_subscribe=false) function createFolder($_parent, $_folderName, $_subscribe=false)
{ {
@ -412,7 +415,7 @@
* *
* @param string _folderName the foldername * @param string _folderName the foldername
* *
* @returns string the converted foldername * @return string the converted foldername
*/ */
function decodeFolderName($_folderName) function decodeFolderName($_folderName)
{ {
@ -444,7 +447,7 @@
* decode header (or envelope information * decode header (or envelope information
* if array given, note that only values will be converted * if array given, note that only values will be converted
* @param $_string mixed input to be converted, if array call decode_header recursively on each value * @param $_string mixed input to be converted, if array call decode_header recursively on each value
* @returns mixed - based on the input type * @return mixed - based on the input type
*/ */
static function decode_header($_string) static function decode_header($_string)
{ {
@ -552,7 +555,7 @@
* *
* @param string _folderName the name of the folder to be deleted * @param string _folderName the name of the folder to be deleted
* *
* @returns bool true on success, false on failure * @return bool true on success, false on failure
*/ */
function deleteFolder($_folderName) function deleteFolder($_folderName)
{ {
@ -657,7 +660,7 @@
* *
* @param string _folderName the foldername * @param string _folderName the foldername
* *
* @returns string the converted string * @return string the converted string
*/ */
function encodeFolderName($_folderName) function encodeFolderName($_folderName)
{ {
@ -1137,7 +1140,7 @@
* @param string _partID the id of the part, which holds the attachment * @param string _partID the id of the part, which holds the attachment
* @param int _winmail_nr winmail.dat attachment nr. * @param int _winmail_nr winmail.dat attachment nr.
* *
* @returns array * @return array
*/ */
function getAttachment($_uid, $_partID, $_winmail_nr=0) function getAttachment($_uid, $_partID, $_winmail_nr=0)
{ {
@ -1255,6 +1258,34 @@
return $attachmentData; return $attachmentData;
} }
/**
* getIdentitiesWithAccounts
*
* @param array reference to pass all identities back
* @return the default Identity (active) or 0
*/
function getIdentitiesWithAccounts(&$identities)
{
// account select box
$selectedID = 0;
if($this->mailPreferences->userDefinedAccounts) $allAccountData = $this->bopreferences->getAllAccountData($this->mailPreferences);
if ($allAccountData) {
foreach ($allAccountData as $tmpkey => $accountData)
{
$identity =& $accountData['identity'];
$icServer =& $accountData['icServer'];
//_debug_array($identity);
//_debug_array($icServer);
if (empty($icServer->host)) continue;
$identities[$identity->id]=$identity->realName.' '.$identity->organization.' <'.$identity->emailAddress.'>';
if (!empty($identity->default)) $selectedID = $identity->id;
}
}
return $selectedID;
}
function getEMailProfile() function getEMailProfile()
{ {
$config = CreateObject('phpgwapi.config','felamimail'); $config = CreateObject('phpgwapi.config','felamimail');
@ -1282,7 +1313,7 @@
* *
* @param _folderName string the foldername * @param _folderName string the foldername
* *
* @returns array * @return array
*/ */
function getFolderStatus($_folderName) function getFolderStatus($_folderName)
{ {
@ -1355,7 +1386,7 @@
* @param _subscribedOnly boolean get subscribed or all folders * @param _subscribedOnly boolean get subscribed or all folders
* @param _getCounters boolean get get messages counters * @param _getCounters boolean get get messages counters
* *
* @returns array with folder objects. eg.: INBOX => {inbox object} * @return array with folder objects. eg.: INBOX => {inbox object}
*/ */
function getFolderObjects($_subscribedOnly=false, $_getCounters=false) function getFolderObjects($_subscribedOnly=false, $_getCounters=false)
{ {
@ -1698,8 +1729,8 @@
/** /**
* getMimePartCharset - fetches the charset mimepart if it exists * getMimePartCharset - fetches the charset mimepart if it exists
* @params $_mimePartObject structure object * @param $_mimePartObject structure object
* @returns mixed mimepart or false if no CHARSET is found, the missing charset has to be handled somewhere else, * @return mixed mimepart or false if no CHARSET is found, the missing charset has to be handled somewhere else,
* as we cannot safely assume any charset as we did earlier * as we cannot safely assume any charset as we did earlier
*/ */
function getMimePartCharset($_mimePartObject) function getMimePartCharset($_mimePartObject)
@ -2547,7 +2578,7 @@
/** /**
* normalizeBodyParts - function to gather and normalize all body Information * normalizeBodyParts - function to gather and normalize all body Information
* @param _bodyParts - Body Array * @param _bodyParts - Body Array
* @returns array - a normalized Bodyarray * @return array - a normalized Bodyarray
*/ */
static function normalizeBodyParts($_bodyParts) static function normalizeBodyParts($_bodyParts)
{ {
@ -2803,7 +2834,7 @@
* @param string _parent the parent foldername * @param string _parent the parent foldername
* @param string _folderName the new foldername * @param string _folderName the new foldername
* *
* @returns mixed name of the newly created folder or false on error * @return mixed name of the newly created folder or false on error
*/ */
function renameFolder($_oldFolderName, $_parent, $_folderName) function renameFolder($_oldFolderName, $_parent, $_folderName)
{ {
@ -2987,7 +3018,7 @@
* convert the foldername from display charset to UTF-7 * convert the foldername from display charset to UTF-7
* *
* @param string _parent the parent foldername * @param string _parent the parent foldername
* @returns ISO-8859-1 / UTF7-IMAP encoded string * @return ISO-8859-1 / UTF7-IMAP encoded string
*/ */
function _encodeFolderName($_folderName) { function _encodeFolderName($_folderName) {
return $GLOBALS['egw']->translation->convert($_folderName, self::$displayCharset, 'ISO-8859-1'); return $GLOBALS['egw']->translation->convert($_folderName, self::$displayCharset, 'ISO-8859-1');
@ -2998,7 +3029,7 @@
* convert the foldername from UTF-7 to display charset * convert the foldername from UTF-7 to display charset
* *
* @param string _parent the parent foldername * @param string _parent the parent foldername
* @returns ISO-8859-1 / self::$displayCharset encoded string * @return ISO-8859-1 / self::$displayCharset encoded string
*/ */
function _decodeFolderName($_folderName) { function _decodeFolderName($_folderName) {
return $GLOBALS['egw']->translation->convert($_folderName, self::$displayCharset, 'ISO-8859-1'); return $GLOBALS['egw']->translation->convert($_folderName, self::$displayCharset, 'ISO-8859-1');
@ -3009,7 +3040,7 @@
* convert the sort value from the gui(integer) into a string * convert the sort value from the gui(integer) into a string
* *
* @param int _sort the integer sort order * @param int _sort the integer sort order
* @returns the ascii sort string * @return the ascii sort string
*/ */
function _getSortString($_sort) function _getSortString($_sort)
{ {
@ -3207,7 +3238,7 @@
* detect_encoding - try to detect the encoding * detect_encoding - try to detect the encoding
* only to be used if the string in question has no structure that determines his encoding * only to be used if the string in question has no structure that determines his encoding
* @param string - to be evaluated * @param string - to be evaluated
* @returns mixed string/boolean (encoding or false * @return mixed string/boolean (encoding or false
*/ */
static function detect_encoding($string) { static function detect_encoding($string) {
static $list = array('utf-8', 'iso-8859-1', 'windows-1251'); // list may be extended static $list = array('utf-8', 'iso-8859-1', 'windows-1251'); // list may be extended
@ -3382,7 +3413,7 @@
* @param uid the uid of the email to be processed * @param uid the uid of the email to be processed
* @param partid the partid of the email * @param partid the partid of the email
* @param mailbox the mailbox, that holds the message * @param mailbox the mailbox, that holds the message
* @returns array with 'mailaddress'=>$mailaddress, * @return array with 'mailaddress'=>$mailaddress,
* 'subject'=>$subject, * 'subject'=>$subject,
* 'message'=>$message, * 'message'=>$message,
* 'attachments'=>$attachments, * 'attachments'=>$attachments,
@ -3469,8 +3500,8 @@
/** /**
* createHeaderInfoSection - creates a textual headersection from headerobject * createHeaderInfoSection - creates a textual headersection from headerobject
* @params header headerarray may contain SUBJECT,FROM,SENDER,TO,CC,BCC,DATE,PRIORITY,IMPORTANCE * @param header headerarray may contain SUBJECT,FROM,SENDER,TO,CC,BCC,DATE,PRIORITY,IMPORTANCE
* @returns string a preformatted string with the information of the header worked into it * @return string a preformatted string with the information of the header worked into it
*/ */
static function createHeaderInfoSection($header,$headline='') static function createHeaderInfoSection($header,$headline='')
{ {
@ -3501,8 +3532,8 @@
/** /**
* getdisplayableBody - creates the bodypart of the email as textual representation * getdisplayableBody - creates the bodypart of the email as textual representation
* @param bofelamimail the bofelamimailobject to be used * @param bofelamimail the bofelamimailobject to be used
* @params bodyPorts array with the bodyparts * @param bodyPorts array with the bodyparts
* @returns string a preformatted string with the mails converted to text * @return string a preformatted string with the mails converted to text
*/ */
static function &getdisplayableBody(&$bofelamimail, $bodyParts) static function &getdisplayableBody(&$bofelamimail, $bodyParts)
{ {

View File

@ -477,11 +477,13 @@ class felamimail_hooks
$menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu'); $menu_title = $GLOBALS['egw_info']['apps'][$appname]['title'] . ' '. lang('Menu');
$file = array(); $file = array();
$bofelamimail =& CreateObject('felamimail.bofelamimail',$GLOBALS['egw']->translation->charset()); $bofelamimail =& CreateObject('felamimail.bofelamimail',$GLOBALS['egw']->translation->charset());
$preferences = $bofelamimail->mailPreferences; $preferences =& $bofelamimail->mailPreferences;
$showMainScreenStuff = false; $showMainScreenStuff = false;
//error_log(__METHOD__.__LINE__.$_GET['menuaction']);
if(($_GET['menuaction'] == 'felamimail.uifelamimail.viewMainScreen' || if(($_GET['menuaction'] == 'felamimail.uifelamimail.viewMainScreen' ||
$_GET['menuaction'] == 'felamimail.uifelamimail.changeFolder' || $_GET['menuaction'] == 'felamimail.uifelamimail.changeFolder' ||
stripos($_GET['menuaction'],'ajax_sidebox') !== false) && stripos($_GET['menuaction'],'ajax_sidebox') !== false) &&
$_GET['menuaction'] != 'felamimail.uipreferences.editAccountData' &&
$_GET['menuaction'] != 'felamimail.uifelamimail.redirectToPreferences' && $_GET['menuaction'] != 'felamimail.uifelamimail.redirectToPreferences' &&
$_GET['menuaction'] != 'felamimail.uifelamimail.redirectToEmailadmin') { $_GET['menuaction'] != 'felamimail.uifelamimail.redirectToEmailadmin') {
/* seems to be, its not needed here, as viewMainScreen does it anyway /* seems to be, its not needed here, as viewMainScreen does it anyway
@ -593,43 +595,26 @@ class felamimail_hooks
'no_lang' => true, 'no_lang' => true,
); );
*/ */
// select account box, treeview // select account box, treeview, we use a whileloop as we may want to break out
if($showMainScreenStuff) { while($showMainScreenStuff) {
$bofelamimail->restoreSessionData(); $bofelamimail->restoreSessionData();
$mailbox = $bofelamimail->sessionData['mailbox'];; $mailbox = $bofelamimail->sessionData['mailbox'];;
//_debug_array($mailbox); //_debug_array($mailbox);
$icServerID = 0; $icServerID = $bofelamimail->profileID;
if (is_object($preferences)) if (is_object($preferences))
{ {
// gather profile data // gather profile data
$imapServer =& $preferences->getIncomingServer($icServerID); $imapServer =& $bofelamimail->icServer;
// account select box // account select box
$selectedID = 0; $selectedID = $bofelamimail->getIdentitiesWithAccounts($identities);
if($preferences->userDefinedAccounts) $allAccountData = $bofelamimail->bopreferences->getAllAccountData($preferences);
if ($allAccountData) {
foreach ($allAccountData as $tmpkey => $accountData)
{
$identity =& $accountData['identity'];
$icServer =& $accountData['icServer'];
//_debug_array($identity);
//_debug_array($icServer);
if (empty($icServer->host)) continue;
$identities[$identity->id]=$identity->realName.' '.$identity->organization.' <'.$identity->emailAddress.'>';
if (!empty($identity->default)) $selectedID = $identity->id;
}
}
// if nothing valid is found return to user defined account definition // if nothing valid is found return to user defined account definition
// todo klaus: can you move this redirect out of the sidebox on felamimail/index.php
if (empty($imapServer->host) && count($identities)==0 && $preferences->userDefinedAccounts) if (empty($imapServer->host) && count($identities)==0 && $preferences->userDefinedAccounts)
{ {
// redirect to new personal account $showMainScreenStuff= false;
egw::redirect_link('/index.php',array('menuaction'=>'felamimail.uipreferences.editAccountData', break;
'accountID'=>"new",
'msg' => lang("There is no IMAP Server configured.")." - ".lang("Please configure access to an existing individual IMAP account."),
));
} }
$activeIdentity =& $preferences->getIdentity($icServerID); $activeIdentity =& $preferences->getIdentity($icServerID);
if ($imapServer->_connected != 1) $connectionStatus = $bofelamimail->openConnection($icServerID); if ($imapServer->_connected != 1) $connectionStatus = $bofelamimail->openConnection($icServerID);
$folderObjects = $bofelamimail->getFolderObjects(true, false); $folderObjects = $bofelamimail->getFolderObjects(true, false);
@ -685,6 +670,7 @@ class felamimail_hooks
'icon' => False, 'icon' => False,
); );
} }
break; // kill the while loop as we need only one go
} }
// display them all // display them all
display_sidebox($appname,$menu_title,$file); display_sidebox($appname,$menu_title,$file);

View File

@ -57,8 +57,22 @@
$this->bofilter = CreateObject('felamimail.bofilter',false); $this->bofilter = CreateObject('felamimail.bofilter',false);
$this->bopreferences =& $this->bofelamimail->bopreferences; //CreateObject('felamimail.bopreferences'); $this->bopreferences =& $this->bofelamimail->bopreferences; //CreateObject('felamimail.bopreferences');
$this->preferences = $this->bopreferences->getPreferences(); $this->preferences =& $this->bofelamimail->mailPreferences;
if (is_object($this->preferences))
{
// account select box
$selectedID = $this->bofelamimail->getIdentitiesWithAccounts($identities);
// if nothing valid is found return to user defined account definition
if (empty($this->bofelamimail->icServer->host) && count($identities)==0 && $this->preferences->userDefinedAccounts)
{
// redirect to new personal account
egw::redirect_link('/index.php',array('menuaction'=>'felamimail.uipreferences.editAccountData',
'accountID'=>"new",
'msg' => lang("There is no IMAP Server configured.")." - ".lang("Please configure access to an existing individual IMAP account."),
));
}
}
$this->bofelamimail->saveSessionData(); $this->bofelamimail->saveSessionData();
$this->mailbox = $this->bofelamimail->sessionData['mailbox']; $this->mailbox = $this->bofelamimail->sessionData['mailbox'];

View File

@ -1,20 +1,21 @@
<?php <?php
/***************************************************************************\ /**
* eGroupWare - FeLaMiMail * * EGroupware - FeLaMiMail - preference user interface
* http://www.linux-at-work.de * *
* http://www.phpgw.de * * @link http://www.egroupware.org
* http://www.egroupware.org * * @package felamimail
* Written by : Lars Kneschke [lkneschke@linux-at-work.de] * * @author Lars Kneschke [lkneschke@linux-at-work.de]
* ------------------------------------------------- * * @author Klaus Leithoff [kl@stylite.de]
* This program is free software; you can redistribute it and/or modify it * * @copyright (c) 2009-10 by Klaus Leithoff <kl-AT-stylite.de>
* under the terms of the GNU General Public License as published by the * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* Free Software Foundation; either version 2 of the License, or (at your * * @version $Id$
* option) any later version. * */
\***************************************************************************/
/* $Id$ */ /**
* FeLaMiMail preference user interface class, provides UI functionality for preferences/actions like
require_once(EGW_INCLUDE_ROOT.'/felamimail/inc/class.felamimail_bosignatures.inc.php'); * managing folders, acls, signatures, rules
*/
require_once(EGW_INCLUDE_ROOT.'/felamimail/inc/class.felamimail_bosignatures.inc.php');
class uipreferences class uipreferences
{ {
@ -37,13 +38,26 @@
{ {
$this->t = $GLOBALS['egw']->template; $this->t = $GLOBALS['egw']->template;
$this->charset = $GLOBALS['egw']->translation->charset(); $this->charset = $GLOBALS['egw']->translation->charset();
$this->bofelamimail = CreateObject('felamimail.bofelamimail',$GLOBALS['egw']->translation->charset()); $this->bofelamimail = CreateObject('felamimail.bofelamimail',$GLOBALS['egw']->translation->charset());
$this->bopreferences = $this->bofelamimail->bopreferences; //CreateObject('felamimail.bopreferences'); $this->bopreferences =& $this->bofelamimail->bopreferences; //CreateObject('felamimail.bopreferences');
$this->uiwidgets = CreateObject('felamimail.uiwidgets'); $this->uiwidgets = CreateObject('felamimail.uiwidgets');
if (is_object($this->bofelamimail->mailPreferences))
{
// account select box
$selectedID = $this->bofelamimail->getIdentitiesWithAccounts($identities);
// if nothing valid is found return to user defined account definition
if (empty($this->bofelamimail->icServer->host) && count($identities)==0 && $this->bofelamimail->mailPreferences->userDefinedAccounts)
{
// redirect to new personal account
$this->editAccountData(lang("There is no IMAP Server configured.")." - ".lang("Please configure access to an existing individual IMAP account."), 'new');
exit;
}
}
$this->bofelamimail->openConnection(); $this->bofelamimail->openConnection();
$this->rowColor[0] = $GLOBALS['egw_info']["theme"]["bg01"]; $this->rowColor[0] = $GLOBALS['egw_info']["theme"]["bg01"];
$this->rowColor[1] = $GLOBALS['egw_info']["theme"]["bg02"]; $this->rowColor[1] = $GLOBALS['egw_info']["theme"]["bg02"];
} }
@ -68,30 +82,30 @@
switch($_GET['menuaction']) switch($_GET['menuaction'])
{ {
case 'felamimail.uipreferences.editSignature': case 'felamimail.uipreferences.editSignature':
$GLOBALS['egw']->js->validate_file('jscode','listSignatures','felamimail'); egw_framework::validate_file('jscode','listSignatures','felamimail');
egw_framework::validate_file('ckeditor3','ckeditor','phpgwapi'); egw_framework::validate_file('ckeditor3','ckeditor','phpgwapi');
#$GLOBALS['egw']->js->set_onload('fm_initEditLayout();'); #$GLOBALS['egw']->js->set_onload('fm_initEditLayout();');
break; break;
case 'felamimail.uipreferences.listAccountData': case 'felamimail.uipreferences.listAccountData':
case 'felamimail.uipreferences.editAccountData': case 'felamimail.uipreferences.editAccountData':
$GLOBALS['egw']->js->validate_file('tabs','tabs'); egw_framework::validate_file('tabs','tabs');
$GLOBALS['egw']->js->validate_file('jscode','editAccountData','felamimail'); egw_framework::validate_file('jscode','editAccountData','felamimail');
$GLOBALS['egw']->js->set_onload('javascript:initEditAccountData();'); $GLOBALS['egw']->js->set_onload('javascript:initEditAccountData();');
$GLOBALS['egw']->js->set_onload('javascript:initTabs();'); $GLOBALS['egw']->js->set_onload('javascript:initTabs();');
break; break;
case 'felamimail.uipreferences.listSignatures': case 'felamimail.uipreferences.listSignatures':
$GLOBALS['egw']->js->validate_file('jscode','listSignatures','felamimail'); egw_framework::validate_file('jscode','listSignatures','felamimail');
#$GLOBALS['egw']->js->set_onload('javascript:initEditAccountData();'); #$GLOBALS['egw']->js->set_onload('javascript:initEditAccountData();');
break; break;
case 'felamimail.uipreferences.listFolder': case 'felamimail.uipreferences.listFolder':
case 'felamimail.uipreferences.addACL': case 'felamimail.uipreferences.addACL':
case 'felamimail.uipreferences.listSelectFolder': case 'felamimail.uipreferences.listSelectFolder':
$GLOBALS['egw']->js->validate_file('tabs','tabs'); egw_framework::validate_file('tabs','tabs');
$GLOBALS['egw']->js->validate_file('dhtmlxtree','js/dhtmlXCommon'); egw_framework::validate_file('dhtmlxtree','js/dhtmlXCommon');
$GLOBALS['egw']->js->validate_file('dhtmlxtree','js/dhtmlXTree'); egw_framework::validate_file('dhtmlxtree','js/dhtmlXTree');
$GLOBALS['egw']->js->validate_file('jscode','listFolder','felamimail'); egw_framework::validate_file('jscode','listFolder','felamimail');
$GLOBALS['egw']->js->set_onload('javascript:initAll();'); $GLOBALS['egw']->js->set_onload('javascript:initAll();');
break; break;
} }
@ -100,7 +114,7 @@
$GLOBALS['egw']->common->egw_header(); $GLOBALS['egw']->common->egw_header();
if($_displayNavbar == TRUE) if($_displayNavbar == TRUE)
echo parse_navbar(); echo $GLOBALS['egw']->framework->navbar();
} }
function editForwardingAddress() function editForwardingAddress()
@ -175,7 +189,7 @@
$this->t->set_var('tinymce',html::fckEditorQuick( $this->t->set_var('tinymce',html::fckEditorQuick(
'signature', 'advanced', 'signature', 'advanced',
$signatureData->fm_signature, $signatureData->fm_signature,
$height) $height,'100%',false)
); );
$this->t->set_var('checkbox_isDefaultSignature',html::checkbox( $this->t->set_var('checkbox_isDefaultSignature',html::checkbox(
@ -187,7 +201,7 @@
); );
} else { } else {
$this->t->set_var('description',''); $this->t->set_var('description','');
$this->t->set_var('tinymce',html::fckEditorQuick('signature', 'advanced', '', $height)); $this->t->set_var('tinymce',html::fckEditorQuick('signature', 'advanced', '', $height,'100%',false));
$this->t->set_var('checkbox_isDefaultSignature',html::checkbox( $this->t->set_var('checkbox_isDefaultSignature',html::checkbox(
'isDefaultSignature', false, 'true', 'id="isDefaultSignature"' 'isDefaultSignature', false, 'true', 'id="isDefaultSignature"'
@ -198,7 +212,7 @@
$this->t->pparse("out","main"); $this->t->pparse("out","main");
} }
function editAccountData($msg='') function editAccountData($msg='', $account2retrieve='active')
{ {
if ($_GET['msg']) $msg = html::purify($_GET['msg']); if ($_GET['msg']) $msg = html::purify($_GET['msg']);
if (!isset($this->bofelamimail)) $this->bofelamimail = CreateObject('felamimail.bofelamimail',$GLOBALS['egw']->translation->charset()); if (!isset($this->bofelamimail)) $this->bofelamimail = CreateObject('felamimail.bofelamimail',$GLOBALS['egw']->translation->charset());
@ -276,7 +290,7 @@
if($this->bofelamimail->openConnection()) { if($this->bofelamimail->openConnection()) {
$folderObjects = $this->bofelamimail->getFolderObjects(); $folderObjects = $this->bofelamimail->getFolderObjects();
foreach($folderObjects as $folderName => $folderInfo) { foreach($folderObjects as $folderName => $folderInfo) {
#_debug_array($folderData); //_debug_array($folderInfo);
$folderList[$folderName] = $folderInfo->displayName; $folderList[$folderName] = $folderInfo->displayName;
} }
$this->bofelamimail->closeConnection(); $this->bofelamimail->closeConnection();
@ -290,7 +304,6 @@
$this->translate(); $this->translate();
// if there is no accountID with the call of the edit method, retrieve an active account // if there is no accountID with the call of the edit method, retrieve an active account
$account2retrieve = 'active';
if ((int)$_GET['accountID']) { if ((int)$_GET['accountID']) {
$account2retrieve = $_GET['accountID']; $account2retrieve = $_GET['accountID'];
} }

View File

@ -61,16 +61,31 @@
$this->displayCharset = $GLOBALS['egw']->translation->charset(); $this->displayCharset = $GLOBALS['egw']->translation->charset();
$this->t =& CreateObject('phpgwapi.Template',EGW_APP_TPL); $this->t =& CreateObject('phpgwapi.Template',EGW_APP_TPL);
$this->botranslation = $GLOBALS['egw']->translation; $this->botranslation =& $GLOBALS['egw']->translation;
$this->bopreferences =& CreateObject('felamimail.bopreferences'); $this->bofelamimail = CreateObject('felamimail.bofelamimail',$GLOBALS['egw']->translation->charset());
$this->mailPreferences = $this->bopreferences->getPreferences(); if (is_object($this->bofelamimail->mailPreferences))
{
// account select box
$selectedID = $this->bofelamimail->getIdentitiesWithAccounts($identities);
// if nothing valid is found return to user defined account definition
if (empty($this->bofelamimail->icServer->host) && count($identities)==0 && $this->bofelamimail->mailPreferences->userDefinedAccounts)
{
// redirect to new personal account
egw::redirect_link('/index.php',array('menuaction'=>'felamimail.uipreferences.editAccountData',
'accountID'=>"new",
'msg' => lang("There is no IMAP Server configured.")." - ".lang("Please configure access to an existing individual IMAP account."),
));
}
}
$this->mailPreferences =& $this->bofelamimail->mailPreferences;
$this->felamimailConfig = config::read('felamimail'); $this->felamimailConfig = config::read('felamimail');
$this->restoreSessionData(); $this->restoreSessionData();
$icServer = $this->mailPreferences->getIncomingServer(0); $icServer = $this->bofelamimail->icServer;
if(is_a($icServer,'defaultimap') && $icServer->enableSieve) { if(is_a($icServer,'defaultimap') && $icServer->enableSieve) {
$this->bosieve = $icServer; $this->bosieve = $icServer;
@ -320,9 +335,9 @@
else else
$editMode = 'filter'; $editMode = 'filter';
$GLOBALS['egw']->js->validate_file('tabs','tabs'); egw_framework::validate_file('tabs','tabs');
$GLOBALS['egw']->js->validate_file('jscode','editProfile','felamimail'); egw_framework::validate_file('jscode','editProfile','felamimail');
$GLOBALS['egw']->js->validate_file('jscode','listSieveRules','felamimail'); egw_framework::validate_file('jscode','listSieveRules','felamimail');
$GLOBALS['egw']->js->set_onload("javascript:initAll('$editMode');"); $GLOBALS['egw']->js->set_onload("javascript:initAll('$editMode');");
if($_GET['menuaction'] == 'felamimail.uisieve.editRule') { if($_GET['menuaction'] == 'felamimail.uisieve.editRule') {
$GLOBALS['egw']->js->set_onunload('opener.fm_sieve_cancelReload();'); $GLOBALS['egw']->js->set_onunload('opener.fm_sieve_cancelReload();');
@ -334,13 +349,13 @@
case 'felamimail.uisieve.editRule': case 'felamimail.uisieve.editRule':
break; break;
default: default:
echo parse_navbar(); echo $GLOBALS['egw']->framework->navbar();
break; break;
} }
} }
function displayRule($_ruleID, $_ruleData, $msg='') { function displayRule($_ruleID, $_ruleData, $msg='') {
$preferences = $this->mailPreferences; $preferences =& $this->mailPreferences;
// display the header // display the header
$this->display_app_header(); $this->display_app_header();
$msg = html::purify($msg); $msg = html::purify($msg);
@ -414,7 +429,7 @@
function editRule() function editRule()
{ {
$preferences = $this->mailPreferences; $preferences =& $this->mailPreferences;
$msg = ''; $msg = '';
$error = 0; $error = 0;
$this->getRules(); /* ADDED BY GHORTH */ $this->getRules(); /* ADDED BY GHORTH */
@ -519,7 +534,7 @@
} }
function editVacation() { function editVacation() {
$preferences = $this->mailPreferences; $preferences =& $this->mailPreferences;
if(!(empty($preferences->preferences['prefpreventabsentnotice']) || $preferences->preferences['prefpreventabsentnotice'] == 0)) if(!(empty($preferences->preferences['prefpreventabsentnotice']) || $preferences->preferences['prefpreventabsentnotice'] == 0))
{ {
die('You should not be here!'); die('You should not be here!');
@ -698,7 +713,7 @@
} }
function editEmailNotification() { function editEmailNotification() {
$preferences = ExecMethod('felamimail.bopreferences.getPreferences'); $preferences =& $this->mailPreferences;
if(!(empty($preferences->preferences['prefpreventnotificationformailviaemail']) || $preferences->preferences['prefpreventnotificationformailviaemail'] == 0)) if(!(empty($preferences->preferences['prefpreventnotificationformailviaemail']) || $preferences->preferences['prefpreventnotificationformailviaemail'] == 0))
die('You should not be here!'); die('You should not be here!');
@ -785,7 +800,7 @@
function listRules() function listRules()
{ {
$preferences = ExecMethod('felamimail.bopreferences.getPreferences'); $preferences =& $this->mailPreferences;
if(!(empty($preferences->preferences['prefpreventeditfilterrules']) || $preferences->preferences['prefpreventeditfilterrules'] == 0)) if(!(empty($preferences->preferences['prefpreventeditfilterrules']) || $preferences->preferences['prefpreventeditfilterrules'] == 0))
die('You should not be here!'); die('You should not be here!');
@ -911,12 +926,12 @@
function selectFolder() function selectFolder()
{ {
$GLOBALS['egw']->js->validate_file('dhtmlxtree','js/dhtmlXCommon'); egw_framework::validate_file('dhtmlxtree','js/dhtmlXCommon');
$GLOBALS['egw']->js->validate_file('dhtmlxtree','js/dhtmlXTree'); egw_framework::validate_file('dhtmlxtree','js/dhtmlXTree');
$GLOBALS['egw']->js->validate_file('jscode','editSieveRule','felamimail'); egw_framework::validate_file('jscode','editSieveRule','felamimail');
$GLOBALS['egw']->common->egw_header(); $GLOBALS['egw']->common->egw_header();
$bofelamimail =& CreateObject('felamimail.bofelamimail',$this->displayCharset); $bofelamimail =& $this->bofelamimail;
$uiwidgets =& CreateObject('felamimail.uiwidgets'); $uiwidgets =& CreateObject('felamimail.uiwidgets');
$connectionStatus = $bofelamimail->openConnection(); $connectionStatus = $bofelamimail->openConnection();