diff options
Diffstat (limited to 'swat')
-rw-r--r-- | swat/desktop/index.esp | 168 | ||||
-rw-r--r-- | swat/scripting/footer_desktop.esp | 6 | ||||
-rw-r--r-- | swat/scripting/header_desktop.esp | 34 |
3 files changed, 208 insertions, 0 deletions
diff --git a/swat/desktop/index.esp b/swat/desktop/index.esp new file mode 100644 index 0000000000..8fe45ed4a0 --- /dev/null +++ b/swat/desktop/index.esp @@ -0,0 +1,168 @@ +<% +/*** Reg stuff ***/ +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(); +/** endReg stuff *****/ + + page_header("desktop", "Virtual Desktop Design Test", "desktop"); +%> + +<script type="text/javascript" src="/scripting/client/encoder.js"></script> +<script type="text/javascript" src="/scripting/client/call.js"></script> + +<script type="text/javascript"> + +function folder_list(fParent, list) { + var i; + fParent.populated = true; + fParent.removeAll(); + for (i=0;i<list.length;i++) { + var fChild; + fChild = new QxTreeFolder(list[i]); + fParent.add(fChild); + fChild.binding = fParent.binding; + if (fParent.reg_path == '\\\\') { + fChild.reg_path = list[i]; + } else { + fChild.reg_path = fParent.reg_path + '\\\\' + list[i]; + } + fChild.add(new QxTreeFolder('Working ...')); + fChild.addEventListener("click", function() { + var el = this; folder_click(el); + }); + fParent.setOpen(1); + } +} + +function folder_click(node) { + if (!node.populated) { + server_call_url("@@request.REQUEST_URI", 'enum_path', + function(list) { folder_list(node, list); }, + node.binding, node.reg_path); + } +} + +/* return a registry tree for the given server */ +function registry_tree(binding) { + var tree = new QxTree("registry: " + binding); + tree.binding = binding; + tree.reg_path = "\\\\"; + tree.populated = false; + with(tree) + { + setBackgroundColor(255); + setBorder(QxBorder.presets.inset); + setOverflow("scroll"); + setStyleProperty("padding", "2px"); + setWidth(400); + setHeight(400); + setTop(20); + } + tree.addEventListener("click", function() { + var el = this; folder_click(el); + }); + return tree; +} + +/*** init the page for qooxdoo ***/ +window.application.main = function() +{ + // Don't declare local with var + doc = this.getClientWindow().getClientDocument(); +} + +function showReg() +{ + var inlineWidget = new QxInline; + var fieldSet = new QxFieldSet("Registry"); + var binding = "ncalrpc:"; + + with(fieldSet) + { + setWidth("40%"); + setMinHeight(500); + setBottom(48); + setMinWidth(500); + setBackgroundColor("#FFF"); + }; + + var gl = new QxGridLayout("auto,auto,auto,auto,auto", "100%"); + gl.setEdge(0); + gl.setCellPaddingTop(3); + gl.setCellPaddingBottom(3); + + inlineWidget.add(fieldSet); + + var t = registry_tree(binding); + + function change_binding(e) { + binding = e.getNewValue(); + srv_printf("changed binding to %s\\n", binding); + gl.remove(t); + t = registry_tree(binding); + gl.add(t, { row : 2, col : 1 }); + } + + var b = new QxTextField(binding); + b.addEventListener("changeText", change_binding); + + gl.add(b, { row : 1, col : 1 }); + gl.add(t, { row : 2, col : 1 }); + + fieldSet.add(gl); + inlineWidget.add(fieldSet); + doc.add(inlineWidget, "canvas"); + + w1.setVisible(false); +} + +function startSwat() +{ + // Don't declare local with var (for now) + w1 = new QxWindow("Welcome to SWAT."); + w1.setSpace(100, 100, 100, 100); + doc.add(w1); + + var btn1 = new QxButton("View Registry"); + btn1.set({ top: 20, left : 30 }); + btn1.addEventListener("click", showReg) + w1.add(btn1); + + w1.setVisible(true); +} +</script> + +<div id="canvas" style="overflow:hidden;position:static;margin-top:38px;margin-left:10px;margin-right:700px;width:700px"></div> + +<div id="toolbar"> + <h3><a href="javascript:startSwat()">SWAT (Start)</a></h3> +</div> + +<% page_footer(); %> diff --git a/swat/scripting/footer_desktop.esp b/swat/scripting/footer_desktop.esp new file mode 100644 index 0000000000..5e563dab88 --- /dev/null +++ b/swat/scripting/footer_desktop.esp @@ -0,0 +1,6 @@ +<% + /* footer for desktop page type */ +%> + +</body> +</html> diff --git a/swat/scripting/header_desktop.esp b/swat/scripting/header_desktop.esp new file mode 100644 index 0000000000..a21ee733bb --- /dev/null +++ b/swat/scripting/header_desktop.esp @@ -0,0 +1,34 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> + +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<meta http-equiv="Content-Language" content="en-us" /> + + <title>@@global.page.title</title> + +<link rel="stylesheet" href="/style/qooxdoo/layouts/application.css" type="text/css" media="all" /> +<link rel="shortcut icon" href="/images/favicon.ico" /> + +<script type="text/javascript" src="/style/qooxdoo/widgets/qooxdoo.js"></script> + +<style type="text/css" media="screen"> +body { + background-color:#3A6EA5; +} +#toolbar { + background-color:ThreeDFace; + position:fixed; + bottom:0; + height:25px; + width:100%; + line-height:25px; + border-top:1px outset #000; +} +</style> + +</head> + +<body> + |