From 3fa8a3bd7aaf6c5ce34c375c3d2b4ef062694e0b Mon Sep 17 00:00:00 2001 From: Chris Morgan Date: Fri, 10 Dec 2004 00:18:01 +0000 Subject: [PATCH] Add support for application wide maintainers, super maintainers, that are maintainers for all versions of a particular application. --- admin/adminMaintainerQueue.php | 70 +++++++- admin/adminMaintainers.php | 15 +- appview.php | 300 ++++++++++++++++++++------------- include/comments.php | 5 +- include/maintainer.php | 27 ++- include/sidebar_login.php | 7 +- include/user.php | 33 ++++ maintainerdelete.php | 34 +++- maintainersubmit.php | 38 ++++- tables/appdb_tables.sql | 12 +- 10 files changed, 393 insertions(+), 148 deletions(-) diff --git a/admin/adminMaintainerQueue.php b/admin/adminMaintainerQueue.php index cfc13e7..d4e5373 100644 --- a/admin/adminMaintainerQueue.php +++ b/admin/adminMaintainerQueue.php @@ -28,7 +28,7 @@ if ($sub) { //get data $query = "SELECT queueId, appId, versionId,". - "userId, maintainReason,". + "userId, maintainReason, superMaintainer,". "UNIX_TIMESTAMP(submitTime) as submitTime ". "FROM appMaintainerQueue WHERE queueId = $queueId;"; $result = mysql_query($query); @@ -61,14 +61,45 @@ if ($sub) // Show the other maintainers of this application, if there are any echo 'Other maintainers of this app:',"\n"; + $foundMaintainers = false; + + $firstDisplay = true; /* if false we need to fix up table rows appropriately */ + $other_users = getMaintainersUserIdsFromAppIdVersionId($ob->appId, $ob->versionId); if($other_users) { + $foundMaintainers = true; while(list($index, list($userIdValue)) = each($other_users)) { - echo "".lookupUsername($userIdValue)."\n"; + if($firstDisplay) + { + echo "".lookupUsername($userIdValue)."\n"; + $firstDisplay = false; + } else + { + echo "".lookupUsername($userIdValue)."\n"; + } } - } else + } + + $other_users = getSuperMaintainersUserIdsFromAppId($ob->appId); + if($other_users) + { + $foundMaintainers = true; + while(list($index, list($userIdValue)) = each($other_users)) + { + if($firstDisplay) + { + echo "".lookupUsername($userIdValue)."*\n"; + $firstDisplay = false; + } else + { + echo "".lookupUsername($userIdValue)."*\n"; + } + } + } + + if(!$foundMaintainers) { echo "No other maintainers\n"; } @@ -76,12 +107,26 @@ if ($sub) // Show which other apps the user maintains echo 'This user also maintains these apps:',"\n"; + $firstDisplay = true; $other_apps = getAppsFromUserId($ob->userId); if($other_apps) { - while(list($index, list($appId, $versionId)) = each($other_apps)) + while(list($index, list($appIdOther, $versionIdOther, $superMaintainerOther)) = each($other_apps)) { - echo "".appIdToName($appIdOther).versionIdToName($versionIdOther)."\n"; + if($firstDisplay) + { + $firstDisplay = false; + if($superMaintainerOther) + echo "".appIdToName($appIdOther)."*\n"; + else + echo "".appIdToName($appIdOther).versionIdToName($versionIdOther)."\n"; + } else + { + if($superMaintainerOther) + echo "".appIdToName($appIdOther)."*\n"; + else + echo "".appIdToName($appIdOther).versionIdToName($versionIdOther)."\n"; + } } } else { @@ -133,6 +178,7 @@ if ($sub) "$ob->appId,". "$ob->versionId,". "$ob->userId,". + "$ob->superMaintainer,". "NOW());"; if (mysql_query($query)) @@ -213,6 +259,7 @@ else /* display the list of all outstanding maintainer requests */ //get available maintainers $query = "SELECT queueId, appId, versionId,". "userId, maintainReason,". + "superMaintainer,". "UNIX_TIMESTAMP(submitTime) as submitTime ". "from appMaintainerQueue;"; $result = mysql_query($query); @@ -243,6 +290,7 @@ else /* display the list of all outstanding maintainer requests */ echo " Username\n"; echo " Application Name\n"; echo " Version\n"; + echo " Super maintainer?\n"; echo " Submitter Email\n"; echo "  \n"; echo "\n\n"; @@ -256,7 +304,17 @@ else /* display the list of all outstanding maintainer requests */ echo " $ob->queueId\n"; echo " ".lookupUsername($ob->userId)."\n"; echo " ".appIdToName($ob->appId)."\n"; - echo " ".versionIdToName($ob->versionId)."  \n"; + + if($ob->superMaintainer) + { + echo "N/A\n"; + echo "Yes\n"; + } else + { + echo "".versionIdToName($ob->versionId)."  \n"; + echo "No\n"; + } + echo " ".lookupEmail($ob->userId)."  \n"; echo " [reject]\n"; echo "\n\n"; diff --git a/admin/adminMaintainers.php b/admin/adminMaintainers.php index 9eb1e69..9aa8d3f 100644 --- a/admin/adminMaintainers.php +++ b/admin/adminMaintainers.php @@ -69,6 +69,7 @@ if ($sub) echo " Username\n"; echo " Application Name\n"; echo " Version\n"; + echo " Super maintainer?\n"; echo " \n"; echo "  \n"; echo "\n\n"; @@ -80,10 +81,20 @@ if ($sub) echo "\n"; echo " ".date("Y-n-t h:i:sa", $ob->submitTime)."  \n"; echo " ".lookupUsername($ob->userId)."\n"; - echo " ".appIdToName($ob->appId)."\n"; - echo " ".versionIdToName($ob->versionId)." \n"; + + if(isSuperMaintainer($ob->appId)) + { + echo " ".appIdToName($ob->appId)."\n"; + echo " ".versionIdToName($ob->versionId)." \n"; + } else + { + echo " ".appIdToName($ob->appId)."\n"; + echo " ".versionIdToName($ob->versionId)." \n"; + } + echo " ".lookupEmail($ob->userId)."  \n"; echo " [delete]\n"; + echo " echo "\n\n"; $c++; } diff --git a/appview.php b/appview.php index 61c9b5c..0fc8e80 100644 --- a/appview.php +++ b/appview.php @@ -31,32 +31,29 @@ function admin_menu() $m = new htmlmenu("Admin"); if($versionId) { - $m->add("Add Note", $apidb_root."admin/addAppNote.php?appId=$appId&versionId=$versionId"); - $m->addmisc(" "); + $m->add("Add Note", $apidb_root."admin/addAppNote.php?appId=$appId&versionId=$versionId"); + $m->addmisc(" "); - $m->add("Edit Version", $apidb_root."admin/editAppVersion.php?appId=$appId&versionId=$versionId"); + $m->add("Edit Version", $apidb_root."admin/editAppVersion.php?appId=$appId&versionId=$versionId"); - $url = $apidb_root."admin/deleteAny.php?what=appVersion&versionId=$versionId&confirmed=yes"; - $m->add("Delete Version", "javascript:deleteURL(\"Are you sure?\", \"".$url."\")"); - - } - else + $url = $apidb_root."admin/deleteAny.php?what=appVersion&versionId=$versionId&confirmed=yes"; + $m->add("Delete Version", "javascript:deleteURL(\"Are you sure?\", \"".$url."\")"); + } else { - $m->add("Add Version", $apidb_root."admin/addAppVersion.php?appId=$appId"); - $m->addmisc(" "); + $m->add("Add Version", $apidb_root."admin/addAppVersion.php?appId=$appId"); + $m->addmisc(" "); - $m->add("Edit App", $apidb_root."admin/editAppFamily.php?appId=$appId"); + $m->add("Edit App", $apidb_root."admin/editAppFamily.php?appId=$appId"); - // global admin options - if(havepriv("admin")) - { - $url = $apidb_root."admin/deleteAny.php?what=appFamily&appId=$appId&confirmed=yes"; - $m->add("Delete App", "javascript:deleteURL(\"Are you sure?\", \"".$url."\")"); - $m->addmisc(" "); - $m->add("Edit Owners", $apidb_root."admin/editAppOwners.php?appId=$appId"); - $m->add("Edit Bundle", $apidb_root."admin/editBundle.php?bundleId=$appId"); + // global admin options + if(havepriv("admin")) + { + $url = $apidb_root."admin/deleteAny.php?what=appFamily&appId=$appId&confirmed=yes"; + $m->add("Delete App", "javascript:deleteURL(\"Are you sure?\", \"".$url."\")"); + $m->addmisc(" "); + $m->add("Edit Owners", $apidb_root."admin/editAppOwners.php?appId=$appId"); + $m->add("Edit Bundle", $apidb_root."admin/editBundle.php?bundleId=$appId"); } - } $m->done(); @@ -74,7 +71,7 @@ function get_screenshot_img($appId, $versionId) if(!$result || !mysql_num_rows($result)) { - $imgFile = "No Screenshot"; + $imgFile = "No Screenshot"; } else { @@ -154,7 +151,7 @@ function display_notes($appId, $versionId = 0) if(!$result || mysql_num_rows($result) == 0) { // do nothing - return; + return; } echo " Notes\n"; @@ -172,10 +169,10 @@ function display_notes($appId, $versionId = 0) } //display row - if (havepriv("admin") || isMaintainer($appId,$versionId) ) - echo " $c. ".substr(stripslashes($ob->noteTitle),0,30)."
\n"; - else - echo " $c. ".substr(stripslashes($ob->noteTitle),0,30)."
\n"; + if (havepriv("admin") || isMaintainer($appId,$versionId) ) + echo " $c. ".substr(stripslashes($ob->noteTitle),0,30)."
\n"; + else + echo " $c. ".substr(stripslashes($ob->noteTitle),0,30)."
\n"; $c++; } @@ -187,7 +184,6 @@ function display_versions($appId, $versions) { if ($versions) { - echo html_frame_start("","98%","",0); echo "\n\n"; @@ -200,33 +196,33 @@ function display_versions($appId, $versions) echo "\n\n"; $c = 0; - while(list($idx, $ver) = each($versions)) - { - //set row color - $bgcolor = ($c % 2 == 0) ? "color0" : "color1"; + while(list($idx, $ver) = each($versions)) + { + //set row color + $bgcolor = ($c % 2 == 0) ? "color0" : "color1"; - //format desc - $desc = substr(stripslashes($ver->description),0,75); - if(strlen($desc) == 75) - $desc .= " ..."; + //format desc + $desc = substr(stripslashes($ver->description),0,75); + if(strlen($desc) == 75) + $desc .= " ..."; - //get ratings - $r_win = rating_stars_for_version($ver->versionId, "windows"); - $r_fake = rating_stars_for_version($ver->versionId, "fake"); + //get ratings + $r_win = rating_stars_for_version($ver->versionId, "windows"); + $r_fake = rating_stars_for_version($ver->versionId, "fake"); - //count comments - $r_count = count_comments($appId,$ver->versionId); + //count comments + $r_count = count_comments($appId,$ver->versionId); - //display row - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n\n"; + //display row + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n\n"; - $c++; + $c++; } echo "
".$ver->versionName."$desc  $r_win$r_fake$r_count
".$ver->versionName."$desc  $r_win$r_fake$r_count
\n"; @@ -247,108 +243,160 @@ if(!is_numeric($appId)) if($appId && !$versionId) { - $app = new Application($appId); - $data = $app->data; - if(!$data) { - // Oops! application not found or other error. do something - errorpage('Internal Database Access Error'); - exit; - } + $app = new Application($appId); + $data = $app->data; + if(!$data) + { + // Oops! application not found or other error. do something + errorpage('Internal Database Access Error'); + exit; + } - // Show Vote Menu - if(loggedin()) - apidb_sidebar_add("vote_menu"); + // Show Vote Menu + if(loggedin()) + apidb_sidebar_add("vote_menu"); - // Show Admin Menu - if(loggedin() && (havepriv("admin") || $current->ownsApp($appId))) { - apidb_sidebar_add("admin_menu"); - } + // Show Admin Menu + if(loggedin() && (havepriv("admin") || $current->ownsApp($appId))) + apidb_sidebar_add("admin_menu"); - // header - apidb_header("Viewing App - ".$data->appName); + // header + apidb_header("Viewing App - ".$data->appName); - //cat display - display_catpath($app->data->catId); + //cat display + display_catpath($app->data->catId); - //set Vendor - $vendor = $app->getVendor(); + //set Vendor + $vendor = $app->getVendor(); - //set URL - $appLinkURL = ($data->webPage) ? "".substr(stripslashes($data->webPage),0,30)."": " "; + //set URL + $appLinkURL = ($data->webPage) ? "".substr(stripslashes($data->webPage),0,30)."": " "; - //set Image - $img = get_screenshot_img($appId, $versionId); + //set Image + $img = get_screenshot_img($appId, $versionId); - //start display application - echo html_frame_start("","98%","",0); + //start display application + echo html_frame_start("","98%","",0); - echo '',"\n"; - echo '',"\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "
Name ".stripslashes($data->appName)."
Vendor ". - " ".stripslashes($vendor->vendorName)."  \n"; - echo "
BUGS ". - " Check for bugs in bugzilla  \n"; - echo "
\n"; + echo " \n"; + echo " "; + echo " \n"; + echo "
\n"; + + echo ' ',"\n"; + echo " \n"; + echo " \n"; //display notes display_notes($appId); //main URL - echo "\n"; + echo " \n"; //optional links $result = mysql_query("SELECT * FROM appData WHERE appId = $appId AND type = 'url'"); if($result && mysql_num_rows($result) > 0) - { - echo "\n"; - } + { + echo " ".substr(stripslashes($ob->description),0,30)."
\n"; + } + echo " \n"; + } // display app owner $result = mysql_query("SELECT * FROM appOwners WHERE appId = $appId"); if($result && mysql_num_rows($result) > 0) - { - echo "\n"; + echo " \n"; - } + echo " ".substr(stripslashes($foo->username),0,30)."
\n"; + } + } + echo " \n"; + } + echo "
Name ".stripslashes($data->appName)."
Vendor ". + " ".stripslashes($vendor->vendorName)."  \n"; + echo "
BUGS ". + " Check for bugs in bugzilla  \n"; + echo "
URL".$appLinkURL."
URL".$appLinkURL."
Links\n"; + { + echo "
Links\n"; while($ob = mysql_fetch_object($result)) - { - echo " ".substr(stripslashes($ob->description),0,30)."
\n"; - } - echo "
Owner\n"; + { + echo "
Owner\n"; while($ob = mysql_fetch_object($result)) - { - $inResult = mysql_query("SELECT username,email FROM user_list WHERE userid = $ob->ownerId"); + { + $inResult = mysql_query("SELECT username,email FROM user_list WHERE userid = $ob->ownerId"); if ($inResult && mysql_num_rows($inResult) > 0) { $foo = mysql_fetch_object($inResult); - echo " ".substr(stripslashes($foo->username),0,30)."
\n"; - } - } - echo "
\n"; /* close of name/vendor/bugs/url table */ - echo "
"; - echo " Submit New Version  \n"; - echo "
\n"; - echo "
\n"; + // Display all supermaintainers maintainers of this application + echo " \n"; + echo " \n"; + $other_maintainers = getSuperMaintainersUserIdsFromAppId($appId); + if($other_maintainers) + { + while(list($index, list($userIdValue)) = each($other_maintainers)) + { + echo " \n"; + } + } else + { + echo " \n"; + } - //Desc - echo "
Super maintainers:
\n"; + echo "
  • ".lookupUsername($userIdValue)."
  • No maintainers.Volunteer today!
    Description
    \n"; - echo add_br(stripslashes($data->description)); + // Display the app maintainer button + echo "
    \n"; + if(loggedin()) + { + /* are we already a maintainer? */ + if(isSuperMaintainer($appId, $versionId)) /* yep */ + { + echo '
    '; + } else /* nope */ + { + echo ' '; + } - echo "
    \n"; - - echo html_frame_end("For more details and user comments, view the versions of this application."); + echo " "; + echo " "; + echo " "; /* set superMaintainer to 1 because we are at the appFamily level */ + echo " "; + } else + { + echo ' '; + } + echo "
    \n"; /* close of super maintainers table */ - //display versions - display_versions($appId,$app->getAppVersionList()); + echo " \n"; - //display bundle - display_bundle($appId); + echo " \n"; + echo "
    Submit New Version  
    \n"; + echo " \n"; - // disabled for now - //log_application_visit($appId); + echo " \n"; + echo " \n"; /* close the table that contains the whole left hand side of the upper table */ + + //Desc + echo " \n"; + echo "
    Description
    \n"; + echo add_br(stripslashes($data->description)); + + echo "
    \n"; + + echo html_frame_end("For more details and user comments, view the versions of this application."); + + //display versions + display_versions($appId,$app->getAppVersionList()); + + //display bundle + display_bundle($appId); + + // disabled for now + //log_application_visit($appId); } else if($appId && $versionId) { @@ -436,13 +484,23 @@ else if($appId && $versionId) echo "
    "; if(loggedin()) { - /* are we already a maintainer? */ - if(isMaintainer($appId, $versionId)) /* yep */ + /* is this user a maintainer of this version by virtue of being a super maintainer */ + /* of this app family? */ + if(isSuperMaintainer($appId) && !isMaintainer($appId, $versionId)) { - echo '
    '; - } else /* nope */ + echo ''; + echo ""; + } else { - echo ''; + /* are we already a maintainer? */ + if(isMaintainer($appId, $versionId)) /* yep */ + { + echo ''; + echo ""; + } else /* nope */ + { + echo ''; + } } echo ""; diff --git a/include/comments.php b/include/comments.php index 4ddfb09..7d6f2a4 100644 --- a/include/comments.php +++ b/include/comments.php @@ -37,6 +37,8 @@ function forum_lookup_user ($userid) */ function view_app_comment($ob) { + global $apidb_root; + echo html_frame_start('','98%'); echo '',"\n"; @@ -69,10 +71,11 @@ function view_app_comment($ob) if(havepriv("admin") || isMaintainer($ob->appId, $ob->versionId)) { echo ""; - echo '","\n"; + echo "blahblahblah $apidb_root"; echo ""; } diff --git a/include/maintainer.php b/include/maintainer.php index a7cf405..bd7de4b 100644 --- a/include/maintainer.php +++ b/include/maintainer.php @@ -5,7 +5,7 @@ */ function getAppsFromUserId($userId) { - $result = mysql_query("SELECT appId, versionId FROM ". + $result = mysql_query("SELECT appId, versionId, superMaintainer FROM ". "appMaintainers WHERE userId = '$userId'"); if(mysql_num_rows($result) == 0) return; @@ -14,7 +14,7 @@ function getAppsFromUserId($userId) $c = 0; while($row = mysql_fetch_object($result)) { - $retval[$c] = array($row->appId, $row->versionId); + $retval[$c] = array($row->appId, $row->versionId, $row->superMaintainer); $c++; } @@ -44,4 +44,27 @@ function getMaintainersUserIdsFromAppIdVersionId($appId, $versionId) return $retval; } +/* + * get the userIds of super maintainers for this appId + */ +function getSuperMaintainersUserIdsFromAppId($appId) +{ + $query = "SELECT userId FROM ". + "appMaintainers WHERE appId = '$appId' " . + "AND superMaintainer = '1';"; + $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; +} + ?> \ No newline at end of file diff --git a/include/sidebar_login.php b/include/sidebar_login.php index 427dbd6..559886a 100644 --- a/include/sidebar_login.php +++ b/include/sidebar_login.php @@ -28,9 +28,12 @@ function global_sidebar_login() { { $g->addmisc(""); $g->addmisc("You maintain:\n"); - while(list($index, list($appId, $versionId)) = each($apps_user_maintains)) + while(list($index, list($appId, $versionId, $superMaintainer)) = each($apps_user_maintains)) { - $g->addmisc("".appIdToName($appId)." ".versionIdToName($versionId)."", "center"); + if($superMaintainer) + $g->addmisc("".appIdToName($appId)."*", "center"); + else + $g->addmisc("".appIdToName($appId)." ".versionIdToName($versionId)."", "center"); } } } diff --git a/include/user.php b/include/user.php index 98d7fea..c79310f 100644 --- a/include/user.php +++ b/include/user.php @@ -226,6 +226,13 @@ class User { if(!loggedin() || !$this->userid) return false; + /* if this user is a super maintainer of this appid then they */ + /* are a maintainer of all of the versionId's of it as well */ + if($this->is_super_maintainer($appId)) + { + return true; + } + $query = "SELECT * FROM appMaintainers WHERE userid = '$this->userid' AND appId = '$appId' AND versionId = '$versionId'"; $result = mysql_query($query, $this->link); if(!$result) @@ -233,6 +240,22 @@ class User { return mysql_num_rows($result); } + /* + * check if this user is an maintainer of a given appId/versionId + */ + function is_super_maintainer($appId) + { + global $current; + if(!loggedin() || !$this->userid) + return false; + + $query = "SELECT * FROM appMaintainers WHERE userid = '$this->userid' AND appId = '$appId' AND superMaintainer = 1"; + $result = mysql_query($query, $this->link); + if(!$result) + return 0; + return mysql_num_rows($result); + } + function addpriv($priv) { if(!$this->userid || !$priv) @@ -302,6 +325,16 @@ function isMaintainer($appId, $versionId) return $current->is_maintainer($appId, $versionId); } +function isSuperMaintainer($appId) +{ + global $current; + + if(!loggedin()) + return false; + + return $current->is_super_maintainer($appId); +} + function debugging() { global $current; diff --git a/maintainerdelete.php b/maintainerdelete.php index e3ec2f7..7bbc270 100644 --- a/maintainerdelete.php +++ b/maintainerdelete.php @@ -16,9 +16,14 @@ opendb(); $appId = strip_tags($_POST['appId']); $versionId = strip_tags($_POST['versionId']); $confirmed = strip_tags($_POST['confirmed']); +$superMaintainer = strip_tags($_POST['superMaintainer']); // header -apidb_header("Confirm maintainer resignation of ".appIdToName($appId).versionIdToName($versionId)); + +if($superMaintainer) + apidb_header("Confirm supermaintainer resignation of ".appIdToName($appId)); +else + apidb_header("Confirm maintainer resignation of ".appIdToName($appId).versionIdToName($versionId)); if($confirmed) { @@ -26,11 +31,20 @@ if($confirmed) echo html_frame_start("Removing",400,"",0); - $query = "DELETE FROM appMaintainers WHERE appId = '$appId' AND versionId = '$versionId' AND userId = '$current->userid';"; + if($superMaintainer) + $query = "DELETE FROM appMaintainers WHERE userId = '$current->userid' AND appId = '$appId' AND superMaintainer = '$superMaintainer';"; + else + $query = "DELETE FROM appMaintainers WHERE userId = '$current->userid' AND appId = '$appId' AND versionId = '$versionId' AND superMaintainer = '$superMaintainer';"; + + echo "$query"; + $result = mysql_query($query); if($result) { - echo "You were removed as a maintainer of ".appIdToName($appId).versionIdToName($versionId); + if($superMaintainer) + echo "You were removed as a supermaintainer of ".appIdToName($appId); + else + echo "You were removed as a maintainer of ".appIdToName($appId).versionIdToName($versionId); } else { //error @@ -44,9 +58,19 @@ if($confirmed) echo "
    ',"\n"; + echo "\n"; echo "commentId>"; echo "appId>"; echo "versionId>
    \n"; echo ""; echo ""; + echo ""; echo ""; - echo "\n"; - echo '\n"; + echo '\n"; + echo '
    Are you sure that you want to be removed as a maintainer of this application?
    ', "\n"; + + if($superMaintainer) + { + echo "
    Are you sure that you want to be removed as a super maintainer of this application?
    ', "\n"; + } else + { + echo "
    Are you sure that you want to be removed as a maintainer of this application?
    ', "\n"; + } + echo "
    "; } diff --git a/maintainersubmit.php b/maintainersubmit.php index 44e72a4..9352b40 100644 --- a/maintainersubmit.php +++ b/maintainersubmit.php @@ -36,6 +36,7 @@ opendb(); $appId = strip_tags($_POST['appId']); $versionId = strip_tags($_POST['versionId']); +$superMaintainer = strip_tags($_POST['superMaintainer']); /* if the user is already a maintainer don't add them again */ if(isMaintainer($appId, $versionId)) @@ -44,6 +45,13 @@ if(isMaintainer($appId, $versionId)) exit; } +/* if this user is a super maintainer they maintain all of the versionIds of this appId */ +if(isSuperMaintainer($appId)) +{ + echo "You are already a supermaintainer of the whole application family!"; + exit; +} + if($_REQUEST['maintainReason']) { // check the input for empty/invalid fields @@ -55,14 +63,18 @@ if($_REQUEST['maintainReason']) } // header - apidb_header("Submit Maintainer Request"); + if($superMaintainer) + apidb_header("Submit SuperMaintainer Request"); + else + 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'])."',". + addslashes($_REQUEST['maintainReason'])."', '". + addslashes($_REQUEST['superMaintainer'])."',". "NOW()".");"; mysql_query($query); @@ -105,9 +117,21 @@ if($_REQUEST['maintainReason']) 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 "
    "; + + /* Special message for super maintainer applications */ + if($superMaintainer) + { + echo "

    As a super maintainer you are expected to do all of this but for EVERY version of\n"; + echo "this application. We don't expect you to run every version but at least to help keep\n"; + echo "the forums clean of stale or out-of-date information\n"; + } echo "

    "; - echo html_frame_start("New Maintainer Form",400,"",0); + if($superMaintainer) + echo html_frame_start("New Super Maintainer Form",400,"",0); + else + echo html_frame_start("New Maintainer Form",400,"",0); echo "\n"; echo "',"\n"; echo ""; echo ""; - echo '',"\n"; + echo ""; + + if($superMaintainer) + echo '',"\n"; + else + echo '',"\n"; + echo '',"\n"; echo '
    "; @@ -115,7 +139,13 @@ if($_REQUEST['maintainReason']) echo '
    Why you want to and should be an app maintainer
    Why you want to and should be an app supermaintainer
    Why you want to and should be an app maintainer
    ',"\n"; diff --git a/tables/appdb_tables.sql b/tables/appdb_tables.sql index 0e8db44..a0cb87d 100644 --- a/tables/appdb_tables.sql +++ b/tables/appdb_tables.sql @@ -252,11 +252,12 @@ create table appNotes ( * care for an application. */ create table appMaintainers ( - maintainerId int not null auto_increment, - appId int, - versionId int, - userId int, - submitTime datetime, + maintainerId int not null auto_increment, + appId int, + versionId int, + userId int, + superMaintainer bool, + submitTime datetime, key(maintainerId) ); @@ -270,6 +271,7 @@ create table appMaintainerQueue ( versionId int, userId int, maintainReason text, + superMaintainer bool, submitTime datetime, key(queueId) );