add support for application maintainers

This commit is contained in:
Chris Morgan
2004-11-09 22:41:18 +00:00
committed by Jeremy Newman
parent 073acaff01
commit c81eebd949
14 changed files with 793 additions and 38 deletions

View File

@@ -0,0 +1,274 @@
<?
/* code to View and approve new application maintainers */
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."tableve.php");
require(BASE."include/"."category.php");
require_once(BASE."include/"."maintainer.php");
//deny access if not logged in
if(!loggedin())
{
errorpage("You need to be logged in to use this page.");
exit;
} else if (!havepriv("admin"))
{
errorpage("You must be an administrator to use this page.");
exit;
}
apidb_header("Admin Maintainer Queue");
echo '<form name="qform" action="adminMaintainerQueue.php" method="post" enctype="multipart/form-data">',"\n";
if ($sub)
{
if ($queueId)
{
//get data
$query = "SELECT queueId, appId, versionId,".
"userId, maintainReason,".
"UNIX_TIMESTAMP(submitTime) as submitTime ".
"FROM appMaintainerQueue WHERE queueId = $queueId;";
$result = mysql_query($query);
$ob = mysql_fetch_object($result);
mysql_free_result($result);
}
else
{
//error no Id!
echo html_frame_start("Error","300");
echo '<p><b>QueueId Not Found!</b></p>',"\n";
echo html_frame_end("&nbsp;");
}
//process according to which request was submitted and optionally the sub flag
if (!$_REQUEST['add'] && !$_REQUEST['reject'] && $queueId)
{
$x = new TableVE("view");
//help
echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
echo "Please enter an accurate and personalized reply anytime a maintainer request is rejected.\n";
echo "Its not polite to reject someones attempt at trying to help out without explaining why.\n";
echo "</td></tr></table></div>\n\n";
//view application details
echo html_frame_start("New Maintainer Form",600,"",0);
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
// Show the other maintainers of this application, if there are any
echo '<tr valign=top><td class=color0><b>Other maintainers of this app:</b></td>',"\n";
$other_users = getMaintainersUserIdsFromAppIdVersionId($ob->appId, $ob->versionId);
if($other_users)
{
while(list($index, list($userIdValue)) = each($other_users))
{
echo "<td>".lookupUsername($userIdValue)."</td></tr>\n";
}
} else
{
echo "<td>No other maintainers</td></tr>\n";
}
// Show which other apps the user maintains
echo '<tr valign=top><td class=color0><b>This user also maintains these apps:</b></td>',"\n";
$other_apps = getAppsFromUserId($ob->userId);
if($other_apps)
{
while(list($index, list($appId, $versionId)) = each($other_apps))
{
echo "<td>".appIdToName($appIdOther).versionIdToName($versionIdOther)."</td></tr>\n";
}
} else
{
echo "<td>User maintains no other applications</td></tr>\n";
}
//app name
echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n";
echo "<td>".appIdToName($ob->appId)."</td></tr>\n";
//version
echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
echo "<td>".versionIdToName($ob->versionId)."</td></tr>\n";
//maintainReason
echo '<tr valign=top><td class=color0><b>Maintainer request reason</b></td>',"\n";
echo '<td><textarea name="maintainReason" rows=10 cols=35>'.stripslashes($ob->maintainReason).'</textarea></td></tr>',"\n";
//email response
echo '<tr valign=top><td class=color0><b>Email reply</b></td>',"\n";
echo "<td><textarea name='replyText' rows=10 cols=35>Enter a personalized reason for acceptance or rejection of the users maintainer request here</textarea></td></tr>\n";
//echo '<tr valign=top><td bgcolor=class=color0><b>Email</b></td>,"\n";
//echo '<td><input type=text name="queueEmail" value="'.$ob->queueEmail.'" size=20></td></tr>',"\n";
/* Add button */
echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
echo '<input type=submit name=add value=" Add maintainer to this application " class=button> </td></tr>',"\n";
/* Reject button */
echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
echo '<input type=submit name=reject value=" Reject this request " class=button></td></tr>',"\n";
echo '</table>',"\n";
echo '<input type=hidden name="sub" value="inside_form">',"\n";
echo '<input type=hidden name="queueId" value="'.$queueId.'">',"\n";
echo html_frame_end("&nbsp;");
echo html_back_link(1,'adminMaintainerQueue.php');
}
else if ($_REQUEST['add'] && $queueId)
{
//add this user, app and version to the database
$statusMessage = "";
$goodtogo = 0;
// insert the new entry into the maintainers list
$query = "INSERT into appMaintainers VALUES(null,".
"$ob->appId,".
"$ob->versionId,".
"$ob->userId,".
"NOW());";
if (mysql_query($query))
{
$statusMessage = "<p>The application $queueName was successfully added into the database</p>\n";
//delete the item from the queue
mysql_query("DELETE from appMaintainerQueue where queueId = $queueId;");
} else
{
//error
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
}
//Send Status Email
if (lookupEmail($ob->userId) && $goodtogo)
{
$ms = "Application Maintainer Request Report\n";
$ms .= "----------------------------------\n\n";
$ms .= "Your application to be the maintainer of ".appIdToName($ob->appId).versionIdToName($ob->versionId)." has been accepted";
$ms .= "We appreciate your help in making the Application Database better for all users.\n\n";
$ms .= "Thanks!\n";
$ms .= "-The AppDB admins\n";
mail(stripslashes(lookupEmail($ob->userId)),'[AppDB] Maintainer Request Report',$ms);
}
//done
echo html_frame_start("Submit Maintainer","600");
echo "<p><b>$statusMessage</b></p>\n";
echo html_frame_end("&nbsp;");
echo html_back_link(1,'adminMaintainerQueue.php');
}
else if (($_REQUEST['reject'] || ($sub == 'reject')) && $queueId)
{
if (lookupEmail($ob->userId) && $goodtogo)
{
$ms = "Application Maintainer Request Report\n";
$ms .= "----------------------------------\n\n";
$ms .= "Your application to be the maintainer of ".appIdToName($ob->appId).versionIdToName($ob->versionId)." was rejected";
$ms .= $_REQUEST['replyText'];
$ms .= "";
$ms .= "Thanks!\n";
$ms .= "-The AppDB admins\n";
mail(stripslashes(lookupEmail($ob->userId)),'[AppDB] Maintainer Request Report',$ms);
}
//delete main item
$query = "DELETE from appMaintainerQueue where queueId = $queueId;";
$result = mysql_query($query);
echo html_frame_start("Delete maintainer application: $ob->queueName",400,"",0);
if(!$result)
{
//error
echo "<p>Internal Error: unable to delete selected maintainer application!</p>\n";
}
else
{
//success
echo "<p>Maintainer application was successfully deleted from the Queue.</p>\n";
}
echo html_frame_end("&nbsp;");
echo html_back_link(1,'adminMaintainerQueue.php');
}
else
{
//error no sub!
echo html_frame_start("Error","300");
echo '<p><b>Internal Routine Not Found!</b></p>',"\n";
echo html_frame_end("&nbsp;");
echo html_back_link(1,'adminMaintainerQueue.php');
}
}
else /* display the list of all outstanding maintainer requests */
{
//get available maintainers
$query = "SELECT queueId, appId, versionId,".
"userId, maintainReason,".
"UNIX_TIMESTAMP(submitTime) as submitTime ".
"from appMaintainerQueue;";
$result = mysql_query($query);
if(!$result || !mysql_num_rows($result))
{
//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("&nbsp;");
}
else
{
//help
echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
echo "<p>This is a list of users that are asking to become application maintainers.\n";
echo "Please read carefully the reasons they give for wanting to be an application maintainer.\n";
echo "</td></tr></table></div>\n\n";
//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";
echo " <td><font color=white>Submission Date</font></td>\n";
echo " <td><font color=white>Queue Id</font></td>\n";
echo " <td><font color=white>Username</font></td>\n";
echo " <td><font color=white>Application Name</font></td>\n";
echo " <td><font color=white>Version</font></td>\n";
echo " <td><font color=white>Submitter Email</font></td>\n";
echo " <td>&nbsp;</td>\n";
echo "</tr>\n\n";
$c = 1;
while($ob = mysql_fetch_object($result))
{
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=$bgcolor>\n";
echo " <td>".date("Y-n-t h:i:sa", $ob->submitTime)." &nbsp;</td>\n";
echo " <td><a href='adminMaintainerQueue.php?sub=view&queueId=$ob->queueId'>$ob->queueId</a></td>\n";
echo " <td>".lookupUsername($ob->userId)."</td>\n";
echo " <td>".appIdToName($ob->appId)."</td>\n";
echo " <td>".versionIdToName($ob->versionId)." &nbsp;</td>\n";
echo " <td>".lookupEmail($ob->userId)." &nbsp;</td>\n";
echo " <td>[<a href='adminMaintainerQueue.php?sub=reject&queueId=$ob->queueId'>reject</a>]</td>\n";
echo "</tr>\n\n";
$c++;
}
echo "</table>\n\n";
echo html_frame_end("&nbsp;");
}
}
echo "</form>";
apidb_footer();
?>

View File

@@ -0,0 +1,99 @@
<?
/* code to view and maintain the list of application maintainers */
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."tableve.php");
require(BASE."include/"."category.php");
require(BASE."include/"."maintainer.php");
//deny access if not logged in
if(!loggedin())
{
errorpage("You need to be logged in to use this page.");
exit;
} else if (!havepriv("admin"))
{
errorpage("You must be an administrator to use this page.");
exit;
}
apidb_header("Admin Maintainers");
echo '<form name="qform" action="adminMaintainers.php" method="post" enctype="multipart/form-data">',"\n";
if ($sub)
{
if($sub == 'delete')
{
$query = "DELETE FROM appMaintainers WHERE maintainerId = $maintainerId;";
echo "$query";
$result = mysql_query($query);
echo html_frame_start("Delete maintainer: $maintainerId",400,"",0);
if(!$result)
{
//error
echo "<p>Internal Error: unable to delete selected maintainer!</p>\n";
}
else
{
//success
echo "<p>Maintainer was successfully deleted</p>\n";
}
echo html_frame_end("&nbsp;");
echo html_back_link(1,'adminMaintainers.php');
}
} else
{
//get available maintainers
$query = "SELECT maintainerId, appId, versionId,".
"userId, UNIX_TIMESTAMP(submitTime) as submitTime ".
"from appMaintainers;";
$result = mysql_query($query);
if(!$result || !mysql_num_rows($result))
{
//no apps in queue
echo html_frame_start("","90%");
echo '<p><b>There are no application maintainers.</b></p>',"\n";
echo html_frame_end("&nbsp;");
}
else
{
//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";
echo " <td><font color=white>Submission Date</font></td>\n";
echo " <td><font color=white>Username</font></td>\n";
echo " <td><font color=white>Application Name</font></td>\n";
echo " <td><font color=white>Version</font></td>\n";
echo " <td></td>\n";
echo " <td>&nbsp;</td>\n";
echo "</tr>\n\n";
$c = 1;
while($ob = mysql_fetch_object($result))
{
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=$bgcolor>\n";
echo " <td>".date("Y-n-t h:i:sa", $ob->submitTime)." &nbsp;</td>\n";
echo " <td>".lookupUsername($ob->userId)."</td>\n";
echo " <td>".appIdToName($ob->appId)."</td>\n";
echo " <td><a href='".$apidb_root."appview.php?appId=$ob->appId&versionId=$ob->versionId'>".versionIdToName($ob->versionId)."</a>&nbsp;</td>\n";
echo " <td>".lookupEmail($ob->userId)." &nbsp;</td>\n";
echo " <td>[<a href='adminMaintainers.php?sub=delete&maintainerId=$ob->maintainerId'>delete</a>]</td>\n";
echo "</tr>\n\n";
$c++;
}
echo "</table>\n\n";
echo html_frame_end("&nbsp;");
}
}
echo "</form>";
apidb_footer();
?>

View File

@@ -16,6 +16,8 @@ require(BASE."include/"."vote.php");
require(BASE."include/"."rating.php");
require(BASE."include/"."category.php");
require(BASE."include/"."maintainer.php");
global $apidb_root;
@@ -373,9 +375,6 @@ else if($appId && $versionId)
//set URL
$appLinkURL = ($data->webPage) ? "<a href='$data->webPage'>".substr(stripslashes($data->webPage),0,30)."</a>": "&nbsp;";
//set image
$img = get_screenshot_img($appId, $versionId);
//start version display
echo html_frame_start("","98%","",0);
@@ -397,14 +396,59 @@ else if($appId && $versionId)
display_notes($appId, $versionId);
//Image
$img = get_screenshot_img($appId, $versionId);
echo "<tr><td align=center colspan=2>$img</td></tr>\n";
echo "</table></td><td class=color2 valign=top width='100%'>\n";
// Display all maintainers of this application
echo "<tr class=color0><td align=left colspan=2><b>Maintainers of this application:</b>\n";
echo "<table width=250 border=0>";
$other_maintainers = getMaintainersUserIdsFromAppIdVersionId($appId, $versionId);
if($other_maintainers)
{
while(list($index, list($userIdValue)) = each($other_maintainers))
{
echo "<tr class=color0><td align=left colspan=2>";
echo "<li>".lookupUsername($userIdValue)."</td></tr>\n";
}
} else
{
echo "<tr class=color0><td align=right colspan=2>";
echo "No maintainers. Volunteer today!</td></tr>\n";
}
echo "</table></td></tr>";
// Display the app maintainer button
echo "<tr><td colspan = 2><center>";
if(loggedin())
{
/* are we already a maintainer? */
if(isMaintainer($appId, $versionId)) /* yep */
{
echo '<form method=post name=message action="maintainerdelete.php"><input type=submit value="Remove yourself as a maintainer" class=button>';
} else /* nope */
{
echo '<form method=post name=message action="maintainersubmit.php"><input type=submit value="Be a maintainer for this app" class=button>';
}
echo "<input type=hidden name='appId' value=$appId>";
echo "<input type=hidden name='versionId' value=$versionId>";
echo "</form>";
} else
{
echo '<input type=submit value="Log in to become an app maintainer" class=button>';
}
echo "</center></td></tr>";
echo "</table><td class=color2 valign=top width='100%'>\n";
//Desc Image
echo "<table width='100%' border=0><tr><td width='100%' valign=top> <b>Description</b><br>\n";
echo add_br(stripslashes($ver->description));
echo "</td></tr></table>\n";
echo "</td></tr>";
/* close the table */
echo "</table>\n";
echo html_frame_end();

View File

@@ -3,8 +3,15 @@
include("path.php");
require(BASE."include/"."incl.php");
//FIXME: should check to see if the user is an application maintainer when we have application maintainers
if(!havepriv("admin"))
$appId = strip_tags($_POST['appId']);
$versionId = strip_tags($_POST['versionId']);
$commentId = strip_tags($_POST['commentId']);
$commentId = mysql_escape_string($commentId);
/* if we aren't an admin or the maintainer of this app we shouldn't be */
/* allowed to delete any comments */
if(!havepriv("admin") && !isMaintainer($appId, $versionId))
{
errorpage('You don\'t have admin privilages');
exit;
@@ -12,12 +19,6 @@ if(!havepriv("admin"))
opendb();
$commentId = strip_tags($_POST['commentId']);
$commentId = mysql_escape_string($commentId);
$appId = strip_tags($_POST['appId']);
$versionId = strip_tags($_POST['versionId']);
/* retrieve the parentID of the comment we are deleting */
/* so we can fix up the parentIds of this comments children */
$result = mysql_query("SELECT parentId FROM appComments WHERE commentId = '$commentId'");

View File

@@ -66,8 +66,7 @@ function view_app_comment($ob)
echo "</td></tr>\n";
// delete message button, for admins
//TODO: application managers should also see this button
if(havepriv("admin"))
if(havepriv("admin") || isMaintainer($ob->appId, $ob->versionId))
{
echo "<tr>";
echo '<td><form method=post name=message action="deletecomment.php"><input type=submit value="Delete" class=button> ',"\n";

47
include/maintainer.php Normal file
View File

@@ -0,0 +1,47 @@
<?
/*
* get the applications and versions that this userId maintains
*/
function getAppsFromUserId($userId)
{
$result = mysql_query("SELECT appId, versionId FROM ".
"appMaintainers WHERE userId = '$userId'");
if(mysql_num_rows($result) == 0)
return;
$retval = array();
$c = 0;
while($row = mysql_fetch_object($result))
{
$retval[$c] = array($row->appId, $row->versionId);
$c++;
}
return $retval;
}
/*
* get the userIds of maintainers for this appId and versionId
*/
function getMaintainersUserIdsFromAppIdVersionId($appId, $versionId)
{
$query = "SELECT userId FROM ".
"appMaintainers WHERE appId = '$appId' " .
"AND versionId = '$versionId';";
$result = mysql_query($query);
if(mysql_num_rows($result) == 0)
return; // no sub categories
$retval = array();
$c = 0;
while($row = mysql_fetch_object($result))
{
$retval[$c] = array($row->userId);
$c++;
}
return $retval;
}
?>

View File

@@ -10,7 +10,7 @@ class htmlmenu {
echo '
<div align=left>
<table width="150" border="0" cellspacing="0" cellpadding="0">
<table width="160" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan=2>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="topMenu">
@@ -30,7 +30,7 @@ echo '
</tr>
<tr>
<td>
<table width="145" border="0" cellspacing="0" cellpadding="1">
<table width="155" border="0" cellspacing="0" cellpadding="1">
<tr class="topMenu"><td>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
';

View File

@@ -1,4 +1,4 @@
<?
.<?
/*
* sidebar_admin
@@ -18,6 +18,7 @@ function global_admin_menu() {
$g->addmisc("&nbsp;");
$g->add("List Users", $apidb_root."admin/");
$g->add("View App Queue (".getQueuedAppCount().")", $apidb_root."admin/adminAppQueue.php");
$g->add("View Maintainer Queue (".getQueuedMaintainerCount().")", $apidb_root."admin/adminMaintainerQueue.php");
$g->done();

View File

@@ -1,5 +1,8 @@
<?
require_once(BASE."include/"."maintainer.php");
require_once(BASE."include/"."category.php");
/*
* Login SideBar
*
@@ -13,8 +16,23 @@ function global_sidebar_login() {
if(loggedin())
{
global $current;
$g->add("Logout", $apidb_root."account.php?cmd=logout");
$g->add("Preferences", $apidb_root."preferences.php");
/* if this user maintains any applications list them */
/* in their sidebar */
$apps_user_maintains = getAppsFromUserId($current->userid);
if($apps_user_maintains)
{
$g->addmisc("");
$g->addmisc("You maintain:\n");
while(list($index, list($appId, $versionId)) = each($apps_user_maintains))
{
$g->addmisc("<a href='".$apidb_root."appview.php?appId=$appId&versionId=$versionId'>".appIdToName($appId).versionIdToName($versionId)."</a>", "center");
}
}
}
else
{

View File

@@ -46,11 +46,7 @@ class User {
function lookup_username($userid)
{
$result = mysql_query("SELECT username FROM user_list WHERE userid = $userid");
if(!$result || mysql_num_rows($result) != 1)
return null;
$ob = mysql_fetch_object($result);
return $ob->username;
return lookupUsername($userId);
}
function lookup_userid($username)
@@ -73,11 +69,7 @@ class User {
function lookup_email($userid)
{
$result = mysql_query("SELECT email FROM user_list WHERE userid = $userid");
if(!$result || mysql_num_rows($result) != 1)
return null;
$ob = mysql_fetch_object($result);
return $ob->email;
return lookupEmail($userid);
}
/*
@@ -220,6 +212,22 @@ class User {
return mysql_num_rows($result);
}
/*
* check if this user is an maintainer of a given appId/versionId
*/
function is_maintainer($appId, $versionId)
{
global $current;
if(!loggedin() || !$this->userid)
return false;
$query = "SELECT * FROM appMaintainers WHERE userid = '$this->userid' AND appId = '$appId' AND versionId = '$versionId'";
$result = mysql_query($query, $this->link);
if(!$result)
return 0;
return mysql_num_rows($result);
}
function addpriv($priv)
{
if(!$this->userid || !$priv)
@@ -280,6 +288,16 @@ function havepriv($priv)
return $current->checkpriv($priv);
}
function isMaintainer($appId, $versionId)
{
global $current;
if(!loggedin())
return false;
return $current->is_maintainer($appId, $versionId);
}
function debugging()
{
global $current;
@@ -315,4 +333,23 @@ function generate_passwd($pass_len = 10)
return ($nps);
}
function lookupUsername($userid)
{
$result = mysql_query("SELECT username FROM user_list WHERE userid = $userid");
if(!$result || mysql_num_rows($result) != 1)
return null;
$ob = mysql_fetch_object($result);
return $ob->username;
}
function lookupEmail($userid)
{
$result = mysql_query("SELECT email FROM user_list WHERE userid = $userid");
if(!$result || mysql_num_rows($result) != 1)
return null;
$ob = mysql_fetch_object($result);
return $ob->email;
}
?>

View File

@@ -180,4 +180,22 @@ function getQueuedAppCount()
return $ob->queued_apps;
}
/* get the number of applications in the appQueue table */
function getQueuedAppCount()
{
$qstring = "SELECT count(*) as queued_apps FROM appQueue";
$result = mysql_query($qstring);
$ob = mysql_fetch_object($result);
return $ob->queued_apps;
}
/* get the number of applications in the appQueue table */
function getQueuedMaintainerCount()
{
$qstring = "SELECT count(*) as queued_maintainers FROM appMaintainerQueue";
$result = mysql_query($qstring);
$ob = mysql_fetch_object($result);
return $ob->queued_maintainers;
}
?>

57
maintainerdelete.php Normal file
View File

@@ -0,0 +1,57 @@
<?
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."tableve.php");
require(BASE."include/"."category.php");
if(!loggedin())
{
errorpage("You need to be logged in to apply to be a maintainer.");
exit;
}
opendb();
$appId = strip_tags($_POST['appId']);
$versionId = strip_tags($_POST['versionId']);
$confirmed = strip_tags($_POST['confirmed']);
// header
apidb_header("Confirm maintainer resignation of ".appIdToName($appId).versionIdToName($versionId));
if($confirmed)
{
global $current;
echo html_frame_start("Removing",400,"",0);
$query = "DELETE FROM appMaintainers WHERE appId = '$appId' AND versionId = '$versionId' AND userId = '$current->userid';";
$result = mysql_query($query);
if($result)
{
echo "You were removed as a maintainer of ".appIdToName($appId).versionIdToName($versionId);
} else
{
//error
echo "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
}
} else
{
echo '<form name="deleteMaintainer" action="maintainerdelete.php" method="post" enctype="multipart/form-data">',"\n";
echo html_frame_start("Confirm",400,"",0);
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
echo "<input type=hidden name='appId' value=$appId>";
echo "<input type=hidden name='versionId' value=$versionId>";
echo "<input type=hidden name='confirmed' value=1>";
echo "<tr><td>Are you sure that you want to be removed as a maintainer of this application?</tr></td>\n";
echo '<tr><td align=center><input type=submit value=" Confirm resignation as maintainer " class=button>', "\n";
echo "</td></tr></table>";
}
echo html_frame_end();
apidb_footer();
?>

129
maintainersubmit.php Normal file
View File

@@ -0,0 +1,129 @@
<?
// Check the input of a submitted form. And output with a list
// of errors. (<ul></ul>)
function checkAppMaintainerInput( $fields )
{
$errors = "";
if ( empty( $fields['maintainReason']) )
{
$errors .= "<li>Please enter say why you would like to be an app maintainer.</li>\n";
}
if ( empty($errors) )
{
return "";
}
else
{
return $errors;
}
}
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."tableve.php");
require(BASE."include/"."category.php");
if(!loggedin())
{
errorpage("You need to be logged in to apply to be a maintainer.");
exit;
}
opendb();
$appId = strip_tags($_POST['appId']);
$versionId = strip_tags($_POST['versionId']);
/* if the user is already a maintainer don't add them again */
if(isMaintainer($appId, $versionId))
{
echo "You are already a maintainer of this app!";
exit;
}
if($_REQUEST['maintainReason'])
{
// check the input for empty/invalid fields
$errors = checkAppMaintainerInput($_REQUEST);
if(!empty($errors))
{
errorpage("We found the following errors:","<ul>$errors</ul><br>Please go back and correct them.");
exit;
}
// header
apidb_header("Submit Maintainer Request");
// add to queue
$query = "INSERT INTO appMaintainerQueue VALUES (null, '".
addslashes($_REQUEST['appId'])."', '".
addslashes($_REQUEST['versionId'])."', '".
addslashes($current->userid)."', '".
addslashes($_REQUEST['maintainReason'])."',".
"NOW()".");";
mysql_query($query);
if ($error = mysql_error())
{
echo "<p><font color=red><b>Error:</b></font></p>\n";
echo "<p>$error</p>\n";
}
else
{
echo "<p>Your maintainer request has been submitted for Review. You should hear back\n";
echo "soon about the status of your submission</p>\n";
}
} else
{
// header
apidb_header("Request to become an application maintainer of ".appIdToName($appId).versionIdToName($versionId));
// show add to queue form
echo '<form name="newApp" action="maintainersubmit.php" method="post" enctype="multipart/form-data">',"\n";
echo "<p>This page is for submitting a request to become an application maintainer.\n";
echo "An application maintainer is someone who runs the application \n";
echo "regularly and who is willing to be active in reporting regressions with newer \n";
echo "versions of wine and to help other users run this application under wine.";
echo "<p>Being an application maintainer comes with responsibilities. ";
echo "<br><br><b>You are expected to:</b>";
echo "<li>You are expected to keep the application comments clean, all stale data should be removed</li>";
echo "<li>Be an active user of that application and version</li>";
echo "<li>Keep up-to-date with all wine releases, if there are regressions these should be reported to wine-devel</li>";
echo "<p><b>You will:</b>";
echo "<li>Receive an email anytime a comment is posted or deleted for the application or the application information is modified</li>";
echo "<p>We ask that all maintainers explain why they want to be an app maintainer,\n";
echo "why they think they will do a good job and a little about their experience\n";
echo "with wine. This is both to give you time to\n";
echo "think about whether you really want to be an app maintainer and also for the\n";
echo "appdb admins to identify people that are best suited for the job. Your request\n";
echo "may be denied if there are already a handful of maintainers for this app or if you\n";
echo "don't have the experience with wine that is necessary to help other users out.\n";
echo "<br><br>";
echo html_frame_start("New Maintainer Form",400,"",0);
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
echo "<tr valign=top><td class=color0>";
echo '<b>Application</br></td><td>'.appIdToName($appId).' '.versionIdToName($versionId);
echo '</td></tr>',"\n";
echo "<input type=hidden name='appId' value=$appId>";
echo "<input type=hidden name='versionId' value=$versionId>";
echo '<tr valign=top><td class=color0><b>Why you want to and should be an app maintainer</b></td><td><textarea name="maintainReason" rows=15 cols=70></textarea></td></tr>',"\n";
echo '<tr valign=top><td class=color3 align=center colspan=2> <input type=submit value=" Submit Maintainer Request " class=button> </td></tr>',"\n";
echo '</table>',"\n";
echo html_frame_end();
echo "</form>";
}
apidb_footer();
?>

View File

@@ -19,6 +19,7 @@ drop table if exists appBundle;
drop table if exists appVotes;
drop table if exists appRating;
drop table if exists appNotes;
drop table if exists appMaintainers;
drop table if exists sessionMessages;
@@ -244,6 +245,36 @@ create table appNotes (
key(noteId)
);
/*
* List of the application maintainers. These users have the rights
* to delete comments, edit the application description and otherwise
* care for an application.
*/
create table appMaintainers (
maintainerId int not null auto_increment,
appId int,
versionId int,
userId int,
submitTime timestamp,
key(maintainerId)
);
/*
* Queue where users names will go if they request to become an application
* maintainer. This includes the reason they want to become a maintainer.
*/
create table appMaintainerQueue (
queueId int not null auto_increment,
appId int,
versionId int,
userId int,
maintainReason text,
submitTime timestamp,
key(queueId)
);
/*
*
*/