]>
src.bluestatic.org Git - bugdar.git/blob - adminfunctions.php
1e4418013b99824518b180cf15fb13dc7cf2c1ef
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)
17 $timeout = $timeout * 200;
21 <script type="text/javascript">
23 var timeout = $timeout;
27 setTimeout("redirect()", $timeout);
36 window.location = "$location";
42 $this->page_start(phrase('redirect'), ':default:', 15, $js);
44 $this->page_message(phrase('redirect'), phrase('wait_to_be_redirected', $location));
49 function error($message)
51 $this->page_start(phrase('error'));
52 $this->page_message(phrase('error'), $message);
58 // ###################################################################
59 // ########################### PAGE CONTROL ##########################
60 // ###################################################################
61 function page_start($actiontitle, $pageclass = ':default:', $pagemargin = 15, $extra = '', $onload = false, $margin = 0, $dotpath = '.')
65 $title = 'BugStrike - ' . phrase('administration_x', $actiontitle);
67 echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
68 echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>";
69 echo "\n\t<title>$title</title>";
70 echo "\n\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />";
71 echo "\n\t<link rel=\"stylesheet\" href=\"$dotpath/admin.css\" />" . (($extra) ? "\n$extra" : '');
72 echo "\n
</head
>\n<body style
=\"margin
: {$margin
}px
;\"" . (($pageclass !== ':default:') ? " class=\"$pageclass\"" : '') . (($onload) ? " onload
=\"$onload\"" : '') . ">\n";
74 if (!defined('HIDE_SETUP') AND $bugsys->userinfo['userid'])
78 $location = parse_url($_SERVER['SCRIPT_URL']);
79 $location['path'] = preg_quote(end(explode('/', $location['path'])));
80 $location['path'] = ((!$location['path']) ? 'index.php' : $location['path']);
82 echo "<div
class=\"tcat\" style
=\"padding
: 5px
; border
-bottom
: 4px outset\"
>\n";
83 echo "\n\t
<form action
=\"jump
.php\" method
=\"post\" title
=\"navigation\" style
=\"display
: inline\"
>";
84 echo "\n\t
<span style
=\"float: right\"
><a href
=\"../\">Tracker Home
</a
></span
>";
85 echo "\n\t\tNavigation
: <select name
=\"jumplocation\" onchange
=\"this
.form
.submit()\">";
86 foreach ($globalnav AS $grouptitle => $links)
88 echo "\n\t\t
<optgroup label
=\"$grouptitle\">";
89 foreach ($links AS $title => $url)
91 $selected = ((preg_match("#$location[path]$#i", $url)) ? ' selected="selected"' : '');
92 echo "\n\t\t\t<option value=\"$url\"$selected>$title</option>";
94 echo "\n\t\t</optgroup>";
96 echo "\n\t\t</select>";
97 echo "\n\t\t<input type=\"submit\" name=\"go\" value=\" Go \" />";
102 echo "<div style=\"margin: {$pagemargin}px;\">\n<!-- / page head -->\n\n";
105 function page_code($code)
107 echo "\n\n$code\n\n";
110 function page_message($title, $message)
112 $this->table_start(true, '75%');
113 $this->table_head($title, 1);
114 $this->row_span("<blockquote>$message</blockquote>", ':swap:', 'left', 1);
118 function page_confirm($message, $location)
120 $this->page_start(phrase('confirm'));
122 $this->page_message(phrase('confirm'), $message . '<p><input type="button" name="confirm" value=" ' . phrase('yes') . ' " onclick="window.location = \'' . $location . '\';" />');
131 $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>";
133 if (!defined('HIDE_SETUP'))
135 echo "\n<!-- page end -->\n</div>\n$copyright";
139 echo "\n
<!-- page end
-->\n</div
>";
142 echo "\n\n
</body
>\n</html
>";
147 // ###################################################################
148 // ##################### TABLE SKELETON RENDERING ####################
149 // ###################################################################
150 function table_start($break = true, $width = '90%')
157 echo "\n
<table cellpadding
=\"4\" cellspacing
=\"0\" border
=\"0\" align
=\"center\" width
=\"$width\" class=\"tborder\"
>\n";
160 function table_head($title, $colspan = 2, $strong = true)
162 echo "<tr
>\n\t<td
class=\"tcat\" align
=\"center\" colspan
=\"$colspan\">" . (($strong) ? "<strong
>$title</strong
>" : $title) . "</td
>\n</tr
>\n";
165 function table_column_head($columnarray)
167 if (is_array($columnarray))
169 $render = "<tr valign
=\"top\" align
=\"center\"
>\n";
171 foreach ($columnarray AS $header)
173 $render .= "\t
<td
class=\"thead\" align
=\"center\"
>$header</td
>\n";
176 $render .= "</tr
>\n";
187 // ###################################################################
188 // ########################## FORM CREATION ##########################
189 // ###################################################################
190 function form_start($action, $do, $enctype = false, $name = 'inputform', $submitmethod = 'post')
192 echo "\n
<!-- input form
-->\n<form name
=\"$name\" action
=\"$action\"" . (($enctype) ? " enctype
=\"$enctype\"" : '') . " method
=\"$submitmethod\">\n";
193 $this->form_hidden_field('do', $do);
196 function form_hidden_field($name, $value)
198 echo "<input type
=\"hidden\" name
=\"$name\" value
=\"$value\" />\n";
203 echo "</form
>\n<!-- / input form
-->\n";
206 // ###################################################################
207 // ####################### TABLE ROW RENDERING #######################
208 // ###################################################################
209 function row_span($text, $class = ':swap:', $align = 'left', $colspan = 2)
212 if ($class === ':swap:')
214 $bugsys->funct->exec_swap_bg();
215 $row_class = $bugsys->funct->bgcolour;
216 $is_style_element = false;
220 if (preg_match('#:style:(.*?)#i', $class))
222 $is_style_element = true;
223 $style = str_replace(':style:', '', $class);
228 $is_style_element = false;
232 echo "<tr
>\n\t<td
". (($is_style_element) ? "style
=\"$style\"" : "class=\"$row_class\"") . " colspan
=\"$colspan\" align
=\"$align\">$text</td
>\n</tr
>";
235 function row_multi_item($row_array)
238 $bugsys->funct->exec_swap_bg();
240 foreach ($row_array AS $item => $align)
242 $row_data["$align"][] = $item;
245 echo "<tr valign=\"top\">";
247 foreach ($row_data AS $align_key => $item_array)
249 if ($align_key == 'c')
253 else if ($align_key == 'l')
257 else if ($align_key == 'r')
262 foreach ($item_array AS $value)
264 echo "\n\t<td class=\"{$bugsys->funct->bgcolour}\" align=\"$align\">$value</td>";
271 function row_text($label, $value = ' ', $valign = 'top', $colspan = 2, $class = -1)
273 global $bugsys, $IS_SETTINGS;
279 $bugsys->funct
->exec_swap_bg();
280 $row_class = $bugsys->funct
->bgcolour
;
292 echo "<tr valign=\"$valign\">";
293 echo "\n\t<td class=\"$row_class\">$label</td>";
294 echo "\n\t<td class=\"$row_class\">$value</td>";
298 echo "\n\t<td class=\"$row_class\" colspan=\"" . $colspan - 2 . "\"> </td>";
304 function row_input($label, $name, $value = '', $colspan = 2, $size = 35, $length = false, $password = false, $lalign = 'top')
306 $this->row_text($label, "<input type=\"" . (($password) ? 'password' : 'text') . "\" class=\"input\" name=\"$name\" value=\"$value\" size=\"$size\" " . (($length) ? "maxlength=\"$length\" " : '') . "/>", $lalign, $colspan);
309 function row_textarea($label, $name, $value = '', $colspan = 2, $rows = 7, $cols = 50, $code = false, $style = '')
311 $this->row_text($label, "<textarea name=\"$name\" class=\"" . (($code) ? 'code' : 'input') . "\" rows=\"$rows\" cols=\"$cols\"" . (($style) ? ' style="' . $style . '"' : '') . ">$value</textarea>", 'top', $colspan);
314 function row_tfoot($data, $colspan = 2)
316 echo $this->row_span($data, 'tfoot', 'center');
319 function row_submit($extra = false, $submit = ':save:', $reset = ':reset:', $colspan = 2)
321 if ($submit === ':save:')
323 $submit = " " . phrase('submit') . " ";
327 $submit = " $submit ";
330 if ($reset === ':reset:')
332 $reset = " " . phrase('reset') . " ";
336 $reset = (($reset) ? " $reset " : '');
339 $output = "\n\t\t<input type=\"submit\" class=\"button\" value=\"$submit\" accesskey=\"s\" />";
340 $output .= (($reset) ? "\n\t\t<input type=\"reset\" class=\"button\" value=\"$reset\" accesskey=\"r\" /> $extra\n\t" : '');
341 $this->row_tfoot($output);
344 function row_upload($label, $name, $colspan = 2)
346 $this->row_text($label, "<input type=\"file\" class=\"button\" name=\"$name\" size=\"35\" />", 'top', $colspan);
349 function list_item($name, $value, $selected = false)
353 $listitem[] = "\n\t<option value=\"$value\"" . (($selected == true) ? ' selected="selected"' : '') . ">$name</option>";
356 function row_list($label, $name, $is_jump = true, $colspan = 2)
360 foreach ($listitem AS $option)
362 $optionlist .= $option;
367 $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=\" " . phrase('go') . " \" accesskey=\"g\" />" : '') . "\n", $colspan);
370 function row_yesno($label, $name, $value, $colspan = 2)
372 $this->row_text($label, "<input type=\"radio\" name=\"$name\" value=\"1\"" . (($value) ? ' checked="checked"' : '') . " /> " . phrase('yes') . " <input type=\"radio\" name=\"$name\" value=\"0\"" . ((!$value) ? ' checked="checked"' : '') . " /> " . phrase('no'), $colspan);
376 /*=====================================================================*\
377 || ###################################################################
380 || ###################################################################
381 \*=====================================================================*/