summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/feed-browser/index.html47
-rw-r--r--contrib/feed-browser/index.php108
-rw-r--r--contrib/feed-browser/scripts/js/repo.js129
-rw-r--r--contrib/feed-browser/section.php85
4 files changed, 261 insertions, 108 deletions
diff --git a/contrib/feed-browser/index.html b/contrib/feed-browser/index.html
new file mode 100644
index 0000000000..08b1d9a804
--- /dev/null
+++ b/contrib/feed-browser/index.html
@@ -0,0 +1,47 @@
+<!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" lang="en" xml:lang="en">
+ <head>
+ <title>Feed browser</title>
+ <meta http-equiv="Content-Style-Type" content="text/css" />
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <style type="text/css" media="all">@import "css/feed.css";</style>
+ <script language="javascript" type="text/javascript" src="scripts/js/repo.js"></script>
+ </head>
+ <body onLoad=" qs(); getLetter(); getSection();">
+ <div id="right">
+ <div id="searchletter"</div>
+ <form name="pkg_query" onsubmit="javascript:pkgQuery();return false"">
+ <fieldset>
+ <label for="name">Package name</label>
+ <input id="pkgsearch" type="text" name="pkgsearch" value="" />
+ <select name="arch">
+ <option value="" selected="selected">all architectures</option>
+ <option value="all">no arch</option>
+<?php
+
+foreach($archs_list as $architecture)
+{
+ echo "<option value='{$architecture['p_arch']}'";
+
+ if($architecture['p_arch'] == $arch)
+ {
+ echo ' selected="selected"';
+ }
+ echo ">{$architecture['p_arch']}</option>";
+}
+
+?>
+
+
+ </select>
+ <input type="submit" value="Search" />
+ </fieldset>
+ </form>
+ <div id="opkgoutput"><?php echo $ipkgoutput; ?></div>
+ </div>
+ <div id="left">
+ <h1>Sections list</h1>
+ <div id="sectionslist"></div>
+ </div>
+ </body>
+</html>
diff --git a/contrib/feed-browser/index.php b/contrib/feed-browser/index.php
deleted file mode 100644
index eca57e9269..0000000000
--- a/contrib/feed-browser/index.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-
-/*
- * (c) Koen Kooi 2006, 2007
- * (c) Marcin Juszkiewicz 2006, 2007
- *
- * This php script is intended to do the following:
- *
- * - have searchable webfronted for the feed like packages.ubuntu.com
- *
- * ToDo:
- *
- * - search functionality
- * - provide feed-management functionality
- * - allow uploading of new software
- *
- *
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License along
- * with this library; see the file COPYING.LIB. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- *
- */
-
-require_once 'includes/config.inc';
-require_once 'includes/functions.inc';
-
-if(!check_database())
-{
- die("Database not found and cannot be created.");
-}
-
-read_vars_from_get(array('name', 'arch', 'pkgsearch', 'letter', 'pkgname', 'section'));
-
-$ipkgoutput = '';
-
-if(!empty($section))
-{
- $ipkgoutput = searchsection($section);
-}
-elseif(!empty($letter))
-{
- $ipkgoutput = searchpkg("{$letter}%", $arch);
-}
-elseif(!empty($pkgname))
-{
- $ipkgoutput = pkgdetails($pkgname);
-}
-elseif(!empty($pkgsearch) OR !empty($arch))
-{
- $ipkgoutput = searchpkg("%{$pkgsearch}%", $arch);
-}
-
-$archs_list = get_arch_list();
-
-?>
-<!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" lang="en" xml:lang="en">
- <head>
- <title>Feed browser</title>
- <meta http-equiv="Content-Style-Type" content="text/css" />
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <style type="text/css" media="all">@import "css/feed.css";</style>
- </head>
- <body >
- <div id="right">
- <?php echo searchletter(); ?>
- <form action="" method="get">
- <fieldset>
- <label for="name">Package name</label>
- <input type="text" name="pkgsearch" value="<?php echo $pkgsearch; ?>" />
- <select name="arch">
- <option value="" selected="selected">all architectures</option>
- <option value="all">no arch</option>
-<?php
-
-foreach($archs_list as $architecture)
-{
- echo "<option value='{$architecture['p_arch']}'";
-
- if($architecture['p_arch'] == $arch)
- {
- echo ' selected="selected"';
- }
- echo ">{$architecture['p_arch']}</option>";
-}
-
-?>
- </select>
- <input type="submit" value="Search" />
- </fieldset>
- </form>
- <?php echo $ipkgoutput; ?>
- </div>
- <div id="left">
- <h1>Sections list</h1>
- <?php echo sectionslist(); ?>
- </div>
- </body>
-</html>
diff --git a/contrib/feed-browser/scripts/js/repo.js b/contrib/feed-browser/scripts/js/repo.js
new file mode 100644
index 0000000000..95b36f3935
--- /dev/null
+++ b/contrib/feed-browser/scripts/js/repo.js
@@ -0,0 +1,129 @@
+/* The following function creates an XMLHttpRequest object... */
+
+function createRequestObject(){
+ var request_o; //declare the variable to hold the object.
+ var browser = navigator.appName; //find the browser name
+ if(browser == "Microsoft Internet Explorer"){
+ /* Create the object using MSIE's method */
+ request_o = new ActiveXObject("Microsoft.XMLHTTP");
+ } else {
+ /* Create the object using other browser's method */
+ request_o = new XMLHttpRequest();
+ }
+ return request_o; //return the object
+}
+
+/* The variable http will hold our new XMLHttpRequest object. */
+var sectionHTTP = createRequestObject();
+var queryHTTP = createRequestObject();
+var http = createRequestObject();
+
+var qsParm = new Array();
+qsParm['pkgsearch'] = null;
+qsParm['arch'] = null;
+qsParm['section'] = null;
+qsParm['pkgname'] = null;
+
+
+function qs() {
+ var query = window.location.search.substring(1);
+ var parms = query.split('&');
+ for (var i=0; i<parms.length; i++) {
+ var pos = parms[i].indexOf('=');
+ if (pos > 0) {
+ var key = parms[i].substring(0,pos);
+ var val = parms[i].substring(pos+1);
+ qsParm[key] = val;
+ }
+ }
+ if (qsParm['pkgsearch']) {
+ document.getElementById('pkgsearch').value = qsParm['pkgsearch'];
+ pkgQuery();
+ }
+ if (qsParm['pkgname']) {
+ document.getElementById('pkgsearch').value = qsParm['pkgname'];
+ pkgQuery();
+ }
+ if (qsParm['section']) {
+ pkgQuery();
+ }
+
+}
+
+function pkgQuery() {
+ var action = 'pkgquery';
+ var params = '';
+
+ if (qsParm['pkgname']) {
+ action = 'pkgname';
+ params = '&pkgname=' + qsParm['pkgname'];
+ }
+
+ if (document.getElementById('pkgsearch').value != "") {
+ params = params + '&pkgsearch=' + document.getElementById('pkgsearch').value;
+ } else {
+ if (qsParm['pkgsearch']) {
+ params = params + '&pkgsearch=' + qsParm['pkgsearch'];
+ }
+ }
+ if (qsParm['arch']) {
+ params = params + '&arch=' + qsParm['arch'];
+ qsParm['arch'] = null;
+ }
+ if (qsParm['section']) {
+ action = 'section';
+ params = params + '&section=' + qsParm['section'];
+ qsParm['section'] = null;
+ }
+
+ params = '&action=' + action + params;
+
+ queryHTTP.open('post', 'section.php');
+ queryHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ queryHTTP.onreadystatechange = queryProgress;
+ queryHTTP.send(params);
+
+}
+
+function getLetter() {
+ var params = 'action=searchletter';
+ http.open('post', 'section.php');
+ http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ http.onreadystatechange = letterProgress;
+ http.send(params);
+
+}
+
+function getSection() {
+ var params = 'action=sectionslist';
+ sectionHTTP.open('post', 'section.php');
+ sectionHTTP.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ sectionHTTP.onreadystatechange = sectionProgress;
+ sectionHTTP.send(params);
+
+}
+
+function letterProgress() {
+ if(http.readyState == 4){
+ var response = http.responseText;
+ document.getElementById('searchletter').innerHTML = response;
+
+ }
+}
+
+function sectionProgress() {
+ if(sectionHTTP.readyState == 4){
+ var response = sectionHTTP.responseText;
+ document.getElementById('sectionslist').innerHTML = response;
+
+ }
+}
+
+function queryProgress() {
+ document.getElementById('opkgoutput').innerHTML = "loading, please wait";
+ if(queryHTTP.readyState == 4){
+ var response = queryHTTP.responseText;
+ document.getElementById('opkgoutput').innerHTML = response;
+
+ }
+}
diff --git a/contrib/feed-browser/section.php b/contrib/feed-browser/section.php
new file mode 100644
index 0000000000..083910bc46
--- /dev/null
+++ b/contrib/feed-browser/section.php
@@ -0,0 +1,85 @@
+<?php
+
+/*
+ * (c) Koen Kooi 2006, 2007, 2008, 2009
+ * (c) Marcin Juszkiewicz 2006, 2007
+ *
+ * This php script is intended to do the following:
+ *
+ * - have searchable webfronted for the feed like packages.ubuntu.com
+ *
+ * ToDo:
+ *
+ * - search functionality
+ * - provide feed-management functionality
+ * - allow uploading of new software
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License along
+ * with this library; see the file COPYING.LIB. If not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ * USA.
+ *
+ */
+
+require_once 'includes/config.inc';
+require_once 'includes/functions.inc';
+
+if(!check_database())
+{
+ die("Database not found and cannot be created.");
+}
+
+if (isset($_POST["action"]) && $_POST["action"] != "") {
+ $action = $_POST["action"];
+} else {
+ print "Invalid action: $action";
+ exit;
+}
+
+if (isset($_POST["pkgsearch"]) && $_POST["pkgsearch"] != "") {
+ $pkgsearch = $_POST["pkgsearch"];
+}
+
+if (isset($_POST["section"]) && $_POST["section"] != "") {
+ $section = $_POST["section"];
+}
+
+if (isset($_POST["arch"]) && $_POST["arch"] != "") {
+ $arch = $_POST["arch"];
+} else {
+ $arch = "";
+}
+
+if (isset($_POST["pkgname"]) && $_POST["pkgname"] != "") {
+ $pkgname = $_POST["pkgname"];
+}
+
+
+//print("$action");
+switch($action) {
+case "sectionslist":
+ echo sectionslist();
+ break;
+case "searchletter":
+ echo searchletter();
+ break;
+case "pkgquery":
+ echo searchpkg("%{$pkgsearch}%", $arch);
+ break;
+case "pkgname":
+ echo pkgdetails($pkgname);
+ break;
+case "section":
+ echo searchsection($section);
+ break;
+}
+?>