Skip to content
Permalink
Browse files

Use new index features.

git-svn-id: https://svn.macports.org/repository/macports/trunk/www@1026 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
Kevin Van Vechten
Kevin Van Vechten committed Oct 10, 2002
1 parent ca74ae3 commit 893d4b0323cc7664882599439d67bbfe43f32ef9
Showing with 146 additions and 6 deletions.
  1. +73 −3 en/ports.php
  2. +73 −3 ports.php
@@ -29,6 +29,7 @@
<option value="name"<? if ($by == "name") { echo " selected=\"selected\""; } ?>>Software Title</option>
<option value="desc"<? if ($by == "desc") { echo " selected=\"selected\""; } ?>>Description</option>
<option value="cat"<? if ($by == "cateogry") { echo " selected=\"selected\""; } ?>>Category</option>
<option value="maintainer"<? if ($by == "maintainer") { echo " selected=\"selected\""; } ?>>Maintainer</option>
</select>
</td>
<td><input type="text" name="substr" size="40" /></td>
@@ -67,10 +68,11 @@
</table>
</form>

<dl>
<?
if ($by && ($substr || $by == "all")) {
$query = "SELECT DISTINCT name,path,version,description,maintainer FROM darwinports.portfiles p, darwinports.maintainers m, darwinports.categories c WHERE p.name=m.portfile AND p.name=c.portfile AND m.is_primary=1";
$query = "SELECT DISTINCT name,path,version,description,maintainer FROM darwinports.portfiles p, ".
"darwinports.maintainers m, darwinports.categories c, darwinports.variants v, darwinports.platforms pl ".
"WHERE p.name=m.portfile AND p.name=v.portfile AND p.name=pl.portfile AND p.name=c.portfile AND m.is_primary=1";
if ($by == "name") {
$query = $query . " AND p.name LIKE '%" . addslashes($substr) . "%'";
}
@@ -80,20 +82,38 @@
if ($by == "cat") {
$query = $query . " AND c.category='" . addslashes($substr) . "'";
}
if ($by == "variant") {
$query = $query . " AND v.variant='" . addslashes($substr) . "'";
}
if ($by == "platform") {
$query = $query . " AND pl.platform ='" . addslashes($substr) . "'";
}
if ($by == "maintainer") {
$query = $query . " AND m.maintainer LIKE '%" . addslashes($substr) . "%'";
}
$query = $query . " ORDER BY name";
$result = mysql_query($query);
if($result) {
?>
<p>
<i><?= mysql_num_rows($result); ?> Portfile<? if (mysql_num_rows($result) != 1) { echo "s"; } ?> Selected</i>
</p>
<dl>
<?
while( $row = mysql_fetch_assoc($result) ) {
?>
<dt><b><a href="http://www.opendarwin.org/projects/darwinports/darwinports/dports/<?= $row['path']; ?>/Portfile"><?= $row['name']; ?></a></b> <?= $row['version']; ?></dt>
<dd>
<?= $row['description']; ?><br />
<i>Maintained by:</i> <a href="mailto:<?= $row['maintainer']; ?>"><?= $row['maintainer']; ?></a><br />
<i>Categories:</i>
<?
// CATEGORIES
$nquery = "SELECT category FROM darwinports.categories WHERE portfile='" . $row['name'] . "' ORDER BY is_primary DESC, category";
$nresult = mysql_query($nquery);
if ($nresult) {
?>
<i>Categories:</i>
<?
$primary = 1;
while ( $nrow = mysql_fetch_assoc($nresult) ) {
if ($primary) { echo "<b>"; }
@@ -104,6 +124,56 @@
$primary = 0;
}
}

// PLATFORMS
$nquery = "SELECT platform FROM darwinports.platforms WHERE portfile='" . $row['name'] . "' ORDER BY platform";
$nresult = mysql_query($nquery);
if ($nresult && mysql_num_rows($nresult) > 0) {
?>
<br />
<i>Platforms:</i>
<?
while ( $nrow = mysql_fetch_array($nresult) ) {
$platform = $nrow[0];
?>
<a href="<?= $PHP_SELF; ?>?by=platform&substr=<?= $platform; ?>"><?= $platform; ?></a>
<?
}
}

// DEPENDENCIES
$nquery = "SELECT library FROM darwinports.dependencies WHERE portfile='" . $row['name'] . "' ORDER BY library";
$nresult = mysql_query($nquery);
if ($nresult && mysql_num_rows($nresult) > 0) {
?>
<br />
<i>Dependencies:</i>
<?
while ( $nrow = mysql_fetch_array($nresult) ) {
// lib:libpng.3:libpng -> libpng
$library = eregi_replace("^[^:]*:[^:]*:", "", $nrow[0]);
?>
<a href="<?= $PHP_SELF; ?>?by=name&substr=<?= $library; ?>"><?= $library; ?></a>
<?
}
}
/*
// VARIANTS
$nquery = "SELECT variant FROM darwinports.variants WHERE portfile='" . $row['name'] . "' ORDER BY variant";
$nresult = mysql_query($nquery);
if ($nresult && mysql_num_rows($nresult) > 0) {
?>
<br />
<i>Variants:</i>
<?
while ( $nrow = mysql_fetch_array($nresult) ) {
$variant = $nrow[0];
?>
<a href="<?= $PHP_SELF; ?>?by=variant&substr=<?= $variant; ?>"><?= $variant; ?></a>
<?
}
}
*/
?>
<br />
</dd>
@@ -29,6 +29,7 @@
<option value="name"<? if ($by == "name") { echo " selected=\"selected\""; } ?>>Software Title</option>
<option value="desc"<? if ($by == "desc") { echo " selected=\"selected\""; } ?>>Description</option>
<option value="cat"<? if ($by == "cateogry") { echo " selected=\"selected\""; } ?>>Category</option>
<option value="maintainer"<? if ($by == "maintainer") { echo " selected=\"selected\""; } ?>>Maintainer</option>
</select>
</td>
<td><input type="text" name="substr" size="40" /></td>
@@ -67,10 +68,11 @@
</table>
</form>

<dl>
<?
if ($by && ($substr || $by == "all")) {
$query = "SELECT DISTINCT name,path,version,description,maintainer FROM darwinports.portfiles p, darwinports.maintainers m, darwinports.categories c WHERE p.name=m.portfile AND p.name=c.portfile AND m.is_primary=1";
$query = "SELECT DISTINCT name,path,version,description,maintainer FROM darwinports.portfiles p, ".
"darwinports.maintainers m, darwinports.categories c, darwinports.variants v, darwinports.platforms pl ".
"WHERE p.name=m.portfile AND p.name=v.portfile AND p.name=pl.portfile AND p.name=c.portfile AND m.is_primary=1";
if ($by == "name") {
$query = $query . " AND p.name LIKE '%" . addslashes($substr) . "%'";
}
@@ -80,20 +82,38 @@
if ($by == "cat") {
$query = $query . " AND c.category='" . addslashes($substr) . "'";
}
if ($by == "variant") {
$query = $query . " AND v.variant='" . addslashes($substr) . "'";
}
if ($by == "platform") {
$query = $query . " AND pl.platform ='" . addslashes($substr) . "'";
}
if ($by == "maintainer") {
$query = $query . " AND m.maintainer LIKE '%" . addslashes($substr) . "%'";
}
$query = $query . " ORDER BY name";
$result = mysql_query($query);
if($result) {
?>
<p>
<i><?= mysql_num_rows($result); ?> Portfile<? if (mysql_num_rows($result) != 1) { echo "s"; } ?> Selected</i>
</p>
<dl>
<?
while( $row = mysql_fetch_assoc($result) ) {
?>
<dt><b><a href="http://www.opendarwin.org/projects/darwinports/darwinports/dports/<?= $row['path']; ?>/Portfile"><?= $row['name']; ?></a></b> <?= $row['version']; ?></dt>
<dd>
<?= $row['description']; ?><br />
<i>Maintained by:</i> <a href="mailto:<?= $row['maintainer']; ?>"><?= $row['maintainer']; ?></a><br />
<i>Categories:</i>
<?
// CATEGORIES
$nquery = "SELECT category FROM darwinports.categories WHERE portfile='" . $row['name'] . "' ORDER BY is_primary DESC, category";
$nresult = mysql_query($nquery);
if ($nresult) {
?>
<i>Categories:</i>
<?
$primary = 1;
while ( $nrow = mysql_fetch_assoc($nresult) ) {
if ($primary) { echo "<b>"; }
@@ -104,6 +124,56 @@
$primary = 0;
}
}

// PLATFORMS
$nquery = "SELECT platform FROM darwinports.platforms WHERE portfile='" . $row['name'] . "' ORDER BY platform";
$nresult = mysql_query($nquery);
if ($nresult && mysql_num_rows($nresult) > 0) {
?>
<br />
<i>Platforms:</i>
<?
while ( $nrow = mysql_fetch_array($nresult) ) {
$platform = $nrow[0];
?>
<a href="<?= $PHP_SELF; ?>?by=platform&substr=<?= $platform; ?>"><?= $platform; ?></a>
<?
}
}

// DEPENDENCIES
$nquery = "SELECT library FROM darwinports.dependencies WHERE portfile='" . $row['name'] . "' ORDER BY library";
$nresult = mysql_query($nquery);
if ($nresult && mysql_num_rows($nresult) > 0) {
?>
<br />
<i>Dependencies:</i>
<?
while ( $nrow = mysql_fetch_array($nresult) ) {
// lib:libpng.3:libpng -> libpng
$library = eregi_replace("^[^:]*:[^:]*:", "", $nrow[0]);
?>
<a href="<?= $PHP_SELF; ?>?by=name&substr=<?= $library; ?>"><?= $library; ?></a>
<?
}
}
/*
// VARIANTS
$nquery = "SELECT variant FROM darwinports.variants WHERE portfile='" . $row['name'] . "' ORDER BY variant";
$nresult = mysql_query($nquery);
if ($nresult && mysql_num_rows($nresult) > 0) {
?>
<br />
<i>Variants:</i>
<?
while ( $nrow = mysql_fetch_array($nresult) ) {
$variant = $nrow[0];
?>
<a href="<?= $PHP_SELF; ?>?by=variant&substr=<?= $variant; ?>"><?= $variant; ?></a>
<?
}
}
*/
?>
<br />
</dd>

0 comments on commit 893d4b0

Please sign in to comment.
You can’t perform that action at this time.