-rw-r--r-- | frontend/beta/html/index_template.html | 4 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/PM/DataModel/Record.js | 7 | ||||
-rw-r--r-- | frontend/beta/js/Clipperz/PM/Proxy.js | 3 | ||||
-rwxr-xr-x | frontend/beta/js/Clipperz/PM/Proxy/Proxy.PHP.js | 262 |
4 files changed, 9 insertions, 267 deletions
diff --git a/frontend/beta/html/index_template.html b/frontend/beta/html/index_template.html index 9862518..27a8a64 100644 --- a/frontend/beta/html/index_template.html +++ b/frontend/beta/html/index_template.html | |||
@@ -14,25 +14,25 @@ | |||
14 | <meta name="keywords" content="password manager,gestor de contraseñas,gerenciador de senhas,Kennwortmanager,passwords,security,privacy,cryptography" /> | 14 | <meta name="keywords" content="password manager,gestor de contraseñas,gerenciador de senhas,Kennwortmanager,passwords,security,privacy,cryptography" /> |
15 | <script> | 15 | <script> |
16 | Clipperz_IEisBroken = false; | 16 | Clipperz_IEisBroken = false; |
17 | Clipperz_normalizedNewLine = '\n'; | 17 | Clipperz_normalizedNewLine = '\n'; |
18 | Clipperz_dumpUrl = "/dump/"; | 18 | Clipperz_dumpUrl = "/dump/"; |
19 | </script> | 19 | </script> |
20 | 20 | ||
21 | <!--[if IE]><script> | 21 | <!--[if IE]><script> |
22 | Clipperz_IEisBroken = true; | 22 | Clipperz_IEisBroken = true; |
23 | Clipperz_normalizedNewLine = '\x0d\x0a'; | 23 | Clipperz_normalizedNewLine = '\x0d\x0a'; |
24 | </script><![endif]--> | 24 | </script><![endif]--> |
25 | 25 | ||
26 | @js_DEBUG@ | 26 | @js_LINKED@ |
27 | 27 | ||
28 | </head> | 28 | </head> |
29 | <body> | 29 | <body> |
30 | <div id="mainDiv"> | 30 | <div id="mainDiv"> |
31 | <div id="header"> | 31 | <div id="header"> |
32 | <div id="miscLinks"> | 32 | <div id="miscLinks"> |
33 | <a id="donateHeaderIconLink" href="http://www.clipperz.com/donations" target="_blank"><img id='donateHeaderIcon' src=""></a> | 33 | <a id="donateHeaderIconLink" href="http://www.clipperz.com/donations" target="_blank"><img id='donateHeaderIcon' src=""></a> |
34 | <ul> | 34 | <ul> |
35 | <li><a href="http://www.clipperz.com/donations" id='donateHeaderLink' class='highlightedHeader' target="_blank">donate</a></li> | 35 | <li><a href="http://www.clipperz.com/donations" id='donateHeaderLink' class='highlightedHeader' target="_blank">donate</a></li> |
36 | <li><a href="http://www.clipperz.com/credits" id='creditsHeaderLink' target="_blank">credits</a></li> | 36 | <li><a href="http://www.clipperz.com/credits" id='creditsHeaderLink' target="_blank">credits</a></li> |
37 | <li><a href="http://www.clipperz.com/contact" id='feedbackHeaderLink' target="_blank">feedback</a></li> | 37 | <li><a href="http://www.clipperz.com/contact" id='feedbackHeaderLink' target="_blank">feedback</a></li> |
38 | <li><a href="http://www.clipperz.com/support/user_guide" target="_blank" id='helpHeaderLink'>help</a></li> | 38 | <li><a href="http://www.clipperz.com/support/user_guide" target="_blank" id='helpHeaderLink'>help</a></li> |
@@ -59,25 +59,25 @@ Clipperz_normalizedNewLine = '\x0d\x0a'; | |||
59 | <td><div><a href="#">bookmarklet</a></div></td> | 59 | <td><div><a href="#">bookmarklet</a></div></td> |
60 | --> | 60 | --> |
61 | </tr> | 61 | </tr> |
62 | </tbody> | 62 | </tbody> |
63 | </table> | 63 | </table> |
64 | </div> | 64 | </div> |
65 | </div> | 65 | </div> |
66 | </div> | 66 | </div> |
67 | 67 | ||
68 | <div id="main"> | 68 | <div id="main"> |
69 | <h3 class="loading">loading ...</h3> | 69 | <h3 class="loading">loading ...</h3> |
70 | 70 | ||
71 | @js_INSTALL@ | 71 | @js_EMBEDDED@ |
72 | 72 | ||
73 | <script> | 73 | <script> |
74 | Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.JSON({'url':'@request.path@', 'shouldPayTolls':@should.pay.toll@}); | 74 | Clipperz.PM.Proxy.defaultProxy = new Clipperz.PM.Proxy.JSON({'url':'@request.path@', 'shouldPayTolls':@should.pay.toll@}); |
75 | /*offline_data_placeholder*/ | 75 | /*offline_data_placeholder*/ |
76 | </script> | 76 | </script> |
77 | 77 | ||
78 | <div id="javaScriptAlert"> | 78 | <div id="javaScriptAlert"> |
79 | <h1>Attention!</h1> | 79 | <h1>Attention!</h1> |
80 | <p>If you can read this message, the chances are that your browser does not properly support JavaScript? or you have disabled this functionality yourself.</p> | 80 | <p>If you can read this message, the chances are that your browser does not properly support JavaScript? or you have disabled this functionality yourself.</p> |
81 | <h3>Javascript is required to access Clipperz.</h3> | 81 | <h3>Javascript is required to access Clipperz.</h3> |
82 | <h5>Please enable scripting or upgrade your browser.</h5> | 82 | <h5>Please enable scripting or upgrade your browser.</h5> |
83 | </div> | 83 | </div> |
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 | |||
@@ -270,36 +270,41 @@ Clipperz.PM.DataModel.Record.prototype = MochiKit.Base.update(null, { | |||
270 | 270 | ||
271 | return result; | 271 | return result; |
272 | }, | 272 | }, |
273 | 273 | ||
274 | //------------------------------------------------------------------------- | 274 | //------------------------------------------------------------------------- |
275 | 275 | ||
276 | 'processData': function(someValues) { | 276 | 'processData': function(someValues) { |
277 | //MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.processData"); | 277 | //MochiKit.Logging.logDebug(">>> [" + (new Date()).valueOf() + "] Record.processData"); |
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 | ||
282 | console.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']]; | ||
297 | console.log("Record.processData - this.currentVersionKey()", this.currentVersionKey()); | ||
298 | console.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) { |
298 | vardirectLoginReference; | 303 | vardirectLoginReference; |
299 | 304 | ||
300 | for (directLoginReference in someValues['data']['directLogins']) { | 305 | for (directLoginReference in someValues['data']['directLogins']) { |
301 | var directLogin; | 306 | var directLogin; |
302 | var directLoginParameters; | 307 | var directLoginParameters; |
303 | 308 | ||
304 | directLoginParameters = someValues['data']['directLogins'][directLoginReference]; | 309 | directLoginParameters = someValues['data']['directLogins'][directLoginReference]; |
305 | directLoginParameters.record = this; | 310 | directLoginParameters.record = this; |
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 | |||
@@ -107,26 +107,25 @@ Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, { | |||
107 | //console.log("<<< Proxy.addToll"); | 107 | //console.log("<<< Proxy.addToll"); |
108 | }, | 108 | }, |
109 | 109 | ||
110 | //========================================================================= | 110 | //========================================================================= |
111 | 111 | ||
112 | 'setTollCallback': function(someParameters) { | 112 | 'setTollCallback': function(someParameters) { |
113 | //console.log(">>> Proxy.setTollCallback", someParameters); | 113 | //console.log(">>> Proxy.setTollCallback", someParameters); |
114 | if (typeof(someParameters['toll']) != 'undefined') { | 114 | if (typeof(someParameters['toll']) != 'undefined') { |
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 | ||
125 | 'registration': function (someParameters) { | 124 | 'registration': function (someParameters) { |
126 | return this.processMessage('registration', someParameters, 'REGISTER'); | 125 | return this.processMessage('registration', someParameters, 'REGISTER'); |
127 | }, | 126 | }, |
128 | 127 | ||
129 | 'handshake': function (someParameters) { | 128 | 'handshake': function (someParameters) { |
130 | return this.processMessage('handshake', someParameters, 'CONNECT'); | 129 | return this.processMessage('handshake', someParameters, 'CONNECT'); |
131 | }, | 130 | }, |
132 | 131 | ||
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 | |||
3 | Copyright 2008-2011 Clipperz Srl | ||
4 | |||
5 | This file is part of Clipperz Community Edition. | ||
6 | Clipperz Community Edition is an online password manager. | ||
7 | For further information about its features and functionalities please | ||
8 | refer 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 | |||
26 | if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } | ||
27 | if (typeof(Clipperz.PM) == 'undefined') { Clipperz.PM = {}; } | ||
28 | |||
29 | //============================================================================= | ||
30 | |||
31 | Clipperz.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 | |||
43 | YAHOO.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"); | ||