From 4fac065351cd6e6a5d7927b32a08288e3beafea6 Mon Sep 17 00:00:00 2001 From: janw Date: Mon, 3 Apr 2006 13:00:02 +0000 Subject: [PATCH] Automatic resizing of divlists (height+width). git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2955 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/include/focus.js | 45 +++++++++++++++++++++++++++++++++++---- include/class_divlist.inc | 8 +++---- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/html/include/focus.js b/html/include/focus.js index cce26f4ef..4e68a3718 100644 --- a/html/include/focus.js +++ b/html/include/focus.js @@ -195,15 +195,52 @@ function js_check(form) { form.javascript.value = 'true'; } -window.onload = register; -window.onresize = register; +window.onload = adjust; +window.onresize = adjust; -function register(e) { +function adjust(e) { + adjust_height(e); + adjust_width(e); +} + +// Automatic resize (height) of divlists +function adjust_height(e) { if (!e) e=window.event; - var px_height= window.innerHeight-220; + var px_height= window.innerHeight-230; if(px_height >= 480) { document.getElementById("d_scrollbody").style.height=px_height+"px"; } return true; } + +// Automatic resize (width) of divlists +function adjust_width(e) { + if (!e) e=window.event; + + // Resize the div + var div_width=parseInt(document.defaultView.getComputedStyle(document.getElementById("t_scrolltable"),"").getPropertyValue('width')); + var width= parseInt(window.innerWidth); + + // Resize the body cells + var diff= width-div_width-430; + + // window has been upscaled + if(div_width+diff>=600) { + document.getElementById('d_scrollbody').style.width=div_width+diff+"px"; + document.getElementById('t_scrollbody').style.width=(div_width-19)+diff+"px"; + + // Resize the Header cells (only the relative-width ones) + document.getElementById('t_scrollhead').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').style.width=div_width+"px"; + document.getElementById('t_scrollbody').style.width=(div_width-19)+"px"; + + // Resize the Header cells (only the relative-width ones) + document.getElementById('t_scrollhead').style.width=div_width+"px"; + } +} // vim:ts=2:syntax diff --git a/include/class_divlist.inc b/include/class_divlist.inc index 62a4dd31e..fe836f453 100644 --- a/include/class_divlist.inc +++ b/include/class_divlist.inc @@ -58,7 +58,7 @@ class divlist { function DrawList(){ $s_return = ""; - $s_return.= ""; + $s_return.= "
"; $s_return.= $this->_generateHeader(); $s_return.=$this->_generatePage(); @@ -91,7 +91,7 @@ class divlist { // Using scrolltable? if($this->i_entriesPerPage == 0) { - $s_return .= "\n
"; + $s_return .= "\n
"; } $s_return .= "\n"; @@ -108,7 +108,7 @@ class divlist { } - // Attach a 18px-wide column (used as scrollbar space in body-table), + // Attach a 13px-wide column (used as scrollbar space in body-table), // but do this only if we are really using scrolltables. if($this->i_entriesPerPage == 0) { $s_return .= "\n"; @@ -132,7 +132,7 @@ 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
 
"; - $s_return .= ""; + $s_return .= "
"; } $i_alternate=0; -- 2.30.2