2004-12-12 03:51:51 +00:00
< ? php
/********************************************************/
2004-11-09 22:41:18 +00:00
/* code to View and approve new application maintainers */
2004-12-12 03:51:51 +00:00
/********************************************************/
2004-11-09 22:41:18 +00:00
2006-07-07 18:14:53 +00:00
require ( " path.php " );
2005-01-30 00:57:34 +00:00
require ( BASE . " include/incl.php " );
2006-07-07 18:14:53 +00:00
require_once ( BASE . " include/tableve.php " );
require_once ( BASE . " include/category.php " );
require_once ( BASE . " include/maintainer.php " );
require_once ( BASE . " include/application.php " );
require_once ( BASE . " include/mail.php " );
2004-11-09 22:41:18 +00:00
2006-06-17 06:10:10 +00:00
$aClean = array (); //array of filtered user input
2006-07-06 17:27:54 +00:00
$aClean [ 'sSub' ] = makeSafe ( $_REQUEST [ 'sSub' ] );
2006-07-16 16:53:08 +00:00
$aClean [ 'iMaintainerId' ] = makeSafe ( $_REQUEST [ 'iMaintainerId' ] );
2006-07-06 17:27:54 +00:00
$aClean [ 'sAdd' ] = makeSafe ( $_REQUEST [ 'sAdd' ] );
$aClean [ 'sReject' ] = makeSafe ( $_REQUEST [ 'sReject' ] );
$aClean [ 'sReplyText' ] = makeSafe ( $_REQUEST [ 'sReplyText' ] );
2006-06-17 06:10:10 +00:00
2005-01-30 23:12:48 +00:00
if ( ! $_SESSION [ 'current' ] -> hasPriv ( " admin " ))
2006-07-06 18:44:56 +00:00
util_show_error_page_and_exit ( " Insufficient privileges. " );
2006-07-06 17:59:52 +00:00
2004-11-09 22:41:18 +00:00
2006-07-06 17:27:54 +00:00
if ( $aClean [ 'sSub' ])
2004-11-09 22:41:18 +00:00
{
2006-07-16 16:53:08 +00:00
if ( $aClean [ 'iMaintainerId' ])
2004-11-09 22:41:18 +00:00
{
//get data
2006-07-16 16:53:08 +00:00
$sQuery = " SELECT maintainerId, appId, versionId, " .
2004-12-10 00:18:01 +00:00
" userId, maintainReason, superMaintainer, " .
2004-11-09 22:41:18 +00:00
" UNIX_TIMESTAMP(submitTime) as submitTime " .
2006-07-16 16:53:08 +00:00
" FROM appMaintainers WHERE maintainerId = '?' AND queued = 'true' " ;
$hResult = query_parameters ( $sQuery , $aClean [ 'iMaintainerId' ]);
2006-06-21 01:04:12 +00:00
$oRow = mysql_fetch_object ( $hResult );
$oUser = new User ( $oRow -> userId );
mysql_free_result ( $hResult );
2004-11-09 22:41:18 +00:00
}
else
{
//error no Id!
2006-07-24 16:20:40 +00:00
util_show_error_page_and_exit ( " <p><b>MaintainerId Not Found!</b></p> " );
2004-11-09 22:41:18 +00:00
}
//process according to which request was submitted and optionally the sub flag
2006-07-16 16:53:08 +00:00
if ( ! $aClean [ 'sAdd' ] && ! $aClean [ 'sReject' ] && $aClean [ 'iMaintainerId' ])
2004-11-09 22:41:18 +00:00
{
2004-12-16 02:46:36 +00:00
apidb_header ( " Admin Maintainer Queue " );
2006-07-06 17:27:54 +00:00
echo '<form name="sQform" action="adminMaintainerQueue.php" method="post" enctype="multipart/form-data">' , " \n " ;
2004-12-16 02:46:36 +00:00
2004-11-09 22:41:18 +00:00
$x = new TableVE ( " view " );
//help
2006-07-24 16:20:40 +00:00
Maintainer :: ObjectDisplayQueueProcessingHelp ();
2004-11-09 22:41:18 +00:00
2006-07-24 16:20:40 +00:00
$oMaintainer = new maintainer ( $aClean [ 'iMaintainerId' ]);
$oMaintainer -> OutputEditor ();
2004-11-09 22:41:18 +00:00
2006-07-24 16:20:40 +00:00
echo " <table border=1 cellpadding=2 cellspacing=0 style='margin-left:auto; margin-right:auto'> \n " ;
2004-11-09 22:41:18 +00:00
//email response
echo '<tr valign=top><td class=color0><b>Email reply</b></td>' , " \n " ;
2006-07-06 17:27:54 +00:00
echo " <td><textarea name='sReplyText' rows=10 cols=35>Enter a personalized reason for acceptance or rejection of the users maintainer request here</textarea></td></tr> \n " ;
2004-11-09 22:41:18 +00:00
/* Add button */
echo '<tr valign=top><td class=color3 align=center colspan=2>' , " \n " ;
2006-07-06 17:27:54 +00:00
echo '<input type=submit name=sAdd value=" Add maintainer to this application " class=button /> </td></tr>' , " \n " ;
2004-11-09 22:41:18 +00:00
/* Reject button */
echo '<tr valign=top><td class=color3 align=center colspan=2>' , " \n " ;
2006-07-06 17:27:54 +00:00
echo '<input type=submit name=sReject value=" Reject this request " class=button /></td></tr>' , " \n " ;
2004-11-09 22:41:18 +00:00
2006-07-06 17:27:54 +00:00
echo '<input type=hidden name="sSub" value="inside_form" />' , " \n " ;
2006-07-16 16:53:08 +00:00
echo '<input type=hidden name="iMaintainerId" value="' . $aClean [ 'iMaintainerId' ] . '" />' , " \n " ;
2004-11-09 22:41:18 +00:00
2006-07-24 16:20:40 +00:00
echo '</table>' ;
2004-11-09 22:41:18 +00:00
echo html_back_link ( 1 , 'adminMaintainerQueue.php' );
2004-12-16 02:46:36 +00:00
echo " </form> " ;
apidb_footer ();
exit ;
2004-11-09 22:41:18 +00:00
}
2006-07-16 16:53:08 +00:00
else if ( $aClean [ 'sAdd' ] && $aClean [ 'iMaintainerId' ])
2004-11-09 22:41:18 +00:00
{
2006-07-24 16:20:40 +00:00
/* create this maintainer object */
$oMaintainer = new maintainer ( $aClean [ 'iMaintainerId' ]);
$sStatusMessage = $oMaintainer -> unQueue ( $aClean [ 'sReplyText' ]);
2005-07-31 17:53:11 +00:00
//done
2006-07-08 22:12:08 +00:00
addmsg ( " <p><b> $sStatusMessage </b></p> " , 'green' );
2004-11-09 22:41:18 +00:00
}
2006-07-16 16:53:08 +00:00
else if (( $aClean [ 'sReject' ] || ( $aClean [ 'sSub' ] == 'sReject' )) && $aClean [ 'iMaintainerId' ])
2004-11-09 22:41:18 +00:00
{
2006-07-24 16:20:40 +00:00
$oMaintainer = new maintainer ( $aClean [ 'iMaintainerId' ]);
$hResult = $oMaintainer -> reject ( $aClean [ 'sReplyText' ]);
if ( ! $hResult ) addmsg ( " unable to delete selected maintainer application " , " red " );
echo html_frame_start ( " Delete maintainer application " , 400 , " " , 0 );
if ( $hResult )
{
//success
echo " <p>Maintainer application was successfully deleted from the Queue.</p> \n " ;
}
echo html_frame_end ( " " );
echo html_back_link ( 1 , 'adminMaintainerQueue.php' );
2004-11-09 22:41:18 +00:00
}
else
{
//error no sub!
2004-12-16 02:46:36 +00:00
addmsg ( '<p><b>Internal Routine Not Found!</b></p>' , 'red' );
2004-11-09 22:41:18 +00:00
}
}
2004-12-16 02:46:36 +00:00
/* display the list of all outstanding maintainer requests */
2004-11-09 22:41:18 +00:00
{
2004-12-16 02:46:36 +00:00
apidb_header ( " Admin Maintainer Queue " );
2006-07-06 17:27:54 +00:00
echo '<form name="sQform" action="adminMaintainerQueue.php" method="post" enctype="multipart/form-data">' , " \n " ;
2004-12-16 02:46:36 +00:00
2006-07-24 16:20:40 +00:00
/* retrieve a list of queued entries */
$hResult = Maintainer :: ObjectGetEntries ( true );
2004-11-09 22:41:18 +00:00
2006-06-21 01:04:12 +00:00
if ( ! $hResult || ! mysql_num_rows ( $hResult ))
2004-11-09 22:41:18 +00:00
{
//no apps in queue
echo html_frame_start ( " " , " 90% " );
echo '<p><b>The Maintainer Queue is empty.</b></p>' , " \n " ;
echo '<p>There is nothing for you to do. Check back later.</p>' , " \n " ;
echo html_frame_end ( " " );
}
else
{
//help
2006-07-24 16:20:40 +00:00
maintainer :: ObjectDisplayQueueProcessingHelp ();
2004-11-09 22:41:18 +00:00
//show applist
echo html_frame_start ( " " , " 90% " , " " , 0 );
echo " <table width='100%' border=0 cellpadding=3 cellspacing=0> \n \n " ;
echo " <tr class=color4> \n " ;
2006-07-24 16:20:40 +00:00
maintainer :: ObjectOutputHeader ();
2005-02-07 23:55:03 +00:00
echo " <td>Action</td> \n " ;
2004-11-09 22:41:18 +00:00
echo " </tr> \n \n " ;
2006-07-08 22:12:08 +00:00
$iRowCount = 1 ;
2006-06-21 01:04:12 +00:00
while ( $oRow = mysql_fetch_object ( $hResult ))
2004-11-09 22:41:18 +00:00
{
2006-07-24 16:20:40 +00:00
$oMaintainer = Maintainer :: ObjectGetObjectFromObjectGetEntriesRow ( $oRow );
2006-07-08 22:12:08 +00:00
if ( $iRowCount % 2 == 1 ) { $sBGColor = 'color0' ; } else { $sBGColor = 'color1' ; }
echo " <tr class= $sBGColor > \n " ;
2006-07-24 16:20:40 +00:00
$oMaintainer -> ObjectOutputTableRow ();
2006-07-16 16:53:08 +00:00
echo " <td>[<a href= \" adminMaintainerQueue.php?sSub=view&iMaintainerId= $oRow->maintainerId\ " > answer </ a > ] </ td > \n " ;
2004-11-09 22:41:18 +00:00
echo " </tr> \n \n " ;
2006-07-08 22:12:08 +00:00
$iRowCount ++ ;
2004-11-09 22:41:18 +00:00
}
echo " </table> \n \n " ;
echo html_frame_end ( " " );
2004-12-16 02:46:36 +00:00
echo " </form> " ;
apidb_footer ();
2004-11-09 22:41:18 +00:00
}
}
?>