/[cvs]/nfo/site/htdocs/inc/otdef/otd_html1/otd_html1.php.inc
ViewVC logotype

Annotation of /nfo/site/htdocs/inc/otdef/otd_html1/otd_html1.php.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Fri Sep 3 01:06:00 2004 UTC (20 years ago) by rabit
Branch: MAIN
Changes since 1.2: +38 -40 lines
U colors and layout

1 rabit 1.1 <?php
2     /*------------------------------------------------------------------------------
3     --- www.netfrag.org
4     --- Setup and common functions include file.
5     --------------------------------------------------------------------------------
6     --- rabit, 21:23 31.08.2004
7 rabit 1.3 --- $Id: otd_html1.php.inc,v 1.2 2004/09/02 14:30:18 rabit Exp $
8 rabit 1.1 ------------------------------------------------------------------------------*/
9    
10     //- REQUIRED:
11     //- common, cms, xmlcp
12    
13     //------------------------------------------------------------------------------
14     //- Name of content render function:
15    
16     $otd_render = 'otd_html1_renderpage';
17    
18     //------------------------------------------------------------------------------
19    
20     //common_benchmark_addstep('otd_html1: ...');
21    
22     //------------------------------------------------------------------------------
23    
24     //----------------------------------------------------------
25     //- XMLCP callbacks setup:
26    
27     xmlcp_registertagcallbacks('b', 'otd_html1_cb_xmlcp_start_bold', 'otd_html1_cb_xmlcp_end_bold');
28     xmlcp_registertagcallbacks('h', 'otd_html1_cb_xmlcp_start_headline', 'otd_html1_cb_xmlcp_end_headline');
29     //xmlcp_registertagcallbacks('page', 'otd_html1_cb_xmlcp_start_page', 'otd_html1_cb_xmlcp_end_page');
30     xmlcp_registertagcallbacks('p', 'otd_html1_cb_xmlcp_start_paragraph', 'otd_html1_cb_xmlcp_end_paragraph');
31    
32     function otd_html1_cb_xmlcp_start_bold($h_parser, $tagname, $attribs) {
33    
34     global $xmlcp_cdata;
35    
36     $xmlcp_cdata .= '<b>';
37    
38     }
39    
40     function otd_html1_cb_xmlcp_end_bold($h_parser, $tagname) {
41    
42     global $xmlcp_cdata;
43    
44     $xmlcp_cdata .= '</b>';
45    
46     }
47    
48     function otd_html1_cb_xmlcp_start_headline($h_parser, $tagname, $attribs) {
49    
50     global $xmlcp_cdata;
51    
52     $xmlcp_cdata = '';
53    
54     }
55    
56     function otd_html1_cb_xmlcp_end_headline($h_parser, $tagname) {
57    
58     global $xmlcp_cdata;
59    
60     otd_html1_headline(trim($xmlcp_cdata));
61    
62     $xmlcp_cdata = '';
63    
64     }
65    
66     /*
67     function otd_html1_cb_xmlcp_start_page($h_parser, $tagname, $attribs) {
68    
69     }
70    
71     function otd_html1_cb_xmlcp_end_page($h_parser, $tagname) {
72    
73     }
74     */
75    
76     function otd_html1_cb_xmlcp_start_paragraph($h_parser, $tagname, $attribs) {
77    
78     global $xmlcp_cdata;
79    
80     $xmlcp_cdata = '';
81    
82     }
83    
84     function otd_html1_cb_xmlcp_end_paragraph($h_parser, $tagname) {
85    
86     global $xmlcp_cdata;
87    
88     otd_html1_paragraph(trim($xmlcp_cdata));
89    
90     $xmlcp_cdata = '';
91    
92     }
93    
94     //----------------------------------------------------------
95     //- Content render functions:
96    
97     function otd_html1_renderpage($keyname, $language_id = 0) {
98    
99     global $common;
100    
101     common_benchmark_addstep('otd_html1: render: start');
102    
103     $list = cms_getlist('xmlpage', $keyname);
104    
105     common_benchmark_addstep('otd_html1: render: CMS get list');
106    
107     $contentdata = cms_getcontent('xmlpage', $keyname, $language_id);
108    
109     common_benchmark_addstep('otd_html1: render: CMS get content');
110    
111     $xml = $contentdata['content'];
112    
113 rabit 1.2 otd_html1_pagehead();
114    
115     common_benchmark_addstep('otd_html1: render: head');
116    
117 rabit 1.1 otd_html1_pageheader();
118    
119     common_benchmark_addstep('otd_html1: render: header');
120    
121     if($xml) {
122    
123     $titledata = '';
124    
125     for($i = 0; $i < count($list); $i++) {
126    
127     $imgtag = '<img alt="' . $list[$i][4] . '" border="0" height="12" src="' . $common['site']['gfxurl'] . 'icons/flags/' . $list[$i][3] . '.gif" width="17" />';
128    
129     $titledata .= ($i ? '
130     ' : '') . (($language_id == $list[$i][3]) ? $imgtag : '<a href="?li=' . $list[$i][3] . '" title="' . $list[$i][4] . '">' . $imgtag . '</a>');
131    
132     }
133    
134     otd_html1_pagetitle($contentdata['description'], $titledata . '<br />');
135    
136 rabit 1.2 $res = xmlcp_parse($xml);
137 rabit 1.1
138 rabit 1.3 common_benchmark_addstep('otd_html1: render: xmlcp_parse() = ' . $res);
139 rabit 1.1
140 rabit 1.3 if($common['hostsetup']['devstate']) {
141 rabit 1.1
142 rabit 1.3 otd_html1_headline('$list array, readable:');
143     otd_html1_codeparagraph('$list = ' . nl2br(htmlentities(print_r($list, true))));
144 rabit 1.1
145 rabit 1.3 otd_html1_headline('$contentdata array, readable:');
146     otd_html1_codeparagraph('$contentdata = ' . nl2br(htmlentities(print_r($contentdata, true))));
147 rabit 1.1
148 rabit 1.3 otd_html1_headline('Content XML:');
149     otd_html1_codeparagraph(nl2br(htmlentities($xml)));
150 rabit 1.1
151 rabit 1.3 /*
152     otd_html1_headline('$common array, readable:');
153     otd_html1_codeparagraph('$common = ' . nl2br(htmlentities(print_r($common, true))));
154 rabit 1.1
155 rabit 1.3 otd_html1_headline('$common_sessiondata array, readable:');
156     otd_html1_codeparagraph('$common_sessiondata = ' . nl2br(htmlentities(print_r($common_sessiondata, true))));
157 rabit 1.1 */
158    
159 rabit 1.3 }
160    
161 rabit 1.1 // Only show the informations when "devstate" is set:
162 rabit 1.2 // if($common['hostsetup']['devstate']) {
163 rabit 1.1
164     otd_html1_paragraph('<small>
165 rabit 1.3 "<b>' . $contentdata['description'] . '</b>" (language: "<b>' . $contentdata['language_name'] . '</b>") created by <b>' . $contentdata['creator_name'] . '</b> on <b>' . date('d.m.Y, H:i:s', $contentdata['unixtime']) . '</b>.<br />
166     Last changes by <b>' . $contentdata['creator_name'] . '</b> on <b>' . date('d.m.Y, H:i:s', $contentdata['unixtime']) . '</b>.
167     </small>', 'box1');
168 rabit 1.1
169 rabit 1.2 // }
170 rabit 1.1
171     } else {
172    
173     otd_html1_pagetitle('Bad content request');
174    
175     otd_html1_paragraph('Sorry, but the requested content is unknown.');
176    
177     }
178    
179     common_benchmark_addstep('otd_html1: render: content');
180    
181     otd_html1_pagefooter();
182    
183 rabit 1.2 common_benchmark_addstep('otd_html1: render: footer');
184    
185     // Only show the benchmark list when "devstate" is set:
186     if($common['hostsetup']['devstate']) {
187    
188     otd_html1_benchmarkbox();
189    
190     }
191    
192     otd_html1_pagefoot();
193    
194 rabit 1.1 }
195    
196     //----------------------------------------------------------
197     //- HTML Output functions:
198    
199     function otd_html1_authbox() {
200    
201     global $common_sessiondata;
202    
203 rabit 1.2 $boxheight = 48;
204     $boxwidth = 280;
205    
206     if($common_sessiondata['userdata']['authorised']) {
207    
208     echo '<table cellspacing="0" cellpadding="2" class="f22" width="' . $boxwidth . '">
209 rabit 1.1 <tr>
210 rabit 1.2 <th class="box2" height="' . $boxheight . '" width="44"><b>User<br />login</b></th>
211 rabit 1.3 <td align="center" valign="top" style="padding:4px;">
212 rabit 1.2 <small>
213 rabit 1.3 You are logged in the ' . $common_sessiondata['userdata']['logincount'] . '. time as <b>' . $common_sessiondata['userdata']['name'] . '</b>. Login time was <b>' . date('H:i:s, d.m.Y', $common_sessiondata['userdata']['logintime']) . '</b>.<br/ >
214 rabit 1.2 Your rights are "<b>' . $common_sessiondata['userdata']['rights'] . '</b>".
215     </small>
216     </td>
217     </table>
218     ';
219    
220     } else {
221    
222     echo '<form action="" method="post" style="margin:0;">
223     <table cellspacing="0" cellpadding="0" class="f22" width="' . $boxwidth . '">
224     <tr>
225     <th class="box2" height="' . $boxheight . '" rowspan="2" width="44"><b>User<br />login</b></th>
226     <td align="right">User name:</td>
227 rabit 1.1 <td rowspan="2">&nbsp;</td>
228 rabit 1.2 <td><input name="un" size="10" type="text" value="' . $common_sessiondata['userdata']['name'] . '" /></td>
229     <th class="box2" rowspan="2"><input type="submit" value="OK" /></th>
230 rabit 1.1 </tr>
231     <tr>
232 rabit 1.2 <td align="right">Password:</td><td><input name="pw" size="10" type="password" /></td>
233 rabit 1.1 </tr>
234     </table>
235     </form>
236     ';
237    
238 rabit 1.2 }
239    
240 rabit 1.1 }
241    
242 rabit 1.2 function otd_html1_benchmarkbox() {
243    
244     global $common;
245 rabit 1.1
246 rabit 1.2 $contents = '';
247    
248     for($i = 0; $i < count($common['benchmark']); $i++) {
249 rabit 1.1
250 rabit 1.2 $mtimesegs = explode(' ', $common['benchmark'][$i][1]);
251     $contents .= substr('0' . ($i + 1), -2) . ': "<b>' . $common['benchmark'][$i][0] . '</b>": ';
252 rabit 1.1
253 rabit 1.2 if($i) {
254 rabit 1.1
255 rabit 1.2 $timediff = (float)($mtimesegs[1] - $lastmtimesegs[1]);
256     $timediff += $mtimesegs[0] - $lastmtimesegs[0];
257 rabit 1.1
258 rabit 1.2 $contents .= '<b>+' . round($timediff * 1000000) / 1000 . '</b> ms<br />
259 rabit 1.1 ';
260    
261 rabit 1.2 } else {
262 rabit 1.1
263 rabit 1.2 $contents .= 'Start time: <b>' . date('H:i:s', $mtimesegs[1]) . substr($mtimesegs[0], 1, 4) . '</b><br />
264     ';
265 rabit 1.1
266 rabit 1.2 }
267 rabit 1.1
268 rabit 1.2 $lastmtimesegs = $mtimesegs;
269 rabit 1.1
270 rabit 1.2 }
271 rabit 1.1
272 rabit 1.2 otd_html1_paragraph('<small>
273     <b>Partial execution times:</b><br />
274     <br />
275 rabit 1.3 ' . $contents . '</small>', 'box1');
276 rabit 1.1
277 rabit 1.2 }
278 rabit 1.1
279 rabit 1.2 function otd_html1_codeparagraph($contents) {
280 rabit 1.1
281 rabit 1.3 echo '<p align="justify" class="hl12">
282 rabit 1.2 <code>
283     ' . $contents . '
284     </code>
285     </p>
286 rabit 1.1 ';
287    
288 rabit 1.2 }
289 rabit 1.1
290 rabit 1.2 function otd_html1_headline($caption) {
291    
292     echo '<big><u>' . $caption . '</u></big>
293 rabit 1.1 ';
294    
295 rabit 1.2 }
296    
297     function otd_html1_pagefoot() {
298 rabit 1.1
299 rabit 1.2 echo '</body>
300 rabit 1.1
301 rabit 1.2 </html>
302     ';
303 rabit 1.1
304 rabit 1.2 }
305 rabit 1.1
306 rabit 1.2 function otd_html1_pagefooter() {
307 rabit 1.1
308 rabit 1.2 global $common;
309 rabit 1.1
310     $endmtimesegs = explode(' ', microtime());
311     $startmtimesegs = explode(' ', $common['benchmark'][0][1]);
312     $timediff = (float)($endmtimesegs[1] - $startmtimesegs[1]);
313     $timediff += $endmtimesegs[0] - $startmtimesegs[0];
314    
315     $devstate = $common['hostsetup']['devstate'];
316    
317 rabit 1.2 echo '</td>
318     <td class="bg11" width="8" rowspan="2" style="padding:0;"></td>
319     </tr>
320 rabit 1.1 <tr>
321 rabit 1.3 <td class="bg11" nowrap="nowrap" style="border-bottom:2px solid #40a080;" valign="bottom">
322     <div class="box2" style="margin-bottom:8px;"><big>Tools:</big></div>
323 rabit 1.2 &bull; Benchmark list: [' . ($devstate ? '<a href="?devstate=0">off</a>' : '<a href="?devstate=1">on</a>') . ']
324 rabit 1.1 </td>
325     </tr>
326 rabit 1.2 <tr class="bg11">
327     <td align="center">
328     <small>
329     Page execution time:<br />
330     </small>
331     <code>' . round($timediff * 100000) / 100 . '</code> ms.<br />
332     </td>
333     <td align="right" colspan="2">
334     <a href="http://validator.w3.org/check?uri=referer" target="_blank"><img alt="This page is valid XHTML 1.0" border="0" height="31" src="http://www.w3.org/Icons/valid-xhtml10" width="88" /></a>
335     <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /></a>
336 rabit 1.1 </td>
337     </tr>
338     </table>
339     ';
340    
341     }
342    
343 rabit 1.2 function otd_html1_pagehead() {
344 rabit 1.1
345     echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
346    
347     <html xmlns="http://www.w3.org/1999/xhtml">
348    
349     <head>
350     <title>www.netfrag.org</title>
351     <style type="text/css"><!--
352     body { margin:0; }
353     body, input, table { font: 10pt verdana, serif; }
354     input { border:1px; }
355 rabit 1.3 .bg11, .f11, .hl11 { background-color:#40d8c0; }
356     .bg12, .box1, .f12, .hl12 { background-color:#40e8e0; }
357 rabit 1.1 .bg13 { background-color:#20a0c0; }
358 rabit 1.3 .bg21, .box2, .f21, .hl21 { background-color:#a0c090; }
359     .bg22, .f22 { background-color:#40c8b0; }
360 rabit 1.1 .bg23 { background-color:#40c080; }
361 rabit 1.3 .box1, .f11, .f12 { border:1px solid #20a0b0; }
362     .box2, .f21, .f22 { border:1px solid #40a080; }
363     .box1, .box2, .hl11, .hl12, .hl21 { padding:4px; }
364 rabit 1.1 --></style>
365     </head>
366    
367     <body>
368     ';
369    
370     }
371    
372 rabit 1.2 function otd_html1_pageheader() {
373 rabit 1.1
374 rabit 1.3 echo '<table cellspacing="0" cellpadding="8" style="border-bottom:2px solid #40a080;" width="100%">
375 rabit 1.2 <tr>
376     <td class="bg11" colspan="3">
377     <table cellspacing="0" cellpadding="0" width="100%">
378 rabit 1.1 <tr class="bg11">
379 rabit 1.2 <th width="100%">
380     <span style="border-bottom:2px solid black; font-size:24pt; letter-spacing:-2pt; padding-bottom:3px;">
381     www.<font color="#107080">n</font>et<font color="#107080">f</font>rag.<font color="#107080">o</font>rg</span>
382     <p style="margin-top:4px;">
383     <small>NetFrag and friends</small>
384     </p>
385 rabit 1.1 </th>
386 rabit 1.2 <td>&nbsp;</td>
387     <td>
388 rabit 1.1 ';
389    
390     otd_html1_authbox();
391    
392     echo '</td>
393     </tr>
394 rabit 1.2 </table>
395     </td>
396     </tr>
397     <tr>
398 rabit 1.3 <td class="bg11" nowrap="nowrap" style="border-top:2px solid #40a080;" valign="top" width="160">
399 rabit 1.2 ';
400 rabit 1.1
401 rabit 1.3 echo '<div class="box2" style="margin-bottom:8px;"><big>Navigation:</big></div>
402     &bull; <a href="">Home page</a>
403 rabit 1.1 </td>
404 rabit 1.3 <td rowspan="2" style="border:2px solid #3090a8; padding:8px;">
405 rabit 1.2 ';
406    
407     }
408 rabit 1.1
409 rabit 1.2 function otd_html1_pagetitle($title, $additionalcontents = '') {
410 rabit 1.1
411 rabit 1.3 echo '<p class="box1">
412 rabit 1.1 <big><b>&bull; ' . $title . '</b>&nbsp;</big>
413     ' . ($additionalcontents ? $additionalcontents . '
414     ' : '') . '</p>
415     ';
416    
417     }
418    
419     function otd_html1_paragraph($contents, $class = '') {
420    
421     echo '<p align="justify"' . ($class ? ' class="' . $class . '"' : '') . '>
422     ' . $contents . '
423     </p>
424     ';
425    
426     }
427    
428     //------------------------------------------------------------------------------
429    
430     ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed