From 89f240bc113bfc5fb50078317b33d7dff7f47b9e Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 2 Jun 2006 07:12:56 +0000 Subject: [PATCH] Updated resizing for divlists git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3625 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/include/focus.js | 37 +++++++++++++++++++++++++++++++++---- include/class_divlist.inc | 30 ++++++++++++++++++++++++------ 2 files changed, 57 insertions(+), 10 deletions(-) diff --git a/html/include/focus.js b/html/include/focus.js index 00ae1bb9a..2ee14d6b6 100644 --- a/html/include/focus.js +++ b/html/include/focus.js @@ -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 diff --git a/include/class_divlist.inc b/include/class_divlist.inc index 52eaecce8..8b0548a19 100644 --- a/include/class_divlist.inc +++ b/include/class_divlist.inc @@ -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.= ""; + if(!$this->force_height){ + $s_return.= "
"; + } else { + $s_return.= "
"; + } $s_return.= $this->_generateHeader(); $s_return.=$this->_generatePage(); @@ -95,7 +104,11 @@ class divlist { // Using scrolltable? if($this->i_entriesPerPage == 0) { - $s_return.= "\n
"; + if(!$this->force_height) { + $s_return.= "\n
"; + } else { + $s_return.= "\n
"; + } } $s_return.= "\n"; @@ -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
"; - $s_return .= ""; + if(!$this->force_height) { + $s_return .= "\n
"; + $s_return .= ""; + } else { + $s_return .= "\n
"; + $s_return .= ""; + } } $i_alternate=0; -- 2.30.2