--- a/src/main/resources/scripts/tracker.js Fri Aug 26 11:42:27 2011 -0400
+++ b/src/main/resources/scripts/tracker.js Fri Aug 26 11:43:59 2011 -0400
@@ -17,7 +17,8 @@
if (n === null) {
Util.log("Creating dummy user");
n = {
- name : "dummy@example.com",
+ name : "DummyUser",
+ userId : "dummy@example.com",
passwd: "foobar",
email : "dummy@example.com",
weight : 73,
@@ -30,10 +31,10 @@
}
};
} else {
- Util.log("Found user " + n.name);
+ Util.log("Found user " + n.userId);
}
- n.getPostRunURI = function() { return "/user/" + this.name + "/workout"; }
- n.getProfileURI = function() { return "/user/" + this.name + "/profile"; }
+ n.getPostRunURI = function() { return "/user/" + this.userId + "/workout"; }
+ n.getProfileURI = function() { return "/user/" + this.userId + "/profile"; }
n.save = function() {
if (Util.store.set("track_gps_user", this)) {
@@ -247,7 +248,9 @@
Util.log("[ERROR] Can't store the workout");
}
}
- Util.postAsJSON(user.getPostRunURI(),app.currentActivity, success, error);
+ Util.postAsJSON(user.getPostRunURI(),
+ { userId : user.userId, passwd : user.passwd, data: app.currentActivity },
+ success, error);
} else {
Util.log("[ERROR] Your workout doesn't contain enough events");
}
@@ -324,8 +327,9 @@
app.setPrefs = function () {
var nodes = null, node = null;
-
- document.getElementById("user_input").value = user.name;
+
+ document.getElementById("user_name_input").value = user.name;
+ document.getElementById("user_email_input").value = user.email;
nodes = document.getElementsByClassName("distance_unit");
i = 0;
@@ -366,7 +370,8 @@
}
app.save = function () {
- user.name = document.getElementById("user_input").value;
+ user.name = document.getElementById("user_name_input").value;
+ user.email = document.getElementById("user_email_input").value;
user.weight = parseInt(document.getElementById("weight_input").value);
user.height = parseInt(document.getElementById("height_input").value);
user.save();