]>
src.bluestatic.org Git - bugdar.git/blob - admin/status.php
2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 require_once ( './global.php' );
14 require_once ( './includes/functions_datastore.php' );
16 if (! can_perform ( 'canadminfields' ))
21 // ###################################################################
23 if ( empty ( $_REQUEST [ 'do' ]))
25 $_REQUEST [ 'do' ] = 'modify' ;
28 // ###################################################################
30 if ( $_REQUEST [ 'do' ] == 'kill' )
32 $db- > query ( "DELETE FROM " . TABLE_PREFIX
. "status WHERE statusid = " . intval ( $bugsys- > in
[ 'statusid' ]));
34 $admin- > redirect ( 'status.php?do=modify' );
37 // ###################################################################
39 if ( $_REQUEST [ 'do' ] == 'delete' )
41 $admin- > page_confirm ( $lang- > string ( '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?do=kill&statusid=' . intval ( $bugsys- > in
[ 'statusid' ]));
44 // ###################################################################
46 if ( $_POST [ 'do' ] == 'insert' )
48 $db- > query ( "INSERT INTO " . TABLE_PREFIX
. "status (status, displayorder, color) VALUES ('" . $bugsys- > in
[ 'status' ] . "', " . intval ( $bugsys- > in
[ 'displayorder' ]) . ", '" . $bugsys- > in
[ 'color' ] . "')" );
50 $admin- > redirect ( 'status.php?do=modify' );
53 // ###################################################################
55 if ( $_REQUEST [ 'do' ] == 'add' )
57 $admin- > page_start ( $lang- > string ( 'Add New Status' ));
59 $admin- > form_start ( 'status.php' , 'insert' );
60 $admin- > table_start ();
61 $admin- > table_head ( $lang- > string ( 'New Status' ));
62 $admin- > row_input ( $lang- > string ( 'Status Title<div><dfn>The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)</dfn></div>' ), 'status' );
63 $admin- > row_input ( $lang- > string ( 'Display Order<div><dfn>The order in which the statuses ar displayed.</dfn></div>' ), 'displayorder' );
64 $admin- > row_input ( $lang- > string ( 'Status Colour<div><dfn>The colour 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' );
72 // ###################################################################
74 if ( $_POST [ 'do' ] == 'update' )
76 $db- > query ( "UPDATE " . TABLE_PREFIX
. "status SET status = '" . $bugsys- > in
[ 'status' ] . "', displayorder = " . intval ( $bugsys- > in
[ 'displayorder' ]) . ", color = '" . $bugsys- > in
[ 'color' ] . "' WHERE statusid = " . intval ( $bugsys- > in
[ 'statusid' ]));
78 $admin- > redirect ( 'status.php?do=modify' );
81 // ###################################################################
83 if ( $_REQUEST [ 'do' ] == 'edit' )
85 $status = $db- > query_first ( "SELECT * FROM " . TABLE_PREFIX
. "status WHERE statusid = " . intval ( $bugsys- > in
[ 'statusid' ]));
86 if (! is_array ( $status ))
88 $admin- > error ( $lang- > getlex ( 'error_invalid_id' ));
91 $admin- > page_start ( $lang- > string ( 'Edit Status' ));
93 $admin- > form_start ( 'status.php' , 'update' );
94 $admin- > form_hidden_field ( 'statusid' , $status [ 'statusid' ]);
95 $admin- > table_start ();
96 $admin- > table_head ( sprintf ( $lang- > string ( 'Edit Status - %1 $s (id: %2 $s )' ), $status [ 'status' ], $status [ 'statusid' ]));
97 $admin- > row_input ( $lang- > string ( 'Status Title<div><dfn>The title of this status flag (eg: `Confirmed` or `Closed (Fixed)`)</dfn></div>' ), 'status' , $status [ 'status' ]);
98 $admin- > row_input ( $lang- > string ( 'Display Order<div><dfn>The order in which the statuses ar displayed.</dfn></div>' ), 'displayorder' , $status [ 'displayorder' ]);
99 $admin- > row_input ( $lang- > string ( 'Status Colour<div><dfn>The colour 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 [ 'color' ]);
100 $admin- > row_submit ();
107 // ###################################################################
109 if ( $_REQUEST [ 'do' ] == 'modify' )
111 $admin- > page_start ( $lang- > string ( 'Status Manager' ));
113 $statuses = $db- > query ( "SELECT * FROM " . TABLE_PREFIX
. "status" );
115 $admin- > form_start ( 'status.php' , 'null' );
116 $admin- > table_start ();
117 $admin- > table_head ( $lang- > string ( 'Status Manager' ));
119 while ( $status = $db- > fetch_array ( $statuses ))
121 $colourblock = '<span style="float: right"><div style="height: 12px; width: 12px; background-color: ' . $status [ 'color' ] . '; border: 1px black solid"></div></span>' ;
122 $admin- > row_text ( " $colourblock $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] \" >[" . $lang- > string ( 'Edit' ) . "]</a> <a href= \" status.php?do=delete&statusid= $status [statusid] \" >[" . $lang- > string ( 'Delete' ) . "]</a>" );
124 $db- > free_result ( $statuses );
126 $admin- > row_span ( '<a href="status.php?do=add">[' . $lang- > string ( 'Add New Status' ) . ']</a>' , 'tfoot' , 'center' , 3 );
133 /*=====================================================================*\
134 || ###################################################################
137 || ###################################################################
138 \*=====================================================================*/