2005-02-06 17:49:48 +00:00
|
|
|
<?php
|
|
|
|
|
/************************************/
|
|
|
|
|
/* this class represents an version */
|
|
|
|
|
/************************************/
|
|
|
|
|
|
2005-02-09 23:51:38 +00:00
|
|
|
require_once(BASE."include/note.php");
|
|
|
|
|
require_once(BASE."include/comment.php");
|
2005-02-11 01:34:16 +00:00
|
|
|
require_once(BASE."include/url.php");
|
2005-02-19 01:19:07 +00:00
|
|
|
require_once(BASE."include/screenshot.php");
|
2005-07-13 01:14:53 +00:00
|
|
|
require_once(BASE."include/bugs.php");
|
2005-02-09 23:51:38 +00:00
|
|
|
|
2005-02-06 17:49:48 +00:00
|
|
|
/**
|
|
|
|
|
* Version class for handling versions.
|
|
|
|
|
*/
|
|
|
|
|
class Version {
|
|
|
|
|
var $iVersionId;
|
|
|
|
|
var $iAppId;
|
|
|
|
|
var $sName;
|
|
|
|
|
var $sDescription;
|
|
|
|
|
var $sTestedRelease;
|
|
|
|
|
var $sTestedRating;
|
2005-02-07 23:21:33 +00:00
|
|
|
var $sSubmitTime;
|
2005-02-06 17:49:48 +00:00
|
|
|
var $iSubmitterId;
|
2005-02-07 23:21:33 +00:00
|
|
|
var $sDate;
|
2005-08-15 03:44:03 +00:00
|
|
|
var $sQueued;
|
2005-02-06 17:49:48 +00:00
|
|
|
var $aNotesIds; // an array that contains the noteId of every note linked to this version
|
2005-02-09 23:51:38 +00:00
|
|
|
var $aCommentsIds; // an array that contains the commentId of every comment linked to this version
|
2005-02-06 17:49:48 +00:00
|
|
|
var $aScreenshotsIds; // an array that contains the screenshotId of every screenshot linked to this version
|
|
|
|
|
var $aUrlsIds; // an array that contains the screenshotId of every url linked to this version
|
2005-07-13 01:14:53 +00:00
|
|
|
var $aBuglinkIds; // an array that contains the buglinkId of every bug linked to this version
|
2005-02-06 17:49:48 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* constructor, fetches the data.
|
|
|
|
|
*/
|
|
|
|
|
function Version($iVersionId = null)
|
|
|
|
|
{
|
|
|
|
|
// we are working on an existing version
|
2005-03-23 23:56:38 +00:00
|
|
|
if(is_numeric($iVersionId))
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* We fetch the data related to this version.
|
|
|
|
|
*/
|
2005-10-26 02:14:17 +00:00
|
|
|
if(!$this->iVersionId)
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
|
|
|
|
$sQuery = "SELECT *
|
|
|
|
|
FROM appVersion
|
|
|
|
|
WHERE versionId = ".$iVersionId;
|
|
|
|
|
if($hResult = query_appdb($sQuery))
|
|
|
|
|
{
|
|
|
|
|
$oRow = mysql_fetch_object($hResult);
|
|
|
|
|
$this->iVersionId = $iVersionId;
|
|
|
|
|
$this->iAppId = $oRow->appId;
|
|
|
|
|
$this->iCatId = $oRow->catId;
|
|
|
|
|
$this->iSubmitterId = $oRow->submitterId;
|
2005-02-07 23:21:33 +00:00
|
|
|
$this->sSubmitTime = $oRow->submitTime;
|
2005-02-06 17:49:48 +00:00
|
|
|
$this->sDate = $oRow->submitTime;
|
|
|
|
|
$this->sName = $oRow->versionName;
|
|
|
|
|
$this->sKeywords = $oRow->keywords;
|
|
|
|
|
$this->sDescription = $oRow->description;
|
2005-02-09 23:57:44 +00:00
|
|
|
$this->sTestedRelease = $oRow->maintainer_release;
|
|
|
|
|
$this->sTestedRating = $oRow->maintainer_rating;
|
2005-02-06 17:49:48 +00:00
|
|
|
$this->sWebpage = $oRow->webPage;
|
2005-08-15 03:44:03 +00:00
|
|
|
$this->sQueued = $oRow->queued;
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* We fetch notesIds.
|
|
|
|
|
*/
|
2005-02-09 23:53:25 +00:00
|
|
|
$this->aNotesIds = array();
|
2005-02-06 17:49:48 +00:00
|
|
|
$sQuery = "SELECT noteId
|
|
|
|
|
FROM appNotes
|
|
|
|
|
WHERE versionId = ".$iVersionId;
|
|
|
|
|
if($hResult = query_appdb($sQuery))
|
|
|
|
|
{
|
|
|
|
|
while($oRow = mysql_fetch_object($hResult))
|
|
|
|
|
{
|
2005-02-09 23:51:38 +00:00
|
|
|
$this->aNotesIds[] = $oRow->noteId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* We fetch commentsIds.
|
|
|
|
|
*/
|
2005-02-11 01:34:16 +00:00
|
|
|
$this->aCommentsIds = array();
|
2005-02-09 23:51:38 +00:00
|
|
|
$sQuery = "SELECT commentId
|
|
|
|
|
FROM appComments
|
|
|
|
|
WHERE versionId = ".$iVersionId;
|
|
|
|
|
if($hResult = query_appdb($sQuery))
|
|
|
|
|
{
|
|
|
|
|
while($oRow = mysql_fetch_object($hResult))
|
|
|
|
|
{
|
|
|
|
|
$this->aCommentsIds[] = $oRow->commentId;
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* We fetch screenshotsIds and urlsIds.
|
|
|
|
|
*/
|
2005-02-09 23:53:25 +00:00
|
|
|
$this->aScreenshotsIds = array();
|
|
|
|
|
$this->aUrlsIds = array();
|
2005-02-06 17:49:48 +00:00
|
|
|
$sQuery = "SELECT id, type
|
|
|
|
|
FROM appData
|
|
|
|
|
WHERE versionId = ".$iVersionId;
|
|
|
|
|
|
|
|
|
|
if($hResult = query_appdb($sQuery))
|
|
|
|
|
{
|
|
|
|
|
while($oRow = mysql_fetch_object($hResult))
|
|
|
|
|
{
|
|
|
|
|
if($oRow->type="image")
|
|
|
|
|
$this->aScreenshotsIds[] = $oRow->id;
|
|
|
|
|
else
|
2005-02-09 23:53:25 +00:00
|
|
|
$this->aUrlsIds[] = $oRow->id;
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
2005-07-13 01:14:53 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* We fetch Bug linkIds.
|
|
|
|
|
*/
|
|
|
|
|
$this->aBuglinkIds = array();
|
|
|
|
|
$sQuery = "SELECT *
|
|
|
|
|
FROM buglinks
|
|
|
|
|
WHERE versionId = ".$iVersionId."
|
|
|
|
|
ORDER BY bug_id";
|
|
|
|
|
if($hResult = query_appdb($sQuery))
|
|
|
|
|
{
|
|
|
|
|
while($oRow = mysql_fetch_object($hResult))
|
|
|
|
|
{
|
|
|
|
|
$this->aBuglinkIds[] = $oRow->linkId;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a new version.
|
|
|
|
|
*/
|
2005-10-10 02:37:55 +00:00
|
|
|
function create()
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
2005-10-26 02:09:49 +00:00
|
|
|
if(!$_SESSION['current']->canCreateVersion())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if($_SESSION['current']->versionCreatedMustBeQueued($this))
|
2005-08-15 03:44:03 +00:00
|
|
|
$this->sQueued = 'true';
|
2005-02-06 17:49:48 +00:00
|
|
|
else
|
2005-08-15 03:44:03 +00:00
|
|
|
$this->sQueued = 'false';
|
2005-02-06 17:49:48 +00:00
|
|
|
|
2005-10-10 02:37:55 +00:00
|
|
|
$aInsert = compile_insert_string(array( 'versionName' => $this->sName,
|
|
|
|
|
'description' => $this->sDescription,
|
|
|
|
|
'maintainer_release'=> $this->sTestedRelease,
|
|
|
|
|
'maintainer_rating' => $this->sTestedRating,
|
|
|
|
|
'appId' => $this->iAppId,
|
2005-02-17 01:18:13 +00:00
|
|
|
'submitterId' => $_SESSION['current']->iUserId,
|
2005-08-15 03:44:03 +00:00
|
|
|
'queued' => $this->sQueued ));
|
2005-02-06 17:49:48 +00:00
|
|
|
$sFields = "({$aInsert['FIELDS']})";
|
|
|
|
|
$sValues = "({$aInsert['VALUES']})";
|
|
|
|
|
|
|
|
|
|
if(query_appdb("INSERT INTO appVersion $sFields VALUES $sValues", "Error while creating a new version."))
|
|
|
|
|
{
|
|
|
|
|
$this->iVersionId = mysql_insert_id();
|
|
|
|
|
$this->version($this->iVersionId);
|
2005-09-30 01:55:51 +00:00
|
|
|
$this->SendNotificationMail();
|
2005-02-06 17:49:48 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else
|
2005-10-10 02:37:55 +00:00
|
|
|
{
|
2005-02-06 17:49:48 +00:00
|
|
|
return false;
|
2005-10-10 02:37:55 +00:00
|
|
|
}
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Update version.
|
2005-02-09 02:17:31 +00:00
|
|
|
* FIXME: Use compile_update_string instead of addslashes.
|
2005-02-06 17:49:48 +00:00
|
|
|
* Returns true on success and false on failure.
|
|
|
|
|
*/
|
2005-10-10 02:37:55 +00:00
|
|
|
function update()
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
2005-02-09 23:51:38 +00:00
|
|
|
$sWhatChanged = "";
|
|
|
|
|
|
2005-10-26 02:09:49 +00:00
|
|
|
if(!$_SESSION['current']->hasAppVersionModifyPermission($this))
|
|
|
|
|
return;
|
|
|
|
|
|
2005-10-10 02:37:55 +00:00
|
|
|
$oVersion = new Version($this->iVersionId);
|
|
|
|
|
|
|
|
|
|
if ($this->sName && ($this->sName!=$oVersion->sName))
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
2005-10-10 02:37:55 +00:00
|
|
|
$sUpdate = compile_update_string(array('versionName' => $this->sName));
|
2005-02-09 23:51:38 +00:00
|
|
|
if (!query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
|
2005-02-06 17:49:48 +00:00
|
|
|
return false;
|
2005-10-10 02:37:55 +00:00
|
|
|
$sWhatChanged .= "Name was changed from:\n\t'".$oVersion->sName."'\nto:\n\t'".$this->sName."'\n\n";
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
|
|
|
|
|
2005-10-10 02:37:55 +00:00
|
|
|
if ($this->sDescription && ($this->sDescription!=$oVersion->sDescription))
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
2005-10-10 02:37:55 +00:00
|
|
|
$sUpdate = compile_update_string(array('description' => $this->sDescription));
|
2005-02-09 23:51:38 +00:00
|
|
|
if (!query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
|
2005-02-06 17:49:48 +00:00
|
|
|
return false;
|
2005-05-11 00:58:58 +00:00
|
|
|
|
2005-10-10 02:37:55 +00:00
|
|
|
if($oVersion->sDescription != "")
|
|
|
|
|
$sWhatChanged .= "Description was changed from\n ".$oVersion->sDescription."\n to \n".$this->sDescription.".\n\n";
|
2005-05-11 00:58:58 +00:00
|
|
|
else
|
2005-10-10 02:37:55 +00:00
|
|
|
$sWhatChanged .= "Description was changed to \n".$this->sDescription.".\n\n";
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
|
|
|
|
|
2005-10-10 02:37:55 +00:00
|
|
|
if ($this->sTestedRelease && ($this->sTestedRelease!=$oVersion->sTestedRelease))
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
2005-10-16 19:03:12 +00:00
|
|
|
$sUpdate = compile_update_string(array('maintainer_release' => $this->sTestedRelease));
|
2005-02-09 23:51:38 +00:00
|
|
|
if (!query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
|
2005-02-06 17:49:48 +00:00
|
|
|
return false;
|
2005-05-11 00:58:58 +00:00
|
|
|
|
2005-10-10 02:37:55 +00:00
|
|
|
if($oVersion->sTestedRelease != "")
|
|
|
|
|
$sWhatChanged .= "Last tested release was changed from ".$oVersion->sTestedRelease." to ".$this->sTestedRelease.".\n\n";
|
2005-05-11 00:58:58 +00:00
|
|
|
else
|
2005-10-10 02:37:55 +00:00
|
|
|
$sWhatChanged .= "Last tested release was changed to ".$this->sTestedRelease.".\n\n";
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
|
|
|
|
|
2005-10-10 02:37:55 +00:00
|
|
|
if ($this->sTestedRating && ($this->sTestedRating!=$oVersion->sTestedRating))
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
2005-10-10 02:37:55 +00:00
|
|
|
$sUpdate = compile_update_string(array('maintainer_rating' => $this->sTestedRating));
|
2005-10-16 04:24:37 +00:00
|
|
|
if (!query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
|
2005-02-06 17:49:48 +00:00
|
|
|
return false;
|
2005-05-09 22:10:51 +00:00
|
|
|
|
2005-05-10 02:48:02 +00:00
|
|
|
if($this->sTestedRating != "")
|
2005-10-10 02:37:55 +00:00
|
|
|
$sWhatChanged .= "Rating was changed from ".$oVersion->sTestedRating." to ".$this->sTestedRating.".\n\n";
|
2005-05-09 22:10:51 +00:00
|
|
|
else
|
2005-10-10 02:37:55 +00:00
|
|
|
$sWhatChanged .= "Rating was changed to ".$this->sTestedRating.".\n\n";
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
|
|
|
|
|
2005-10-10 02:37:55 +00:00
|
|
|
if ($this->iAppId && ($this->iAppId!=$oVersion->iAppId))
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
2005-10-10 02:37:55 +00:00
|
|
|
$sUpdate = compile_update_string(array('appId' => $this->iAppId));
|
2005-02-11 01:34:16 +00:00
|
|
|
if (!query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
|
2005-02-06 17:49:48 +00:00
|
|
|
return false;
|
2005-10-10 02:37:55 +00:00
|
|
|
$oAppBefore = new Application($oVersion->iAppId);
|
|
|
|
|
$oAppAfter = new Application($this->iAppId);
|
2005-06-05 21:26:07 +00:00
|
|
|
$sWhatChanged .= "Version was moved from application ".$oAppBefore->sName." to application ".$oAppAfter->sName.".\n\n";
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
2005-10-10 02:37:55 +00:00
|
|
|
|
2005-02-09 23:51:38 +00:00
|
|
|
if($sWhatChanged)
|
2005-09-30 01:55:51 +00:00
|
|
|
$this->SendNotificationMail("edit",$sWhatChanged);
|
2005-02-06 17:49:48 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deletes the version from the database.
|
|
|
|
|
* and request the deletion of linked elements.
|
|
|
|
|
*/
|
|
|
|
|
function delete($bSilent=false)
|
|
|
|
|
{
|
2005-08-05 22:07:41 +00:00
|
|
|
/* is the current user allowed to delete this version? */
|
2005-10-26 02:09:49 +00:00
|
|
|
if(!$_SESSION['current']->canDeleteVersion($this))
|
|
|
|
|
return false;
|
2005-08-05 22:07:41 +00:00
|
|
|
|
2005-06-30 01:59:32 +00:00
|
|
|
/* remove all of the items this version contains */
|
|
|
|
|
foreach($this->aNotesIds as $iNoteId)
|
|
|
|
|
{
|
|
|
|
|
$oNote = new Note($iNoteId);
|
|
|
|
|
$oNote->delete($bSilent);
|
|
|
|
|
}
|
|
|
|
|
foreach($this->aCommentsIds as $iCommentId)
|
|
|
|
|
{
|
|
|
|
|
$oComment = new Comment($iCommentId);
|
|
|
|
|
$oComment->delete($bSilent);
|
|
|
|
|
}
|
|
|
|
|
foreach($this->aScreenshotsIds as $iScreenshotId)
|
|
|
|
|
{
|
|
|
|
|
$oScreenshot = new Screenshot($iScreenshotId);
|
|
|
|
|
$oScreenshot->delete($bSilent);
|
|
|
|
|
}
|
|
|
|
|
foreach($this->aUrlsIds as $iUrlId)
|
|
|
|
|
{
|
|
|
|
|
$oUrl = new Url($iUrlId);
|
|
|
|
|
$oUrl->delete($bSilent);
|
|
|
|
|
}
|
2005-10-26 02:09:49 +00:00
|
|
|
foreach($this->aBuglinkIds as $iBug_id)
|
2005-07-13 01:14:53 +00:00
|
|
|
{
|
|
|
|
|
$oBug = new bug($iBug_id);
|
|
|
|
|
$oBug->delete($bSilent);
|
|
|
|
|
}
|
2005-06-30 01:59:32 +00:00
|
|
|
|
|
|
|
|
// remove any maintainers for this version so we don't orphan them
|
|
|
|
|
$sQuery = "DELETE from appMaintainers WHERE versionId='".$this->iVersionId."';";
|
|
|
|
|
if(!($hResult = query_appdb($sQuery)))
|
|
|
|
|
{
|
|
|
|
|
addmsg("Error removing version maintainers for the deleted version!", "red");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* now delete the version */
|
2005-02-06 17:49:48 +00:00
|
|
|
$sQuery = "DELETE FROM appVersion
|
|
|
|
|
WHERE versionId = ".$this->iVersionId."
|
|
|
|
|
LIMIT 1";
|
2005-06-30 01:59:32 +00:00
|
|
|
if(!($hResult = query_appdb($sQuery)))
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
2005-06-30 01:59:32 +00:00
|
|
|
addmsg("Error removing the deleted version!", "red");
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
2005-06-30 01:59:32 +00:00
|
|
|
|
2005-02-06 17:49:48 +00:00
|
|
|
if(!$bSilent)
|
2005-09-30 01:55:51 +00:00
|
|
|
$this->SendNotificationMail("delete");
|
2005-05-07 18:45:33 +00:00
|
|
|
|
2005-08-15 03:44:03 +00:00
|
|
|
$this->mailSubmitter("delete");
|
2005-10-26 02:09:49 +00:00
|
|
|
|
|
|
|
|
return true;
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Move version out of the queue.
|
|
|
|
|
*/
|
|
|
|
|
function unQueue()
|
|
|
|
|
{
|
2005-10-26 02:09:49 +00:00
|
|
|
if(!$_SESSION['current']->canUnQueueVersion($this))
|
2005-08-05 22:07:41 +00:00
|
|
|
return;
|
|
|
|
|
|
2005-02-06 17:49:48 +00:00
|
|
|
// If we are not in the queue, we can't move the version out of the queue.
|
2005-08-15 03:44:03 +00:00
|
|
|
if(!$this->sQueued == 'true')
|
2005-02-06 17:49:48 +00:00
|
|
|
return false;
|
|
|
|
|
|
2005-02-07 23:21:33 +00:00
|
|
|
$sUpdate = compile_update_string(array('queued' => "false"));
|
|
|
|
|
if(query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
2005-08-15 03:44:03 +00:00
|
|
|
$this->sQueued = 'false';
|
2005-02-06 17:49:48 +00:00
|
|
|
// we send an e-mail to intersted people
|
2005-08-15 03:44:03 +00:00
|
|
|
$this->mailSubmitter("unQueue");
|
2005-09-30 01:55:51 +00:00
|
|
|
$this->SendNotificationMail();
|
2005-02-06 17:49:48 +00:00
|
|
|
|
|
|
|
|
// the version has been unqueued
|
|
|
|
|
addmsg("The version has been unqueued.", "green");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-08-15 03:44:03 +00:00
|
|
|
function Reject($bSilent=false)
|
|
|
|
|
{
|
2005-10-26 02:09:49 +00:00
|
|
|
if(!$_SESSION['current']->canRejectVersion($this))
|
2005-08-15 03:44:03 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// If we are not in the queue, we can't move the version out of the queue.
|
|
|
|
|
if(!$this->sQueued == 'true')
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
$sUpdate = compile_update_string(array('queued' => "rejected"));
|
|
|
|
|
if(query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
|
|
|
|
|
{
|
|
|
|
|
$this->sQueued = 'rejected';
|
|
|
|
|
// we send an e-mail to intersted people
|
|
|
|
|
if(!$bSilent)
|
|
|
|
|
{
|
|
|
|
|
$this->mailSubmitter("reject");
|
2005-09-30 01:55:51 +00:00
|
|
|
$this->SendNotificationMail("reject");
|
2005-08-15 03:44:03 +00:00
|
|
|
}
|
|
|
|
|
// the version has been unqueued
|
|
|
|
|
addmsg("The version has been rejected.", "green");
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-02-06 17:49:48 +00:00
|
|
|
|
2005-08-15 03:44:03 +00:00
|
|
|
function ReQueue()
|
|
|
|
|
{
|
2005-10-26 02:09:49 +00:00
|
|
|
if(!$_SESSION['current']->canRequeueVersion($this))
|
2005-08-15 03:44:03 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
$sUpdate = compile_update_string(array('queued' => "true"));
|
|
|
|
|
if(query_appdb("UPDATE appVersion SET ".$sUpdate." WHERE versionId = ".$this->iVersionId))
|
|
|
|
|
{
|
|
|
|
|
$this->sQueued = 'true';
|
|
|
|
|
// we send an e-mail to intersted people
|
2005-09-30 01:55:51 +00:00
|
|
|
$this->SendNotificationMail();
|
2005-08-15 03:44:03 +00:00
|
|
|
|
|
|
|
|
// the version has been unqueued
|
|
|
|
|
addmsg("The version has been re-submitted", "green");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mailSubmitter($sAction="add")
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
|
|
|
|
if($this->iSubmitterId)
|
|
|
|
|
{
|
|
|
|
|
$oApp = new Application($this->appId);
|
|
|
|
|
$oSubmitter = new User($this->iSubmitterId);
|
2005-08-15 03:44:03 +00:00
|
|
|
switch($sAction)
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
2005-08-15 03:44:03 +00:00
|
|
|
case "add":
|
|
|
|
|
{
|
|
|
|
|
$sSubject = "Submitted version accepted";
|
|
|
|
|
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been accepted.";
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case "reject":
|
|
|
|
|
{
|
|
|
|
|
$sSubject = "Submitted version rejected";
|
2005-10-01 00:33:01 +00:00
|
|
|
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been rejected. ";
|
|
|
|
|
$sMsg .= "Clicking on the link in this email will allow you to modify and resubmit the version. ";
|
|
|
|
|
$sMsg .= "A link to your queue of applications and versions will also show up on the left hand side of the Appdb site once you have logged in. ";
|
2005-08-15 03:44:03 +00:00
|
|
|
$sMsg .= APPDB_ROOT."admin/resubmitRejectedApps.php?sub=view&versionId=".$this->iVersionId."\n";
|
|
|
|
|
$sMsg .= "Reason given:\n";
|
|
|
|
|
$sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case "delete":
|
|
|
|
|
{
|
|
|
|
|
$sSubject = "Submitted version deleted";
|
|
|
|
|
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been deleted.";
|
|
|
|
|
$sMsg .= "Reason given:\n";
|
|
|
|
|
$sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
|
|
|
|
|
}
|
|
|
|
|
break;
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
|
|
|
|
$sMsg .= $_REQUEST['replyText']."\n";
|
|
|
|
|
$sMsg .= "We appreciate your help in making the Version Database better for all users.";
|
2005-08-15 03:44:03 +00:00
|
|
|
|
2005-02-06 17:49:48 +00:00
|
|
|
mail_appdb($oSubmitter->sEmail, $sSubject ,$sMsg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-09-30 01:55:51 +00:00
|
|
|
function SendNotificationMail($sAction="add",$sMsg=null)
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
2005-02-19 01:18:31 +00:00
|
|
|
$oApp = new Application($this->iAppId);
|
2005-02-09 23:51:38 +00:00
|
|
|
switch($sAction)
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
2005-02-09 23:51:38 +00:00
|
|
|
case "add":
|
2005-08-15 03:44:03 +00:00
|
|
|
if($this->sQueued == "false")
|
2005-02-09 23:51:38 +00:00
|
|
|
{
|
2005-02-19 01:18:31 +00:00
|
|
|
$sSubject = "Version ".$this->sName." of ".$oApp->sName." added by ".$_SESSION['current']->sRealname;
|
2005-02-09 23:51:38 +00:00
|
|
|
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
|
|
|
|
|
if($this->iSubmitterId)
|
|
|
|
|
{
|
|
|
|
|
$oSubmitter = new User($this->iSubmitterId);
|
|
|
|
|
$sMsg .= "This version has been submitted by ".$oSubmitter->sRealname.".";
|
|
|
|
|
$sMsg .= "\n";
|
2005-06-23 00:34:31 +00:00
|
|
|
$sMsg .= "Appdb admin reply text:\n";
|
|
|
|
|
$sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
|
2005-02-09 23:51:38 +00:00
|
|
|
}
|
|
|
|
|
addmsg("The version was successfully added into the database.", "green");
|
|
|
|
|
} else // Version queued.
|
2005-02-06 17:49:48 +00:00
|
|
|
{
|
2005-06-19 15:46:57 +00:00
|
|
|
$sSubject = "Version '".$this->sName."' of '".$oApp->sName."' submitted by ".$_SESSION['current']->sRealname;
|
2005-02-09 23:51:38 +00:00
|
|
|
$sMsg .= "This version has been queued.";
|
2005-02-06 17:49:48 +00:00
|
|
|
$sMsg .= "\n";
|
2005-08-15 03:44:03 +00:00
|
|
|
addmsg("The version you submitted will be added to the database after being reviewed.", "green");
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
2005-02-09 23:51:38 +00:00
|
|
|
break;
|
|
|
|
|
case "edit":
|
2005-06-19 15:46:57 +00:00
|
|
|
$sSubject = "'".$oApp->sName." ".$this->sName."' has been modified by ".$_SESSION['current']->sRealname;
|
2005-07-13 03:44:38 +00:00
|
|
|
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
|
2005-02-09 23:51:38 +00:00
|
|
|
addmsg("Version modified.", "green");
|
|
|
|
|
break;
|
|
|
|
|
case "delete":
|
2005-06-30 01:59:32 +00:00
|
|
|
$sSubject = "Version '".$this->sName."' of '".$oApp->sName."' has been deleted by ".$_SESSION['current']->sRealname;
|
2005-05-09 22:14:09 +00:00
|
|
|
|
|
|
|
|
/* if replyText is set we should report the reason the application was deleted */
|
|
|
|
|
if($_REQUEST['replyText'])
|
|
|
|
|
{
|
|
|
|
|
$sMsg .= "Reason given:\n";
|
|
|
|
|
$sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
|
|
|
|
|
}
|
|
|
|
|
|
2005-02-09 23:51:38 +00:00
|
|
|
addmsg("Version deleted.", "green");
|
|
|
|
|
break;
|
2005-08-15 03:44:03 +00:00
|
|
|
case "reject":
|
|
|
|
|
$sSubject = "Version '".$this->sName."' of '".$oApp->sName."' has been rejected by ".$_SESSION['current']->sRealname;
|
2005-09-21 01:26:10 +00:00
|
|
|
$sMsg .= APPDB_ROOT."admin/resubmitRejectedApps.php?sub=view&versionId=".$this->iVersionId."\n";
|
2005-08-15 03:44:03 +00:00
|
|
|
|
|
|
|
|
/* if replyText is set we should report the reason the application was rejected */
|
|
|
|
|
if($_REQUEST['replyText'])
|
|
|
|
|
{
|
|
|
|
|
$sMsg .= "Reason given:\n";
|
|
|
|
|
$sMsg .= $_REQUEST['replyText']."\n"; /* append the reply text, if there is any */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addmsg("Version rejected.", "green");
|
|
|
|
|
break;
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
|
|
|
|
$sEmail = get_notify_email_address_list(null, $this->iVersionId);
|
|
|
|
|
if($sEmail)
|
|
|
|
|
mail_appdb($sEmail, $sSubject ,$sMsg);
|
|
|
|
|
}
|
2005-10-10 02:37:55 +00:00
|
|
|
|
|
|
|
|
/* output html and the current versions information for editing */
|
|
|
|
|
/* if $editParentApplication is true that means we need to display fields */
|
|
|
|
|
/* to let the user change the parent application of this version */
|
|
|
|
|
/* otherwise, if $editParentAppliation is false, we leave them out */
|
2005-10-16 04:24:37 +00:00
|
|
|
function OutputEditor($editParentApplication, $editRatingAndRelease)
|
2005-10-10 02:37:55 +00:00
|
|
|
{
|
|
|
|
|
HtmlAreaLoaderScript(array("version_editor"));
|
|
|
|
|
echo html_frame_start("Version Form", "90%", "", 0);
|
|
|
|
|
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
|
|
|
|
|
|
2005-10-16 04:24:37 +00:00
|
|
|
echo '<input type="hidden" name="versionId" value='.$this->iVersionId.' />';
|
|
|
|
|
|
2005-10-10 02:37:55 +00:00
|
|
|
if($editParentApplication)
|
|
|
|
|
{
|
|
|
|
|
// app parent
|
|
|
|
|
$x = new TableVE("view");
|
|
|
|
|
echo '<tr valign=top><td class=color0><b>Application</b></td>', "\n";
|
|
|
|
|
echo '<td>',"\n";
|
|
|
|
|
$x->make_option_list("appId",$this->iAppId,"appFamily","appId","appName");
|
|
|
|
|
echo '</td></tr>',"\n";
|
2005-10-16 04:24:37 +00:00
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
echo '<input type="hidden" name="appId" value='.$this->iAppId.' />';
|
2005-10-10 02:37:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// version name
|
|
|
|
|
echo '<tr valign=top><td class="color0"><b>Version name</b></td>',"\n";
|
|
|
|
|
echo '<td><input size="20" type="text" name="versionName" value="'.$this->sName.'"></td></tr>',"\n";
|
|
|
|
|
|
|
|
|
|
// version description
|
|
|
|
|
echo '<tr valign=top><td class=color0><b>Version description</b></td>',"\n";
|
|
|
|
|
echo '<td><p><textarea cols="80" rows="20" id="version_editor" name="versionDescription">',"\n";
|
|
|
|
|
|
|
|
|
|
/* if magic quotes are enabled we need to strip them before we output the 'versionDescription' */
|
|
|
|
|
/* again. Otherwise we will stack up magic quotes each time the user resubmits after having */
|
|
|
|
|
/* an error */
|
|
|
|
|
if(get_magic_quotes_gpc())
|
|
|
|
|
echo stripslashes($this->sDescription).'</textarea></p></td></tr>',"\n";
|
|
|
|
|
else
|
|
|
|
|
echo $this->sDescription.'</textarea></p></td></tr>',"\n";
|
|
|
|
|
|
|
|
|
|
echo '</table>',"\n";
|
|
|
|
|
|
|
|
|
|
echo html_frame_end();
|
2005-10-16 04:24:37 +00:00
|
|
|
|
|
|
|
|
if($editRatingAndRelease)
|
|
|
|
|
{
|
|
|
|
|
echo html_frame_start("Info", "90%", "", 0);
|
|
|
|
|
echo "<table border=0 cellpadding=2 cellspacing=0>\n";
|
|
|
|
|
echo '<tr><td class="color4">Rating</td><td class="color0">',"\n";
|
|
|
|
|
make_maintainer_rating_list("maintainer_rating", $this->sTestedRating);
|
|
|
|
|
echo '</td></tr>',"\n";
|
|
|
|
|
echo '<tr><td class=color1>Release</td><td class=color0>',"\n";
|
|
|
|
|
make_bugzilla_version_list("maintainer_release", $this->sTestedRelease);
|
|
|
|
|
echo '</td></tr>',"\n";
|
|
|
|
|
echo html_table_end();
|
|
|
|
|
echo html_frame_end();
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
echo '<input type="hidden" name="maintainer_rating" value='.$this->sTestedRating.' />';
|
|
|
|
|
echo '<input type="hidden" name="maintainer_release" value='.$this->sTestedRelease.' />';
|
|
|
|
|
}
|
2005-10-10 02:37:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function CheckOutputEditorInput()
|
|
|
|
|
{
|
|
|
|
|
$errors = "";
|
|
|
|
|
|
|
|
|
|
if (empty($_REQUEST['versionName']))
|
|
|
|
|
$errors .= "<li>Please enter an application version.</li>\n";
|
|
|
|
|
|
|
|
|
|
if (empty($_REQUEST['versionDescription']))
|
|
|
|
|
$errors .= "<li>Please enter a version description.</li>\n";
|
|
|
|
|
|
|
|
|
|
return $errors;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* retrieves values from $_REQUEST that were output by OutputEditor() */
|
|
|
|
|
function GetOutputEditorValues()
|
|
|
|
|
{
|
|
|
|
|
if(get_magic_quotes_gpc())
|
|
|
|
|
{
|
2005-10-16 04:24:37 +00:00
|
|
|
$this->iAppId = stripslashes($_REQUEST['appId']);
|
|
|
|
|
$this->iVersionId = stripslashes($_REQUEST['versionId']);
|
2005-10-10 02:37:55 +00:00
|
|
|
$this->sName = stripslashes($_REQUEST['versionName']);
|
|
|
|
|
$this->sDescription = stripslashes($_REQUEST['versionDescription']);
|
2005-10-16 04:24:37 +00:00
|
|
|
|
|
|
|
|
$this->sTestedRating = stripslashes($_REQUEST['maintainer_rating']);
|
|
|
|
|
$this->sTestedRelease = stripslashes($_REQUEST['maintainer_release']);
|
2005-10-10 02:37:55 +00:00
|
|
|
} else
|
|
|
|
|
{
|
2005-10-16 04:24:37 +00:00
|
|
|
$this->iAppId = $_REQUEST['appId'];
|
|
|
|
|
$this->iVersionId = $_REQUEST['versionId'];
|
2005-10-10 02:37:55 +00:00
|
|
|
$this->sName = $_REQUEST['versionName'];
|
|
|
|
|
$this->sDescription = $_REQUEST['versionDescription'];
|
2005-10-16 04:24:37 +00:00
|
|
|
|
|
|
|
|
$this->sTestedRating = $_REQUEST['maintainer_rating'];
|
|
|
|
|
$this->sTestedRelease = $_REQUEST['maintainer_release'];
|
2005-10-10 02:37:55 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function GetDefaultVersionDescription()
|
|
|
|
|
{
|
|
|
|
|
return "<p>This is a template; enter version-specific description here</p>
|
|
|
|
|
<p>
|
|
|
|
|
<span class=\"title\">Wine compatibility</span><br />
|
|
|
|
|
<span class=\"subtitle\">What works:</span><br />
|
|
|
|
|
- settings<br />
|
|
|
|
|
- help<br />
|
|
|
|
|
<br /><span class=\"subtitle\">What doesn't work:</span><br />
|
|
|
|
|
- erasing<br />
|
|
|
|
|
<br /><span class=\"subtitle\">What was not tested:</span><br />
|
|
|
|
|
- burning<br />
|
|
|
|
|
</p>
|
|
|
|
|
<p><span class=\"title\">Tested versions</span><br /><table class=\"historyTable\" width=\"90%\" border=\"1\">
|
|
|
|
|
<thead class=\"historyHeader\"><tr>
|
|
|
|
|
<td>App. version</td><td>Wine version</td><td>Installs?</td><td>Runs?</td><td>Rating</td>
|
|
|
|
|
</tr></thead>
|
|
|
|
|
<tbody><tr>
|
|
|
|
|
<td class=\"gold\">3.23</td><td class=\"gold\">20050111</td><td class=\"gold\">yes</td><td class=\"gold\">yes</td><td class=\"gold\">Gold</td>
|
|
|
|
|
</tr><tr>
|
|
|
|
|
<td class=\"silver\">3.23</td><td class=\"silver\">20041201</td><td class=\"silver\">yes</td><td class=\"silver\">yes</td><td class=\"silver\">Silver</td>
|
|
|
|
|
</tr><tr>
|
|
|
|
|
<td class=\"bronze\">3.21</td><td class=\"bronze\">20040615</td><td class=\"bronze\">yes</td><td class=\"bronze\">yes</td><td class=\"bronze\">Bronze</td>
|
|
|
|
|
</tr></tbody></table></p><p><br /></p>";
|
2005-02-06 17:49:48 +00:00
|
|
|
}
|
|
|
|
|
?>
|