+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/js/init.js b/assets/js/init.js
index b7c98e3..d93cc00 100644
--- a/assets/js/init.js
+++ b/assets/js/init.js
@@ -3,34 +3,27 @@ var sess = null;
$(document).ready(function() {
var sval = new ServerVal("#randval");
- sess = new Session("#sessinfo");
-
-// $(window).focus(function() {
-// $.getJSON("/sessinfo/", $.proxy(sess.loadJSON, sess));
-// });
+ sess = new Session("#sessinfo", "#sessid", "#user");
$.getJSON(
"/version/",
function(data) {
- $.each(result, function(i, field){
- $("#version").empty().append("version: " + field);
- });
+ $("#version").empty().append("version: " + data.version);
}
);
- $("div#menu ul li:eq(1)").click(function() {
- sval.start();
- });
+ $.getJSON("/sessinfo/", $.proxy(sess.loadJSON, sess));
+ $.getJSON("/user/get/", $.proxy(sess.loadUserJSON, sess));
- $("div#menu ul li:eq(2)").click(function() {
- $.getJSON("/sess/", $.proxy(sess.loadJSON, sess));
+ $(window).focus(function() {
+ $.getJSON("/sessinfo/", $.proxy(sess.loadJSON, sess));
});
- $("div#menu ul li:eq(3)").click(function() {
+ $("div#menu ul li:eq(5)").click(function() {
$("#signup").removeClass("hide");
});
- $("div#menu ul li:eq(4)").click(function() {
+ $("div#menu ul li:eq(6)").click(function() {
$("#login").removeClass("hide");
});
@@ -42,7 +35,7 @@ $(document).ready(function() {
event.preventDefault();
$.post("/login/",
$("#login form").serialize(),
- $.proxy(sess.loadJSON, sess));
+ $.proxy(sess.loadUserJSON, sess));
$("#login").addClass("hide");
});
@@ -50,7 +43,7 @@ $(document).ready(function() {
event.preventDefault();
$.post("/signup/",
$("#signup form").serialize(),
- $.proxy(sess.loadJSON, sess));
+ $.proxy(sess.loadUserJSON, sess));
$("#signup").addClass("hide");
});
});
diff --git a/assets/js/session.js b/assets/js/session.js
index 248b047..9e695ca 100644
--- a/assets/js/session.js
+++ b/assets/js/session.js
@@ -1,13 +1,13 @@
-function Session(sId)
+function Session(sInfo, sId, sUser)
{
- this.eSid = $(sId + " span");
- this.canvas = $(sId + " canvas").get(0);
+ this.eUser = $(sUser);
+ this.eId = $(sId);
+ this.canvas = $(sInfo + " canvas").get(0);
this.context = this.canvas.getContext("2d");
this.id = "none"
this.timeout = 0;
this.timeleft = 0;
- this.username = "";
this.email = "";
this.firstname = "";
this.surname = "";
@@ -16,27 +16,34 @@ function Session(sId)
this.draw();
}
-Session.prototype.loadJSON = function(data)
+Session.prototype.loadUserJSON = function(data)
{
- this.stop();
-
- this.id = ("0" == data.id)? "none" : data.id;
- //this.timeout = data.timeout * 10;
- //this.timeleft = data.timeleft * 10;
- //this.username = data.username;
this.email = data.email;
this.firstname = data.firstname;
this.surname = data.surname;
- name = " ";
-
- this.eSid.empty().append(this.id);
- if ('(null)' == this.firstname || '(null)' == this.surname) {
- name += this.email;
+ name = "";
+ if ('' == this.email) {
+ name = "not logged in";
} else {
- name += this.firstname + " " + this.surname;
+ if ('' == this.firstname || '' == this.surname) {
+ name += this.email;
+ } else {
+ name += this.firstname + " " + this.surname;
+ }
}
- $("#main p:eq(1) span:eq(0)").empty().append(name);
+ this.eUser.empty().append(name);
+}
+
+Session.prototype.loadJSON = function(data)
+{
+ // this.stop();
+
+ this.id = ("0" == data.id)? "none" : data.id;
+ this.timeout = data.timeout * 10;
+ this.timeleft = data.timeleft * 10;
+
+ this.eId.empty().append(this.id);
this.draw();
if (0 < this.timeleft)
@@ -57,7 +64,7 @@ Session.prototype.draw = function()
Session.prototype.start = function()
{
if (null === this.interval) {
- this.interval = setInterval($.proxy(this.process, this), 100);
+ this.interval = setInterval($.proxy(this.process, this), 500);
}
}
@@ -68,7 +75,7 @@ Session.prototype.process = function()
}
else {
- this.timeleft--;
+ this.timeleft-=5;
this.draw();
}
}
@@ -85,8 +92,8 @@ Session.prototype.stop = function()
this.firstname = "";
this.surname = "";
- this.eSid.empty().append(this.id);
- $("#main p:eq(1) span:eq(0)").empty().append(" " + this.username);
+ this.eId.empty().append("");
+ this.eUser.empty().append("not logged in");
this.draw();
}
diff --git a/assets/style/common.css b/assets/style/common.css
index 0a6742e..ad9c38b 100644
--- a/assets/style/common.css
+++ b/assets/style/common.css
@@ -64,7 +64,7 @@ ul#menu li {
}
div#sessinfo canvas {
- border: 1px solid black;
+ border: 1px solid black;
}
/* vim: set st=4 sw=4: */
diff --git a/assets/style/taskrambler.css b/assets/style/taskrambler.css
index 7d996d2..da1e8f6 100644
--- a/assets/style/taskrambler.css
+++ b/assets/style/taskrambler.css
@@ -126,6 +126,28 @@ div.border div.br {
background: url(/image/rambler-border-br.jpg);
}
+#statusline {
+ position: absolute;
+ margin: 0px;
+ font-family: old_newspaper;
+ font-size: 12px;
+ text-align: right;
+}
+
+#statusline ul {
+ display: inline-block;
+ width: 780px;
+ height: 15px;
+ list-style: none;
+ padding: 0px;
+ margin: 0px;
+}
+
+#statusline ul li {
+ display: inline-block;
+ border-right: 1px solid black;
+ padding-right: 5px;
+}
#page {
top: 50px;