queueditems: Allow users to edit and delete their submissions

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-10-31 11:05:32 +01:00
committed by Chris Morgan
parent 8b52310051
commit 2aad57fbec

View File

@@ -14,6 +14,7 @@ class appData
var $iSubmitterId; var $iSubmitterId;
var $sSubmitTime; var $sSubmitTime;
var $sDescription; var $sDescription;
var $bQueued;
function appData($iId = null, $oRow = null, $oObject = null) function appData($iId = null, $oRow = null, $oObject = null)
{ {
@@ -31,6 +32,7 @@ class appData
$this->iVersionId = $oObject->iVersionId; $this->iVersionId = $oObject->iVersionId;
$this->sSubmitTime = $oObject->sSubmitTime; $this->sSubmitTime = $oObject->sSubmitTime;
$this->iId = $iId; $this->iId = $iId;
$this->bQueued = $oObject->bQueued;
return; return;
} }
@@ -47,6 +49,7 @@ class appData
$this->iVersionId = $oRow->versionId; $this->iVersionId = $oRow->versionId;
$this->sSubmitTime = $oRow->submitTime; $this->sSubmitTime = $oRow->submitTime;
$this->iId = $iId; $this->iId = $iId;
$this->bQueued = ($oRow->sQueued == "false") ? false : true;
$this->sDescription = $oRow->description; $this->sDescription = $oRow->description;
} }
} }
@@ -122,16 +125,26 @@ class appData
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");
"Type",
"Description", $oTableRow = new tableRow();
"Submission Date"),
"color4"); $oTableRow->addTextCell("Version");
$oTableRow->addTextCell("Type");
$oTableRow->addTextCell("Description");
$oTableRow->addTextCell("Submission Date");
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++)
{ {
$oTableRow = new tableRow();
if($oRow->versionId) if($oRow->versionId)
{ {
$oVersion = new version($oRow->versionId); $oVersion = new version($oRow->versionId);
@@ -142,17 +155,26 @@ class appData
$oApp = new application($this->appId); $oApp = new application($this->appId);
$sLink = $oApp->objectMakeLink(); $sLink = $oApp->objectMakeLink();
} }
$sReturn .= html_tr(array(
$sLink, $oTableRow->addTextCell($sLink);
$oRow->type, $oTableRow->addTextCell($oRow->type);
$oRow->description, $oTableRow->addTextCell($oRow->description);
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($oRow->type);
$oM->setReturnTo(array_key_exists('REQUEST_URI', $_SERVER) ? $_SERVER['REQUEST_URI'] : "");
$shDeleteLink = '<a href="'.$oM->makeUrl("delete", $oRow->id, "Delete entry").'">delete</a>';
$shEditLink = '<a href="'.$oM->makeUrl("edit", $oRow->id, "Edit entry").'">edit</a>';
$oTableRow->addTextCell("[ $shEditLink ] &nbsp; [ $shDeleteLink ]");
}
$oTableRow->setClass(($i % 2) ? "color0" : "color1");
$oTable->addRow($oTableRow);
} }
$sReturn .= html_table_end(""); return $oTable->getString();
return $sReturn;
} }
@@ -448,6 +470,9 @@ class appData
return TRUE; return TRUE;
if($this) if($this)
{ {
if($this->bQueued && $this->iSubmitterId == $_SESSION['current']->iUserId)
return true;
if($this->iVersionId) if($this->iVersionId)
{ {
$oVersion = new version($this->iVersionId); $oVersion = new version($this->iVersionId);