Code

Removed js errors when not showing divlists.
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 19 May 2006 09:38:10 +0000 (09:38 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 19 May 2006 09:38:10 +0000 (09:38 +0000)
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
ihtml/themes/altlinux/framework.tpl
ihtml/themes/default/framework.tpl

index 18bca214033ae1f6250e61493877e9dd782c8e2a..ccee6a47da5c4b46636377b8e5a2cc5c96ed91ef 100644 (file)
@@ -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);
index fd90ab66dbe41005eedf7fe04c7aef5cbd4527df..a412873c3ff2b2c9ae885b91ed4cf704628e0b62 100644 (file)
@@ -36,7 +36,7 @@
   </tr>
   <tr style="vertical-align:top;">
     <!-- Menu -->
-    <td style="background-color:#5353ad; vertical-align:top;">
+    <td style="background-color:#5353ad; vertical-align:top;" id="menucell">
       <div style="background-color:#5353ad; height:12px; width:100%;">&nbsp;</div>
       {$menu}
          <br>
index aecd63b3bff7edb111e1917b06e0ecfb8639f145..f51784b56461c7754e611e427150c6147013d228 100644 (file)
@@ -37,7 +37,7 @@
 
   <tr style="vertical-align:top;">
     <!-- Menu -->
-    <td style="background-color:#EEFFE6; vertical-align:top;" >
+    <td style="background-color:#EEFFE6; vertical-align:top;" id="menucell">
       <div style="background-color:#CDF6BD; height:12px; width:100%;">&nbsp;</div>
       {$menu}
          <br />