r12892: Add a 'Migrate from Windows' page to our installation section in SWAT.
[kai/samba.git] / swat / esptest / qooxdoo.esp
index f98fe01bd4990161b1b994d25152bc10fb5a03e9..554a4e90d5d9510403840df23861f869eeacbf87 100644 (file)
@@ -1,9 +1,27 @@
-<% 
+<%
+/******************************/
+/* server side AJAJ functions */
+libinclude("server_call.js");
+
+/* this is a call that the client js code can make - it just adds
+   some more elements to the passed object, then returns the object */
+function testfunc(x) {
+       var sys = sys_init();
+       x.nttime = sys.nttime();
+       x.timestring = sys.httptime(x.nttime);
+       return x;
+}
+
+/* register a call for clients to make */
+var call = servCallObj();
+call.add('testfunc', testfunc);
+
+/* run the function that was asked for */
+call.run();
+
+  /***********************/
+  /* now the main page */
   page_header("columns", "ESP qooxdoo test", "esptest"); 
-
-  libinclude("encoder.js");
-
-  var thispage = request.REQUEST_URI;
 %>
 
 <script type="text/javascript" src="/scripting/client/encoder.js"></script>
 
     var d = this.getClientWindow().getDocument();
 
-    function myCheckBox(label, name, value) {
-           var w = new QxCheckBox(label, value, name, value);
-           w.setWidth("100%");
-           return w;
-    }
-
-    function myTextField(name, value) {
-           var w = new QxTextField(value);
-           return w;
-    }
-
     var stopit = 0;
     var shared = new Object();
 
            shared.rate = shared.counter / (shared.time_diff * 0.0000001);
            shared.counter++;
            if (stopit == 0) {
-                   server_call('remote.esp', 'testfunc', callback, shared);
+                   server_call_url("@@request.REQUEST_URI", 'testfunc', callback, shared);
            }
     }
 
     function start_call() { 
-           server_call('remote.esp', 'printf', null, 
-                       "Starting calls ... (stopit=%d)\\n", stopit);
+           srv_printf("Starting calls ... (stopit=%d)\\n", stopit);
            stopit = 0;
            shared.counter = 0;
            shared.start_time = 0;
-           server_call('remote.esp', 'testfunc', callback, shared);
+           server_call_url("@@request.REQUEST_URI", 'testfunc', callback, shared);
     };
 
     function stop_call() { 
-           server_call('remote.esp', 'printf', null, "Stopping calls\\n");
+           srv_printf("Stopping calls\\n");
            stopit = 1;
     };
 
     function myButton(name, label, call) {
         var b = new QxButton(label);
        b.setWidth("25%");
-       b.setVerticalAlign("top");
-       b.name = name;
        b.addEventListener("click", call);
        return b;
     };
 
+    function myCheckBox(label, name, value) {
+           var w = new QxCheckBox(label, value, name, value);
+           w.setWidth("100%");
+           return w;
+    }
+
     var c1 = myCheckBox("Enable The Server", 'checkbox1', false);
     var c2 = myCheckBox("Another Server", 'checkbox2', true);
-    var t3 = myTextField("mytext", "hello");
+    var t3 = new QxTextField("hello");
     var b1 = myButton("send", "Make Call", start_call);
     var b2 = myButton("stop", "Stop Call", stop_call);
     var ta = new QxTextArea;