]>
src.bluestatic.org Git - bugdar.git/blob - admin/status.php
2 /*=====================================================================*\
3 || ###################################################################
5 || # Copyright ©2002-2007 Blue Static
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 2 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 require_once ( './global.php' );
23 require_once ( './includes/api_status.php' );
25 APIError ( array ( new API_Error_Handler ( $admin ), 'admin_error' ));
27 NavLinks
:: fieldsPages ();
28 $navigator- > set_focus ( 'tab' , 'fields' , null );
30 if (! can_perform ( 'canadminfields' ))
35 // ###################################################################
37 if ( empty ( $_REQUEST [ 'do' ]))
39 $_REQUEST [ 'do' ] = 'modify' ;
42 // ###################################################################
44 if ( $_REQUEST [ 'do' ] == 'kill' )
46 $status = new StatusAPI ();
47 $status- > set ( 'statusid' , $input- > in
[ 'statusid' ]);
48 $status- > set_condition ();
51 $admin- > redirect ( 'status.php?do=modify' );
54 // ###################################################################
56 if ( $_REQUEST [ 'do' ] == 'delete' )
58 $admin- > page_confirm ( T ( 'Are you sure you want to delete this status? Doing so will revert all bugs to the default status (which is set in the options panel)?' ), 'status.php' , 'kill' , array ( 'statusid' => $input- > inputClean ( 'statusid' , TYPE_UINT
)));
61 // ###################################################################
63 if ( $_POST [ 'do' ] == 'insert' )
65 $status = new StatusAPI ();
66 $status- > set ( 'status' , $input- > in
[ 'status' ]);
67 $status- > set ( 'color' , $input- > in
[ 'color' ]);
68 $status- > set ( 'displayorder' , $input- > in
[ 'displayorder' ]);
71 $admin- > redirect ( 'status.php?do=modify' );
74 // ###################################################################
76 if ( $_REQUEST [ 'do' ] == 'add' )
78 NavLinks
:: statusesAdd ();
79 $navigator- > set_focus ( 'link' , 'statuses-add' , 'statuses' );
81 $admin- > page_start ( T ( 'Add New Status' ));
83 $admin- > form_start ( 'status.php' , 'insert' );
84 $admin- > table_start ();
85 $admin- > table_head ( T ( 'New Status' ));
86 $admin- > row_input ( T ( 'Status Title<div><dfn>The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)</dfn></div>' ), 'status' );
87 $admin- > row_input ( T ( 'Display Order<div><dfn>The order in which the statuses ar displayed.</dfn></div>' ), 'displayorder' );
88 $admin- > row_input ( T ( 'Status Color<div><dfn>The color of the status. This will be displayed on bug listings page to make viewing easier. Note: you must enter the # sign if you are using HEX values.</dfn></div>' ), 'color' );
96 // ###################################################################
98 if ( $_POST [ 'do' ] == 'update' )
100 $status = new StatusAPI ();
101 $status- > set ( 'statusid' , $input- > in
[ 'statusid' ]);
102 $status- > set_condition ();
103 $status- > set ( 'status' , $input- > in
[ 'status' ]);
104 $status- > set ( 'color' , $input- > in
[ 'color' ]);
105 $status- > set ( 'displayorder' , $input- > in
[ 'displayorder' ]);
108 $admin- > redirect ( 'status.php?do=modify' );
111 // ###################################################################
113 if ( $_REQUEST [ 'do' ] == 'edit' )
115 NavLinks
:: statusesEdit ( $input- > in
[ 'statusid' ]);
116 $navigator- > set_focus ( 'link' , 'fields-pages-statuses' , 'fields-pages' );
118 $status = new StatusAPI ();
119 $status- > set ( 'statusid' , $input- > in
[ 'statusid' ]);
120 $status- > set_condition ();
123 $admin- > page_start ( T ( 'Edit Status' ));
125 $admin- > form_start ( 'status.php' , 'update' );
126 $admin- > form_hidden_field ( 'statusid' , $status- > record
[ 'statusid' ]);
127 $admin- > table_start ();
128 $admin- > table_head ( sprintf ( T ( 'Edit Status - %1 $s (id: %2 $s )' ), $status- > record
[ 'status' ], $status- > record
[ 'statusid' ]));
129 $admin- > row_input ( T ( 'Status Title<div><dfn>The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)</dfn></div>' ), 'status' , $status- > record
[ 'status' ]);
130 $admin- > row_input ( T ( 'Display Order<div><dfn>The order in which the statuses ar displayed.</dfn></div>' ), 'displayorder' , $status- > record
[ 'displayorder' ]);
131 $admin- > row_input ( T ( 'Status Color<div><dfn>The color of the status. This will be displayed on bug listings page to make viewing easier. Note: you must enter the # sign if you are using HEX values.</dfn></div>' ), 'color' , $status- > record
[ 'color' ]);
132 $admin- > row_submit ();
139 // ###################################################################
141 if ( $_REQUEST [ 'do' ] == 'modify' )
143 NavLinks
:: statusesAdd ();
144 $navigator- > set_focus ( 'link' , 'fields-pages-statuses' , 'fields-pages' );
146 $admin- > page_start ( T ( 'Status Manager' ));
148 $statuses = $db- > query ( "SELECT * FROM " . TABLE_PREFIX
. "status" );
150 $admin- > table_start ();
151 $admin- > table_head ( T ( 'Status Manager' ));
153 foreach ( $statuses as $status )
155 $colorblock = '<span style="float: right"><div style="height: 12px; width: 12px; background-color: ' . $status [ 'color' ] . '; border: 1px black solid"></div></span>' ;
156 $admin- > row_text ( " $colorblock $status [displayorder]: <a href= \" status.php?do=edit&statusid= $status [statusid] \" > $status [status]</a>" , "(statusid: $status [statusid]) <a href= \" status.php?do=edit&statusid= $status [statusid] \" >[" . T ( 'Edit' ) . "]</a> <a href= \" status.php?do=delete&statusid= $status [statusid] \" >[" . T ( 'Delete' ) . "]</a>" );
158 $db- > free_result ( $statuses );
165 /*=====================================================================*\
166 || ###################################################################
169 || ###################################################################
170 \*=====================================================================*/