2 /******************************/
3 /* server side AJAJ functions */
4 libinclude("server_call.js");
6 /* this is a call that the client js code can make - it just adds
7 some more elements to the passed object, then returns the object */
10 x.nttime = sys.nttime();
11 x.timestring = sys.httptime(x.nttime);
15 /* register a call for clients to make */
16 var call = servCallObj();
17 call.add('testfunc', testfunc);
19 /* run the function that was asked for */
22 /***********************/
23 /* now the main page */
24 page_header("columns", "ESP qooxdoo test", "esptest");
27 <script type="text/javascript" src="/scripting/client/encoder.js"></script>
28 <script type="text/javascript" src="/scripting/client/call.js"></script>
30 <h1>Samba4 qooxdoo test</h1>
32 <script type="text/javascript">
34 window.application.main = function()
36 var inlineWidget = new QxInline;
37 var fieldSet = new QxFieldSet("thefieldset");
47 var gl = new QxGridLayout("auto,auto,auto,auto,auto", "100%");
49 gl.setCellPaddingTop(3);
50 gl.setCellPaddingBottom(3);
52 inlineWidget.add(fieldSet);
54 var d = this.getClientWindow().getDocument();
57 var shared = new Object();
59 function callback(o) {
61 var r = "Response:\\n";
62 for (var i in shared) {
63 r = r + "\\t" + i + " : " + shared[i] + "\\n";
66 if (shared.start_time == 0) {
67 shared.start_time = shared.nttime;
69 shared.time_diff = shared.nttime - shared.start_time;
70 shared.rate = shared.counter / (shared.time_diff * 0.0000001);
73 server_call_url("@@request.REQUEST_URI", 'testfunc', callback, shared);
77 function start_call() {
78 srv_printf("Starting calls ... (stopit=%d)\\n", stopit);
81 shared.start_time = 0;
82 server_call_url("@@request.REQUEST_URI", 'testfunc', callback, shared);
85 function stop_call() {
86 srv_printf("Stopping calls\\n");
90 function myButton(name, label, call) {
91 var b = new QxButton(label);
93 b.addEventListener("click", call);
97 function myCheckBox(label, name, value) {
98 var w = new QxCheckBox(label, value, name, value);
103 var c1 = myCheckBox("Enable The Server", 'checkbox1', false);
104 var c2 = myCheckBox("Another Server", 'checkbox2', true);
105 var t3 = new QxTextField("hello");
106 var b1 = myButton("send", "Make Call", start_call);
107 var b2 = myButton("stop", "Stop Call", stop_call);
108 var ta = new QxTextArea;
109 ta.setText("initial text");
112 ta.setVerticalAlign("top");
114 gl.add(c1, { row : 1, col : 1 });
115 gl.add(c2, { row : 2, col : 1 });
116 gl.add(t3, { row : 3, col : 1, scaleHorizontal: true });
117 gl.add(b1, { row : 4, col : 1 });
118 gl.add(ta, { row : 5, col : 1 });
119 gl.add(b2, { row : 6, col : 1 });
123 inlineWidget.add(fieldSet);
125 d.add(inlineWidget, "canvas");
131 <div id="canvas" style="overflow:hidden;position:static;margin-top:38px;margin-left:10px;margin-right:700px;width:700px"></div>