Code

Added third list to test.
[gosa.git] / test.php
index 286956722df29ba9a99965ccdbd5f616e42bf4a4..1fdc8216421d3444ee06bd8b11ea2866a70e63bc 100644 (file)
--- 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;
@@ -73,6 +76,8 @@
 </style>
 <script type="text/javascript">
 
+<!--
+
 /* Register resize event to force redraw of all 
  *  displayed lists 
  */
@@ -82,36 +87,58 @@ window.onresize = updateObjectListViewportSize;
        function updateObjectListViewportSize() {
 
                var dbg = document.getElementById('debug');
-
+               dbg.value ="";
+               
                /* 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
+                        */
+                       dbg.value += " " + calc;
+                       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;
        }
 
 
@@ -126,6 +153,8 @@ window.onresize = updateObjectListViewportSize;
                obj = getComputedStyle(document.getElementById(obj),"").height;
                return(parseInt(obj.replace(/px/,'')));
        }       
+
+-->
 </script>
 </head>
 <body>
@@ -133,7 +162,7 @@ window.onresize = updateObjectListViewportSize;
        <table style='height:90%;width:90%;background-color:#DDDDDD; border: solid 1px;'
                cellspacing=0 cellpadding=0>
                <tr>
-                       <td style='width:30%;height:50%;background-color:#EEEEEE;'>
+                       <td style='width:30%;height:30%;background-color:#EEEEEE;'>
                                hallo<br>
                                hallo<br>
                                hallo<br>
@@ -142,24 +171,23 @@ window.onresize = updateObjectListViewportSize;
                                hallo<br>
                        </td>
                        <td style='background-color:#EEEEEE;'>
-                               <?php
-                               echo passthru("./test");
-                               ?>
+                               <?php echo passthru("./test"); ?>
                        </td>
                </tr>
                <tr>
-                       <td style='background-color:#999777;'>
-                               hallo<br>
-                               hallo<br>
+                       <td style='height:30%;background-color:#999777;'>
+                               <?php echo passthru("./test"); ?>
                        </td>
                        <td style='background-color:#AAA006;'>
-                               hallo<br>
-                               hallo<br>
+                       </td>
+               </tr>
+               <tr>
+                       <td style='background-color:#999777;'>
+                       </td>
+                       <td style='background-color:#999777;'>
+                               <?php echo passthru("./test"); ?>
                        </td>
                </tr>
        </table>
-<script type="text/javascript">
-       document.getElementById('ObjectListViewport_Entry_Cover').style.height= "50px";
-</script>
 </body>
 </html>