summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2010-09-01 23:10:29 +0000
committerrandomdan <randomdan@localhost>2010-09-01 23:10:29 +0000
commitc4e387d440ef6690026e6fc4f072fb47eef89879 (patch)
tree8d153abfc22458d0df60f91dd8c8d58e2c15c0ec
parentImport and display the ebuild slot and license (diff)
downloadgentoobrowse-c4e387d440ef6690026e6fc4f072fb47eef89879.tar.bz2
gentoobrowse-c4e387d440ef6690026e6fc4f072fb47eef89879.tar.xz
gentoobrowse-c4e387d440ef6690026e6fc4f072fb47eef89879.zip
email users when new ebuilds come along that they have tracked
-rw-r--r--gentoobrowse/console/emailebuilds.xml42
-rw-r--r--gentoobrowse/emails/newpackageversions.xml27
-rw-r--r--gentoobrowse/emails/newpackageversions.xslt25
3 files changed, 94 insertions, 0 deletions
diff --git a/gentoobrowse/console/emailebuilds.xml b/gentoobrowse/console/emailebuilds.xml
new file mode 100644
index 0000000..14f57f6
--- /dev/null
+++ b/gentoobrowse/console/emailebuilds.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<emailebuild name="emailebuild" xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:project2="http://project2.randomdan.homeip.net">
+ <xi:include href="../datasources/postgres.xml" />
+ <project2:sqliterate name="users" recordname="user" datasource="postgres">
+ <sql>
+ select ut.userid, ut.useremail from
+ (select e.ebuildid, u.userid, u.useremail
+ from files f, ebuilds e, user_packages up, users u
+ where e.packageid = up.packageid
+ and f.fileid = e.ebuildid
+ and u.userid = up.userid
+ and f.firstseen > up.trackedsince) as ut left outer join user_ebuild_emails ebe
+ on ebe.userid = ut.userid and ebe.ebuildid = ut.ebuildid
+ where ebe.userid is null
+ group by ut.userid, ut.useremail
+ </sql>
+ <project2:sendmail to="^useremail" server="smtp.random.lan:25" subject="Gentoo Browse - New package versions"
+ present="newpackageversions" from="noreply@gentoobrowse.randomdan.homeip.net" />
+ <project2:sqltask datasource="postgres">
+ <sql>
+ insert into user_ebuild_emails(ebuildid, userid, sentat)
+ select ut.ebuildid, ut.userid, now()
+ from (
+ select e.ebuildid, up.userid
+ from files f, ebuilds e, user_packages up, users u
+ where e.packageid = up.packageid
+ and f.fileid = e.ebuildid
+ and u.userid = up.userid
+ and u.userid = ?
+ and f.firstseen > up.trackedsince) as ut left outer join user_ebuild_emails ebe
+ on ebe.userid = ut.userid and ebe.ebuildid = ut.ebuildid
+ where ebe.userid is null
+ </sql>
+ <parameters>
+ <param bind="0" value="^userid" />
+ </parameters>
+ </project2:sqltask>
+ </project2:sqliterate>
+</emailebuild>
+
+
diff --git a/gentoobrowse/emails/newpackageversions.xml b/gentoobrowse/emails/newpackageversions.xml
new file mode 100644
index 0000000..83bebbc
--- /dev/null
+++ b/gentoobrowse/emails/newpackageversions.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<view root="newpackageversions" style="emails/newpackageversions.xslt" xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:project2="http://project2.randomdan.homeip.net">
+ <xi:include href="../datasources/postgres.xml" />
+ <project2:sqlview name="newpackageversions" recordname="version" datasource="postgres">
+ <sql>
+ select ut.cname, ut.pname, ut.version
+ from (
+ select e.ebuildid, up.userid, u.useremail, p.name as pname, c.name as cname, e.version
+ from files f, ebuilds e, user_packages up, users u, packages p, categories c
+ where e.packageid = up.packageid
+ and f.fileid = e.ebuildid
+ and u.userid = up.userid
+ and u.userid = ?
+ and e.packageid = p.packageid
+ and c.categoryid = p.categoryid
+ and f.firstseen > up.trackedsince) as ut left outer join user_ebuild_emails ebe
+ on ebe.userid = ut.userid and ebe.ebuildid = ut.ebuildid
+ where ebe.userid is null
+ order by ut.cname, ut.pname, ut.version
+ </sql>
+ <parameters>
+ <param bind="0" value="^userid" />
+ </parameters>
+ </project2:sqlview>
+</view>
+
diff --git a/gentoobrowse/emails/newpackageversions.xslt b/gentoobrowse/emails/newpackageversions.xslt
new file mode 100644
index 0000000..abdd9e4
--- /dev/null
+++ b/gentoobrowse/emails/newpackageversions.xslt
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<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:output encoding="utf-8" method="html" media-type="text/html" indent="yes"
+ doctype-system="http://www.w3.org/TR/html4/loose.dtd"
+ doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />
+ <xsl:template match="/newpackageversions">
+ <html>
+ <head>
+ <title>Welcome to Gentoo Browse</title>
+ </head>
+ <body>
+ <p>All new shiny ebuilds available!</p>
+ <ul>
+ <xsl:for-each select="newpackageversions/version">
+ <li>
+ <xsl:value-of select="cname"/>/<xsl:value-of select="pname"/>-<xsl:value-of select="version"/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </body>
+ </html>
+ </xsl:template>
+</xsl:stylesheet>
+