From 5d7f69ae1ff2a0a2feee37ca51e071fe55611f5f Mon Sep 17 00:00:00 2001 From: randomdan Date: Thu, 16 Dec 2010 22:35:05 +0000 Subject: Return HTTP 500 on error Use AJAX to track and untrack packages --- gentoobrowse/package.xslt | 59 +++++++++++++++++++++++----------------- gentoobrowse/present/ok.xml | 4 +++ gentoobrowse/request/track.xml | 4 +-- gentoobrowse/request/untrack.xml | 2 +- gentoobrowse/style.css | 13 +++++---- 5 files changed, 48 insertions(+), 34 deletions(-) create mode 100644 gentoobrowse/present/ok.xml 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"; + } + } @@ -67,30 +89,6 @@ - - -
- /untrack// - - - - - - -
-
- -
- /track// - - - - - - -
-
-

@@ -99,6 +97,18 @@ / + + + javascript:track(); + + display: none + (Track) + + javascript:untrack(); + + display: none + (Untrack) +

@@ -148,7 +158,6 @@ -
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 @@ + + + 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 @@ - - + Package already tracked 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 @@ - 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 { } -- cgit v1.2.3