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