summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-04-15 21:23:05 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-04-15 21:23:05 +0100
commit4e734c570ca6934009296622adabc8f7fca4910c (patch)
treed0fe869f40ec1b1c89ae598086bb79342c285d4b
parentSome fixes recommended by Google (diff)
downloadgentoobrowse-4e734c570ca6934009296622adabc8f7fca4910c.tar.bz2
gentoobrowse-4e734c570ca6934009296622adabc8f7fca4910c.tar.xz
gentoobrowse-4e734c570ca6934009296622adabc8f7fca4910c.zip
Extra package image and display it on the pagegentoobrowse-1.0.2
-rw-r--r--gentoobrowse/console/packagemetadata.xml3
-rw-r--r--gentoobrowse/datasources/schema.sql3
-rw-r--r--gentoobrowse/views/package.xml2
-rw-r--r--gentoobrowse/xslt/package.xslt10
4 files changed, 15 insertions, 3 deletions
diff --git a/gentoobrowse/console/packagemetadata.xml b/gentoobrowse/console/packagemetadata.xml
index f4b1a2f..b66abfe 100644
--- a/gentoobrowse/console/packagemetadata.xml
+++ b/gentoobrowse/console/packagemetadata.xml
@@ -29,7 +29,8 @@
<project2:sqltask name="update" datasource="postgres">
<sql>
UPDATE packages SET
- summary = <param source="parent" name="longdesc" />,
+ summary = regexp_replace(<param source="parent" name="longdesc" />, '&lt;&lt;data:image/[^&gt;]+&gt;&gt;', ''),
+ image = (SELECT regexp_matches(<param source="parent" name="longdesc" />, '&lt;&lt;(data:image/[^&gt;]+)&gt;&gt;'))[1],
maintainer = <param source="parent" name="maintainer" />,
herd = <param source="parent" name="herd" />,
metadatadate = <param source="parent" name="moddate" depth="2" />
diff --git a/gentoobrowse/datasources/schema.sql b/gentoobrowse/datasources/schema.sql
index 0d62c3e..d82dae6 100644
--- a/gentoobrowse/datasources/schema.sql
+++ b/gentoobrowse/datasources/schema.sql
@@ -264,7 +264,8 @@ CREATE TABLE packages (
summary text,
maintainer text,
herd text,
- metadatadate timestamp without time zone
+ metadatadate timestamp without time zone,
+ image text
);
diff --git a/gentoobrowse/views/package.xml b/gentoobrowse/views/package.xml
index bf2c5ab..bb8be37 100644
--- a/gentoobrowse/views/package.xml
+++ b/gentoobrowse/views/package.xml
@@ -12,7 +12,7 @@
</project2:sqlrows>
<project2:sqlrows name="packages" datasource="postgres-web">
<sql>
- SELECT p.packageid, p.name AS pkgname, p.description, p.firstseen, c.name AS catname, p.herd, p.summary
+ SELECT p.packageid, p.name AS pkgname, p.description, p.firstseen, c.name AS catname, p.herd, p.summary, p.image
FROM packages p, categories c
WHERE p.categoryid = c.categoryid
<filter name="catAndName">
diff --git a/gentoobrowse/xslt/package.xslt b/gentoobrowse/xslt/package.xslt
index 2dac0a6..94d67bb 100644
--- a/gentoobrowse/xslt/package.xslt
+++ b/gentoobrowse/xslt/package.xslt
@@ -112,6 +112,16 @@
<xsl:if test="/gentoo/package/summary != ''">
<section id="summary">
<h2 class="page-header">Summary</h2>
+ <xsl:if test="/gentoo/package/image">
+ <img style="float:right">
+ <xsl:attribute name="title">
+ <xsl:value-of select="/gentoo/package/pkgname"/>
+ </xsl:attribute>
+ <xsl:attribute name="src">
+ <xsl:value-of select="/gentoo/package/image"/>
+ </xsl:attribute>
+ </img>
+ </xsl:if>
<p>
<xsl:value-of select="/gentoo/package/summary" />
</p>