From c4618104628457f407f8b397a41e4ec1bcc70668 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Sun, 12 Jan 2014 23:04:03 +0100 Subject: [PATCH] Encode/Decode on import/export group from/to sync server --- inc/myco_objects.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/inc/myco_objects.js b/inc/myco_objects.js index fa5a126..e490014 100644 --- a/inc/myco_objects.js +++ b/inc/myco_objects.js @@ -113,7 +113,7 @@ function Group(name,data) { contributions.push(this.contributions[idx].export()); } return { - 'name': this.name, + 'name': encodeURIComponent(this.name), 'contributors': contributors, 'contributions': contributions }; @@ -223,8 +223,8 @@ function Group(name,data) { if (jQuery.type(data.contributors) == 'array') { for (idx in data.contributors) { this.contributors.push(new Contributor( - data.contributors[idx].name, - data.contributors[idx].email, + decodeURIComponent(data.contributors[idx].name), + decodeURIComponent(data.contributors[idx].email), idx )); } @@ -234,7 +234,7 @@ function Group(name,data) { this.contributions.push(new Contribution( this.contributorByName(data.contributions[idx].contributor), data.contributions[idx].cost, - data.contributions[idx].title, + decodeURIComponent(data.contributions[idx].title), data.contributions[idx].date, idx, data.contributions[idx].lastChange @@ -254,8 +254,8 @@ function Contributor(name,email,id) { this.id=id; this.export=function() { return { - 'name': this.name, - 'email': this.email + 'name': encodeURIComponent(this.name), + 'email': encodeURIComponent(this.email) }; } } @@ -269,9 +269,9 @@ function Contribution(contributor,cost,title,date,id,lastChange) { this.lastChange=lastChange || new Date().getTime(); this.export=function() { return { - 'contributor': this.contributor.name, + 'contributor': encodeURIComponent(this.contributor.name), 'cost': this.cost, - 'title': this.title, + 'title': encodeURIComponent(this.title), 'date': this.date, 'lastChange': this.lastChange, };