Code

Changed some js comments
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 7 Nov 2007 13:47:39 +0000 (13:47 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 7 Nov 2007 13:47:39 +0000 (13:47 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-playground@7744 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_ObjectListViewport.inc
test.php

index 2cc44af49d46a7c7bb0a7857e717c623c051cb74..7ff0e655f0cddf1043281a7e5b36c679f436aae9 100644 (file)
@@ -208,9 +208,7 @@ class ObjectListViewport {
 
     /* Generate fixed headline */
     $buffer = "
-    <table class='ObjectListViewport' id='ObjectListViewport' cellspacing=o cellpadding=0
-          style=' width:100%;height:100%;; 
-                  border-collapse:collapse;'>
+    <table class='ObjectListViewport' id='ObjectListViewport' cellspacing=o cellpadding=0>
       <tr>
         <td>
               <table class='ObjectListViewport_Table' id='ObjectListViewport_Table' cellpadding=0 cellspacing=0 >
index 6588fd79754387bf5867a572460286b1f68f4d14..718e512690280dff12f0e4bfffcf7bef8f9cd41b 100644 (file)
--- a/test.php
+++ b/test.php
@@ -1,10 +1,12 @@
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
 <style type="text/css">
 
 .ObjectListViewport {
        width:100%;
+       height:100%;
+       border-collapse:collapse;
 }
 
 .ObjectListViewport_Header_Table {
@@ -36,6 +38,7 @@
 .ObjectListViewport_Table {
        border-collapse:collapse;
     width:100%;
+       height:100%;
        border: 0px;
 }
 
@@ -48,7 +51,6 @@
        padding:0px;
 }
 .ObjectListViewport_TD_Entries {
-       background-color: #009900;
        vertical-align:middle;
        border: 0px;
        margin:0px;
        margin:0px;
        padding:0px;
 }
-td {
+.ObjectListViewport_Entry_Cell {
        border-left: solid 1px;
-       border-right: solid 1px;
-       font-size:1em;
-       height:22px;
+       font-size:10px;
+       height:18px;
 }
 
 </style>
 <script type="text/javascript">
-window.onload = setHeight;
-window.onresize = setHeight;
 
-       function setHeight() {
-               dbg = document.getElementById('debug');
+/* Register resize event to force redraw of all 
+ *  displayed lists 
+ */
+window.onload = updateObjectListViewportSize;
+window.onresize = updateObjectListViewportSize;
 
-               OVP = getComputedStyle(document.getElementById('ObjectListViewport'),"").height;
-               OVP_h = parseInt(OVP.replace(/px/,''));
+       function updateObjectListViewportSize() {
 
-               table             = getComputedStyle(document.getElementById('ObjectListViewport_Table'),"").height;
-               table_header  = getComputedStyle(document.getElementById('ObjectListViewport_TD_Header'),"").height;
-               table_entries = getComputedStyle(document.getElementById('ObjectListViewport_TD_Entries'),"").height;
-               table_footer  = getComputedStyle(document.getElementById('ObjectListViewport_TD_Footer'),"").height;
+               dbg = document.getElementById('debug');
+       
+               /* Set Viewport to min height, to ensure 
+         *  that resize will work correctly in konqueror 
+         */
+               document.getElementById('ObjectListViewport_Entry_Cover').style.height= "50px";
+               document.getElementById('ObjectListViewport_Entry_Cover').style.display= "none";
+               document.getElementById('ObjectListViewport_Entry_Cover').style.display= "block";
+       
+               /* Get values of displayed header and footer heights to be 
+                *  able to recalculate the Viewport 
+         */
+               viewport        = getObjectHeight('ObjectListViewport_Table');
+               header          = getObjectHeight('ObjectListViewport_TD_Header');
+               footer          = getObjectHeight('ObjectListViewport_TD_Footer');
 
-               table_h                 = parseInt(table.replace(/px/,''));
-               table_header_h  = parseInt(table_header.replace(/px/,''));
-               table_entries_h = parseInt(table_entries.replace(/px/,'')); 
-               table_footer_h  = parseInt(table_footer.replace(/px/,''));
-                       
-               calc = (OVP_h  - ( table_header_h + table_footer_h ));
+               /* Calculate the new visible entry part height. */
+               calc = (viewport  - ( header + footer ));
                document.getElementById('ObjectListViewport_Entry_Cover').style.height= calc + 'px' ;
 
-               OVP_T = getComputedStyle(document.getElementById('ObjectListViewport_Table'),"").width;
-               OVP_T_w = parseInt(OVP_T.replace(/px/,'',OVP_T));
-               
+               /* Reduce width of entry list, we need some space to 
+         *  display the scrollbar without breaking the layout
+         */
+               viewport_ = getObjectWidth('ObjectListViewport_Table');
                document.getElementById('ObjectListViewport_Entry_Table').style.width = (OVP_T_w - 16) + 'px';
        }
+
+       /* Return integer value of style attribute width for specified ID  */
+       function getObjectWidth(obj){
+               obj = getComputedStyle(document.getElementById(obj),"").width;
+               return(parseInt(obj.replace(/px/,'')));
+       }
+
+       /* Return integer value of style attribute height for specified ID  */
+       function getObjectHeight(obj){
+               obj = getComputedStyle(document.getElementById(obj),"").height;
+               return(parseInt(obj.replace(/px/,'')));
+       }
 </script>
 </head>
-<body style="height:100%;position:relative" id='body'>
+<body>
 <input type='text' id='debug' value="" style='width:100%;'>
-       <table style='height:100%;width:100%;background-color:#6788FF;border: solid 5px #000000;'>
+       <table style='height:90%;width:90%;background-color:#DDDDDD; border: solid 1px;'
+               cellspacing=0 cellpadding=0>
                <tr>
-                       <td style='width:30%;height:20%;background-color:#AAA006;'>
+                       <td style='width:30%;height:50%;background-color:#EEEEEE;'>
                                hallo<br>
                                hallo<br>
                                hallo<br>
@@ -112,7 +134,7 @@ window.onresize = setHeight;
                                hallo<br>
                                hallo<br>
                        </td>
-                       <td style='background-color:#660099;'>
+                       <td style='background-color:#EEEEEE;'>
                                <?php
                                echo passthru("./test");
                                ?>
@@ -130,9 +152,7 @@ window.onresize = setHeight;
                </tr>
        </table>
 <script type="text/javascript">
-//     document.getElementById('ObjectListViewport_Entry_Cover').style.height= document.getElementById('ObjectListViewport').height;
-//             document.getElementById('body').style.height = getComputedStyle(document.getElementById('body'),"").height;
-       document.getElementById('ObjectListViewport_Entry_Cover').style.height= "200px";
+       document.getElementById('ObjectListViewport_Entry_Cover').style.height= "50px";
 </script>
 </body>
 </html>