Skip to content

Commit

Permalink
* when there is no known link into SVN, display the link as struck out
Browse files Browse the repository at this point in the history
* when displaying deleted ports, do not display package information because
  * there is no package for a delete port
  * the information is repetitive
  * the information is available on the port page

Fixes: 24
  • Loading branch information
dlangille committed Sep 4, 2016
1 parent 816dab1 commit 352759f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
27 changes: 19 additions & 8 deletions classes/port-display.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,33 @@ function SetPort($port, $branch = BRANCH_HEAD) {
function link_to_repo() {
# we want something like
# http://svn.freebsd.org/ports/head/x11-wm/awesome/
$link_title = 'SVNWeb';
$link = 'https://' . $this->port->svn_hostname . $this->port->element_pathname . '/';
if ($this->port->IsDeleted()) {
#
# if the port has been deleted, let's link to the last commit
# deleted ports don't change much. It's easier to do this here
# If the port has been deleted, let's link to the last commit.
# Deleted ports don't change much. It's easier to do this here
# than to do it for ALL ports.
#
require_once($_SERVER['DOCUMENT_ROOT'] . '/../classes/commit.php');

$commit = new Commit($this->db);
$commit->FetchById($this->port->last_commit_id);

$link .= '?pathrev=' . ($commit->svn_revision - 1);

if (!empty($commit->svn_revision)) {
$link .= '?pathrev=' . ($commit->svn_revision - 1);
} else {
$link = null;
}
}

return $link;
if (!empty($link)) {
$link = '<a href="' . $link . '">' . $link_title . '</a>';
} else {
$link = '<strike>SVNWeb</strike>';
}

return $link;
}

function port_display(&$db, $User = 0) {
Expand Down Expand Up @@ -191,7 +202,7 @@ function Display($verbosity_level = 1) {
# verbosity_level has been defined, but not used.
$port = $this->port;

$HTML = '';
$HTML = '';
# $HTML = $this->JavascriptInclude();

$MarkedAsNew = "N";
Expand Down Expand Up @@ -429,7 +440,7 @@ function Display($verbosity_level = 1) {
}

if ($this->ShowChangesLink || $this->ShowEverything) {
$HTML .= '<a href="' . $this->link_to_repo() . '">SVNWeb</a>';
$HTML .= $this->link_to_repo();
}

if ($port->PackageExists() && ($this->ShowPackageLink || $this->ShowEverything)) {
Expand All @@ -447,7 +458,7 @@ function Display($verbosity_level = 1) {
if (defined('PORTSMONSHOW') && ($this->ShowPortsMonLink || $this->ShowEverything)) {
$HTML .= ' <b>:</b> ' . freshports_PortsMonitorURL($port->category, $port->port);
}

# only show if we're meant to show, and if the port has not been deleted.
if ($this->ShowPackageLink || $this->ShowEverything) {
$HTML .= "\n<hr>\n";
Expand Down
5 changes: 3 additions & 2 deletions include/list-of-ports.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ function freshports_ListOfPorts($result, $db, $ShowDateAdded, $ShowCategoryHeade

$HTML = $PortCountText;
$HTML .= "<TR><TD>\n";

$HTML .= "<br><center>\n" . Ad_728x90() . "\n</center>\n";


if ($numrows > 0 && $ShowCategoryHeaders) {
$HTML .= '<DL>';
Expand Down Expand Up @@ -61,6 +61,7 @@ function freshports_ListOfPorts($result, $db, $ShowDateAdded, $ShowCategoryHeade
}
}
$port_display->SetPort($port);
$port_display->ShowPackageLink = false;

$Port_HTML = $port_display->Display();

Expand Down

0 comments on commit 352759f

Please sign in to comment.