s/( |->)_message/message/g
[isso.git] / printer.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Iris Studios Shared Object Framework [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 /**
23 * Printer
24 * printer.php
25 *
26 * @package ISSO
27 */
28
29 /**
30 * Printer
31 *
32 * This framework generates standard HTML through various functions. The purpose
33 * is generally so that things like the admin system can be created without templates.
34 *
35 * @author Iris Studios, Inc.
36 * @copyright Copyright ©2002 - [#]year[#], Iris Studios, Inc.
37 * @version $Revision$
38 * @package ISSO
39 *
40 */
41 class Printer
42 {
43 /**
44 * Framework registry object
45 * @var object
46 */
47 var $registry = null;
48
49 /**
50 * Realm that we are operating in (displayed in the <title>)
51 * @var string
52 */
53 var $realm = '[UNDEFINED REALM]';
54
55 /**
56 * CSS to place in the page
57 * @var string
58 */
59 var $css = '';
60
61 /**
62 * Constructor
63 */
64 function Printer(&$registry)
65 {
66 $this->registry =& $registry;
67 }
68
69 /**
70 * Creates a redirect to another page; constructs the header and footer (therefore execution stops)
71 *
72 * @param string Location to redirect to
73 * @param integer Time to wait before the redirect
74 */
75 function redirect($location, $timeout = 10)
76 {
77 $timeout = $timeout * 200;
78
79 $js =
80 <<<EOD
81 <script type="text/javascript">
82 <!--
83 var timeout = $timeout;
84
85 if (timeout > 0)
86 {
87 setTimeout("redirect()", $timeout);
88 }
89 else
90 {
91 redirect();
92 }
93
94 function redirect()
95 {
96 window.location = "$location";
97 }
98 -->
99 </script>
100 EOD;
101
102 $this->page_start($this->registry->modules['localize']->string('Redirect'), ':default:', 15, $js);
103
104 $this->page_message($this->registry->modules['localize']->string('Redirect'), sprintf($this->registry->modules['localize']->string('Please wait to be redirected. If you are not redirected in a few seconds, click <a href="%1$s">here</a>.'), $location));
105
106 $this->page_end();
107 }
108
109 /**
110 * Throws a fatal error; constructs the header and footer
111 *
112 * @param string Error messsage text
113 */
114 function error($message)
115 {
116 $this->page_start($this->registry->modules['localize']->string('Error'));
117 $this->page_message($this->registry->modules['localize']->string('Error'), $message);
118 $this->page_end();
119
120 exit;
121 }
122
123 // ###################################################################
124 /**
125 * Outputs the header of the page: doctype, <html>, <head>, <title>, <body>
126 * and imbeds the style information
127 *
128 * @param string Title of the page
129 * @param string Class of the page to be applied to the body
130 * @param integer Margin of the <div> that all content is placed in
131 * @param string Extra HTML to imbed in the <head> tag
132 * @param string <body> onLoad action to imbed
133 * @param integer Margin of the actual <body > tag
134 * @param string Relative path where the CSS data is stored
135 * @param bool Will force re-print the header if it has already been printed
136 */
137 function page_start($actiontitle, $pageclass = ':default:', $pagemargin = 15, $extra = '', $onload = false, $margin = 0, $dotpath = '.', $override = false)
138 {
139 if ($this->registry->debug AND isset($_GET['query']))
140 {
141 ob_start();
142 }
143
144 if (constant('DONE_HEADER') AND !$override)
145 {
146 return;
147 }
148
149 $title = sprintf($this->registry->modules['localize']->string('%1$s - %2$s - %3$s'), $this->registry->application, $this->realm, $actiontitle);
150
151 echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
152 echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>";
153 echo "\n\t<title>$title</title>";
154 echo "\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />";
155 echo $this->css;
156 echo ($extra ? "\n$extra" : '');
157 echo "\n</head>\n<body style=\"margin: {$margin}px;\"" . (($pageclass !== ':default:') ? " class=\"$pageclass\"" : '') . (($onload) ? " onload=\"$onload\"" : '') . ">\n";
158
159 if (!defined('HIDE_SETUP') AND function_exists('_printer_page_start'))
160 {
161 _printer_page_start();
162 }
163
164 echo "<div style=\"margin: {$pagemargin}px;\">\n<!-- / page head -->\n\n";
165
166 if (!defined('DONE_HEADER'))
167 {
168 define('DONE_HEADER', 1);
169 }
170 }
171
172 /**
173 * Links CSS to the page from a given relative path
174 *
175 * @param string Relative path to the CSS file
176 */
177 function css_link($path)
178 {
179 $this->css .= "\n\t<link rel=\"stylesheet\" href=\"$path\" />";
180 }
181
182 /**
183 * Imbeds actual CSS information into the page in <style> tags
184 *
185 * @param string Path of the CSS file to be imbeded
186 */
187 function css_imbed($path)
188 {
189 $data = require_once($path);
190 $css = preg_replace('#/\*(.*?)\*/(\r|\n)*#s', '', $css);
191 $css = trim($css);
192 $this->css .= "\n\t<style type=\"text/css\">\n\t<!--\n" . $css . "\n\t//-->\n\t</style>";
193 }
194
195 /**
196 * Places raw HTML code directly into the documet at the current position
197 *
198 * @param string HTML code
199 */
200 function page_code($code)
201 {
202 echo "\n\n$code\n\n";
203 }
204
205 /**
206 * A block function that produces a table with a message in it. This does not print the header and footer
207 *
208 * @param string The title of the message (appears at the top of the block)
209 * @param string Content of the message
210 */
211 function page_message($title, $message)
212 {
213 $this->table_start(true, '75%');
214 $this->table_head($title, 1);
215 $this->row_span("<blockquote>$message</blockquote>", ':swap:', 'left', 1);
216 $this->table_end();
217 }
218
219 /**
220 * Produces an entire page layout that asks the user whether or not they want to perform X action and provides
221 * a link to the YES and NO action
222 *
223 * @param string Message that asks if they want to do X
224 * @param string Location to go for YES
225 * @param string DO action to pass
226 * @param array Hidden parameters to pass to the next page
227 */
228 function page_confirm($message, $location, $action, $params)
229 {
230 $this->page_start($this->registry->modules['localize']->string('Confirm'));
231
232 $this->form_start($location, $action);
233 foreach ($params AS $key => $value)
234 {
235 $this->form_hidden_field($key, $value);
236 }
237
238 $this->table_start(true, '75%');
239 $this->table_head($this->registry->modules['localize']->string('Confirm'), 1);
240 $this->row_span("<blockquote>$message</blockquote>", ':swap:', 'left', 1);
241 $this->row_submit('<input type="button" class="button" name="no" value=" ' . $this->registry->modules['localize']->string('No') . ' " onclick="history.back(1); return false;" />', $this->registry->modules['localize']->string('Yes'), '');
242 $this->table_end();
243
244 $this->form_end();
245
246 $this->page_end();
247 }
248
249 /**
250 * Closes the HTML document structure an adds the copyright; this also stops execution of the page
251 */
252 function page_end()
253 {
254 if ($this->registry->debug AND isset($_GET['query']))
255 {
256 ob_clean();
257 ob_end_clean();
258
259 if (is_array($this->registry->modules['db_mysql']->history))
260 {
261 echo '<pre>';
262 foreach ($this->registry->modules['db_mysql']->history AS $query)
263 {
264 echo $query . "\n\n<hr />\n\n";
265 }
266 echo '</pre>';
267 }
268 exit;
269 }
270
271 $copyright = "\n<br />\n<p align=\"center\" class=\"copyright\">\n\t<a href=\"http://www.iris-studios.com\" target=\"_blank\">" . $this->registry->application . ' ' . $this->registry->appversion . ", &copy; 2002 - " . date('Y') . " Iris Studios, Inc.</a>\n</p>";
272
273 if (!defined('HIDE_SETUP'))
274 {
275 echo "\n<!-- page end -->\n</div>\n$copyright";
276 }
277 else
278 {
279 echo "\n<!-- page end -->\n</div>";
280 }
281
282 if ($this->registry->debug)
283 {
284 // source control
285 $scinfo = 'Not Under Source Control';
286 $possiblescms = array('cvs', 'svn', 'cvs_information', 'svn_information', 'scm', 'sc_information', 'scm_information');
287 foreach ($possiblescms AS $scm)
288 {
289 if (defined(strtoupper($scm)))
290 {
291 $scinfo = constant(strtoupper($scm));
292
293 $type = '';
294 // CVS
295 if (strpos($scinfo, 'RCSfile:') !== false)
296 {
297 $type = 'cvs';
298 }
299 else if (strpos($scinfo, ',v ') !== false)
300 {
301 $type = 'cvs';
302 }
303 // SVN
304 else if (strpos($scinfo, 'URL:') !== false)
305 {
306 $type = 'svn';
307 }
308 else if (strpos($scinfo, 'https://') !== false OR strpos($scinfo, 'http://') !== false)
309 {
310 $type= 'svn';
311 }
312 // not found so just return it
313 // try a SVN ID tag as we can't really tell if we're using it
314 else
315 {
316 $test = preg_replace('#\$' . 'Id: (.+?) (.+?) [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.+?) (.+?) \$#', '\\1 - SVN \\2', $scinfo);
317 if ($test == '$' . 'Id: $')
318 {
319 $scinfo = 'Not Under Source Control';
320 }
321 else
322 {
323 $scinfo = $test;
324 }
325 break;
326 }
327
328 if ($type == 'cvs')
329 {
330 $scinfo = preg_replace('#\$' . 'RCSfile: (.+?) \$#', '\\1', $scinfo);
331 $scinfo = preg_replace('#\$' . 'Revision: (.+?) \$#', 'CVS \\1', $scinfo);
332 $scinfo = preg_replace('#\$' . 'Id: (.+?) (.+?) [0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} (.+?) (.+?) \$#', '\\1 - CVS \\2', $scinfo);
333 }
334 else if ($type == 'svn')
335 {
336 $scinfo = preg_replace('#\$' . '(Head)?URL: (.+?) \$#e', "end(explode('/', '\\2'))", $scinfo);
337 $scinfo = preg_replace('#\$' . '(LastModified)?Revision: (.+?) \$#', 'SVN \\2', $scinfo);
338 $scinfo = preg_replace('#\$' . 'Id: (.+?) ([0-9].+?) [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.+?) (.+?) \$#', '\\1 - SVN \\2', $scinfo);
339 }
340 else
341 {
342 $scinfo = 'Not Under Source Control';
343 }
344 break;
345 }
346 }
347 $scinfo = trim($scinfo);
348 $debug .= "\n\t<li><strong>Source Control:</strong> $scinfo</li>";
349
350 // query information
351 if (is_object($this->registry->modules['db_mysql']))
352 {
353 $debug .= "\n\t<li><strong>Total Queries:</strong> " . sizeof($this->registry->modules['db_mysql']->history) . " (<a href=\"" . $this->registry->sanitize($_SERVER['REQUEST_URI']) . ((strpos($_SERVER['REQUEST_URI'], '?') !== false) ? '&amp;query=1' : '?query=1') . "\">?</a>)</li>";
354 }
355
356 // total execution time
357 if (defined('ISSO_MT_START'))
358 {
359 $this->registry->load('functions', 'functions');
360 $debug .= "\n\t<li><strong>Total Execution Time:</strong> " . round($this->registry->modules['functions']->fetch_microtime_diff(ISSO_MT_START), 10) . "</li>";
361 }
362
363 // debug notices
364 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Debug Notices (" . sizeof($this->registry->debuginfo) . ")</option>";
365 foreach ((array)$this->registry->debuginfo AS $msg)
366 {
367 $debug .= "\n\t\t\t<option>--- $msg</option>";
368 }
369 $debug .= "\n\t\t</select>\n\t</li>";
370
371 // loaded modules
372 $modules = $this->registry->show_modules(true);
373 $debug .= "\n\t<li>\n\t\t<select>\n\t\t\t<option>Loaded Modules (" . sizeof($modules) . ")</option>";
374 foreach ($modules AS $mod)
375 {
376 $debug .= "\n\t\t\t<option>--- $mod</option>";
377 }
378 $debug .= "\n\t\t</select>\n\t</li>";
379
380 // --- END
381 $debug .= "\n</ul>";
382
383 $debug = "\n<hr />\n" . $this->registry->message('Debug Information', $debug, 1, true, false);
384 echo "\n\n<!-- dev debug -->\n<div align=\"center\">\n$debug\n</div>\n<!-- / dev debug -->\n\n";
385 }
386
387 echo "\n\n</body>\n</html>";
388
389 exit;
390 }
391
392 // ###################################################################
393 /**
394 * Opens a <table> tag with styling
395 *
396 * @param bool Whether to add a <br /> before the table
397 * @param string Value of the width attribute
398 */
399 function table_start($break = true, $width = '90%')
400 {
401 if ($break)
402 {
403 echo '<br />';
404 }
405
406 echo "\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\" align=\"center\" width=\"$width\" class=\"tborder\">\n";
407 }
408
409 /**
410 * Adds a table row that is sued to head the entire table
411 *
412 * @param string Title string
413 * @param integer Colspan attribute value
414 * @param bool Whether to bold the title
415 */
416 function table_head($title, $colspan = 2, $strong = true)
417 {
418 echo "<tr>\n\t<td class=\"tcat\" align=\"center\" colspan=\"$colspan\">" . (($strong) ? "<strong>$title</strong>" : $title) . "</td>\n</tr>\n";
419 }
420
421 /**
422 * Creates column headings; useful for a grid-style page. This uses a different styling than table_head()
423 * and is usually used directly after a table header
424 *
425 * @param array Array of titles to print
426 */
427 function table_column_head($columnarray)
428 {
429 if (is_array($columnarray))
430 {
431 $render = "<tr valign=\"top\" align=\"center\">\n";
432
433 foreach ($columnarray AS $header)
434 {
435 $render .= "\t<td class=\"thead\" align=\"center\">$header</td>\n";
436 }
437
438 $render .= "</tr>\n";
439
440 echo $render;
441 }
442 }
443
444 /**
445 * Closes a <table> tag
446 */
447 function table_end()
448 {
449 echo "\n</table>\n";
450 }
451
452 // ###################################################################
453 /**
454 * Starts a <form> tag and adds the DO hidden input field
455 *
456 * @param string Action/name of the file to action to
457 * @param string Value of the DO parameter; used to do-branch
458 * @param bool Enctype attribute; used for mime/multi-part
459 * @param string Name of the form; this only matters for DOM access
460 * @param string Method to action as; POST or GET (default is POST)
461 */
462 function form_start($action, $do, $enctype = false, $name = 'inputform', $submitmethod = 'post')
463 {
464 echo "\n<!-- input form -->\n<form name=\"$name\" action=\"$action\"" . (($enctype) ? " enctype=\"$enctype\"" : '') . " method=\"$submitmethod\">\n";
465 $this->form_hidden_field('do', $do);
466 }
467
468 /**
469 * Adds a hidden field at the current location
470 *
471 * @param string Name of the field
472 * @param string Value of the field
473 */
474 function form_hidden_field($name, $value)
475 {
476 echo "<input type=\"hidden\" name=\"$name\" value=\"$value\" />\n";
477 }
478
479 /**
480 * Closes a <form> tag
481 */
482 function form_end()
483 {
484 echo "</form>\n<!-- / input form -->\n";
485 }
486
487 // ###################################################################
488 /**
489 * Creates a table row that spans an entire row; this is used to divide sections, usually
490 *
491 * @param string Text to place in the row
492 * @param string Class name to style with; by default it alternates between alt1 and alt2 (use :swap: to do that)
493 * @param string Alignment of the text in the row
494 * @param integer Colspan attribute
495 */
496 function row_span($text, $class = ':swap:', $align = 'left', $colspan = 2)
497 {
498 if ($class === ':swap:')
499 {
500 $this->registry->modules['functions']->exec_swap_bg();
501 $row_class = $this->registry->modules['functions']->bgcolour;
502 $is_style_element = false;
503 }
504 else
505 {
506 if (preg_match('#:style:(.*?)#i', $class))
507 {
508 $is_style_element = true;
509 $style = str_replace(':style:', '', $class);
510 }
511 else
512 {
513 $row_class = $class;
514 $is_style_element = false;
515 }
516 }
517
518 echo "\n<tr>\n\t<td ". (($is_style_element) ? "style=\"$style\"" : "class=\"$row_class\"") . " colspan=\"$colspan\" align=\"$align\">$text</td>\n</tr>";
519 }
520
521 /**
522 * Creates a table row that has more than two columns; this is used in conjunction with table_column_head()
523 * usually; it takes an array of values
524 *
525 * @param array Array of values in form value => alignment key (c for center, l for left, and r for right)
526 */
527 function row_multi_item($row_array)
528 {
529 $this->registry->modules['functions']->exec_swap_bg();
530
531 foreach ($row_array AS $item => $align)
532 {
533 $row_data["$align"][] = $item;
534 }
535
536 echo "<tr valign=\"top\">";
537
538 foreach ($row_data AS $align_key => $item_array)
539 {
540 if ($align_key == 'c')
541 {
542 $align = 'center';
543 }
544 else if ($align_key == 'l')
545 {
546 $align = 'left';
547 }
548 else if ($align_key == 'r')
549 {
550 $align = 'right';
551 }
552
553 foreach ($item_array AS $value)
554 {
555 echo "\n\t<td class=\"{$this->registry->modules['functions']->bgcolour}\" align=\"$align\">$value</td>";
556 }
557 }
558
559 echo "\n</tr>\n";
560 }
561
562 /**
563 * Generic row creation function that has two columns: label and value; this is used for many
564 * other form functions, but can also be used for non-editable fields
565 *
566 * @param string Label text
567 * @param string HTML or text to place in the value column
568 * @param string Vertical align (valign attribute) for the row
569 * @param integer Colspan attribute
570 * @param string Class to style the row with; default is to alternate
571 */
572 function row_text($label, $value = '&nbsp;', $valign = 'top', $colspan = 2, $class = -1)
573 {
574 global $IS_SETTINGS;
575
576 if ($class == -1)
577 {
578 if (!$IS_SETTINGS)
579 {
580 $this->registry->modules['functions']->exec_swap_bg();
581 $row_class = $this->registry->modules['functions']->bgcolour;
582 }
583 else
584 {
585 $row_class = 'alt2';
586 }
587 }
588 else
589 {
590 $row_class = $class;
591 }
592
593 echo "<tr valign=\"$valign\">";
594 echo "\n\t<td class=\"$row_class\">$label</td>";
595 echo "\n\t<td class=\"$row_class\">$value</td>";
596
597 if ($colspan > 2)
598 {
599 echo "\n\t<td class=\"$row_class\" colspan=\"" . $colspan - 2 . "\">&nbsp;</td>";
600 }
601
602 echo "\n</tr>\n";
603 }
604
605 /**
606 * Creates a table row with an <input> text field as the value column
607 *
608 * @param string Label text
609 * @param string Name of the <input> field
610 * @param string Value of the field
611 * @param integer Colspan attribute
612 * @param integer Size of the <input> field
613 * @param integer Length attribute; use FALSE for no length to be specified
614 * @param bool Whether to make this a password field
615 * @param string Vertical align (valign attribute)
616 */
617 function row_input($label, $name, $value = '', $colspan = 2, $size = 35, $length = false, $password = false, $lalign = 'top')
618 {
619 $this->row_text($label, "<input type=\"" . (($password) ? 'password' : 'text') . "\" class=\"input\" name=\"$name\" value=\"$value\" size=\"$size\" " . (($length) ? "maxlength=\"$length\" " : '') . "/>", $lalign, $colspan);
620 }
621
622 /**
623 * Creates a table row with a <textarea> as the value column
624 *
625 * @param string Label text
626 * @param string Name of the <textarea>
627 * @param string Value of the <textarea>
628 * @param integer Colspan attribute
629 * @param integer Number of rows in the <textarea>
630 * @param integer Number of colums in the <textarea>
631 * @param bool Whether or not to use monospacing font
632 * @param string Extra style attributes to apply to the <textarea>
633 */
634 function row_textarea($label, $name, $value = '', $colspan = 2, $rows = 7, $cols = 50, $code = false, $style = '')
635 {
636 $this->row_text($label, "<textarea name=\"$name\" class=\"" . (($code) ? 'code' : 'input') . "\" rows=\"$rows\" cols=\"$cols\"" . (($style) ? ' style="' . $style . '"' : '') . ">$value</textarea>", 'top', $colspan);
637 }
638
639 /**
640 * Creates a table row with the tfoot class
641 *
642 * @param string Extra text or HTML to insert into the row
643 * @param integer Colspan attribute
644 */
645 function row_tfoot($data, $colspan = 2)
646 {
647 echo $this->row_span($data, 'tfoot', 'center', $colspan);
648 }
649
650 /**
651 * Creates a tfoot table row with submit buttons
652 *
653 * @param string Extra HTML to imbed in the row after the buttons
654 * @param string Submit button text (by default it uses pre-translated "Submit" from :save:)
655 * @param string Reset button text (default it uses pre-translated "Reset" from :reset:)
656 * @param integer Colspan attribute
657 */
658 function row_submit($extra = false, $submit = ':save:', $reset = ':reset:', $colspan = 2)
659 {
660 if ($submit === ':save:')
661 {
662 $submit = " " . $this->registry->modules['localize']->string('Submit') . " ";
663 }
664 else
665 {
666 $submit = " $submit ";
667 }
668
669 if ($reset === ':reset:')
670 {
671 $reset = " " . $this->registry->modules['localize']->string('Reset') . " ";
672 }
673 else
674 {
675 $reset = (($reset) ? " $reset " : '');
676 }
677
678 $output = "\n\t\t<input type=\"submit\" class=\"button\" value=\"$submit\" accesskey=\"s\" />";
679 $output .= ($reset ? "\n\t\t<input type=\"reset\" class=\"button\" value=\"$reset\" accesskey=\"r\" />" : '');
680 $output .= ($extra ? "\n\t\t$extra" : '');
681 $output .= "\n\t";
682 $this->row_tfoot($output, $colspan);
683 }
684
685 /**
686 * Creates an upload row; you need to specify some other paramaters in form_start() for this to work
687 *
688 * @param string Label text
689 * @param string Upload name
690 * @param integer Colspan attribute
691 */
692 function row_upload($label, $name, $colspan = 2)
693 {
694 $this->row_text($label, "<input type=\"file\" class=\"button\" name=\"$name\" size=\"35\" />", 'top', $colspan);
695 }
696
697 /**
698 * Adds a name-value pair to an array that is constructed into a <select> list
699 *
700 * @param string Text displayed for the option
701 * @param string Value of the option
702 * @param bool Whether or not to select this particluar option
703 */
704 function list_item($name, $value, $selected = false)
705 {
706 global $listitem;
707
708 $listitem[] = "\n\t<option value=\"$value\"" . (($selected == true) ? ' selected="selected"' : '') . ">$name</option>";
709 }
710
711 /**
712 * Assembles a <select> table row from list_item() items
713 *
714 * @param string Label text
715 * @param string Name of the <select>
716 * @param bool Automatically submit the form on a change?
717 * @param integer Colspan attribute
718 */
719 function row_list($label, $name, $is_jump = false, $colspan = 2)
720 {
721 global $listitem;
722
723 foreach ($listitem AS $option)
724 {
725 $optionlist .= $option;
726 }
727
728 $listitem = '';
729
730 $this->row_text($label, "\n<select class=\"button\" name=\"$name\"" . (($is_jump) ? " onchange=\"this.form.submit();\"" : '') . ">$optionlist\n</select>" . (($is_jump) ? "\n<input type=\"submit\" class=\"button\" value=\" " . $this->registry->modules['localize']->string('Go') . " \" accesskey=\"g\" />" : '') . "\n", $colspan);
731 }
732
733 /**
734 * Creates a row with two radio buttons: yes and now
735 *
736 * @param string Label text
737 * @param string Name of the BOOL flag
738 * @param bool TRUE to select the YES by default; FALSE for NO
739 * @param integer Colspan attribute
740 */
741 function row_yesno($label, $name, $value, $colspan = 2)
742 {
743 $this->row_text($label, "<input type=\"radio\" name=\"$name\" value=\"1\"" . (($value) ? ' checked="checked"' : '') . " /> " . $this->registry->modules['localize']->string('Yes') . " <input type=\"radio\" name=\"$name\" value=\"0\"" . ((!$value) ? ' checked="checked"' : '') . " /> " . $this->registry->modules['localize']->string('No'), $colspan);
744 }
745 }
746
747 /*=====================================================================*\
748 || ###################################################################
749 || # $HeadURL$
750 || # $Id$
751 || ###################################################################
752 \*=====================================================================*/
753 ?>