66b82a89ed01070b0229d087e39c419a4313b73a
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

1) function GroupList() {
Benjamin Renard Add lastChange field in obj...

Benjamin Renard authored 10 years ago

2) 
3)   lastChange=0;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

4)   
5)   this.loadFromLocalStorage=function() {
Benjamin Renard Manage local data loading e...

Benjamin Renard authored 10 years ago

6)     if (jQuery.type(localStorage.groups)!='undefined') {
7)       try {
8)         var data=JSON.parse(localStorage.groups);
9)         this.lastChange=data.lastChange;
10)         for (el in data.groups) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

11)           this[el]=new Group(el,false,data.groups[el]);
Benjamin Renard Manage local data loading e...

Benjamin Renard authored 10 years ago

12)         }
13)       }
14)       catch(e) {
15)         for (el in this) {
16)           if (this.isGroup(this[el])) {
17)             delete this[el];
18)           }
19)         }
20)         myconfirm('Erreur en chargeant les données locales. On les purges ?',
21)           function(data) {
22)             delete localStorage.groups;
23)             location.reload();
24)           }
25)         );
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

26)       }
27)     }
28)   }
29) 
30)   this.export=function() {
Benjamin Renard Add lastChange in GroupList...

Benjamin Renard authored 10 years ago

31)     return {
32)       'lastChange': this.lastChange,
33)       'groups': this.each(function(idx,group) {
34)         return group.export();
35)       })
36)     };
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

37)   }
38) 
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

39)   this.import=function(groups) {
40)     ret={};
41)     for (el in this) {
42)       if (this.isGroup(this[el])) {
43)         delete ret[el];
44)       }
45)     }
Benjamin Renard Add lastChange in GroupList...

Benjamin Renard authored 10 years ago

46)     this.lastChange=groups.lastChange;
47)     for (el in groups.groups) {
48)       this[el]=new Group(el,false,groups.groups[el]);
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

49)     }
50)     return true;
51)   }
52) 
53) 
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

54)   this.save=function() {
Benjamin Renard Add lastChange in GroupList...

Benjamin Renard authored 10 years ago

55)     localStorage.groups=JSON.stringify(this.export());
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

56)   }
57) 
58)   this.each=function(fct) {
59)     var idx=0;
Benjamin Renard Improve GroupsList each() m...

Benjamin Renard authored 10 years ago

60)     var ret={};
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

61)     for (el in this) {
62)       if(this.isGroup(this[el])) {
Benjamin Renard Improve GroupsList each() m...

Benjamin Renard authored 10 years ago

63)         ret[el]=fct(idx++,this[el]);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

64)       }
65)     }
Benjamin Renard Improve GroupsList each() m...

Benjamin Renard authored 10 years ago

66)     return ret;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

67)   }
68) 
69)   this.count=function() {
70)     len=0;
Benjamin Renard Improve GroupsList each() m...

Benjamin Renard authored 10 years ago

71)     this.each(function(idx,group) {
72)       len=len+1;
73)     });
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

74)     return len;
75)   }
76) 
77)   this.isGroup=function(el) {
Benjamin Renard Improve GroupList isGroup()...

Benjamin Renard authored 10 years ago

78)     return (jQuery.type(el)=='object' && jQuery.type(el.isGroup)=='function' && el.isGroup());
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

79)   }
80) 
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

81)   this.byName=function(name) {
82)     for (el in this) {
83)       if(this.isGroup(this[el])) {
84)         if (this[el].name==name) {
85)           return this[el];
86)         }
87)       }
88)     }
89)     return false;
90)   }
91) 
92) 
93)   this.removeGroup=function(uuid) {
94)     if (this.isGroup(this[uuid])) {
95)       delete this[uuid];
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

96)       return true;
97)     }
98)     return false;
99)   }
Benjamin Renard Add GroupList balances() me...

Benjamin Renard authored 10 years ago

100) 
101)   this.balances=function(fct) {
102)     return this.each(function(idx,group) {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

103)       bal=group.balance();
104)       bal.name=group.name;
105)       return bal;
Benjamin Renard Add GroupList balances() me...

Benjamin Renard authored 10 years ago

106)     });
107)   }
108) 
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

109)   this.newGroup=function(name,uuid) {
110)     var uuid=uuid||generate_uuid();
111)     this[uuid]=new Group(uuid,name);
112)     return uuid;
113)   }
114) 
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

115) }
116) 
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

117) function Group(uuid,name,data) {
118)   this.uuid=uuid || generate_uuid();
119)   this.name=name || false;
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

120)   this.contributors={};
Benjamin Renard Manage group contributors t...

Benjamin Renard authored 10 years ago

121)   this.deletedContributors={};
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

122)   this.contributions={};
123)   this.deletedContributions={};
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

124) 
125) 
126)   this.isGroup=function() {
127)     return true;
128)   }
129) 
130)   this.export=function() {
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

131)     var contributors={};
132)     for (email in this.contributors) {
133)       contributors[email]=this.contributors[email].export();
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

134)     }
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

135)     var contributions={}
136)     for (uuid in this.contributions) {
137)       contributions[uuid]=this.contributions[uuid].export();
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

138)     }
139)     return {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

140)       'uuid': this.uuid,
Benjamin Renard Encode/Decode on import/exp...

Benjamin Renard authored 10 years ago

141)       'name': encodeURIComponent(this.name),
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

142)       'contributors': contributors,
Benjamin Renard Manage group contributors t...

Benjamin Renard authored 10 years ago

143)       'deletedContributors': this.deletedContributors,
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

144)       'contributions': contributions,
145)       'deletedContributions': this.deletedContributions
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

146)     };
147)   }
148) 
Benjamin Renard Clean code

Benjamin Renard authored 10 years ago

149)   /*
150)    * Contributors
151)    */
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

152)   this.removeContributor=function(c) {
Benjamin Renard Manage group contributors t...

Benjamin Renard authored 10 years ago

153)     this.deletedContributors[c.email]=c.export();
154)     time=new Date().getTime();
155)     this.deletedContributors[c.email].deletionTime=time;
156)     contributions=this.contributionsByContributorEmail(c.email);
157)     for (idx in contributions) {
158)       this.deleteContribution(contributions[idx].uuid,time);
159)     }
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

160)     delete this.contributors[c.email];
Benjamin Renard Manage group contributors t...

Benjamin Renard authored 10 years ago

161)     return true;
162)   }
163) 
164)   this.restoreContributor=function(email) {
165)     if (email in  this.contributors) return;
166)     if (! email in this.deletedContributors) return;
167)     this.contributors[email]=this.importContributor(this.deletedContributors[email]);
168)     contributions=this.deletedContributionsByContributorEmail(email);
169)     for (idx in contributions) {
170)       if (contributions[idx].lastChange==this.deletedContributors[email].deletionTime) {
171)         this.restoreContribution(contributions[idx].uuid);
172)       }
173)     }
174)     delete this.deletedContributors[email];
175)     return true;
176)   }
177) 
178)   this.getDeletedContributors=function() {
179)     var ret=[];
180)     for (email in this.deletedContributors) {
181)       ret.push(this.importContributor(this.deletedContributors[email]));
182)     }
183)     return ret;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

184)   }
185) 
186)   this.contributorByName=function(name) {
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

187)     for (email in this.contributors) {
188)       if (this.contributors[email].name == name) return this.contributors[email];
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

189)     }
190)     return undefined;
191)   }
192) 
193)   this.contributorByEmail=function(email) {
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

194)     if (jQuery.type(this.contributors[email])!='undefined') {
195)       return this.contributors[email];
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

196)     }
197)     return undefined;
198)   }
199) 
Benjamin Renard Clean code

Benjamin Renard authored 10 years ago

200)   this.addContributor=function(c) {
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

201)     this.contributors[c.email]=c;
Benjamin Renard Clean code

Benjamin Renard authored 10 years ago

202)   }
203) 
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

204)   this.replaceContributor=function(email,c) {
205)     delete this.contributors[email];
206)     this.contributors[c.email]=c;
Benjamin Renard Clean code

Benjamin Renard authored 10 years ago

207)   }
208) 
209)   /*
210)    * Contributions
211)    */
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

212)   this.contributionsByContributorEmail=function(email) {
Benjamin Renard Sort contribution by date o...

Benjamin Renard authored 10 years ago

213)     var ret=[];
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

214)     for (uuid in this.contributions) {
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

215)       if (this.contributions[uuid].contributor.email==email) {
Benjamin Renard Sort contribution by date o...

Benjamin Renard authored 10 years ago

216)         ret.push(this.contributions[uuid]);
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

217)       }
218)     }
Benjamin Renard Sort contribution by date o...

Benjamin Renard authored 10 years ago

219)     ret.sort(function(a,b) {
220)       if (a.date==b.date) {
221)         return 0;
222)       }
223)       else if(a.date<b.date) {
224)         return -1;
225)       }
226)       else {
227)         return 1;
228)       }
229)     });
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

230)     return ret;
231)   }
232) 
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

233)   this.deletedContributionsByContributorEmail=function(email) {
234)     var ret=[];
235)     for (uuid in this.deletedContributions) {
236)       if (this.deletedContributions[uuid].contributor==email) {
237)         ret.push(new Contribution(
238)           this.contributorByEmail(email),
239)           this.deletedContributions[uuid].cost,
240)           decodeURIComponent(this.deletedContributions[uuid].title),
241)           this.deletedContributions[uuid].date,
242)           uuid,
243)           this.deletedContributions[uuid].lastChange
244)         ));
245)       }
246)     }
247)     ret.sort(function(a,b) {
248)       if (a.lastChange==b.lastChange) {
249)         return 0;
250)       }
251)       else if(a.lastChange<b.lastChange) {
252)         return -1;
253)       }
254)       else {
255)         return 1;
256)       }
257)     });
258)     return ret;
259)   }
260) 
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

261)   this.addContribution=function(c) {
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

262)     this.contributions[c.uuid]=c;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

263)   }
264) 
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

265)   this.updateContribution=function(uuid,c) {
266)     c.uuid=uuid;
267)     this.contributions[uuid]=c;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

268)   }
269) 
Benjamin Renard Manage group contributors t...

Benjamin Renard authored 10 years ago

270)   this.deleteContribution=function(uuid,time) {
271)     this.contributions[uuid].lastChange=time || new Date().getTime();
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

272)     this.deletedContributions[uuid]=this.contributions[uuid].export();
273)     delete this.contributions[uuid];
274)   }
275) 
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

276)   this.restoreContribution=function(uuid) {
277)     this.deletedContributions[uuid].lastChange=new Date().getTime();
278)     this.contributions[uuid]=this.importContribution(this.deletedContributions[uuid]);
279)     delete this.deletedContributions[uuid];
280)   }
281) 
Benjamin Renard Manage group contributors t...

Benjamin Renard authored 10 years ago

282)   this.importContributor=function(data) {
283)     return new Contributor(
284)       decodeURIComponent(data.name),
285)       data.email
286)     );
287)   }
288) 
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

289)   this.importContribution=function(data) {
290)     return new Contribution(
291)       this.contributorByEmail(data.contributor),
292)       data.cost,
293)       decodeURIComponent(data.title),
294)       data.date,
295)       data.uuid,
296)       data.lastChange
297)     );
298)   }
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

299) 
Benjamin Renard Clean code

Benjamin Renard authored 10 years ago

300)   /*
301)    * Balance
302)    */
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

303)   this.balance=function() {
Benjamin Renard Improve balance display

Benjamin Renard authored 10 years ago

304)     total={}
305)     min=-1;
306)     max=0;
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

307)     for (email in this.contributors) {
Benjamin Renard Improve balance display

Benjamin Renard authored 10 years ago

308)       var sum=0;
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

309)       cl=this.contributionsByContributorEmail(email);
Benjamin Renard Sort contribution by date o...

Benjamin Renard authored 10 years ago

310)       for (idx in cl) {
311)         sum+=cl[idx].cost;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

312)       }
Benjamin Renard Improve balance display

Benjamin Renard authored 10 years ago

313)       if (min==-1 || min>sum) {
314)           min=sum;
315)         }
316)       if(max<sum) {
317)         max=sum;
318)       }
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

319)       total[email]=sum;
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

320)     }
Benjamin Renard Improve balance display

Benjamin Renard authored 10 years ago

321)     balance={}
322)     var sum=0;
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

323)     for (email in total) {
324)       balance[email]={
325)         'name': this.contributors[email].name,
326)         'total': total[email],
327)         'diff': total[email]-max,
Benjamin Renard Improve balance display

Benjamin Renard authored 10 years ago

328)       }
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

329)       sum=sum+total[email];
Benjamin Renard Improve balance display

Benjamin Renard authored 10 years ago

330)     }
331)     return {
332)       'balance': balance,
333)       'sum': sum,
334)       'min': min,
335)       'max': max
336)     };
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

337)   }
338) 
Benjamin Renard Clean code

Benjamin Renard authored 10 years ago

339)   /*
340)    * Contructor
341)    */
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

342)   if (jQuery.type(data)=='object') {
343)     try {
Benjamin Renard Add uuid to group and refer...

Benjamin Renard authored 10 years ago

344)       this.uuid=data.uuid;
Benjamin Renard Clean code

Benjamin Renard authored 10 years ago

345)       this.name=data.name;
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

346)       if (jQuery.type(data.contributors) == 'object') {
347)         for (email in data.contributors) {
Benjamin Renard Manage group contributors t...

Benjamin Renard authored 10 years ago

348)           this.contributors[email]=this.importContributor(data.contributors[email]);
349)         }
350)       }
351)       if (jQuery.type(data.deletedContributors) == 'object') {
352)         for (email in data.deletedContributors) {
353)           this.deletedContributors[email]=data.deletedContributors[email];
Benjamin Renard Clean code

Benjamin Renard authored 10 years ago

354)         }
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

355)       }
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

356)       if (jQuery.type(data.contributions) == 'object') {
357)         for (uuid in data.contributions) {
Benjamin Renard Add possibility to view trash

Benjamin Renard authored 10 years ago

358)           this.contributions[uuid]=this.importContribution(data.contributions[uuid]);
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

359)         }
360)       }
361)       if (jQuery.type(data.deletedContributions) == 'object') {
362)         for (uuid in data.deletedContributions) {
363)           this.deletedContributions[uuid]=data.deletedContributions[uuid];
Benjamin Renard Clean code

Benjamin Renard authored 10 years ago

364)         }
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

365)       }
366)     }
367)     catch (e) {
368)       alert('Une erreur est survenue en chargeant le groupe '+this.name+' depuis le cache');
369)     }
370)   }
371) }
372) 
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

373) function Contributor(name,email) {
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

374)   this.name=name;
375)   this.email=email;
376)   this.export=function() {
377)     return {
Benjamin Renard Encode/Decode on import/exp...

Benjamin Renard authored 10 years ago

378)       'name': encodeURIComponent(this.name),
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

379)       'email': this.email
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

380)     };
381)   }
382) }
383) 
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

384) function Contribution(contributor,cost,title,date,uuid,lastChange) {
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

385)   this.contributor=contributor;
386)   this.cost=cost;
387)   this.title=title;
Benjamin Renard Transform date of contribut...

Benjamin Renard authored 10 years ago

388)   if (jQuery.type(date)!='date') {
389)     date=moment(date).toDate();
390)   }
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

391)   this.date=date;
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

392)   this.uuid=uuid || generate_uuid();
Benjamin Renard Add lastChange field in obj...

Benjamin Renard authored 10 years ago

393)   this.lastChange=lastChange || new Date().getTime();
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

394)   this.export=function() {
395)     return {
Benjamin Renard Manage contributor by their...

Benjamin Renard authored 10 years ago

396)       'contributor': this.contributor.email,
Benjamin Renard Use UUID as Contribution id...

Benjamin Renard authored 10 years ago

397)       'uuid': this.uuid,
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

398)       'cost': this.cost,
Benjamin Renard Encode/Decode on import/exp...

Benjamin Renard authored 10 years ago

399)       'title': encodeURIComponent(this.title),
Benjamin Renard Transform date of contribut...

Benjamin Renard authored 10 years ago

400)       'date': this.date.getTime(),
Benjamin Renard Add lastChange field in obj...

Benjamin Renard authored 10 years ago

401)       'lastChange': this.lastChange,
Benjamin Renard Initial commit

Benjamin Renard authored 10 years ago

402)     };
403)   }
404) 
405)   this.getTitle=function() {
406)     if (jQuery.type(this.title)=='string') {
407)       return this.title;
408)     }
409)     return '';
410)   }
411) }
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

412) 
413) function SyncServer() {
414)   this.url=false;
415)   this.email=false;
416)   this.password=false;
417)   this.logged=false;
418) 
419)   this.login=function(url,email,password,onsuccess,onerror) {
420)     this.url=url;
421)     this.email=email;
422)     this.password=password;
423) 
424)     try {
425)       jQuery.getJSON(
426)         this.url+'/login',
427)         {'email':email,'password':password},
428)         function(data, textStatus) {
429)           console.log(data);
430)           if (textStatus=='success') {
Benjamin Renard Fixed login error display

Benjamin Renard authored 10 years ago

431)             if(jQuery.type(data.email) != 'undefined' && jQuery.type(data.name) != 'undefined') {
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

432)               console.log('Login success return');
433)               console.log(onsuccess);
434)               onsuccess(data);
435)               return true;
436)             }
437)           }
438)           onerror(data);
439)         }
440)       ).fail(onerror);
441)     }
442)     catch(e) {
443)       if(jQuery.type(onerror)=='function') {
444)         onerror();
445)       }
446)     }
447)   }
448) 
Benjamin Renard Add subscribe feature

Benjamin Renard authored 10 years ago

449)   this.subscribe=function(url,email,name,password,onsuccess,onerror) {
450)     this.url=url;
451)     this.email=email;
452)     this.name=name;
453)     this.password=password;
454) 
455)     try {
456)       jQuery.getJSON(
457)         this.url+'/subscribe',
458)         {'email':email,'name': name,'password':password},
459)         function(data, textStatus) {
460)           console.log(data);
461)           if (textStatus=='success') {
462)             if(jQuery.type(data.email) != 'undefined' && jQuery.type(data.name) != 'undefined') {
463)               onsuccess(data);
464)               return true;
465)             }
466)           }
467)           onerror(data);
468)           return false;
469)         }
470)       ).fail(onerror);
471)     }
472)     catch(e) {
473)       if(jQuery.type(onerror)=='function') {
474)         onerror();
475)       }
476)     }
477)   }
478) 
479) 
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

480)   this.sync=function(url,email,password,groups,onsuccess,onerror) {
481)     this.url=url;
482)     this.email=email;
483)     this.password=password;
484)     try {
Benjamin Renard Use POST instead of GET req...

Benjamin Renard authored 10 years ago

485)       jQuery.post(
Benjamin Renard Add login and sync support

Benjamin Renard authored 10 years ago

486)         this.url+'/sync',
487)         {
488)           'email':email,
489)           'password':password,
490)           'groups': JSON.stringify(groups)
491)         },
492)         function(data, textStatus) {
493)           console.log(data);
494)           if (textStatus=='success') {
495)             if(jQuery.type(data.groups)) {
496)               console.log('Sync success return');
497)               onsuccess(data);
498)               return true;
499)             }
500)           }
501)           onerror(data);
Benjamin Renard Use POST instead of GET req...

Benjamin Renard authored 10 years ago

502)         },
503)         'json'