2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Bugdar [#]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('Bugdar - 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=utf-8\" />";
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()\" class=\"input\">";
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') . " \" class=\"button\" />";
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\">Bugdar " . $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, $help = null
)
179 $title = ($help ?
"<a href=\"http://www.iris-studios.com/support/bugdar/$help.html\" target=\"_blank\" style=\"cursor: help; text-decoration: none\">$title</a>" : $title);
180 $help = ($help ?
"<span style=\"float: right\"><a href=\"http://www.iris-studios.com/support/bugdar/$help.html\" target=\"_blank\" style=\"cursor: help; text-decoration: none; font-size: 9px; color: #FFFFFF\">Help</a></span>" : '');
181 echo "<tr>\n\t<td class=\"tcat\" align=\"center\" colspan=\"$colspan\">$help<strong>$title</strong></td>\n</tr>\n";
184 function table_column_head($columnarray)
186 if (is_array($columnarray))
188 $render = "<tr valign=\"top\" align=\"center\">\n";
190 foreach ($columnarray AS $header)
192 $render .= "\t<td class=\"thead\" align=\"center\">$header</td>\n";
195 $render .= "</tr>\n";
206 // ###################################################################
207 // ########################## FORM CREATION ##########################
208 // ###################################################################
209 function form_start($action, $do, $enctype = false
, $name = 'inputform', $submitmethod = 'post')
211 echo "\n<!-- input form -->\n<form name=\"$name\" action=\"$action\"" . (($enctype) ?
" enctype=\"$enctype\"" : '') . " method=\"$submitmethod\">\n";
212 $this->form_hidden_field('do', $do);
215 function form_hidden_field($name, $value)
217 echo "<input type=\"hidden\" name=\"$name\" value=\"$value\" />\n";
222 echo "</form>\n<!-- / input form -->\n";
225 // ###################################################################
226 // ####################### TABLE ROW RENDERING #######################
227 // ###################################################################
228 function row_span($text, $class = ':swap:', $align = 'left', $colspan = 2)
231 if ($class === ':swap:')
233 $bugsys->funct
->exec_swap_bg();
234 $row_class = $bugsys->funct
->bgcolour
;
235 $is_style_element = false
;
239 if (preg_match('#:style:(.*?)#i', $class))
241 $is_style_element = true
;
242 $style = str_replace(':style:', '', $class);
247 $is_style_element = false
;
251 echo "<tr>\n\t<td ". (($is_style_element) ?
"style=\"$style\"" : "class=\"$row_class\"") . " colspan=\"$colspan\" align=\"$align\">$text</td>\n</tr>";
254 function row_multi_item($row_array)
257 $bugsys->funct
->exec_swap_bg();
259 foreach ($row_array AS $item => $align)
261 $row_data["$align"][] = $item;
264 echo "<tr valign=\"top\">";
266 foreach ($row_data AS $align_key => $item_array)
268 if ($align_key == 'c')
272 else if ($align_key == 'l')
276 else if ($align_key == 'r')
281 foreach ($item_array AS $value)
283 echo "\n\t<td class=\"{$bugsys->funct->bgcolour}\" align=\"$align\">$value</td>";
290 function row_text($label, $value = ' ', $valign = 'top', $colspan = 2, $class = -1)
292 global $bugsys, $IS_SETTINGS;
298 $bugsys->funct
->exec_swap_bg();
299 $row_class = $bugsys->funct
->bgcolour
;
311 echo "<tr valign=\"$valign\">";
312 echo "\n\t<td class=\"$row_class\">$label</td>";
313 echo "\n\t<td class=\"$row_class\">$value</td>";
317 echo "\n\t<td class=\"$row_class\" colspan=\"" . $colspan - 2 . "\"> </td>";
323 function row_input($label, $name, $value = '', $colspan = 2, $size = 35, $length = false
, $password = false
, $lalign = 'top')
325 $this->row_text($label, "<input type=\"" . (($password) ?
'password' : 'text') . "\" class=\"input\" name=\"$name\" value=\"$value\" size=\"$size\" " . (($length) ?
"maxlength=\"$length\" " : '') . "/>", $lalign, $colspan);
328 function row_textarea($label, $name, $value = '', $colspan = 2, $rows = 7, $cols = 50, $code = false
, $style = '')
330 $this->row_text($label, "<textarea name=\"$name\" class=\"" . (($code) ?
'code' : 'input') . "\" rows=\"$rows\" cols=\"$cols\"" . (($style) ?
' style="' . $style . '"' : '') . ">$value</textarea>", 'top', $colspan);
333 function row_tfoot($data, $colspan = 2)
335 echo $this->row_span($data, 'tfoot', 'center');
338 function row_submit($extra = false
, $submit = ':save:', $reset = ':reset:', $colspan = 2)
342 if ($submit === ':save:')
344 $submit = " " . $bugsys->lang
->string('Submit') . " ";
348 $submit = " $submit ";
351 if ($reset === ':reset:')
353 $reset = " " . $bugsys->lang
->string('Reset') . " ";
357 $reset = (($reset) ?
" $reset " : '');
360 $output = "\n\t\t<input type=\"submit\" class=\"button\" value=\"$submit\" accesskey=\"s\" />";
361 $output .= (($reset) ?
"\n\t\t<input type=\"reset\" class=\"button\" value=\"$reset\" accesskey=\"r\" /> $extra\n\t" : $extra);
362 $this->row_tfoot($output);
365 function row_upload($label, $name, $colspan = 2)
367 $this->row_text($label, "<input type=\"file\" class=\"button\" name=\"$name\" size=\"35\" />", 'top', $colspan);
370 function list_item($name, $value, $selected = false
)
374 $listitem[] = "\n\t<option value=\"$value\"" . (($selected == true
) ?
' selected="selected"' : '') . ">$name</option>";
377 function row_list($label, $name, $is_jump = false
, $colspan = 2)
381 foreach ($listitem AS $option)
383 $optionlist .= $option;
388 $this->row_text($label, "\n<select class=\"input\" 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);
391 function row_yesno($label, $name, $value, $colspan = 2)
395 $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);
399 /*=====================================================================*\
400 || ###################################################################
403 || ###################################################################
404 \*=====================================================================*/