author | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-23 17:36:57 (UTC) |
---|---|---|
committer | Giulio Cesare Solaroli <giulio.cesare@clipperz.com> | 2011-10-23 17:36:57 (UTC) |
commit | 67455b069c4c9ec493f9cef76017e172a430a7d4 (patch) (unidiff) | |
tree | 0b287debfeeb0819b3df9dd02860cd84103e25b3 /frontend/gamma | |
parent | b312e037ebba7c94abea9661bcf62c52b7d73fbf (diff) | |
download | clipperz-67455b069c4c9ec493f9cef76017e172a430a7d4.zip clipperz-67455b069c4c9ec493f9cef76017e172a430a7d4.tar.gz clipperz-67455b069c4c9ec493f9cef76017e172a430a7d4.tar.bz2 |
Integration of PHP backend with /beta and /gamma front ends
Fixed PHP backend and /beta code to handle request and data format compatible with /gamma.
At the moment adding/deleting/editing records seem to work fine.
-rw-r--r-- | frontend/gamma/html/index_template.html | 5 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/Async.js | 19 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/Proxy.js | 2 |
3 files changed, 19 insertions, 7 deletions
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 | |||
@@ -26,32 +26,37 @@ Clipperz_normalizedNewLine = '\x0d\x0a'; | |||
26 | @js_DEBUG@ | 26 | @js_DEBUG@ |
27 | 27 | ||
28 | </head> | 28 | </head> |
29 | <body> | 29 | <body> |
30 | <div id="mainDiv"> | 30 | <div id="mainDiv"> |
31 | <div id="loading"> | 31 | <div id="loading"> |
32 | <a href="http://www.clipperz.com" target="_blank"><div id="logo"></div></a> | 32 | <a href="http://www.clipperz.com" target="_blank"><div id="logo"></div></a> |
33 | <h5 class="clipperzPayoff">keep it to yourself!</h5> | 33 | <h5 class="clipperzPayoff">keep it to yourself!</h5> |
34 | <h2>loading ...</h2> | 34 | <h2>loading ...</h2> |
35 | </div> | 35 | </div> |
36 | 36 | ||
37 | @js_INSTALL@ | 37 | @js_INSTALL@ |
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"> |
46 | <div class="header"></div> | 51 | <div class="header"></div> |
47 | <div class="body"> | 52 | <div class="body"> |
48 | <div class="alertLogo"></div> | 53 | <div class="alertLogo"></div> |
49 | <div class="alert"> | 54 | <div class="alert"> |
50 | <h1>Attention!</h1> | 55 | <h1>Attention!</h1> |
51 | <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> | 56 | <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> |
52 | <h3>Javascript is required to access Clipperz.</h3> | 57 | <h3>Javascript is required to access Clipperz.</h3> |
53 | <h5>Please enable scripting or upgrade your browser.</h5> | 58 | <h5>Please enable scripting or upgrade your browser.</h5> |
54 | </div> | 59 | </div> |
55 | </div> | 60 | </div> |
56 | <div class="footer"></div> | 61 | <div class="footer"></div> |
57 | </div> | 62 | </div> |
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 | |||
@@ -49,88 +49,94 @@ Clipperz.Async.Deferred = function(aName, args) { | |||
49 | //============================================================================= | 49 | //============================================================================= |
50 | 50 | ||
51 | Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, { | 51 | Clipperz.Base.extend(Clipperz.Async.Deferred, MochiKit.Async.Deferred, { |
52 | 52 | ||
53 | 'name': function () { | 53 | 'name': function () { |
54 | return this._name; | 54 | return this._name; |
55 | }, | 55 | }, |
56 | 56 | ||
57 | 'args': function () { | 57 | 'args': function () { |
58 | return this._args; | 58 | return this._args; |
59 | }, | 59 | }, |
60 | 60 | ||
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; |
70 | 71 | ||
71 | message = "ERROR [" + this._name + "]"; | 72 | message = "ERROR [" + this._name + "]"; |
72 | this.addErrback(function(aResult) { | 73 | this.addErrback(function(aResult) { |
73 | if (! (aResult instanceof MochiKit.Async.CancelledError)) { | 74 | if (! (aResult instanceof MochiKit.Async.CancelledError)) { |
74 | Clipperz.log(message, aResult); | 75 | Clipperz.log(message, aResult); |
75 | } | 76 | } |
76 | return aResult; | 77 | return aResult; |
77 | }); | 78 | }); |
78 | 79 | ||
79 | if (this._shouldTrace) { | 80 | if (this._shouldTrace) { |
80 | var resultMessage; | 81 | var resultMessage; |
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 | } |
90 | } | 92 | } |
91 | 93 | ||
92 | if (CLIPPERZ_DEFERRED_CALL_LOGGING_ENABLED === true) { | 94 | if (CLIPPERZ_DEFERRED_CALL_LOGGING_ENABLED === true) { |
93 | Clipperz.log("callback " + this._name, this); | 95 | Clipperz.log("callback " + this._name, this); |
94 | } | 96 | } |
95 | 97 | ||
96 | return Clipperz.Async.Deferred.superclass.callback.apply(this, arguments); | 98 | return Clipperz.Async.Deferred.superclass.callback.apply(this, arguments); |
97 | }, | 99 | }, |
98 | 100 | ||
99 | //----------------------------------------------------------------------------- | 101 | //----------------------------------------------------------------------------- |
100 | 102 | ||
101 | 'addCallback': function () { | 103 | 'addCallback': function () { |
102 | var message; | 104 | var message; |
103 | 105 | ||
104 | if (this._shouldTrace) { | 106 | if (this._shouldTrace) { |
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 | ||
125 | //============================================================================= | 131 | //============================================================================= |
126 | 132 | ||
127 | 'addCallbackPass': function() { | 133 | 'addCallbackPass': function() { |
128 | var passFunction; | 134 | var passFunction; |
129 | 135 | ||
130 | passFunction = MochiKit.Base.partial.apply(null, arguments); | 136 | passFunction = MochiKit.Base.partial.apply(null, arguments); |
131 | 137 | ||
132 | this.addCallback(function() { | 138 | this.addCallback(function() { |
133 | var result; | 139 | var result; |
134 | 140 | ||
135 | result = arguments[arguments.length -1]; | 141 | result = arguments[arguments.length -1]; |
136 | passFunction(); | 142 | passFunction(); |
@@ -393,32 +399,33 @@ MochiKit.Base.update(Clipperz.Async.DeferredSynchronizer.prototype, { | |||
393 | } | 399 | } |
394 | 400 | ||
395 | return this.result(); | 401 | return this.result(); |
396 | }, | 402 | }, |
397 | 403 | ||
398 | //----------------------------------------------------------------------------- | 404 | //----------------------------------------------------------------------------- |
399 | 405 | ||
400 | 'handleMethodCallDone': function(anIndexValue, aResult) { | 406 | 'handleMethodCallDone': function(anIndexValue, aResult) { |
401 | this.incrementNumberOfMethodsDone(); | 407 | this.incrementNumberOfMethodsDone(); |
402 | this.methodResults()[anIndexValue] = aResult; | 408 | this.methodResults()[anIndexValue] = aResult; |
403 | 409 | ||
404 | if (this.numberOfMethodsDone() < this.methods().length) { | 410 | if (this.numberOfMethodsDone() < this.methods().length) { |
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 | }, |
413 | 420 | ||
414 | //----------------------------------------------------------------------------- | 421 | //----------------------------------------------------------------------------- |
415 | 422 | ||
416 | __syntaxFix__: "syntax fix" | 423 | __syntaxFix__: "syntax fix" |
417 | }); | 424 | }); |
418 | 425 | ||
419 | //############################################################################# | 426 | //############################################################################# |
420 | 427 | ||
421 | MochiKit.Base.update(Clipperz.Async, { | 428 | MochiKit.Base.update(Clipperz.Async, { |
422 | 429 | ||
423 | 'callbacks': function (aName, someFunctions, someArguments, aCallbackValue) { | 430 | 'callbacks': function (aName, someFunctions, someArguments, aCallbackValue) { |
424 | var deferredResult; | 431 | var deferredResult; |
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 | |||
@@ -129,33 +129,33 @@ Clipperz.PM.Proxy.prototype = MochiKit.Base.update(null, { | |||
129 | return this.processMessage('handshake', someParameters, 'CONNECT'); | 129 | return this.processMessage('handshake', someParameters, 'CONNECT'); |
130 | }, | 130 | }, |
131 | 131 | ||
132 | 'message': function (someParameters) { | 132 | 'message': function (someParameters) { |
133 | return this.processMessage('message', someParameters, 'MESSAGE'); | 133 | return this.processMessage('message', someParameters, 'MESSAGE'); |
134 | }, | 134 | }, |
135 | 135 | ||
136 | 'logout': function (someParameters) { | 136 | 'logout': function (someParameters) { |
137 | return this.processMessage('logout', someParameters, 'MESSAGE'); | 137 | return this.processMessage('logout', someParameters, 'MESSAGE'); |
138 | }, | 138 | }, |
139 | 139 | ||
140 | //========================================================================= | 140 | //========================================================================= |
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); |
150 | 150 | ||
151 | return deferredResult; | 151 | return deferredResult; |
152 | }, | 152 | }, |
153 | 153 | ||
154 | //========================================================================= | 154 | //========================================================================= |
155 | 155 | ||
156 | 'sendMessage': function () { | 156 | 'sendMessage': function () { |
157 | throw Clipperz.Base.exception.AbstractMethod; | 157 | throw Clipperz.Base.exception.AbstractMethod; |
158 | }, | 158 | }, |
159 | 159 | ||
160 | //========================================================================= | 160 | //========================================================================= |
161 | 161 | ||