Author: ralfbecker
New Revision: 55995
URL: http://svn.stylite.de/viewvc/egroupware?rev=55995&view=rev
Log:
using new api for mail app
Added:
trunk/egroupware/api/src/Etemplate/KeyManager.php
- copied, changed from r55990, trunk/phpgwapi/inc/class.egw_keymanager.inc.php
Modified:
trunk/egroupware/doc/fix_api.php
trunk/mail/inc/class.mail_acl.inc.php
trunk/mail/inc/class.mail_compose.inc.php
trunk/mail/inc/class.mail_hooks.inc.php
trunk/mail/inc/class.mail_integration.inc.php
trunk/mail/inc/class.mail_sieve.inc.php
trunk/mail/inc/class.mail_tree.inc.php
trunk/mail/inc/class.mail_ui.inc.php
trunk/mail/inc/class.mail_wizard.inc.php
trunk/mail/inc/class.mail_zpush.inc.php
trunk/mail/setup/default_records.inc.php
trunk/mail/setup/setup.inc.php
trunk/phpgwapi/inc/class.egw_keymanager.inc.php
— trunk/phpgwapi/inc/class.egw_keymanager.inc.php (original)
+++ trunk/egroupware/api/src/Etemplate/KeyManager.php Tue May 3 21:17:44 2016
@@ -1,17 +1,19 @@
<?php
/**
- * eGroupWare API: contains classes and key constants for generating shortcuts
+ * EGroupware API: contains classes and key constants for generating shortcuts
*
* @link http://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package api
- * @subpackage egw action grid
+ * @subpackage etemplate
* @author Andreas Stöckel
* @copyright (c) 2011 Stylite
* @version $Id$
*/
-class egw_keymanager
+namespace EGroupware\Api\Etemplate;
+
+class KeyManager
{
const BACKSPACE = 8;
const TAB = 9;
Modified: trunk/egroupware/doc/fix_api.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/doc/fix_api.php?rev=55995&r1=55994&r2=55995&view=diff
==============================================================================
--- trunk/egroupware/doc/fix_api.php (original)
+++ trunk/egroupware/doc/fix_api.php Tue May 3 21:17:44 2016
@@ -44,7 +44,7 @@
"#\\\$GLOBALS\['egw'\]->preferences->change#" => '$GLOBALS[\'egw\']->preferences->add',
);
// enclose class-names and static methods with some syntax check
-$class_start = '#(?<!function)([\[\s,;().!])';
+$class_start = '#(? 'Api\\Accounts',
@@ -158,6 +158,7 @@
'etemplate_request' => 'Api\\Etemplate\\Request',
'nextmatch_widget::category_action' => 'Api\\Etemplate\\Widget\\Nextmatch::category_action',
'nextmatch_widget::DEFAULT_MAX_MENU_LENGTH' => 'Api\\Etemplate\\Widget\\Nextmatch::DEFAULT_MAX_MENU_LENGTH',
+ 'egw_keymanager' => 'Api\\Etemplate\\KeyManager',
// so_sql and friends
'so_sql' => 'Api\\Storage\\Base',
'so_sql_cf' => 'Api\\Storage',
@@ -167,6 +168,7 @@
// addressbook backend
'addressbook_bo' => 'Api\\Contacts',
'addressbook_so' => 'Api\\Contacts\\Storage',
+ 'addressbook_merge' => 'Api\\Contacts\\Merge',
) as $from => $to)
{
$replace[$class_start.$from.$class_end] = '$1'.$to.'$2';
Modified: trunk/mail/inc/class.mail_acl.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/mail/inc/class.mail_acl.inc.php?rev=55995&r1=55994&r2=55995&view=diff
==============================================================================
--- trunk/mail/inc/class.mail_acl.inc.php (original)
+++ trunk/mail/inc/class.mail_acl.inc.php Tue May 3 21:17:44 2016
@@ -11,6 +11,8 @@
*/
use EGroupware\Api;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Etemplate;
use EGroupware\Api\Mail;
class mail_acl
@@ -61,13 +63,13 @@
*/
function edit(array $content=null ,$msg='')
{
- $tmpl = new Api\Etemplate('mail.acl');
+ $tmpl = new Etemplate('mail.acl');
if (!is_array($content))
{
$acc_id = $_GET['acc_id']?$_GET['acc_id']:$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
if (isset($_GET['account_id']) && !isset($GLOBALS['egw_info']['user']['apps']['admin']))
{
- egw_framework::window_close(lang('Permission denied'));
+ Framework::window_close(lang('Permission denied'));
}
$account_id = $_GET['account_id'];
}
@@ -175,12 +177,12 @@
$msg .= "\n".lang("Error: Could not save ACL").' '.lang("reason!");
}
//Send message
- egw_framework::message($msg);
+ Framework::message($msg);
if ($button == "apply") break;
//Fall through
case 'cancel':
- egw_framework::window_close();
+ Framework::window_close();
exit;
case 'delete':
@@ -193,7 +195,7 @@
{
error_log(__METHOD__.__LINE__. "()" . "The remove_acl suppose to return an array back, something is wrong there");
}
- egw_framework::message($msg);
+ Framework::message($msg);
}
}
$readonlys = $sel_options = array();
@@ -239,13 +241,13 @@
/**
* Autocomplete for folder taglist
*
- * @throws egw_exception_no_permission_admin
+ * @throws Api\Exception\NoPermission\Admin
*/
public static function ajax_folders()
{
if (!empty($_GET['account_id']) && !$GLOBALS['egw_info']['user']['apps']['admin'])
{
- throw new egw_exception_no_permission_admin;
+ throw new Api\Exception\NoPermission\Admin;
}
$account = Mail\Account::read($_GET['acc_id'], $_GET['account_id']);
$imap = $account->imapServer(!empty($_GET['account_id']) ? (int)$_GET['account_id'] : false);
@@ -263,7 +265,7 @@
}
}
// switch regular JSON response handling off
- egw_json_request::isJSONRequest(false);
+ Api\Json\Request::isJSONRequest(false);
header('Content-Type: application/json; charset=utf-8');
echo json_encode($folders);
Modified: trunk/mail/inc/class.mail_compose.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/mail/inc/class.mail_compose.inc.php?rev=55995&r1=55994&r2=55995&view=diff
==============================================================================
--- trunk/mail/inc/class.mail_compose.inc.php (original)
+++ trunk/mail/inc/class.mail_compose.inc.php Tue May 3 21:17:44 2016
@@ -11,6 +11,11 @@
*/
use EGroupware\Api;
+use EGroupware\Api\Link;
+use EGroupware\Api\Framework;
+use EGroupware\Api\Egw;
+use EGroupware\Api\Acl;
+use EGroupware\Api\Etemplate;
use EGroupware\Api\Vfs;
use EGroupware\Api\Mail;
@@ -65,7 +70,7 @@
function __construct()
{
- $this->displayCharset = translation::charset();
+ $this->displayCharset = Api\Translation::charset();
$profileID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
$this->mail_bo = Mail::getInstance(true,$profileID);
@@ -232,7 +237,7 @@
{
$actions['prty']['children'][$content['priority']]['default'] = true;
}
- if (html::$ua_mobile)
+ if (Api\Header\UserAgent::mobile())
{
foreach (array_keys($actions) as $key)
{
@@ -256,7 +261,7 @@
*/
function compose(array $_content=null,$msg=null, $_focusElement='to',$suppressSigOnTop=false, $isReply=false)
{
- if ($msg) egw_framework::message($msg);
+ if ($msg) Framework::message($msg);
if (!empty($GLOBALS['egw_info']['user']['preferences']['mail']['LastSignatureIDUsed']))
{
@@ -350,16 +355,16 @@
{
$upload['file'] = $upload['tmp_name'] = Mail::checkFileBasics($upload,$this->composeID,false);
}
- catch (egw_exception_wrong_userinput $e)
- {
- egw_framework::message($e->getMessage(), 'error');
+ catch (Api\Exception\WrongUserinput $e)
+ {
+ Framework::message($e->getMessage(), 'error');
unset($_content['uploadForCompose'][$i]);
continue;
}
if (is_dir($upload['file']) && (!$_content['filemode'] || $_content['filemode'] == Vfs\Sharing::ATTACH))
{
$_content['filemode'] = Vfs\Sharing::READONLY;
- egw_framework::message(lang('Directories have to be shared.'), 'info');
+ Framework::message(lang('Directories have to be shared.'), 'info');
}
}
}
@@ -449,7 +454,7 @@
$GLOBALS['egw']->preferences->save_repository(true);
}
}
- catch (egw_exception_wrong_userinput $e)
+ catch (Api\Exception\WrongUserinput $e)
{
$sendOK = false;
$message = $e->getMessage();
@@ -494,7 +499,7 @@
$rhA = mail_ui::splitRowID($_content['processedmail_id']);
$idsForRefresh[] = mail_ui::generateRowID($rhA['profileID'], $rhA['folder'], $rhA['msgUID'], $_prependApp=false);
}
- $response = egw_json_response::get();
+ $response = Api\Json\Response::get();
if ($activeProfile != $composeProfile)
{
// we need a message only, when account ids (composeProfile vs. activeProfile) differ
@@ -518,12 +523,12 @@
$response->call('opener.egw_message',lang('Message send successfully.'));
}
//egw_framework::refresh_opener(lang('Message send successfully.'),'mail');
- egw_framework::window_close();
+ Framework::window_close();
}
if ($sendOK == false)
{
- $response = egw_json_response::get();
- egw_framework::message(lang('Message send failed: %1',$message),'error');// maybe error is more appropriate
+ $response = Api\Json\Response::get();
+ Framework::message(lang('Message send failed: %1',$message),'error');// maybe error is more appropriate
$response->call('app.mail.clearIntevals');
}
}
@@ -552,7 +557,7 @@
$suppressSigOnTop = true;
if (stripos($content['mail_htmltext'],'
')!==false)
{
- $contentArr = translation::splithtmlByPRE($content['mail_htmltext']);
+ $contentArr = Api\Mail\Html::splithtmlByPRE($content['mail_htmltext']);
if (is_array($contentArr))
{
foreach ($contentArr as $k =>&$elem)
@@ -563,7 +568,7 @@
}
}
$content['mail_htmltext'] = $this->_getCleanHTML($content['mail_htmltext']);
- $content['mail_htmltext'] = translation::convertHTMLToText($content['mail_htmltext'],$charset=false,false,true);
+ $content['mail_htmltext'] = Api\Mail\Html::convertHTMLToText($content['mail_htmltext'],$charset=false,false,true);
$content['body'] = $content['mail_htmltext'];
unset($content['mail_htmltext']);
@@ -665,7 +670,7 @@
{
$content['body'] = str_replace("\n",'\n',$content['body']); // dont know why, but \n screws up preg_replace
$styles = Mail::getStyles(array(array('body'=>$content['body'])));
- if (stripos($content['body'],'style')!==false) translation::replaceTagsCompletley($content['body'],'style',$endtag='',true); // clean out empty or pagewide style definitions / left over tags
+ if (stripos($content['body'],'style')!==false) Api\Mail\Html::replaceTagsCompletley($content['body'],'style',$endtag='',true); // clean out empty or pagewide style definitions / left over tags
}
$content['body'] = str_replace(array("\r","\t","
\n",": "),array("","","
",":"),($_currentMode == 'html'?html::purify($content['body'],Mail::$htmLawed_config,array(),true):$content['body']));
Mail::$htmLawed_config = $_htmlConfig;
@@ -747,7 +752,7 @@
$mt = $_REQUEST['method'];
$id = $_REQUEST['id'];
// passed method MUST be registered
- $method = egw_link::get_registry($app,$mt);
+ $method = Link::get_registry($app,$mt);
//error_log(__METHOD__.__LINE__.array2string($method));
if ($method)
{
@@ -905,13 +910,13 @@
// special handling for attaching vCard of iCal --> use their link-title as name
if (substr($path,-7) != '/.entry' ||
!(list($app,$id) = array_slice(explode('/',$path),-3)) ||
- !($name = egw_link::title($app, $id)))
+ !($name = Link::title($app, $id)))
{
$name = Vfs::decodePath(Vfs::basename($path));
}
else
{
- $name .= '.'.mime_magic::mime2ext($type);
+ $name .= '.'.Api\MimeMagic::mime2ext($type);
}
// use type specified by caller, if Vfs reports only default, or contains specified type (eg. "text/vcard; charset=utf-8")
if (!empty($types[$k]) && ($type == 'application/octet-stream' || stripos($types[$k], $type) === 0))
@@ -928,14 +933,14 @@
if ($formData['type'] == Vfs::DIR_MIME_TYPE && $content['filemode'] == Vfs\Sharing::ATTACH)
{
$content['filemode'] = Vfs\Sharing::READONLY;
- egw_framework::message(lang('Directories have to be shared.'), 'info');
+ Framework::message(lang('Directories have to be shared.'), 'info');
}
}
elseif(is_readable($path))
{
$formData = array(
'name' => isset($names[$k]) ? $names[$k] : basename($path),
- 'type' => isset($types[$k]) ? $types[$k] : (function_exists('mime_content_type') ? mime_content_type($path) : mime_magic::filename2mime($path)),
+ 'type' => isset($types[$k]) ? $types[$k] : (function_exists('mime_content_type') ? mime_content_type($path) : Api\MimeMagic::filename2mime($path)),
'file' => $path,
'size' => filesize($path),
);
@@ -991,8 +996,8 @@
$content['to'] = $email;
}
}
- if (strpos($content['to'],'%40')!== false) $content['to'] = html::purify(str_replace('%40','@',$content['to']));
- $rarr = array(html::purify($rest));
+ if (strpos($content['to'],'%40')!== false) $content['to'] = Api\Html::purify(str_replace('%40','@',$content['to']));
+ $rarr = array(Api\Html::purify($rest));
if (isset($rest)&&!empty($rest) && strpos($rest,'&')!== false) $rarr = explode('&',$rest);
//error_log(__METHOD__.__LINE__.$content['to'].'->'.array2string($rarr));
$karr = array();
@@ -1011,7 +1016,7 @@
{
if ($karr[$name]) $content[$name] = $karr[$name];
}
- if (!empty($_REQUEST['subject'])) $content['subject'] = html::purify(trim(html_entity_decode($_REQUEST['subject'])));
+ if (!empty($_REQUEST['subject'])) $content['subject'] = Api\Html::purify(trim(html_entity_decode($_REQUEST['subject'])));
}
}
//error_log(__METHOD__.__LINE__.array2string($content));
@@ -1054,7 +1059,7 @@
}
}
- if ($content['mimeType'] == 'html' && html::htmlarea_availible()===false)
+ if ($content['mimeType'] == 'html' && Api\Html::htmlarea_availible()===false)
{
$_content['mimeType'] = $content['mimeType'] = 'plain';
$content['body'] = $this->convertHTMLToText($content['body']);
@@ -1152,7 +1157,7 @@
// prepare body
// in a way, this tests if we are having real utf-8 (the displayCharset) by now; we should if charsets reported (or detected) are correct
- $content['body'] = translation::convert_jsonsafe($content['body'],'utf-8');
+ $content['body'] = Api\Translation::convert_jsonsafe($content['body'],'utf-8');
//error_log(__METHOD__.__LINE__.array2string($content));
// get identities of all accounts as "$acc_id:$ident_id" => $identity
@@ -1254,7 +1259,7 @@
$sel_options['filemode'] = Vfs\Sharing::$modes;
if (!isset($content['priority']) || empty($content['priority'])) $content['priority']=3;
//$GLOBALS['egw_info']['flags']['currentapp'] = 'mail';//should not be needed
- $etpl = new Api\Etemplate('mail.compose');
+ $etpl = new Etemplate('mail.compose');
$etpl->setElementAttribute('composeToolbar', 'actions', $this->getToolbarActions($_content));
if ($content['mimeType']=='html')
@@ -1404,7 +1409,7 @@
* Use ajax_merge to merge & send multiple
*/
// Merge selected ID (in mailtocontactbyid or $mail_id) into given document
- $merge_class = preg_match('/^([a-z_-]+_merge)$/', $_REQUEST['merge']) ? $_REQUEST['merge'] : 'addressbook_merge';
+ $merge_class = preg_match('/^([a-z_-]+_merge)$/', $_REQUEST['merge']) ? $_REQUEST['merge'] : 'EGroupware\\Api\\Contacts\\Merge';
$document_merge = new $merge_class();
$this->mail_bo->openConnection();
$merge_ids = $_REQUEST['preset']['mailtocontactbyid'] ? $_REQUEST['preset']['mailtocontactbyid'] : $mail_id;
@@ -1439,11 +1444,11 @@
{
$success = implode(', ',$results['success']);
$fail = implode(', ', $results['failed']);
- if($success) egw_framework::message($success, 'success');
- egw_framework::window_close($fail);
- }
- }
- catch (egw_exception_wrong_userinput $e)
+ if($success) Framework::message($success, 'success');
+ Framework::window_close($fail);
+ }
+ }
+ catch (Api\Exception\WrongUserinput $e)
{
// if this returns with an exeption, something failed big time
$content['msg'] = $e->getMessage();
@@ -1463,7 +1468,7 @@
static function replaceEmailAdresses(&$text)
{
// replace emailaddresses eclosed in <> (eg.: ) with the emailaddress only (e.g: me@you.de)
- translation::replaceEmailAdresses($text);
+ Api\Mail\Html::replaceEmailAdresses($text);
return 1;
}
@@ -1472,7 +1477,7 @@
$stripalltags = true;
// third param is stripalltags, we may not need that, if the source is already in ascii
if (!$sourceishtml) $stripalltags=false;
- return translation::convertHTMLToText($_html,$this->displayCharset,$stripcrl,$stripalltags);
+ return Api\Mail\Html::convertHTMLToText($_html,$this->displayCharset,$stripcrl,$stripalltags);
}
function generateRFC822Address($_addressObject)
@@ -1644,7 +1649,7 @@
$bodyParts[$i]['body'] = "".$bodyParts[$i]['body']."
";
}
if ($bodyParts[$i]['charSet']===false) $bodyParts[$i]['charSet'] = Mail::detect_encoding($bodyParts[$i]['body']);
- $bodyParts[$i]['body'] = translation::convert_jsonsafe($bodyParts[$i]['body'], $bodyParts[$i]['charSet']);
+ $bodyParts[$i]['body'] = Api\Translation::convert_jsonsafe($bodyParts[$i]['body'], $bodyParts[$i]['charSet']);
#error_log( "GetDraftData (HTML) CharSet:".mb_detect_encoding($bodyParts[$i]['body'] . 'a' , strtoupper($bodyParts[$i]['charSet']).','.strtoupper($this->displayCharset).',UTF-8, ISO-8859-1'));
$this->sessionData['body'] .= ($i>0?"
":""). $bodyParts[$i]['body'] ;
}
@@ -1658,7 +1663,7 @@
$this->sessionData['body'] .= "
";
}
if ($bodyParts[$i]['charSet']===false) $bodyParts[$i]['charSet'] = Mail::detect_encoding($bodyParts[$i]['body']);
- $bodyParts[$i]['body'] = translation::convert_jsonsafe($bodyParts[$i]['body'], $bodyParts[$i]['charSet']);
+ $bodyParts[$i]['body'] = Api\Translation::convert_jsonsafe($bodyParts[$i]['body'], $bodyParts[$i]['charSet']);
#error_log( "GetDraftData (Plain) CharSet".mb_detect_encoding($bodyParts[$i]['body'] . 'a' , strtoupper($bodyParts[$i]['charSet']).','.strtoupper($this->displayCharset).',UTF-8, ISO-8859-1'));
$this->sessionData['body'] .= ($i>0?"\r\n":""). $bodyParts[$i]['body'] ;
}
@@ -1779,11 +1784,11 @@
{
$tmpFileName = Mail::checkFileBasics($_formData,$this->composeID,false);
}
- catch (egw_exception_wrong_userinput $e)
+ catch (Api\Exception\WrongUserinput $e)
{
$attachfailed = true;
$alert_msg = $e->getMessage();
- egw_framework::message($e->getMessage(), 'error');
+ Framework::message($e->getMessage(), 'error');
}
//error_log(__METHOD__.__LINE__.array2string($tmpFileName));
//error_log(__METHOD__.__LINE__.array2string($_formData));
@@ -1832,7 +1837,7 @@
function getAttachment()
{
// read attachment data from etemplate request, use tmpname only to identify it
- if (($request = etemplate_request::read($_GET['etemplate_exec_id'])))
+ if (($request = Etemplate\Request::read($_GET['etemplate_exec_id'])))
{
foreach($request->preserv['attachments'] as $attachment)
{
@@ -1871,7 +1876,7 @@
$buff = explode('.',$attachment['tmp_name']);
$suffix = '';
if (is_array($buff)) $suffix = array_pop($buff); // take the last extension to check with ext2mime
- if (!empty($suffix)) $sfxMimeType = mime_magic::ext2mime($suffix);
+ if (!empty($suffix)) $sfxMimeType = Api\MimeMagic::ext2mime($suffix);
$attachment['type'] = $sfxMimeType;
if (strtoupper($sfxMimeType) == 'TEXT/VCARD' || strtoupper($sfxMimeType) == 'TEXT/X-VCARD') $attachment['type'] = strtoupper($sfxMimeType);
}
@@ -1926,10 +1931,10 @@
}
}
//error_log(__METHOD__.__LINE__.'->'.array2string($attachment));
- html::safe_content_header($attachment['attachment'], $attachment['name'], $attachment['type'], $size=0, true, $_GET['mode'] == "save");
+ Api\Header\Content::safe($attachment['attachment'], $attachment['name'], $attachment['type'], $size=0, true, $_GET['mode'] == "save");
echo $attachment['attachment'];
- common::egw_exit();
+ exit();
}
/**
@@ -2111,7 +2116,7 @@
$_htmlConfig = Mail::$htmLawed_config;
Mail::$htmLawed_config['comment'] = 2;
Mail::$htmLawed_config['transform_anchor'] = false;
- $this->sessionData['body'] .= "
".self::_getCleanHTML(translation::convert_jsonsafe($bodyParts[$i]['body'], $bodyParts[$i]['charSet']));
+ $this->sessionData['body'] .= "
".self::_getCleanHTML(Api\Translation::convert_jsonsafe($bodyParts[$i]['body'], $bodyParts[$i]['charSet']));
Mail::$htmLawed_config = $_htmlConfig;
#error_log( "GetReplyData (HTML) CharSet:".mb_detect_encoding($bodyParts[$i]['body'] . 'a' , strtoupper($bodyParts[$i]['charSet']).','.strtoupper($this->displayCharset).',UTF-8, ISO-8859-1'));
}
@@ -2134,7 +2139,7 @@
}
// add line breaks to $bodyParts
- $newBody2 = translation::convert_jsonsafe($bodyParts[$i]['body'],$bodyParts[$i]['charSet']);
+ $newBody2 = Api\Translation::convert_jsonsafe($bodyParts[$i]['body'],$bodyParts[$i]['charSet']);
#error_log( "GetReplyData (Plain) CharSet:".mb_detect_encoding($bodyParts[$i]['body'] . 'a' , strtoupper($bodyParts[$i]['charSet']).','.strtoupper($this->displayCharset).',UTF-8, ISO-8859-1'));
$newBody = mail_ui::resolve_inline_images($newBody2, $_folder, $_uid, $_partID, 'plain');
$this->sessionData['body'] .= "\r\n";
@@ -2211,12 +2216,12 @@
/**
* Create a message from given data and identity
*
- * @param egw_mailer $_mailObject
+ * @param Api\Mailer $_mailObject
* @param array $_formData
* @param array $_identity
* @param boolean $_autosaving =false true: autosaving, false: save-as-draft or send
*/
- function createMessage(egw_mailer $_mailObject, array $_formData, array $_identity, $_autosaving=false)
+ function createMessage(Api\Mailer $_mailObject, array $_formData, array $_identity, $_autosaving=false)
{
if (substr($_formData['body'], 0, 27) == '-----BEGIN PGP MESSAGE-----')
{
@@ -2496,7 +2501,7 @@
if ($html)
{
- $links[] = html::a_href($name, $link).' '.
+ $links[] = Api\Html::a_href($name, $link).' '.
(is_dir($path) ? lang('Directory') : Vfs::hsize($attachment['size']));
}
else
@@ -2525,7 +2530,7 @@
public function ajax_saveAsDraft ($content, $action='button[saveAsDraft]')
{
//error_log(__METHOD__.__LINE__.array2string($content)."(, action=$action)");
- $response = egw_json_response::get();
+ $response = Api\Json\Response::get();
$success = true;
// check if default account is changed then we need to change profile
@@ -2573,7 +2578,7 @@
{
$this->mail_bo->deleteMessages($duid,$dmailbox,'remove_immediately');
}
- catch (egw_exception $e)
+ catch (Api\Exception $e)
{
$msg = str_replace('"',"'",$e->getMessage());
$success = false;
@@ -2591,10 +2596,10 @@
}
else
{
- throw new egw_exception_wrong_userinput(lang("Error: Could not save Message as Draft"));
- }
- }
- catch (egw_exception_wrong_userinput $e)
+ throw new Api\Exception\WrongUserinput(lang("Error: Could not save Message as Draft"));
+ }
+ }
+ catch (Api\Exception\WrongUserinput $e)
{
$msg = str_replace('"',"'",$e->getMessage());
error_log(__METHOD__.__LINE__.$msg);
@@ -2658,7 +2663,7 @@
{
//error_log(__METHOD__."(..., $savingDestination, action=$action)");
$mail_bo = $this->mail_bo;
- $mail = new egw_mailer($this->mail_bo->profileID);
+ $mail = new Api\Mailer($this->mail_bo->profileID);
// preserve the bcc and if possible the save to folder information
$this->sessionData['folder'] = $_formData['folder'];
@@ -2716,7 +2721,7 @@
{
$messageUid = $mail_bo->appendMessage($savingDestination, $mail->getRaw(), null, $flags);
}
- catch (egw_exception_wrong_userinput $e)
+ catch (Api\Exception\WrongUserinput $e)
{
error_log(__METHOD__.__LINE__.lang("Save of message %1 failed. Could not save message to folder %2 due to: %3",__METHOD__,$savingDestination,$e->getMessage()));
return false;
@@ -2733,7 +2738,7 @@
function send($_formData)
{
$mail_bo = $this->mail_bo;
- $mail = new egw_mailer($mail_bo->profileID);
+ $mail = new Api\Mailer($mail_bo->profileID);
$messageIsDraft = false;
$this->sessionData['mailaccount'] = $_formData['mailaccount'];
@@ -3001,7 +3006,7 @@
//error_log(__METHOD__.__LINE__.array2string($folderName));
$mail_bo->appendMessage($folderName, $mail->getRaw(), null, $flags);
}
- catch (egw_exception_wrong_userinput $e)
+ catch (Api\Exception\WrongUserinput $e)
{
error_log(__METHOD__.__LINE__.'->'.lang("Import of message %1 failed. Could not save message to folder %2 due to: %3",$this->sessionData['subject'],$folderName,$e->getMessage()));
}
@@ -3035,7 +3040,7 @@
//error_log(__METHOD__.__LINE__.array2string($folderName));
$this->mail_bo->appendMessage($folderName, $mail->getRaw(), null, $flags);
}
- catch (egw_exception_wrong_userinput $e)
+ catch (Api\Exception\WrongUserinput $e)
{
error_log(__METHOD__.__LINE__.'->'.lang("Import of message %1 failed. Could not save message to folder %2 due to: %3",$this->sessionData['subject'],$folderName,$e->getMessage()));
}
@@ -3076,7 +3081,7 @@
$mail_bo->deleteMessages($lastDrafted['uid'],$lastDrafted['folder'],'remove_immediately');
}
}
- catch (egw_exception $e)
+ catch (Api\Exception $e)
{
//error_log(__METHOD__.__LINE__." ". str_replace('"',"'",$e->getMessage()));
unset($e);
@@ -3103,7 +3108,7 @@
$mail_bo->deleteMessages(array($this->sessionData['uid']),$this->sessionData['messageFolder']);
}
}
- catch (egw_exception $e)
+ catch (Api\Exception $e)
{
//error_log(__METHOD__.__LINE__." ". str_replace('"',"'",$e->getMessage()));
unset($e);
@@ -3118,7 +3123,7 @@
//error_log(__METHOD__.__LINE__.':'.array2string($this->sessionData['forwardedUID']).' F:'.$this->sessionData['sourceFolder']);
$mail_bo->flagMessages("forwarded", $this->sessionData['forwardedUID'],$this->sessionData['sourceFolder']);
}
- catch (egw_exception $e)
+ catch (Api\Exception $e)
{
//error_log(__METHOD__.__LINE__." ". str_replace('"',"'",$e->getMessage()));
unset($e);
@@ -3152,7 +3157,7 @@
{
$app_name = substr($app_key,3);
// Get registered hook data of the app called for integration
- $hook = $GLOBALS['egw']->hooks->single(array('location'=> 'mail_import'),$app_name);
+ $hook = Api\Hooks::single(array('location'=> 'mail_import'),$app_name);
// store mail / eml in temp. file to not have to download it from mail-server again
$eml = tempnam($GLOBALS['egw_info']['server']['temp_dir'],'mail_integrate');
@@ -3163,9 +3168,9 @@
// Open the app called for integration in a popup
// and store the mail raw data as egw_data, in order to
// be stored from registered app method later
- egw_framework::popup(egw::link('/index.php', array(
+ Framework::popup(Egw::link('/index.php', array(
'menuaction' => $hook['menuaction'],
- 'egw_data' => egw_link::set_data(null,'mail_integration::integrate',array(
+ 'egw_data' => Link::set_data(null,'mail_integration::integrate',array(
$mailaddresses,
$this->sessionData['subject'],
$this->convertHTMLToText($this->sessionData['body']),
@@ -3281,7 +3286,7 @@
{
$useCacheIfPossible = true;
}
- $searchString = translation::convert($_searchString, Mail::$displayCharset,'UTF7-IMAP');
+ $searchString = Api\Translation::convert($_searchString, Mail::$displayCharset,'UTF7-IMAP');
foreach ($folderObjects as $k =>$fA)
{
//error_log(__METHOD__.__LINE__.$_searchString.'/'.$searchString.' in '.$k.'->'.$fA->displayName);
@@ -3317,12 +3322,12 @@
return $rL;
}
// switch regular JSON response handling off
- egw_json_request::isJSONRequest(false);
+ Api\Json\Request::isJSONRequest(false);
header('Content-Type: application/json; charset=utf-8');
//error_log(__METHOD__.__LINE__);
echo json_encode($results);
- common::egw_exit();
+ exit();
}
public static function ajax_searchAddress($_searchStringLength=2) {
@@ -3432,7 +3437,7 @@
if($include_lists)
{
$lists = array_filter(
- $contacts_obj->get_lists(EGW_ACL_READ),
+ $contacts_obj->get_lists(Acl::READ),
function($element) use($_searchString) {
return (stripos($element, $_searchString) !== false);
}
@@ -3452,12 +3457,12 @@
}
}
// switch regular JSON response handling off
- egw_json_request::isJSONRequest(false);
+ Api\Json\Request::isJSONRequest(false);
//error_log(__METHOD__.__LINE__.array2string($jsArray));
header('Content-Type: application/json; charset=utf-8');
echo json_encode($results);
- common::egw_exit();
+ exit();
}
/**
@@ -3468,14 +3473,14 @@
*/
public function ajax_merge($contact_id)
{
- $response = egw_json_response::get();
- if(class_exists($_REQUEST['merge']) && is_subclass_of($_REQUEST['merge'],'bo_merge'))
+ $response = Api\Json\Response::get();
+ if(class_exists($_REQUEST['merge']) && is_subclass_of($_REQUEST['merge'], 'EGroupware\\Api\\Storage\\Merge'))
{
$document_merge = new $_REQUEST['merge']();
}
else
{
- $document_merge = new addressbook_merge();
+ $document_merge = new Api\Contacts\Merge();
}
$this->mail_bo->openConnection();
Modified: trunk/mail/inc/class.mail_hooks.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/mail/inc/class.mail_hooks.inc.php?rev=55995&r1=55994&r2=55995&view=diff
==============================================================================
--- trunk/mail/inc/class.mail_hooks.inc.php (original)
+++ trunk/mail/inc/class.mail_hooks.inc.php Tue May 3 21:17:44 2016
@@ -11,6 +11,7 @@
*/
use EGroupware\Api;
+use EGroupware\Api\Egw;
use EGroupware\Api\Mail;
/**
@@ -31,7 +32,7 @@
if (Mail\Account::is_multiple($account) && $account['acc_imap_admin_username'] ||
$account['acc_imap_type'] == 'managementserver_imap')
{
- translation::add_app('mail');
+ Api\Translation::add_app('mail');
if (true /* ToDo check ACL available */ || $account['acc_imap_type'] == 'managementserver_imap')
{
@@ -40,7 +41,7 @@
'caption' => 'Folder ACL',
'icon' => 'lock',
'popup' => '750x420',
- 'url' => egw::link('/index.php', array(
+ 'url' => Egw::link('/index.php', array(
'menuaction' => 'mail.mail_acl.edit',
'acc_id' => $data['acc_id'],
'account_id' => $data['account_id'],
@@ -55,7 +56,7 @@
'caption' => 'Vacation notice',
'icon' => 'mail/navbar',
'popup' => '750x420',
- 'url' => egw::link('/index.php', array(
+ 'url' => Egw::link('/index.php', array(
'menuaction' => 'mail.mail_sieve.editVacation',
'acc_id' => $data['acc_id'],
'account_id' => $data['account_id'],
@@ -70,11 +71,13 @@
/**
* Hook called by link-class to include mail in the appregistry of the linkage
*
- * @param array/string $location location and other parameters (not used)
+ * @param array|string $location location and other parameters (not used)
* @return array with method-names
*/
static function search_link($location)
{
+ unset($location); // not used, but required by function signature
+
return array(
'view' => array(
'menuaction' => 'mail.mail_ui.displayMessage',
@@ -122,22 +125,7 @@
$profileID = 0;
if (isset($GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID']))
$profileID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];
-
- $mailConfig = config::read('mail');
- }
-
- $connectionTimeout = array(
- '0' => lang('use default timeout (20 seconds)'),
- '10' => '10', // timeout used in SIEVE
- '20' => '20',
- '30' => '30',
- '40' => '40',
- '50' => '50',
- '60' => '60',
- '70' => '70',
- '80' => '80',
- '90' => '90',
- );
+ }
$no_yes = array(
'0' => lang('no'),
@@ -145,35 +133,13 @@
);
$no_yes_copy = array_merge($no_yes,array('2'=>lang('yes, offer copy option')));
- $prefAllowManageFolders = $no_yes;
-
$forwardOptions = array(
'asmail' => lang('forward as attachment'),
'inline' => lang('forward inline'),
);
- $sortOrder = array(
- '0' => lang('date(newest first)'),
- '1' => lang('date(oldest first)'),
- '3' => lang('from(A->Z)'),
- '2' => lang('from(Z->A)'),
- '5' => lang('subject(A->Z)'),
- '4' => lang('subject(Z->A)'),
- '7' => lang('size(0->...)'),
- '6' => lang('size(...->0)')
- );
-
$trustServersUnseenOptions = array_merge(
$no_yes,
array('2' => lang('yes') . ' - ' . lang('but check shared folders'))
- );
-
- $selectOptions = array_merge(
- $no_yes,
- array('2' => lang('yes') . ' - ' . lang('small view'))
- );
- $newWindowOptions = array(
- '1' => lang('only one window'),
- '2' => lang('allways a new window'),
);
$deleteOptions = array(
@@ -208,45 +174,9 @@
'only_if_no_text' => lang('display only when no plain text is available'),
'always_display' => lang('always show html emails'),
);
- $toggle = false;
- if ($GLOBALS['egw_info']['user']['preferences']['common']['select_mode'] == 'EGW_SELECTMODE_TOGGLE') $toggle=true;
- $rowOrderStyle = array(
- 'mail' => lang('mail'),
- 'outlook' => 'Outlook',
- 'mail_wCB' => lang('mail').' '.($toggle?lang('(select mails by clicking on the line, like a checkbox)'):lang('(with checkbox enforced)')),
- 'outlook_wCB' => 'Outlook'.' '.($toggle?lang('(