]>
src.bluestatic.org Git - bugdar.git/blob - adminfunctions.php
3bdc1ae7b9a3298c8611e9c04d7fbaf9b176cd99
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # Renapsus [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # All parts of this file are ©2003-[#]year[#] Iris Studios, Inc. No # ||
7 || # part of this file may be reproduced in any way: part or whole. # ||
8 || # --------------------------------------------------------------- # ||
9 || # ©2003 - [#]year[#] Iris Studios, Inc. | http://www.iris-studios.com # ||
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 = 'Renapsus - ' . 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\" />" . iff($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
;\"" . iff($pageclass !== ':default:', " class=\"$pageclass\"") . iff($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\">Renapsus " . $bugsys->options['trackerversion'] . ", © 2003 - " . 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\">" . iff($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\"" . iff($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)
185 if ($class === ':swap:')
189 $is_style_element = false;
193 if (preg_match('#:style:(.*?)#i', $class))
195 $is_style_element = true;
196 $style = str_replace(':style:', '', $class);
201 $is_style_element = false;
205 echo "<tr
>\r\t<td
". iff($is_style_element, "style
=\"$style\"", "class=\"$row_class\"") . " colspan
=\"$colspan\" align
=\"$align\">$text</td
>\r</tr
>";
208 function row_multi_item($row_array)
213 foreach ($row_array AS $item => $align)
215 $row_data["$align"][] = $item;
218 echo "<tr valign=\"top\">";
220 foreach ($row_data AS $align_key => $item_array)
222 if ($align_key == 'c')
226 else if ($align_key == 'l')
230 else if ($align_key == 'r')
235 foreach ($item_array AS $value)
237 echo "\r\t<td class=\"$row_class\" align=\"$align\">$value</td>";
244 function row_text($label, $value = ' ', $valign = 'top', $colspan = 2, $class = -1)
265 echo "<tr valign=\"$valign\">";
266 echo "\r\t<td class=\"$row_class\">$label</td>";
267 echo "\r\t<td class=\"$row_class\">$value</td>";
271 echo "\r\t<td class=\"$row_class\" 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=\"" . iff($password, 'password', 'text') . "\" class=\"input\" name=\"$name\" value=\"$value\" size=\"$size\" " . iff($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=\"" . iff($code, 'code', 'input') . "\" rows=\"$rows\" cols=\"$cols\"" . iff($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 = iff($reset, " $reset ");
312 $output = "\r\t\t<input type=\"submit\" class=\"button\" value=\"$submit\" accesskey=\"s\" />";
313 $output .= iff($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\"" . iff($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\"" . iff($is_jump, " onchange=\"this.form.submit();\"") . ">$optionlist\r</select>" . iff($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\"" . iff($value, ' checked="checked"') . " /> " . phrase('yes') . " <input type=\"radio\" name=\"$name\" value=\"0\"" . iff(!$value, ' checked="checked"') . " /> " . phrase('no'), $colspan);
349 /*=====================================================================*\
350 || ###################################################################
353 || ###################################################################
354 \*=====================================================================*/