]>
src.bluestatic.org Git - bugdar.git/blob - adminfunctions.php
ef25a7becdf288393ccc89db28c5559463b32a58
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 = '.')
63 $title = 'BugStrike - ' . phrase('administration_x', $actiontitle);
65 echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r";
66 echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\r<head>";
67 echo "\r\t<title>$title</title>";
68 echo "\r\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />";
69 echo "\r\t<link rel=\"stylesheet\" href=\"$dotpath/admin.css\" />" . (($extra) ? "\r$extra" : '');
70 if (!defined('HIDE_SETUP'))
72 echo "\r\t
<script type
=\"text
/javascript\"
> parent
.document
.title
= \"$title\"; </script
>";
74 echo "\r
</head
>\r<body style
=\"margin
: {$margin
}px
;\"" . (($pageclass !== ':default:') ? " class=\"$pageclass\"" : '') . (($onload) ? " onload
=\"$onload\"" : '') . ">\r";
76 echo "<div style
=\"margin
: {$pagemargin
}px
;\">\r<!-- / page head
-->\r\r";
79 function page_code($code)
84 function page_message($title, $message)
86 $this->table_start(true, '75%');
87 $this->table_head($title, 1);
88 $this->row_span("<blockquote
>$message</blockquote
>", ':swap:', 'left', 1);
92 function page_confirm($message, $location)
94 $this->page_start(phrase('confirm'));
96 $this->page_message(phrase('confirm'), $message . '<p><input type="button
" name="confirm
" value=" ' . phrase('yes
') . ' " onclick="window
.location
= \'' . $location . '\'
;" />');
105 $copyright = "\r
<br
/>\r<p align
=\"center\"
class=\"copyright\"
>\r\t<a href
=\"http
://www.iris-studios.com\" target=\"_blank\">BugStrike " . $bugsys->options['trackerversion'] . ", © 2002 - " . date('Y') . " Iris Studios, Inc.</a>\r</p>";
107 if (!defined('HIDE_SETUP'))
109 echo "\r<!-- page end -->\r</div>\r$copyright";
113 echo "\r
<!-- page end
-->\r</div
>";
116 echo "\r\r
</body
>\r</html
>";
121 // ###################################################################
122 // ##################### TABLE SKELETON RENDERING ####################
123 // ###################################################################
124 function table_start($break = true, $width = '90%')
131 echo "\r
<table cellpadding
=\"4\" cellspacing
=\"0\" border
=\"0\" align
=\"center\" width
=\"$width\" class=\"tborder\"
>\r";
134 function table_head($title, $colspan = 2, $strong = true)
136 echo "<tr
>\r\t<td
class=\"tcat\" align
=\"center\" colspan
=\"$colspan\">" . (($strong) ? "<strong
>$title</strong
>" : $title) . "</td
>\r</tr
>\r";
139 function table_column_head($columnarray)
141 if (is_array($columnarray))
143 $render = "<tr valign
=\"top\" align
=\"center\"
>\r";
145 foreach ($columnarray AS $header)
147 $render .= "\t
<td
class=\"thead\" align
=\"center\"
>$header</td
>\r";
150 $render .= "</tr
>\r";
161 // ###################################################################
162 // ########################## FORM CREATION ##########################
163 // ###################################################################
164 function form_start($action, $do, $enctype = false, $name = 'inputform', $submitmethod = 'post')
166 echo "\r
<!-- input form
-->\r<form name
=\"$name\" action
=\"$action\"" . (($enctype) ? " enctype
=\"$enctype\"" : '') . " method
=\"$submitmethod\">\r";
167 $this->form_hidden_field('do', $do);
170 function form_hidden_field($name, $value)
172 echo "<input type
=\"hidden\" name
=\"$name\" value
=\"$value\" />\r";
177 echo "</form
>\r<!-- / input form
-->\r";
180 // ###################################################################
181 // ####################### TABLE ROW RENDERING #######################
182 // ###################################################################
183 function row_span($text, $class = ':swap:', $align = 'left', $colspan = 2)
186 if ($class === ':swap:')
188 $bugsys->funt->exec_swap_bg();
189 $row_class = $bugsys->funct->bgcolour;
190 $is_style_element = false;
194 if (preg_match('#:style:(.*?)#i', $class))
196 $is_style_element = true;
197 $style = str_replace(':style:', '', $class);
202 $is_style_element = false;
206 echo "<tr
>\r\t<td
". (($is_style_element) ? "style
=\"$style\"" : "class=\"$row_class\"") . " colspan
=\"$colspan\" align
=\"$align\">$text</td
>\r</tr
>";
209 function row_multi_item($row_array)
212 $bugsys->funct->exec_swap_bg();
214 foreach ($row_array AS $item => $align)
216 $row_data["$align"][] = $item;
219 echo "<tr valign=\"top\">";
221 foreach ($row_data AS $align_key => $item_array)
223 if ($align_key == 'c')
227 else if ($align_key == 'l')
231 else if ($align_key == 'r')
236 foreach ($item_array AS $value)
238 echo "\r\t<td class=\"{$bugsys->funct->bgcolour}\" align=\"$align\">$value</td>";
245 function row_text($label, $value = ' ', $valign = 'top', $colspan = 2, $class = -1)
247 global $bugsys, $IS_SETTINGS;
253 $bugsys->funct
->exec_swap_bg();
265 echo "<tr valign=\"$valign\">";
266 echo "\r\t<td class=\"{$bugsys->funct->bgcolour}\">$label</td>";
267 echo "\r\t<td class=\"{$bugsys->funct->bgcolour}\">$value</td>";
271 echo "\r\t<td class=\"{$bugsys->funct->bgcolour}\" colspan=\"" . $colspan - 2 . "\"> </td>";
277 function row_input($label, $name, $value = '', $colspan = 2, $size = 35, $length = false, $password = false, $lalign = 'top')
279 $this->row_text($label, "<input type=\"" . (($password) ? 'password' : 'text') . "\" class=\"input\" name=\"$name\" value=\"$value\" size=\"$size\" " . (($length) ? "maxlength=\"$length\" " : '') . "/>", $lalign, $colspan);
282 function row_textarea($label, $name, $value = '', $colspan = 2, $rows = 7, $cols = 50, $code = false, $style = '')
284 $this->row_text($label, "<textarea name=\"$name\" class=\"" . (($code) ? 'code' : 'input') . "\" rows=\"$rows\" cols=\"$cols\"" . (($style) ? ' style="' . $style . '"' : '') . ">$value</textarea>", 'top', $colspan);
287 function row_tfoot($data, $colspan = 2)
289 echo $this->row_span($data, 'tfoot', 'center');
292 function row_submit($extra = false, $submit = ':save:', $reset = ':reset:', $colspan = 2)
294 if ($submit === ':save:')
296 $submit = " " . phrase('submit') . " ";
300 $submit = " $submit ";
303 if ($reset === ':reset:')
305 $reset = " " . phrase('reset') . " ";
309 $reset = (($reset) ? " $reset " : '');
312 $output = "\r\t\t<input type=\"submit\" class=\"button\" value=\"$submit\" accesskey=\"s\" />";
313 $output .= (($reset) ? "\r\t\t<input type=\"reset\" class=\"button\" value=\"$reset\" accesskey=\"r\" /> $extra\r\t" : '');
314 $this->row_tfoot($output);
317 function row_upload($label, $name, $colspan = 2)
319 $this->row_text($label, "<input type=\"file\" class=\"button\" name=\"$name\" size=\"35\" />", 'top', $colspan);
322 function list_item($name, $value, $selected = false)
326 $listitem[] = "\r\t<option value=\"$value\"" . (($selected == true) ? ' selected="selected"' : '') . ">$name</option>";
329 function row_list($label, $name, $is_jump = true, $colspan = 2)
333 foreach ($listitem AS $option)
335 $optionlist .= $option;
340 $this->row_text($label, "\r<select class=\"button\" name=\"$name\"" . (($is_jump) ? " onchange=\"this.form.submit();\"" : '') . ">$optionlist\r</select>" . (($is_jump) ? "\r<input type=\"submit\" class=\"button\" value=\" " . phrase('go') . " \" accesskey=\"g\" />" : '') . "\r", $colspan);
343 function row_yesno($label, $name, $value, $colspan = 2)
345 $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);
349 /*=====================================================================*\
350 || ###################################################################
353 || ###################################################################
354 \*=====================================================================*/