summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.php150
-rw-r--r--smarty/templates/rpmphp/index.tpl40
2 files changed, 111 insertions, 79 deletions
diff --git a/index.php b/index.php
index c9136f4..f1ff7c3 100644
--- a/index.php
+++ b/index.php
@@ -1,85 +1,77 @@
-<!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">-->
- <link rel="shortcut icon" href="images/favicon.ico"/>
- <link rel="icon" href="images/favicon.ico"/>
- </head>
-
- <body>
- <div id="wrapper">
-<?php
-include '_header.php';
-?>
- <!-- content BEGIN -->
- <div id="fedora-content">
- <div id="ariane">
- <p>You are here: </p>
- <ul>
- <li><a href="#">Reports home</a></li>
- </ul>
- </div>
- <h1>Packages in Fedora repositories</h1>
- <h2>Package reports</h2>
- <ul id="reports">
- <li><a href="rpm.php?type=pecl">PECL Extensions in Fedora</a> with upstream information</li>
- <li><a href="rpm.php?type=pear">PEAR Extensions in Fedora</a> with upstream information</li>
- <li><a href="rpm.php?type=R">R Extensions in Fedora</a> with upstream information</li>
- <li><a href="all.php">All Packages in Fedora</a></li>
- </ul><!-- /reports -->
- <table id="list-packages">
- <caption><strong>Analysed repositories</strong></caption>
- <thead>
- <tr>
- <th>Main</th>
- <th>Active</th>
- <th>Sub</th>
- <th>Url</th>
- <th>Last update</th>
- </tr>
- </thead>
- <tbody>
<?php
-require "config.inc.php";
+
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Display informations from a specific package
+ *
+ * PHP version 5
+ *
+ * Copyright © 2010 Remi Collet
+ *
+ * This file is part of rpmphp.
+ *
+ * rpmphp is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * rpmphp is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with rpmphp. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Main
+ * @package RPMPHP
+ *
+ * @author Remi Collet <unknown@unknwown.com>
+ * @author Johan Cwiklinski <johan@x-tnd.be>
+ * @copyright 2010 Remi Collet
+ * @license http://www.gnu.org/licenses/agpl-3.0-standalone.html AGPL License 3.0 or (at your option) any later version
+ * @version SVN: $Id: ajouter_adherent.php 836 2010-02-27 08:11:44Z trashy $
+ * @link http://github.com/remicollet/rpmphp/
+ * @since The begining of times.
+*/
+require 'main.inc.php';
+
+$smarty->assign('ariane', $ariane);
+$smarty->assign('page_title', 'Packages in Fedora repositories');
+
try {
- $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS);
+ $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS);
- $sql='SELECT * FROM repo ORDER BY ID';
- $res=$db->query($sql);
- if ($res) for ($i=0, $prev="xx" ; $repo=$res->fetchObject() ; $i++, $prev=$repo->main) {
- printf ("<tr class='%s'><td><strong>%s</strong></td><td>%s</td><td>%s</td><td><a href='%s'>%s</a></td><td>%s</td></tr>\n",
- ($i%2 ? 'odd' : 'even'),
- ($repo->main != $prev ? $repo->main : "&nbsp;"),
- ($repo->main != $prev ? ($repo->active ? "<strong>Yes</strong>" : "no") : "&nbsp;"),
- $repo->sub, $repo->url, $repo->url, date("r", $repo->stamp));
- }
+ $sql='SELECT * FROM repo ORDER BY ID';
+ $res=$db->query($sql);
+ $repositories = null;
+ if ( $res ) {
+ for ( $i=0, $prev="xx";
+ $repo=$res->fetchObject();
+ $i++, $prev=$repo->main
+ ) {
+ $repositories[] = array(
+ 'repo_name' => ($repo->main != $prev ? $repo->main : "&nbsp;"),
+ 'active' => ($repo->main != $prev ?
+ ($repo->active ? "<strong>Yes</strong>" : "no") :
+ "&nbsp;"
+ ),
+ 'sub_name' => $repo->sub,
+ 'url' => $repo->url,
+ 'date' => date("r", $repo->stamp)
+ );
+ }
+ $smarty->assign('repositories', $repositories);
+ }
} catch(PDOException $e) {
-?>
- <tr>
- <td colspan="5">
-<?php
- printf("%s ERREUR : %s\n", date("r"), $e->getMessage());
-?>
- </td>
- </tr>
-<?php
+ $smarty->assign(
+ 'error',
+ sprintf("%s ERREUR : %s\n", date("r"), $e->getMessage())
+ );
}
-?>
- </tbody>
- </table><!-- /list-pacakges -->
-
- <h2>Script sources</h2>
- <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 -->
-<?php
-include '_footer.php';
-?>
- </div>
- </body>
-</html>
-
+$page_content = $smarty->fetch('index.tpl');
+$smarty->assign('page_content', $page_content);
+$smarty->display('main.tpl');
+?> \ No newline at end of file
diff --git a/smarty/templates/rpmphp/index.tpl b/smarty/templates/rpmphp/index.tpl
new file mode 100644
index 0000000..df6cb52
--- /dev/null
+++ b/smarty/templates/rpmphp/index.tpl
@@ -0,0 +1,40 @@
+ <h2>Package reports</h2>
+ <ul id="reports">
+ <li><a href="rpm.php?type=pecl">PECL Extensions in Fedora</a> with upstream information</li>
+ <li><a href="rpm.php?type=pear">PEAR Extensions in Fedora</a> with upstream information</li>
+ <li><a href="rpm.php?type=R">R Extensions in Fedora</a> with upstream information</li>
+ <li><a href="all.php">All Packages in Fedora</a></li>
+ </ul><!-- /reports -->
+ <table id="list-packages">
+ <caption><strong>Analysed repositories</strong></caption>
+ <thead>
+ <tr>
+ <th>Main</th>
+ <th>Active</th>
+ <th>Sub</th>
+ <th>Url</th>
+ <th>Last update</th>
+ </tr>
+ </thead>
+ <tbody>
+{if $error}
+ <tr>
+ <td colspan="5">{$error}</td>
+ </tr>
+{else}
+ {foreach from=$repositories item=repo name=rlist}
+ <tr class="{if $smarty.foreach.rlist.iteration % 2 eq 0}even{else}odd{/if}">
+ <td><strong>{$repo.repo_name}</strong></td>
+ <td>{$repo.active}</td>
+ <td>{$repo.sub_name}</td>
+ <td><a href="{$repo.url}">{$repo.url}</a></td>
+ <td>{$repo.date}</td>
+ </tr>
+ {/foreach}
+{/if}
+ </tbody>
+ </table><!-- /list-pacakges -->
+ <h2>Script sources</h2>
+ <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>
+