summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2010-06-11 09:03:42 +0000
committerrandomdan <randomdan@localhost>2010-06-11 09:03:42 +0000
commit6d9685a710718cef286293bf98e500a5b68c5f14 (patch)
treed8ebe1e10195761ac442292e63f120c085f60435
parentAdd top level browse page (diff)
downloadgentoobrowse-6d9685a710718cef286293bf98e500a5b68c5f14.tar.bz2
gentoobrowse-6d9685a710718cef286293bf98e500a5b68c5f14.tar.xz
gentoobrowse-6d9685a710718cef286293bf98e500a5b68c5f14.zip
Use Glib::ustring in libodbcpp for data and std::string for non-data
Add support for parameters in SqlViews Uses parameters to implement category browse and search
-rw-r--r--gentoobrowse/base.xslt15
-rw-r--r--gentoobrowse/present/category.xml4
-rw-r--r--gentoobrowse/present/search.xml4
-rw-r--r--gentoobrowse/search.xslt6
-rw-r--r--gentoobrowse/views/category.xml16
-rw-r--r--gentoobrowse/views/search.xml19
6 files changed, 57 insertions, 7 deletions
diff --git a/gentoobrowse/base.xslt b/gentoobrowse/base.xslt
index b723c59..803d56a 100644
--- a/gentoobrowse/base.xslt
+++ b/gentoobrowse/base.xslt
@@ -35,10 +35,17 @@
</div>
<div class="poweredby">
Powered by
- <a href="http://www.gentoo.org/">Gentoo</a>,
- <a href="http://httpd.apache.org/">Apache</a>,
- <a href="http://www.postgresql.org/">PostgreSQL</a> and
- <a href="http://www.w3.org/TR/xslt">XSLT</a> - Driven by dbweb
+ <a href="http://www.gentoo.org/">Gentoo</a>
+ |
+ <a href="http://www.postgresql.org/">PostgreSQL</a>
+ |
+ <a href="http://httpd.apache.org/">Apache</a>
+ |
+ <a href="http://www.fastcgi.com/drupal/">FastCGI</a>
+ |
+ <a href="http://www.w3.org/TR/xslt">XSLT</a>
+ |
+ <a href="http://project2.randomdan.homeip.net">Project2</a>
</div>
</body>
</html>
diff --git a/gentoobrowse/present/category.xml b/gentoobrowse/present/category.xml
new file mode 100644
index 0000000..d6c4748
--- /dev/null
+++ b/gentoobrowse/present/category.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<view name="category" root="gentoo" style="browse.xslt" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:include href="../views/category.xml" />
+</view>
diff --git a/gentoobrowse/present/search.xml b/gentoobrowse/present/search.xml
new file mode 100644
index 0000000..26c7c1d
--- /dev/null
+++ b/gentoobrowse/present/search.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<view name="search" root="gentoo" style="search.xslt" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:include href="../views/search.xml" />
+</view>
diff --git a/gentoobrowse/search.xslt b/gentoobrowse/search.xslt
index c17a5a8..74a791d 100644
--- a/gentoobrowse/search.xslt
+++ b/gentoobrowse/search.xslt
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:dbweb="http://dbweb.randomdan.homeip.net/">
+ xmlns:project2="http://project2.randomdan.homeip.net/">
<xsl:import href="base.xslt" />
<xsl:output encoding="utf-8" method="html" media-type="text/html" indent="yes"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"
@@ -10,7 +10,7 @@
<form action="/search" method="get">
<input type="textbox" name="criteria">
<xsl:attribute name="value">
- <xsl:value-of select="/gentoo/dbweb:params/dbweb:param[@name='criteria']" />
+ <xsl:value-of select="/gentoo/project2:params/project2:param[@name='criteria']" />
</xsl:attribute>
</input>
<input type="submit" />
@@ -18,7 +18,7 @@
<xsl:apply-templates select="/gentoo/searchResults" />
</xsl:template>
<xsl:template match="/gentoo/searchResults">
- <xsl:if test="/gentoo/dbweb:params/dbweb:param[@name='criteria'] != ''">
+ <xsl:if test="/gentoo/project2:params/project2:param[@name='criteria'] != ''">
<xsl:if test="count(/gentoo/searchResults/package) &gt; 0">
<h2>Search Results</h2>
<ul>
diff --git a/gentoobrowse/views/category.xml b/gentoobrowse/views/category.xml
new file mode 100644
index 0000000..5e4644e
--- /dev/null
+++ b/gentoobrowse/views/category.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<block xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:include href="../datasources/postgres.xml" />
+ <sqlview name="packages" recordname="package" datasource="postgres">
+ <sql>
+ SELECT c.name AS catname, p.name AS pkgname, p.description
+ FROM categories c, packages p
+ WHERE c.categoryid = p.categoryid
+ AND c.name = ?
+ ORDER BY p.name
+ </sql>
+ <parameters>
+ <param bind="0" id="1" source="uri" />
+ </parameters>
+ </sqlview>
+</block>
diff --git a/gentoobrowse/views/search.xml b/gentoobrowse/views/search.xml
new file mode 100644
index 0000000..538e852
--- /dev/null
+++ b/gentoobrowse/views/search.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<block xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:include href="../datasources/postgres.xml" />
+ <sqlview name="searchResults" recordname="package" datasource="postgres">
+ <sql>
+ select c.name as catname, p.name as pkgname, description,
+ ts_rank((setweight(to_tsvector('english', p.name), 'A') || setweight(to_tsvector('english', p.description), 'B')),
+ plainto_tsquery('english', ?)) as rank
+ from packages p, categories c
+ where (setweight(to_tsvector('english', p.name), 'A') || setweight(to_tsvector('english', p.description), 'B')) @@ plainto_tsquery('english', ?)
+ and p.categoryid = c.categoryid
+ order by rank desc, p.name
+ </sql>
+ <parameters>
+ <param bind="0" id="criteria" source="query" />
+ <param bind="1" id="criteria" source="query" />
+ </parameters>
+ </sqlview>
+</block>