summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/PM/DataModel/Record.js7
-rw-r--r--frontend/beta/js/Clipperz/PM/Proxy.js3
-rwxr-xr-xfrontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js262
3 files changed, 7 insertions, 265 deletions
diff --git a/frontend/beta/js/Clipperz/PM/DataModel/Record.js b/frontend/beta/js/Clipperz/PM/DataModel/Record.js
index 270f2ae..ffb45de 100644
--- a/frontend/beta/js/Clipperz/PM/DataModel/Record.js
+++ b/frontend/beta/js/Clipperz/PM/DataModel/Record.js
@@ -279,18 +279,23 @@ Clipperz.PM.DataModel.Record.prototype = MochiKit.Base.update(null, {
279 if (this.shouldProcessData()) { 279 if (this.shouldProcessData()) {
280 var currentVersionParameters; 280 var currentVersionParameters;
281 281
282console.log("Record.processData", someValues);
282 this.processDataToExtractLegacyValues(someValues['data']); 283 this.processDataToExtractLegacyValues(someValues['data']);
283 284
284 if (typeof(someValues['data']['notes']) != 'undefined') { 285 if (typeof(someValues['data']['notes']) != 'undefined') {
285 this.setNotes(someValues['data']['notes']); 286 this.setNotes(someValues['data']['notes']);
286 } 287 }
288
287 if (someValues['data']['currentVersionKey'] != null) { 289 if (someValues['data']['currentVersionKey'] != null) {
288 this.setCurrentVersionKey(someValues['data']['currentVersionKey']); 290 this.setCurrentVersionKey(someValues['data']['currentVersionKey']);
289 } else { 291 } else {
290 this.setCurrentVersionKey(this.key()); 292 this.setCurrentVersionKey(this.key());
291 } 293 }
292 294
293 currentVersionParameters = someValues['currentVersion']; 295 // currentVersionParameters = someValues['currentVersion'];
296 currentVersionParameters = someValues['versions'][someValues['currentVersion']];
297console.log("Record.processData - this.currentVersionKey()", this.currentVersionKey());
298console.log("Record.processData - currentVersionParameters", currentVersionParameters);
294 currentVersionParameters['key'] = this.currentVersionKey(); 299 currentVersionParameters['key'] = this.currentVersionKey();
295 this.setCurrentVersion(new Clipperz.PM.DataModel.RecordVersion(this, currentVersionParameters)); 300 this.setCurrentVersion(new Clipperz.PM.DataModel.RecordVersion(this, currentVersionParameters));
296 301
diff --git a/frontend/beta/js/Clipperz/PM/Proxy.js b/frontend/beta/js/Clipperz/PM/Proxy.js
index f476196..bec9195 100644
--- a/frontend/beta/js/Clipperz/PM/Proxy.js
+++ b/frontend/beta/js/Clipperz/PM/Proxy.js
@@ -116,8 +116,7 @@ Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, {
116 this.addToll(new Clipperz.PM.Toll(someParameters['toll'])); 116 this.addToll(new Clipperz.PM.Toll(someParameters['toll']));
117 } 117 }
118//console.log("<<< Proxy.setTallCallback", someParameters['result']); 118//console.log("<<< Proxy.setTallCallback", someParameters['result']);
119 //return someParameters['result']; 119 return someParameters['result'];
120 return someParameters;
121 }, 120 },
122 121
123 //========================================================================= 122 //=========================================================================
diff --git a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js
deleted file mode 100755
index 34a10c2..0000000
--- a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js
+++ b/dev/null
@@ -1,262 +0,0 @@
1/*
2
3Copyright 2008-2011 Clipperz Srl
4
5This file is part of Clipperz Community Edition.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please
8refer to http://www.clipperz.com.
9
10* Clipperz Community Edition is free software: you can redistribute
11 it and/or modify it under the terms of the GNU Affero General Public
12 License as published by the Free Software Foundation, either version
13 3 of the License, or (at your option) any later version.
14
15* Clipperz Community Edition is distributed in the hope that it will
16 be useful, but WITHOUT ANY WARRANTY; without even the implied
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details.
19
20* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see
22 <http://www.gnu.org/licenses/>.
23
24*/
25
26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; }
28
29//=============================================================================
30
31Clipperz.PM.Proxy.PHP = function(args) {
32 Clipperz.PM.Proxy.PHP.superclass.constructor.call(this, args);
33/*
34 this._tolls = {
35 'CONNECT':[],
36 'REGISTER':[],
37 'MESSAGE':[]
38 };
39 */
40 return this;
41}
42
43YAHOO.extendX(Clipperz.PM.Proxy.PHP, Clipperz.PM.Proxy, {
44
45 'toString': function() {
46 return "Clipperz.PM.Proxy.PHP - " + this.args();
47 },
48
49 //=========================================================================
50/*
51 'tolls': function() {
52 return this._tolls;
53 },
54*/
55 //-------------------------------------------------------------------------
56/*
57 'payToll': function(aRequestType, someParameters) {
58 vardeferredResult;
59
60//MochiKit.Logging.logDebug(">>> Proxy.DWR.payToll: " + aRequestType);
61 if (this.tolls()[aRequestType].length > 0) {
62 deferredResult = MochiKit.Async.succeed(this.tolls()[aRequestType].pop());
63 } else {
64//MochiKit.Logging.logDebug("### " + aRequestType + " toll NOT immediately available; request queued.");
65 deferredResult = new MochiKit.Async.Deferred();
66 deferredResult.addCallback(function(someParameters) {
67 return new Clipperz.PM.Toll(someParameters['toll']);
68 })
69 com_clipperz_pm_Proxy.knock(Clipperz.Base.serializeJSON({requestType:aRequestType}), {
70 callback:MochiKit.Base.method(deferredResult, 'callback'),
71 errorHandler:MochiKit.Base.method(deferredResult, 'errback')
72 });
73 }
74
75 deferredResult.addCallback(function(aToll) {
76 return aToll.deferredPay();
77 });
78 deferredResult.addCallback(function(someParameters, aToll) {
79 var result;
80
81 result = {
82 parameters: someParameters,
83 toll: aToll
84 }
85
86 return result;
87 }, someParameters);
88
89 return deferredResult;
90 },
91*/
92 //-------------------------------------------------------------------------
93/*
94 'addToll': function(aToll) {
95 this.tolls()[aToll.requestType()].push(aToll);
96 },
97*/
98 //=========================================================================
99/*
100 'setTollCallback': function(someParameters) {
101//MochiKit.Logging.logDebug(">>> Proxy.DWR.setTollCallback");
102//MochiKit.Logging.logDebug("--- Proxy.DWR.setTollCallback - " + Clipperz.Base.serializeJSON(someParameters));
103 if (typeof(someParameters['toll']) != 'undefined') {
104 this.addToll(new Clipperz.PM.Toll(someParameters['toll']));
105 }
106 return someParameters['result'];
107 },
108*/
109 //=========================================================================
110
111 'registration': function(someParameters) {
112 return this.sendMessage('registration', someParameters, 'REGISTER');
113 },
114
115 //-------------------------------------------------------------------------
116
117 'handshake': function(someParameters) {
118/*
119 _s = "e8a2162f29aeaabb729f5625e9740edbf0cd80ac77c6b19ab951ed6c88443b8c";
120 _v = new Clipperz.Crypto.BigInt("955e2db0f7844aca372f5799e5f7e51b5866718493096908bd66abcf1d068108", 16);
121 _b = new Clipperz.Crypto.BigInt("5761e6c84d22ea3c5649de01702d60f674ccfe79238540eb34c61cd020230c53", 16);
122
123 _B = _v.add(Clipperz.Crypto.SRP.g().powerModule(_b, Clipperz.Crypto.SRP.n()));
124 _u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_B.asString(10))).toHexString(), 16);
125 _A = new Clipperz.Crypto.BigInt("3b3567ec33d73673552e960872eb154d091a2488915941038aef759236a27e64", 16);
126 _S = (_A.multiply(_v.powerModule(_u, Clipperz.Crypto.SRP.n()))).powerModule(_b, Clipperz.Crypto.SRP.n());
127 _K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_S.asString(10))).toHexString().slice(2);
128 _M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_A.asString(10) + _B.asString(10) + _K)).toHexString().slice(2);
129 _M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_A.asString(10) + _M1 + _K)).toHexString().slice(2);
130
131 // MochiKit.Logging.logDebug("b = " + _b.asString(16));
132 // MochiKit.Logging.logDebug("v = " + _v.asString(16));
133 MochiKit.Logging.logDebug("B = " + _B.asString(16));
134 MochiKit.Logging.logDebug("u = " + _u.asString(16));
135 MochiKit.Logging.logDebug("S = " + _S.asString(16));
136 MochiKit.Logging.logDebug("K = " + _K);
137 MochiKit.Logging.logDebug("M1 = " + _M1);
138 MochiKit.Logging.logDebug("M2 = " + _M2);
139 // MochiKit.Logging.logDebug("someParameters.version: " + someParameters.version);
140 */
141 return this.sendMessage('handshake', someParameters, 'CONNECT');
142 },
143
144 //-------------------------------------------------------------------------
145
146 'message': function(someParameters) {
147 return this.sendMessage('message', someParameters, 'MESSAGE');
148 },
149
150 //-------------------------------------------------------------------------
151
152 'logout': function(someParameters) {
153//MochiKit.Logging.logDebug("=== Proxy.DWR.logout");
154 return this.sendMessage('logout', someParameters, 'MESSAGE');
155 },
156
157 //=========================================================================
158
159 'sendMessage': function(aFunctionName, someParameters, aRequestType) {
160/*
161 vardeferredResult;
162 var proxy;
163
164//MochiKit.Logging.logDebug(">>> Proxy.DWR.sendMessage - " + aFunctionName + " - " + aRequestType);
165 proxy = this;
166
167 deferredResult = new MochiKit.Async.Deferred();
168//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.1 Proxy.DWR.sendMessage - 1: " + res); return res;});
169 deferredResult.addCallback(MochiKit.Base.method(proxy, 'payToll'), aRequestType);
170//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.2 Proxy.DWR.sendMessage - 2: " + Clipperz.Base.serializeJSON(res)); return res;});
171 deferredResult.addCallback(MochiKit.Base.method(proxy, 'sendRemoteMessage'), aFunctionName);
172//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.DWR.sendMessage - 3: " + res); return res;});
173//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.DWR.sendMessage - 3: " + Clipperz.Base.serializeJSON(res)); return res;});
174 deferredResult.callback(someParameters);
175
176//MochiKit.Logging.logDebug("<<< Proxy.DWR.sendMessage");
177 return deferredResult;
178*/
179
180 // return this.sendRemoteMessage(aFunctionName, someParameters);
181
182
183 vardeferredResult;
184 var proxy;
185
186 proxy = this;
187
188 deferredResult = new MochiKit.Async.Deferred();
189 deferredResult.addCallback(MochiKit.Base.method(proxy, 'sendRemoteMessage'), aFunctionName);
190//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.PHP.sendMessage - 3: " + res); return res;});
191//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.PHP.sendMessage - 3.1: " + Clipperz.Base.serializeJSON(res)); return res;});
192
193 deferredResult.callback(someParameters);
194
195 return deferredResult;
196 },
197
198 //=========================================================================
199
200 'sendRemoteMessage': function(aFunctionName, someParameters) {
201/*
202 vardeferredResult;
203
204//MochiKit.Logging.logDebug(">>> Proxy.DWR.sendRemoteMessage('" + aFunctionName + "', " + Clipperz.Base.serializeJSON(someParameters) + ") - " + this);
205 deferredResult = new MochiKit.Async.Deferred();
206//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Proxy.DWR.sendRemoteMessage - 1: " + res); return res;});
207 // deferredResult.addCallback(MochiKit.Base.method(this, 'setTollCallback'));
208//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Proxy.DWR.sendRemoteMessage - 2: " + res); return res;});
209
210 com_clipperz_pm_Proxy[aFunctionName](Clipperz.Base.serializeJSON(someParameters), {
211 callback:MochiKit.Base.method(deferredResult, 'callback'),
212 errorHandler:MochiKit.Base.method(deferredResult, 'errback')
213 });
214//MochiKit.Logging.logDebug("<<< Proxy.PHP.sendRemoteMessage - result: " + deferredResult);
215
216 return deferredResult;
217*/
218
219 vardeferredResult;
220 var parameters;
221
222//MochiKit.Logging.logDebug(">>> Proxy.PHP.sendRemoteMessage('" + aFunctionName + "', " + Clipperz.Base.serializeJSON(someParameters) + ") - " + this);
223 parameters = {};
224 parameters['method'] = aFunctionName;
225 // parameters['version'] = someParameters['version'];
226 // parameters['message'] = someParameters['message'];
227 parameters['parameters'] = Clipperz.Base.serializeJSON(someParameters);
228//MochiKit.Logging.logDebug("--- Proxy.PHP.sendRemoteMessage('" + Clipperz.Base.serializeJSON(parameters) + ") - " + this);
229 deferredResult = new MochiKit.Async.Deferred();
230 deferredResult.addCallback(MochiKit.Async.doXHR, "./php/index.php", {
231 method:'POST',
232 sendContent:MochiKit.Base.queryString(parameters),
233 headers:{"Content-Type":"application/x-www-form-urlencoded"}
234 });
235//deferredResult.addCallback(function(res) {MochiKit.Logging.logDebug("Proxy.PHP.response - 2: " + res.responseText); return res;});
236//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("Proxy.PHP.response - ERROR: " + res); return res;});
237 deferredResult.addCallback(MochiKit.Async.evalJSONRequest);
238 deferredResult.addCallback(function (someValues) {
239 if (someValues['result'] == 'EXCEPTION') {
240 throw someValues['message'];
241 }
242 return someValues;
243 })
244 deferredResult.callback();
245
246 return deferredResult;
247 },
248
249 //=========================================================================
250
251 'isReadOnly': function() {
252 return false;
253 },
254
255 //=========================================================================
256 __syntaxFix__: "syntax fix"
257
258});
259
260//=============================================================================
261
262//Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.PHP("Proxy.PHP - async test");