summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse/package.xslt59
-rw-r--r--gentoobrowse/present/ok.xml4
-rw-r--r--gentoobrowse/request/track.xml4
-rw-r--r--gentoobrowse/request/untrack.xml2
-rw-r--r--gentoobrowse/style.css13
5 files changed, 48 insertions, 34 deletions
diff --git a/gentoobrowse/package.xslt b/gentoobrowse/package.xslt
index a4f03fd..0546bb7 100644
--- a/gentoobrowse/package.xslt
+++ b/gentoobrowse/package.xslt
@@ -21,6 +21,28 @@
}
document.getElementById(name).className = 'tabvisible';
}
+ function track(pid)
+ {
+ xmlhttp = new XMLHttpRequest();
+ xmlhttp.open("POST", "/track", false);
+ xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
+ xmlhttp.send("packageid=" + pid);
+ if (xmlhttp.status == 200) {
+ document.getElementById("dotrack").style.display = "none";
+ document.getElementById("dountrack").style.display = "inline";
+ }
+ }
+ function untrack(pid)
+ {
+ xmlhttp = new XMLHttpRequest();
+ xmlhttp.open("POST", "/untrack", false);
+ xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
+ xmlhttp.send("packageid=" + pid);
+ if (xmlhttp.status == 200) {
+ document.getElementById("dountrack").style.display = "none";
+ document.getElementById("dotrack").style.display = "inline";
+ }
+ }
</script>
</xsl:template>
<xsl:template name="content">
@@ -67,30 +89,6 @@
</li>
</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>
<xsl:apply-templates select="packageUrls" />
<h2>
<a>
@@ -99,6 +97,18 @@
</xsl:attribute>
<xsl:value-of select="catname" />
</a>/<xsl:value-of select="pkgname" />
+ <xsl:if test="count(/gentoo/project2:session/project2:var[@name='loggedInUserID']) != 0">
+ <a id="dotrack">
+ <xsl:attribute name="href">javascript:track(<xsl:value-of select="/gentoo/summary/package/packageid" />);</xsl:attribute>
+ <xsl:if test="count(tracks/track) = 1">
+ <xsl:attribute name="style">display: none</xsl:attribute>
+ </xsl:if>(Track)</a>
+ <a id="dountrack">
+ <xsl:attribute name="href">javascript:untrack(<xsl:value-of select="/gentoo/summary/package/packageid" />);</xsl:attribute>
+ <xsl:if test="count(tracks/track) = 0">
+ <xsl:attribute name="style">display: none</xsl:attribute>
+ </xsl:if>(Untrack)</a>
+ </xsl:if>
</h2>
<p>
<xsl:value-of select="description" />
@@ -148,7 +158,6 @@
</xsl:attribute>
<xsl:value-of select="url" />
</a>
- <br />
</xsl:for-each>
</div>
</xsl:template>
diff --git a/gentoobrowse/present/ok.xml b/gentoobrowse/present/ok.xml
new file mode 100644
index 0000000..4abc040
--- /dev/null
+++ b/gentoobrowse/present/ok.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<view name="ok" root="ok" contenttype="text/xml" xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:project2="http://project2.randomdan.homeip.net" />
+
diff --git a/gentoobrowse/request/track.xml b/gentoobrowse/request/track.xml
index 24ced59..5d8bbc9 100644
--- a/gentoobrowse/request/track.xml
+++ b/gentoobrowse/request/track.xml
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
-<request name="track" present="package" xmlns:xi="http://www.w3.org/2001/XInclude"
+<request name="track" present="ok" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:project2="http://project2.randomdan.homeip.net">
<xi:include href="../datasources/postgres-web.xml" />
- <project2:sqlcheck datasource="postgres-web" testOp="=" testValue="0" present="package" name="checkNotTracked">
+ <project2:sqlcheck datasource="postgres-web" testOp="=" testValue="0" present="ok" name="checkNotTracked">
<message>Package already tracked</message>
<sql>
SELECT COUNT(*)
diff --git a/gentoobrowse/request/untrack.xml b/gentoobrowse/request/untrack.xml
index 88bcdf9..58f595b 100644
--- a/gentoobrowse/request/untrack.xml
+++ b/gentoobrowse/request/untrack.xml
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<request name="track" present="package" xmlns:xi="http://www.w3.org/2001/XInclude"
+<request name="track" present="ok" xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:project2="http://project2.randomdan.homeip.net">
<xi:include href="../datasources/postgres-web.xml" />
<project2:sqltask datasource="postgres-web" name="addTrack">
diff --git a/gentoobrowse/style.css b/gentoobrowse/style.css
index dcd30f0..6d5d2f9 100644
--- a/gentoobrowse/style.css
+++ b/gentoobrowse/style.css
@@ -56,7 +56,9 @@ p {
.urls {
float: right;
margin: 8px 30px;
- text-align: center;
+}
+.urls a {
+ display: block;
}
div.trademark, div.poweredby {
@@ -82,14 +84,13 @@ form.generalForm td input {
border: 1px solid #aaaaff;
width: 98%;
}
-form.tracker {
- float: right;
- margin-right: 30px;
- margin-left: 30px;
-}
.tracked {
font-weight: bold;
}
+#dotrack, #dountrack {
+ font-size: 8px;
+ margin: 0 10px;
+}
.tabstrip {
}