Code

Fixed display
[gosa.git] / test.php
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <style type="text/css">
6 .ObjectListViewport {
7         width:100%;
8         height:100%;
9         border-collapse:collapse;
10 }
12 .ObjectListViewport_Header_Table {
13         width:100%;
14         border: 0px;
15         border-collapse:collapse;
16 }       
17         
18 .ObjectListViewport_Entry_Table {
19         width:100%;
20         border: 0px;
21         border-collapse:collapse;
22 }
24 .ObjectListViewport_Footer_Table {
25     width:100%;
26     border: 0px;
27     border-collapse:collapse;
28 }
31 .ObjectListViewport_Table {
32         border-collapse:collapse;
33     width:100%;
34         height:100%;
35         border: 0px;
36 }
38 .ObjectListViewport_TD_Header {
39         height:20px;
40         background-color: #CCCCCC;
41         vertical-align:middle;
42         border: 0px;
43         margin:0px;
44         padding:0px;
45 }
46 .ObjectListViewport_TD_Entries {
47         vertical-align:middle;
48         border: 0px;
49         margin:0px;
50         padding:0px;
51 }
52 .ObjectListViewport_TD_Footer {
53         height:20px;
54         background-color: #CCCCCC;
55         vertical-align:middle;
56         border: 0px;
57         margin:0px;
58         padding:0px;
59 }
60 .ObjectListViewport_Entry_Cover{
61         overflow:auto;
62         height:100px;
63 }
64 .ObjectListViewport_Entry_Cell {
65         border-left: solid 1px;
66         font-size:10px;
67         height:12px;
68 }
69 </style>
70 </head>
71 <script type="text/javascript">
73 <!--
75 /* Register resize event to force redraw of all 
76  *  displayed lists 
77  */
78 window.onload = updateObjectListViewportSize;
79 window.onresize = updateObjectListViewportSize;
81         function updateObjectListViewportSize() {
83                 var dbg = document.getElementById('debug');
84                 dbg.value ="";
86 //      var all = getElementsByStyleClass('ObjectListViewport');
87 //      for (var i = 0; i < all.length; ++i){
88 //              alert(all[i].id);
89 //              document.getElementById(all[i].id).style.display= "block";
90 //              document.getElementById(all[i].id).style.height= "50px";
91 //      }
92                 
93                 /* Somehow IE do not need to be resized 
94          *  So skip the following part if the client uses ie
95          */
96                 if(document.all && !window.opera){
97                         var all = getElementsByStyleClass('ObjectListViewport_Entry_Cover');
98                         for (var i = 0; i < all.length; ++i){
99                                 document.getElementById(all[i].id).style.height= "100%";
100                         }
101                         return;
102                 }
103         
104                 var all = getElementsByStyleClass('ObjectListViewport');
105                 for (var i = 0; i < all.length; ++i){
107                         var id_pref = all[i].id.replace(/[^0-9]*/,"");
109                         /* Set Viewport to min height, to ensure 
110                          *  that resize will work correctly in konqueror 
111                          */
112                         document.getElementById('ObjectListViewport_Entry_Cover' + id_pref).style.height= "50px";
114                         /* Get values of displayed header and footer heights to be 
115                          *  able to recalculate the Viewport 
116                          */
117                         var viewport    = getObjectHeight('ObjectListViewport_Table' + id_pref);
118                         var header      = getObjectHeight('ObjectListViewport_TD_Header' + id_pref);
119                         var footer      = getObjectHeight('ObjectListViewport_TD_Footer' + id_pref);
121                         /* Calculate the new visible entry part height. */
122                         var calc = (viewport  - ( header + footer ));
123                         document.getElementById('ObjectListViewport_Entry_Cover' + id_pref).style.height = calc;
125                         /* Reduce width of entry list, we need some space to 
126                          *  display the scrollbar without breaking the layout
127                          */
128                         dbg.value += " " + calc;
129                         var viewport_w = getObjectWidth('ObjectListViewport_Table' + id_pref);
130                         document.getElementById('ObjectListViewport_Entry_Table' + id_pref).style.width = (viewport_w - 16) + 'px';
131                 }
132         }
134         
135         /* Return all elements of a specific class */   
136         function getElementsByStyleClass (className) {
137                 var all = document.all ? document.all : document.getElementsByTagName('*');
138                 var elements = new Array();
139                 for (var e = 0; e < all.length; e++)
140                         if (all[e].className == className)
141                                 elements[elements.length] = all[e];
142                 return elements;
143         }
146         /* Return integer value of style attribute width for specified ID  */
147         function getObjectWidth(obj){
148                 obj = getComputedStyle(document.getElementById(obj),"").width;
149                 return(parseInt(obj.replace(/px/,''))); 
150         }
152         /* Return integer value of style attribute height for specified ID  */
153         function getObjectHeight(obj){
154                 obj = getComputedStyle(document.getElementById(obj),"").height;
155                 return(parseInt(obj.replace(/px/,'')));
156         }       
158 -->
159 </script>
160 <body>
161 <input type='button' onclick='updateObjectListViewportSize();'>
162 <?php
163 $a1 = shell_exec("./test");
164 $a2 = shell_exec("./test");
165 $a3 = shell_exec("./test");
166 $a4 = shell_exec("./test");
167 $a5 = shell_exec("./test");
168 $a6 = shell_exec("./test");
169 ?>
170 <input type='text' id='debug' value="" style='width:100%;'>
171     <table style='height:90%;width:90%;background-color:#DDDDDD; border: solid 1px;'
172         cellspacing=2 cellpadding=2>
173         <tr>
174             <td style='width:30%;height:30%;'>
175                 <?php echo $a1; ?>
176             </td>
177             <td>
178                 <?php echo $a2; ?>
179             </td>
180         </tr>
181         <tr>
182             <td>
183                 <?php echo $a3; ?>
184             </td>
185             <td>
186                 <?php echo $a4; ?>
187             </td>
188         </tr>
189         <tr>
190             <td>
191                 <?php echo $a5; ?>
192             </td>
193             <td>
194                 <?php echo $a6; ?>
195             </td>
196         </tr>
197     </table>
199 </body>
200 </html>