summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse/browse.xslt27
-rw-r--r--gentoobrowse/home.xslt3
-rw-r--r--gentoobrowse/present/atom.xml2
-rw-r--r--gentoobrowse/request/track.xml26
-rw-r--r--gentoobrowse/request/untrack.xml17
-rw-r--r--gentoobrowse/style.css8
-rw-r--r--gentoobrowse/views/newebuilds.xml12
-rw-r--r--gentoobrowse/views/newebuildsatom.xml23
-rw-r--r--gentoobrowse/views/package.xml12
-rw-r--r--gentoobrowse/views/search.xml4
10 files changed, 127 insertions, 7 deletions
diff --git a/gentoobrowse/browse.xslt b/gentoobrowse/browse.xslt
index 26d5e25..db3f4f6 100644
--- a/gentoobrowse/browse.xslt
+++ b/gentoobrowse/browse.xslt
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:project2="http://project2.randomdan.homeip.net/" exclude-result-prefixes="project2" >
<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"
@@ -66,6 +67,30 @@
</tr>
</xsl:template>
<xsl:template match="/gentoo/summary/package">
+ <xsl:if test="count(/gentoo/project2:session/project2:var[@name='loggedInUserID']) != 0">
+ <xsl:if test="count(tracks/track) > 0">
+ <form method="post" class="tracker">
+ <xsl:attribute name="action">/untrack/<xsl:value-of select="catname" />/<xsl:value-of select="pkgname" /></xsl:attribute>
+ <input type="hidden" name="packageid">
+ <xsl:attribute name="value">
+ <xsl:value-of select="/gentoo/summary/package/packageid" />
+ </xsl:attribute>
+ </input>
+ <input type="submit" value="Untrack" />
+ </form>
+ </xsl:if>
+ <xsl:if test="count(tracks/track) = 0">
+ <form method="post" class="tracker">
+ <xsl:attribute name="action">/track/<xsl:value-of select="catname" />/<xsl:value-of select="pkgname" /></xsl:attribute>
+ <input type="hidden" name="packageid">
+ <xsl:attribute name="value">
+ <xsl:value-of select="/gentoo/summary/package/packageid" />
+ </xsl:attribute>
+ </input>
+ <input type="submit" value="Track" />
+ </form>
+ </xsl:if>
+ </xsl:if>
<h2>
<a>
<xsl:attribute name="href">
diff --git a/gentoobrowse/home.xslt b/gentoobrowse/home.xslt
index 35fd4ef..0363a81 100644
--- a/gentoobrowse/home.xslt
+++ b/gentoobrowse/home.xslt
@@ -29,6 +29,9 @@
<xsl:template match="/gentoo/newebuilds/ebuild">
<li>
<a>
+ <xsl:if test="tracked = 1">
+ <xsl:attribute name="class">tracked</xsl:attribute>
+ </xsl:if>
<xsl:attribute name="title">
<xsl:value-of select="description" /> (updated <xsl:value-of select="moddate" />)
</xsl:attribute>
diff --git a/gentoobrowse/present/atom.xml b/gentoobrowse/present/atom.xml
index 1bd5d24..72c1695 100644
--- a/gentoobrowse/present/atom.xml
+++ b/gentoobrowse/present/atom.xml
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<view name="atomebuilds" root="gentoo" style="atomebuilds.xslt" xmlns:xi="http://www.w3.org/2001/XInclude">
- <xi:include href="../views/newebuilds.xml" />
+ <xi:include href="../views/newebuildsatom.xml" />
</view>
diff --git a/gentoobrowse/request/track.xml b/gentoobrowse/request/track.xml
new file mode 100644
index 0000000..c5e62e4
--- /dev/null
+++ b/gentoobrowse/request/track.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<request name="track" present="package" xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:project2="http://project2.randomdan.homeip.net">
+ <xi:include href="../datasources/postgres.xml" />
+ <project2:sqlcheck datasource="postgres" testOp="=" testValue="0" present="package" name="checkNotTracked">
+ <message>Package already tracked</message>
+ <sql>
+ SELECT COUNT(*)
+ FROM user_packages
+ WHERE packageid = ?
+ AND userid = ?
+ </sql>
+ <parameters>
+ <param bind="0" value="$packageid" />
+ <param bind="1" value="%loggedInUserID" />
+ </parameters>
+ </project2:sqlcheck>
+ <project2:sqltask datasource="postgres" name="addTrack">
+ <sql>INSERT INTO user_packages(packageid, userid, trackedsince) VALUES(?, ?, NOW())</sql>
+ <parameters>
+ <param bind="0" value="$packageid" />
+ <param bind="1" value="%loggedInUserID" />
+ </parameters>
+ </project2:sqltask>
+</request>
+
diff --git a/gentoobrowse/request/untrack.xml b/gentoobrowse/request/untrack.xml
new file mode 100644
index 0000000..93c5108
--- /dev/null
+++ b/gentoobrowse/request/untrack.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<request name="track" present="package" xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:project2="http://project2.randomdan.homeip.net">
+ <xi:include href="../datasources/postgres.xml" />
+ <project2:sqltask datasource="postgres" name="addTrack">
+ <sql>
+ DELETE FROM user_packages
+ WHERE packageid = ?
+ AND userid = ?
+ </sql>
+ <parameters>
+ <param bind="0" value="$packageid" />
+ <param bind="1" value="%loggedInUserID" />
+ </parameters>
+ </project2:sqltask>
+</request>
+
diff --git a/gentoobrowse/style.css b/gentoobrowse/style.css
index 8cfccbb..d0e558c 100644
--- a/gentoobrowse/style.css
+++ b/gentoobrowse/style.css
@@ -99,3 +99,11 @@ form.generalForm td input {
border: 1px solid #aaaaff;
width: 98%;
}
+form.tracker {
+ float: right;
+ margin-right: 30px;
+ margin-left: 30px;
+}
+.tracked {
+ font-weight: bold;
+}
diff --git a/gentoobrowse/views/newebuilds.xml b/gentoobrowse/views/newebuilds.xml
index 7e26b37..a95fa3c 100644
--- a/gentoobrowse/views/newebuilds.xml
+++ b/gentoobrowse/views/newebuilds.xml
@@ -3,14 +3,20 @@
<xi:include href="../datasources/postgres.xml" />
<project2:sqlview name="newebuilds" recordname="ebuild" datasource="postgres">
<sql>
- SELECT filename, description, moddate, p.name AS pkgname, c.name AS catname, f.firstseen sync
- FROM ebuilds e, files f, packages p, categories c
+ SELECT filename, description, moddate, p.name AS pkgname, c.name AS catname, f.firstseen sync,
+ up.trackedsince IS NOT NULL AS tracked
+ FROM ebuilds e, files f, categories c, packages p LEFT OUTER JOIN user_packages up
+ ON up.userid = ?
+ AND up.packageid = p.packageid
WHERE e.ebuildid = f.fileid
AND e.packageid = p.packageid
AND p.categoryid = c.categoryid
AND f.firstseen IN (SELECT DISTINCT f.firstseen FROM files f ORDER BY f.firstseen DESC LIMIT 3)
- ORDER BY c.name, p.name, e.versioninst
+ ORDER BY tracked DESC, c.name, p.name, e.versioninst
</sql>
+ <parameters>
+ <param bind="0" value="%loggedInUserID|0" />
+ </parameters>
</project2:sqlview>
<project2:sqlview name="syncs" recordname="sync" datasource="postgres">
<sql>
diff --git a/gentoobrowse/views/newebuildsatom.xml b/gentoobrowse/views/newebuildsatom.xml
new file mode 100644
index 0000000..fba9e2b
--- /dev/null
+++ b/gentoobrowse/views/newebuildsatom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<block xmlns:project2="http://project2.randomdan.homeip.net" xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:include href="../datasources/postgres.xml" />
+ <project2:sqlview name="newebuilds" recordname="ebuild" datasource="postgres">
+ <sql>
+ SELECT filename, description, moddate, p.name AS pkgname, c.name AS catname, f.firstseen sync
+ FROM ebuilds e, files f, categories c, packages p, user_packages up, users u
+ WHERE e.ebuildid = f.fileid
+ AND e.packageid = p.packageid
+ AND p.categoryid = c.categoryid
+ AND up.userid = u.userid
+ AND u.username = ?
+ AND up.packageid = p.packageid
+ AND f.firstseen >= up.trackedsince
+ ORDER BY f.firstseen DESC, c.name, p.name, e.versioninst
+ LIMIT 50
+ </sql>
+ <parameters>
+ <param bind="0" value="/1" />
+ </parameters>
+ </project2:sqlview>
+</block>
+
diff --git a/gentoobrowse/views/package.xml b/gentoobrowse/views/package.xml
index 28aff03..6ec12ec 100644
--- a/gentoobrowse/views/package.xml
+++ b/gentoobrowse/views/package.xml
@@ -14,6 +14,18 @@
<param bind="0" value="/1" />
<param bind="1" value="/2" />
</parameters>
+ <project2:sqlview name="tracks" recordname="track" datasource="postgres">
+ <sql>
+ SELECT trackedsince
+ FROM user_packages up
+ WHERE up.packageid = ?
+ AND up.userid = ?
+ </sql>
+ <parameters>
+ <param bind="0" value="^packageid" />
+ <param bind="1" value="%loggedInUserID|0" />
+ </parameters>
+ </project2:sqlview>
<project2:sqlview name="versions" recordname="version" datasource="postgres">
<sql>
SELECT e.ebuildid, e.version
diff --git a/gentoobrowse/views/search.xml b/gentoobrowse/views/search.xml
index 65db6b8..3d6a72d 100644
--- a/gentoobrowse/views/search.xml
+++ b/gentoobrowse/views/search.xml
@@ -13,8 +13,8 @@
order by rank desc, p.name
</sql>
<parameters>
- <param bind="0" value="$criteria" />
- <param bind="1" value="$criteria" />
+ <param bind="0" value="$criteria|" />
+ <param bind="1" value="$criteria|" />
</parameters>
</project2:sqlview>
</block>