From: hickert Date: Wed, 7 Nov 2007 14:51:39 +0000 (+0000) Subject: Allow multiple lists on one page X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9a8a8bbe62485077c56112105853d90399b67f33;p=gosa.git Allow multiple lists on one page git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-playground@7747 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_ObjectListViewport.inc b/include/class_ObjectListViewport.inc index 7ff0e655f..1968cd189 100644 --- a/include/class_ObjectListViewport.inc +++ b/include/class_ObjectListViewport.inc @@ -45,7 +45,9 @@ class ObjectListViewport { */ private $multiselect; - + /*! \brief ID used to identify objects of same list */ + private $id = ""; + /*! \brief ObjectListViewport constructor The ObjectListViewport class renders/handles the ObjectList defined by $config. @@ -64,6 +66,9 @@ class ObjectListViewport { /* Load and instanciate classes, extract filter, icons, view hooks, etc. */ $this->objects= new ObjectList($config); + + /* generate an unique id */ + $this->id = preg_replace("/[^0-9]/","",microtime()); } /*! \brief Handles _POST / _GET events @@ -204,30 +209,28 @@ class ObjectListViewport { $entries .= $this->renderEntry($value); } - - /* Generate fixed headline */ $buffer = " - +
- +
- -
+ ".$header."
-
- + - diff --git a/test.php b/test.php index 286956722..86e63fd27 100644 --- a/test.php +++ b/test.php @@ -64,6 +64,9 @@ margin:0px; padding:0px; } +.ObjectListViewport_Entry_Cover{ + overflow:auto; +} .ObjectListViewport_Entry_Cell { border-left: solid 1px; font-size:10px; @@ -82,36 +85,56 @@ window.onresize = updateObjectListViewportSize; function updateObjectListViewportSize() { var dbg = document.getElementById('debug'); - + /* Somehow IE do not need to be resized * So skip the following part if the client uses ie */ if(document.all){ - document.getElementById('ObjectListViewport_Entry_Cover').style.height= "100%"; + var all = getElementsByStyleClass('ObjectListViewport_Entry_Cover'); + for (var i = 0; i < all.length; ++i){ + document.getElementById(all[i].id).style.height= "100%"; + } return; } - /* Set Viewport to min height, to ensure - * that resize will work correctly in konqueror - */ - document.getElementById('ObjectListViewport_Entry_Cover').style.height= "50px"; - - /* Get values of displayed header and footer heights to be - * able to recalculate the Viewport - */ - var viewport = getObjectHeight('ObjectListViewport_Table'); - var header = getObjectHeight('ObjectListViewport_TD_Header'); - var footer = getObjectHeight('ObjectListViewport_TD_Footer'); - - /* Calculate the new visible entry part height. */ - var calc = (viewport - ( header + footer )); - document.getElementById('ObjectListViewport_Entry_Cover').style.height = calc; + var all = getElementsByStyleClass('ObjectListViewport'); + for (var i = 0; i < all.length; ++i){ + + var id_pref = all[i].id.replace(/[^0-9]*/,""); + + /* Set Viewport to min height, to ensure + * that resize will work correctly in konqueror + */ + document.getElementById('ObjectListViewport_Entry_Cover' + id_pref).style.height= "50px"; + + /* Get values of displayed header and footer heights to be + * able to recalculate the Viewport + */ + var viewport = getObjectHeight('ObjectListViewport_Table' + id_pref); + var header = getObjectHeight('ObjectListViewport_TD_Header' + id_pref); + var footer = getObjectHeight('ObjectListViewport_TD_Footer' + id_pref); + + /* Calculate the new visible entry part height. */ + var calc = (viewport - ( header + footer )); + document.getElementById('ObjectListViewport_Entry_Cover' + id_pref).style.height = calc; + + /* Reduce width of entry list, we need some space to + * display the scrollbar without breaking the layout + */ + var viewport = getObjectWidth('ObjectListViewport_Table' + id_pref); + document.getElementById('ObjectListViewport_Entry_Table' + id_pref).style.width = (viewport - 16) + 'px'; + } + } - /* Reduce width of entry list, we need some space to - * display the scrollbar without breaking the layout - */ - var viewport = getObjectWidth('ObjectListViewport_Table'); - document.getElementById('ObjectListViewport_Entry_Table').style.width = (viewport - 16) + 'px'; + + /* Return all elements of a specific class */ + function getElementsByStyleClass (className) { + var all = document.all ? document.all : document.getElementsByTagName('*'); + var elements = new Array(); + for (var e = 0; e < all.length; e++) + if (all[e].className == className) + elements[elements.length] = all[e]; + return elements; } @@ -142,14 +165,13 @@ window.onresize = updateObjectListViewportSize; hallo
+
+ ".$entries."
- +
hallo
+ hallo
@@ -159,7 +181,7 @@ window.onresize = updateObjectListViewportSize;