Code

Updated resizing for divlists
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 2 Jun 2006 07:12:56 +0000 (07:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 2 Jun 2006 07:12:56 +0000 (07:12 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3625 594d385d-05f5-0310-b6e9-bd551577e9d8

html/include/focus.js
include/class_divlist.inc

index 00ae1bb9a5dd47ba072c9514516a647cf67720f1..2ee14d6b63c2cc088f12346022fbc4120f1af1c0 100644 (file)
@@ -195,10 +195,13 @@ function js_check(form) {
        form.javascript.value = 'true';
 }
 
-window.onload = adjust_width;
-window.onresize = adjust_width;
-window.onload = adjust_height;
-window.onresize = adjust_height;
+window.onload = adjust;
+window.onresize = adjust;
+
+function adjust (e) {
+       adjust_height(e);
+       adjust_width(e);
+}
 
 // Automatic resize (height) of divlists
 function adjust_height(e) {
@@ -259,6 +262,32 @@ function adjust_width(e) {
                        // Resize the Header cells (only the relative-width ones)
                        document.getElementById('t_scrollhead').style.width=div_width+"px";
                }
+       } else if(document.defaultView && document.getElementById("t_scrolltable_onlywidth")) {
+               // Resize the div
+               var div_width=parseInt(document.defaultView.getComputedStyle(document.getElementById("t_scrolltable_onlywidth"),"").getPropertyValue('width'));
+               var width= parseInt(window.innerWidth);
+
+               // Resize the body cells
+               var diff= width-div_width-470;
+               
+               // window has been upscaled
+               if(div_width+diff>=600) {
+                       document.getElementById('d_scrollbody_onlywidth').style.width=div_width+diff+"px";
+                       document.getElementById('t_scrollbody_onlywidth').style.width=(div_width-19)+diff+"px";
+       
+                       // Resize the Header cells (only the relative-width ones)
+                       document.getElementById('t_scrollhead_onlywidth').style.width=div_width+diff+"px";
+
+               // window has been downscaled, we must reset the div to 600px
+               } else if (width < 930) {
+                       // Reset layout (set width to 600px)
+                       div_width=600;
+                       document.getElementById('d_scrollbody_onlywidth').style.width=div_width+"px";
+                       document.getElementById('t_scrollbody_onlywidth').style.width=(div_width-19)+"px";
+       
+                       // Resize the Header cells (only the relative-width ones)
+                       document.getElementById('t_scrollhead_onlywidth').style.width=div_width+"px";
+               }
        } else {
                // IE
 
index 52eaecce87fb642fae430ec7c3afbf368377b0d6..8b0548a191b5cd477847f8fd690ea7307282ecd7 100644 (file)
@@ -16,6 +16,8 @@ class divlist {
        var $i_currentPage;
        var $i_entriesPerPage;
 
+  var $force_height = false;
+  
        // Added php 4 constructor
        function divlist($pageid){
 
@@ -49,6 +51,7 @@ class divlist {
        
   function SetHeight($s_height) {
                $this->s_height= $s_height;
+    $this->force_height = true;
        }
   
   function SetWidth($s_width) {
@@ -61,9 +64,15 @@ class divlist {
        
        function DrawList(){
                $s_return = "";
-               $s_return.= "<table summary='".$this->s_summary."' style='width:".
-                $this->s_width."px;height:".$this->s_height.
-                "px;' cellspacing='0' id='t_scrolltable'>";
+    if(!$this->force_height){
+                 $s_return.= "<table summary='".$this->s_summary."' style='width:".
+                  $this->s_width."px;height:".$this->s_height.
+                  "px;' cellspacing='0' id='t_scrolltable'>";
+    } else {
+                 $s_return.= "<table summary='".$this->s_summary."' style='width:".
+                  $this->s_width."px;height:".$this->s_height.
+                  "px;' cellspacing='0' id='t_scrolltable_onlywidth'>";
+    }
 
     $s_return.= $this->_generateHeader();
     $s_return.=$this->_generatePage();
@@ -95,7 +104,11 @@ class divlist {
                
     // Using scrolltable?
     if($this->i_entriesPerPage == 0) {
-      $s_return.= "\n<tr><td class='scrollhead'><table summary='' style='width:".$this->s_width."px;' cellspacing='0' id='t_scrollhead'>";
+      if(!$this->force_height) {
+        $s_return.= "\n<tr><td class='scrollhead'><table summary='' style='width:".$this->s_width."px;' cellspacing='0' id='t_scrollhead'>";
+      } else {
+        $s_return.= "\n<tr><td class='scrollhead'><table summary='' style='width:".$this->s_width."px;' cellspacing='0' id='t_scrollhead_onlywidth'>";
+      }
     }
 
                $s_return.= "\n<tr>";
@@ -135,8 +148,13 @@ class divlist {
    
     if($this->i_entriesPerPage == 0) {
       // We need to construct a "body"-table that is width-of-scrollbar thinner than the "head"-table.
-      $s_return .= "\n<tr><td colspan='".$this->cols."' class='scrollbody'><div style='width:".$this->s_width."px;height:".($this->s_height-20)."px;' id='d_scrollbody' class='scrollbody'>";
-      $s_return .= "<table summary='' style='height:100%;width:581px;' cellspacing='0' id='t_scrollbody'>";
+      if(!$this->force_height) {
+        $s_return .= "\n<tr><td colspan='".$this->cols."' class='scrollbody'><div style='width:".$this->s_width."px;height:".($this->s_height-20)."px;' id='d_scrollbody' class='scrollbody'>";
+        $s_return .= "<table summary='' style='height:100%;width:581px;' cellspacing='0' id='t_scrollbody'>";
+      } else {
+        $s_return .= "\n<tr><td colspan='".$this->cols."' class='scrollbody'><div style='width:".$this->s_width."px;height:".($this->s_height-20)."px;' id='d_scrollbody' class='scrollbody_onlywidth'>";
+        $s_return .= "<table summary='' style='height:100%;width:581px;' cellspacing='0' id='t_scrollbody_onlywidth'>";
+      }
        }
  
     $i_alternate=0;