[KSS-checkins] r39897 - kukit/kukit.js/trunk/kukit

reebalazs at codespeak.net reebalazs at codespeak.net
Sun Mar 4 16:23:08 CET 2007


Author: reebalazs
Date: Sun Mar  4 16:23:06 2007
New Revision: 39897

Modified:
   kukit/kukit.js/trunk/kukit/oper.js
   kukit/kukit.js/trunk/kukit/serveraction.js
Log:
Implemented the kssUrl parameter for action-server.

Also change the call signature of kukit.sa.serverAction.

Modified: kukit/kukit.js/trunk/kukit/oper.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/oper.js	(original)
+++ kukit/kukit.js/trunk/kukit/oper.js	Sun Mar  4 16:23:06 2007
@@ -164,10 +164,18 @@
 
 kukit.op.Oper.prototype.executeServerAction = function(name) {
     for (key in this.aparms) {
-        throw 'No kss parameter "' + key + '" allowed in action-server. (Normal parameters cannot start with kss.)';
+        switch (key) {
+            case 'kssUrl': {
+                // Value will be evaluated.
+            } break;
+            default: {
+                throw 'No kss parameter "' + key + '" allowed in action-server. (Normal parameters cannot start with kss.)';
+            } break;
+        }
     }
+
     // oper will be accessible to some commands that execute in return
-    var sa = new kukit.sa.ServerAction(name, this.parms, this);
+    var sa = new kukit.sa.ServerAction(name, this);
 };
 
 /* Helpers the serve binding */

Modified: kukit/kukit.js/trunk/kukit/serveraction.js
==============================================================================
--- kukit/kukit.js/trunk/kukit/serveraction.js	(original)
+++ kukit/kukit.js/trunk/kukit/serveraction.js	Sun Mar  4 16:23:06 2007
@@ -22,15 +22,29 @@
 
 kukit.sa = {};
 
-kukit.sa.ServerAction = function(name, params, oper) {
-    this.url = this.calculateAbsoluteURL(name);
-    this.params = params;
+kukit.sa.ServerAction = function(name, oper) {
+    this.url = oper.aparms.kssUrl;
+    if (typeof(this.url) == 'undefined') {
+        this.url = name;
+    }
+    this.url = this.calculateAbsoluteURL(this.url);
     this.oper = oper;
     this.notifyServer();
 };
 
 kukit.sa.ServerAction.prototype.calculateAbsoluteURL = function(url) {
-    if (url.search("http://") == 0) {
+    //
+    // If the url is an absolute path, it is used
+    //
+    // If the url is not an absolute path, it is put at the end of the context
+    // url.
+    //
+    // example: url='@theview/getName',
+    //          context='http://your.site.com/portal/folder/object'
+    //
+    //     result='http://your.site.com/portal/folder/object/@@theview/getName'
+    //
+    if (url.match(RegExp('/^https?:\/\//'))) {
         return url;
     } else {
         var result = kukit.engine.baseUrl + '/' + url;
@@ -63,8 +77,8 @@
     };
     // convert params
     var query = new kukit.fo.FormQuery();
-    for (var key in this.params) {
-        query.appendElem(key, this.params[key]);
+    for (var key in this.oper.parms) {
+        query.appendElem(key, this.oper.parms[key]);
     }
     var encoded = query.encode();
     // sending form


More information about the Kukit-checkins mailing list