diff options
author | Remi Collet <fedora@famillecollet.com> | 2010-09-19 16:52:11 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2010-09-19 16:52:11 +0200 |
commit | 13f5a889da9cd6fcb864ae0b84eb31e4e97a9d10 (patch) | |
tree | 0fcbe9725dac207e881e6c75a05421d0986ed1a8 | |
parent | 9689e536a9c72251fc20512f81a24b3a92a53c22 (diff) |
Add 'need work' filter, fixed #88
-rw-r--r-- | rpm.php | 37 | ||||
-rw-r--r-- | smarty/templates/rpmphp/rpm.tpl | 1 |
2 files changed, 25 insertions, 13 deletions
@@ -72,6 +72,10 @@ function report($db, $type) $package = null; $rpmname = $upstream->name; + $verup = strtolower( + $upstream->stable ? $upstream->stable : $upstream->unstable + ); + $sql2="SELECT DISTINCT owner FROM acls WHERE name = '$rpmname'"; $res2=$db->query($sql2); $owners=array(); @@ -85,10 +89,25 @@ function report($db, $type) $res=$db->query($sql); $rpm = ($res ? $res->fetchObject() : false); + $rpms=array(); + if ( $rpm ) { + do { + $rpms[$rpm->repo_main."-".$rpm->repo_sub]=$rpm; + } while ($rpm = $res->fetchObject()); + } switch ($what) { + case '%work': + $display = false; + if (count($rpms) + && isset($rpms['devel-']) + && $rpms['devel-']->ver != $verup + ) { + $display = true; + } + break; case '%fedora': - $display = ($rpm !== false); + $display = (count($rpms)); break; case '%stable': $display = !empty($upstream->stable); @@ -112,12 +131,6 @@ function report($db, $type) if ( $upstream->channel != $upstream->type ) { $package['channel'] = $upstream->channel; } - $rpms=array(); - if ( $rpm ) { - do { - $rpms[$rpm->repo_main."-".$rpm->repo_sub]=$rpm; - } while ($rpm = $res->fetchObject()); - } $dispowner=""; $package['owners'] = $owners; @@ -132,10 +145,6 @@ function report($db, $type) ' <small>(' . $upstream->state . ')</small>'; } - $verup = strtolower( - $upstream->stable ? $upstream->stable : $upstream->unstable - ); - $versions = null; foreach ( $repos as $repomain ) { $display=""; @@ -145,7 +154,8 @@ function report($db, $type) $rpm=$rpms[$repo['main']."-".$repo['sub']]; $verpm=$rpm->ver; - if (preg_match("/\.((beta|RC)\d*)\./i", $rpm->rel, $res)) { + $pat = "/\.((beta|RC)\d*)\./i"; + if (preg_match($pat, $rpm->rel, $res)) { $verpm .= strtolower($res[1]); } @@ -180,7 +190,8 @@ function report($db, $type) break; case "updates": $display .= sprintf( - "<strong>%s</strong>-%s <small>(updates)</small><br/>", + "<strong>%s</strong>-%s ". + "<small>(updates)</small><br/>", $rpm->ver, $rpm->rel ); diff --git a/smarty/templates/rpmphp/rpm.tpl b/smarty/templates/rpmphp/rpm.tpl index 535bfea..9f9d94f 100644 --- a/smarty/templates/rpmphp/rpm.tpl +++ b/smarty/templates/rpmphp/rpm.tpl @@ -28,6 +28,7 @@ <select name="what" id="what"> <optgroup label="Pakages"> <option value="%fedora"{if $what eq '%fedora'} selected="selected"{/if}>In fedora</option> + <option value="%work"{if $what eq '%work'} selected="selected"{/if}>Need work</option> <option value="%stable"{if $what eq '%stable'} selected="selected"{/if}>All stable</option> <option value="%all"{if $what eq '%all'} selected="selected"{/if}>All</option> </optgroup> |