mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
r9227: cleanup and simplify the AJAJ code
(This used to be commit ceb7669e59
)
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
922f28fcbd
commit
8942ac69f0
@ -21,20 +21,20 @@ function __register_call(name, func)
|
|||||||
*/
|
*/
|
||||||
function __run_call() {
|
function __run_call() {
|
||||||
var c = this;
|
var c = this;
|
||||||
var name = form['func'];
|
var name = form['ajaj_func'];
|
||||||
if (name == undefined) {
|
if (name == undefined) {
|
||||||
println("no function name given in run_call");
|
/* no function to run */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var args = form['args'];
|
var args = form['ajaj_args'];
|
||||||
if (args == undefined) {
|
if (args == undefined) {
|
||||||
println("no function arguments given in run_call");
|
println("no function arguments given in run_call");
|
||||||
return;
|
exit(0);
|
||||||
}
|
}
|
||||||
args = decodeObject(args);
|
args = decodeObject(args);
|
||||||
if (c.calls[name] == undefined) {
|
if (c.calls[name] == undefined) {
|
||||||
println("undefined remote call " + name);
|
println("undefined remote call " + name);
|
||||||
return;
|
exit(0);
|
||||||
}
|
}
|
||||||
var f = c.calls[name];
|
var f = c.calls[name];
|
||||||
var res;
|
var res;
|
||||||
@ -59,11 +59,12 @@ function __run_call() {
|
|||||||
res = f(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
res = f(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
|
||||||
} else {
|
} else {
|
||||||
println("too many arguments for remote call: " + name);
|
println("too many arguments for remote call: " + name);
|
||||||
return;
|
exit(0);
|
||||||
}
|
}
|
||||||
var repobj = new Object();
|
var repobj = new Object();
|
||||||
repobj.res = res;
|
repobj.res = res;
|
||||||
write(encodeObject(repobj));
|
write(encodeObject(repobj));
|
||||||
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,26 @@
|
|||||||
<%
|
<%
|
||||||
|
/******************************/
|
||||||
|
/* 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");
|
page_header("columns", "ESP qooxdoo test", "esptest");
|
||||||
%>
|
%>
|
||||||
|
|
||||||
@ -48,7 +70,7 @@
|
|||||||
shared.rate = shared.counter / (shared.time_diff * 0.0000001);
|
shared.rate = shared.counter / (shared.time_diff * 0.0000001);
|
||||||
shared.counter++;
|
shared.counter++;
|
||||||
if (stopit == 0) {
|
if (stopit == 0) {
|
||||||
server_call('remote.esp', 'testfunc', callback, shared);
|
server_call_url("@@request.REQUEST_URI", 'testfunc', callback, shared);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +79,7 @@
|
|||||||
stopit = 0;
|
stopit = 0;
|
||||||
shared.counter = 0;
|
shared.counter = 0;
|
||||||
shared.start_time = 0;
|
shared.start_time = 0;
|
||||||
server_call('remote.esp', 'testfunc', callback, shared);
|
server_call_url("@@request.REQUEST_URI", 'testfunc', callback, shared);
|
||||||
};
|
};
|
||||||
|
|
||||||
function stop_call() {
|
function stop_call() {
|
||||||
|
@ -1,4 +1,38 @@
|
|||||||
<%
|
<%
|
||||||
|
/******************************/
|
||||||
|
/* server side AJAJ functions */
|
||||||
|
libinclude("base.js");
|
||||||
|
libinclude("winreg.js");
|
||||||
|
libinclude("server_call.js");
|
||||||
|
|
||||||
|
/*
|
||||||
|
server side call to return a listing of elements in a winreg path
|
||||||
|
*/
|
||||||
|
function enum_path(binding, path) {
|
||||||
|
printf("enum_path(%s, %s)\n", binding, path);
|
||||||
|
var reg = winreg_init();
|
||||||
|
security_init(reg);
|
||||||
|
|
||||||
|
reg.credentials = session.authinfo.credentials;
|
||||||
|
|
||||||
|
var status = reg.connect(binding);
|
||||||
|
if (status.is_ok != true) {
|
||||||
|
printVars(status);
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
var list = winreg_enum_path(reg, path);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* register a call for clients to make */
|
||||||
|
var call = servCallObj();
|
||||||
|
call.add('enum_path', enum_path);
|
||||||
|
|
||||||
|
/* run the function that was asked for */
|
||||||
|
call.run();
|
||||||
|
|
||||||
|
/***********************/
|
||||||
|
/* now the main page */
|
||||||
page_header("columns", "ESP registry edit", "esptest");
|
page_header("columns", "ESP registry edit", "esptest");
|
||||||
%>
|
%>
|
||||||
|
|
||||||
@ -33,7 +67,7 @@ function folder_list(t, list) {
|
|||||||
|
|
||||||
function folder_click(t) {
|
function folder_click(t) {
|
||||||
if (!t.populated) {
|
if (!t.populated) {
|
||||||
server_call("registry_calls.esp", 'enum_path',
|
server_call_url("@@request.REQUEST_URI", 'enum_path',
|
||||||
function(list) { folder_list(t, list); },
|
function(list) { folder_list(t, list); },
|
||||||
t.binding, t.reg_path);
|
t.binding, t.reg_path);
|
||||||
}
|
}
|
||||||
@ -54,8 +88,10 @@ function registry_tree(binding) {
|
|||||||
setWidth(400);
|
setWidth(400);
|
||||||
setHeight(400);
|
setHeight(400);
|
||||||
setTop(20);
|
setTop(20);
|
||||||
addEventListener("click", function() { folder_click(t); });
|
|
||||||
}
|
}
|
||||||
|
t.addEventListener("click", function() {
|
||||||
|
var el = this; folder_click(el);
|
||||||
|
});
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
<%
|
|
||||||
libinclude("base.js");
|
|
||||||
libinclude("winreg.js");
|
|
||||||
libinclude("server_call.js");
|
|
||||||
|
|
||||||
/*
|
|
||||||
server side call to return a listing of elements in a winreg path
|
|
||||||
*/
|
|
||||||
function enum_path(binding, path) {
|
|
||||||
printf("enum_path(%s, %s)\n", binding, path);
|
|
||||||
if (path == "\\") {
|
|
||||||
printf("IN ROOT\n");
|
|
||||||
var list = new Array("HKLM", "HKCR", "HKPD");
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
printf("binding=%s path=%s\n", binding, path);
|
|
||||||
var reg = winreg_init();
|
|
||||||
security_init(reg);
|
|
||||||
|
|
||||||
reg.credentials = session.authinfo.credentials;
|
|
||||||
|
|
||||||
var status = reg.connect(binding);
|
|
||||||
if (status.is_ok != true) {
|
|
||||||
printVars(status);
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
var list = winreg_enum_path(reg, path);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* register a call for clients to make */
|
|
||||||
var call = servCallObj();
|
|
||||||
call.add('enum_path', enum_path);
|
|
||||||
|
|
||||||
/* run the function that was asked for */
|
|
||||||
call.run();
|
|
||||||
%>
|
|
@ -1,19 +0,0 @@
|
|||||||
<%
|
|
||||||
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();
|
|
||||||
%>
|
|
@ -12,7 +12,6 @@ var call = servCallObj();
|
|||||||
*/
|
*/
|
||||||
function srv_printf()
|
function srv_printf()
|
||||||
{
|
{
|
||||||
println("in srv_printf");
|
|
||||||
var s = string_init();
|
var s = string_init();
|
||||||
print(s.vsprintf(arguments));
|
print(s.vsprintf(arguments));
|
||||||
return undefined;
|
return undefined;
|
||||||
|
Reference in New Issue
Block a user