2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 class Admin_Print_Class
15 function redirect($location, $timeout = 10)
19 $timeout = $timeout * 200;
23 <script type
="text/javascript">
25 var timeout
= $timeout;
29 setTimeout("redirect()", $timeout);
38 window
.location
= "$location";
44 $this->page_start($bugsys->lang
->string('Redirect'), ':default:', 15, $js);
46 $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 <a href="%1$s">here</a>.'), $location));
51 function error($message)
55 $this->page_start($bugsys->lang
->string('Error'));
56 $this->page_message($bugsys->lang
->string('Error'), $message);
62 // ###################################################################
63 // ########################### PAGE CONTROL ##########################
64 // ###################################################################
65 function page_start($actiontitle, $pageclass = ':default:', $pagemargin = 15, $extra = '', $onload = false
, $margin = 0, $dotpath = '.', $override = false
)
69 if (constant('DONE_HEADER') AND !$override)
74 $title = sprintf($bugsys->lang
->string('BugStrike - Administration - %1$s'), $actiontitle);
76 echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
77 echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>";
78 echo "\n\t<title>$title</title>";
79 echo "\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />";
80 echo "\n\t<link rel=\"stylesheet\" href=\"$dotpath/admin.css\" />" . (($extra) ?
"\n$extra" : '');
81 echo "\n</head>\n<body style=\"margin: {$margin}px;\"" . (($pageclass !== ':default:') ?
" class=\"$pageclass\"" : '') . (($onload) ?
" onload=\"$onload\"" : '') . ">\n";
83 if (!defined('HIDE_SETUP') AND $bugsys->userinfo
['adminsession'])
87 $location = parse_url($_SERVER['SCRIPT_URL']);
88 $location['path'] = preg_quote(end(explode('/', $location['path'])));
89 $location['path'] = ((!$location['path']) ?
'index.php' : $location['path']);
91 echo "<div class=\"tcat\" style=\"padding: 5px; border-bottom: 4px outset\">\n";
92 echo "\n\t<form action=\"jump.php\" method=\"post\" title=\"navigation\" style=\"display: inline\">";
93 echo "\n\t<span style=\"float: right\"><a href=\"../\">" . $bugsys->lang
->string('Tracker Home') . "</a></span>";
94 echo "\n\t\t" . $bugsys->lang
->string('Navigation') . ": <select name=\"jumplocation\" onchange=\"this.form.submit()\">";
95 foreach ($globalnav AS $grouptitle => $links)
97 echo "\n\t\t<optgroup label=\"$grouptitle\">";
98 foreach ($links AS $title => $url)
100 $selected = ((preg_match("#$location[path]$#i", $url)) ?
' selected="selected"' : '');
101 echo "\n\t\t\t<option value=\"$url\"$selected>$title</option>";
103 echo "\n\t\t</optgroup>";
105 echo "\n\t\t</select>";
106 echo "\n\t\t<input type=\"submit\" name=\"go\" value=\" " . $bugsys->lang
->string('Go') . " \" />";
111 echo "<div style=\"margin: {$pagemargin}px;\">\n<!-- / page head -->\n\n";
113 if (!defined('DONE_HEADER'))
115 define('DONE_HEADER', 1);
119 function page_code($code)
121 echo "\n\n$code\n\n";
124 function page_message($title, $message)
126 $this->table_start(true
, '75%');
127 $this->table_head($title, 1);
128 $this->row_span("<blockquote>$message</blockquote>", ':swap:', 'left', 1);
132 function page_confirm($message, $location)
136 $this->page_start($bugsys->lang
->string('Confirm'));
138 $this->page_message($bugsys->lang
->string('Confirm'), $message . '<p><input type="button" name="confirm" value=" ' . $bugsys->lang
->string('Yes') . ' " onclick="window.location = \'' . $location . '\';" />');
147 $copyright = "\n<br />\n<p align=\"center\" class=\"copyright\">\n\t<a href=\"http://www.iris-studios.com\" target=\"_blank\">BugStrike " . $bugsys->options
['trackerversion'] . ", © 2002 - " . date('Y') . " Iris Studios, Inc.</a>\n</p>";
149 if (!defined('HIDE_SETUP'))
151 echo "\n<!-- page end -->\n</div>\n$copyright";
155 echo "\n<!-- page end -->\n</div>";
158 echo "\n\n</body>\n</html>";
163 // ###################################################################
164 // ##################### TABLE SKELETON RENDERING ####################
165 // ###################################################################
166 function table_start($break = true
, $width = '90%')
173 echo "\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\" align=\"center\" width=\"$width\" class=\"tborder\">\n";
176 function table_head($title, $colspan = 2, $strong = true
)
178 echo "<tr>\n\t<td class=\"tcat\" align=\"center\" colspan=\"$colspan\">" . (($strong) ?
"<strong>$title</strong>" : $title) . "</td>\n</tr>\n";
181 function table_column_head($columnarray)
183 if (is_array($columnarray))
185 $render = "<tr valign=\"top\" align=\"center\">\n";
187 foreach ($columnarray AS $header)
189 $render .= "\t<td class=\"thead\" align=\"center\">$header</td>\n";
192 $render .= "</tr>\n";
203 // ###################################################################
204 // ########################## FORM CREATION ##########################
205 // ###################################################################
206 function form_start($action, $do, $enctype = false
, $name = 'inputform', $submitmethod = 'post')
208 echo "\n<!-- input form -->\n<form name=\"$name\" action=\"$action\"" . (($enctype) ?
" enctype=\"$enctype\"" : '') . " method=\"$submitmethod\">\n";
209 $this->form_hidden_field('do', $do);
212 function form_hidden_field($name, $value)
214 echo "<input type=\"hidden\" name=\"$name\" value=\"$value\" />\n";
219 echo "</form>\n<!-- / input form -->\n";
222 // ###################################################################
223 // ####################### TABLE ROW RENDERING #######################
224 // ###################################################################
225 function row_span($text, $class = ':swap:', $align = 'left', $colspan = 2)
228 if ($class === ':swap:')
230 $bugsys->funct
->exec_swap_bg();
231 $row_class = $bugsys->funct
->bgcolour
;
232 $is_style_element = false
;
236 if (preg_match('#:style:(.*?)#i', $class))
238 $is_style_element = true
;
239 $style = str_replace(':style:', '', $class);
244 $is_style_element = false
;
248 echo "<tr>\n\t<td ". (($is_style_element) ?
"style=\"$style\"" : "class=\"$row_class\"") . " colspan=\"$colspan\" align=\"$align\">$text</td>\n</tr>";
251 function row_multi_item($row_array)
254 $bugsys->funct
->exec_swap_bg();
256 foreach ($row_array AS $item => $align)
258 $row_data["$align"][] = $item;
261 echo "<tr valign=\"top\">";
263 foreach ($row_data AS $align_key => $item_array)
265 if ($align_key == 'c')
269 else if ($align_key == 'l')
273 else if ($align_key == 'r')
278 foreach ($item_array AS $value)
280 echo "\n\t<td class=\"{$bugsys->funct->bgcolour}\" align=\"$align\">$value</td>";
287 function row_text($label, $value = ' ', $valign = 'top', $colspan = 2, $class = -1)
289 global $bugsys, $IS_SETTINGS;
295 $bugsys->funct
->exec_swap_bg();
296 $row_class = $bugsys->funct
->bgcolour
;
308 echo "<tr valign=\"$valign\">";
309 echo "\n\t<td class=\"$row_class\">$label</td>";
310 echo "\n\t<td class=\"$row_class\">$value</td>";
314 echo "\n\t<td class=\"$row_class\" colspan=\"" . $colspan - 2 . "\"> </td>";
320 function row_input($label, $name, $value = '', $colspan = 2, $size = 35, $length = false
, $password = false
, $lalign = 'top')
322 $this->row_text($label, "<input type=\"" . (($password) ?
'password' : 'text') . "\" class=\"input\" name=\"$name\" value=\"$value\" size=\"$size\" " . (($length) ?
"maxlength=\"$length\" " : '') . "/>", $lalign, $colspan);
325 function row_textarea($label, $name, $value = '', $colspan = 2, $rows = 7, $cols = 50, $code = false
, $style = '')
327 $this->row_text($label, "<textarea name=\"$name\" class=\"" . (($code) ?
'code' : 'input') . "\" rows=\"$rows\" cols=\"$cols\"" . (($style) ?
' style="' . $style . '"' : '') . ">$value</textarea>", 'top', $colspan);
330 function row_tfoot($data, $colspan = 2)
332 echo $this->row_span($data, 'tfoot', 'center');
335 function row_submit($extra = false
, $submit = ':save:', $reset = ':reset:', $colspan = 2)
339 if ($submit === ':save:')
341 $submit = " " . $bugsys->lang
->string('Submit') . " ";
345 $submit = " $submit ";
348 if ($reset === ':reset:')
350 $reset = " " . $bugsys->lang
->string('Reset') . " ";
354 $reset = (($reset) ?
" $reset " : '');
357 $output = "\n\t\t<input type=\"submit\" class=\"button\" value=\"$submit\" accesskey=\"s\" />";
358 $output .= (($reset) ?
"\n\t\t<input type=\"reset\" class=\"button\" value=\"$reset\" accesskey=\"r\" /> $extra\n\t" : '');
359 $this->row_tfoot($output);
362 function row_upload($label, $name, $colspan = 2)
364 $this->row_text($label, "<input type=\"file\" class=\"button\" name=\"$name\" size=\"35\" />", 'top', $colspan);
367 function list_item($name, $value, $selected = false
)
371 $listitem[] = "\n\t<option value=\"$value\"" . (($selected == true
) ?
' selected="selected"' : '') . ">$name</option>";
374 function row_list($label, $name, $is_jump = false
, $colspan = 2)
378 foreach ($listitem AS $option)
380 $optionlist .= $option;
385 $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=\" " . $bugsys->lang
->string('Go') . " \" accesskey=\"g\" />" : '') . "\n", $colspan);
388 function row_yesno($label, $name, $value, $colspan = 2)
392 $this->row_text($label, "<input type=\"radio\" name=\"$name\" value=\"1\"" . (($value) ?
' checked="checked"' : '') . " /> " . $bugsys->lang
->string('Yes') . " <input type=\"radio\" name=\"$name\" value=\"0\"" . ((!$value) ?
' checked="checked"' : '') . " /> " . $bugsys->lang
->string('No'), $colspan);
396 /*=====================================================================*\
397 || ###################################################################
400 || ###################################################################
401 \*=====================================================================*/