fix up preview area actions

This commit is contained in:
Klaus Leithoff 2013-10-14 13:30:04 +00:00
parent 38504680b7
commit 7f574b0a2a
2 changed files with 136 additions and 5 deletions

View File

@ -3027,19 +3027,23 @@ class mail_bo
/** /**
* htmlspecialchars * 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 string $_string input to be converted
* @param mixed $charset false or string -> Target charset, if false mail displayCharset will be used * @param mixed $charset false or string -> Target charset, if false mail displayCharset will be used
* @return string * @return string
*/ */
static function htmlspecialchars($_string, $_charset=false) static function htmlspecialchars($_string, $_charset=false)
{ {
return $_string;
/*
//setting the charset (if not given) //setting the charset (if not given)
if ($_charset===false) $_charset = self::$displayCharset; if ($_charset===false) $_charset = self::$displayCharset;
$_stringORG = $_string; $_stringORG = $_string;
$_string = @htmlspecialchars($_string,ENT_QUOTES,$_charset, false); $_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); if (empty($_string) && !empty($_stringORG)) $_string = @htmlspecialchars(translation::convert($_stringORG,translation::detect_encoding($_stringORG),$_charset),ENT_QUOTES | ENT_IGNORE,$_charset, false);
return $_string; return $_string;
*/
} }
/** /**

View File

@ -72,6 +72,7 @@ app.mail = AppJS.extend(
this.et2 = et2.widgetContainer; this.et2 = et2.widgetContainer;
var isMainView = false; var isMainView = false;
var isDisplay = false; var isDisplay = false;
var isCompose = false;
for (var t in et2.templates) for (var t in et2.templates)
{ {
//alert(t); // as we iterate through this more than once, ... we separate trigger and action //alert(t); // as we iterate through this more than once, ... we separate trigger and action
@ -85,7 +86,7 @@ app.mail = AppJS.extend(
break; break;
case 'mail.compose': case 'mail.compose':
this.mail_isMainWindow = false; this.mail_isMainWindow = false;
isCompose = true;
} }
} }
//alert('action about to go down'); //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())); //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()))); 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 = []; var _senders = [];
_senders.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); _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; var _id = _senders[0].id;
// reinitialize the buffer-info on selected mails // reinitialize the buffer-info on selected mails
@ -223,6 +245,14 @@ app.mail = AppJS.extend(
var _elems = []; var _elems = [];
_elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); _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); console.log(_action, _elems);
// Extra info passed to egw.open() // Extra info passed to egw.open()
@ -658,7 +688,7 @@ app.mail = AppJS.extend(
mail_refreshMessageGrid: function(_isPopup) { mail_refreshMessageGrid: function(_isPopup) {
if (typeof _isPopup == 'undefined') _isPopup = false; if (typeof _isPopup == 'undefined') _isPopup = false;
var nm; var nm;
if (_isPopup) if (_isPopup && !this.mail_isMainWindow)
{ {
nm = window.opener.etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById(this.nm_index); nm = window.opener.etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById(this.nm_index);
} }
@ -750,6 +780,14 @@ app.mail = AppJS.extend(
var _elems = []; var _elems = [];
_elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); _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); var msg = this.mail_getFormData(_elems);
//alert(_action.id+','+ msg); //alert(_action.id+','+ msg);
@ -928,6 +966,14 @@ app.mail = AppJS.extend(
msg = {}; msg = {};
msg['msg'] = [this.et2.getArrayMgr('content').getEntry('mail_id') || '']; 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); //alert(_action.id+' - '+_elems[0].id);
@ -991,6 +1037,14 @@ app.mail = AppJS.extend(
var _elems = []; var _elems = [];
_elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); _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+')'); //alert('mail_header('+_elems[0].id+')');
var url = window.egw_webserverUrl+'/index.php?'; var url = window.egw_webserverUrl+'/index.php?';
@ -1014,6 +1068,14 @@ app.mail = AppJS.extend(
var _elems = []; var _elems = [];
_elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); _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+')'); //alert('mail_mailsource('+_elems[0].id+')');
var url = window.egw_webserverUrl+'/index.php?'; var url = window.egw_webserverUrl+'/index.php?';
@ -1038,6 +1100,14 @@ app.mail = AppJS.extend(
var _elems = []; var _elems = [];
_elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); _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+')'); //alert('mail_save('+_elems[0].id+')');
var url = window.egw_webserverUrl+'/index.php?'; var url = window.egw_webserverUrl+'/index.php?';
@ -1073,6 +1143,14 @@ app.mail = AppJS.extend(
var _elems = []; var _elems = [];
_elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); _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 _id = _elems[0].id;
var dataElem = egw.dataGetUIDdata(_id); var dataElem = egw.dataGetUIDdata(_id);
@ -1106,12 +1184,37 @@ app.mail = AppJS.extend(
var _elems = []; var _elems = [];
_elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); _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; //alert('mail_infolog('+_elems[0].id+')');return;
console.log(_action, _elems);
var url = window.egw_webserverUrl+'/index.php?'; var url = window.egw_webserverUrl+'/index.php?';
url += 'menuaction=infolog.infolog_ui.import_mail'; // todo compose for Draft folder url += 'menuaction=infolog.infolog_ui.import_mail'; // todo compose for Draft folder
url += '&rowid='+_elems[0].id; 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 = []; var _elems = [];
_elems.push({id:this.et2.getArrayMgr("content").getEntry('mail_id') || ''}); _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+')'); //alert('mail_tracker('+_elems[0].id+')');
var url = window.egw_webserverUrl+'/index.php?'; var url = window.egw_webserverUrl+'/index.php?';
url += 'menuaction=tracker.tracker_ui.import_mail'; // todo compose for Draft folder url += 'menuaction=tracker.tracker_ui.import_mail'; // todo compose for Draft folder
url += '&rowid='+_elems[0].id; 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]));
}, },