mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 17:33:49 +01:00
several stuff, AND basic attempt to handle upload files; first try with to importmessage and open. results in javascript error
This commit is contained in:
parent
aaf0a7491d
commit
367811306f
@ -4737,6 +4737,19 @@ class mail_bo
|
||||
return $headdata;
|
||||
}
|
||||
|
||||
/**
|
||||
* adaptSubjectForImport - strips subject from unwanted Characters, and does some normalization
|
||||
* to meet expectations
|
||||
* @param string $subject string to process
|
||||
* @return string
|
||||
*/
|
||||
static function adaptSubjectForImport($subject)
|
||||
{
|
||||
$subject = str_replace('$$','__',($subject?$subject:lang('(no subject)')));
|
||||
$subject = str_ireplace(array('[FWD]','[',']','{','}','<','>'),array('Fwd:',' ',' ',' ',' ',' ',' '),trim($subject));
|
||||
return $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* convertAddressArrayToString - converts an mail envelope Address Array To String
|
||||
* @param array $rfcAddressArray an addressarray as provided by mail retieved via egw_pear....
|
||||
|
@ -266,16 +266,16 @@ class mail_compose
|
||||
* function compose
|
||||
* this function is used to fill the compose dialog with the content provided by session data
|
||||
*
|
||||
* @var content array the etemplate content array
|
||||
* @var _content array the etemplate content array
|
||||
* @var msg string a possible message to be passed and displayed to the userinterface
|
||||
* @var _focusElement varchar subject, to, body supported
|
||||
* @var suppressSigOnTop boolean
|
||||
* @var isReply boolean
|
||||
*/
|
||||
function compose(array $content=null,$msg=null, $_focusElement='to',$suppressSigOnTop=false, $isReply=false)
|
||||
function compose(array $_content=null,$msg=null, $_focusElement='to',$suppressSigOnTop=false, $isReply=false)
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.array2string($_REQUEST));
|
||||
error_log(__METHOD__.__LINE__.array2string($content));
|
||||
error_log(__METHOD__.__LINE__.array2string($_content));
|
||||
|
||||
if (isset($_GET['reply_id'])) $replyID = $_GET['reply_id'];
|
||||
// read the data from session
|
||||
@ -946,8 +946,6 @@ class mail_compose
|
||||
if ($value=="NIL@NIL") continue;
|
||||
if ($destination=='replyto' && str_replace('"','',$value) == str_replace('"','',$identities[($presetId ? $presetId : $defaultIdentity)])) continue;
|
||||
//error_log(__METHOD__.__LINE__.array2string(array('key'=>$key,'value'=>$value)));
|
||||
$selectDestination = html::select('destination[]', $destination, $this->destinations, false, "style='width: 100%;' onchange='fm_compose_changeInputType(this)'");
|
||||
//$this->t->set_var('select_destination', $selectDestination);
|
||||
$value = htmlspecialchars_decode($value,ENT_COMPAT);
|
||||
$value = str_replace("\"\"",'"',$value);
|
||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($value):$value), '');
|
||||
@ -960,8 +958,14 @@ class mail_compose
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($content)
|
||||
if ($_content)
|
||||
{
|
||||
$content = array_merge($content,$_content);
|
||||
|
||||
if (!empty($content['FOLDER'])) $sel_options['FOLDER']=$this->ajax_searchFolder(0,true);
|
||||
$content['SENDER'] = (empty($content['SENDER'])?($selectedSender?(array)$selectedSender:''):$content['SENDER']);
|
||||
$content['is_html'] = ($this->sessionData['mimeType'] == 'html'?true:'');
|
||||
$content['is_plain'] = ($this->sessionData['mimeType'] == 'html'?'':true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -972,6 +976,8 @@ class mail_compose
|
||||
//error_log(__METHOD__.__LINE__.$sessionData['body']);
|
||||
$content['mail_'.($this->sessionData['mimeType'] == 'html'?'html':'plain').'text'] = $sessionData['body'];
|
||||
}
|
||||
$preserv['is_html'] = $content['is_html'];
|
||||
$preserv['is_plain'] = $content['is_plain'];
|
||||
$etpl = new etemplate_new('mail.compose');
|
||||
$etpl->exec('mail.mail_compose.compose',$content,$sel_options,$readonlys,$preserv,2);
|
||||
}
|
||||
@ -2529,12 +2535,12 @@ class mail_compose
|
||||
common::egw_exit();
|
||||
}
|
||||
|
||||
function ajax_searchFolder() {
|
||||
function ajax_searchFolder($_searchStringLength=2, $_returnList=false) {
|
||||
static $useCacheIfPossible;
|
||||
if (is_null($useCacheIfPossible)) $useCacheIfPossible = true;
|
||||
$_searchString = trim($_REQUEST['query']);
|
||||
$results = array();
|
||||
if (strlen($_searchString)>=2 && isset($this->mail_bo->icServer))
|
||||
if (strlen($_searchString)>=$_searchStringLength && isset($this->mail_bo->icServer))
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.':'.$this->mail_bo->icServer->ImapServerId);
|
||||
if (!($this->mail_bo->icServer->_connected == 1)) $this->mail_bo->openConnection($this->mail_bo->icServer->ImapServerId);
|
||||
@ -2552,7 +2558,12 @@ class mail_compose
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.$_searchString.'/'.$searchString.' in '.$k.'->'.$fA->displayName);
|
||||
$f=false;
|
||||
if (stripos($fA->displayName,$_searchString)!==false)
|
||||
if ($_searchStringLength<=0)
|
||||
{
|
||||
$f=true;
|
||||
$results[] = array('id'=>$k, 'label' => htmlspecialchars($fA->displayName));
|
||||
}
|
||||
if ($f==false && stripos($fA->displayName,$_searchString)!==false)
|
||||
{
|
||||
$f=true;
|
||||
$results[] = array('id'=>$k, 'label' => htmlspecialchars($fA->displayName));
|
||||
@ -2564,7 +2575,11 @@ class mail_compose
|
||||
}
|
||||
}
|
||||
//error_log(__METHOD__.__LINE__.' IcServer:'.$this->mail_bo->icServer->ImapServerId.':'.array2string($results));
|
||||
|
||||
if ($_returnList)
|
||||
{
|
||||
foreach ((array)$results as $k => $_result) {$rL[$_result['id']]=$_result['label'];};
|
||||
return $rL;
|
||||
}
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode($results);
|
||||
common::egw_exit();
|
||||
|
@ -799,12 +799,14 @@ class mail_hooks
|
||||
'link'=>false,
|
||||
'icon' => false
|
||||
);
|
||||
/*
|
||||
$file[] = array(
|
||||
'no_lang' => true,
|
||||
'text'=>'<span id="mail-index_buttontesthtmlarea" class="button" />',
|
||||
'link'=>false,
|
||||
'icon' => false
|
||||
);
|
||||
*/
|
||||
$file[] = array(
|
||||
'no_lang' => true,
|
||||
'text'=>'<span id="mail-tree_target" class="dtree" />',
|
||||
|
@ -1599,11 +1599,6 @@ unset($query['actions']);
|
||||
),
|
||||
));
|
||||
*/
|
||||
egw_framework::set_onload('$j(document).ready(function() {
|
||||
var subject = etemplate2.getByApplication(\'mail\')[0].widgetContainer.getWidgetById(\'mail_displaysubject\');
|
||||
var body = etemplate2.getByApplication(\'mail\')[0].widgetContainer.getWidgetById(\'mail_displaybody\');
|
||||
body.node.parentNode.style.top=subject.node.offsetTop+40+\'px\';
|
||||
});');
|
||||
$subject = /*mail_bo::htmlspecialchars(*/$this->mail_bo->decode_subject(preg_replace($nonDisplayAbleCharacters,'',$envelope['SUBJECT']),false)/*,
|
||||
mail_bo::$displayCharset)*/;
|
||||
if($envelope['FROM'][0] != $envelope['SENDER'][0]) {
|
||||
@ -2691,9 +2686,12 @@ blockquote[type=cite] {
|
||||
/**
|
||||
* importMessage
|
||||
*/
|
||||
function importMessage()
|
||||
function importMessage($content)
|
||||
{
|
||||
error_log(array2string($_POST));
|
||||
error_log(array2string($content));
|
||||
if (!is_array($content)) $content = array();
|
||||
$etpl = new etemplate_new('mail.importMessage');
|
||||
$etpl->exec('mail.mail_ui.importMessage',$content,$sel_options,$readonlys,$preserv,2);
|
||||
/*
|
||||
if (empty($importtype)) $importtype = htmlspecialchars($_POST["importtype"]);
|
||||
if (empty($toggleFS)) $toggleFS = htmlspecialchars($_POST["toggleFS"]);
|
||||
|
@ -63,7 +63,7 @@ app.mail = AppJS.extend(
|
||||
*/
|
||||
et2_ready: function(et2)
|
||||
{
|
||||
// call parent
|
||||
// call parent; somehow this function is called more often. (twice on a display and compose) why?
|
||||
this._super.apply(this, arguments);
|
||||
this.et2_obj = et2;
|
||||
this.et2 = et2.widgetContainer;
|
||||
@ -71,10 +71,24 @@ app.mail = AppJS.extend(
|
||||
var isDisplay = false;
|
||||
for (var t in et2.templates)
|
||||
{
|
||||
if (t=='mail.index') {isMainView=true;break;};
|
||||
if (t=='mail.display') {isDisplay=true;break;};
|
||||
//alert(t); // as we iterate through this more than once, ... we separate trigger and action
|
||||
switch (t) {
|
||||
case 'mail.index':
|
||||
isMainView=true;
|
||||
break;
|
||||
case 'mail.display':
|
||||
isDisplay=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//alert('action about to go down');
|
||||
if (isMainView) this.mail_disablePreviewArea(true);
|
||||
if (isDisplay)
|
||||
{
|
||||
var subject = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('mail_displaysubject');
|
||||
var body = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('mail_displaybody');
|
||||
body.node.parentNode.style.top=subject.node.offsetTop+40+'px';
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1148,6 +1162,29 @@ app.mail = AppJS.extend(
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Send names of uploaded files (again) to server, to process them: either copy to vfs or ask overwrite/rename
|
||||
*
|
||||
* @param _event
|
||||
* @param _file_count
|
||||
* @param {string} [_path=current directory] Where the file is uploaded to.
|
||||
*/
|
||||
uploadForImport: function(_event, _file_count, _path)
|
||||
{
|
||||
console.log(_event,_file_count,_path);
|
||||
if(typeof _path == 'undefined')
|
||||
{
|
||||
//_path = this.get_path();
|
||||
}
|
||||
if (_file_count && !jQuery.isEmptyObject(_event.data.getValue()))
|
||||
{
|
||||
// var widget = _event.data;
|
||||
// var request = new egw_json_request('filemanager_ui::ajax_action', ['upload', widget.getValue(), _path], this);
|
||||
// widget.set_value('');
|
||||
// request.sendRequest(false, this._upload_callback, this);
|
||||
}
|
||||
},
|
||||
|
||||
sieve_editRules_radiobtn: function()
|
||||
{
|
||||
console.log("hi i am radiobtn");
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* EGroupware - eTemplates for Application mail
|
||||
* http://www.egroupware.org
|
||||
* generated by soetemplate::dump4setup() 2013-06-05 13:45
|
||||
* generated by soetemplate::dump4setup() 2013-08-28 16:05
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package mail
|
||||
@ -14,7 +14,7 @@ $templ_version=1;
|
||||
|
||||
$templ_data[] = array('name' => 'mail.display','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:2:{i:0;a:2:{s:4:"name";s:3:"msg";s:4:"type";s:4:"html";}i:1;a:10:{s:5:"width";s:4:"100%";s:4:"name";s:11:"mailDisplay";s:4:"type";s:4:"vbox";s:4:"size";s:1:"6";i:1;a:7:{s:5:"width";s:4:"100%";s:4:"name";s:22:"mailDisplayHeadersFrom";s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:19:",mailDisplayHeaders";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"From";}i:2;a:3:{s:8:"readonly";s:4:"true";s:4:"name";s:18:"DisplayFromAddress";s:4:"type";s:9:"url-email";}}i:2;a:7:{s:5:"width";s:4:"100%";s:4:"name";s:20:"mailDisplayHeadersTo";s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:19:",mailDisplayHeaders";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:2:"To";}i:2;a:3:{s:8:"readonly";s:4:"true";s:4:"name";s:16:"DisplayToAddress";s:4:"type";s:9:"url-email";}}i:3;a:7:{s:5:"width";s:4:"100%";s:4:"name";s:22:"mailDisplayHeadersDate";s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:19:",mailDisplayHeaders";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Date";}i:2;a:4:{s:5:"align";s:4:"left";s:8:"readonly";s:4:"true";s:4:"name";s:11:"DisplayDate";s:4:"type";s:9:"date-time";}}i:4;a:7:{s:5:"width";s:4:"100%";s:4:"name";s:25:"mailDisplayHeadersSubject";s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:19:",mailDisplayHeaders";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Subject";}i:2;a:4:{s:5:"align";s:4:"left";s:8:"readonly";s:4:"true";s:4:"name";s:14:"DisplaySubject";s:4:"type";s:5:"label";}}i:5;a:4:{s:4:"name";s:16:"mailDisplayIcons";s:4:"type";s:4:"hbox";s:4:"size";s:1:"1";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Icons";}}i:6;a:4:{s:4:"name";s:20:"mailDisplayContainer";s:4:"type";s:3:"box";s:4:"size";s:1:"1";i:1;a:2:{s:4:"name";s:15:"mailDisplayBody";s:4:"type";s:4:"html";}}}}','size' => '','style' => '','modified' => '1370432711',);
|
||||
|
||||
$templ_data[] = array('name' => 'mail.importMessage','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:1;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1365666381',);
|
||||
$templ_data[] = array('name' => 'mail.importMessage','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:1:{s:4:"type";s:4:"file";}}i:2;a:1:{s:1:"A";a:1:{s:4:"type";s:3:"vfs";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1377698715',);
|
||||
|
||||
$templ_data[] = array('name' => 'mail.index','template' => '','lang' => '','group' => '0','version' => '1.9.001','data' => 'a:3:{i:0;a:5:{s:11:"autoloading";s:28:"mail.mail_ui.ajax_foldertree";s:7:"onclick";s:56:"app.mail.mail_changeFolder(widget.event_args[0],widget);";s:11:"parent_node";s:11:"tree_target";s:4:"name";s:14:"nm[foldertree]";s:4:"type";s:4:"tree";}i:1;a:2:{s:4:"name";s:3:"msg";s:4:"type";s:4:"html";}i:2;a:7:{s:9:"dock_side";s:10:"bottomDock";s:11:"orientation";s:1:"h";s:4:"name";s:12:"mailSplitter";s:4:"type";s:5:"split";s:4:"size";s:1:"2";i:1;a:4:{s:8:"onselect";s:21:"app.mail.mail_preview";s:4:"name";s:2:"nm";s:4:"type";s:9:"nextmatch";s:4:"size";s:15:"mail.index.rows";}i:2;a:10:{s:5:"width";s:4:"100%";s:4:"name";s:11:"mailPreview";s:4:"type";s:4:"vbox";s:4:"size";s:1:"6";i:1;a:7:{s:5:"width";s:4:"100%";s:4:"name";s:22:"mailPreviewHeadersFrom";s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:19:",mailPreviewHeaders";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"From";}i:2;a:3:{s:8:"readonly";s:4:"true";s:4:"name";s:18:"previewFromAddress";s:4:"type";s:9:"url-email";}}i:2;a:7:{s:5:"width";s:4:"100%";s:4:"name";s:20:"mailPreviewHeadersTo";s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:19:",mailPreviewHeaders";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:2:"To";}i:2;a:3:{s:8:"readonly";s:4:"true";s:4:"name";s:16:"previewToAddress";s:4:"type";s:9:"url-email";}}i:3;a:7:{s:5:"width";s:4:"100%";s:4:"name";s:22:"mailPreviewHeadersDate";s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:19:",mailPreviewHeaders";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Date";}i:2;a:4:{s:5:"align";s:4:"left";s:8:"readonly";s:4:"true";s:4:"name";s:11:"previewDate";s:4:"type";s:9:"date-time";}}i:4;a:7:{s:5:"width";s:4:"100%";s:4:"name";s:25:"mailPreviewHeadersSubject";s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";s:4:"span";s:19:",mailPreviewHeaders";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Subject";}i:2;a:4:{s:5:"align";s:4:"left";s:8:"readonly";s:4:"true";s:4:"name";s:14:"previewSubject";s:4:"type";s:5:"label";}}i:5;a:4:{s:4:"name";s:16:"mailPreviewIcons";s:4:"type";s:4:"hbox";s:4:"size";s:1:"1";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Icons";}}i:6;a:4:{s:4:"name";s:20:"mailPreviewContainer";s:4:"type";s:3:"box";s:4:"size";s:1:"1";i:1;a:4:{s:11:"frameborder";s:1:"1";s:9:"scrolling";s:4:"auto";s:4:"name";s:13:"messageIFRAME";s:4:"type";s:6:"iframe";}}}}}','size' => '','style' => '','modified' => '1370427910',);
|
||||
|
||||
|
13
mail/templates/default/importMessage.xet
Normal file
13
mail/templates/default/importMessage.xet
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="mail.importMessage" template="" lang="" group="0" version="1.9.001">
|
||||
<vbox id ="divImportArea">
|
||||
<hbox span="all">
|
||||
<description value="Store to Folder"/>
|
||||
<taglist id="FOLDER" width="50%" autocomplete_url='mail.mail_compose.ajax_searchFolder' autocomplete_params='' maxSelection="1" allowFreeEntries="false" onclick="app.mail.address_click"/>
|
||||
</hbox>
|
||||
<file statustext="Select file to import into Folder" onFinish="app.mail.uploadForImport" mime="message/rfc822" id="uploadForImport" drop_target ="mail-importMessage_divImportArea"/>
|
||||
</vbox>>
|
||||
</template>
|
||||
</overlay>
|
Loading…
Reference in New Issue
Block a user