From ba64c08edda8b348e2391af36808ab39bfb3ff05 Mon Sep 17 00:00:00 2001 From: janw Date: Fri, 19 May 2006 09:38:10 +0000 Subject: [PATCH] Removed js errors when not showing divlists. Divlists now have minimum height (=height of menu on the left) and minimum width (fixed size). Resizing should work properly with at least firefox and konqueror (both tested). git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3456 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/include/focus.js | 29 ++++++++++++++++++++++------- ihtml/themes/altlinux/framework.tpl | 2 +- ihtml/themes/default/framework.tpl | 2 +- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/html/include/focus.js b/html/include/focus.js index 18bca2140..ccee6a47d 100644 --- a/html/include/focus.js +++ b/html/include/focus.js @@ -206,12 +206,27 @@ function adjust(e) { // Automatic resize (height) of divlists function adjust_height(e) { if (!e) e=window.event; - var px_height= window.innerHeight-230; - if(document.defaultView) { - var div_width=parseInt(document.defaultView.getComputedStyle(document.getElementById("t_scrolltable"),"").getPropertyValue('height')); - } - if(px_height >= 480) { - document.getElementById("d_scrollbody").style.height=px_height+"px"; + if (document.getElementById("menucell") && document.getElementById("d_scrollbody")) { + var inner_height= window.innerHeight; + var min_height= 450; + var px_height= min_height; + var suggested= px_height; + + // document.defaultView allows access to the rendered size of elements and should be supported by modern browsers + if(document.defaultView) { + var menu_height=parseInt(document.defaultView.getComputedStyle(document.getElementById("menucell"),"").getPropertyValue('height')); + + // Minimum height for divlist should be the bottom edge of the menu + min_height= menu_height-197; + suggested= min_height; + if((inner_height-230)-suggested>0) { + suggested= inner_height-230; + } + + } else if(px_height >= 450) { + suggested= px_height-230; + } + document.getElementById("d_scrollbody").style.height=suggested+"px"; } return true; } @@ -221,7 +236,7 @@ function adjust_width(e) { if (!e) e=window.event; // Known to not work with IE - if(document.defaultView) { + if(document.defaultView && document.getElementById("t_scrolltable")) { // Resize the div var div_width=parseInt(document.defaultView.getComputedStyle(document.getElementById("t_scrolltable"),"").getPropertyValue('width')); var width= parseInt(window.innerWidth); diff --git a/ihtml/themes/altlinux/framework.tpl b/ihtml/themes/altlinux/framework.tpl index fd90ab66d..a412873c3 100644 --- a/ihtml/themes/altlinux/framework.tpl +++ b/ihtml/themes/altlinux/framework.tpl @@ -36,7 +36,7 @@ - +
 
{$menu}
diff --git a/ihtml/themes/default/framework.tpl b/ihtml/themes/default/framework.tpl index aecd63b3b..f51784b56 100644 --- a/ihtml/themes/default/framework.tpl +++ b/ihtml/themes/default/framework.tpl @@ -37,7 +37,7 @@ - +
 
{$menu}
-- 2.30.2