diff --git a/distributionView.php b/distributionView.php deleted file mode 100644 index f7a7d00..0000000 --- a/distributionView.php +++ /dev/null @@ -1,67 +0,0 @@ -hasPriv("admin")) - util_show_error_page_and_exit("Insufficient privileges."); - - if($aClean['sSub'] == 'delete') - { - $oDistribution = new distribution($aClean['iDistributionId']); - $oDistribution->delete(); - util_redirect_and_exit($_SERVER['PHP_SELF']); - } -} -$oDistribution = new distribution($aClean['iDistributionId']); - -/* Display distribution list if no id given */ -if(!$oDistribution->iDistributionId) -{ - apidb_header("View Distributions"); - - //get available Distributions - $hResult = distribution::ObjectGetEntries(false); - - // show Distribution list - echo html_frame_start("","90%","",0); - echo "\n\n"; - - distribution::ObjectOutputHeader("color4"); - - for($c = 1; $oRow = mysql_fetch_object($hResult); $c++) - { - $oDistribution = distribution::ObjectGetInstanceFromRow($oRow); - - $oDistribution->objectOutputTableRow(($c % 2) ? "color0" : "color1"); - } - echo "
\n\n"; - echo html_frame_end(" "); - if ($_SESSION['current']->hasPriv("admin")) - echo "[Add New Distribution]"; - apidb_footer(); -} -else -{ - //display page - apidb_header("View Distribution"); - echo html_frame_start("Distribution Information",500); - - $oDistribution->display(); - - echo html_frame_end(); - echo html_back_link(1); - apidb_footer(); -} - -?> diff --git a/include/distribution.php b/include/distribution.php index 0934b99..bcdcfce 100644 --- a/include/distribution.php +++ b/include/distribution.php @@ -286,8 +286,9 @@ class distribution { case "add": if($this->sQueued == "false") { - $sSubject = "Distribution ".$this->sName." added by ".$_SESSION['current']->sRealname; - $sMsg = APPDB_ROOT."distributionView.php?iDistributionId=".$this->iDistributionId."\n"; + $sSubject = "Distribution ".$this->sName." added by ". + $_SESSION['current']->sRealname; + $sMsg = $this->objectMakeUrl."\n"; if($this->iSubmitterId) { $oSubmitter = new User($this->iSubmitterId); @@ -307,7 +308,7 @@ class distribution { break; case "edit": $sSubject = "Distribution ".$this->sName." has been modified by ".$_SESSION['current']->sRealname; - $sMsg = APPDB_ROOT."distributionView.php?iDistributionId=".$this->iDistributionId."\n"; + $sMsg = $this->objectMakeUrl()."\n"; addmsg("Distribution modified.", "green"); break; case "delete": @@ -323,8 +324,9 @@ class distribution { addmsg("Distribution deleted.", "green"); break; case "reject": - $sSubject = "Distribution '".$this->sName." has been rejected by ".$_SESSION['current']->sRealname; - $sMsg = APPDB_ROOT."distributionView.php?iDistributionId=".$this->iDistributionId."\n"; + $sSubject = "Distribution '".$this->sName." has been rejected by ". + $_SESSION['current']->sRealname; + $sMsg = $this->objectMakeUrl()."\n"; // if sReplyText is set we should report the reason the data was rejected if($aClean['sReplyText']) @@ -549,6 +551,19 @@ class distribution { echo '',"\n"; } } + + /* Make a URL for viewing the specified distribution */ + function objectMakeUrl() + { + $oObject = new objectManager("distribution", "View Distribution"); + return $oObject->makeUrl("view", $this->iDistributionId); + } + + /* Make an HTML link for viewing the specified distirbution */ + function objectMakeLink() + { + return "objectMakeUrl()."\">$this->sName"; + } } ?> diff --git a/include/incl.php b/include/incl.php index 91e6d12..f99de07 100644 --- a/include/incl.php +++ b/include/incl.php @@ -13,6 +13,7 @@ require(BASE."include/menu.php"); require(BASE."include/html.php"); require(BASE."include/error_log.php"); require(BASE."include/query.php"); +require_once(BASE."include/objectManager.php"); /* if magic quotes are enabled make sure the user disables them */ /* otherwise they will see all kinds of odd effects that are difficult */ diff --git a/include/testData.php b/include/testData.php index ac52a34..53684f4 100644 --- a/include/testData.php +++ b/include/testData.php @@ -446,8 +446,7 @@ class testData{ } echo ' ',"\n"; - echo '',"\n"; - echo $oDistribution->sName.'',"\n"; + echo $oDistribution->objectMakeLink()."\n"; echo ' ',"\n"; echo ' '.date("M d Y", mysqldatetime_to_unixtimestamp($oTest->sTestedDate)).'',"\n"; echo ' '.$oTest->sTestedRelease.' ',"\n";