From 1d063f945c81a5eab987a46b25f66cfa601cc0ad Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 22 Oct 2005 21:41:30 +0000 Subject: [PATCH] Copying printer class from bugtrack --- printer.php | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 430 insertions(+) create mode 100644 printer.php diff --git a/printer.php b/printer.php new file mode 100644 index 0000000..93c089e --- /dev/null +++ b/printer.php @@ -0,0 +1,430 @@ + + + +EOD; + + $this->page_start($bugsys->lang->string('Redirect'), ':default:', 15, $js); + + $this->page_message($bugsys->lang->string('Redirect'), sprintf($bugsys->lang->string('Please wait to be redirected. If you are not redirected in a few seconds, click here.'), $location)); + + $this->page_end(); + } + + function error($message) + { + global $bugsys; + + $this->page_start($bugsys->lang->string('Error')); + $this->page_message($bugsys->lang->string('Error'), $message); + $this->page_end(); + + exit; + } + + // ################################################################### + // ########################### PAGE CONTROL ########################## + // ################################################################### + function page_start($actiontitle, $pageclass = ':default:', $pagemargin = 15, $extra = '', $onload = false, $margin = 0, $dotpath = '.', $override = false) + { + global $bugsys; + + if (constant('DONE_HEADER') AND !$override) + { + return; + } + + $title = sprintf($bugsys->lang->string('BugStrike - Administration - %1$s'), $actiontitle); + + echo "\n"; + echo "\n"; + echo "\n\t$title"; + echo "\n\t"; + echo "\n\t" . (($extra) ? "\n$extra" : ''); + echo "\n\n\n"; + + if (!defined('HIDE_SETUP') AND $bugsys->userinfo['adminsession']) + { + global $globalnav; + + $location = parse_url($_SERVER['SCRIPT_URL']); + $location['path'] = preg_quote(end(explode('/', $location['path']))); + $location['path'] = ((!$location['path']) ? 'index.php' : $location['path']); + + echo "
\n"; + echo "\n\t
"; + echo "\n\t" . $bugsys->lang->string('Tracker Home') . ""; + echo "\n\t\t" . $bugsys->lang->string('Navigation') . ": "; + echo "\n\t\tlang->string('Go') . " \" />"; + echo "\n\t
"; + echo "\n
"; + } + + echo "
\n\n\n"; + + if (!defined('DONE_HEADER')) + { + define('DONE_HEADER', 1); + } + } + + function page_code($code) + { + echo "\n\n$code\n\n"; + } + + function page_message($title, $message) + { + $this->table_start(true, '75%'); + $this->table_head($title, 1); + $this->row_span("
$message
", ':swap:', 'left', 1); + $this->table_end(); + } + + function page_confirm($message, $location) + { + global $bugsys; + + $this->page_start($bugsys->lang->string('Confirm')); + + $this->page_message($bugsys->lang->string('Confirm'), $message . '

'); + + $this->page_end(); + } + + function page_end() + { + global $bugsys; + + $copyright = "\n
\n

\n\tBugStrike " . $bugsys->options['trackerversion'] . ", © 2002 - " . date('Y') . " Iris Studios, Inc.\n

"; + + if (!defined('HIDE_SETUP')) + { + echo "\n\n
\n$copyright"; + } + else + { + echo "\n\n"; + } + + echo "\n\n\n"; + + exit; + } + + // ################################################################### + // ##################### TABLE SKELETON RENDERING #################### + // ################################################################### + function table_start($break = true, $width = '90%') + { + if ($break) + { + echo '
'; + } + + echo "\n\n"; + } + + function table_head($title, $colspan = 2, $strong = true) + { + echo "\n\t\n\n"; + } + + function table_column_head($columnarray) + { + if (is_array($columnarray)) + { + $render = "\n"; + + foreach ($columnarray AS $header) + { + $render .= "\t\n"; + } + + $render .= "\n"; + + echo $render; + } + } + + function table_end() + { + echo "\n
" . (($strong) ? "$title" : $title) . "
$header
\n"; + } + + // ################################################################### + // ########################## FORM CREATION ########################## + // ################################################################### + function form_start($action, $do, $enctype = false, $name = 'inputform', $submitmethod = 'post') + { + echo "\n\n
\n"; + $this->form_hidden_field('do', $do); + } + + function form_hidden_field($name, $value) + { + echo "\n"; + } + + function form_end() + { + echo "
\n\n"; + } + + // ################################################################### + // ####################### TABLE ROW RENDERING ####################### + // ################################################################### + function row_span($text, $class = ':swap:', $align = 'left', $colspan = 2) + { + global $bugsys; + if ($class === ':swap:') + { + $bugsys->funct->exec_swap_bg(); + $row_class = $bugsys->funct->bgcolour; + $is_style_element = false; + } + else + { + if (preg_match('#:style:(.*?)#i', $class)) + { + $is_style_element = true; + $style = str_replace(':style:', '', $class); + } + else + { + $row_class = $class; + $is_style_element = false; + } + } + + echo "\n\t$text\n"; + } + + function row_multi_item($row_array) + { + global $bugsys; + $bugsys->funct->exec_swap_bg(); + + foreach ($row_array AS $item => $align) + { + $row_data["$align"][] = $item; + } + + echo ""; + + foreach ($row_data AS $align_key => $item_array) + { + if ($align_key == 'c') + { + $align = 'center'; + } + else if ($align_key == 'l') + { + $align = 'left'; + } + else if ($align_key == 'r') + { + $align = 'right'; + } + + foreach ($item_array AS $value) + { + echo "\n\tfunct->bgcolour}\" align=\"$align\">$value"; + } + } + + echo "\n\n"; + } + + function row_text($label, $value = ' ', $valign = 'top', $colspan = 2, $class = -1) + { + global $bugsys, $IS_SETTINGS; + + if ($class == -1) + { + if (!$IS_SETTINGS) + { + $bugsys->funct->exec_swap_bg(); + $row_class = $bugsys->funct->bgcolour; + } + else + { + $row_class = 'alt2'; + } + } + else + { + $row_class = $class; + } + + echo ""; + echo "\n\t$label"; + echo "\n\t$value"; + + if ($colspan > 2) + { + echo "\n\t "; + } + + echo "\n\n"; + } + + function row_input($label, $name, $value = '', $colspan = 2, $size = 35, $length = false, $password = false, $lalign = 'top') + { + $this->row_text($label, "", $lalign, $colspan); + } + + function row_textarea($label, $name, $value = '', $colspan = 2, $rows = 7, $cols = 50, $code = false, $style = '') + { + $this->row_text($label, "", 'top', $colspan); + } + + function row_tfoot($data, $colspan = 2) + { + echo $this->row_span($data, 'tfoot', 'center'); + } + + function row_submit($extra = false, $submit = ':save:', $reset = ':reset:', $colspan = 2) + { + global $bugsys; + + if ($submit === ':save:') + { + $submit = " " . $bugsys->lang->string('Submit') . " "; + } + else + { + $submit = " $submit "; + } + + if ($reset === ':reset:') + { + $reset = " " . $bugsys->lang->string('Reset') . " "; + } + else + { + $reset = (($reset) ? " $reset " : ''); + } + + $output = "\n\t\t"; + $output .= (($reset) ? "\n\t\t $extra\n\t" : ''); + $this->row_tfoot($output); + } + + function row_upload($label, $name, $colspan = 2) + { + $this->row_text($label, "", 'top', $colspan); + } + + function list_item($name, $value, $selected = false) + { + global $listitem; + + $listitem[] = "\n\t"; + } + + function row_list($label, $name, $is_jump = false, $colspan = 2) + { + global $listitem; + + foreach ($listitem AS $option) + { + $optionlist .= $option; + } + + $listitem = ''; + + $this->row_text($label, "\n" . (($is_jump) ? "\nlang->string('Go') . " \" accesskey=\"g\" />" : '') . "\n", $colspan); + } + + function row_yesno($label, $name, $value, $colspan = 2) + { + global $bugsys; + + $this->row_text($label, " " . $bugsys->lang->string('Yes') . " " . $bugsys->lang->string('No'), $colspan); + } +} + +/*=====================================================================*\ +|| ################################################################### +|| # $HeadURL$ +|| # $Id$ +|| ################################################################### +\*=====================================================================*/ +?> \ No newline at end of file -- 2.22.5