Diffstat (limited to 'frontend/beta/js/Clipperz/PM/Proxy') (more/less context) (ignore whitespace changes)
4 files changed, 40 insertions, 48 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 | }); |
diff --git a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js index d5336be..1a5caff 100644 --- a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js +++ b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.DataStore.js | |||
@@ -1,118 +1,116 @@ | |||
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 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { | 24 | try { if (typeof(Clipperz.PM.Proxy.Offline) == 'undefined') { throw ""; }} catch (e) { |
27 | throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!"; | 25 | throw "Clipperz.PM.Proxy.Offline.DataStore depends on Clipperz.PM.Proxy.Offline!"; |
28 | } | 26 | } |
29 | 27 | ||
30 | //============================================================================= | 28 | //============================================================================= |
31 | 29 | ||
32 | Clipperz.PM.Proxy.Offline.DataStore = function(args) { | 30 | Clipperz.PM.Proxy.Offline.DataStore = function(args) { |
33 | args = args || {}; | 31 | args = args || {}; |
34 | 32 | ||
35 | this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); | 33 | this._data = args.data || (typeof(_clipperz_dump_data_) != 'undefined' ? _clipperz_dump_data_ : null); |
36 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); | 34 | this._isReadOnly = (typeof(args.readOnly) == 'undefined' ? true : args.readOnly); |
37 | this._shouldPayTolls = args.shouldPayTolls || false; | 35 | this._shouldPayTolls = args.shouldPayTolls || false; |
38 | 36 | ||
39 | this._tolls = {}; | 37 | this._tolls = {}; |
40 | this._connections = {}; | 38 | this._connections = {}; |
41 | 39 | ||
42 | this._b = null; | 40 | this._b = null; |
43 | this._B = null; | 41 | this._B = null; |
44 | this._A = null; | 42 | this._A = null; |
45 | this._userData = null; | 43 | this._userData = null; |
46 | 44 | ||
47 | return this; | 45 | return this; |
48 | } | 46 | } |
49 | 47 | ||
50 | //Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { | 48 | //Clipperz.Base.extend(Clipperz.PM.Proxy.Offline.DataStore, Object, { |
51 | Clipperz.PM.Proxy.Offline.DataStore.prototype = MochiKit.Base.update(null, { | 49 | Clipperz.PM.Proxy.Offline.DataStore.prototype = MochiKit.Base.update(null, { |
52 | 50 | ||
53 | //------------------------------------------------------------------------- | 51 | //------------------------------------------------------------------------- |
54 | 52 | ||
55 | 'isReadOnly': function () { | 53 | 'isReadOnly': function () { |
56 | return this._isReadOnly; | 54 | return this._isReadOnly; |
57 | }, | 55 | }, |
58 | 56 | ||
59 | //------------------------------------------------------------------------- | 57 | //------------------------------------------------------------------------- |
60 | 58 | ||
61 | 'shouldPayTolls': function() { | 59 | 'shouldPayTolls': function() { |
62 | return this._shouldPayTolls; | 60 | return this._shouldPayTolls; |
63 | }, | 61 | }, |
64 | 62 | ||
65 | //------------------------------------------------------------------------- | 63 | //------------------------------------------------------------------------- |
66 | 64 | ||
67 | 'data': function () { | 65 | 'data': function () { |
68 | return this._data; | 66 | return this._data; |
69 | }, | 67 | }, |
70 | 68 | ||
71 | //------------------------------------------------------------------------- | 69 | //------------------------------------------------------------------------- |
72 | 70 | ||
73 | 'tolls': function () { | 71 | 'tolls': function () { |
74 | return this._tolls; | 72 | return this._tolls; |
75 | }, | 73 | }, |
76 | 74 | ||
77 | //------------------------------------------------------------------------- | 75 | //------------------------------------------------------------------------- |
78 | 76 | ||
79 | 'connections': function () { | 77 | 'connections': function () { |
80 | return this._connections; | 78 | return this._connections; |
81 | }, | 79 | }, |
82 | 80 | ||
83 | //========================================================================= | 81 | //========================================================================= |
84 | 82 | ||
85 | 'resetData': function() { | 83 | 'resetData': function() { |
86 | this._data = { | 84 | this._data = { |
87 | 'users': { | 85 | 'users': { |
88 | 'catchAllUser': { | 86 | 'catchAllUser': { |
89 | __masterkey_test_value__: 'masterkey', | 87 | __masterkey_test_value__: 'masterkey', |
90 | s: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00', | 88 | s: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00', |
91 | v: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00' | 89 | v: '112233445566778899aabbccddeeff00112233445566778899aabbccddeeff00' |
92 | } | 90 | } |
93 | } | 91 | } |
94 | }; | 92 | }; |
95 | }, | 93 | }, |
96 | 94 | ||
97 | //------------------------------------------------------------------------- | 95 | //------------------------------------------------------------------------- |
98 | 96 | ||
99 | 'setupWithEncryptedData': function(someData) { | 97 | 'setupWithEncryptedData': function(someData) { |
100 | this._data = Clipperz.Base.deepClone(someData); | 98 | this._data = Clipperz.Base.deepClone(someData); |
101 | }, | 99 | }, |
102 | 100 | ||
103 | //------------------------------------------------------------------------- | 101 | //------------------------------------------------------------------------- |
104 | 102 | ||
105 | 'setupWithData': function(someData) { | 103 | 'setupWithData': function(someData) { |
106 | var deferredResult; | 104 | var deferredResult; |
107 | var resultData; | 105 | var resultData; |
108 | var i, c; | 106 | var i, c; |
109 | 107 | ||
110 | //Clipperz.log(">>> Proxy.Test.setupWithData"); | 108 | //Clipperz.log(">>> Proxy.Test.setupWithData"); |
111 | resultData = this._data; | 109 | resultData = this._data; |
112 | 110 | ||
113 | deferredResult = new MochiKit.Async.Deferred(); | 111 | deferredResult = new MochiKit.Async.Deferred(); |
114 | c = someData['users'].length; | 112 | c = someData['users'].length; |
115 | 113 | ||
116 | for (i=0; i<c; i++) { | 114 | for (i=0; i<c; i++) { |
117 | varnewConnection; | 115 | varnewConnection; |
118 | varrecordConfiguration; | 116 | varrecordConfiguration; |
diff --git a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.js b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.js index 3cf499e..91a7b48 100644 --- a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.js +++ b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Offline.js | |||
@@ -1,70 +1,68 @@ | |||
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.Offline = function(args) { | 29 | Clipperz.PM.Proxy.Offline = function(args) { |
32 | args = args || {}; | 30 | args = args || {}; |
33 | 31 | ||
34 | Clipperz.PM.Proxy.Offline.superclass.constructor.call(this, args); | 32 | Clipperz.PM.Proxy.Offline.superclass.constructor.call(this, args); |
35 | 33 | ||
36 | this._dataStore = args.dataStore || new Clipperz.PM.Proxy.Offline.DataStore(args); | 34 | this._dataStore = args.dataStore || new Clipperz.PM.Proxy.Offline.DataStore(args); |
37 | 35 | ||
38 | return this; | 36 | return this; |
39 | } | 37 | } |
40 | 38 | ||
41 | YAHOO.extendX(Clipperz.PM.Proxy.Offline, Clipperz.PM.Proxy, { | 39 | YAHOO.extendX(Clipperz.PM.Proxy.Offline, Clipperz.PM.Proxy, { |
42 | 40 | ||
43 | 'toString': function () { | 41 | 'toString': function () { |
44 | return "Clipperz.PM.Proxy.Offline"; | 42 | return "Clipperz.PM.Proxy.Offline"; |
45 | }, | 43 | }, |
46 | 44 | ||
47 | //------------------------------------------------------------------------- | 45 | //------------------------------------------------------------------------- |
48 | 46 | ||
49 | 'dataStore': function () { | 47 | 'dataStore': function () { |
50 | return this._dataStore; | 48 | return this._dataStore; |
51 | }, | 49 | }, |
52 | 50 | ||
53 | //------------------------------------------------------------------------- | 51 | //------------------------------------------------------------------------- |
54 | 52 | ||
55 | 'sendMessage': function(aFunctionName, someParameters) { | 53 | 'sendMessage': function(aFunctionName, someParameters) { |
56 | return this.dataStore().processMessage(aFunctionName, someParameters); | 54 | return this.dataStore().processMessage(aFunctionName, someParameters); |
57 | }, | 55 | }, |
58 | 56 | ||
59 | //------------------------------------------------------------------------- | 57 | //------------------------------------------------------------------------- |
60 | 58 | ||
61 | 'isReadOnly': function () { | 59 | 'isReadOnly': function () { |
62 | return true; | 60 | return true; |
63 | }, | 61 | }, |
64 | 62 | ||
65 | //------------------------------------------------------------------------- | 63 | //------------------------------------------------------------------------- |
66 | 64 | ||
67 | __syntaxFix__: "syntax fix" | 65 | __syntaxFix__: "syntax fix" |
68 | 66 | ||
69 | }); | 67 | }); |
70 | 68 | ||
diff --git a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Test.js b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Test.js index ce6e6d8..18014f4 100644 --- a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Test.js +++ b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.Test.js | |||
@@ -1,91 +1,89 @@ | |||
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 | if (typeof(Clipperz.PM.Proxy) == 'undefined') { Clipperz.PM.Proxy = {}; } | 26 | if (typeof(Clipperz.PM.Proxy) == 'undefined') { Clipperz.PM.Proxy = {}; } |
29 | 27 | ||
30 | //============================================================================= | 28 | //============================================================================= |
31 | 29 | ||
32 | Clipperz.PM.Proxy.Test = function(args) { | 30 | Clipperz.PM.Proxy.Test = function(args) { |
33 | args = args || {}; | 31 | args = args || {}; |
34 | 32 | ||
35 | Clipperz.PM.Proxy.Offline.call(this, args); | 33 | Clipperz.PM.Proxy.Offline.call(this, args); |
36 | 34 | ||
37 | 35 | ||
38 | 36 | ||
39 | return this; | 37 | return this; |
40 | } | 38 | } |
41 | 39 | ||
42 | Clipperz.PM.Proxy.Test.prototype = MochiKit.Base.update(new Clipperz.PM.Proxy.Offline(), { | 40 | Clipperz.PM.Proxy.Test.prototype = MochiKit.Base.update(new Clipperz.PM.Proxy.Offline(), { |
43 | 41 | ||
44 | 'toString': function() { | 42 | 'toString': function() { |
45 | return "Clipperz.PM.Proxy.Test"; | 43 | return "Clipperz.PM.Proxy.Test"; |
46 | }, | 44 | }, |
47 | 45 | ||
48 | //------------------------------------------------------------------------- | 46 | //------------------------------------------------------------------------- |
49 | 47 | ||
50 | 'isTestData': function() { | 48 | 'isTestData': function() { |
51 | return typeof(this.userData()['__masterkey_test_value__'] != 'undefined'); | 49 | return typeof(this.userData()['__masterkey_test_value__'] != 'undefined'); |
52 | }, | 50 | }, |
53 | 51 | ||
54 | //------------------------------------------------------------------------- | 52 | //------------------------------------------------------------------------- |
55 | 53 | ||
56 | 'userDetails': function() { | 54 | 'userDetails': function() { |
57 | var result; | 55 | var result; |
58 | 56 | ||
59 | if (this.isTestData()) { | 57 | if (this.isTestData()) { |
60 | var serializedHeader; | 58 | var serializedHeader; |
61 | var version; | 59 | var version; |
62 | 60 | ||
63 | version = this.userData()['version']; | 61 | version = this.userData()['version']; |
64 | serializedHeader = Clipperz.Base.serializeJSON(this.userData()['userDetails']); | 62 | serializedHeader = Clipperz.Base.serializeJSON(this.userData()['userDetails']); |
65 | result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(this.userData()['__masterkey_test_value__'], serializedHeader); | 63 | result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(this.userData()['__masterkey_test_value__'], serializedHeader); |
66 | } else { | 64 | } else { |
67 | result = Clipperz.PM.Proxy.Offline.prototype.userDetails.call(this); | 65 | result = Clipperz.PM.Proxy.Offline.prototype.userDetails.call(this); |
68 | } | 66 | } |
69 | 67 | ||
70 | return result; | 68 | return result; |
71 | }, | 69 | }, |
72 | 70 | ||
73 | //------------------------------------------------------------------------- | 71 | //------------------------------------------------------------------------- |
74 | 72 | ||
75 | 'statistics': function() { | 73 | 'statistics': function() { |
76 | var result; | 74 | var result; |
77 | var serializedStatistics; | 75 | var serializedStatistics; |
78 | var version; | 76 | var version; |
79 | 77 | ||
80 | version = this.userData()['version']; | 78 | version = this.userData()['version']; |
81 | serializedStatistics = Clipperz.Base.serializeJSON(this.userData()['statistics']); | 79 | serializedStatistics = Clipperz.Base.serializeJSON(this.userData()['statistics']); |
82 | result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(this.userData()['__masterkey_test_value__'], serializedStatistics); | 80 | result = Clipperz.PM.Crypto.encryptingFunctions.versions[version].encrypt(this.userData()['__masterkey_test_value__'], serializedStatistics); |
83 | 81 | ||
84 | return result; | 82 | return result; |
85 | }, | 83 | }, |
86 | 84 | ||
87 | //------------------------------------------------------------------------- | 85 | //------------------------------------------------------------------------- |
88 | __syntaxFix__: "syntax fix" | 86 | __syntaxFix__: "syntax fix" |
89 | 87 | ||
90 | }); | 88 | }); |
91 | 89 | ||