1 |
<? |
2 |
|
3 |
// ================================================================= |
4 |
// some helper-functions |
5 |
|
6 |
// ------------------------------------------------------------------------------------------------------ |
7 |
function getHtmlTag($tagname, $args = array(), $bool_endtag = 0) { |
8 |
$retval = ""; |
9 |
if ($bool_endtag) { |
10 |
$retval = "</$tagname>"; |
11 |
} else { |
12 |
$attribstring = getHtmlTag_Attributes($args); |
13 |
$retval = "<$tagname $attribstring>\n"; |
14 |
} |
15 |
return $retval; |
16 |
} |
17 |
|
18 |
// ------------------------------------------------------------------------------------------------------ |
19 |
function getHtmlTag_Attributes($args) { |
20 |
|
21 |
/* |
22 |
$array_NoValueAttributes = array(); |
23 |
if (isset($args['nowrap'])) { |
24 |
array_push($array_NoValueAttributes, 'nowrap'); |
25 |
unset($args['nowrap']); |
26 |
} |
27 |
$attribstring = getAttribStringFromHash($args, ' ', '=', '"'); |
28 |
while ($item_NoValueAttribute = current($array_NoValueAttributes)) { |
29 |
$attribstring .= ' ' . $item_NoValueAttribute; |
30 |
next($array_NoValueAttributes); |
31 |
} |
32 |
*/ |
33 |
|
34 |
$attribstring = getAttribStringFromHash($args, ' ', '=', '"'); |
35 |
return $attribstring; |
36 |
} |
37 |
|
38 |
// ================================================================= |
39 |
class HTMLGUI { |
40 |
|
41 |
function getFormObject($args) { |
42 |
$hf = new HTMLForm($args); |
43 |
return $hf; |
44 |
} |
45 |
|
46 |
} |
47 |
|
48 |
|
49 |
// ================================================================= |
50 |
class HTMLFrameset { |
51 |
|
52 |
var $bool_jailed; |
53 |
var $attribs; |
54 |
|
55 |
function HTMLFrameset($args) { |
56 |
$this->attribs = $args; |
57 |
} |
58 |
|
59 |
function getJailTop() { |
60 |
if(!$this->attribs['jailed']) { return; } |
61 |
return ' |
62 |
<frameset rows="*,' . $this->attribs['height'] . ',*" border="0" frameborder="0" framespacing="0"> |
63 |
<frame src="pages/frameset/blank.html" scrolling="no" marginwidth="0" marginheight="0"> |
64 |
|
65 |
<frameset cols="*,' . $this->attribs['width'] . ',*" border="0" frameborder="0" framespacing="0"> |
66 |
<frame src="pages/frameset/blank.html" scrolling="no" marginwidth="0" marginheight="0"> |
67 |
'; |
68 |
} |
69 |
|
70 |
function getJailBottom() { |
71 |
if(!$this->attribs['jailed']) { return; } |
72 |
return ' |
73 |
<frame src="pages/frameset/blank.html" scrolling=no> |
74 |
</frameset> |
75 |
|
76 |
<frame src="pages/frameset/blank.html" scrolling=no> |
77 |
</frameset> |
78 |
'; |
79 |
} |
80 |
|
81 |
} |
82 |
|
83 |
|
84 |
// ================================================================= |
85 |
class HtmlGui_Box { |
86 |
|
87 |
var $meta; |
88 |
|
89 |
var $header; |
90 |
var $footer; |
91 |
|
92 |
function HtmlGui_Box($args) { |
93 |
$this->_initArgs($args); |
94 |
} |
95 |
|
96 |
function _initArgs($args) { |
97 |
|
98 |
if (isset($args['border_width'])) { |
99 |
$this->meta['border_width'] = $args['border_width']; |
100 |
} else { |
101 |
isset($this->meta['border_width']) || $this->meta['border_width'] = 1; |
102 |
} |
103 |
if (isset($args['width'])) { |
104 |
$this->meta['width_outer'] = $args['width']; |
105 |
$this->meta['width_inner'] = $args['width'] - ($this->meta['border_width'] * 2); |
106 |
} else { |
107 |
isset($this->meta['width_outer']) || $this->meta['width_outer'] = ''; |
108 |
isset($this->meta['width_inner']) || $this->meta['width_inner'] = ''; |
109 |
} |
110 |
if (isset($args['height'])) { |
111 |
$this->meta['height_outer'] = $args['height']; |
112 |
$this->meta['height_inner'] = $args['height'] - ($this->meta['border_width'] * 2); |
113 |
} else { |
114 |
isset($this->meta['height_outer']) || $this->meta['height_outer'] = ''; |
115 |
isset($this->meta['height_inner']) || $this->meta['height_inner'] = ''; |
116 |
} |
117 |
|
118 |
if (isset($args['htmlattribs_header_default'])) { |
119 |
$this->header['htmlattribs_default'] = $args['htmlattribs_header_default']; |
120 |
} else { |
121 |
isset($this->header['htmlattribs_default']) || $this->header['htmlattribs_default'] = array(); |
122 |
} |
123 |
|
124 |
if (isset($args['htmlattribs_footer_default'])) { |
125 |
$this->footer['htmlattribs_default'] = $args['htmlattribs_footer_default']; |
126 |
} else { |
127 |
isset($this->footer['htmlattribs_default']) || $this->footer['htmlattribs_default'] = array(); |
128 |
} |
129 |
|
130 |
if (isset($args['caption'])) { |
131 |
$this->addHeaderArea($args['caption']); |
132 |
} |
133 |
|
134 |
} |
135 |
|
136 |
function addHeaderArea( $content = '', $htmlargs_container = array() ) { |
137 |
$htmlattribs = array_merge($this->header['htmlattribs_default'], $htmlargs_container); |
138 |
$args = array( 'content' => $content, 'htmlargs_container' => $htmlattribs ); |
139 |
$this->header['areas'][] = $args; |
140 |
} |
141 |
|
142 |
function addFooterArea( $content = '', $htmlargs_container = array() ) { |
143 |
$htmlattribs = array_merge($this->footer['htmlattribs_default'], $htmlargs_container); |
144 |
$args = array( 'content' => $content, 'htmlargs_container' => $htmlattribs ); |
145 |
$this->footer['areas'][] = $args; |
146 |
} |
147 |
|
148 |
function gen($contentType) { |
149 |
switch($contentType) { |
150 |
case 'begin'; |
151 |
$this->_gen_Begin(); |
152 |
break; |
153 |
case 'end'; |
154 |
$this->_gen_End(); |
155 |
break; |
156 |
} |
157 |
} |
158 |
|
159 |
} |
160 |
|
161 |
|
162 |
// ================================================================= |
163 |
class HtmlGui_PageBox extends HtmlGui_Box { |
164 |
|
165 |
function HtmlGui_PageBox($args) { |
166 |
|
167 |
// modify value to default-PageBox-width |
168 |
// TODO: store this value into "$site->design" or kinds like this |
169 |
$args['width'] = 602; |
170 |
|
171 |
// call constructor of base-class |
172 |
$this->HtmlGui_Box($args); |
173 |
} |
174 |
|
175 |
function _gen_Begin() { |
176 |
?> |
177 |
|
178 |
<!-- pagebox - begin --> |
179 |
<table width="<?= $this->meta['width_outer'] ?>" height="<?= $this->meta['height_outer'] ?>" cellspacing="0" cellpadding="1" border="0" > |
180 |
|
181 |
<tr><td bgcolor="#474890" style="padding-bottom:0px;"> |
182 |
<!-- pagebox/header - begin --> |
183 |
<? $this->_gen_ContentHeader(); ?> |
184 |
<!-- pagebox/header - end --> |
185 |
</td></tr> |
186 |
|
187 |
<tr><td bgcolor="#474890" style="padding-bottom:0px;"> |
188 |
|
189 |
<table width="<?= $this->meta['width_inner'] ?>" height="<?= $this->meta['height_inner'] ?>" border="0" cellspacing="0" cellpadding="1"> |
190 |
|
191 |
<tr> |
192 |
<td class="txtMainn" bgcolor="#FAFAFA" height="8"></td> |
193 |
</tr> |
194 |
|
195 |
<tr> |
196 |
<td class="txtMainn" bgcolor="#FAFAFA"> |
197 |
|
198 |
<!-- pagebox/content - begin --> |
199 |
<? |
200 |
} |
201 |
|
202 |
|
203 |
function _gen_End() { |
204 |
?> |
205 |
<!-- pagebox/content - end --> |
206 |
|
207 |
</td> |
208 |
</tr> |
209 |
|
210 |
<tr> |
211 |
<td bgcolor="#FAFAFA" > </td> |
212 |
</tr> |
213 |
|
214 |
</table> |
215 |
|
216 |
</td></tr> |
217 |
|
218 |
|
219 |
<tr><td bgcolor="#474890" > |
220 |
<!-- pagebox/footer - begin --> |
221 |
<? $this->_gen_ContentFooter(); ?> |
222 |
<!-- pagebox/footer - end --> |
223 |
</td></tr> |
224 |
|
225 |
</table> |
226 |
<!-- pagebox - end --> |
227 |
|
228 |
<? |
229 |
} |
230 |
|
231 |
function _gen_ContentHeader() { |
232 |
?> |
233 |
<table border="0" width="100%" cellspacing="0" cellpadding="3"> |
234 |
<tr> |
235 |
<? |
236 |
// print "right-arrow" |
237 |
$htmlattribs = $this->header['htmlattribs_default']; |
238 |
$htmlattribs['width'] = 10; |
239 |
$content = '<img src="../img/icons/arrowc.gif" width="9" height="18" border="0">'; |
240 |
print getHtmlTag('td', $htmlattribs) . $content . getHtmlTag('td', Null, 1) . "\n"; |
241 |
|
242 |
// print all areas |
243 |
if (!isset($this->header['areas'])) { $this->addHeaderArea(); } |
244 |
reset($this->header['areas']); |
245 |
while($item = current($this->header['areas'])) { |
246 |
// print one item (value) |
247 |
print getHtmlTag('td', $item['htmlargs_container']) . $item['content'] . getHtmlTag('td', Null, 1) . "\n"; |
248 |
next($this->header['areas']); |
249 |
} |
250 |
?> |
251 |
</tr> |
252 |
</table> |
253 |
<? |
254 |
} |
255 |
|
256 |
|
257 |
function _gen_ContentFooter() { |
258 |
?> |
259 |
<table border="0" width="100%" cellspacing="0" cellpadding="1"> |
260 |
<tr height="18"><td bgcolor="#fafafa"> |
261 |
<table border="0" width="99.97%" cellspacing="0" cellpadding="1"> |
262 |
<tr> |
263 |
<? |
264 |
// print all areas |
265 |
if (!isset($this->footer['areas'])) { $this->addFooterArea(); } |
266 |
reset($this->footer['areas']); |
267 |
while($item = current($this->footer['areas'])) { |
268 |
// print one item ("right-arrow") |
269 |
$htmlattribs = $this->footer['htmlattribs_default']; |
270 |
$htmlattribs['width'] = 10; |
271 |
$content = '<img src="../img/icons/arroww.gif" width="9" height="18" border="0">'; |
272 |
print getHtmlTag('td', $htmlattribs) . $content . getHtmlTag('td', Null, 1) . "\n"; |
273 |
|
274 |
// print one item (value) |
275 |
print getHtmlTag('td', $item['htmlargs_container']) . $item['content'] . getHtmlTag('td', Null, 1) . "\n"; |
276 |
next($this->footer['areas']); |
277 |
} |
278 |
?> |
279 |
</tr> |
280 |
</table> |
281 |
</td></tr> |
282 |
</table> |
283 |
<? |
284 |
} |
285 |
|
286 |
} |
287 |
|
288 |
|
289 |
|
290 |
// ================================================================= |
291 |
class HtmlGui_MiniBox extends HtmlGui_Box { |
292 |
|
293 |
function HtmlGui_MiniBox($args) { |
294 |
// call constructor of base-class |
295 |
$this->HtmlGui_Box($args); |
296 |
} |
297 |
|
298 |
function _gen_Begin() { |
299 |
?> |
300 |
|
301 |
<table width="<?= $this->meta['width_outer'] ?>" height="<?= $this->meta['height_outer'] ?>" cellspacing="0" cellpadding="1" border="0" > |
302 |
|
303 |
<tr ><td bgcolor="#474890" style="padding-bottom:0px;"> |
304 |
<? $this->_gen_ContentHeader(); ?> |
305 |
</td></tr> |
306 |
|
307 |
<tr><td bgcolor="#474890" style="padding-bottom:0px;"> |
308 |
|
309 |
<table width="<?= $this->meta['width_inner'] ?>" height="<?= $this->meta['height_inner'] ?>" cellspacing="0" cellpadding="1" border="0" > |
310 |
|
311 |
<tr> |
312 |
<td class="txtMainn" bgcolor="#FAFAFA" height="8"></td> |
313 |
</tr> |
314 |
|
315 |
<tr> |
316 |
<td class="txtMainn" bgcolor="#FAFAFA"> |
317 |
|
318 |
<? |
319 |
} |
320 |
|
321 |
|
322 |
function _gen_End() { |
323 |
?> |
324 |
|
325 |
</td> |
326 |
</tr> |
327 |
|
328 |
<!-- |
329 |
<tr> |
330 |
<td class="txtMainn" bgcolor="#FAFAFA" height="100"></td> |
331 |
</tr> |
332 |
--> |
333 |
|
334 |
<tr> |
335 |
<td bgcolor="#FAFAFA" > </td> |
336 |
</tr> |
337 |
|
338 |
</table> |
339 |
|
340 |
</td></tr> |
341 |
|
342 |
|
343 |
<tr><td bgcolor="#474890"> |
344 |
<? $this->_gen_ContentFooter(); ?> |
345 |
</td></tr> |
346 |
|
347 |
</table> |
348 |
|
349 |
<? |
350 |
} |
351 |
|
352 |
function _gen_ContentHeader() { |
353 |
?> |
354 |
<table border="0" width="100%" cellspacing="0" cellpadding="1" > |
355 |
<tr> |
356 |
<? |
357 |
// print "right-arrow" |
358 |
$htmlattribs = $this->header['htmlattribs_default']; |
359 |
$htmlattribs['width'] = 10; |
360 |
$content = '<img src="../img/icons/arrowc.gif" width="9" height="18" border="0">'; |
361 |
print getHtmlTag('td', $htmlattribs) . $content . getHtmlTag('td', Null, 1) . "\n"; |
362 |
|
363 |
// print all areas |
364 |
if (!isset($this->header['areas'])) { $this->addHeaderArea(); } |
365 |
reset($this->header['areas']); |
366 |
while($item = current($this->header['areas'])) { |
367 |
// print one item (value) |
368 |
print getHtmlTag('td', $item['htmlargs_container']) . $item['content'] . getHtmlTag('td', Null, 1) . "\n"; |
369 |
next($this->header['areas']); |
370 |
} |
371 |
?> |
372 |
</tr> |
373 |
</table> |
374 |
<? |
375 |
} |
376 |
|
377 |
|
378 |
function _gen_ContentFooter() { |
379 |
?> |
380 |
<table border="0" width="100%" cellspacing="0" cellpadding="1"> |
381 |
<tr height="18"><td bgcolor="#fafafa"> |
382 |
<table border="0" width="99.97%" cellspacing="0" cellpadding="1"> |
383 |
<tr> |
384 |
<? |
385 |
// print all areas |
386 |
if (!isset($this->footer['areas'])) { $this->addFooterArea(); } |
387 |
reset($this->footer['areas']); |
388 |
while($item = current($this->footer['areas'])) { |
389 |
// print one item ("right-arrow") |
390 |
$htmlattribs = $this->footer['htmlattribs_default']; |
391 |
$htmlattribs['width'] = 10; |
392 |
$content = '<img src="../img/icons/arroww.gif" width="9" height="10" border="0">'; |
393 |
print getHtmlTag('td', $htmlattribs) . $content . getHtmlTag('td', Null, 1) . "\n"; |
394 |
|
395 |
// print one item (value) |
396 |
print getHtmlTag('td', $item['htmlargs_container']) . $item['content'] . getHtmlTag('td', Null, 1) . "\n"; |
397 |
next($this->footer['areas']); |
398 |
} |
399 |
?> |
400 |
</tr> |
401 |
</table> |
402 |
</td></tr> |
403 |
</table> |
404 |
<? |
405 |
} |
406 |
|
407 |
} |
408 |
|
409 |
|
410 |
class HtmlGui_ItemContainer extends HtmlGui_MiniBox { |
411 |
|
412 |
var $datastore_container; |
413 |
|
414 |
function HtmlGui_ItemContainer($args) { |
415 |
|
416 |
$this->datastore_container = array(); |
417 |
if (isset($args['datastore'])) { |
418 |
$datastore = $args['datastore']; |
419 |
$this->datastore_container = $datastore['container']; |
420 |
unset($args['datastore']); |
421 |
} |
422 |
|
423 |
// call constructor of base-class |
424 |
$this->HtmlGui_MiniBox($args); |
425 |
|
426 |
} |
427 |
|
428 |
function gen() { |
429 |
|
430 |
// render ItemContainer |
431 |
parent::gen('begin'); |
432 |
|
433 |
if (is_array($this->datastore_container)) { |
434 |
?> |
435 |
<!-- items-chosen - begin --> |
436 |
<table cellspacing="3" cellpadding="0" border="0"> |
437 |
|
438 |
<? |
439 |
reset($this->datastore_container); |
440 |
while($item = current($this->datastore_container)) { |
441 |
?> |
442 |
<tr > |
443 |
<td bgcolor="#FAFAFA" width="8"> </td> |
444 |
<td bgcolor="#FAFAFA" valign="top" width="10" class="txtMain" align="center"><img src="../img/icons/arrowc.gif" width="9" height="10" border="0"></td> |
445 |
<td bgcolor="#FAFAFA" valign="top" class="txtMain2smaller" colspan="2"><?= $item['caption'] ?></td> |
446 |
</tr> |
447 |
<? |
448 |
next($this->datastore_container); |
449 |
} |
450 |
?> |
451 |
|
452 |
</table> |
453 |
<!-- items-chosen - end --> |
454 |
<? |
455 |
} |
456 |
parent::gen('end'); |
457 |
|
458 |
} |
459 |
|
460 |
} |
461 |
|
462 |
?> |