summaryrefslogtreecommitdiff
path: root/frontend
Unidiff
Diffstat (limited to 'frontend') (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
-rw-r--r--frontend/gamma/html/index_template.html5
-rw-r--r--frontend/gamma/js/Clipperz/Async.js19
-rw-r--r--frontend/gamma/js/Clipperz/PM/Proxy.js2
6 files changed, 26 insertions, 272 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
@@ -278,20 +278,25 @@ Clipperz.PM.DataModel.Record.prototype = MochiKit.Base.update(null, {
278//MochiKit.Logging.logDebug("--- Record.processData: " + Clipperz.Base.serializeJSON(someValues)); 278//MochiKit.Logging.logDebug("--- Record.processData: " + Clipperz.Base.serializeJSON(someValues));
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
297 if (someValues['data']['directLogins'] != null) { 302 if (someValues['data']['directLogins'] != null) {
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
@@ -115,10 +115,9 @@ Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, {
115//console.log("added a new toll", someParameters['toll']); 115//console.log("added a new toll", someParameters['toll']);
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 //=========================================================================
124 123
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");
diff --git a/frontend/gamma/html/index_template.html b/frontend/gamma/html/index_template.html
index 8cf838c..bedb243 100644
--- a/frontend/gamma/html/index_template.html
+++ b/frontend/gamma/html/index_template.html
@@ -38,8 +38,13 @@ Clipperz_normalizedNewLine = '\x0d\x0a';
38 38
39</div> 39</div>
40<div id="applicationVersionType" class="@application.version.type@"></div> 40<div id="applicationVersionType" class="@application.version.type@"></div>
41 41
42<script>
43 Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.JSON({'url':'@request.path@', 'shouldPayTolls':@should.pay.toll@});
44 /*offline_data_placeholder*/
45</script>
46
42<!-- --> 47<!-- -->
43<div id="javaScriptAlert"> 48<div id="javaScriptAlert">
44 <div class="mask"></div> 49 <div class="mask"></div>
45 <div class="message"> 50 <div class="message">
diff --git a/frontend/gamma/js/Clipperz/Async.js b/frontend/gamma/js/Clipperz/Async.js
index 7c9d783..97d8ecf 100644
--- a/frontend/gamma/js/Clipperz/Async.js
+++ b/frontend/gamma/js/Clipperz/Async.js
@@ -61,9 +61,10 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
61 //----------------------------------------------------------------------------- 61 //-----------------------------------------------------------------------------
62 62
63 'callback': function (aValue) { 63 'callback': function (aValue) {
64 if (this._shouldTrace) { 64 if (this._shouldTrace) {
65 Clipperz.log("CALLBACK " + this._name, aValue); 65 //Clipperz.log("CALLBACK " + this._name, aValue);
66 console.log("CALLBACK " + this._name, aValue);
66 } 67 }
67 68
68 if (this.chained == false) { 69 if (this.chained == false) {
69 var message; 70 var message;
@@ -81,9 +82,10 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
81 82
82 resultMessage = "RESULT " + this._name + " <=="; 83 resultMessage = "RESULT " + this._name + " <==";
83 // this.addCallback(function(aResult) { 84 // this.addCallback(function(aResult) {
84 Clipperz.Async.Deferred.superclass.addCallback.call(this, function(aResult) { 85 Clipperz.Async.Deferred.superclass.addCallback.call(this, function(aResult) {
85 Clipperz.log(resultMessage, aResult); 86 //Clipperz.log(resultMessage, aResult);
87 console.log(resultMessage, aResult);
86 88
87 return aResult; 89 return aResult;
88 }); 90 });
89 } 91 }
@@ -105,20 +107,24 @@ Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, {
105 this._count ++; 107 this._count ++;
106 message = "[" + this._count + "] " + this._name + " "; 108 message = "[" + this._count + "] " + this._name + " ";
107 // this.addBoth(function(aResult) {Clipperz.log(message + "-->", aResult); return aResult;}); 109 // this.addBoth(function(aResult) {Clipperz.log(message + "-->", aResult); return aResult;});
108 this.addCallbacks( 110 this.addCallbacks(
109 function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;}, 111 //function(aResult) {Clipperz.log("-OK- " + message + "-->"/*, aResult*/); return aResult;},
110 function(aResult) {Clipperz.log("FAIL " + message + "-->"/*, aResult*/); return aResult;} 112 function(aResult) {console.log("-OK- " + message + "-->"/*, aResult*/); return aResult;},
113 //function(aResult) {Clipperz.log("FAIL " + message + "-->"/*, aResult*/); return aResult;}
114 function(aResult) {console.log("FAIL " + message + "-->"/*, aResult*/); return aResult;}
111 ); 115 );
112 } 116 }
113 117
114 Clipperz.Async.Deferred.superclass.addCallback.apply(this, arguments); 118 Clipperz.Async.Deferred.superclass.addCallback.apply(this, arguments);
115 119
116 if (this._shouldTrace) { 120 if (this._shouldTrace) {
117 // this.addBoth(function(aResult) {Clipperz.log(message + "<--", aResult); return aResult;}); 121 // this.addBoth(function(aResult) {Clipperz.log(message + "<--", aResult); return aResult;});
118 this.addCallbacks( 122 this.addCallbacks(
119 function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;}, 123 //function(aResult) {Clipperz.log("-OK- " + message + "<--", aResult); return aResult;},
120 function(aResult) {Clipperz.log("FAIL " + message + "<--", aResult); return aResult;} 124 function(aResult) {console.log("-OK- " + message + "<--", aResult); return aResult;},
125 //function(aResult) {Clipperz.log("FAIL " + message + "<--", aResult); return aResult;}
126 function(aResult) {console.log("FAIL " + message + "<--", aResult); return aResult;}
121 ); 127 );
122 } 128 }
123 }, 129 },
124 130
@@ -405,8 +411,9 @@ MochiKit.Base.update(Clipperz.Async.DeferredSynchronizer.prototype, {
405 //nothing to do here other than possibly log something 411 //nothing to do here other than possibly log something
406 } else if (this.numberOfMethodsDone() == this.methods().length) { 412 } else if (this.numberOfMethodsDone() == this.methods().length) {
407 this.result().callback(); 413 this.result().callback();
408 } else if (this.numberOfMethodsDone() > this.methods().length) { 414 } else if (this.numberOfMethodsDone() > this.methods().length) {
415 alert("Clipperz.Async.Deferred.handleMethodCallDone -> WTF!");
409 //WTF!!! :( 416 //WTF!!! :(
410 } 417 }
411 418
412 }, 419 },
diff --git a/frontend/gamma/js/Clipperz/PM/Proxy.js b/frontend/gamma/js/Clipperz/PM/Proxy.js
index 190bffd..9817eac 100644
--- a/frontend/gamma/js/Clipperz/PM/Proxy.js
+++ b/frontend/gamma/js/Clipperz/PM/Proxy.js
@@ -141,9 +141,9 @@ Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, {
141 141
142 'processMessage': function (aFunctionName, someParameters, aRequestType) { 142 'processMessage': function (aFunctionName, someParameters, aRequestType) {
143 vardeferredResult; 143 vardeferredResult;
144 144
145 deferredResult = new Clipperz.Async.Deferred("Proxy.processMessage", {trace:false}); 145 deferredResult = new Clipperz.Async.Deferred("Proxy.processMessage", {trace:true});
146 deferredResult.addMethod(this, 'payToll', aRequestType); 146 deferredResult.addMethod(this, 'payToll', aRequestType);
147 deferredResult.addMethod(this, 'sendMessage', aFunctionName); 147 deferredResult.addMethod(this, 'sendMessage', aFunctionName);
148 deferredResult.addMethod(this, 'setTollCallback'); 148 deferredResult.addMethod(this, 'setTollCallback');
149 deferredResult.callback(someParameters); 149 deferredResult.callback(someParameters);