mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-22 22:08:45 +01:00
* eMail: feature to save messages that are in progress of being composed to draft every 3 minutes;
* eMail: fix bug regarding language strings with single quotes in Javascript; masking hash char when saving mails to filemanager, using purifyCreateHTMLTidyConfig when trying to use purifier as tidy substitution
This commit is contained in:
parent
abf0750842
commit
a2af0cc046
@ -262,6 +262,66 @@ class ajaxfelamimail
|
||||
return $response->getXML();
|
||||
}
|
||||
|
||||
function saveAsDraft($_composeID, $_data)
|
||||
{
|
||||
if($this->_debug) error_log(__METHOD__.__LINE__.' ID:'.array2string($_composeID).' Data:'.array2string($_data));
|
||||
$bocompose = CreateObject('felamimail.bocompose',$_composeID,$this->charset);
|
||||
$folder = ($this->bofelamimail->mailPreferences->ic_server[$this->bofelamimail->profileID]->draftfolder ? $this->bofelamimail->mailPreferences->ic_server[$this->bofelamimail->profileID]->draftfolder : $this->bofelamimail->mailPreferences->preferences['draftFolder']);
|
||||
$this->bofelamimail->reopen($folder);
|
||||
$status = $this->bofelamimail->getFolderStatus($folder);
|
||||
//error_log(__METHOD__.__LINE__.array2string(array('Folder'=>$folder,'Status'=>$status)));
|
||||
$uidNext = $status['uidnext']; // we may need that, if the server does not return messageUIDs of saved/appended messages
|
||||
$_data['saveAsDraft'] = 1;
|
||||
$formData['identity'] = (int)$_data['identity'];
|
||||
|
||||
foreach((array)$_data['destination'] as $key => $destination) {
|
||||
if(!empty($_data['address'][$key])) {
|
||||
if($destination == 'folder') {
|
||||
$formData[$destination][] = $GLOBALS['egw']->translation->convert($_data['address'][$key], $this->charset, 'UTF7-IMAP');
|
||||
} else {
|
||||
$formData[$destination][] = $_data['address'][$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$formData['subject'] = $bocompose->stripSlashes($_data['subject']);
|
||||
$formData['body'] = $bocompose->stripSlashes($_data['body']);
|
||||
/*
|
||||
// if the body is empty, maybe someone pasted something with scripts, into the message body
|
||||
if(empty($formData['body']))
|
||||
{
|
||||
// this is to be found with the egw_unset_vars array for the _POST['body'] array
|
||||
$name='_POST';
|
||||
$key='body';
|
||||
//error_log($GLOBALS['egw_unset_vars'][$name.'['.$key.']']);
|
||||
if (isset($GLOBALS['egw_unset_vars'][$name.'['.$key.']']))
|
||||
{
|
||||
$formData['body'] = bocompose::_getCleanHTML( $GLOBALS['egw_unset_vars'][$name.'['.$key.']']);
|
||||
}
|
||||
}
|
||||
*/
|
||||
$formData['priority'] = $bocompose->stripSlashes($_data['priority']);
|
||||
$formData['signatureID'] = (int)$_data['signatureID'];
|
||||
$formData['stationeryID'] = $_data['stationeryID'];
|
||||
$formData['mimeType'] = $bocompose->stripSlashes($_data['mimeType']);
|
||||
if ($formData['mimeType'] == 'html' && html::htmlarea_availible()===false)
|
||||
{
|
||||
$formData['mimeType'] = 'plain';
|
||||
$formData['body'] = $bocompose->convertHTMLToText($formData['body']);
|
||||
}
|
||||
$formData['disposition'] = (bool)$_data['disposition'];
|
||||
$formData['to_infolog'] = $_data['to_infolog'];
|
||||
$formData['to_tracker'] = $_data['to_tracker'];
|
||||
$formData['isDraft'] = 1;
|
||||
$lastDrafted = false;
|
||||
if (isset($bocompose->sessionData['lastDrafted'])) $lastDrafted = $bocompose->sessionData['lastDrafted'];
|
||||
$messageUid = $bocompose->saveAsDraft($formData,$folder); // folder may change
|
||||
if ($lastDrafted && is_array($lastDrafted)) $this->bofelamimail->deleteMessages((array)$lastDrafted['uid'],$lastDrafted['folder']);
|
||||
$bocompose->sessionData['lastDrafted'] = array('uid'=>$messageUid,'folder'=>$folder);
|
||||
$bocompose->saveSessionData();
|
||||
if($this->_debug) error_log(__METHOD__.__LINE__.' saved as:'.$messageUid.' in '.$folder);
|
||||
}
|
||||
|
||||
function toggleEditor($_composeID, $_content ,$_mode)
|
||||
{
|
||||
$_content = utf8_decode($_content);
|
||||
|
@ -27,6 +27,7 @@
|
||||
var $bopreferences;
|
||||
var $bosignatures;
|
||||
var $displayCharset;
|
||||
var $sessionData;
|
||||
|
||||
function bocompose($_composeID = '', $_charSet = 'iso-8859-1')
|
||||
{
|
||||
@ -1151,7 +1152,13 @@
|
||||
}
|
||||
//$bofelamimail->closeConnection();
|
||||
}
|
||||
#error_log("handling draft messages, flagging and such");
|
||||
// handle previous drafted versions of that mail
|
||||
$lastDrafted = false;
|
||||
if (isset($this->sessionData['lastDrafted'])) $lastDrafted = $this->sessionData['lastDrafted'];
|
||||
if ($lastDrafted && is_array($lastDrafted)) $bofelamimail->deleteMessages((array)$lastDrafted['uid'],$lastDrafted['folder']);
|
||||
unset($this->sessionData['lastDrafted']);
|
||||
|
||||
//error_log("handling draft messages, flagging and such");
|
||||
if((isset($this->sessionData['uid']) && isset($this->sessionData['messageFolder']))
|
||||
|| (isset($this->sessionData['forwardFlag']) && isset($this->sessionData['sourceFolder']))) {
|
||||
// mark message as answered
|
||||
|
@ -802,6 +802,7 @@ class felamimail_bo
|
||||
|
||||
function deleteMessages($_messageUID, $_folder=NULL)
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.'->'.array2string($_messageUID).','.$_folder);
|
||||
$msglist = '';
|
||||
$oldMailbox = '';
|
||||
if (is_null($_folder) || empty($_folder)) $_folder = $this->sessionData['mailbox'];
|
||||
@ -1203,7 +1204,8 @@ class felamimail_bo
|
||||
// EnableID is needed for anchor tags
|
||||
$config->set('Attr.EnableID',true);
|
||||
// actual allowed tags and attributes
|
||||
$config->set('URI.AllowedSchemes', array('http'=>true, 'https'=>true, 'ftp'=>true, 'file'=>true, 'cid'=>true, 'data'=>true)); $config->set('AutoFormat.RemoveEmpty', true);
|
||||
$config->set('URI.AllowedSchemes', array('http'=>true, 'https'=>true, 'ftp'=>true, 'file'=>true, 'cid'=>true, 'data'=>true));
|
||||
//$config->set('AutoFormat.RemoveEmpty', true);
|
||||
$config->set('HTML.Allowed', 'br,p[class|align],b,i,u,s,em,pre,tt,strong,strike,center,div[class|align],hr[class|style],'.
|
||||
'font[size|color],'.
|
||||
'ul[class|type],ol[class|type|start],li,'.
|
||||
@ -4485,7 +4487,7 @@ class felamimail_bo
|
||||
}
|
||||
else
|
||||
{
|
||||
$newBody = html::purify($newBody);
|
||||
$newBody = html::purify($newBody,html::purifyCreateHTMLTidyConfig());
|
||||
}
|
||||
//error_log(__METHOD__.__LINE__.' after purify:'.$newBody);
|
||||
if ($preserveHTML==false) $newBody = $bofelamimail->convertHTMLToText($newBody,true);
|
||||
|
@ -425,6 +425,7 @@
|
||||
// the editorobject is needed all the time (since we use CKEDITOR3
|
||||
//$editorObject = html::initCKEditor('400px','simple');
|
||||
$this->t->set_var('ckeditorConfig', egw_ckeditor_config::get_ckeditor_config('simple-withimage'));//$editorObject->jsEncode($editorObject->config));
|
||||
$this->t->set_var('refreshTimeOut', 3*60*1000); // 3 minutes till a compose messages will be saved as draft;
|
||||
|
||||
// check for some error messages from last posting attempt
|
||||
$errorInfo = $this->bocompose->getErrorInfo();
|
||||
|
@ -52,6 +52,54 @@ function initAll()
|
||||
if (titletext.length>0) updateTitle(titletext);
|
||||
}
|
||||
|
||||
function fm_startTimerSaveAsDraft(_refreshTimeOut) {
|
||||
if(aktiv) {
|
||||
window.clearTimeout(aktiv);
|
||||
}
|
||||
if(_refreshTimeOut > 5000) {
|
||||
aktiv = window.setInterval("fm_compose_saveAsDraftBG()", _refreshTimeOut);
|
||||
}
|
||||
}
|
||||
|
||||
function fm_compose_saveAsDraftBG()
|
||||
{
|
||||
//alert('composing in progress->'+composeID);
|
||||
|
||||
var htmlFlag = document.getElementsByName('_is_html')[0];
|
||||
var mimeType = document.getElementById('mimeType');
|
||||
var currentEditor = htmlFlag.value;
|
||||
var currentMode ='';
|
||||
var data = {};
|
||||
if (currentEditor == 1)
|
||||
{fm_startTimerSaveAsDraft(_refreshTimeOut)
|
||||
data['mimeType']=currentMode='html';
|
||||
}
|
||||
else
|
||||
{
|
||||
data['mimeType']=currentMode='plain';
|
||||
}
|
||||
|
||||
var ckeditor = CKEDITOR.instances['body'];
|
||||
var plaineditor = document.getElementsByName('body')[0];
|
||||
var editorArea = document.getElementById('editorArea');
|
||||
data = window.xajax.getFormValues('doit');
|
||||
data['body'] ='';
|
||||
// body
|
||||
if (currentMode == 'html')
|
||||
{
|
||||
//Copy the current HTML data and recode it via a XAJAX request
|
||||
data['body'] = ckeditor.getData();
|
||||
}
|
||||
else
|
||||
{
|
||||
data['body'] = plaineditor.value;
|
||||
}
|
||||
|
||||
//call saveasdraft with xajax_doXMLHTTP, or something equivalent
|
||||
xajax_doXMLHTTP("felamimail.ajaxfelamimail.saveAsDraft", composeID, data);
|
||||
fm_startTimerSaveAsDraft(_refreshTimeOut);
|
||||
}
|
||||
|
||||
function addEmail(to,email)
|
||||
{
|
||||
//alert(to+': '+email);
|
||||
|
@ -481,6 +481,7 @@ function onNodeSelect(_nodeID) {
|
||||
var actionPending = false;
|
||||
// var formData = new Array();
|
||||
if(top.tree.getUserData(_nodeID, 'folderName')) {
|
||||
/*
|
||||
if(document.getElementsByName("folderAction")[0].value == "moveMessage") {
|
||||
if (prefAskForMove == 1 || prefAskForMove == 2)
|
||||
{
|
||||
@ -532,13 +533,14 @@ function onNodeSelect(_nodeID) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
*/
|
||||
mail_resetMessageSelect();
|
||||
egw_appWindow('felamimail').setStatusMessage('<span style="font-weight: bold;">' + egw_appWindow('felamimail').lang_loading + ' ' + top.tree.getUserData(_nodeID, 'folderName') + '</span>');
|
||||
mail_cleanup();
|
||||
document.getElementById('divMessageList').innerHTML = '';
|
||||
egw_appWindow('felamimail').xajax_doXMLHTTP("felamimail.ajaxfelamimail.updateMessageView",_nodeID);
|
||||
egw_appWindow('felamimail').refreshFolderStatus(_nodeID);
|
||||
}
|
||||
// }
|
||||
}
|
||||
CopyOrMove = true;
|
||||
}
|
||||
@ -1258,7 +1260,7 @@ function topPosition() {
|
||||
function leftPosition() {
|
||||
return typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
// build/show the dialog box, populate the data and call the fadeDialog function //
|
||||
function showDialog(title,message,type,autohide) {
|
||||
if(!type) {
|
||||
@ -1367,7 +1369,7 @@ function fadeDialog(flag) {
|
||||
clearInterval(dialog.timer);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
function felamimail_transform_foldertree() {
|
||||
// Get the felamimail object manager, but do not create it!
|
||||
var objectManager = egw_getObjectManager('felamimail', false);
|
||||
|
@ -8,6 +8,8 @@
|
||||
var activityImagePath = "{ajax-loader}";
|
||||
var fm_compose_langNoAddressSet = "{lang_no_address_set}";
|
||||
var ckeditorConfig = {ckeditorConfig};
|
||||
var aktiv;
|
||||
var _refreshTimeOut = {refreshTimeOut};
|
||||
|
||||
self.focus();
|
||||
|
||||
@ -48,6 +50,7 @@
|
||||
}
|
||||
return true;
|
||||
}
|
||||
fm_startTimerSaveAsDraft(_refreshTimeOut);
|
||||
</script>
|
||||
<center>
|
||||
<form method="post" name="doit" action="{link_action}" ENCTYPE="multipart/form-data" onsubmit="return check_data();">
|
||||
|
@ -4,43 +4,43 @@ var sURL = unescape(window.location.pathname);
|
||||
|
||||
// some translations needed for javascript functions
|
||||
|
||||
var movingMessages = '{lang_moving_messages_to}';
|
||||
var copyingMessages = '{lang_copying_messages_to}';
|
||||
var lang_askformove = '{lang_askformove}';
|
||||
var prefAskForMove = '{prefaskformove}';
|
||||
var prefAskForMultipleForward = '{prefaskformultipleforward}';
|
||||
var movingMessages = "{lang_moving_messages_to}";
|
||||
var copyingMessages = "{lang_copying_messages_to}";
|
||||
var lang_askformove = "{lang_askformove}";
|
||||
var prefAskForMove = "{prefaskformove}";
|
||||
var prefAskForMultipleForward = "{prefaskformultipleforward}";
|
||||
var CopyOrMove = true;
|
||||
var lang_MoveCopyTitle = '{lang_MoveCopyTitle}';
|
||||
var lang_copy = '{lang_copy}';
|
||||
var lang_move = '{lang_move}';
|
||||
var lang_multipleforward = '{lang_multipleforward}';
|
||||
var lang_cancel = '{lang_cancel}';
|
||||
var lang_MoveCopyTitle = "{lang_MoveCopyTitle}";
|
||||
var lang_copy = "{lang_copy}";
|
||||
var lang_move = "{lang_move}";
|
||||
var lang_multipleforward = "{lang_multipleforward}";
|
||||
var lang_cancel = "{lang_cancel}";
|
||||
|
||||
var lang_emptyTrashFolder = '{lang_empty_trash}';
|
||||
var lang_compressingFolder = '{lang_compress_folder}';
|
||||
var lang_select_target_folder = '{lang_select_target_folder}';
|
||||
var lang_updating_message_status = '{lang_updating_message_status}';
|
||||
var lang_loading = '{lang_loading}';
|
||||
var lang_deleting_messages = '{lang_deleting_messages}';
|
||||
var lang_skipping_forward = '{lang_skipping_forward}';
|
||||
var lang_skipping_previous = '{lang_skipping_previous}';
|
||||
var lang_jumping_to_end = '{lang_jumping_to_end}';
|
||||
var lang_jumping_to_start = '{lang_jumping_to_start}';
|
||||
var lang_updating_view = '{lang_updating_view}';
|
||||
var lang_mark_all_messages = '{lang_mark_all_messages}';
|
||||
var lang_confirm_all_messages = '{lang_confirm_all_messages}';
|
||||
var lang_emptyTrashFolder = "{lang_empty_trash}";
|
||||
var lang_compressingFolder = "{lang_compress_folder}";
|
||||
var lang_select_target_folder = "{lang_select_target_folder}";
|
||||
var lang_updating_message_status = "{lang_updating_message_status}";
|
||||
var lang_loading = "{lang_loading}";
|
||||
var lang_deleting_messages = "{lang_deleting_messages}";
|
||||
var lang_skipping_forward = "{lang_skipping_forward}";
|
||||
var lang_skipping_previous = "{lang_skipping_previous}";
|
||||
var lang_jumping_to_end = "{lang_jumping_to_end}";
|
||||
var lang_jumping_to_start = "{lang_jumping_to_start}";
|
||||
var lang_updating_view = "{lang_updating_view}";
|
||||
var lang_mark_all_messages = "{lang_mark_all_messages}";
|
||||
var lang_confirm_all_messages = "{lang_confirm_all_messages}";
|
||||
var lang_sendnotify = "{lang_sendnotify}";
|
||||
|
||||
var MessageBuffer;
|
||||
// global vars to store server and active folder info
|
||||
var activeServerID = '{activeServerID}';
|
||||
var activeFolder = '{activeFolder}';
|
||||
var activeFolder = "{activeFolder}";
|
||||
var activeFolderB64 = '{activeFolderB64}';
|
||||
var sentFolder = '{sentFolder}';
|
||||
var sentFolder = "{sentFolder}";
|
||||
var sentFolderB64 = '{sentFolderB64}';
|
||||
var draftFolder = '{draftFolder}';
|
||||
var draftFolder = "{draftFolder}";
|
||||
var draftFolderB64 = '{draftFolderB64}';
|
||||
var templateFolder = '{templateFolder}';
|
||||
var templateFolder = "{templateFolder}";
|
||||
var templateFolderB64 = '{templateFolderB64}';
|
||||
var activityImagePath = '{ajax-loader}';
|
||||
var test = '';
|
||||
|
@ -4,43 +4,43 @@ var sURL = unescape(window.location.pathname);
|
||||
|
||||
// some translations needed for javascript functions
|
||||
|
||||
var movingMessages = '{lang_moving_messages_to}';
|
||||
var copyingMessages = '{lang_copying_messages_to}';
|
||||
var lang_askformove = '{lang_askformove}';
|
||||
var prefAskForMove = '{prefaskformove}';
|
||||
var prefAskForMultipleForward = '{prefaskformultipleforward}';
|
||||
var CopyOrMove = true;
|
||||
var lang_MoveCopyTitle = '{lang_MoveCopyTitle}';
|
||||
var lang_copy = '{lang_copy}';
|
||||
var lang_move = '{lang_move}';
|
||||
var lang_multipleforward = '{lang_multipleforward}';
|
||||
var lang_cancel = '{lang_cancel}';
|
||||
|
||||
var lang_emptyTrashFolder = '{lang_empty_trash}';
|
||||
var lang_compressingFolder = '{lang_compress_folder}';
|
||||
var lang_select_target_folder = '{lang_select_target_folder}';
|
||||
var lang_updating_message_status = '{lang_updating_message_status}';
|
||||
var lang_loading = '{lang_loading}';
|
||||
var lang_deleting_messages = '{lang_deleting_messages}';
|
||||
var lang_skipping_forward = '{lang_skipping_forward}';
|
||||
var lang_skipping_previous = '{lang_skipping_previous}';
|
||||
var lang_jumping_to_end = '{lang_jumping_to_end}';
|
||||
var lang_jumping_to_start = '{lang_jumping_to_start}';
|
||||
var lang_updating_view = '{lang_updating_view}';
|
||||
var lang_mark_all_messages = '{lang_mark_all_messages}';
|
||||
var lang_confirm_all_messages = '{lang_confirm_all_messages}';
|
||||
var movingMessages = "{lang_moving_messages_to}";
|
||||
var copyingMessages = "{lang_copying_messages_to}";
|
||||
var lang_askformove = "{lang_askformove}";
|
||||
var prefAskForMove = "{prefaskformove}";
|
||||
var prefAskForMultipleForward = "{prefaskformultipleforward}";
|
||||
var CopyOrMove = true;
|
||||
var lang_MoveCopyTitle = "{lang_MoveCopyTitle}";
|
||||
var lang_copy = "{lang_copy}";
|
||||
var lang_move = "{lang_move}";
|
||||
var lang_multipleforward = "{lang_multipleforward}";
|
||||
var lang_cancel = "{lang_cancel}";
|
||||
|
||||
var lang_emptyTrashFolder = "{lang_empty_trash}";
|
||||
var lang_compressingFolder = "{lang_compress_folder}";
|
||||
var lang_select_target_folder = "{lang_select_target_folder}";
|
||||
var lang_updating_message_status = "{lang_updating_message_status}";
|
||||
var lang_loading = "{lang_loading}";
|
||||
var lang_deleting_messages = "{lang_deleting_messages}";
|
||||
var lang_skipping_forward = "{lang_skipping_forward}";
|
||||
var lang_skipping_previous = "{lang_skipping_previous}";
|
||||
var lang_jumping_to_end = "{lang_jumping_to_end}";
|
||||
var lang_jumping_to_start = "{lang_jumping_to_start}";
|
||||
var lang_updating_view = "{lang_updating_view}";
|
||||
var lang_mark_all_messages = "{lang_mark_all_messages}";
|
||||
var lang_confirm_all_messages = "{lang_confirm_all_messages}";
|
||||
var lang_sendnotify = "{lang_sendnotify}";
|
||||
|
||||
var MessageBuffer;
|
||||
// global vars to store server and active folder info
|
||||
var activeServerID = '{activeServerID}';
|
||||
var activeFolder = '{activeFolder}';
|
||||
var activeFolderB64 = '{activeFolderB64}';
|
||||
var sentFolder = '{sentFolder}';
|
||||
var activeServerID = '{activeServerID}';
|
||||
var activeFolder = "{activeFolder}";
|
||||
var activeFolderB64 = '{activeFolderB64}';
|
||||
var sentFolder = "{sentFolder}";
|
||||
var sentFolderB64 = '{sentFolderB64}';
|
||||
var draftFolder = '{draftFolder}';
|
||||
var draftFolder = "{draftFolder}";
|
||||
var draftFolderB64 = '{draftFolderB64}';
|
||||
var templateFolder = '{templateFolder}';
|
||||
var templateFolder = "{templateFolder}";
|
||||
var templateFolderB64 = '{templateFolderB64}';
|
||||
var activityImagePath = '{ajax-loader}';
|
||||
var test = '';
|
||||
|
Loading…
Reference in New Issue
Block a user