Allow users to delete their queued bug links

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-12-22 00:46:47 +01:00
committed by Chris Morgan
parent 214de5a459
commit a4720d9e4b

View File

@@ -286,37 +286,54 @@ class Bug
/* Get a list of bugs submitted by a given user */ /* Get a list of bugs submitted by a given user */
function listSubmittedBy($iUserId, $bQueued = true) function listSubmittedBy($iUserId, $bQueued = true)
{ {
$hResult = query_parameters("SELECT appFamily.appName, buglinks.versionId, appVersion.versionName, buglinks.submitTime, buglinks.bug_id FROM buglinks, appFamily, appVersion WHERE appFamily.appId = appVersion.appId AND buglinks.versionId = appVersion.versionId AND buglinks.queued = '?' AND buglinks.submitterId = '?' ORDER BY buglinks.versionId", $bQueued ? "true" : "false", $iUserId); $hResult = query_parameters("SELECT appFamily.appName, buglinks.versionId, appVersion.versionName, buglinks.submitTime, buglinks.bug_id, buglinks.linkId FROM buglinks, appFamily, appVersion WHERE appFamily.appId = appVersion.appId AND buglinks.versionId = appVersion.versionId AND buglinks.queued = '?' AND buglinks.submitterId = '?' ORDER BY buglinks.versionId", $bQueued ? "true" : "false", $iUserId);
if(!$hResult || !query_num_rows($hResult)) if(!$hResult || !query_num_rows($hResult))
return FALSE; return FALSE;
$sReturn = html_table_begin("width=\"100%\" align=\"center\""); $oTable = new Table();
$sReturn .= html_tr(array( $oTable->SetWidth("100%");
"Version", $oTable->SetAlign("center");
array("Bug #", 'width="50"'),
array("Status", 'width="80"'), // setup the table header
array("Resolution", 'width="110"'), $oTableRow = new TableRow();
"Description", $oTableRow->AddTextCell('Version');
"Submit time"), $oTableRow->AddTextCell('Bug #', 'width="50"');
"color4"); $oTableRow->AddTextCell('Status', 'width="80"');
$oTableRow->AddTextCell('Resolution', 'width="110"');
$oTableRow->AddTextCell('Description', 'Submit time');
$oTableRow->AddTextCell('Submit time');
if($bQueued)
$oTableRow->addTextCell('Action');
$oTableRow->SetClass('color4');
$oTable->AddRow($oTableRow);
for($i = 1; $oRow = query_fetch_object($hResult); $i++) for($i = 1; $oRow = query_fetch_object($hResult); $i++)
{ {
$oBug = new Bug($oRow->bug_id); $oTableRow = new TableRow();
$sReturn .= html_tr(array(
version::fullNameLink($oRow->versionId), $oTableRow->AddTextCell(version::fullNameLink($oRow->versionId));
"<a href=\"".BUGZILLA_ROOT."show_bug.cgi?id=".$oRow->bug_id."\">".$oRow->bug_id."</a>", $oTableRow->AddTextCell('<a href='.BUGZILLA_ROOT.'show_bug.cgi?id='.$oRow->bug_id.'">'.$oRow->bug_id.'</a>');
$oBug->sBug_status, $oTableRow->AddTextCell($oBug->sBug_status);
$oBug->sResolution, $oTableRow->AddTextCell($oBug->sResolution);
$oBug->sShort_desc, $oTableRow->AddTextCell($oBug->sShort_desc);
print_date(mysqldatetime_to_unixtimestamp($oRow->submitTime))), $oTableRow->AddTextCell(print_date(mysqldatetime_to_unixtimestamp($oRow->submitTime)));
($i % 2) ? "color0" : "color1");
if($bQueued)
{
$oM = new objectManager('bug');
$oM->setReturnTo(array_key_exists('REQUEST_URI', $_SERVER) ? $_SERVER['REQUEST_URI'] : "");
$shDeleteLink = '<a href="'.$oM->makeUrl('delete', $oRow->linkId, 'Delete entry').'">delete</a>';
$oTableRow->addTextCell(" [ $shDeleteLink ]");
} }
$sReturn .= html_table_end(); $oTableRow->SetClass(($i % 2 ) ? 'color0' : 'color1');
$oTable->AddRow($oTableRow);
}
return $sReturn; return $oTable->GetString();
} }
function isOpen() function isOpen()
@@ -459,6 +476,9 @@ class Bug
{ {
return true; return true;
} }
if($this->iSubmitterId == $_SESSION['current']->iUserId)
return true;
} }
return false; return false;