diff --git a/admin/adminBugs.php b/admin/adminBugs.php new file mode 100644 index 0000000..5dedab2 --- /dev/null +++ b/admin/adminBugs.php @@ -0,0 +1,185 @@ +hasPriv("admin")) +{ + errorpage("Insufficient privileges."); + exit; +} + +if ($_REQUEST['sub']) +{ + if(($_REQUEST['sub'] == 'delete' ) && ($_REQUEST['buglinkId'])) + { + $oBuglink = new bug($_REQUEST['buglinkId']); + $oBuglink->delete(); + } + if(($_REQUEST['sub'] == 'unqueue' ) && ($_REQUEST['buglinkId'])) + { + $oBuglink = new bug($_REQUEST['buglinkId']); + $oBuglink->unqueue(); + } + redirect($_SERVER['PHP_SELF']."?ItemsPerPage=".$_REQUEST['ItemsPerPage']."&QueuedOnly=".$_REQUEST['QueuedOnly']."&page=".$_REQUEST['page']); + exit; +} + +{ + apidb_header("Administer Bugs"); + + $pageRange = 10; + $ItemsPerPage = 10; + $currentPage = 1; + $QueuedOnly = !isset($_REQUEST['QueuedOnly'])? NULL: $_REQUEST['QueuedOnly']; + $BugLinks = ($QueuedOnly == 'on')?getNumberOfQueuedBugLinks():getNumberOfBugLinks(); + if($_REQUEST['ItemsPerPage']) + $ItemsPerPage = $_REQUEST['ItemsPerPage']; + + if($_REQUEST['page']) + $currentPage = $_REQUEST['page']; + + $ItemsPerPage = min($ItemsPerPage,100); + $totalPages = max(ceil($BugLinks/$ItemsPerPage),1); + $currentPage = min($currentPage,$totalPages); + $offset = (($currentPage-1) * $ItemsPerPage); + + /* display page selection links */ + echo '
',"\n"; + echo '
',"\n"; + echo 'Page '.$currentPage.' of '.$totalPages.'
',"\n"; + display_page_range($currentPage, $pageRange, $totalPages, $_SERVER['PHP_SELF']."?ItemsPerPage=".$ItemsPerPage."&QueuedOnly=".$QueuedOnly); + echo '
',"\n"; + echo '
',"\n"; + + /* display the option to choose how many comments per-page to display */ + echo ''; + + echo 'Number of Bug Links per page: '; + echo '',"\n"; + + echo '
',"\n"; + echo 'View queued links only: ',"\n"; + echo '
',"\n"; + echo '',"\n"; + + echo '
',"\n"; + echo '
',"\n"; + + echo '',"\n"; + echo '',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo '',"\n"; + if ($QueuedOnly == 'on') + { + $sWhere = "WHERE appFamily.appId = appVersion.appId + AND buglinks.versionId = appVersion.versionId + AND buglinks.bug_id = ".BUGZILLA_DB.".bugs.bug_id + AND buglinks.queued = 'true'"; + } else + { + $sWhere = "WHERE appFamily.appId = appVersion.appId + AND buglinks.versionId = appVersion.versionId + AND buglinks.bug_id = ".BUGZILLA_DB.".bugs.bug_id"; + } + $sQuery = "SELECT appFamily.description as appDescription, + appFamily.appName as appName, appVersion.*, + buglinks.versionId as versionId, + buglinks.bug_id as bug_id, + buglinks.linkId as linkId, + buglinks.queued as queued, + bugs.* + FROM appFamily, appVersion, buglinks, bugs.bugs + ".$sWhere." + ORDER BY buglinks.bug_id, appName, versionName"; + $sQuery = "SELECT appFamily.description as appDescription, + appFamily.appName as appName, appVersion.*, + buglinks.versionId as versionId, + buglinks.bug_id as bug_id, + buglinks.linkId as linkId, + buglinks.queued as queued, + bugs.* + FROM appFamily, appVersion, buglinks, bugs.bugs + ".$sWhere." + ORDER BY buglinks.bug_id, appName, versionName + LIMIT ".$offset.", ".$ItemsPerPage.";"; + + $c = 0; + + if($hResult = query_appdb($sQuery)) + { + while($oRow = mysql_fetch_object($hResult)) + { + // set row color + $bgcolor = ($c % 2 == 0) ? "color0" : "color1"; + echo '',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + echo ' ',"\n"; + $bQueued = ($oRow->queued=="true")?true:false; + if ($bQueued) + { + echo '',"\n"; + } else + { + echo '',"\n"; + } + echo '',"\n"; + $c++; + } + } + + echo "
Bug #StatusBug DescriptionApplication NameAplication Descriptionversiondeletechecked
',"\n"; + echo ' '.$oRow->bug_id.'',"\n"; + echo ' '.$oRow->bug_status.''.$oRow->short_desc.'',"\n"; + echo ' '.$oRow->appName.'',"\n"; + echo ' '.$oRow->appDescription.'',"\n"; + echo ' '.$oRow->versionName.'',"\n"; + echo ' [delete][OK]Yes
","\n"; + echo "
","\n"; + display_page_range($currentPage, $pageRange, $totalPages, $_SERVER['PHP_SELF']."?ItemsPerPage=".$ItemsPerPage."&QueuedOnly=".$QueuedOnly); + echo "
","\n"; + + apidb_footer(); +} +?>