summaryrefslogtreecommitdiff
path: root/frontend
Unidiff
Diffstat (limited to 'frontend') (more/less context) (ignore whitespace changes)
-rwxr-xr-xfrontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js
index e7c2bc1..6185fd6 100755
--- a/frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js
+++ b/frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js
@@ -49,211 +49,217 @@ YAHOO.extendX(Clipperz.PM.Proxy.PHP, Clipperz.PM.Proxy, {
49 return "Clipperz.PM.Proxy.PHP - " + this.args(); 49 return "Clipperz.PM.Proxy.PHP - " + this.args();
50 }, 50 },
51 51
52 //========================================================================= 52 //=========================================================================
53/* 53/*
54 'tolls': function() { 54 'tolls': function() {
55 return this._tolls; 55 return this._tolls;
56 }, 56 },
57*/ 57*/
58 //------------------------------------------------------------------------- 58 //-------------------------------------------------------------------------
59/* 59/*
60 'payToll': function(aRequestType, someParameters) { 60 'payToll': function(aRequestType, someParameters) {
61 vardeferredResult; 61 vardeferredResult;
62 62
63//MochiKit.Logging.logDebug(">>> Proxy.DWR.payToll: " + aRequestType); 63//MochiKit.Logging.logDebug(">>> Proxy.DWR.payToll: " + aRequestType);
64 if (this.tolls()[aRequestType].length > 0) { 64 if (this.tolls()[aRequestType].length > 0) {
65 deferredResult = MochiKit.Async.succeed(this.tolls()[aRequestType].pop()); 65 deferredResult = MochiKit.Async.succeed(this.tolls()[aRequestType].pop());
66 } else { 66 } else {
67//MochiKit.Logging.logDebug("### " + aRequestType + " toll NOT immediately available; request queued."); 67//MochiKit.Logging.logDebug("### " + aRequestType + " toll NOT immediately available; request queued.");
68 deferredResult = new MochiKit.Async.Deferred(); 68 deferredResult = new MochiKit.Async.Deferred();
69 deferredResult.addCallback(function(someParameters) { 69 deferredResult.addCallback(function(someParameters) {
70 return new Clipperz.PM.Toll(someParameters['toll']); 70 return new Clipperz.PM.Toll(someParameters['toll']);
71 }) 71 })
72 com_clipperz_pm_Proxy.knock(Clipperz.Base.serializeJSON({requestType:aRequestType}), { 72 com_clipperz_pm_Proxy.knock(Clipperz.Base.serializeJSON({requestType:aRequestType}), {
73 callback:MochiKit.Base.method(deferredResult, 'callback'), 73 callback:MochiKit.Base.method(deferredResult, 'callback'),
74 errorHandler:MochiKit.Base.method(deferredResult, 'errback') 74 errorHandler:MochiKit.Base.method(deferredResult, 'errback')
75 }); 75 });
76 } 76 }
77 77
78 deferredResult.addCallback(function(aToll) { 78 deferredResult.addCallback(function(aToll) {
79 return aToll.deferredPay(); 79 return aToll.deferredPay();
80 }); 80 });
81 deferredResult.addCallback(function(someParameters, aToll) { 81 deferredResult.addCallback(function(someParameters, aToll) {
82 var result; 82 var result;
83 83
84 result = { 84 result = {
85 parameters: someParameters, 85 parameters: someParameters,
86 toll: aToll 86 toll: aToll
87 } 87 }
88 88
89 return result; 89 return result;
90 }, someParameters); 90 }, someParameters);
91 91
92 return deferredResult; 92 return deferredResult;
93 }, 93 },
94*/ 94*/
95 //------------------------------------------------------------------------- 95 //-------------------------------------------------------------------------
96/* 96/*
97 'addToll': function(aToll) { 97 'addToll': function(aToll) {
98 this.tolls()[aToll.requestType()].push(aToll); 98 this.tolls()[aToll.requestType()].push(aToll);
99 }, 99 },
100*/ 100*/
101 //========================================================================= 101 //=========================================================================
102/* 102/*
103 'setTollCallback': function(someParameters) { 103 'setTollCallback': function(someParameters) {
104//MochiKit.Logging.logDebug(">>> Proxy.DWR.setTollCallback"); 104//MochiKit.Logging.logDebug(">>> Proxy.DWR.setTollCallback");
105//MochiKit.Logging.logDebug("--- Proxy.DWR.setTollCallback - " + Clipperz.Base.serializeJSON(someParameters)); 105//MochiKit.Logging.logDebug("--- Proxy.DWR.setTollCallback - " + Clipperz.Base.serializeJSON(someParameters));
106 if (typeof(someParameters['toll']) != 'undefined') { 106 if (typeof(someParameters['toll']) != 'undefined') {
107 this.addToll(new Clipperz.PM.Toll(someParameters['toll'])); 107 this.addToll(new Clipperz.PM.Toll(someParameters['toll']));
108 } 108 }
109 return someParameters['result']; 109 return someParameters['result'];
110 }, 110 },
111*/ 111*/
112 //========================================================================= 112 //=========================================================================
113 113
114 'registration': function(someParameters) { 114 'registration': function(someParameters) {
115 return this.sendMessage('registration', someParameters, 'REGISTER'); 115 return this.sendMessage('registration', someParameters, 'REGISTER');
116 }, 116 },
117 117
118 //------------------------------------------------------------------------- 118 //-------------------------------------------------------------------------
119 119
120 'handshake': function(someParameters) { 120 'handshake': function(someParameters) {
121/* 121/*
122 _s = "e8a2162f29aeaabb729f5625e9740edbf0cd80ac77c6b19ab951ed6c88443b8c"; 122 _s = "e8a2162f29aeaabb729f5625e9740edbf0cd80ac77c6b19ab951ed6c88443b8c";
123 _v = new Clipperz.Crypto.BigInt("955e2db0f7844aca372f5799e5f7e51b5866718493096908bd66abcf1d068108", 16); 123 _v = new Clipperz.Crypto.BigInt("955e2db0f7844aca372f5799e5f7e51b5866718493096908bd66abcf1d068108", 16);
124 _b = new Clipperz.Crypto.BigInt("5761e6c84d22ea3c5649de01702d60f674ccfe79238540eb34c61cd020230c53", 16); 124 _b = new Clipperz.Crypto.BigInt("5761e6c84d22ea3c5649de01702d60f674ccfe79238540eb34c61cd020230c53", 16);
125 125
126 _B = _v.add(Clipperz.Crypto.SRP.g().powerModule(_b, Clipperz.Crypto.SRP.n())); 126 _B = _v.add(Clipperz.Crypto.SRP.g().powerModule(_b, Clipperz.Crypto.SRP.n()));
127 _u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_B.asString(10))).toHexString(), 16); 127 _u = new Clipperz.Crypto.BigInt(Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_B.asString(10))).toHexString(), 16);
128 _A = new Clipperz.Crypto.BigInt("3b3567ec33d73673552e960872eb154d091a2488915941038aef759236a27e64", 16); 128 _A = new Clipperz.Crypto.BigInt("3b3567ec33d73673552e960872eb154d091a2488915941038aef759236a27e64", 16);
129 _S = (_A.multiply(_v.powerModule(_u, Clipperz.Crypto.SRP.n()))).powerModule(_b, Clipperz.Crypto.SRP.n()); 129 _S = (_A.multiply(_v.powerModule(_u, Clipperz.Crypto.SRP.n()))).powerModule(_b, Clipperz.Crypto.SRP.n());
130 _K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_S.asString(10))).toHexString().slice(2); 130 _K = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_S.asString(10))).toHexString().slice(2);
131 _M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_A.asString(10) + _B.asString(10) + _K)).toHexString().slice(2); 131 _M1 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_A.asString(10) + _B.asString(10) + _K)).toHexString().slice(2);
132 _M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_A.asString(10) + _M1 + _K)).toHexString().slice(2); 132 _M2 = Clipperz.PM.Crypto.encryptingFunctions.versions[someParameters.version].hash(new Clipperz.ByteArray(_A.asString(10) + _M1 + _K)).toHexString().slice(2);
133 133
134 // MochiKit.Logging.logDebug("b = " + _b.asString(16)); 134 // MochiKit.Logging.logDebug("b = " + _b.asString(16));
135 // MochiKit.Logging.logDebug("v = " + _v.asString(16)); 135 // MochiKit.Logging.logDebug("v = " + _v.asString(16));
136 MochiKit.Logging.logDebug("B = " + _B.asString(16)); 136 MochiKit.Logging.logDebug("B = " + _B.asString(16));
137 MochiKit.Logging.logDebug("u = " + _u.asString(16)); 137 MochiKit.Logging.logDebug("u = " + _u.asString(16));
138 MochiKit.Logging.logDebug("S = " + _S.asString(16)); 138 MochiKit.Logging.logDebug("S = " + _S.asString(16));
139 MochiKit.Logging.logDebug("K = " + _K); 139 MochiKit.Logging.logDebug("K = " + _K);
140 MochiKit.Logging.logDebug("M1 = " + _M1); 140 MochiKit.Logging.logDebug("M1 = " + _M1);
141 MochiKit.Logging.logDebug("M2 = " + _M2); 141 MochiKit.Logging.logDebug("M2 = " + _M2);
142 // MochiKit.Logging.logDebug("someParameters.version: " + someParameters.version); 142 // MochiKit.Logging.logDebug("someParameters.version: " + someParameters.version);
143 */ 143 */
144 return this.sendMessage('handshake', someParameters, 'CONNECT'); 144 return this.sendMessage('handshake', someParameters, 'CONNECT');
145 }, 145 },
146 146
147 //------------------------------------------------------------------------- 147 //-------------------------------------------------------------------------
148 148
149 'message': function(someParameters) { 149 'message': function(someParameters) {
150 return this.sendMessage('message', someParameters, 'MESSAGE'); 150 return this.sendMessage('message', someParameters, 'MESSAGE');
151 }, 151 },
152 152
153 //------------------------------------------------------------------------- 153 //-------------------------------------------------------------------------
154 154
155 'logout': function(someParameters) { 155 'logout': function(someParameters) {
156//MochiKit.Logging.logDebug("=== Proxy.DWR.logout"); 156//MochiKit.Logging.logDebug("=== Proxy.DWR.logout");
157 return this.sendMessage('logout', someParameters, 'MESSAGE'); 157 return this.sendMessage('logout', someParameters, 'MESSAGE');
158 }, 158 },
159 159
160 //========================================================================= 160 //=========================================================================
161 161
162 'sendMessage': function(aFunctionName, someParameters, aRequestType) { 162 'sendMessage': function(aFunctionName, someParameters, aRequestType) {
163/* 163/*
164 vardeferredResult; 164 vardeferredResult;
165 var proxy; 165 var proxy;
166 166
167//MochiKit.Logging.logDebug(">>> Proxy.DWR.sendMessage - " + aFunctionName + " - " + aRequestType); 167//MochiKit.Logging.logDebug(">>> Proxy.DWR.sendMessage - " + aFunctionName + " - " + aRequestType);
168 proxy = this; 168 proxy = this;
169 169
170 deferredResult = new MochiKit.Async.Deferred(); 170 deferredResult = new MochiKit.Async.Deferred();
171//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.1 Proxy.DWR.sendMessage - 1: " + res); return res;}); 171//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.1 Proxy.DWR.sendMessage - 1: " + res); return res;});
172 deferredResult.addCallback(MochiKit.Base.method(proxy, 'payToll'), aRequestType); 172 deferredResult.addCallback(MochiKit.Base.method(proxy, 'payToll'), aRequestType);
173//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.2 Proxy.DWR.sendMessage - 2: " + Clipperz.Base.serializeJSON(res)); return res;}); 173//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.2 Proxy.DWR.sendMessage - 2: " + Clipperz.Base.serializeJSON(res)); return res;});
174 deferredResult.addCallback(MochiKit.Base.method(proxy, 'sendRemoteMessage'), aFunctionName); 174 deferredResult.addCallback(MochiKit.Base.method(proxy, 'sendRemoteMessage'), aFunctionName);
175//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.DWR.sendMessage - 3: " + res); return res;}); 175//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.DWR.sendMessage - 3: " + res); return res;});
176//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.DWR.sendMessage - 3: " + Clipperz.Base.serializeJSON(res)); return res;}); 176//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.DWR.sendMessage - 3: " + Clipperz.Base.serializeJSON(res)); return res;});
177 deferredResult.callback(someParameters); 177 deferredResult.callback(someParameters);
178 178
179//MochiKit.Logging.logDebug("<<< Proxy.DWR.sendMessage"); 179//MochiKit.Logging.logDebug("<<< Proxy.DWR.sendMessage");
180 return deferredResult; 180 return deferredResult;
181*/ 181*/
182 182
183 // return this.sendRemoteMessage(aFunctionName, someParameters); 183 // return this.sendRemoteMessage(aFunctionName, someParameters);
184 184
185 185
186 vardeferredResult; 186 vardeferredResult;
187 var proxy; 187 var proxy;
188 188
189 proxy = this; 189 proxy = this;
190 190
191 deferredResult = new MochiKit.Async.Deferred(); 191 deferredResult = new MochiKit.Async.Deferred();
192 deferredResult.addCallback(MochiKit.Base.method(proxy, 'sendRemoteMessage'), aFunctionName); 192 deferredResult.addCallback(MochiKit.Base.method(proxy, 'sendRemoteMessage'), aFunctionName);
193//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.PHP.sendMessage - 3: " + res); return res;}); 193//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.PHP.sendMessage - 3: " + res); return res;});
194//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.PHP.sendMessage - 3.1: " + Clipperz.Base.serializeJSON(res)); return res;}); 194//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("x.3 Proxy.PHP.sendMessage - 3.1: " + Clipperz.Base.serializeJSON(res)); return res;});
195 195
196 deferredResult.callback(someParameters); 196 deferredResult.callback(someParameters);
197 197
198 return deferredResult; 198 return deferredResult;
199 }, 199 },
200 200
201 //========================================================================= 201 //=========================================================================
202 202
203 'sendRemoteMessage': function(aFunctionName, someParameters) { 203 'sendRemoteMessage': function(aFunctionName, someParameters) {
204/* 204/*
205 vardeferredResult; 205 vardeferredResult;
206 206
207//MochiKit.Logging.logDebug(">>> Proxy.DWR.sendRemoteMessage('" + aFunctionName + "', " + Clipperz.Base.serializeJSON(someParameters) + ") - " + this); 207//MochiKit.Logging.logDebug(">>> Proxy.DWR.sendRemoteMessage('" + aFunctionName + "', " + Clipperz.Base.serializeJSON(someParameters) + ") - " + this);
208 deferredResult = new MochiKit.Async.Deferred(); 208 deferredResult = new MochiKit.Async.Deferred();
209//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Proxy.DWR.sendRemoteMessage - 1: " + res); return res;}); 209//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Proxy.DWR.sendRemoteMessage - 1: " + res); return res;});
210 // deferredResult.addCallback(MochiKit.Base.method(this, 'setTollCallback')); 210 // deferredResult.addCallback(MochiKit.Base.method(this, 'setTollCallback'));
211//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Proxy.DWR.sendRemoteMessage - 2: " + res); return res;}); 211//deferredResult.addBoth(function(res) {MochiKit.Logging.logDebug("Proxy.DWR.sendRemoteMessage - 2: " + res); return res;});
212 212
213 com_clipperz_pm_Proxy[aFunctionName](Clipperz.Base.serializeJSON(someParameters), { 213 com_clipperz_pm_Proxy[aFunctionName](Clipperz.Base.serializeJSON(someParameters), {
214 callback:MochiKit.Base.method(deferredResult, 'callback'), 214 callback:MochiKit.Base.method(deferredResult, 'callback'),
215 errorHandler:MochiKit.Base.method(deferredResult, 'errback') 215 errorHandler:MochiKit.Base.method(deferredResult, 'errback')
216 }); 216 });
217//MochiKit.Logging.logDebug("<<< Proxy.PHP.sendRemoteMessage - result: " + deferredResult); 217//MochiKit.Logging.logDebug("<<< Proxy.PHP.sendRemoteMessage - result: " + deferredResult);
218 218
219 return deferredResult; 219 return deferredResult;
220*/ 220*/
221 221
222 vardeferredResult; 222 vardeferredResult;
223 var parameters; 223 var parameters;
224 224
225//MochiKit.Logging.logDebug(">>> Proxy.PHP.sendRemoteMessage('" + aFunctionName + "', " + Clipperz.Base.serializeJSON(someParameters) + ") - " + this); 225//MochiKit.Logging.logDebug(">>> Proxy.PHP.sendRemoteMessage('" + aFunctionName + "', " + Clipperz.Base.serializeJSON(someParameters) + ") - " + this);
226 parameters = {}; 226 parameters = {};
227 parameters['method'] = aFunctionName; 227 parameters['method'] = aFunctionName;
228 // parameters['version'] = someParameters['version']; 228 // parameters['version'] = someParameters['version'];
229 // parameters['message'] = someParameters['message']; 229 // parameters['message'] = someParameters['message'];
230 parameters['parameters'] = Clipperz.Base.serializeJSON(someParameters); 230 parameters['parameters'] = Clipperz.Base.serializeJSON(someParameters);
231//MochiKit.Logging.logDebug("--- Proxy.PHP.sendRemoteMessage('" + Clipperz.Base.serializeJSON(parameters) + ") - " + this); 231//MochiKit.Logging.logDebug("--- Proxy.PHP.sendRemoteMessage('" + Clipperz.Base.serializeJSON(parameters) + ") - " + this);
232 deferredResult = new MochiKit.Async.Deferred(); 232 deferredResult = new MochiKit.Async.Deferred();
233 deferredResult.addCallback(MochiKit.Async.doXHR, "./php/index.php", { 233 deferredResult.addCallback(MochiKit.Async.doXHR, "./php/index.php", {
234 method:'POST', 234 method:'POST',
235 sendContent:MochiKit.Base.queryString(parameters), 235 sendContent:MochiKit.Base.queryString(parameters),
236 headers:{"Content-Type":"application/x-www-form-urlencoded"} 236 headers:{"Content-Type":"application/x-www-form-urlencoded"}
237 }); 237 });
238//deferredResult.addCallback(function(res) {MochiKit.Logging.logDebug("Proxy.PHP.response - 2: " + res.responseText); return res;}); 238//deferredResult.addCallback(function(res) {MochiKit.Logging.logDebug("Proxy.PHP.response - 2: " + res.responseText); return res;});
239//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("Proxy.PHP.response - ERROR: " + res); return res;}); 239//deferredResult.addErrback(function(res) {MochiKit.Logging.logDebug("Proxy.PHP.response - ERROR: " + res); return res;});
240 deferredResult.addCallback(MochiKit.Async.evalJSONRequest); 240 deferredResult.addCallback(MochiKit.Async.evalJSONRequest);
241 deferredResult.addCallback(function (someValues) {
242 if (someValues['result'] == 'EXCEPTION') {
243 throw someValues['message'];
244 }
245 return someValues;
246 })
241 deferredResult.callback(); 247 deferredResult.callback();
242 248
243 return deferredResult; 249 return deferredResult;
244 }, 250 },
245 251
246 //========================================================================= 252 //=========================================================================
247 253
248 'isReadOnly': function() { 254 'isReadOnly': function() {
249 return false; 255 return false;
250 }, 256 },
251 257
252 //========================================================================= 258 //=========================================================================
253 __syntaxFix__: "syntax fix" 259 __syntaxFix__: "syntax fix"
254 260
255}); 261});
256 262
257//============================================================================= 263//=============================================================================
258 264
259//Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.PHP("Proxy.PHP - async test"); 265//Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.PHP("Proxy.PHP - async test");