allow app to specify "availHeight" for its popup height and keep that height in automatic resize, for OS (eg. Linux) does not report an availHeight < height, we subtract 100px

This commit is contained in:
Ralf Becker 2014-11-10 10:41:23 +00:00
parent 318ebe29a2
commit df7025f879
3 changed files with 17 additions and 8 deletions

View File

@ -77,26 +77,23 @@ class mail_hooks
'menuaction' => 'mail.mail_ui.displayMessage',
),
'view_id' => 'id',
'view_popup' => '870xegw_getWindowOuterHeight()',
//'view_popup' => '870x800',
'view_popup' => '870xavailHeight',
'view_list' => 'mail.mail_ui.index',
'add' => array(
'menuaction' => 'mail.mail_compose.compose',
),
//'add_popup' => '870xegw_getWindowOuterHeight()',
'add_popup' => '870x800',
'add_popup' => '870xavailHeight',
'edit' => array(
'menuaction' => 'mail.mail_compose.compose',
),
'edit_id' => 'id',
//'edit_popup' => '870xegw_getWindowOuterHeight()',
'edit_popup' => '870x800',
'edit_popup' => '870xavailHeight',
// register mail as handler for .eml files
'mime' => array(
'message/rfc822' => array(
'menuaction' => 'mail.mail_ui.importMessageFromVFS2DraftAndDisplay',
'mime_url' => 'formData[file]',
'mime_popup' => '870xegw_getWindowOuterHeight()',
'mime_popup' => '870xavailHeight',
),
),
'entry' => 'Mail',

View File

@ -235,6 +235,10 @@
// to take padding/margin into account
var delta_width = w.width - ($et2.outerWidth(true) + ($main_div.outerWidth(true) - $main_div.width()));
var delta_height = w.height - ($et2.outerHeight(true) + ($main_div.outerHeight(true) - $main_div.height()));
if (delta_height && egw_getWindowOuterHeight() >= egw.availHeight())
{
delta_height = 0;
}
if(delta_width != 0 || delta_height != 0)
{
window.resizeTo(egw_getWindowOuterWidth() - delta_width,egw_getWindowOuterHeight() - delta_height);

View File

@ -279,7 +279,7 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
if (_popup)
{
var w_h = _popup.split('x');
if (w_h[1] == 'egw_getWindowOuterHeight()') w_h[1] = egw_getWindowOuterHeight();
if (w_h[1] == 'availHeight') w_h[1] = this.availHeight();
var popup_window = _wnd.egw_openWindowCentered2(url, _target || '_blank', w_h[0], w_h[1], false, _target_app, true);
// Remember which windows are open
@ -303,6 +303,14 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
}
},
/**
* Get available height of screen
*/
availHeight: function()
{
return screen.availHeight < screen.height ? screen.availHeight : screen.height - 100;
},
/**
* Use frameworks (framed template) link handler to open a url
*