diff --git a/admin/adminMaintainers.php b/admin/adminMaintainers.php index b1af823..899db02 100644 --- a/admin/adminMaintainers.php +++ b/admin/adminMaintainers.php @@ -38,7 +38,8 @@ if ($_REQUEST['sub']) } else { // get available maintainers - $sQuery = "SELECT * FROM appMaintainers;"; + $sQuery = "SELECT * FROM appMaintainers, user_list where appMaintainers.userId = user_list.userid"; + $sQuery.= " ORDER BY realname;"; $hResult = query_appdb($sQuery); if(!$hResult || !mysql_num_rows($hResult)) @@ -63,10 +64,44 @@ if ($_REQUEST['sub']) echo "\n\n"; $c = 1; + $oldUserId = 0; while($ob = mysql_fetch_object($hResult)) { $oUser = new User($ob->userId); if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } + + /* if this is a new user we should print a header that has the aggregate of the applications */ + /* the user super maintains and versions they maintain */ + if($ob->userId != $oldUserId) + { + $style = "border-top:thin solid;border-bottom:thin solid"; + + echo "\n"; + echo " Maintainer summary\n"; + echo " sEmail."\">".$oUser->sRealname."\n"; + $count = $oUser->getMaintainerCount(true); + if($count == 0) + echo " \n"; + else if($count <= 1) + echo " ".$count." app\n"; + else + echo " ".$count." apps\n"; + + + $count = $oUser->getMaintainerCount(false); + if($count == 0) + echo " \n"; + else if($count <= 1) + echo " ".$count." version\n"; + else + echo " ".$count." versions\n"; + + echo "  \n"; + echo "\n\n"; + + $oldUserId = $ob->userId; + } + echo "\n"; echo " ".print_date(mysqldatetime_to_unixtimestamp($ob->submitTime))."  \n"; echo " sEmail."\">".$oUser->sRealname."\n"; diff --git a/include/user.php b/include/user.php index a2f2cba..0dd828e 100644 --- a/include/user.php +++ b/include/user.php @@ -247,6 +247,19 @@ class User { return mysql_num_rows($hResult); } + function getMaintainerCount($bSuperMaintainer) + { + if(!$this->isLoggedIn()) return 0; + + $sQuery = "SELECT count(*) as cnt from appMaintainers WHERE userid = '$this->iUserId' AND superMaintainer = '$bSuperMaintainer'"; + $hResult = query_appdb($sQuery); + if(!$hResult) + return 0; + $ob = mysql_fetch_object($hResult); + return $ob->cnt; + } + + /** * Add the user as a maintainer */