summaryrefslogtreecommitdiff
path: root/frontend/delta/js/Clipperz/PM/Proxy/Proxy.JSON.js
Unidiff
Diffstat (limited to 'frontend/delta/js/Clipperz/PM/Proxy/Proxy.JSON.js') (more/less context) (ignore whitespace changes)
-rwxr-xr-xfrontend/delta/js/Clipperz/PM/Proxy/Proxy.JSON.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/frontend/delta/js/Clipperz/PM/Proxy/Proxy.JSON.js b/frontend/delta/js/Clipperz/PM/Proxy/Proxy.JSON.js
index 1638d99..6deee3d 100755
--- a/frontend/delta/js/Clipperz/PM/Proxy/Proxy.JSON.js
+++ b/frontend/delta/js/Clipperz/PM/Proxy/Proxy.JSON.js
@@ -1,86 +1,86 @@
1/* 1/*
2 2
3Copyright 2008-2013 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz, the online password manager. 5This file is part of Clipperz, the online password manager.
6For further information about its features and functionalities please 6For further information about its features and functionalities please
7refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
8 8
9* Clipperz is free software: you can redistribute it and/or modify it 9* Clipperz is free software: you can redistribute it and/or modify it
10 under the terms of the GNU Affero General Public License as published 10 under the terms of the GNU Affero General Public License as published
11 by the Free Software Foundation, either version 3 of the License, or 11 by the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version. 12 (at your option) any later version.
13 13
14* Clipperz is distributed in the hope that it will be useful, but 14* Clipperz is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of 15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
18 18
19* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
20 License along with Clipperz. If not, see http://www.gnu.org/licenses/. 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
21 21
22*/ 22*/
23 23
24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } 25if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
26 26
27//============================================================================= 27//=============================================================================
28 28
29Clipperz.PM.Proxy.JSON = function(args) { 29Clipperz.PM.Proxy.JSON = function(args) {
30 Clipperz.PM.Proxy.JSON.superclass.constructor.call(this, args); 30 Clipperz.PM.Proxy.JSON.superclass.constructor.call(this, args);
31 31
32 this._url = args.url || Clipperz.Base.exception.raise('MandatoryParameter'); 32 this._url = args.url || Clipperz.Base.exception.raise('MandatoryParameter');
33 33
34 return this; 34 return this;
35} 35}
36 36
37Clipperz.Base.extend(Clipperz.PM.Proxy.JSON, Clipperz.PM.Proxy, { 37Clipperz.Base.extend(Clipperz.PM.Proxy.JSON, Clipperz.PM.Proxy, {
38 38
39 'toString': function() { 39 'toString': function() {
40 return "Clipperz.PM.Proxy.JSON"; 40 return "Clipperz.PM.Proxy.JSON";
41 }, 41 },
42 42
43 //========================================================================= 43 //=========================================================================
44 44
45 'url': function () { 45 'url': function () {
46 return this._url; 46 return this._url;
47 }, 47 },
48 48
49 //========================================================================= 49 //=========================================================================
50 50
51 '_sendMessage': function(aFunctionName, aVersion, someParameters) { 51 '_sendMessage': function(aFunctionName, aVersion, someParameters) {
52 vardeferredResult; 52 vardeferredResult;
53 var parameters; 53 var parameters;
54 54
55 parameters = { 55 parameters = {
56 method: aFunctionName, 56 method: aFunctionName,
57 version: aVersion, 57 version: aVersion,
58 parameters: Clipperz.Base.serializeJSON(someParameters) 58 parameters: Clipperz.Base.serializeJSON(someParameters)
59 }; 59 };
60 60console.log("PROXY.JSON._sendMessage", parameters);
61 deferredResult = new Clipperz.Async.Deferred("Proxy.JSON.sendMessage", {trace:false}); 61 deferredResult = new Clipperz.Async.Deferred("Proxy.JSON._sendMessage", {trace:false});
62 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestSent'); 62 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestSent');
63 deferredResult.addCallback(MochiKit.Async.doXHR, this.url(), { 63 deferredResult.addCallback(MochiKit.Async.doXHR, this.url(), {
64 method:'POST', 64 method:'POST',
65 sendContent:MochiKit.Base.queryString(parameters), 65 sendContent:MochiKit.Base.queryString(parameters),
66 headers:{"Content-Type":"application/x-www-form-urlencoded"} 66 headers:{"Content-Type":"application/x-www-form-urlencoded"}
67 }); 67 });
68 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestReceived'); 68 deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'remoteRequestReceived');
69 deferredResult.addCallback(MochiKit.Base.itemgetter('responseText')); 69 deferredResult.addCallback(MochiKit.Base.itemgetter('responseText'));
70 deferredResult.addCallback(Clipperz.Base.evalJSON); 70 deferredResult.addCallback(Clipperz.Base.evalJSON);
71 deferredResult.addCallback(function (someValues) { 71 deferredResult.addCallback(function (someValues) {
72 if (someValues['result'] == 'EXCEPTION') { 72 if (someValues['result'] == 'EXCEPTION') {
73 throw someValues['message']; 73 throw someValues['message'];
74 } 74 }
75 75
76 return someValues; 76 return someValues;
77 }) 77 })
78 deferredResult.callback(); 78 deferredResult.callback();
79 79
80 return deferredResult; 80 return deferredResult;
81 }, 81 },
82 82
83 //========================================================================= 83 //=========================================================================
84 __syntaxFix__: "syntax fix" 84 __syntaxFix__: "syntax fix"
85 85
86}); 86});