]>
src.bluestatic.org Git - bugdar.git/blob - includes/adminfunctions.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] Iris Studios, Inc.
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
22 class Admin_Print_Class
24 function redirect ( $location , $timeout = 10 )
28 $timeout = $timeout * 200 ;
32 <script type="text/javascript">
34 var timeout = $timeout ;
38 setTimeout("redirect()", $timeout );
47 window.location = " $location" ;
53 $this- > page_start ( $bugsys- > lang
-> string ( 'Redirect' ), ':default:' , 15 , $js );
55 $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 ));
60 function error ( $message )
64 $this- > page_start ( $bugsys- > lang
-> string ( 'Error' ));
65 $this- > page_message ( $bugsys- > lang
-> string ( 'Error' ), $message );
71 // ###################################################################
72 // ########################### PAGE CONTROL ##########################
73 // ###################################################################
74 function page_start ( $actiontitle , $pageclass = ':default:' , $pagemargin = 15 , $extra = '' , $onload = false , $margin = 0 , $dotpath = '.' , $override = false )
78 if ( constant ( 'DONE_HEADER' ) AND ! $override )
83 $title = sprintf ( $bugsys- > lang
-> string ( 'Bugdar - Administration - %1 $s' ), $actiontitle );
85 echo "<!DOCTYPE html PUBLIC \" -//W3C//DTD XHTML 1.0 Transitional//EN \" \" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd \" > \n ";
86 echo "<html xmlns= \" http://www.w3.org/1999/xhtml \" > \n <head>";
87 echo " \n\t <title> $title </title>";
88 echo " \n\t <meta http-equiv= \" Content-Type \" content= \" text/html; charset=utf-8 \" />";
89 echo " \n\t <link rel= \" stylesheet \" href= \" $dotpath /admin.css \" />" . (( $extra ) ? " \n $extra" : ' ');
90 echo " \n </head> \n <body style= \" margin: {$margin} px; \" " . (( $pageclass !== ' : default : ') ? " class= \" $pageclass\" " : ' ') . (( $onload ) ? " onload= \" $onload\" " : ' ') . "> \n ";
92 if (!defined(' HIDE_SETUP
') AND $bugsys- >userinfo[' adminsession
'])
96 $location = parse_url( $_SERVER [' SCRIPT_URL
']);
97 $location [' path
'] = preg_quote(end(explode(' / ', $location [' path
'])));
98 $location [' path
'] = ((! $location [' path
']) ? ' index
. php
' : $location [' path
']);
100 echo "<div class= \" tcat \" style= \" padding: 5px; border-bottom: 4px outset \" > \n ";
101 echo " \n\t <form action= \" jump.php \" method= \" post \" title= \" navigation \" style= \" display: inline \" >";
102 echo " \n\t <span style= \" float: right \" ><a href= \" ../ \" >" . $bugsys- >lang->string(' Tracker Home
') . "</a></span>";
103 echo " \n\t\t " . $bugsys- >lang->string(' Navigation
') . ": <select name= \" jumplocation \" onchange= \" this.form.submit() \" class= \" input \" >";
104 foreach ( $globalnav AS $grouptitle => $links )
106 echo " \n\t\t <optgroup label= \" $grouptitle\" >";
107 foreach ( $links AS $title => $url )
109 $selected = ((preg_match("# $location [path]$#i", $url )) ? ' selected
= "selected" ' : ' ');
110 echo " \n\t\t\t <option value= \" $url\" $selected > $title </option>";
112 echo " \n\t\t </optgroup>";
114 echo " \n\t\t </select>";
115 echo " \n\t\t <input type= \" submit \" name= \" go \" value= \" " . $bugsys- >lang->string(' Go
') . " \" class= \" button \" />";
120 echo "<div style= \" margin: {$pagemargin} px; \" > \n <!-- / page head --> \n\n ";
122 if (!defined(' DONE_HEADER
'))
124 define(' DONE_HEADER
', 1);
128 function page_code( $code )
130 echo " \n\n $code\n\n ";
133 function page_message( $title , $message )
135 $this- >table_start(true, ' 75 %
');
136 $this- >table_head( $title , 1);
137 $this- >row_span("<blockquote> $message </blockquote>", ' : swap
: ', ' left
', 1);
141 function page_confirm( $message , $location )
145 $this- >page_start( $bugsys- >lang->string(' Confirm
'));
147 $this- >page_message( $bugsys- >lang->string(' Confirm
'), $message . ' < p
>< input type
= "button" name
= "confirm" value
= " ' . $bugsys- >lang->string('Yes') . ' " onclick
= "window.location = \' ' . $location . ' \' ;" /> ');
156 $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>";
158 if (!defined(' HIDE_SETUP
'))
160 echo " \n <!-- page end --> \n </div> \n $copyright" ;
164 echo " \n <!-- page end --> \n </div>";
167 echo " \n\n </body> \n </html>";
172 // ###################################################################
173 // ##################### TABLE SKELETON RENDERING ####################
174 // ###################################################################
175 function table_start( $break = true, $width = ' 90 %
')
182 echo " \n <table cellpadding= \" 4 \" cellspacing= \" 0 \" border= \" 0 \" align= \" center \" width= \" $width\" class= \" tborder \" > \n ";
185 function table_head( $title , $colspan = 2, $help = null)
188 $title = ( $help ? "<a href= \" http://www.iris-studios.com/support/bugdar/ $help .html \" target= \" _blank \" style= \" cursor: help; text-decoration: none \" > $title </a>" : $title );
189 $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>" : ' ');
190 echo "<tr> \n\t <td class= \" tcat \" align= \" center \" colspan= \" $colspan\" > $help <strong> $title </strong></td> \n </tr> \n ";
193 function table_column_head( $columnarray )
195 if (is_array( $columnarray ))
197 $render = "<tr valign= \" top \" align= \" center \" > \n ";
199 foreach ( $columnarray AS $header )
201 $render .= " \t <td class= \" thead \" align= \" center \" > $header </td> \n ";
204 $render .= "</tr> \n ";
215 // ###################################################################
216 // ########################## FORM CREATION ##########################
217 // ###################################################################
218 function form_start( $action , $do , $enctype = false, $name = ' inputform
', $submitmethod = ' post
')
220 echo " \n <!-- input form --> \n <form name= \" $name\" action= \" $action\" " . (( $enctype ) ? " enctype= \" $enctype\" " : ' ') . " method= \" $submitmethod\" > \n ";
221 $this- >form_hidden_field(' do ', $do );
224 function form_hidden_field( $name , $value )
226 echo "<input type= \" hidden \" name= \" $name\" value= \" $value\" /> \n ";
231 echo "</form> \n <!-- / input form --> \n ";
234 // ###################################################################
235 // ####################### TABLE ROW RENDERING #######################
236 // ###################################################################
237 function row_span( $text , $class = ' : swap
: ', $align = ' left
', $colspan = 2)
240 if ( $class === ' : swap
: ')
242 $bugsys- >funct->exec_swap_bg();
243 $row_class = $bugsys- >funct->bgcolour;
244 $is_style_element = false;
248 if (preg_match(' #:style:(.*?)#i', $class))
250 $is_style_element = true ;
251 $style = str_replace ( ':style:' , '' , $class );
256 $is_style_element = false ;
260 echo "<tr> \n\t <td " . (( $is_style_element ) ? "style= \" $style\" " : "class= \" $row_class\" " ) . " colspan= \" $colspan\" align= \" $align\" > $text </td> \n </tr>" ;
263 function row_multi_item ( $row_array )
266 $bugsys- > funct
-> exec_swap_bg ();
268 foreach ( $row_array AS $item => $align )
270 $row_data [ " $align" ][] = $item ;
273 echo " < tr valign
=\" top\"
> ";
275 foreach ( $row_data AS $align_key => $item_array )
277 if ( $align_key == 'c')
281 else if ( $align_key == 'l')
285 else if ( $align_key == 'r')
290 foreach ( $item_array AS $value )
292 echo " \n\t
< td
class =\"{ $bugsys
-> funct
-> bgcolour
}\" align
=\" $align\" > $value </ td
> ";
299 function row_text( $label , $value = ' ', $valign = 'top', $colspan = 2, $class = -1)
301 global $bugsys , $IS_SETTINGS ;
307 $bugsys- >funct->exec_swap_bg();
308 $row_class = $bugsys- >funct->bgcolour;
320 echo " < tr valign
=\" $valign\" > ";
321 echo " \n\t
< td
class =\" $row_class\" > $label </ td
> ";
322 echo " \n\t
< td
class =\" $row_class\" > $value </ td
> ";
326 echo " \n\t
< td
class =\" $row_class\" colspan
=\" " . $colspan - 2 . " \"
>& nbsp
;</ td
> ";
332 function row_input( $label , $name , $value = '', $colspan = 2, $size = 35, $length = false, $password = false, $lalign = 'top')
334 $this- >row_text( $label , " < input type
=\" " . (( $password ) ? 'password' : 'text') . " \"
class =\" input\" name
=\" $name\" value
=\" $value\" size
=\" $size\" " . (( $length ) ? " maxlength
=\" $length\" " : '') . " /> ", $lalign , $colspan );
337 function row_textarea( $label , $name , $value = '', $colspan = 2, $rows = 7, $cols = 50, $code = false, $style = '')
339 $this- >row_text( $label , " < textarea name
=\" $name\" class =\" " . (( $code ) ? 'code' : 'input') . " \" rows
=\" $rows\" cols
=\" $cols\" " . (( $style ) ? ' style=" ' . $style . ' "' : '') . " > $value </ textarea
> ", 'top', $colspan );
342 function row_tfoot( $data , $colspan = 2)
344 echo $this- >row_span( $data , 'tfoot', 'center');
347 function row_submit( $extra = false, $submit = ':save:', $reset = ':reset:', $colspan = 2)
351 if ( $submit === ':save:')
353 $submit = " " . $bugsys- >lang->string('Submit') . " ";
357 $submit = " $submit ";
360 if ( $reset === ':reset:')
362 $reset = " " . $bugsys- >lang->string('Reset') . " ";
366 $reset = (( $reset ) ? " $reset " : '');
369 $output = " \n\t\t
< input type
=\" submit\"
class =\" button\" value
=\" $submit\" accesskey
=\" s\"
/> ";
370 $output .= (( $reset ) ? " \n\t\t
< input type
=\" reset\"
class =\" button\" value
=\" $reset\" accesskey
=\" r\"
/> $extra\n\t " : $extra );
371 $this- >row_tfoot( $output );
374 function row_upload( $label , $name , $colspan = 2)
376 $this- >row_text( $label , " < input type
=\" file\"
class =\" button\" name
=\" $name\" size
=\" 35\" /> ", 'top', $colspan );
379 function list_item( $name , $value , $selected = false)
383 $listitem [] = " \n\t
< option value
=\" $value\" " . (( $selected == true) ? ' selected=" selected
"' : '') . " > $name </ option
> ";
386 function row_list( $label , $name , $is_jump = false, $colspan = 2)
390 foreach ( $listitem AS $option )
392 $optionlist .= $option ;
397 $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 );
400 function row_yesno( $label , $name , $value , $colspan = 2)
404 $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 );
408 /*=====================================================================*\
409 || ###################################################################
412 || ###################################################################
413 \*=====================================================================*/