Alexander Nicolaysen Sørnes <alex@thehandofagony.com>
Let objectManager handle deletion and delete notification.
This commit is contained in:
@@ -18,19 +18,6 @@ echo '<form name="sQform" action="adminMaintainers.php" method="post" enctype="m
|
|||||||
|
|
||||||
if (isset($aClean['sSub']))
|
if (isset($aClean['sSub']))
|
||||||
{
|
{
|
||||||
if($aClean['sSub'] == 'delete')
|
|
||||||
{
|
|
||||||
$oMaintainer = new maintainer($aClean['iMaintainerId']);
|
|
||||||
$oMaintainer->delete();
|
|
||||||
echo html_frame_start("Delete maintainer: ".$aClean['iMaintainerId'],400,"",0);
|
|
||||||
if($hResult)
|
|
||||||
{
|
|
||||||
// success
|
|
||||||
echo "<p>Maintainer was successfully deleted</p>\n";
|
|
||||||
}
|
|
||||||
echo html_frame_end(" ");
|
|
||||||
echo html_back_link(1,'adminMaintainers.php');
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// get available maintainers
|
// get available maintainers
|
||||||
@@ -115,7 +102,7 @@ if (isset($aClean['sSub']))
|
|||||||
$oVersion = new version($oRow->versionId);
|
$oVersion = new version($oRow->versionId);
|
||||||
echo " <td>".$oVersion->objectMakeLink()."</td>\n";
|
echo " <td>".$oVersion->objectMakeLink()."</td>\n";
|
||||||
}
|
}
|
||||||
echo " <td align=\"center\">[<a href='adminMaintainers.php?sSub=delete&iMaintainerId=$oRow->maintainerId'>delete</a>]</td>\n";
|
echo " <td align=\"center\">[<a href='".BASE."objectManager.php?sClass=maintainer&iId=$oRow->maintainerId&bIsQueue=false&sTitle=Admin%20Maintainers&sAction=delete&sReturnTo=".APPDB_ROOT."admin/adminMaintainers.php'>delete</a>]</td>\n";
|
||||||
echo "</tr>\n\n";
|
echo "</tr>\n\n";
|
||||||
$c++;
|
$c++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ class Application {
|
|||||||
* Deletes the application from the database.
|
* Deletes the application from the database.
|
||||||
* and request the deletion of linked elements.
|
* and request the deletion of linked elements.
|
||||||
*/
|
*/
|
||||||
function delete($bSilent=false)
|
function delete()
|
||||||
{
|
{
|
||||||
$bSuccess = true;
|
$bSuccess = true;
|
||||||
|
|
||||||
@@ -257,14 +257,6 @@ class Application {
|
|||||||
if(!($hResult = query_parameters($sQuery, $this->iAppId)))
|
if(!($hResult = query_parameters($sQuery, $this->iAppId)))
|
||||||
$bSuccess = false;
|
$bSuccess = false;
|
||||||
|
|
||||||
if(!$bSilent)
|
|
||||||
{
|
|
||||||
$this->SendNotificationMail("delete");
|
|
||||||
|
|
||||||
if(!$bSuccess)
|
|
||||||
addmsg("Error deleting application", "red");
|
|
||||||
}
|
|
||||||
|
|
||||||
return $bSuccess;
|
return $bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,6 +334,43 @@ class Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->iSubmitterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return new mailOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
if($bMailSubmitter)
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
$sSubject = "Submitted application deleted";
|
||||||
|
$sMsg = "The application you submitted (".$this->sName.
|
||||||
|
") has been deleted.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aMailTo = null;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
$sSubject = $this->sName." deleted";
|
||||||
|
$sMsg = "The application '".$this->sName."' has been deleted.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aMailTo = User::get_notify_email_address_list($this->iAppId);
|
||||||
|
}
|
||||||
|
return array($sSubject, $sMsg, $aMailTo);
|
||||||
|
}
|
||||||
|
|
||||||
function mailSubmitter($sAction="add")
|
function mailSubmitter($sAction="add")
|
||||||
{
|
{
|
||||||
global $aClean;
|
global $aClean;
|
||||||
@@ -368,11 +397,6 @@ class Application {
|
|||||||
"Edit+Application\n";
|
"Edit+Application\n";
|
||||||
$sMsg .= "Reason given:\n";
|
$sMsg .= "Reason given:\n";
|
||||||
break;
|
break;
|
||||||
case "delete":
|
|
||||||
$sSubject = "Submitted application deleted";
|
|
||||||
$sMsg = "The application you submitted (".$this->sName.") has been deleted by ".$_SESSION['current']->sRealname.".";
|
|
||||||
$sMsg .= "Reason given:\n";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sMsg .= $aClean['sReplyText']."\n";
|
$sMsg .= $aClean['sReplyText']."\n";
|
||||||
@@ -455,18 +479,6 @@ class Application {
|
|||||||
$sMsg .= $this->objectMakeUrl()."\n";
|
$sMsg .= $this->objectMakeUrl()."\n";
|
||||||
addmsg("Application modified.", "green");
|
addmsg("Application modified.", "green");
|
||||||
break;
|
break;
|
||||||
case "delete":
|
|
||||||
$sSubject = $this->sName." has been deleted by ".$_SESSION['current']->sRealname;
|
|
||||||
|
|
||||||
// if sReplyText is set we should report the reason the application was deleted
|
|
||||||
if($aClean['sReplyText'])
|
|
||||||
{
|
|
||||||
$sMsg .= "Reason given:\n";
|
|
||||||
$sMsg .= $aClean['sReplyText']."\n"; // append the reply text, if there is any
|
|
||||||
}
|
|
||||||
|
|
||||||
addmsg("Application deleted.", "green");
|
|
||||||
break;
|
|
||||||
case "reject":
|
case "reject":
|
||||||
$sSubject = $this->sName." has been rejected by ".$_SESSION['current']->sRealname;
|
$sSubject = $this->sName." has been rejected by ".$_SESSION['current']->sRealname;
|
||||||
$sMsg .= APPDB_ROOT."objectManager.php?sClass=application_queue".
|
$sMsg .= APPDB_ROOT."objectManager.php?sClass=application_queue".
|
||||||
@@ -698,8 +710,8 @@ class Application {
|
|||||||
}
|
}
|
||||||
if($_SESSION['current']->hasPriv("admin"))
|
if($_SESSION['current']->hasPriv("admin"))
|
||||||
{
|
{
|
||||||
$url = BASE."admin/deleteAny.php?sWhat=appFamily&iAppId=".$this->iAppId."&sConfirmed=yes";
|
$url = BASE."objectManager.php?sClass=application&bIsQueue=false&sAction=delete&sTitle=Delete%20".$this->sName."&iId=".$this->iAppId;
|
||||||
echo " <form method=\"post\" name=\"sEdit\" action=\"javascript:deleteURL('Are you sure?', '".$url."')\"><input type=\"submit\" value=\"Delete App\" class=\"button\"></form>";
|
echo " <form method=\"post\" name=\"sEdit\" action=\"javascript:self.location = '".$url."'\"><input type=\"submit\" value=\"Delete App\" class=\"button\"></form>";
|
||||||
echo ' <form method="post" name="sEdit" action="admin/editBundle.php"><input type="hidden" name="iBundleId" value="'.$this->iAppId.'"><input type="submit" value="Edit Bundle" class="button"></form>';
|
echo ' <form method="post" name="sEdit" action="admin/editBundle.php"><input type="hidden" name="iBundleId" value="'.$this->iAppId.'"><input type="submit" value="Edit Bundle" class="button"></form>';
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -132,6 +132,26 @@ class application_queue
|
|||||||
return $bSuccess;
|
return $bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetChildren()
|
||||||
|
{
|
||||||
|
return $this->oApp->objectGetChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->oApp->objectGetSubmitterId();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return $this->oApp->objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return $this->oApp->objectGetMail($sAction, $bMailSubmitter, $bParentAction);
|
||||||
|
}
|
||||||
|
|
||||||
function outputEditor()
|
function outputEditor()
|
||||||
{
|
{
|
||||||
/* We ask the user for the application name first so as to avoid duplicate
|
/* We ask the user for the application name first so as to avoid duplicate
|
||||||
|
|||||||
@@ -98,6 +98,30 @@ class browse_newest_apps
|
|||||||
return array($aItemsPerPage, $iDefaultPerPage);
|
return array($aItemsPerPage, $iDefaultPerPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetChildren()
|
||||||
|
{
|
||||||
|
$oApp = new application($this->iAppId);
|
||||||
|
return $oApp->objectGetChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
$oApp = new application($this->iAppId);
|
||||||
|
return $oApp->objectGetSubmitterId();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
$oApp = new application($this->iAppId);
|
||||||
|
return $oApp->objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
$oApp = new application($this->iAppId);
|
||||||
|
return $oApp->objectGetMail($sAction, $bMailSubmitter, $bParentAction);
|
||||||
|
}
|
||||||
|
|
||||||
function objectGetId()
|
function objectGetId()
|
||||||
{
|
{
|
||||||
return $this->iAppId;
|
return $this->iAppId;
|
||||||
|
|||||||
@@ -151,24 +151,12 @@ class Bug
|
|||||||
*
|
*
|
||||||
* Return true if successful, false if an error occurs
|
* Return true if successful, false if an error occurs
|
||||||
*/
|
*/
|
||||||
function delete($bSilent=false)
|
function delete()
|
||||||
{
|
{
|
||||||
$sQuery = "DELETE FROM buglinks
|
$sQuery = "DELETE FROM buglinks
|
||||||
WHERE linkId = '?'";
|
WHERE linkId = '?'";
|
||||||
if($hResult = query_parameters($sQuery, $this->iLinkId))
|
if(!($hResult = query_parameters($sQuery, $this->iLinkId)))
|
||||||
{
|
|
||||||
if(!$bSilent)
|
|
||||||
$this->SendNotificationMail(true);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if($this->iSubmitterId &&
|
|
||||||
($this->iSubmitterId != $_SESSION['current']->iUserId))
|
|
||||||
{
|
|
||||||
$this->mailSubmitter(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -269,6 +257,22 @@ class Bug
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->iSubmitterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return new mailOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
/* We don't do this at the moment */
|
||||||
|
return array(null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
function objectGetChildren()
|
function objectGetChildren()
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
|
|||||||
@@ -163,13 +163,18 @@ class Comment {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getOutputEditorValues($aClean)
|
||||||
|
{
|
||||||
|
/* Stub */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the current comment from the database.
|
* Removes the current comment from the database.
|
||||||
* Informs interested people about the deletion.
|
* Informs interested people about the deletion.
|
||||||
* Returns true on success and false on failure.
|
* Returns true on success and false on failure.
|
||||||
*/
|
*/
|
||||||
function delete($bSilent = false)
|
function delete()
|
||||||
{
|
{
|
||||||
$hResult = query_parameters("DELETE FROM appComments WHERE commentId = '?'", $this->iCommentId);
|
$hResult = query_parameters("DELETE FROM appComments WHERE commentId = '?'", $this->iCommentId);
|
||||||
if ($hResult)
|
if ($hResult)
|
||||||
@@ -178,57 +183,11 @@ class Comment {
|
|||||||
$hResult = query_parameters("UPDATE appComments set parentId = '?' WHERE parentId = '?'",
|
$hResult = query_parameters("UPDATE appComments set parentId = '?' WHERE parentId = '?'",
|
||||||
$this->iParentId, $this->iCommentId);
|
$this->iParentId, $this->iCommentId);
|
||||||
|
|
||||||
if(!$bSilent)
|
|
||||||
{
|
|
||||||
$this->SendNotificationMail("delete");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
addmsg("Error removing the deleted comment!", "red");
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function SendNotificationMail($sAction="add", $sMsg = null)
|
|
||||||
{
|
|
||||||
global $aClean;
|
|
||||||
|
|
||||||
// use 'sReplyText' if it is defined, otherwise define the value as an empty string
|
|
||||||
if(!isset($aClean['sReplyText']))
|
|
||||||
$aClean['sReplyText'] = "";
|
|
||||||
|
|
||||||
$oApp = new Application($this->iAppId);
|
|
||||||
switch($sAction)
|
|
||||||
{
|
|
||||||
case "delete":
|
|
||||||
$sSubject = "Comment for '".version::fullName($this->iVersionId)."' deleted by ".$_SESSION['current']->sRealname;
|
|
||||||
$oVersion = new version($this->iVersionId);
|
|
||||||
$sMsg = $oVersion->objectMakeUrl()."\n";
|
|
||||||
$sMsg .= "\n";
|
|
||||||
$sMsg .= "This comment was made on ".substr($this->sDateCreated,0,10)." by ".$this->oOwner->sRealname."\n";
|
|
||||||
$sMsg .= "\n";
|
|
||||||
$sMsg .= "Subject: ".$this->sSubject."\r\n";
|
|
||||||
$sMsg .= "\n";
|
|
||||||
$sMsg .= $this->sBody."\r\n";
|
|
||||||
$sMsg .= "\n";
|
|
||||||
$sMsg .= "Because:\n";
|
|
||||||
if($sReason)
|
|
||||||
$sMsg .= $sReason."\n";
|
|
||||||
else
|
|
||||||
$sMsg .= "No reason given.\n";
|
|
||||||
|
|
||||||
addmsg("Comment deleted.", "green");
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sEmail = User::get_notify_email_address_list($this->iAppId, $this->iVersionId);
|
|
||||||
$sEmail .= $this->oOwner->sEmail;
|
|
||||||
if($sEmail)
|
|
||||||
mail_appdb($sEmail, $sSubject, $sMsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_comment_count_for_versionid($iVersionId)
|
function get_comment_count_for_versionid($iVersionId)
|
||||||
@@ -280,9 +239,15 @@ class Comment {
|
|||||||
|| $_SESSION['current']->isMaintainer($oRow->versionId)
|
|| $_SESSION['current']->isMaintainer($oRow->versionId)
|
||||||
|| $_SESSION['current']->isSuperMaintainer($oRow->appId))
|
|| $_SESSION['current']->isSuperMaintainer($oRow->appId))
|
||||||
{
|
{
|
||||||
|
$oVersion = new version($oRow->versionId);
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<td><form method=\"post\" name=\"sMessage\" action=\"".BASE."deletecomment.php\"><input type=\"submit\" value=\"Delete\" class=\"button\">\n";
|
echo "<td><form method=\"post\" name=\"sMessage\" action=\"".BASE."objectManager.php\"><input type=\"submit\" value=\"Delete\" class=\"button\">\n";
|
||||||
echo "<input type=\"hidden\" name=\"iCommentId\" value=\"$oRow->commentId\" />";
|
echo "<input type=\"hidden\" name=\"iId\" value=\"$oRow->commentId\" />";
|
||||||
|
echo "<input type=\"hidden\" name=\"sClass\" value=\"comment\" />";
|
||||||
|
echo "<input type=\"hidden\" name=\"bQueued\" value=\"false\" />";
|
||||||
|
echo "<input type=\"hidden\" name=\"sAction\" value=\"delete\" />";
|
||||||
|
echo "<input type=\"hidden\" name=\"sTitle\" value=\"Delete comment\" />";
|
||||||
|
echo "<input type=\"hidden\" name=\"sReturnTo\" value=\"".$oVersion->objectMakeUrl()."\" />";
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
}
|
}
|
||||||
@@ -386,6 +351,86 @@ class Comment {
|
|||||||
echo "</ul>\n";
|
echo "</ul>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function canEdit()
|
||||||
|
{
|
||||||
|
return $_SESSION['current']->hasPriv("admin");
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetId()
|
||||||
|
{
|
||||||
|
return $this->iCommentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->oOwner->iUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
$oOptions = new mailOptions();
|
||||||
|
|
||||||
|
if($sAction == "delete" && $bParentAction)
|
||||||
|
$oOptions->bMailOnce = TRUE;
|
||||||
|
|
||||||
|
return $oOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
$sSubject = "";
|
||||||
|
$sMessage = "";
|
||||||
|
$aRecipients = null;
|
||||||
|
|
||||||
|
$oVersion = new version($this->iVersionId);
|
||||||
|
$sVerName = version::fullName($this->iVersionId);
|
||||||
|
|
||||||
|
if($bMailSubmitter)
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
if($bParentAction)
|
||||||
|
{
|
||||||
|
$sSubject = "Comments for $sVerName deleted";
|
||||||
|
$sMessage = "Your comments for $sVerName were deleted because the";
|
||||||
|
$sMessage .= "version was removed from the database";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$sSubject = "Comment for $sVerName deleted";
|
||||||
|
$sMessage = $oVersion->objectMakeUrl()."\n";
|
||||||
|
$sMessage .= "\n";
|
||||||
|
$sMessage .= "This comment was made on ".substr($this->sDateCreated,0,10)."\n";
|
||||||
|
$sMessage .= "\n";
|
||||||
|
$sMessage .= "Subject: ".$this->sSubject."\r\n";
|
||||||
|
$sMessage .= "\n";
|
||||||
|
$sMessage .= $this->sBody."\r\n";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
if(!$bParentAction)
|
||||||
|
{
|
||||||
|
$sSubject = "Comment for $sVerName deleted";
|
||||||
|
$sMessage = $oVersion->objectMakeUrl()."\n";
|
||||||
|
$sMessage .= "\n";
|
||||||
|
$sMessage .= "This comment was made on ".substr($this->sDateCreated,0,10)." by ".$this->oOwner->sRealname."\n";
|
||||||
|
$sMessage .= "\n";
|
||||||
|
$sMessage .= "Subject: ".$this->sSubject."\r\n";
|
||||||
|
$sMessage .= "\n";
|
||||||
|
$sMessage .= $this->sBody."\r\n";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aRecipients = User::get_notify_email_address_list($this->iAppId, $this->iVersionId);
|
||||||
|
}
|
||||||
|
return array($sSubject, $sMessage, $aRecipients);
|
||||||
|
}
|
||||||
|
|
||||||
function objectGetChildren()
|
function objectGetChildren()
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ class distribution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete Distributution.
|
// Delete Distributution.
|
||||||
function delete($bSilent=false)
|
function delete()
|
||||||
{
|
{
|
||||||
/* Is the current user allowed to delete this distribution? We allow
|
/* Is the current user allowed to delete this distribution? We allow
|
||||||
everyone to delete a queued, empty distribution, because it should be
|
everyone to delete a queued, empty distribution, because it should be
|
||||||
@@ -172,16 +172,6 @@ class distribution {
|
|||||||
if(!($hResult = query_parameters($sQuery, $this->iDistributionId)))
|
if(!($hResult = query_parameters($sQuery, $this->iDistributionId)))
|
||||||
$bSuccess = FALSE;
|
$bSuccess = FALSE;
|
||||||
|
|
||||||
if(!$bSilent)
|
|
||||||
{
|
|
||||||
$this->SendNotificationMail("delete");
|
|
||||||
|
|
||||||
if(!$bSuccess)
|
|
||||||
addmsg("Error deleting distribution", "delete");
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->mailSubmitter("delete");
|
|
||||||
|
|
||||||
return $bSuccess;
|
return $bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,6 +273,46 @@ class distribution {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->iSubmitterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return new mailOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
$oSubmitter = new user($this->iSubmitterId);
|
||||||
|
|
||||||
|
if($bMailSubmitter)
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
$sSubject = "Submitted distribution deleted";
|
||||||
|
$sMsg = "The distribution you submitted (".$this->sName.") has been ".
|
||||||
|
"deleted.\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aMailTo = null;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
$sSubject = "Distribution ".$this->sName." deleted";
|
||||||
|
$sMsg = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aMailTo = User::get_notify_email_address_list(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array($sSubject, $sMsg, $aMailTo);
|
||||||
|
}
|
||||||
|
|
||||||
function mailSubmitter($sAction="add")
|
function mailSubmitter($sAction="add")
|
||||||
{
|
{
|
||||||
global $aClean;
|
global $aClean;
|
||||||
|
|||||||
@@ -136,6 +136,22 @@ class downloadurl
|
|||||||
return $sReturn;
|
return $sReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->iSubmitterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return new mailOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
/* We don't do this at the moment */
|
||||||
|
return array(null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
/* Process data from a Download URL form */
|
/* Process data from a Download URL form */
|
||||||
function ProcessForm($aValues)
|
function ProcessForm($aValues)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -839,6 +839,77 @@ class maintainer
|
|||||||
return $sReplyTextHelp;
|
return $sReplyTextHelp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return new mailOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
$oSubmitter = new user($this->iSubmitterId);
|
||||||
|
|
||||||
|
$sVerb = $this->sQueued == "true" ? "rejected" : "removed";
|
||||||
|
|
||||||
|
if($this->bSuperMaintainer)
|
||||||
|
{
|
||||||
|
$oApp = new application($this->iAppId);
|
||||||
|
$sFor = $oApp->sName;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$sFor = version::fullName($this->iVersionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sMsg = null;
|
||||||
|
$sSubject = null;
|
||||||
|
|
||||||
|
if($bMailSubmitter)
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
$sSubject = "Maintainership for $sFor $sVerb";
|
||||||
|
if($this->sQueued == "true")
|
||||||
|
{
|
||||||
|
$sMsg = "Your request to be a maintainer of '$sFor'".
|
||||||
|
" has been denied.";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$sMsg = "You have been removed as a maintainer of ".
|
||||||
|
"'$sFor'.";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aMailTo = null;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
if(!$bParentAction)
|
||||||
|
{
|
||||||
|
$sSubject = "Maintainership for $sFor $sVerb";
|
||||||
|
if($this->bQueued == "false")
|
||||||
|
{
|
||||||
|
$sMsg = $oSubmitter->sRealName." has been removed as a ".
|
||||||
|
"maintainer of $sFor.";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$sMsg = $oSubmitter->sRealName." request to be a maintainer ".
|
||||||
|
" of $sFor has been rejected.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aMailTo = User::get_notify_email_address_list(null, null);
|
||||||
|
}
|
||||||
|
return array($sSubject, $sMsg, $aMailTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->iUserId;
|
||||||
|
}
|
||||||
|
|
||||||
function objectHideDelete()
|
function objectHideDelete()
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
@@ -100,16 +100,75 @@ class Monitor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->iUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return new mailOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
$sSubject = null;
|
||||||
|
$sMsg = null;
|
||||||
|
|
||||||
|
if($this->iVersionId)
|
||||||
|
{
|
||||||
|
$sWhat = "version";
|
||||||
|
$sName = version::fullName($this->iVersionId);
|
||||||
|
$oVersion = new version($this->iVersionId);
|
||||||
|
$sUrl = $oVersion->objectMakeUrl();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$sWhat = "application";
|
||||||
|
$oApp = new application($this->iAppId);
|
||||||
|
$sName = $oApp->sName;
|
||||||
|
$sUrl = $oApp->objectMakeUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($bMailSubmitter)
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
if($bParentActino)
|
||||||
|
{
|
||||||
|
$sSubject = "Monitored $sWhat deleted";
|
||||||
|
$sMsg = "The $sWhat $sName which you monitored has been ".
|
||||||
|
"deleted by ".$_SESSION['current']->iUserId.".";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aMailTo = null;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$oUser = new user($this->iUserId);
|
||||||
|
$sUser = $oUser->sName;
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
if(!$bParentAction)
|
||||||
|
{
|
||||||
|
$sSubject = "Monitor for $sName removed: $sUser";
|
||||||
|
$sMsg = $sUrl;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
User::get_notify_email_address_list(null, $this->iVersionId);
|
||||||
|
}
|
||||||
|
return array($sSubject, $sMsg, $aMailTo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the current Monitor from the database.
|
* Removes the current Monitor from the database.
|
||||||
* Informs interested people about the deletion.
|
* Informs interested people about the deletion.
|
||||||
*/
|
*/
|
||||||
function delete($bSilent=false)
|
function delete()
|
||||||
{
|
{
|
||||||
$hResult = query_parameters("DELETE FROM appMonitors WHERE monitorId = '?'", $this->iMonitorId);
|
$hResult = query_parameters("DELETE FROM appMonitors WHERE monitorId = '?'", $this->iMonitorId);
|
||||||
if(!$bSilent)
|
|
||||||
$this->SendNotificationMail("delete");
|
|
||||||
|
|
||||||
if(!$hResult)
|
if(!$hResult)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -126,13 +126,14 @@ class Note {
|
|||||||
*
|
*
|
||||||
* Returns: true if successful, false if not
|
* Returns: true if successful, false if not
|
||||||
*/
|
*/
|
||||||
function delete($bSilent=false)
|
function delete()
|
||||||
{
|
{
|
||||||
$hResult = query_parameters("DELETE FROM appNotes WHERE noteId = '?'", $this->iNoteId);
|
$hResult = query_parameters("DELETE FROM appNotes WHERE noteId = '?'", $this->iNoteId);
|
||||||
if(!$bSilent)
|
|
||||||
$this->SendNotificationMail("delete");
|
|
||||||
|
|
||||||
return true;
|
if(!$hResult)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -311,6 +312,22 @@ class Note {
|
|||||||
return $oManager->makeUrl("view", $this->objectGetId());
|
return $oManager->makeUrl("view", $this->objectGetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->iSubmitterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return new mailOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
/* We don't do this at the moment */
|
||||||
|
return array(null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
function objectGetChildren()
|
function objectGetChildren()
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class ObjectManager
|
|||||||
var $sTitle;
|
var $sTitle;
|
||||||
var $iId;
|
var $iId;
|
||||||
var $bIsRejected;
|
var $bIsRejected;
|
||||||
|
var $sReturnTo;
|
||||||
var $oMultiPage;
|
var $oMultiPage;
|
||||||
var $oTableRow;
|
var $oTableRow;
|
||||||
|
|
||||||
@@ -335,20 +336,228 @@ class ObjectManager
|
|||||||
"ObjectDisplayQueueProcessingHelp"));
|
"ObjectDisplayQueueProcessingHelp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete the object associated with the given id */
|
/* Ask whether the user really wants to delete the entry and display a delete reason box */
|
||||||
function delete_entry()
|
function delete_prompt()
|
||||||
{
|
{
|
||||||
$this->checkMethods(array("delete", "canEdit"));
|
$this->checkMethods(array("delete", "canEdit"));
|
||||||
|
|
||||||
$oObject = new $this->sClass($this->iId);
|
$oObject = new $this->sClass($this->iId);
|
||||||
|
|
||||||
|
/* Check permissions */
|
||||||
|
if(!$oObject->canEdit())
|
||||||
|
{
|
||||||
|
echo "<font color=\"red\">You do not have permission to delete this entry.</font>\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check whether the object exists */
|
||||||
|
if(!$oObject->objectGetId())
|
||||||
|
{
|
||||||
|
echo "<font>There is no entry with that id in the database.</font>\n";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$oTable = new Table();
|
||||||
|
$oTableRow = new TableRow();
|
||||||
|
$oTable->setAlign("center");
|
||||||
|
$oTable->addRow($oTableRow);
|
||||||
|
$oTableRow->addTextCell(
|
||||||
|
'<div style="left: 200px; width: 400px;" align="center" class="default_container">'.
|
||||||
|
'<div style="text-align: left;" class="info_container">'.
|
||||||
|
'<div class="title_class">'.
|
||||||
|
"Confirm deletion".
|
||||||
|
"</div>".
|
||||||
|
'<div class="info_contents">'.
|
||||||
|
"Are you sure you wish to delete this entry?<br />".
|
||||||
|
"Please enter a reason why so that you don’t hurt the submitter’s".
|
||||||
|
" feelings.".
|
||||||
|
"</div>".
|
||||||
|
"</div>".
|
||||||
|
|
||||||
|
'<form method="post" action="'.$this->makeUrl().'">'.
|
||||||
|
$this->makeUrlFormData().
|
||||||
|
'<input type="hidden" name="iId" value="'.$this->iId.'" />'.
|
||||||
|
'<textarea rows="15" cols="50" name="sReplyText"></textarea><br /><br />'.
|
||||||
|
'<input type="submit" value="Delete" name="sSubmit" class="button" />'.
|
||||||
|
"</form>".
|
||||||
|
"</div>");
|
||||||
|
echo $oTable->getString();
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_child($sReplyText, $bMailSubmitter, $bMailCommon)
|
||||||
|
{
|
||||||
|
$this->checkMethods(array("delete", "canEdit"));
|
||||||
|
|
||||||
|
$oObject = new $this->sClass($this->iId);
|
||||||
|
$oSubmitterMail = null;
|
||||||
|
$oCommonMail = null;
|
||||||
|
|
||||||
if(!$oObject->canEdit())
|
if(!$oObject->canEdit())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if($bMailSubmitter)
|
||||||
|
$oSubmitterMail = $this->get_mail(TRUE, "delete", TRUE);
|
||||||
|
|
||||||
|
if($bMailCommon)
|
||||||
|
$oCommonMail = $this->get_mail(FALSE, "delete", TRUE);
|
||||||
|
|
||||||
if($oObject->delete())
|
if($oObject->delete())
|
||||||
|
{
|
||||||
|
if($oCommonMail || $oSubmitterMail)
|
||||||
|
{
|
||||||
|
$sReplyText = "The parent entry was deleted. The reason given for ".
|
||||||
|
"that deletion was:\n$sReplyText";
|
||||||
|
|
||||||
|
if($oCommonMail)
|
||||||
|
$oCommonMail->send("delete", $sReplyText);
|
||||||
|
|
||||||
|
if($oSubmitterMail)
|
||||||
|
$oSubmitterMail->send("delete", $sReplyText);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Delete the object associated with the given id */
|
||||||
|
function delete_entry($sReplyText)
|
||||||
|
{
|
||||||
|
$this->checkMethods(array("delete", "canEdit"));
|
||||||
|
|
||||||
|
$oObject = new $this->sClass($this->iId);
|
||||||
|
|
||||||
|
if(!$oObject->objectGetId())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if(!$oObject->canEdit())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
$oSubmitterMail = $this->get_mail(TRUE, "delete");
|
||||||
|
$oCommonMail = $this->get_mail(FALSE, "delete");
|
||||||
|
|
||||||
|
$iFailed = 0;
|
||||||
|
$iDeleted = 0;
|
||||||
|
|
||||||
|
/* Delete children first, if there are any */
|
||||||
|
if(method_exists($oObject, "objectGetChildren"))
|
||||||
|
{
|
||||||
|
$aChildren = $oObject->objectGetChildren();
|
||||||
|
|
||||||
|
if(!is_array($aChildren))
|
||||||
|
{
|
||||||
|
addmsg("Failed to get child entries, aborting", "red");
|
||||||
util_redirect_and_exit($this->makeUrl("view", false));
|
util_redirect_and_exit($this->makeUrl("view", false));
|
||||||
else
|
}
|
||||||
echo "Failure.\n";
|
|
||||||
|
/* Keep track of whether we should send mails. This is used by the
|
||||||
|
'mail once' option */
|
||||||
|
$aSendMailSubmitter = array();
|
||||||
|
$aSendMailCommon = array();
|
||||||
|
|
||||||
|
foreach($aChildren as $oChild)
|
||||||
|
{
|
||||||
|
if(!is_object($oChild))
|
||||||
|
{
|
||||||
|
addmsg("Failed to get child entries, aborting", "red");
|
||||||
|
util_redirect_and_exit($this->makeUrl("view", false));
|
||||||
|
}
|
||||||
|
|
||||||
|
$oM = $this->om_from_object($oChild);
|
||||||
|
|
||||||
|
if(!isset($aSendMailSubmitter[$oM->sClass][$oChild->objectGetSubmitterId()]))
|
||||||
|
$aSendMailSubmitter[$oM->sClass][$oChild->objectGetSubmitterId()] = TRUE;
|
||||||
|
|
||||||
|
if(!isset($aSendMailCommon[$oM->sClass]))
|
||||||
|
$aSendMailCommon[$oM->sClass] = TRUE;
|
||||||
|
|
||||||
|
if($oM->delete_child($sReplyText, $aSendMailSubmitter[$oM->sClass][$oChild->objectGetSubmitterId()], $aSendMailCommon[$oM->sClass]))
|
||||||
|
{
|
||||||
|
$iDeleted++;
|
||||||
|
|
||||||
|
if($oChild->objectGetMailOptions("delete", TRUE, TRUE)->bMailOnce)
|
||||||
|
$aSendMailSubmitter[$oM->sClass][$oChild->objectGetSubmitterId()] = FALSE;
|
||||||
|
|
||||||
|
if($oChild->objectGetMailOptions("delete", FALSE, TRUE)->bMailOnce)
|
||||||
|
$aSendMailCommon[$oM->sClass] = FALSE;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$iFailed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($oObject->delete())
|
||||||
|
{
|
||||||
|
$oCommonMail->send("delete", $sReplyText);
|
||||||
|
|
||||||
|
if($oSubmitterMail)
|
||||||
|
$oSubmitterMail->send("delete", $sReplyText);
|
||||||
|
|
||||||
|
addmsg("Entry deleted", "green");
|
||||||
|
|
||||||
|
if($iDeleted)
|
||||||
|
addmsg("Deleted $iDeleted child entries", "green");
|
||||||
|
|
||||||
|
if($iFailed)
|
||||||
|
addmsg("Failed to delete $iFailed child entries", "red");
|
||||||
|
|
||||||
|
$this->return_to_url($this->makeUrl("view", false));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
addmsg("Failed to delete entry", "red");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the user to the url specified in the objectManager object. Fall back to a
|
||||||
|
given value if the object member is not set */
|
||||||
|
function return_to_url($sFallback)
|
||||||
|
{
|
||||||
|
$sUrl = $this->sReturnTo;
|
||||||
|
|
||||||
|
if(!$sUrl)
|
||||||
|
$sUrl = $sFallback;
|
||||||
|
|
||||||
|
util_redirect_and_exit($sUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
function om_from_object($oObject)
|
||||||
|
{
|
||||||
|
return new objectManager(get_class($oObject), "", $oObject->objectGetId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Creates a mail object using information from objectGetMail(). If bMailSubmitter
|
||||||
|
is true then we first check to see whether the submitter is the one deleting the
|
||||||
|
entry, in which case we don't send him a notification mail.
|
||||||
|
Thus it returns null if no mail is to be sent, or a Mail object otherwise.
|
||||||
|
bParentAction states whether the action was caused by a change to the parent
|
||||||
|
entry, for instance this will be true when deleting a version because we
|
||||||
|
delete its parent application. */
|
||||||
|
function get_mail($bMailSubmitter, $sAction, $bParentAction = FALSE)
|
||||||
|
{
|
||||||
|
$oObject = new $this->sClass($this->iId);
|
||||||
|
|
||||||
|
if($bMailSubmitter)
|
||||||
|
{
|
||||||
|
$iSubmitterId = $oObject->objectGetSubmitterId();
|
||||||
|
|
||||||
|
/* Should we mail the submitter? */
|
||||||
|
if($iSubmitterId && $iSubmitterId != $_SESSION['current']->iUserId)
|
||||||
|
{
|
||||||
|
return new mail($oObject->objectGetMail($sAction, $bMailSubmitter,
|
||||||
|
$bParentAction),
|
||||||
|
$iSubmitterId);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
return new mail($oObject->objectGetMail("delete", $bMailSubmitter,
|
||||||
|
$bParentAction));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move all the object's children to another object of the same type, and
|
/* Move all the object's children to another object of the same type, and
|
||||||
@@ -377,7 +586,8 @@ class ObjectManager
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->delete_entry();
|
/* The argument is the reply text */
|
||||||
|
$this->delete_entry("Duplicate entry");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display a page where the user can select which object the children of the current
|
/* Display a page where the user can select which object the children of the current
|
||||||
@@ -542,7 +752,8 @@ class ObjectManager
|
|||||||
$oObject->getOutputEditorValues($aClean);
|
$oObject->getOutputEditorValues($aClean);
|
||||||
|
|
||||||
/* Check input, if necessary */
|
/* Check input, if necessary */
|
||||||
if(method_exists(new $this->sClass, "checkOutputEditorInput"))
|
if($aClean['sSubmit'] != "Delete" &&
|
||||||
|
method_exists(new $this->sClass, "checkOutputEditorInput"))
|
||||||
{
|
{
|
||||||
$sErrors = $oObject->checkOutputEditorInput($aClean);
|
$sErrors = $oObject->checkOutputEditorInput($aClean);
|
||||||
}
|
}
|
||||||
@@ -589,7 +800,7 @@ class ObjectManager
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "Delete":
|
case "Delete":
|
||||||
$this->delete_entry();
|
$this->delete_entry($aClean['sReplyText']);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -655,6 +866,7 @@ class ObjectManager
|
|||||||
$sReturn .= "<input type=\"hidden\" name=\"bIsRejected\" value=\"$sIsRejected\" />\n";
|
$sReturn .= "<input type=\"hidden\" name=\"bIsRejected\" value=\"$sIsRejected\" />\n";
|
||||||
$sReturn .= "<input type=\"hidden\" name=\"sClass\" value=\"".$this->sClass."\" />\n";
|
$sReturn .= "<input type=\"hidden\" name=\"sClass\" value=\"".$this->sClass."\" />\n";
|
||||||
$sReturn .= "<input type=\"hidden\" name=\"sTitle\" value=\"".$this->sTitle."\" />\n";
|
$sReturn .= "<input type=\"hidden\" name=\"sTitle\" value=\"".$this->sTitle."\" />\n";
|
||||||
|
$sReturn .= "<input type=\"hidden\" name=\"sReturnTo\" value=\"".$this->sReturnTo."\" />\n";
|
||||||
|
|
||||||
if($this->oMultiPage->bEnabled)
|
if($this->oMultiPage->bEnabled)
|
||||||
{
|
{
|
||||||
@@ -839,4 +1051,67 @@ class MultiPage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class mailOptions
|
||||||
|
{
|
||||||
|
var $bMailOnce;
|
||||||
|
|
||||||
|
function mailOptions()
|
||||||
|
{
|
||||||
|
/* Set default options */
|
||||||
|
$this->bMailOnce = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class mail
|
||||||
|
{
|
||||||
|
var $sSubject;
|
||||||
|
var $sMessage;
|
||||||
|
var $aRecipients;
|
||||||
|
|
||||||
|
function mail($aInput, $iRecipientId = null)
|
||||||
|
{
|
||||||
|
if(!$aInput)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* $aInput is returned from objectGetMail(); an array with the following members
|
||||||
|
0: Mail subject
|
||||||
|
1: Mail text
|
||||||
|
2: Array of recipients
|
||||||
|
If iRecipientId is set the third array member is ignored. */
|
||||||
|
$this->sSubject = $aInput[0];
|
||||||
|
$this->sMessage = $aInput[1];
|
||||||
|
|
||||||
|
if($iRecipientId)
|
||||||
|
{
|
||||||
|
$oRecipient = new user($iRecipientId);
|
||||||
|
$this->aRecipients = array($oRecipient->sEmail);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$this->aRecipients = $aInput[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function send($sAction, $sReplyText)
|
||||||
|
{
|
||||||
|
/* We don't send empty mails */
|
||||||
|
if(!$this->sSubject && !$this->sMessage)
|
||||||
|
return;
|
||||||
|
|
||||||
|
$this->sMessage .= "\n";
|
||||||
|
|
||||||
|
$this->sMessage .= "The action was performed by ".$_SESSION['current']->sRealname."\n";
|
||||||
|
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
$this->sMessage .= "Reasons given\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->sMessage .= $sReplyText;
|
||||||
|
|
||||||
|
mail_appdb($this->aRecipients, $this->sSubject, $this->sMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class screenshot
|
|||||||
*
|
*
|
||||||
* Returns: true if deletion was success, false if otherwise
|
* Returns: true if deletion was success, false if otherwise
|
||||||
*/
|
*/
|
||||||
function delete($bSilent=false)
|
function delete()
|
||||||
{
|
{
|
||||||
/* appData has a universal function for removing database entries */
|
/* appData has a universal function for removing database entries */
|
||||||
$oAppData = new appData($this->iScreenshotId, null, $this);
|
$oAppData = new appData($this->iScreenshotId, null, $this);
|
||||||
@@ -150,13 +150,6 @@ class screenshot
|
|||||||
$sOriginalFilename = appdb_fullpath("/data/screenshots/originals/".$this->iScreenshotId);
|
$sOriginalFilename = appdb_fullpath("/data/screenshots/originals/".$this->iScreenshotId);
|
||||||
if(is_file($sOriginalFilename))
|
if(is_file($sOriginalFilename))
|
||||||
unlink($sOriginalFilename);
|
unlink($sOriginalFilename);
|
||||||
|
|
||||||
if(!$bSilent)
|
|
||||||
$this->mailMaintainers(true);
|
|
||||||
}
|
|
||||||
if($this->iSubmitterId && ($this->iSubmitterId != $_SESSION['current']->iUserId))
|
|
||||||
{
|
|
||||||
$this->mailSubmitter(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -321,6 +314,64 @@ class screenshot
|
|||||||
return $this->oThumbnailImage->get_height();
|
return $this->oThumbnailImage->get_height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->iSubmitterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
$oOptions = new mailOptions();
|
||||||
|
|
||||||
|
if($sAction == "delete" && $bParentAction)
|
||||||
|
$oOptions->bMailOnce = TRUE;
|
||||||
|
|
||||||
|
return $oOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
$sFor = version::fullName($this->iVersionId);
|
||||||
|
|
||||||
|
$sMsg = null;
|
||||||
|
$sSubject = null;
|
||||||
|
|
||||||
|
if($bMailSubmitter)
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
if($bParentAction)
|
||||||
|
{
|
||||||
|
$sSubject = "Submitter screenshots deleted";
|
||||||
|
$sMsg = "The screenshots you submitted for $sFor have been ".
|
||||||
|
"deleted because $sFor was deleted.";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$sSubject = "Submitted screenshot deleted";
|
||||||
|
$sMsg = "The screenshot with description '".$this->sDescription.
|
||||||
|
"' that you submitted for $sFor has been deleted.";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aMailTo = null;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
if(!$bParentAction)
|
||||||
|
{
|
||||||
|
$sSubject = "Screenshot for $sFor deleted";
|
||||||
|
$sMsg = "The screenshot with description '".$this->sDescription.
|
||||||
|
"' for $sFor has been deleted.";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aMailTo = User::get_notify_email_address_list(null, $this->iVersionId);
|
||||||
|
}
|
||||||
|
return array($sSubject, $sMsg, $aMailTo);
|
||||||
|
}
|
||||||
|
|
||||||
function mailSubmitter($bRejected=false)
|
function mailSubmitter($bRejected=false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ class testData{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete test results.
|
// Delete test results.
|
||||||
function delete($bSilent=false)
|
function delete()
|
||||||
{
|
{
|
||||||
// is the current user allowed to delete this test result?
|
// is the current user allowed to delete this test result?
|
||||||
$oVersion = new Version($this->iVersionId);
|
$oVersion = new Version($this->iVersionId);
|
||||||
@@ -230,12 +230,6 @@ class testData{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$bSilent)
|
|
||||||
$this->SendNotificationMail("delete");
|
|
||||||
|
|
||||||
if($this->iSubmitterId && ($this->iSubmitterId != $_SESSION['current']->iUserId))
|
|
||||||
$this->mailSubmitter("delete");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,6 +308,60 @@ class testData{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
$oOptions = new mailOptions();
|
||||||
|
|
||||||
|
if($sAction == "delete" && $bParentAction)
|
||||||
|
$oOptions->bMailOnce = TRUE;
|
||||||
|
|
||||||
|
return $oOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
$oSubmitter = new User($this->iSubmitterId);
|
||||||
|
$sName = version::fullName($this->iVersionId);
|
||||||
|
|
||||||
|
$sMsg = null;
|
||||||
|
$sSubject = null;
|
||||||
|
|
||||||
|
if($bMailSubmitter)
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
$sSubject = "Submitted test data deleted";
|
||||||
|
if($bParentAction)
|
||||||
|
{
|
||||||
|
$sMsg = "All test data you submitted for '$sName' has ".
|
||||||
|
"been deleted because '$sName' was deleted.";
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$sMsg = "The test report you submitted for '$sName' has ".
|
||||||
|
"been deleted.";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aMailTo = nulL;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
if(!$bParentAction)
|
||||||
|
{
|
||||||
|
$sSubject = "Test Results deleted for $sName by ".
|
||||||
|
$_SESSION['current']->sRealname;
|
||||||
|
$sMsg = "";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aMailTo = User::get_notify_email_address_list(null, $this->iVersionId);
|
||||||
|
}
|
||||||
|
return array($sSubject, $sMsg, $aMailTo);
|
||||||
|
}
|
||||||
|
|
||||||
function mailSubmitter($sAction="add")
|
function mailSubmitter($sAction="add")
|
||||||
{
|
{
|
||||||
global $aClean;
|
global $aClean;
|
||||||
@@ -343,12 +391,6 @@ class testData{
|
|||||||
$sMsg .= $this->objectMakeUrl()."\n";
|
$sMsg .= $this->objectMakeUrl()."\n";
|
||||||
$sMsg .= "Reason given:\n";
|
$sMsg .= "Reason given:\n";
|
||||||
break;
|
break;
|
||||||
case "delete":
|
|
||||||
$sSubject = "Submitted testing data deleted";
|
|
||||||
$sMsg = "The testing data you submitted for '$sName' has ".
|
|
||||||
"been deleted by ".$_SESSION['current']->sRealname.".";
|
|
||||||
$sMsg .= "Reason given:\n";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
$sMsg .= $aClean['sReplyText']."\n";
|
$sMsg .= $aClean['sReplyText']."\n";
|
||||||
$sMsg .= "We appreciate your help in making the Application ".
|
$sMsg .= "We appreciate your help in making the Application ".
|
||||||
@@ -400,17 +442,6 @@ class testData{
|
|||||||
$sMsg .= $sBacklink;
|
$sMsg .= $sBacklink;
|
||||||
addmsg("test data modified.", "green");
|
addmsg("test data modified.", "green");
|
||||||
break;
|
break;
|
||||||
case "delete":
|
|
||||||
$sSubject = "Test Results deleted for version ".$oVersion->sName." of ".$oApp->sName." by ".$_SESSION['current']->sRealname;
|
|
||||||
// if replyText is set we should report the reason the data was deleted
|
|
||||||
if($aClean['sReplyText'])
|
|
||||||
{
|
|
||||||
$sMsg .= "Reason given:\n";
|
|
||||||
$sMsg .= $aClean['sReplyText']."\n"; // append the reply text, if there is any
|
|
||||||
}
|
|
||||||
|
|
||||||
addmsg("test data deleted.", "green");
|
|
||||||
break;
|
|
||||||
case "reject":
|
case "reject":
|
||||||
$sSubject = "Test Results rejected for version ".$oVersion->sName." of ".$oApp->sName." by ".$_SESSION['current']->sRealname;
|
$sSubject = "Test Results rejected for version ".$oVersion->sName." of ".$oApp->sName." by ".$_SESSION['current']->sRealname;
|
||||||
$sMsg .= $sBacklink;
|
$sMsg .= $sBacklink;
|
||||||
@@ -1140,6 +1171,11 @@ class testData{
|
|||||||
{
|
{
|
||||||
return $this->iTestingId;
|
return $this->iTestingId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->iSubmitterId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -177,6 +177,26 @@ class testData_queue
|
|||||||
{
|
{
|
||||||
return $this->oTestData->objectGetId();
|
return $this->oTestData->objectGetId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->oTestData->objectGetSubmitterId();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetChildren()
|
||||||
|
{
|
||||||
|
return $this->oTestData->objectGetChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return $this->oTestData->objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return $this->oTestData->objectGetMail($sAction, $bMailSubmitter, $bParentAction);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class Url {
|
|||||||
* Deletes the url from the database.
|
* Deletes the url from the database.
|
||||||
* and request its deletion from the filesystem (including the thumbnail).
|
* and request its deletion from the filesystem (including the thumbnail).
|
||||||
*/
|
*/
|
||||||
function delete($bSilent=false)
|
function delete()
|
||||||
{
|
{
|
||||||
$sQuery = "DELETE FROM appData
|
$sQuery = "DELETE FROM appData
|
||||||
WHERE id = '?'
|
WHERE id = '?'
|
||||||
@@ -100,15 +100,6 @@ class Url {
|
|||||||
if(!$hResult = query_parameters($sQuery, $this->iUrlId))
|
if(!$hResult = query_parameters($sQuery, $this->iUrlId))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!$bSilent)
|
|
||||||
$this->SendNotificationMail(true);
|
|
||||||
|
|
||||||
if($this->iSubmitterId &&
|
|
||||||
$this->iSubmitterId != $_SESSION['current']->iUserId)
|
|
||||||
{
|
|
||||||
$this->mailSubmitter(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,11 +246,6 @@ class Url {
|
|||||||
addmsg("The url you submitted will be added to the database ".
|
addmsg("The url you submitted will be added to the database ".
|
||||||
"database after being reviewed.", "green");
|
"database after being reviewed.", "green");
|
||||||
}
|
}
|
||||||
} else // Url deleted.
|
|
||||||
{
|
|
||||||
$sSubject = "Url for $sAppName deleted by ".$_SESSION['current']->sRealname;
|
|
||||||
$sMsg = "$sUrl\n";
|
|
||||||
addmsg("Url deleted.", "green");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sEmail = User::get_notify_email_address_list(null, $this->iVersionId);
|
$sEmail = User::get_notify_email_address_list(null, $this->iVersionId);
|
||||||
@@ -456,7 +442,7 @@ class Url {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
function canEdit($iVersionId, $iAppId = NULL)
|
function canEdit($iVersionId = NULL, $iAppId = NULL)
|
||||||
{
|
{
|
||||||
if($_SESSION['current']->hasPriv("admin"))
|
if($_SESSION['current']->hasPriv("admin"))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -499,6 +485,27 @@ class Url {
|
|||||||
return $sReturn;
|
return $sReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetId()
|
||||||
|
{
|
||||||
|
return $this->iUrlId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->iSubmitterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return new mailOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
/* We don't do this at the moment */
|
||||||
|
return array(null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
function objectGetChildren()
|
function objectGetChildren()
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
|
|||||||
@@ -149,11 +149,11 @@ class Vendor {
|
|||||||
/**
|
/**
|
||||||
* Deletes the vendor from the database.
|
* Deletes the vendor from the database.
|
||||||
*/
|
*/
|
||||||
function delete($bSilent=false)
|
function delete()
|
||||||
{
|
{
|
||||||
if(sizeof($this->aApplicationsIds)>0)
|
if(sizeof($this->aApplicationsIds)>0)
|
||||||
{
|
{
|
||||||
addmsg("The vendor has not been deleted because there are still applications linked to it.", "red");
|
return FALSE;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
$sQuery = "DELETE FROM vendor
|
$sQuery = "DELETE FROM vendor
|
||||||
@@ -161,7 +161,6 @@ class Vendor {
|
|||||||
LIMIT 1";
|
LIMIT 1";
|
||||||
if(query_parameters($sQuery, $this->iVendorId))
|
if(query_parameters($sQuery, $this->iVendorId))
|
||||||
{
|
{
|
||||||
addmsg("The vendor has been deleted.", "green");
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,6 +291,29 @@ class Vendor {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return new mailOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetChildren()
|
||||||
|
{
|
||||||
|
/* We don't have any */
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
/* We don't send notification mails */
|
||||||
|
return array(null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
/* We don't record the submitter id */
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
function getOutputEditorValues($aClean)
|
function getOutputEditorValues($aClean)
|
||||||
{
|
{
|
||||||
$this->sName = $aClean['sVendorName'];
|
$this->sName = $aClean['sVendorName'];
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ class version {
|
|||||||
* Deletes the version from the database.
|
* Deletes the version from the database.
|
||||||
* and request the deletion of linked elements.
|
* and request the deletion of linked elements.
|
||||||
*/
|
*/
|
||||||
function delete($bSilent=false)
|
function delete()
|
||||||
{
|
{
|
||||||
/* We need the versionId to continue */
|
/* We need the versionId to continue */
|
||||||
if(!$this->iVersionId)
|
if(!$this->iVersionId)
|
||||||
@@ -256,19 +256,9 @@ class version {
|
|||||||
if(!$hResult)
|
if(!$hResult)
|
||||||
$bSuccess = FALSE;
|
$bSuccess = FALSE;
|
||||||
|
|
||||||
$this->mailSubmitter("delete");
|
|
||||||
|
|
||||||
if(!$bSilent)
|
|
||||||
{
|
|
||||||
if(!$bSuccess)
|
|
||||||
addmsg("Error removing version", "red");
|
|
||||||
|
|
||||||
$this->SendNotificationMail("delete");
|
|
||||||
}
|
|
||||||
return $bSuccess;
|
return $bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move version out of the queue.
|
* Move version out of the queue.
|
||||||
*/
|
*/
|
||||||
@@ -344,6 +334,46 @@ class version {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->iSubmitterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return new mailOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
$oApp = new application($this->iAppId);
|
||||||
|
|
||||||
|
if($bMailSubmitter)
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
$sSubject = "Submitted version deleted";
|
||||||
|
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.
|
||||||
|
") has been deleted.";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aMailTo = null;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "delete":
|
||||||
|
$sSubject = "Version '".$this->sName."' of '".$oApp->sName."' ".
|
||||||
|
"deleted";
|
||||||
|
$sMsg = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$aMailTo = User::get_notify_email_address_list(null, $this->iVersionId);
|
||||||
|
}
|
||||||
|
return array($sSubject, $sMsg, $aMailTo);
|
||||||
|
}
|
||||||
|
|
||||||
function mailSubmitter($sAction="add")
|
function mailSubmitter($sAction="add")
|
||||||
{
|
{
|
||||||
global $aClean; //FIXME: we should pass the sReplyText value in
|
global $aClean; //FIXME: we should pass the sReplyText value in
|
||||||
@@ -372,11 +402,6 @@ class version {
|
|||||||
"&bIsQueue=true&bIsRejected=true&iId=".$this->iVersionId."&".
|
"&bIsQueue=true&bIsRejected=true&iId=".$this->iVersionId."&".
|
||||||
"sTitle=Edit+Version\n";
|
"sTitle=Edit+Version\n";
|
||||||
break;
|
break;
|
||||||
case "delete":
|
|
||||||
$sSubject = "Submitted version deleted";
|
|
||||||
$sMsg = "The version you submitted (".$oApp->sName." ".$this->sName.") has been deleted by ".$_SESSION['current']->sRealname.".";
|
|
||||||
$sMsg .= "Reason given:\n";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
$sMsg .= $aClean['sReplyText']."\n";
|
$sMsg .= $aClean['sReplyText']."\n";
|
||||||
$sMsg .= "We appreciate your help in making the Version Database better for all users.";
|
$sMsg .= "We appreciate your help in making the Version Database better for all users.";
|
||||||
@@ -428,7 +453,6 @@ class version {
|
|||||||
addmsg("Version modified.", "green");
|
addmsg("Version modified.", "green");
|
||||||
break;
|
break;
|
||||||
case "delete":
|
case "delete":
|
||||||
$sSubject = "Version '".$this->sName."' of '".$oApp->sName."' has been deleted by ".$_SESSION['current']->sRealname;
|
|
||||||
|
|
||||||
// if sReplyText is set we should report the reason the application was deleted
|
// if sReplyText is set we should report the reason the application was deleted
|
||||||
if($aClean['sReplyText'])
|
if($aClean['sReplyText'])
|
||||||
@@ -851,8 +875,8 @@ class version {
|
|||||||
echo "\t".'<input type="hidden" name="iVersionId" value="'.$this->iVersionId.'" />'."\n";
|
echo "\t".'<input type="hidden" name="iVersionId" value="'.$this->iVersionId.'" />'."\n";
|
||||||
echo "\t".'<input type=submit value="Edit Version" class="button" />'."\n";
|
echo "\t".'<input type=submit value="Edit Version" class="button" />'."\n";
|
||||||
echo '</form>'."\n";
|
echo '</form>'."\n";
|
||||||
$url = BASE."admin/deleteAny.php?sWhat=appVersion&iAppId=".$oApp->iAppId."&iVersionId=".$this->iVersionId."&sConfirmed=yes";
|
$url = BASE."objectManager.php?sClass=version&sAction=delete&bQueued=false&sTitle=Delete%20".version::fullName($this->iVersionId)."&iId=".$this->iVersionId;
|
||||||
echo "<form method=\"post\" name=\"sDelete\" action=\"javascript:deleteURL('Are you sure?', '".$url."')\">\n";
|
echo "<form method=\"post\" name=\"sDelete\" action=\"javascript:self.location = '".$url."'\">\n";
|
||||||
echo "\t".'<input type=submit value="Delete Version" class="button" />'."\n";
|
echo "\t".'<input type=submit value="Delete Version" class="button" />'."\n";
|
||||||
echo '</form>'."\n";
|
echo '</form>'."\n";
|
||||||
echo '<form method="post" name="message" action="admin/addAppNote.php">'."\n";
|
echo '<form method="post" name="message" action="admin/addAppNote.php">'."\n";
|
||||||
|
|||||||
@@ -97,6 +97,26 @@ class version_queue
|
|||||||
$this->oDownloadUrl->unQueue();
|
$this->oDownloadUrl->unQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function objectGetSubmitterId()
|
||||||
|
{
|
||||||
|
return $this->oVersion->objectGetSubmitterId();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetChildren()
|
||||||
|
{
|
||||||
|
return $this->oVersion->objectGetChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return $this->oVersion->objectGetMailOptions($sAction, $bMailSubmitter, $bParentAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetMail($sAction, $bMailSubmitter, $bParentAction)
|
||||||
|
{
|
||||||
|
return $this->oVersion->objectGetMail($sAction, $bMailSubmitter, $bParentAction);
|
||||||
|
}
|
||||||
|
|
||||||
function outputEditor()
|
function outputEditor()
|
||||||
{
|
{
|
||||||
global $aClean;
|
global $aClean;
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ if(isset($aClean['bIsQueue']) && $aClean['bIsQueue'] == 'true')
|
|||||||
else
|
else
|
||||||
$oObject->bIsQueue = false;
|
$oObject->bIsQueue = false;
|
||||||
|
|
||||||
|
if(isset($aClean['sReturnTo']))
|
||||||
|
$oObject->sReturnTo = $aClean['sReturnTo'];
|
||||||
|
|
||||||
$aClean['bIsRejected'] = isset($aClean['bIsRejected']) ? $aClean['bIsRejected'] : false;
|
$aClean['bIsRejected'] = isset($aClean['bIsRejected']) ? $aClean['bIsRejected'] : false;
|
||||||
/* If it is rejected it is defined as queued */
|
/* If it is rejected it is defined as queued */
|
||||||
if($aClean['bIsRejected'] == 'true')
|
if($aClean['bIsRejected'] == 'true')
|
||||||
@@ -68,11 +71,6 @@ $oOtherObject = new $oObject->sClass($oObject->iId);
|
|||||||
on failure */
|
on failure */
|
||||||
$sErrors = $oObject->processForm($aClean);
|
$sErrors = $oObject->processForm($aClean);
|
||||||
|
|
||||||
if($oObject->iId && $aClean['sAction'] == "delete")
|
|
||||||
{
|
|
||||||
$oObject->delete_entry();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($aClean['sAction']) && $aClean['sAction'] == "add")
|
if(isset($aClean['sAction']) && $aClean['sAction'] == "add")
|
||||||
$oObject->handle_anonymous_submission();
|
$oObject->handle_anonymous_submission();
|
||||||
|
|
||||||
@@ -100,6 +98,10 @@ if($oObject->iId)
|
|||||||
$oObject->display_move_children();
|
$oObject->display_move_children();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "delete":
|
||||||
|
$oObject->delete_prompt();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$oObject->view($_SERVER['REQUEST_URI']);
|
$oObject->view($_SERVER['REQUEST_URI']);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -260,9 +260,13 @@ function test_object_methods()
|
|||||||
"canEdit",
|
"canEdit",
|
||||||
"display",
|
"display",
|
||||||
"getOutputEditorValues",
|
"getOutputEditorValues",
|
||||||
|
"objectGetChildren",
|
||||||
"objectGetEntries",
|
"objectGetEntries",
|
||||||
"objectGetHeader",
|
"objectGetHeader",
|
||||||
"objectGetId",
|
"objectGetId",
|
||||||
|
"objectGetMail",
|
||||||
|
"objectGetMailOptions",
|
||||||
|
"objectGetSubmitterId",
|
||||||
"objectGetTableRow",
|
"objectGetTableRow",
|
||||||
"objectMakeLink",
|
"objectMakeLink",
|
||||||
"objectMakeUrl",
|
"objectMakeUrl",
|
||||||
|
|||||||
Reference in New Issue
Block a user