diff options
author | Johan "Papa" Cwiklinski <trasher@odysseus.(none)> | 2010-05-29 21:08:26 +0200 |
---|---|---|
committer | Johan "Papa" Cwiklinski <trasher@odysseus.(none)> | 2010-05-29 21:08:26 +0200 |
commit | 984fed1620d14acf0009122f578a59cdfba5b287 (patch) | |
tree | 84dd207716aa36d79b32fe7ae6e8a86ee87ddb3a /zoom.php | |
parent | 5fdb1c3cf92ffd73a01ecc82ca91112aa17da350 (diff) |
Missing file in last commit ; refs #47
Diffstat (limited to 'zoom.php')
-rw-r--r-- | zoom.php | 227 |
1 files changed, 85 insertions, 142 deletions
@@ -1,53 +1,51 @@ <?php -require "config.inc.php"; -require "FedoraClient.php"; +require 'main.inc.php'; +require 'FedoraClient.php'; $fedcli = new FedoraPkgdb(); $name = $_GET['rpm']; -$ajax_infos = '<span class="ajax">(wait for ajax or <a href="' . $_SERVER['PHP_SELF'] . '?rpm='.$name.'&pkgdb=1">reload with pkgdb</a>)</span>'; -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> - <head> - <title>Packages in Fedora</title> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> - <link rel="stylesheet" type="text/css" media="screen" href="css/rpmphp.css"/> - <!--<link rel="stylesheet" type="text/css" media="print" href="css/rpmphp-print.css">--> - <script type="text/javascript" src="scripts/jquery-1.4.2.min.js"></script> - <script type="text/javascript" src="scripts/rpmphp.js"></script> -<?php -if ( isset($name) && $name != '' ) { -?> - <script type="text/javascript"> - // <![CDATA[ - $(function(){ - initZoomJS('<?php echo $name; ?>'); - }); - //]]> - </script> -<?php +$smarty->assign('name', $name); +$ariane[] = array( + 'url' => '#', + 'text' => 'Package: ' . $name +); +$ajax_infos = '<span class="ajax">(wait for ajax or <a href="' . $_SERVER['PHP_SELF'] . '?rpm='.$name.'&pkgdb=1">reload with pkgdb</a>)</span>'; +$smarty->assign('ajax_infos', $ajax_infos); +$smarty->assign('ariane', $ariane); +$smarty->assign('page_title', 'Package: ' . $name); + +function getBranchPeople($params) +{ + global $fedpkg; + extract($params); + $ret = null; + if ($branch == 'rawhide' && isset($fedpkg['devel']['owner']) ) { + if ( !$people || $people == '' || $people == 'owner' ) { + $ret = $fedpkg['devel']['owner']; + } else if( $people == 'people') { + $ret_tmp = $fedpkg['devel']['people']; + } + } else if (isset($fedpkg[$branch]['owner'])) { + if ( !$people || $people == '' || $people == 'owner' ) { + $ret = $fedpkg[$branch]['owner']; + } else if( $people == 'people') { + $ret_tmp = $fedpkg[$branch]['people']; + } + } + if( $people == 'people') { + foreach ( $ret_tmp as $r ) { + if ( $ret !== null ) { + $ret .= ', '; + } + $ret .= $r['username']; + } + } + return $ret; } -?> - <link rel="shortcut icon" href="images/favicon.ico"/> - <link rel="icon" href="images/favicon.ico"/> - </head> +$smarty->register_function('getBranchPeople', 'getBranchPeople'); - <body> - <div id="wrapper"> -<?php -include '_header.php'; -?> - <div id="fedora-content"> - <div id="ariane"> - <p>You are here: </p> - <ul> - <li><a href="./">Reports home</a></li> - <li><a href="#">Package detail</a></li> - </ul> - </div> -<?php if ( !isset($name) || !$name ) { ?> <h1>Missing package name</h1> @@ -81,124 +79,69 @@ if ( !isset($name) || !$name ) { echo "<h1>$name not found</h1>\n"; } else { - echo "<h1>Package: $name</h1>\n"; + if ($rpm->summary) { + $summary['Summary'] = $rpm->summary; + } else if ($owner->summary) { + $summary['Summary'] = $owner->summary; + } + $summary['Description'] = ((isset($fedpkg['devel']['package']['description'])) ? $fedpkg['devel']['package']['description'] : $ajax_infos); + if ( $rpm->url ) { + $summary['URL'] = $rpm->url; + } + if ($up && $up->type) { + $summary['Type'] = $up->type; + } + if ($up && $up->channel) { + $summary['Channel'] = $up->channel; + } + if ($up && $up->stable) { + $summary['Stabe version'] = $up->stable; + } + if ($up && $up->unstable && $up->stable!=$up->unstable) { + if ($up->state) { + $summary['Unstable version'] = $up->unstable . ' (' . $up->state . ')'; + } else { + $summary['Unstable version'] = $up->unstable; + } + + } + if ($owner && $owner->owner) { + if ($owner->cc) { + $summary['Owner'] = $owner->owner . ' (' . $owner->cc . ')'; + } else { + $summary['Owner'] = $owner->owner; + } + } + $summary['ViewVC'] = 'http://cvs.fedoraproject.org/viewvc/rpms/' . $name . '/'; + if (isset($_GET['pkgdb'])) { $fedpkg = $fedcli->getPackageInfo($name); - echo "<p id=\"pkgdb-link\"><a href='".$_SERVER['PHP_SELF']."?rpm=$name'>Hide pkgdb informations</a></p>"; } else { $fedpkg = false; - echo "<p id=\"pkgdb-link\"><a href='".$_SERVER['PHP_SELF']."?rpm=$name&pkgdb=1'>Show more informations from pkgdb</a></p>"; - } - echo "<table id=\"upstream\">\n"; - echo "<caption>Upstream info</caption>\n"; - $i=0; - - if ($rpm->summary) { - echo "<tr><th>"; $i++; - echo "Summary: </th><td><strong>". $rpm->summary . "</strong></td></tr>\n"; - } else if ($owner->summary) { - echo "<tr><th>"; $i++; - echo "Summary: </th><td><strong>". $owner->summary . "</strong></td></tr>\n"; } + $i=0; - echo "<tr><th>"; $i++; - echo "Description: </th><td id=\"" . $name . "_desc\">" . ((isset($fedpkg['devel']['package']['description'])) ? $fedpkg['devel']['package']['description'] : $ajax_infos) . "</td></tr>\n"; - - if ($rpm->url) { - echo "<tr><th>"; $i++; - echo "URL: </th><td><strong><a href='".$rpm->url."'>". $rpm->url . "</a></strong></td></tr>\n"; - } - if ($up && $up->type) { - echo "<tr><th>"; $i++; - echo "Type: </th><td><strong>". $up->type . "</strong></td></tr>\n"; - } - if ($up && $up->channel) { - echo "<tr><th>"; $i++; - echo "Channel: </th><td><strong>". $up->channel . "</strong></td></tr>\n"; - } - if ($up && $up->stable) { - echo "<tr><th>"; $i++; - echo "Stable version: </th><td><strong>". $up->stable . "</strong></td></tr>\n"; - } - if ($up && $up->unstable && $up->stable!=$up->unstable) { - echo "<tr><th>"; $i++; - echo "Unstable version: </th><td><strong>". $up->unstable . "</strong>"; - if ($up->state) { - echo " (". $up->state . ")\n"; - } - echo "</td></tr>\n"; - } - if ($owner && $owner->owner) { - echo "<tr><th>"; $i++; - echo "Owner: </th><td><strong>". $owner->owner . "</strong>"; - if ($owner->cc) { - echo " (". $owner->cc . ")\n"; - } - echo "</td></tr>\n"; - } - echo "<tr><th>ViewVC: </th>"; $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 "<table id=\"list-packages\">\n"; - echo "<caption>Packages available in Fedora Repositories</caption>\n"; - echo "<thead><tr><th>Branch</th><th>Repository</th><th>Version-Release</th><th>Owner</th><th>Co-maintainers</th></tr></thead><tbody>\n"; $prev=false; do { - if ($rpm->repo_main=='rawhide' && isset($fedpkg['devel']['owner'])) { - $owner = $fedpkg['devel']['owner']; - $people = $fedpkg['devel']['people']; - } else if (isset($fedpkg[$rpm->repo_main]['owner'])) { - $owner = $fedpkg[$rpm->repo_main]['owner']; - $people = $fedpkg[$rpm->repo_main]['people']; - } else { - $owner =" "; - $people = false; - } - $comaint = ''; - if ($people) foreach ($people as $user) { - if (isset($user['aclOrder']['commit']['statuscode']) && $user['aclOrder']['commit']['statuscode']==3) { - if ( $comaint !== '' ) { - $comaint .= ', '; - } - $comaint .= $user['username']; - } - } - echo "<tr class='".($i%2 ? 'odd' : 'even')."'>"; $i++; - echo "<td><strong>".($rpm->repo_main==$prev ? " " : $rpm->repo_main)."</strong></td>"; - echo "<td>".$rpm->repo_sub."</td>"; - echo "<td>".($rpm->epoch ? $rpm->epoch.":" : "").$rpm->ver."-".$rpm->rel."</td>"; - $id = 'pkgdb_' . $rpm->repo_main; - if ( $rpm->repo_main != $prev ) { - echo "<td id=\"" . $id . "_owner\">" . (($fedpkg) ? $owner : $ajax_infos) . "</td><td id=\"" . $id . "_maintainers\">" . (($fedpkg) ? $comaint : $ajax_infos) . "</td></tr>\n"; - } else { - echo '<td> </td><td> </td></tr>'; - } + $packages[] = $rpm; if( $rpm->repo_main != $prev ) { $prev = $rpm->repo_main; } } while ($rpm = $resrpm->fetchObject()); - echo "</tbody></table>"; } } catch(PDOException $e) { printf("%s ERREUR : %s\n", date("r"), $e->getMessage()); } } -?> - - - <!-- document END --> - </div> - <!-- content END --> -<?php -include '_footer.php'; -?> - </div> - </body> -</html> +$smarty->assign('pkgdb', (isset($_GET['pkgdb']) ? $_GET['pkgdb'] : null)); +$smarty->assign('summary', $summary); +$smarty->assign('packages', $packages); +$smarty->assign('fedpkg', $fedpkg); +$page_content = $smarty->fetch('zoom.tpl'); +$smarty->assign('page_content', $page_content); +$smarty->display('main.tpl'); +?>
\ No newline at end of file |