author | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-04 23:24:50 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-04 23:24:50 (UTC) |
commit | 3065be1b71e4c40428cfa192de560c970ba7f8b3 (patch) (unidiff) | |
tree | bd030652e7c1e1556125beeaf7f18e174ab79385 /frontend | |
parent | c53c209c9b1e86f375aea9262fdb3170cae61ebc (diff) | |
parent | bf22713a7251a2b32700a67456a086a283dbe33a (diff) | |
download | clipperz-3065be1b71e4c40428cfa192de560c970ba7f8b3.zip clipperz-3065be1b71e4c40428cfa192de560c970ba7f8b3.tar.gz clipperz-3065be1b71e4c40428cfa192de560c970ba7f8b3.tar.bz2 |
Merge branch 'timeout'
-rwxr-xr-x | frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js | 6 |
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 | |||
@@ -145,115 +145,121 @@ YAHOO.extendX(Clipperz.PM.Proxy.PHP, Clipperz.PM.Proxy, { | |||
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"); |