]>
src.bluestatic.org Git - bugdar.git/blob - admin/status.php
2 /*=====================================================================*\
3 || ###################################################################
4 || # Bugdar [#]version[#]
5 || # Copyright ©2002-[#]year[#] 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 [#]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 require_once ( './global.php' );
23 require_once ( './includes/api_status.php' );
25 require_once ( './includes/class_api_error.php' );
26 APIError ( array ( new API_Error_Handler ( $admin ), 'admin_error' ));
28 NavLinks
:: fieldsPages ();
29 $navigator- > set_focus ( 'tab' , 'fields' , null );
31 if (! can_perform ( 'canadminfields' ))
36 // ###################################################################
38 if ( empty ( $_REQUEST [ 'do' ]))
40 $_REQUEST [ 'do' ] = 'modify' ;
43 // ###################################################################
45 if ( $_REQUEST [ 'do' ] == 'kill' )
47 $status = new StatusAPI ( $bugsys );
48 $status- > set ( 'statusid' , $bugsys- > in
[ 'statusid' ]);
49 $status- > set_condition ();
52 $admin- > redirect ( 'status.php?do=modify' );
55 // ###################################################################
57 if ( $_REQUEST [ 'do' ] == 'delete' )
59 $admin- > page_confirm ( _ ( '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' => $bugsys- > input_clean ( 'statusid' , TYPE_UINT
)));
62 // ###################################################################
64 if ( $_POST [ 'do' ] == 'insert' )
66 $status = new StatusAPI ( $bugsys );
67 $status- > set ( 'status' , $bugsys- > in
[ 'status' ]);
68 $status- > set ( 'color' , $bugsys- > in
[ 'color' ]);
69 $status- > set ( 'displayorder' , $bugsys- > in
[ 'displayorder' ]);
72 $admin- > redirect ( 'status.php?do=modify' );
75 // ###################################################################
77 if ( $_REQUEST [ 'do' ] == 'add' )
79 NavLinks
:: statusesAdd ();
80 $navigator- > set_focus ( 'link' , 'statuses-add' , 'statuses' );
82 $admin- > page_start ( _ ( 'Add New Status' ));
84 $admin- > form_start ( 'status.php' , 'insert' );
85 $admin- > table_start ();
86 $admin- > table_head ( _ ( 'New Status' ));
87 $admin- > row_input ( _ ( 'Status Title<div><dfn>The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)</dfn></div>' ), 'status' );
88 $admin- > row_input ( _ ( 'Display Order<div><dfn>The order in which the statuses ar displayed.</dfn></div>' ), 'displayorder' );
89 $admin- > row_input ( _ ( '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' );
97 // ###################################################################
99 if ( $_POST [ 'do' ] == 'update' )
101 $status = new StatusAPI ( $bugsys );
102 $status- > set ( 'statusid' , $bugsys- > in
[ 'statusid' ]);
103 $status- > set_condition ();
104 $status- > set ( 'status' , $bugsys- > in
[ 'status' ]);
105 $status- > set ( 'color' , $bugsys- > in
[ 'color' ]);
106 $status- > set ( 'displayorder' , $bugsys- > in
[ 'displayorder' ]);
109 $admin- > redirect ( 'status.php?do=modify' );
112 // ###################################################################
114 if ( $_REQUEST [ 'do' ] == 'edit' )
116 NavLinks
:: statusesEdit ( $bugsys- > in
[ 'statusid' ]);
117 $navigator- > set_focus ( 'link' , 'fields-pages-statuses' , 'fields-pages' );
119 $status = new StatusAPI ( $bugsys );
120 $status- > set ( 'statusid' , $bugsys- > in
[ 'statusid' ]);
121 $status- > set_condition ();
124 $admin- > page_start ( _ ( 'Edit Status' ));
126 $admin- > form_start ( 'status.php' , 'update' );
127 $admin- > form_hidden_field ( 'statusid' , $status- > objdata
[ 'statusid' ]);
128 $admin- > table_start ();
129 $admin- > table_head ( sprintf ( _ ( 'Edit Status - %1 $s (id: %2 $s )' ), $status- > objdata
[ 'status' ], $status- > objdata
[ 'statusid' ]));
130 $admin- > row_input ( _ ( 'Status Title<div><dfn>The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)</dfn></div>' ), 'status' , $status- > objdata
[ 'status' ]);
131 $admin- > row_input ( _ ( 'Display Order<div><dfn>The order in which the statuses ar displayed.</dfn></div>' ), 'displayorder' , $status- > objdata
[ 'displayorder' ]);
132 $admin- > row_input ( _ ( '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- > objdata
[ 'color' ]);
133 $admin- > row_submit ();
140 // ###################################################################
142 if ( $_REQUEST [ 'do' ] == 'modify' )
144 NavLinks
:: statusesAdd ();
145 $navigator- > set_focus ( 'link' , 'fields-pages-statuses' , 'fields-pages' );
147 $admin- > page_start ( _ ( 'Status Manager' ));
149 $statuses = $db- > query ( "SELECT * FROM " . TABLE_PREFIX
. "status" );
151 $admin- > table_start ();
152 $admin- > table_head ( _ ( 'Status Manager' ));
154 while ( $status = $db- > fetch_array ( $statuses ))
156 $colorblock = '<span style="float: right"><div style="height: 12px; width: 12px; background-color: ' . $status [ 'color' ] . '; border: 1px black solid"></div></span>' ;
157 $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] \" >[" . _ ( 'Edit' ) . "]</a> <a href= \" status.php?do=delete&statusid= $status [statusid] \" >[" . _ ( 'Delete' ) . "]</a>" );
159 $db- > free_result ( $statuses );
166 /*=====================================================================*\
167 || ###################################################################
170 || ###################################################################
171 \*=====================================================================*/