diff options
author | Remi Collet <fedora@famillecollet.com> | 2010-05-22 15:22:32 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2010-05-22 15:22:32 +0200 |
commit | afa9e729734e8bc78411c866dcd1ba1e2f6c914d (patch) | |
tree | 369d21eb1ab3a76cfc44e49438dbc4304cd331ca /zoom.php | |
parent | 1d9140560f969d4545e5b1ba762a90a5385f62f4 (diff) |
index.php
- quick access to package page (zomm) from input on the top/right
- link to github for sources access
zoom.php
- input on the top right corner
- message if package not found
- ViewVC link
Diffstat (limited to 'zoom.php')
-rw-r--r-- | zoom.php | 183 |
1 files changed, 98 insertions, 85 deletions
@@ -51,12 +51,10 @@ body { require "config.inc.php"; if (!isset($_GET['rpm'])) { - die("missing arg."); + die("missing arg."); } $name = $_GET['rpm']; -try { - $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS); ?> </style> @@ -74,7 +72,12 @@ try { </div> <div id="fedora-header-items"> - + <span class="fedora-header-search"> + <form action='zoom.php' method='get'> + Package : + <input type='text' name='rpm' size='20' /> + <input type="image" src='http://docs.fedoraproject.org/images/header-search.png' alt="Search" /> + </form></span> </div> </div> @@ -101,87 +104,98 @@ try { <!-- document BEGIN --> <?php - echo "<h1>$name</h1>\n"; - - $sql = "SELECT rpm.* - FROM rpm - INNER JOIN repo ON (repo.main=rpm.repo_main AND repo.sub=rpm.repo_sub) - WHERE rpm.name='$name' - ORDER BY repo.id DESC"; - $resrpm = $db->query($sql); - $rpm = ($resrpm ? $resrpm->fetchObject() : false); - - $sql = "SELECT * FROM upstream WHERE name = '$name'"; - $resup=$db->query($sql); - $up = ($resup ? $resup->fetchObject() : false); - - $sql = "SELECT * FROM acls WHERE name = '$name'"; - $resown=$db->query($sql); - $owner = ($resown ? $resown->fetchObject() : false); - - echo "<table id='fedora-list-packages'>\n"; - echo "<tr><th colspan='2'>Upstream info</th></tr>\n"; - $i=0; - - if ($rpm && $rpm->summary) { - echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; - echo "Summary</td><td><strong>". $rpm->summary . "</strong></td></tr>\n"; - } else if ($owner->summary) { - echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; - echo "Summary</td><td><strong>". $owner->summary . "</strong></td></tr>\n"; - } - if ($rpm && $rpm->url) { - echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; - echo "URL</td><td><strong><a href='".$rpm->url."'>". $rpm->url . "</a></strong></td></tr>\n"; - } - if ($up && $up->type) { - echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; - echo "Type</td><td><strong>". $up->type . "</strong></td></tr>\n"; - } - if ($up && $up->channel) { - echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; - echo "Channel</td><td><strong>". $up->channel . "</strong></td></tr>\n"; - } - if ($up && $up->stable) { - echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; - echo "Stable version</td><td><strong>". $up->stable . "</strong></td></tr>\n"; - } - if ($up && $up->unstable && $up->stable!=$up->unstable) { - echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; - echo "Unstable version</td><td><strong>". $up->unstable . "</strong>"; - if ($up->state) { - echo " (". $up->state . ")\n"; - } - echo "</td></tr>\n"; - } - if ($owner && $owner->owner) { - echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; - echo "Owner</td><td><strong>". $owner->owner . "</strong>"; - if ($owner->cc) { - echo " (". $owner->cc . ")\n"; - } - } - echo "</table>"; - - if ($rpm) { - echo "<br /><table id='fedora-list-packages'>\n"; - echo "<tr><th colspan='3'>Packages available in Fedora Repositories</th></tr>\n"; - $prev=false; - do { - echo "<tr class='".($i%2 ? 'odd' : 'even')."'>"; $i++; - echo "<td><strong>".($rpm->repo_main==$prev ? " " : $prev=$rpm->repo_main)."</strong></td>"; - echo "<td>".$rpm->repo_sub."</td>"; - echo "<td>".($rpm->epoch ? $rpm->epoch.":" : "").$rpm->ver."-".$rpm->rel."</td>"; - echo "</tr>\n"; - } while ($rpm = $resrpm->fetchObject()); - echo "</table>"; - } - -} -catch(PDOException $e) { - printf("%s ERREUR : %s\n", date("r"), $e->getMessage()); +if (!$name) { + echo "<h1>Enter a package name</h1>\n"; +} else { + try { + $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS); + + $sql = "SELECT rpm.* + FROM rpm + INNER JOIN repo ON (repo.main=rpm.repo_main AND repo.sub=rpm.repo_sub) + WHERE rpm.name='$name' + ORDER BY repo.id DESC"; + $resrpm = $db->query($sql); + $rpm = ($resrpm ? $resrpm->fetchObject() : false); + + $sql = "SELECT * FROM upstream WHERE name = '$name'"; + $resup=$db->query($sql); + $up = ($resup ? $resup->fetchObject() : false); + + $sql = "SELECT * FROM acls WHERE name = '$name'"; + $resown=$db->query($sql); + $owner = ($resown ? $resown->fetchObject() : false); + + if (!$rpm) { + echo "<h1>$name not found</h1>\n"; + } else { + echo "<h1>Package: $name</h1>\n"; + echo "<table id='fedora-list-packages'>\n"; + echo "<tr><th colspan='2'>Upstream info</th></tr>\n"; + $i=0; + + if ($rpm->summary) { + echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; + echo "Summary</td><td><strong>". $rpm->summary . "</strong></td></tr>\n"; + } else if ($owner->summary) { + echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; + echo "Summary</td><td><strong>". $owner->summary . "</strong></td></tr>\n"; + } + if ($rpm->url) { + echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; + echo "URL</td><td><strong><a href='".$rpm->url."'>". $rpm->url . "</a></strong></td></tr>\n"; + } + if ($up && $up->type) { + echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; + echo "Type</td><td><strong>". $up->type . "</strong></td></tr>\n"; + } + if ($up && $up->channel) { + echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; + echo "Channel</td><td><strong>". $up->channel . "</strong></td></tr>\n"; + } + if ($up && $up->stable) { + echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; + echo "Stable version</td><td><strong>". $up->stable . "</strong></td></tr>\n"; + } + if ($up && $up->unstable && $up->stable!=$up->unstable) { + echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; + echo "Unstable version</td><td><strong>". $up->unstable . "</strong>"; + if ($up->state) { + echo " (". $up->state . ")\n"; + } + echo "</td></tr>\n"; + } + if ($owner && $owner->owner) { + echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++; + echo "Owner</td><td><strong>". $owner->owner . "</strong>"; + if ($owner->cc) { + echo " (". $owner->cc . ")\n"; + } + echo "</td></tr>\n"; + } + echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>ViewVC</td>"; $i++; + echo "<td><a href='http://cvs.fedoraproject.org/viewvc/rpms/$name/'>http://cvs.fedoraproject.org/viewvc/rpms/$name/</a>"; + echo "</td></tr>\n"; + + echo "</table>"; + + echo "<br /><table id='fedora-list-packages'>\n"; + echo "<tr><th colspan='3'>Packages available in Fedora Repositories</th></tr>\n"; + $prev=false; + do { + echo "<tr class='".($i%2 ? 'odd' : 'even')."'>"; $i++; + echo "<td><strong>".($rpm->repo_main==$prev ? " " : $prev=$rpm->repo_main)."</strong></td>"; + echo "<td>".$rpm->repo_sub."</td>"; + echo "<td>".($rpm->epoch ? $rpm->epoch.":" : "").$rpm->ver."-".$rpm->rel."</td>"; + echo "</tr>\n"; + } while ($rpm = $resrpm->fetchObject()); + echo "</table>"; + } + } + catch(PDOException $e) { + printf("%s ERREUR : %s\n", date("r"), $e->getMessage()); + } } - ?> @@ -204,4 +218,3 @@ catch(PDOException $e) { <!-- footer END --> </body> </html> - |