From 7f574b0a2a01cfb3058b7f9a5f41bce2cf609626 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Mon, 14 Oct 2013 13:30:04 +0000 Subject: [PATCH] fix up preview area actions --- mail/inc/class.mail_bo.inc.php | 6 +- mail/js/app.js | 135 ++++++++++++++++++++++++++++++++- 2 files changed, 136 insertions(+), 5 deletions(-) diff --git a/mail/inc/class.mail_bo.inc.php b/mail/inc/class.mail_bo.inc.php index 2e08de1cfe..da686232c7 100644 --- a/mail/inc/class.mail_bo.inc.php +++ b/mail/inc/class.mail_bo.inc.php @@ -3027,19 +3027,23 @@ class mail_bo /** * htmlspecialchars - * helperfunction to cope with wrong encoding in strings + * helperfunction to cope with wrong encoding in strings; + * seems to be outdated and not needed any more for et2 * @param string $_string input to be converted * @param mixed $charset false or string -> Target charset, if false mail displayCharset will be used * @return string */ static function htmlspecialchars($_string, $_charset=false) { + return $_string; +/* //setting the charset (if not given) if ($_charset===false) $_charset = self::$displayCharset; $_stringORG = $_string; $_string = @htmlspecialchars($_string,ENT_QUOTES,$_charset, false); if (empty($_string) && !empty($_stringORG)) $_string = @htmlspecialchars(translation::convert($_stringORG,translation::detect_encoding($_stringORG),$_charset),ENT_QUOTES | ENT_IGNORE,$_charset, false); return $_string; +*/ } /** diff --git a/mail/js/app.js b/mail/js/app.js index 9d3f989c89..3a13554654 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -72,6 +72,7 @@ app.mail = AppJS.extend( this.et2 = et2.widgetContainer; var isMainView = false; var isDisplay = false; + var isCompose = false; for (var t in et2.templates) { //alert(t); // as we iterate through this more than once, ... we separate trigger and action @@ -85,7 +86,7 @@ app.mail = AppJS.extend( break; case 'mail.compose': this.mail_isMainWindow = false; - + isCompose = true; } } //alert('action about to go down'); @@ -113,6 +114,19 @@ app.mail = AppJS.extend( //alert('resizing to'+(w_h[0]?w_h[0]:870)+','+(w_h[1]?w_h[1]:egw_getWindowOuterHeight())); window.resizeTo((w_h[0]?w_h[0]:870),(w_h[1]?w_h[1]:(screen.availHeight>egw_getWindowOuterHeight()?screen.availHeight:egw_getWindowOuterHeight()))); } + if (isCompose) + { + var app_registry = egw.link_get_registry('mail');//this.appname); + //console.log(app_registry); + w=870; + if (typeof app_registry['edit'] != 'undefined' && typeof app_registry['edit_popup'] != 'undefined' ) + { + var w_h =app_registry['edit_popup'].split('x'); + if (w_h[1] == 'egw_getWindowOuterHeight()') w_h[1] = (screen.availHeight>egw_getWindowOuterHeight()?screen.availHeight:egw_getWindowOuterHeight()); + } + //alert('resizing to'+(w_h[0]?w_h[0]:870)+','+(w_h[1]?w_h[1]:egw_getWindowOuterHeight())); + window.resizeTo((w_h[0]?w_h[0]:870),(w_h[1]?w_h[1]:(screen.availHeight>egw_getWindowOuterHeight()?screen.availHeight:egw_getWindowOuterHeight()))); + } }, /** @@ -166,6 +180,14 @@ app.mail = AppJS.extend( var _senders = []; _senders.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); } + if (typeof _senders == 'undefined' && this.mail_isMainWindow) + { + if (this.mail_currentlyFocussed) + { + var _senders = []; + _senders.push({id:this.mail_currentlyFocussed}); + } + } } var _id = _senders[0].id; // reinitialize the buffer-info on selected mails @@ -223,6 +245,14 @@ app.mail = AppJS.extend( var _elems = []; _elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); } + if (typeof _elems == 'undefined' && this.mail_isMainWindow) + { + if (this.mail_currentlyFocussed) + { + var _elems = []; + _elems.push({id:this.mail_currentlyFocussed}); + } + } } console.log(_action, _elems); // Extra info passed to egw.open() @@ -658,7 +688,7 @@ app.mail = AppJS.extend( mail_refreshMessageGrid: function(_isPopup) { if (typeof _isPopup == 'undefined') _isPopup = false; var nm; - if (_isPopup) + if (_isPopup && !this.mail_isMainWindow) { nm = window.opener.etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById(this.nm_index); } @@ -750,6 +780,14 @@ app.mail = AppJS.extend( var _elems = []; _elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); } + if (typeof _elems == 'undefined' && this.mail_isMainWindow) + { + if (this.mail_currentlyFocussed) + { + var _elems = []; + _elems.push({id:this.mail_currentlyFocussed}); + } + } } var msg = this.mail_getFormData(_elems); //alert(_action.id+','+ msg); @@ -928,6 +966,14 @@ app.mail = AppJS.extend( msg = {}; msg['msg'] = [this.et2.getArrayMgr('content').getEntry('mail_id') || '']; } + if (typeof _elems == 'undefined' && this.mail_isMainWindow) + { + if (this.mail_currentlyFocussed) + { + msg = {}; + msg['msg'] = [this.mail_currentlyFocussed]; + } + } } //alert(_action.id+' - '+_elems[0].id); @@ -991,6 +1037,14 @@ app.mail = AppJS.extend( var _elems = []; _elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); } + if (typeof _elems == 'undefined' && this.mail_isMainWindow) + { + if (this.mail_currentlyFocussed) + { + var _elems = []; + _elems.push({id:this.mail_currentlyFocussed}); + } + } } //alert('mail_header('+_elems[0].id+')'); var url = window.egw_webserverUrl+'/index.php?'; @@ -1014,6 +1068,14 @@ app.mail = AppJS.extend( var _elems = []; _elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); } + if (typeof _elems == 'undefined' && this.mail_isMainWindow) + { + if (this.mail_currentlyFocussed) + { + var _elems = []; + _elems.push({id:this.mail_currentlyFocussed}); + } + } } //alert('mail_mailsource('+_elems[0].id+')'); var url = window.egw_webserverUrl+'/index.php?'; @@ -1038,6 +1100,14 @@ app.mail = AppJS.extend( var _elems = []; _elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); } + if (typeof _elems == 'undefined' && this.mail_isMainWindow) + { + if (this.mail_currentlyFocussed) + { + var _elems = []; + _elems.push({id:this.mail_currentlyFocussed}); + } + } } //alert('mail_save('+_elems[0].id+')'); var url = window.egw_webserverUrl+'/index.php?'; @@ -1073,6 +1143,14 @@ app.mail = AppJS.extend( var _elems = []; _elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); } + if (typeof _elems == 'undefined' && this.mail_isMainWindow) + { + if (this.mail_currentlyFocussed) + { + var _elems = []; + _elems.push({id:this.mail_currentlyFocussed}); + } + } } var _id = _elems[0].id; var dataElem = egw.dataGetUIDdata(_id); @@ -1106,12 +1184,37 @@ app.mail = AppJS.extend( var _elems = []; _elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); } + if (typeof _elems == 'undefined' && this.mail_isMainWindow) + { + if (this.mail_currentlyFocussed) + { + var _elems = []; + _elems.push({id:this.mail_currentlyFocussed}); + } + } + if (typeof _action.data.width == 'undefined' && typeof _action.data.height == 'undefined' && !(typeof _action.data.event == 'undefined' &&typeof _action.data.event.popup == 'undefined')) + { + if (_action.data.event.popup) + { + var app_registry = _action.data.event.popup; + } + else + { + var app_registry = egw.link_get_registry('infolog');//this.appname); + } + //console.log(app_registry); + if (typeof app_registry['edit'] != 'undefined' && typeof app_registry['edit_popup'] != 'undefined' ) + { + var w_h =app_registry['edit_popup'].split('x'); + } + } } //alert('mail_infolog('+_elems[0].id+')');return; + console.log(_action, _elems); var url = window.egw_webserverUrl+'/index.php?'; url += 'menuaction=infolog.infolog_ui.import_mail'; // todo compose for Draft folder url += '&rowid='+_elems[0].id; - egw_openWindowCentered(url,'import_mail_'+_elems[0].id,_action.data.width,_action.data.height); + egw_openWindowCentered(url,'import_mail_'+_elems[0].id,(_action.data.width?_action.data.width:w_h[0]),(_action.data.height?_action.data.height:w_h[1])); }, /** @@ -1129,12 +1232,36 @@ app.mail = AppJS.extend( var _elems = []; _elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); } + if (typeof _elems == 'undefined' && this.mail_isMainWindow) + { + if (this.mail_currentlyFocussed) + { + var _elems = []; + _elems.push({id:this.mail_currentlyFocussed}); + } + } + if (typeof _action.data.width == 'undefined' && typeof _action.data.height == 'undefined' && !(typeof _action.data.event == 'undefined' &&typeof _action.data.event.popup == 'undefined')) + { + if (_action.data.event.popup) + { + var app_registry = _action.data.event.popup; + } + else + { + var app_registry = egw.link_get_registry('infolog');//this.appname); + } + //console.log(app_registry); + if (typeof app_registry['edit'] != 'undefined' && typeof app_registry['edit_popup'] != 'undefined' ) + { + var w_h =app_registry['edit_popup'].split('x'); + } + } } //alert('mail_tracker('+_elems[0].id+')'); var url = window.egw_webserverUrl+'/index.php?'; url += 'menuaction=tracker.tracker_ui.import_mail'; // todo compose for Draft folder url += '&rowid='+_elems[0].id; - egw_openWindowCentered(url,'import_tracker_'+_elems[0].id,_action.data.width,_action.data.height); + egw_openWindowCentered(url,'import_tracker_'+_elems[0].id,(_action.data.width?_action.data.width:w_h[0]),(_action.data.height?_action.data.height:w_h[1])); },