Code

Allow disabling of footer and header part
[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         background-color: white;
66     background-image: none;
67     background-repeat: repeat;
68     background-attachment: scroll;
69     -x-background-x-position: 0%;
70     -x-background-y-position: 0%;
71     -moz-background-clip: -moz-initial;
72     -moz-background-origin: -moz-initial;
73     -moz-background-inline-policy: -moz-initial;
74     border-right-width: 1px;
75     border-right-style: solid;
76     border-right-color: rgb(192, 192, 192);
77     padding-top: 3px;
78     padding-right-value: 3px;
79     padding-bottom: 3px;
80     padding-left-value: 3px;
81     padding-left-ltr-source: physical;
82     padding-left-rtl-source: physical;
83     padding-right-ltr-source: physical;
84     padding-right-rtl-source: physical;
85     height: 22px;
86 }
88 .ObjectListViewport_Footer_Cell {
90     background-color: rgb(240, 240, 240);
91     background-image: none;
92     background-repeat: repeat;
93     background-attachment: scroll;
94     -x-background-x-position: 0%;
95     -x-background-y-position: 0%;
96     -moz-background-clip: -moz-initial;
97     -moz-background-origin: -moz-initial;
98     -moz-background-inline-policy: -moz-initial;
99     font-weight: bold;
100     border-top-width: 1px;
101     border-top-style: solid;
102     border-top-color: rgb(170, 170, 170);
103     padding-top: 3px;
104     padding-right-value: 3px;
105     padding-bottom: 3px;
106     padding-left-value: 3px;
107     padding-left-ltr-source: physical;
108     padding-left-rtl-source: physical;
109     padding-right-ltr-source: physical;
110     padding-right-rtl-source: physical;
111     height: 22px;
114 .ObjectListViewport_Header_Cell {
115     background-color: rgb(240, 240, 240);
116     background-image: none;
117     background-repeat: repeat;
118     background-attachment: scroll;
119     -x-background-x-position: 0%;
120     -x-background-y-position: 0%;
121     -moz-background-clip: -moz-initial;
122     -moz-background-origin: -moz-initial;
123     -moz-background-inline-policy: -moz-initial;
124     font-weight: bold;
125     border-right-width: 1px;
126     border-right-style: solid;
127     border-right-color: rgb(170, 170, 170);
128     border-bottom-width: 1px;
129     border-bottom-style: solid;
130     border-bottom-color: rgb(170, 170, 170);
131     padding-top: 3px;
132     padding-right-value: 3px;
133     padding-bottom: 3px;
134     padding-left-value: 3px;
135     padding-left-ltr-source: physical;
136     padding-left-rtl-source: physical;
137     padding-right-ltr-source: physical;
138     padding-right-rtl-source: physical;
139     height: 22px;
141 </style>
142 </head>
143 <script type="text/javascript">
145 <!--
147 /* Register resize event to force redraw of all 
148  *  displayed lists 
149  */
150 window.onload = updateObjectListViewportSize;
151 window.onresize = updateObjectListViewportSize;
153         function updateObjectListViewportSize() {
155                 var dbg = document.getElementById('debug');
156                 dbg.value ="";
158 //      var all = getElementsByStyleClass('ObjectListViewport');
159 //      for (var i = 0; i < all.length; ++i){
160 //              alert(all[i].id);
161 //              document.getElementById(all[i].id).style.display= "block";
162 //              document.getElementById(all[i].id).style.height= "50px";
163 //      }
164                 
165                 /* Somehow IE do not need to be resized 
166          *  So skip the following part if the client uses ie
167          */
168                 if(document.all && !window.opera){
169                         var all = getElementsByStyleClass('ObjectListViewport_Entry_Cover');
170                         for (var i = 0; i < all.length; ++i){
171                                 document.getElementById(all[i].id).style.height= "100%";
172                         }
173                         return;
174                 }
175         
176                 var all = getElementsByStyleClass('ObjectListViewport');
177                 for (var i = 0; i < all.length; ++i){
179                         var id_pref = all[i].id.replace(/[^0-9]*/,"");
181                         /* Set Viewport to min height, to ensure 
182                          *  that resize will work correctly in konqueror 
183                          */
184                         document.getElementById('ObjectListViewport_Entry_Cover' + id_pref).style.height= "50px";
186                         /* Get values of displayed header and footer heights to be 
187                          *  able to recalculate the Viewport 
188                          */
189                         var viewport    = getObjectHeight('ObjectListViewport_Table' + id_pref);
190                         var header      = getObjectHeight('ObjectListViewport_TD_Header' + id_pref);
191                         var footer      = getObjectHeight('ObjectListViewport_TD_Footer' + id_pref);
193                         /* Calculate the new visible entry part height. */
194                         var calc = (viewport  - ( header + footer ));
195                         document.getElementById('ObjectListViewport_Entry_Cover' + id_pref).style.height = calc;
197                         /* Reduce width of entry list, we need some space to 
198                          *  display the scrollbar without breaking the layout
199                          */
200                         dbg.value += " " + calc;
201                         var viewport_w = getObjectWidth('ObjectListViewport_Table' + id_pref);
202                         document.getElementById('ObjectListViewport_Entry_Table' + id_pref).style.width = (viewport_w - 16) + 'px';
203                 }
204         }
206         
207         /* Return all elements of a specific class */   
208         function getElementsByStyleClass (className) {
209                 var all = document.all ? document.all : document.getElementsByTagName('*');
210                 var elements = new Array();
211                 for (var e = 0; e < all.length; e++)
212                         if (all[e].className == className)
213                                 elements[elements.length] = all[e];
214                 return elements;
215         }
218         /* Return integer value of style attribute width for specified ID  */
219         function getObjectWidth(obj){
220                 obj = getComputedStyle(document.getElementById(obj),"").width;
221                 return(parseInt(obj.replace(/px/,''))); 
222         }
224         /* Return integer value of style attribute height for specified ID  */
225         function getObjectHeight(obj){
226                 obj = getComputedStyle(document.getElementById(obj),"").height;
227                 return(parseInt(obj.replace(/px/,'')));
228         }       
230 -->
231 </script>
232 <body>
233 <input type='button' onclick='updateObjectListViewportSize();'>
234 <?php
235 $a1 = shell_exec("./test");
236 $a2 = shell_exec("./test");
237 $a3 = shell_exec("./test");
238 $a4 = shell_exec("./test");
239 $a5 = shell_exec("./test");
240 $a6 = shell_exec("./test");
241 ?>
242 <input type='text' id='debug' value="" style='width:100%;'>
243     <table style='height:90%;width:90%;background-color: rgb(170, 170, 170);'
244         cellspacing=1 cellpadding=0>
245         <tr>
246             <td style='width:30%;height:30%;'>
247                 <?php echo $a1; ?>
248             </td>
249             <td>
250                 <?php echo $a2; ?>
251             </td>
252         </tr>
253         <tr>
254             <td>
255                 <?php echo $a3; ?>
256             </td>
257             <td>
258                 <?php echo $a4; ?>
259             </td>
260         </tr>
261         <tr>
262             <td>
263                 <?php echo $a5; ?>
264             </td>
265             <td>
266                 <?php echo $a6; ?>
267             </td>
268         </tr>
269     </table>
271 </body>
272 </html>