Use objectMakeLink()/Url() in more places

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-04-03 02:08:44 +00:00
committed by WineHQ
parent eeaf2c3642
commit 89535dbe01
13 changed files with 63 additions and 49 deletions

View File

@@ -24,7 +24,8 @@ if(!$_SESSION['current']->hasPriv("admin") &&
//set link for version
if(is_numeric($aClean['iVersionId']) and !empty($aClean['iVersionId']))
{
$sVersionLink = "iVersionId={$aClean['iVersionId']}";
$oVersion = new version($aClean['iVersionId']);
$sVersionLink = $oVersion->objectMakeUrl();
}
else
exit;
@@ -35,7 +36,7 @@ $oNote->GetOutputEditorValues($aClean);
if($aClean['sSub'] == "Submit")
{
$oNote->create();
util_redirect_and_exit(apidb_fullurl("appview.php?".$sVersionLink));
util_redirect_and_exit($sVersionLink);
}
else if($aClean['sSub'] == 'Preview' OR empty($aClean['sSubmit']))
{
@@ -54,7 +55,7 @@ else if($aClean['sSub'] == 'Preview' OR empty($aClean['sSubmit']))
echo '<input type="submit" name="sSub" value="Submit"></td></tr>',"\n";
echo '</center>';
echo html_back_link(1,BASE."appview.php?".$sVersionLink);
echo html_back_link(1,$sVersionLink);
apidb_footer();
}
?>

View File

@@ -122,6 +122,8 @@ if ($aClean['sSub'])
{
while($oRow = mysql_fetch_object($hResult))
{
$oApp = new application($oRow->appId);
$oVersion = new version($oRow->versionId);
// set row color
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
echo '<tr class='.$bgcolor.'>',"\n";
@@ -131,11 +133,11 @@ if ($aClean['sSub'])
echo ' <td align=center>'.$oRow->bug_status.'</td>',"\n";
echo ' <td>'.$oRow->short_desc.'</td>',"\n";
echo ' <td>',"\n";
echo ' <a href="'.apidb_fullurl('appview.php?iAppId='.$oRow->appId).'">'.$oRow->appName.'</a>',"\n";
echo $oApp->objectMakeLink()."\n";
echo ' </td>',"\n";
echo ' <td>'.$oRow->appDescription.'</td>',"\n";
echo ' <td>',"\n";
echo ' <a href="'.apidb_fullurl('appview.php?iVersionId='.$oRow->versionId).'">'.$oRow->versionName.'</a>',"\n";
echo $oVersion->objectMakeLink()."\n";
echo ' </td>',"\n";
echo ' <td align=center>[<a href="adminBugs.php?sSub=delete',"\n";
echo '&iBuglinkId='.$oRow->linkId,"\n";

View File

@@ -64,6 +64,7 @@ if ($aClean['sSub'])
while($oRow = mysql_fetch_object($hResult))
{
$oUser = new User($oRow->userId);
$oApp = new application($oRow->appId);
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
/* if this is a new user we should print a header that has the aggregate of the applications */
@@ -105,14 +106,14 @@ if ($aClean['sSub'])
echo "<tr class=$bgcolor>\n";
echo " <td>".print_date(mysqldatetime_to_unixtimestamp($oRow->submitTime))." &nbsp;</td>\n";
echo " <td><a href=\"mailto:".$oUser->sEmail."\">".$oUser->sRealname."</a></td>\n";
echo " <td>".$oApp->objectMakeLink()."</td>\n";
if($oRow->superMaintainer)
{
echo " <td><a href='".BASE."appview.php?iAppId=$oRow->appId'>".Application::lookup_name($oRow->appId)."</a></td>\n";
echo " <td>*</td>\n";
} else
{
echo " <td><a href='".BASE."appview.php?iAppId=$oRow->appId'>".Application::lookup_name($oRow->appId)."</a></td>\n";
echo " <td><a href='".BASE."appview.php?iVersionId=$oRow->versionId'>".Version::lookup_name($oRow->versionId)."</a>&nbsp;</td>\n";
$oVersion = new version($oRow->versionId);
echo " <td>".$oVersion->objectMakeLink()."</td>\n";
}
echo " <td align=\"center\">[<a href='adminMaintainers.php?sSub=delete&iMaintainerId=$oRow->maintainerId'>delete</a>]</td>\n";
echo "</tr>\n\n";

View File

@@ -116,13 +116,9 @@ while ($oRow = mysql_fetch_object($Ids))
echo $img;
echo "<div align=center>". substr($oRow->description,0,20). "\n";
echo "<br />[<a href='".apidb_fullurl("appview.php");
echo "?iAppId=".$oApp->iAppId."'>";
echo $oApp->sName."</a>]";
echo "<br />[".$oApp->objectMakeLink()."]";
echo "<br />[<a href='".apidb_fullurl("appview.php");
echo "?iVersionId=".$oVersion->iVersionId."'>";
echo "Version: ".$oVersion->sName."</a>]";
echo "<br />[".$oVersion->objectMakeLink()."]";
//show admin delete link
if($_SESSION['current']->isLoggedIn() &&

View File

@@ -48,7 +48,10 @@ if($aClean['sWhat'])
if(!$oVersion->delete())
util_show_error_page_and_exit();
else
util_redirect_and_exit(BASE."appview.php?iAppId=".$aClean['iAppId']);
{
$oApp = new application($aClean['iAppId']);
util_redirect_and_exit($oApp->objectMakeUrl());
}
break;
}
}

View File

@@ -55,12 +55,13 @@ function display_bundle($iAppId)
$c = 0;
while($ob = mysql_fetch_object($hResult))
{
$oApp = new application($ob->appId);
//set row color
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
//display row
echo "<tr class=\"$bgcolor\">\n";
echo " <td><a href=\"appview.php?iAppId=$ob->appId\">".stripslashes($ob->appName)."</a></td>\n";
echo " <td>".$oApp->objectMakeLink()."</td>\n";
echo " <td>".util_trim_description($oApp->sDescription)."</td>\n";
echo "</tr>\n\n";
@@ -85,7 +86,7 @@ if ($aClean['sSub'])
{
$oBuglink = new Bug($aClean['iBuglinkId']);
$oBuglink->delete();
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
util_redirect_and_exit($oVersion->objectMakeUrl());
}
}
@@ -97,7 +98,7 @@ if ($aClean['sSub'])
{
$oBuglink = new Bug($aClean['iBuglinkId']);
$oBuglink->unqueue();
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
util_redirect_and_exit($oVersion->objectMakeUrl());
}
}
@@ -105,13 +106,13 @@ if ($aClean['sSub'])
{
$oBuglink = new Bug();
$oBuglink->create($aClean['iVersionId'],$aClean['iBuglinkId']);
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
util_redirect_and_exit($oVersion->objectMakeUrl());
}
if($aClean['sSub'] == 'StartMonitoring')
{
$oMonitor = new Monitor();
$oMonitor->create($_SESSION['current']->iUserId,$aClean['iAppId'],$aClean['iVersionId']);
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
util_redirect_and_exit($oVersion->objectMakeUrl());
}
if($aClean['sSub'] == 'StopMonitoring')
{
@@ -121,7 +122,7 @@ if ($aClean['sSub'])
{
$oMonitor->delete();
}
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
util_redirect_and_exit($oVersion->objectMakeUrl());
}
}

View File

@@ -55,6 +55,7 @@ if($_SESSION['current']->getPref("confirm_comment_deletion") != "no" && !isset($
} else
{
$oComment->delete($aClean['sWhy']);
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$oComment->iVersionId));
$oVersion = new version($oComment->iVersionId);
util_redirect_and_exit($oVersion->objectMakeUrl());
}
?>

View File

@@ -443,7 +443,7 @@ class Application {
if($this->sQueued == 'false') // Has been accepted.
{
$sSubject = $this->sName." has been added by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?iAppId=".$this->iAppId."\n";
$sMsg = $this->objectMakeUrl()."\n";
if($this->iSubmitterId)
{
$oSubmitter = new User($this->iSubmitterId);
@@ -467,7 +467,7 @@ class Application {
break;
case "edit":
$sSubject = $this->sName." has been modified by ".$_SESSION['current']->sRealname;
$sMsg .= APPDB_ROOT."appview.php?iAppId=".$this->iAppId."\n";
$sMsg .= $this->objectMakeUrl()."\n";
addmsg("Application modified.", "green");
break;
case "delete":
@@ -810,8 +810,9 @@ class Application {
for($i = 1; $oRow = mysql_fetch_object($hResult); $i++)
{
$oVendor = new vendor($oRow->vendorId);
$oApp = new application($oRow->appId);
$sResult .= html_tr(array(
"<a href=\"".BASE."appview.php?iAppId=$oRow->appId\">$oRow->appName</a>",
$oApp->objectMakeLink(),
$oRow->description,
$oVendor->objectMakeLink(),
print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime))),

View File

@@ -219,13 +219,14 @@ class Bug {
function SendNotificationMail($bDeleted=false)
{
$sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId);
$sAppName = version::fullName($this->iVersionId);
$oVersion = new version($this->iVersionId);
if(!$bDeleted)
{
if(!$this->bQueued)
{
$sSubject = "Link between Bug ".$this->iBug_id." and ".$sAppName." added by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."\n";
$sMsg = $oVersion->objectMakeUrl()."\n";
if($this->iSubmitterId)
{
$oSubmitter = new User($this->iSubmitterId);
@@ -236,7 +237,7 @@ class Bug {
} else // Bug Link queued.
{
$sSubject = "Link between Bug ".$this->iBug_id." and ".$sAppName." submitted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."\n";
$sMsg = $oVersion->objectMakeUrl()."\n";
$sMsg .= "This Bug Link has been queued.";
$sMsg .= "\n";
addmsg("The Bug Link you submitted will be added to the database after being reviewed.", "green");
@@ -244,7 +245,7 @@ class Bug {
} else // Bug Link deleted.
{
$sSubject = "Link between Bug ".$this->iBug_id." and ".$sAppName." deleted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."\n";
$sMsg = $oVersion->objectMakeUrl()."\n";
addmsg("Bug Link deleted.", "green");
}
@@ -277,7 +278,7 @@ class Bug {
{
$oBug = new Bug($oRow->bug_id);
$sReturn .= html_tr(array(
"<a href=\"".BASE."appview.php?iVersionId=".$oRow->versionId."\">".$oRow->appName.": ".$oRow->versionName."</a>",
version::fullNameUrl($oRow->versionId),
"<a href=\"".BUGZILLA_ROOT."show_bug.cgi?id=".$oRow->bug_id."\">".$oRow->bug_id."</a>",
$oBug->sBug_status,
$oBug->sResolution,
@@ -315,7 +316,7 @@ function view_version_bugs($iVersionId = null, $aBuglinkIds)
//start format table
if($_SESSION['current']->isLoggedIn())
{
echo "<form method=post action='appview.php?iVersionId=".$iVersionId."'>\n";
echo "<form method=post action='".$oVersion->objectMakeUrl()."'>\n";
}
echo html_frame_start("Known bugs","98%",'',0);
echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\">\n\n";
@@ -352,10 +353,10 @@ function view_version_bugs($iVersionId = null, $aBuglinkIds)
if($bCanEdit == true)
{
echo "<td align=center>[<a href='appview.php?sSub=delete&iBuglinkId=".$oBuglink->iLinkId."&iVersionId=".$oBuglink->iVersionId."'>delete</a>]</td>\n";
echo "<td align=center>[<a href='".$oVersion->objectMakeUrl()."&sSub=delete&iBuglinkId=".$oBuglink->iLinkId."'>delete</a>]</td>\n";
if ($oBuglink->bQueued)
{
echo "<td align=center>[<a href='appview.php?sSub=unqueue&iBuglinkId=".$oBuglink->iLinkId."&iVersionId=".$oBuglink->iVersionId."'>OK</a>]</td>\n";
echo "<td align=center>[<a href='".$oVersion->objectMakeUrl()."&sSub=unqueue&iBuglinkId=".$oBuglink->iLinkId."'>OK</a>]</td>\n";
} else
{
echo "<td align=center>Yes</td>\n";

View File

@@ -87,7 +87,7 @@ class Comment {
$sSubject = "Comment for '".Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId)."' added by ".$_SESSION['current']->sRealname;
$sMsg = "To reply to this email please use the link provided below.\n";
$sMsg .= "DO NOT reply via your email client as it will not reach the person who wrote the comment\n";
$sMsg .= APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."&mode=nested#Comment-".$this->iCommentId."\n";
$sMsg .= $this->objectMakeUrl()."\n";
$sMsg .= "\n";
$sMsg .= "Subject: ".$this->sSubject."\r\n";
$sMsg .= "\n";
@@ -165,8 +165,9 @@ class Comment {
$sEmail .= $this->oOwner->sEmail;
if($sEmail)
{
$sSubject = "Comment for '".Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId)."' deleted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?iVersionId=".$this->iVersionId."\n";
$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";
@@ -385,8 +386,10 @@ class Comment {
if (!empty($aClean['sCmode']))
$_SESSION['current']->setPref("comments:mode", $aClean['sCmode']);
$oVersion = new version($versionId);
$sel[$_SESSION['current']->getPref("comments:mode", "threaded")] = 'selected';
echo '<td><form method="post" name="sMode" action="appview.php">',"\n";
echo '<td><form method="post" name="sMode" action="'.
$oVersion->objectMakeUrl().'">',"\n";
echo "<b>Application Comments</b> $messageCount total comments ";
echo '<b>Mode</b> <select name="sCmode" onchange="document.sMode.submit();">',"\n";
echo ' <option value="flat" '.$sel['flat'].'>Flat</option>',"\n";
@@ -394,7 +397,7 @@ class Comment {
echo ' <option value="nested" '.$sel['nested'].'>Nested</option>',"\n";
echo ' <option value="off" '.$sel['off'].'>No Comments</option>',"\n";
echo '</select>',"\n";
echo '<input type="hidden" name="iVersionId" value="'.$versionId.'"></form></td>',"\n";
echo '</form></td>',"\n";
}
// blank space
@@ -440,7 +443,14 @@ class Comment {
}
echo '</td></tr></table>',"\n";
}
}
function objectMakeUrl()
{
$oVersion = new version($this->iVersionId);
$sUrl = $oVersion->objectMakeUrl()."#Comment-".$this->iCommentId;
return $sUrl;
}
}

View File

@@ -527,8 +527,8 @@ class distribution {
continue;
echo '<tr class='.$bgcolor.'>',"\n";
echo '<td><a href="'.BASE.'appview.php?iVersionId='.$oTest->iVersionId.'&iTestingId='.$oTest->iTestingId.'">',"\n";
echo $oApp->sName.' '.$oVersion->sName.'</a></td>',"\n";
echo '<td><a href="'.$oVersion->objectMakeUrl().'&iTestingId='.$oTest->iTestingId.'">',"\n";
echo version::fullName($oVersion->iVersionId).'</a></td>',"\n";
echo '<td>',"\n";
if($_SESSION['current']->isLoggedIn())
{

View File

@@ -191,13 +191,12 @@ class downloadurl
if($sWhatChanged && $sEmail =
User::get_notify_email_address_list($aValues['iVersionId']))
{
$oApp = new Application($aValues["iAppId"]);
$oVersion = new Version($aValues["iVersionId"]);
$sSubject = "Download URLs for $oApp->sName $oVersion->sName".
$sSubject = "Download URLs for ".version::fullName($oVersion->iVersionId).
" updated by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?iVersionId=".$aValues['iVersionId'];
$sMsg = $oVersion->objectMakeUrl();
$sMsg .= "\n\n";
$sMsg .= "The following changed were made\n\n";
$sMsg .= "$sWhatChanged\n\n";

View File

@@ -65,14 +65,12 @@ If you have screenshots or links to contribute, please browse the database and u
$hResult = query_parameters($voteQuery);
$oRow = mysql_fetch_object($hResult);
$sVoteVersionId = $oRow->versionId;
$sVoteAppName = version::fullName($oRow->versionId);
// don't mention the top application if there are no votes yet
if($sVoteVersionId != "")
if($oRow->versionId)
{
$sVoteAppLink = version::fullNameLink($oRow->versionId);
echo "There are <b>$numApps</b> applications currently in the database with\n";
echo "<a href='appview.php?iVersionId=$sVoteVersionId'>$sVoteAppName</a> being the\n";
echo "$shVoteAppLink being the\n";
echo "top <a href='votestats.php'>voted</a> application.\n";
} else
{