summaryrefslogtreecommitdiff
path: root/gentoobrowse/package.xslt
diff options
context:
space:
mode:
Diffstat (limited to 'gentoobrowse/package.xslt')
-rw-r--r--gentoobrowse/package.xslt59
1 files changed, 34 insertions, 25 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>