]>
src.bluestatic.org Git - isso.git/blob - printer.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Iris Studios Shared Object Framework [#]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 \*=====================================================================*/
32 * This framework generates standard HTML through various functions. The purpose
33 * is generally so that things like the admin system can be created without templates.
35 * @author Iris Studios, Inc.
36 * @copyright Copyright ©2002 - [#]year[#], Iris Studios, Inc.
43 function redirect ( $location , $timeout = 10 )
47 $timeout = $timeout * 200 ;
51 <script type="text/javascript">
53 var timeout = $timeout ;
57 setTimeout("redirect()", $timeout );
66 window.location = " $location" ;
72 $this- > page_start ( $bugsys- > lang
-> string ( 'Redirect' ), ':default:' , 15 , $js );
74 $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 ));
79 function error ( $message )
83 $this- > page_start ( $bugsys- > lang
-> string ( 'Error' ));
84 $this- > page_message ( $bugsys- > lang
-> string ( 'Error' ), $message );
90 // ###################################################################
91 // ########################### PAGE CONTROL ##########################
92 // ###################################################################
93 function page_start ( $actiontitle , $pageclass = ':default:' , $pagemargin = 15 , $extra = '' , $onload = false , $margin = 0 , $dotpath = '.' , $override = false )
97 if ( constant ( 'DONE_HEADER' ) AND ! $override )
102 $title = sprintf ( $bugsys- > lang
-> string ( 'BugStrike - Administration - %1 $s' ), $actiontitle );
104 echo "<!DOCTYPE html PUBLIC \" -//W3C//DTD XHTML 1.0 Transitional//EN \" \" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd \" > \n ";
105 echo "<html xmlns= \" http://www.w3.org/1999/xhtml \" > \n <head>";
106 echo " \n\t <title> $title </title>";
107 echo " \n\t <meta http-equiv= \" Content-Type \" content= \" text/html; charset=iso-8859-1 \" />";
108 echo " \n\t <link rel= \" stylesheet \" href= \" $dotpath /admin.css \" />" . (( $extra ) ? " \n $extra" : ' ');
109 echo " \n </head> \n <body style= \" margin: {$margin} px; \" " . (( $pageclass !== ' : default : ') ? " class= \" $pageclass\" " : ' ') . (( $onload ) ? " onload= \" $onload\" " : ' ') . "> \n ";
111 if (!defined(' HIDE_SETUP
') AND $bugsys- >userinfo[' adminsession
'])
115 $location = parse_url( $_SERVER [' SCRIPT_URL
']);
116 $location [' path
'] = preg_quote(end(explode(' / ', $location [' path
'])));
117 $location [' path
'] = ((! $location [' path
']) ? ' index
. php
' : $location [' path
']);
119 echo "<div class= \" tcat \" style= \" padding: 5px; border-bottom: 4px outset \" > \n ";
120 echo " \n\t <form action= \" jump.php \" method= \" post \" title= \" navigation \" style= \" display: inline \" >";
121 echo " \n\t <span style= \" float: right \" ><a href= \" ../ \" >" . $bugsys- >lang->string(' Tracker Home
') . "</a></span>";
122 echo " \n\t\t " . $bugsys- >lang->string(' Navigation
') . ": <select name= \" jumplocation \" onchange= \" this.form.submit() \" >";
123 foreach ( $globalnav AS $grouptitle => $links )
125 echo " \n\t\t <optgroup label= \" $grouptitle\" >";
126 foreach ( $links AS $title => $url )
128 $selected = ((preg_match("# $location [path]$#i", $url )) ? ' selected
= "selected" ' : ' ');
129 echo " \n\t\t\t <option value= \" $url\" $selected > $title </option>";
131 echo " \n\t\t </optgroup>";
133 echo " \n\t\t </select>";
134 echo " \n\t\t <input type= \" submit \" name= \" go \" value= \" " . $bugsys- >lang->string(' Go
') . " \" />";
139 echo "<div style= \" margin: {$pagemargin} px; \" > \n <!-- / page head --> \n\n ";
141 if (!defined(' DONE_HEADER
'))
143 define(' DONE_HEADER
', 1);
147 function page_code( $code )
149 echo " \n\n $code\n\n ";
152 function page_message( $title , $message )
154 $this- >table_start(true, ' 75 %
');
155 $this- >table_head( $title , 1);
156 $this- >row_span("<blockquote> $message </blockquote>", ' : swap
: ', ' left
', 1);
160 function page_confirm( $message , $location )
164 $this- >page_start( $bugsys- >lang->string(' Confirm
'));
166 $this- >page_message( $bugsys- >lang->string(' Confirm
'), $message . ' < p
>< input type
= "button" name
= "confirm" value
= " ' . $bugsys- >lang->string('Yes') . ' " onclick
= "window.location = \' ' . $location . ' \' ;" /> ');
175 $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>";
177 if (!defined(' HIDE_SETUP
'))
179 echo " \n <!-- page end --> \n </div> \n $copyright" ;
183 echo " \n <!-- page end --> \n </div>";
186 echo " \n\n </body> \n </html>";
191 // ###################################################################
192 // ##################### TABLE SKELETON RENDERING ####################
193 // ###################################################################
194 function table_start( $break = true, $width = ' 90 %
')
201 echo " \n <table cellpadding= \" 4 \" cellspacing= \" 0 \" border= \" 0 \" align= \" center \" width= \" $width\" class= \" tborder \" > \n ";
204 function table_head( $title , $colspan = 2, $strong = true)
206 echo "<tr> \n\t <td class= \" tcat \" align= \" center \" colspan= \" $colspan\" >" . (( $strong ) ? "<strong> $title </strong>" : $title ) . "</td> \n </tr> \n ";
209 function table_column_head( $columnarray )
211 if (is_array( $columnarray ))
213 $render = "<tr valign= \" top \" align= \" center \" > \n ";
215 foreach ( $columnarray AS $header )
217 $render .= " \t <td class= \" thead \" align= \" center \" > $header </td> \n ";
220 $render .= "</tr> \n ";
231 // ###################################################################
232 // ########################## FORM CREATION ##########################
233 // ###################################################################
234 function form_start( $action , $do , $enctype = false, $name = ' inputform
', $submitmethod = ' post
')
236 echo " \n <!-- input form --> \n <form name= \" $name\" action= \" $action\" " . (( $enctype ) ? " enctype= \" $enctype\" " : ' ') . " method= \" $submitmethod\" > \n ";
237 $this- >form_hidden_field(' do ', $do );
240 function form_hidden_field( $name , $value )
242 echo "<input type= \" hidden \" name= \" $name\" value= \" $value\" /> \n ";
247 echo "</form> \n <!-- / input form --> \n ";
250 // ###################################################################
251 // ####################### TABLE ROW RENDERING #######################
252 // ###################################################################
253 function row_span( $text , $class = ' : swap
: ', $align = ' left
', $colspan = 2)
256 if ( $class === ' : swap
: ')
258 $bugsys- >funct->exec_swap_bg();
259 $row_class = $bugsys- >funct->bgcolour;
260 $is_style_element = false;
264 if (preg_match(' #:style:(.*?)#i', $class))
266 $is_style_element = true ;
267 $style = str_replace ( ':style:' , '' , $class );
272 $is_style_element = false ;
276 echo "<tr> \n\t <td " . (( $is_style_element ) ? "style= \" $style\" " : "class= \" $row_class\" " ) . " colspan= \" $colspan\" align= \" $align\" > $text </td> \n </tr>" ;
279 function row_multi_item ( $row_array )
282 $bugsys- > funct
-> exec_swap_bg ();
284 foreach ( $row_array AS $item => $align )
286 $row_data [ " $align" ][] = $item ;
289 echo " < tr valign
=\" top\"
> ";
291 foreach ( $row_data AS $align_key => $item_array )
293 if ( $align_key == 'c')
297 else if ( $align_key == 'l')
301 else if ( $align_key == 'r')
306 foreach ( $item_array AS $value )
308 echo " \n\t
< td
class =\"{ $bugsys
-> funct
-> bgcolour
}\" align
=\" $align\" > $value </ td
> ";
315 function row_text( $label , $value = ' ', $valign = 'top', $colspan = 2, $class = -1)
317 global $bugsys , $IS_SETTINGS ;
323 $bugsys- >funct->exec_swap_bg();
324 $row_class = $bugsys- >funct->bgcolour;
336 echo " < tr valign
=\" $valign\" > ";
337 echo " \n\t
< td
class =\" $row_class\" > $label </ td
> ";
338 echo " \n\t
< td
class =\" $row_class\" > $value </ td
> ";
342 echo " \n\t
< td
class =\" $row_class\" colspan
=\" " . $colspan - 2 . " \"
>& nbsp
;</ td
> ";
348 function row_input( $label , $name , $value = '', $colspan = 2, $size = 35, $length = false, $password = false, $lalign = 'top')
350 $this- >row_text( $label , " < input type
=\" " . (( $password ) ? 'password' : 'text') . " \"
class =\" input\" name
=\" $name\" value
=\" $value\" size
=\" $size\" " . (( $length ) ? " maxlength
=\" $length\" " : '') . " /> ", $lalign , $colspan );
353 function row_textarea( $label , $name , $value = '', $colspan = 2, $rows = 7, $cols = 50, $code = false, $style = '')
355 $this- >row_text( $label , " < textarea name
=\" $name\" class =\" " . (( $code ) ? 'code' : 'input') . " \" rows
=\" $rows\" cols
=\" $cols\" " . (( $style ) ? ' style=" ' . $style . ' "' : '') . " > $value </ textarea
> ", 'top', $colspan );
358 function row_tfoot( $data , $colspan = 2)
360 echo $this- >row_span( $data , 'tfoot', 'center');
363 function row_submit( $extra = false, $submit = ':save:', $reset = ':reset:', $colspan = 2)
367 if ( $submit === ':save:')
369 $submit = " " . $bugsys- >lang->string('Submit') . " ";
373 $submit = " $submit ";
376 if ( $reset === ':reset:')
378 $reset = " " . $bugsys- >lang->string('Reset') . " ";
382 $reset = (( $reset ) ? " $reset " : '');
385 $output = " \n\t\t
< input type
=\" submit\"
class =\" button\" value
=\" $submit\" accesskey
=\" s\"
/> ";
386 $output .= (( $reset ) ? " \n\t\t
< input type
=\" reset\"
class =\" button\" value
=\" $reset\" accesskey
=\" r\"
/> $extra\n\t " : '');
387 $this- >row_tfoot( $output );
390 function row_upload( $label , $name , $colspan = 2)
392 $this- >row_text( $label , " < input type
=\" file\"
class =\" button\" name
=\" $name\" size
=\" 35\" /> ", 'top', $colspan );
395 function list_item( $name , $value , $selected = false)
399 $listitem [] = " \n\t
< option value
=\" $value\" " . (( $selected == true) ? ' selected=" selected
"' : '') . " > $name </ option
> ";
402 function row_list( $label , $name , $is_jump = false, $colspan = 2)
406 foreach ( $listitem AS $option )
408 $optionlist .= $option ;
413 $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
=\" " . $bugsys- >lang->string('Go') . " \" accesskey
=\" g\"
/> " : '') . " \n
", $colspan );
416 function row_yesno( $label , $name , $value , $colspan = 2)
420 $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 );
424 /*=====================================================================*\
425 || ###################################################################
428 || ###################################################################
429 \*=====================================================================*/