summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan "Papa" Cwiklinski <trasher@odysseus.(none)>2010-05-25 01:05:25 +0200
committerJohan "Papa" Cwiklinski <trasher@odysseus.(none)>2010-05-25 01:05:25 +0200
commitb76086add9ffb0cbd9ddf54955df51db436ed07a (patch)
tree3f28f0d4653579150915b8e26406d3ae63bfb368
parent423564807cbf345a16840acf31ef4bad3a527092 (diff)
Move common header and footer HTML code into separate (and reusable) files, change RPM page layout and validate xhtml 1.0 strict
-rw-r--r--_footer.php7
-rw-r--r--_header.php14
-rw-r--r--css/rpmphp.css38
-rw-r--r--index.php28
-rw-r--r--rpm.php293
5 files changed, 181 insertions, 199 deletions
diff --git a/_footer.php b/_footer.php
new file mode 100644
index 0000000..591540b
--- /dev/null
+++ b/_footer.php
@@ -0,0 +1,7 @@
+ <div id="footer">
+ <p class="disclaimer">The Fedora Project is maintained and driven by the community and sponsored by Red Hat. This is a community maintained site. Red Hat is not responsible for content.</p>
+ <ul>
+ <li><a href="http://fedoraproject.org/wiki/Legal:Main">Legal</a></li>
+ <li><a href="http://fedoraproject.org/wiki/Legal:Trademark_guidelines">Trademark Guidelines</a></li>
+ </ul>
+ </div><!-- /footer -->
diff --git a/_header.php b/_header.php
new file mode 100644
index 0000000..63f5850
--- /dev/null
+++ b/_header.php
@@ -0,0 +1,14 @@
+ <div id="header">
+ <h1>
+ <a href="http://fedoraproject.org"><img src="images/fedora-logo.png" alt="Fedora Project"/></a>
+ </h1>
+ <div id="headsearch">
+ <form action='zoom.php' method='get'>
+ <div>
+ <label for="rpm">Package&nbsp;: </label>
+ <input type="text" name="rpm" id="rpm" size="20" />
+ <input type="submit" value="Search" />
+ </div>
+ </form>
+ </div>
+ </div>
diff --git a/css/rpmphp.css b/css/rpmphp.css
index 1bf4ae9..89ce374 100644
--- a/css/rpmphp.css
+++ b/css/rpmphp.css
@@ -64,6 +64,11 @@ p{
background: #FFFFFF url(../images/border-right.png) 100% 0 repeat-y;
}
+#fedora-content{
+ margin-right:18px;
+ position:relative;
+}
+
#header {
border-top: 10px solid #337ACC;
padding: 1ex 17px;
@@ -150,29 +155,52 @@ p{
border-top:1px solid #DDDDDD;
}
+#filter{
+ display:inline-block;
+ position:absolute;
+ right:1em;
+}
+
+#filter fieldset{
+ padding:.2em;
+}
+
+#count_found{
+ text-align:right;
+ font-size:.9em;
+ font-style:italic;
+}
+
+#legend{
+ margin:0 auto;
+ list-style:none;
+ width:20%;
+ text-align:center;
+}
+
.error {
background:url(../images/icon-error.png) no-repeat left;
- padding-left: 21px;
+ padding-left: 21px!important;
}
.info {
background:url(../images/icon-info.png) no-repeat left;
- padding-left: 21px;
+ padding-left: 21px!important;
}
.attn {
background:url(../images/attention.png) no-repeat left;
- padding-left: 21px;
+ padding-left: 21px!important;
}
.check {
background:url(../images/checkmark.png) no-repeat left;
- padding-left: 21px;
+ padding-left: 21px!important;
}
.cpan {
background:url(../images/perl.gif) no-repeat left;
- padding-left: 18px;
+ padding-left: 18px!important;
}
/*.rt {
diff --git a/index.php b/index.php
index 863ccdb..c9136f4 100644
--- a/index.php
+++ b/index.php
@@ -11,21 +11,9 @@
<body>
<div id="wrapper">
- <div id="header">
- <h1>
- <a href="http://fedoraproject.org"><img src="images/fedora-logo.png" alt="Fedora Project"/></a>
- </h1>
- <div id="headsearch">
- <form action='zoom.php' method='get'>
- <div>
- <label for="rpm">Package&nbsp;: </label>
- <input type="text" name="rpm" id="rpm" size="20" />
- <input type="submit" value="Search" />
- </div>
- </form>
- </div>
- </div>
-
+<?php
+include '_header.php';
+?>
<!-- content BEGIN -->
<div id="fedora-content">
<div id="ariane">
@@ -88,13 +76,9 @@ try {
<p>You can retrieve the current application sources from my GIT repository on github.com: <a href='http://github.com/remicollet/rpmphp'>http://github.com/remicollet/rpmphp</a>.</p>
<p>Feedbacks, RFE and patches are welcome.</p>
</div><!-- /fedora-content -->
- <div id="footer">
- <p class="disclaimer">The Fedora Project is maintained and driven by the community and sponsored by Red Hat. This is a community maintained site. Red Hat is not responsible for content.</p>
- <ul>
- <li><a href="http://fedoraproject.org/wiki/Legal:Main">Legal</a></li>
- <li><a href="http://fedoraproject.org/wiki/Legal:Trademark_guidelines">Trademark Guidelines</a></li>
- </ul>
- </div><!-- /footer -->
+<?php
+include '_footer.php';
+?>
</div>
</body>
</html>
diff --git a/rpm.php b/rpm.php
index 2da5bfc..7c42c3c 100644
--- a/rpm.php
+++ b/rpm.php
@@ -3,80 +3,26 @@ $what=(isset($_GET["what"]) ? $_GET["what"] : "%fedora");
$type=(isset($_GET["type"]) ? $_GET["type"] : "pecl");
require "config.inc.php";
-?>
-<html>
- <head>
- <title><?php echo $type; ?> extensions in Fedora</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <link rel="stylesheet" type="text/css" media="print" href="http://docs.fedoraproject.org/css/print.css">
- <style type="text/css" media="screen">
- @import url("http://docs.fedoraproject.org/css/layout.css");
- @import url("http://docs.fedoraproject.org/css/content.css");
- @import url("http://docs.fedoraproject.org/css/docbook.css");
-
-body {
- background-image:none;
-}
-.error {
- background:url(http://fedoraproject.org/wikidata/kindofblue/img/icon-error.png) no-repeat left;
- padding-left: 21px;
-}
-
-.info {
- background:url(http://fedoraproject.org/wikidata/kindofblue/img/icon-info.png) no-repeat left;
- padding-left: 21px;
-}
-
-.attn {
- background:url(http://fedoraproject.org/wikidata/kindofblue/img/attention.png) no-repeat left;
- padding-left: 21px;
-}
-
-.check {
- background:url(http://fedoraproject.org/wikidata/kindofblue/img/checkmark.png) no-repeat left;
- padding-left: 21px;
-}
-
-.cpan {
- background:url(http://www.perl.com/favicon.ico) no-repeat left;
- padding-left: 18px;
-}
-
-.rt {
- background:url(/img/rt.png) no-repeat left;
- padding-left: 18px;
-}
-
-.bz {
- background:url(/img/bz.png) no-repeat left;
- padding-left: 18px;
-}
-<?php
-
-function Report ($db, $type) {
- global $what;
-
- echo "<h1>".strtoupper($type)." extensions in Fedora</h1>\n";
-
-
- $repos=array();
+function listRepos($db){
+ $repos = array();
$res=$db->query("SELECT * FROM repo WHERE active=1 ORDER BY ID");
if ($res) while ($repo = $res->fetchObject()) {
$repos[$repo->main][$repo->sub]=$repo;
}
- // echo "<pre>"; print_r($repos);echo "</pre>";
-
- echo "<table id='fedora-list-packages'>\n";
- echo "<tr class='odd'><th>Package</th><th>Owner(s)</th><th>Upstream</th>";
-
+ // echo "<pre>"; print_r($repos);echo "</pre>";
foreach($repos as $repomain) {
foreach ($repomain as $repo) {
- printf ("<th align='left'>%s</th>", $repo->main);
+ /*printf ("<th align='left'>%s</th>", $repo->main);*/
+ $repos[$repo->main][$repo->sub] = $repo;
break;
}
}
- echo "</tr>\n";
+ return $repos;
+}
+
+function Report ($db, $type, $repos) {
+ global $what;
$i=0;
$resup=$db->query("SELECT * FROM upstream WHERE type='$type' ORDER BY name");
@@ -97,7 +43,7 @@ function Report ($db, $type) {
case '%fedora':
$display = ($rpm !== false);
break;
- case '%stable':
+ case '%stable':
$display = !empty($upstream->stable);
break;
case '%all':
@@ -110,7 +56,7 @@ function Report ($db, $type) {
if ($display) {
if ($rpm) {
- $dispname = "<a href='zoom.php?rpm=" . $rpmname . "' title='" . $rpm->summary . "'>$rpmname</a>";
+ $dispname = "<a href=\"zoom.php?rpm=" . $rpmname . "\" title=\"" . htmlentities($rpm->summary) . "\">$rpmname</a>";
} else {
$dispname = $rpmname;
}
@@ -121,14 +67,14 @@ function Report ($db, $type) {
$dispowner="";
foreach ($owners as $owner) {
- if ($dispowner) $dispowner .= "<br>";
- $dispowner .= sprintf ("<a href='%s?type=$type&what=%s'>%s</a>", $_SERVER["PHP_SELF"], $owner, $owner);
+ if ($dispowner) $dispowner .= "<br/>";
+ $dispowner .= sprintf ("<a href=\"%s?type=$type&amp;what=%s\">%s</a>", $_SERVER["PHP_SELF"], $owner, $owner);
}
- printf ("<tr class='%s'><td>%s<br><small>%s</small></td><td>%s</td><td>%s%s</td>",
- ($i%2 ? "odd" : "even"), $dispname,
+ printf ("<tr class=\"%s\">\n\t<td>%s<br/><small>%s</small></td>\n\t<td>%s</td>\n\t<td>%s%s</td>\n",
+ ($i%2 ? "odd" : "even"), $dispname,
($upstream->channel != $upstream->type ? "channel: " . $upstream->channel : ""),
$dispowner,
- ($upstream->stable ? "<b>".$upstream->stable."</b><br />" : "&nbsp;"),
+ ($upstream->stable ? "<strong>".$upstream->stable."</strong><br />" : "&nbsp;"),
($upstream->unstable && (!$upstream->stable || $upstream->stable!=$upstream->unstable) ? $upstream->unstable." <small>(".$upstream->state.")</small>" : "&nbsp;"));
$verup = strtolower($upstream->stable ? $upstream->stable : $upstream->unstable);
@@ -137,132 +83,118 @@ function Report ($db, $type) {
$display="";
$class="";
foreach ($repomain as $repo) {
- if (isset($rpms[$repo->main."-".$repo->sub])) {
+ if (isset($rpms[$repo->main."-".$repo->sub])) {
$rpm=$rpms[$repo->main."-".$repo->sub];
$verpm=$rpm->ver;
if (preg_match("/\.((beta|RC)\d*)\./i", $rpm->rel, $res)) {
$verpm .= strtolower($res[1]);
}
-
+
switch ($repo->sub) {
case "base":
if (isset($rpms[$repo->main."-updates"])) {
- $display .= sprintf("%s-%s<br>", $rpm->ver, $rpm->rel);
+ $display .= sprintf("%s-%s<br/>", $rpm->ver, $rpm->rel);
} else {
- $display .= sprintf("<b>%s</b>-%s<br>", $rpm->ver, $rpm->rel);
+ $display .= sprintf("<strong>%s</strong>-%s<br/>", $rpm->ver, $rpm->rel);
}
if ($verup==$verpm) $class="check";
break;
case "":
- $display .= sprintf("<b>%s</b>-%s<br>", $rpm->ver, $rpm->rel);
+ $display .= sprintf("<strong>%s</strong>-%s<br/>", $rpm->ver, $rpm->rel);
if ($verup==$verpm) $class="check";
break;
case "updates":
- $display .= sprintf("<b>%s</b>-%s <small>(updates)</small><br>", $rpm->ver, $rpm->rel);
+ $display .= sprintf("<strong>%s</strong>-%s <small>(updates)</small><br/>", $rpm->ver, $rpm->rel);
if ($verup==$verpm) $class="check";
break;
case "testing":
- $display .= sprintf("%s-%s <small>(testing)</small><br>", $rpm->ver, $rpm->rel);
+ $display .= sprintf("%s-%s <small>(testing)</small><br/>", $rpm->ver, $rpm->rel);
if ($verup==$verpm) $class="info";
- break;
+ break;
}
} // RPM exists
} // sub repo
if ($display && empty($class)) $class="attn";
if ($display) {
- printf("<td><div class='%s'>%s</div></td>", $class, $display);
+ printf("\t<td class=\"%s\">%s</td>\n", $class, $display);
} else {
- echo "<td>&nbsp;</td>";
+ echo "\t<td>&nbsp;</td>\n";
}
} // mainrepo
echo "</tr>\n";
- $i++;
+ $i++;
}
} // each $unstable
- echo "</table>\n";
- echo "<p>$i packages found</p>";
+ echo "<tr id=\"count_found\"><td colspan=\"" . (count(array_keys($repos)) + 3) . "\">$i packages found</td></tr>\n";
}
-try {
- $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS);
?>
- </style>
-
- <meta name="MSSmartTagsPreventParsing" content="TRUE">
- <link rel="shortcut icon" href="http://docs.fedoraproject.org/images/favicon.ico">
- <link rel="icon" href="http://docs.fedoraproject.org/images/favicon.ico">
+<!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><?php echo $type; ?> extensions 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">-->
+ <link rel="shortcut icon" href="images/favicon.ico"/>
+ <link rel="icon" href="images/favicon.ico"/>
</head>
-
<body>
- <!-- header BEGIN -->
- <div id="fedora-header">
- <div id="fedora-header-logo">
-
- <a href="http://fedoraproject.org"><img src="http://docs.fedoraproject.org/images/header-fedora_logo01.png" alt="Fedora Project"></a>
- </div>
-
- <div id="fedora-header-items">
- <span class="fedora-header-search">
+ <div id="wrapper">
<?php
- echo "<form action='" . $_SERVER["PHP_SELF"] . "' method='get'>";
- echo "<input type='hidden' name='type' value='$type' />";
+include '_header.php';
?>
- <select name='what' size='1'>
- <optgroup label='Pakages'>
- <option value='%fedora' <?php if ($what=='%fedora') echo " selected='1'"; ?> >In fedora</option>
- <option value='%stable' <?php if ($what=='%stable') echo " selected='1'"; ?> >All stable</option>
- <option value='%all' <?php if ($what=='%all') echo " selected='1'"; ?> >All</option>
- </optgroup>
- <optgroup label='Owner'>
+ <!-- content BEGIN -->
+ <div id="fedora-content">
+ <div id="ariane">
+ <p>You are here: </p>
+ <ul>
+ <li><a href="./">Reports home</a></li>
+ <li><a href="#"><?php echo strtoupper($type) . ' extensions'; ?></a></li>
+ </ul>
+ </div>
+
+ <div id="filter">
+ <form action="rpm.php" method="get">
+ <fieldset>
+ <legend>Filter <?php echo strtoupper($type); ?> packages</legend>
+ <input type="hidden" name='type' value="<?php echo $type; ?>" />
+ <label for="what">Where to search: </label>
+ <select name="what" id="what">
+ <optgroup label="Pakages">
+ <option value="%fedora"<?php if ($what=='%fedora') echo " selected=\"selected\""; ?>>In fedora</option>
+ <option value="%stable"<?php if ($what=='%stable') echo " selected=\"selected\""; ?>>All stable</option>
+ <option value="%all"<?php if ($what=='%all') echo " selected=\"selected\""; ?>>All</option>
+ </optgroup>
+ <optgroup label="Owner">
<?php
+try {
switch ($type) {
case "pecl": $filter = "WHERE name LIKE 'php-pecl-%' "; break;
case "pear": $filter = "WHERE name LIKE 'php-%' "; break;
case "R": $filter = "WHERE name LIKE 'R-%' "; break;
default: $filter = "";
}
+
+ $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS);
$sql="SELECT DISTINCT owner FROM acls $filter ORDER BY owner";
$res=$db->query($sql);
if ($res)while ($owner = $res->fetchObject()) {
- printf("<option value='%s' %s>%s</option>", $owner->owner, ($what==$owner->owner ? "selected='1'" : ""), $owner->owner);
+ printf("\t\t\t\t\t\t\t\t\t<option value=\"%s\" %s>%s</option>\n", $owner->owner, ($what==$owner->owner ? " selected=\"selected\"" : ""), $owner->owner);
} else {
- echo "<option value='remi'>remi</option>";
+ echo "\t\t\t\t\t\t\t\t\t<option value=\"remi\">remi</option>\n";
}
?>
- </optgroup>
- </select>
- <input type="image" src='http://docs.fedoraproject.org/images/header-search.png' alt="Search" />
- </form></span>
-
- </div>
-
- </div>
-
- <div id="fedora-nav"></div>
- &nbsp;<img src='http://docs.fedoraproject.org/images/link-offsite-side.png' />
- <a href="./">Reports home</a>
- &nbsp;<img src='http://docs.fedoraproject.org/images/link-offsite-side.png' />
- <?php echo "$type extensions"; ?>
- <!-- header END -->
-
- <!-- leftside BEGIN -->
- <div id="fedora-side-left">
- </div>
-
- <!-- leftside END -->
-
- <!-- content BEGIN -->
- <div id="fedora-middle-one">
- <div class="fedora-corner-tr">&nbsp;</div>
- <div class="fedora-corner-tl">&nbsp;</div>
- <div id="fedora-content">
-
- <!-- document BEGIN -->
-
-
-
+ </optgroup>
+ </select><br/>
+ <label for="rpmf">Criteria: </label>
+ <input type="text" name="rpmf" id="rpmf" size="20" />
+ <input type="submit" value="Filter" />
+ </fieldset>
+ </form>
+ </div>
<?php
$sql='SELECT MAX(stamp) AS stamp FROM repo';
@@ -271,40 +203,57 @@ try {
printf("<p>Repositories last updated %s.</p>", date("r", $row->stamp));
}
- Report($db, $type);
- echo "<p>&nbsp</p>";
-
+?>
+ <h1><?php echo strtoupper($type). ' extensions in Fedora'; ?></h1>
+ <table id="list-packages">
+ <thead>
+ <tr>
+ <th>Package</th>
+ <th>Owner(s)</th>
+ <th>Upstream</th>
+<?php
+$repos = listRepos($db);
+$repos_k = array_keys($repos);
+foreach ( $repos_k as $r ) {
+?>
+ <th><?php echo $r; ?></th>
+<?php
}
-catch(PDOException $e) {
+?>
+
+ </tr>
+ </thead>
+ <tbody>
+<?php
+ Report($db, $type, $repos);
+} catch(PDOException $e) {
+?>
+ <tr>
+ <td colspan="<?php echo count($repos_k) + 3; ?>">
+<?php
printf("%s ERREUR : %s\n", date("r"), $e->getMessage());
+?>
+ </td>
+ </tr>
+<?php
}
-
?>
+ </tbody>
+ </table>
+ <ul id="legend">
+ <li>Legend: </li>
+ <li><strong>Upstream</strong>: bold if stable. </li>
+ <li><strong>Repo</strong>: bold for latest release.</li>
+ <li class='check'>Lastest released (stable if exists)</li>
+ <li class='info'>Lastest in testing</li>
+ <li class='attn'>Lastest not available</li>
+ </ul>
+ </div><!-- /fedora-content -->
-<table id='fedora-list-packages'><tr><th>Legend:&nbsp;</th>
-<td><b>Upstream</b>: bold if stable. <b>Repo</b>: bold for latest release.</td>
-<td><div class='check'>Lastest released (stable if exists)</div></td>
-<td><div class='info'>Lastest in testing</div></td>
-<td><div class='attn'>Lastest not available</div></td>
-</tr></table>
-
- <!-- document END -->
- </div>
- <div class="fedora-corner-br">&nbsp;</div>
- <div class="fedora-corner-bl">&nbsp;</div>
- </div>
-
- <!-- content END -->
-
- <!-- footer BEGIN -->
-
- <div id="fedora-footer">
- <br/>The Fedora Project is maintained and driven by the community and sponsored by Red Hat.
- <br/><a href="http://fedoraproject.org/wiki/Legal">Legal</a> | <a href="http://fedoraproject.org/wiki/Legal/TrademarkGuidelines">Trademark Guidelines</a>
- <br>
+<?php
+include '_footer.php';
+?>
</div>
-
- <!-- footer END -->
</body>
</html>