summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeryck Hodge <deryck@samba.org>2005-08-24 11:53:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:34:31 -0500
commit9dfffdf4c0e228d988f55cf4e80f838aa7320ecb (patch)
tree9d1fad44a9c8225cb92e72c058ef5ea0c931467b
parent782fd6946f3ed9d0c68bb6391e504910ec7ca1d8 (diff)
downloadsamba-9dfffdf4c0e228d988f55cf4e80f838aa7320ecb.tar.gz
samba-9dfffdf4c0e228d988f55cf4e80f838aa7320ecb.tar.bz2
samba-9dfffdf4c0e228d988f55cf4e80f838aa7320ecb.zip
r9579: Desktop SWAT opens now with a little server status window.
This includes a table layout that can be reused (see QxListView in status.js). Some formatting fixes, too. deryck (This used to be commit f95bf0adf760b8799ec02ec68ce42516ca40b6d2)
-rw-r--r--swat/desktop/index.esp275
-rw-r--r--swat/scripting/client/status.js49
-rw-r--r--swat/scripting/server/status.esp27
3 files changed, 218 insertions, 133 deletions
diff --git a/swat/desktop/index.esp b/swat/desktop/index.esp
index e945215c27..424f848e44 100644
--- a/swat/desktop/index.esp
+++ b/swat/desktop/index.esp
@@ -1,118 +1,127 @@
<%
-/*** Reg stuff ***/
libinclude("base.js");
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" src="/scripting/client/regedit.js"></script>
+<script type="text/javascript" src="/scripting/client/status.js"></script>
<script type="text/javascript">
/* Qooxdoo's browser sniffer doesn't distinguish IE version.
- We'll cover IE 6 for now, but these checks need to be
- revisited for fuller browser coverage. */
+We'll cover IE 6 for now, but these checks need to be
+revisited for fuller browser coverage. */
var browser = QxClient().engine;
function docWidth()
{
- var x;
- if (browser != "mshtml") {
- x = window.innerWidth;
- } else {
- x = document.documentElement.clientWidth;
- }
- return x;
+ var x;
+ if (browser != "mshtml") {
+ x = window.innerWidth;
+ } else {
+ x = document.documentElement.clientWidth;
+ }
+ return x;
}
function docHeight()
{
- var y;
- // Less 25px to not cover the toolbar
- if (browser != "mshtml") {
- y = window.innerHeight - 25;
- } else {
- y = document.documentElement.clientHeight;
- }
- return y;
+ var y;
+ // Less 25px to not cover the toolbar
+ if (browser != "mshtml") {
+ y = window.innerHeight - 25;
+ } else {
+ y = document.documentElement.clientHeight;
+ }
+ return y;
}
function showMessage(m)
{
- var message = new QxWindow();
- with(message) {
- setWidth(300);
- setTop("35%");
- setLeft("35%");
- setShowMaximize(false);
- setShowMinimize(false);
- }
-
- var note = new QxAtom(m);
- with(note) {
- setTop(10);
- setLeft(10);
- }
-
- var ok = new QxButton("OK");
- with(ok) {
- setLeft("42%");
- setBottom(2);
- }
- ok.addEventListener("click", function() {
- w.remove(message);
- });
-
- message.add(note);
- message.add(ok);
- w.add(message);
- message.setVisible(true);
+ var message = new QxWindow();
+ with(message) {
+ setWidth(300);
+ setTop("35%");
+ setLeft("35%");
+ setShowMaximize(false);
+ setShowMinimize(false);
+ }
+
+ var note = new QxAtom(m);
+ with(note) {
+ setTop(10);
+ setLeft(10);
+ }
+
+ var ok = new QxButton("OK");
+ with(ok) {
+ setLeft("42%");
+ setBottom(2);
+ }
+ ok.addEventListener("click", function() {
+ w.remove(message);
+ });
+
+ message.add(note);
+ message.add(ok);
+ w.add(message);
+ message.setVisible(true);
}
function showContextMenu(e)
{
+ var aboutCmd = new QxCommand();
+ aboutCmd.addEventListener("execute", function() {
+ showMessage("SWAT, the Samba Web Administration Tool.<br/>This tool is currently under development.");
+ });
- var aboutCmd = new QxCommand();
- aboutCmd.addEventListener("execute", function() {
- showMessage("SWAT, the Samba Web Administration Tool.<br/>This tool is currently under development.");
- });
+ var menu = new QxMenu;
- var menu = new QxMenu;
+ var sub1 = new QxMenuButton("About SWAT", null, aboutCmd);
+ var sep = new QxMenuSeparator();
+ var sub2 = new QxMenuButton("More menu later...", null);
- var sub1 = new QxMenuButton("About SWAT", null, aboutCmd);
- var sep = new QxMenuSeparator();
- var sub2 = new QxMenuButton("More menu later...", null);
+ menu.add(sub1, sep, sub2);
- menu.add(sub1, sep, sub2);
-
- menu.setLeft(e.getClientX());
- menu.setTop(e.getClientY());
- w.add(menu);
- menu.setVisible(true);
+ menu.setLeft(e.getClientX());
+ menu.setTop(e.getClientY());
+ w.add(menu);
+ menu.setVisible(true);
}
/*** init the page for qooxdoo ***/
window.application.main = function()
{
- var doc = this.getClientWindow().getClientDocument();
- // Don't declare local with var
- w = new QxWidget();
- with(w) {
- setTop(0);
- setLeft(0);
- setWidth(docWidth());
- setHeight(docHeight());
- }
- doc.addEventListener("contextmenu", showContextMenu);
- doc.add(w);
-
+ var doc = this.getClientWindow().getClientDocument();
+ // Don't declare local with var
+ w = new QxWidget();
+ with(w) {
+ setTop(0);
+ setLeft(0);
+ setWidth(docWidth());
+ setHeight(docHeight());
+ }
+ doc.addEventListener("contextmenu", showContextMenu);
+ doc.add(w);
+
+
+ // Always open with stats
+ var win = new QxWindow();
+ with(win) {
+ setTop(50);
+ setRight(50);
+ setHeight(175);
+ }
+ w.add(win);
+ getServerStatus(win);
+
}
window.onresize = function()
{
- w.setWidth(docWidth());
- w.setHeight(docHeight());
+ w.setWidth(docWidth());
+ w.setHeight(docHeight());
}
function showReg()
@@ -124,68 +133,68 @@ function showReg()
function startSwat()
{
- var sMenu = new QxMenu;
- with(sMenu) {
- setWidth(150);
- setHeight(150);
- }
-
- var srvMenu = new QxMenu;
- var srv1 = new QxMenuButton("LDAP Server", null);
- var srv2 = new QxMenuButton("CDAP Server", null);
- var srv3 = new QxMenuButton("RPC Server", null);
- var srv4 = new QxMenuButton("NBT Server", null);
- var srv5 = new QxMenuButton("WINS Server", null);
- var srv6 = new QxMenuButton("Kerberos Server", null);
- srvMenu.add(srv1, srv2, srv3, srv4, srv5, srv6);
- w.add(srvMenu);
- srvMenu.setVisible(false);
-
- var editReg = new QxCommand;
- editReg.addEventListener("execute", function() {
- showReg();
- });
-
- var espMenu = new QxMenu;
- var esp1 = new QxMenuButton("Registry Editor", null, editReg);
- espMenu.add(esp1);
- w.add(espMenu);
- espMenu.setVisible(false);
-
- var opt1 = new QxMenuButton("Servers", null)
- opt1.addEventListener("mouseover", function() {
- srvMenu.setVisible(true);
- srvMenu.setLeft(this.getComputedPageBoxRight() + 4);
- srvMenu.setTop(this.getComputedPageBoxTop() - 3);
- if (espMenu.getVisible()) {
- espMenu.setVisible(false);
- }
- });
- var opt2 = new QxMenuButton("Installation", null);
- var opt3 = new QxMenuButton("Configuration", null);
- var opt4 = new QxMenuButton("ESP Tests", null);
- opt4.addEventListener("mouseover", function() {
- espMenu.setVisible(true);
- espMenu.setLeft(this.getComputedPageBoxRight() + 4);
- espMenu.setTop(this.getComputedPageBoxTop() - 3);
- if (srvMenu.getVisible()) {
- srvMenu.setVisible(false);
- }
- });
- var opt5 = new QxMenuButton("Documentation", null);
- var sep1 = new QxMenuSeparator();
- var sep2 = new QxMenuSeparator();
-
- sMenu.add(opt1, opt2, opt3, sep1, opt4, sep2, opt5);
- sMenu.setLeft(0);
- sMenu.setTop(docHeight() - 150);
- w.add(sMenu);
- sMenu.setVisible(true);
+ var sMenu = new QxMenu;
+ with(sMenu) {
+ setWidth(150);
+ setHeight(150);
+ }
+
+ var srvMenu = new QxMenu;
+ var srv1 = new QxMenuButton("LDAP Server", null);
+ var srv2 = new QxMenuButton("CDAP Server", null);
+ var srv3 = new QxMenuButton("RPC Server", null);
+ var srv4 = new QxMenuButton("NBT Server", null);
+ var srv5 = new QxMenuButton("WINS Server", null);
+ var srv6 = new QxMenuButton("Kerberos Server", null);
+ srvMenu.add(srv1, srv2, srv3, srv4, srv5, srv6);
+ w.add(srvMenu);
+ srvMenu.setVisible(false);
+
+ var editReg = new QxCommand;
+ editReg.addEventListener("execute", function() {
+ showReg();
+ });
+
+ var espMenu = new QxMenu;
+ var esp1 = new QxMenuButton("Registry Editor", null, editReg);
+ espMenu.add(esp1);
+ w.add(espMenu);
+ espMenu.setVisible(false);
+
+ var opt1 = new QxMenuButton("Servers", null)
+ opt1.addEventListener("mouseover", function() {
+ srvMenu.setVisible(true);
+ srvMenu.setLeft(this.getComputedPageBoxRight() + 4);
+ srvMenu.setTop(this.getComputedPageBoxTop() - 3);
+ if (espMenu.getVisible()) {
+ espMenu.setVisible(false);
+ }
+ });
+ var opt2 = new QxMenuButton("Installation", null);
+ var opt3 = new QxMenuButton("Configuration", null);
+ var opt4 = new QxMenuButton("ESP Tests", null);
+ opt4.addEventListener("mouseover", function() {
+ espMenu.setVisible(true);
+ espMenu.setLeft(this.getComputedPageBoxRight() + 4);
+ espMenu.setTop(this.getComputedPageBoxTop() - 3);
+ if (srvMenu.getVisible()) {
+ srvMenu.setVisible(false);
+ }
+ });
+ var opt5 = new QxMenuButton("Documentation", null);
+ var sep1 = new QxMenuSeparator();
+ var sep2 = new QxMenuSeparator();
+
+ sMenu.add(opt1, opt2, opt3, sep1, opt4, sep2, opt5);
+ sMenu.setLeft(0);
+ sMenu.setTop(docHeight() - 150);
+ w.add(sMenu);
+ sMenu.setVisible(true);
}
</script>
<div id="toolbar">
- <h3><a href="javascript:startSwat()">SWAT (Start)</a></h3>
+<h3><a href="javascript:startSwat()">SWAT (Start)</a></h3>
</div>
<% page_footer(); %>
diff --git a/swat/scripting/client/status.js b/swat/scripting/client/status.js
new file mode 100644
index 0000000000..fa2c3b57e7
--- /dev/null
+++ b/swat/scripting/client/status.js
@@ -0,0 +1,49 @@
+/*
+ server status library for SWAT
+
+ released under the GNU GPL Version 2 or later
+*/
+
+
+/* Ensure we always include the proper libs
+ Playing with a way to add/del scripts on the fly...
+*/
+var lib = document.createElement('script');
+lib.setAttribute('type', 'text/javascript');
+lib.setAttribute('src', '/scripting/client/call.js');
+var head = document.getElementsByTagName('head')[0];
+head.appendChild(lib);
+
+// Format for a server status table
+var s = [
+ { id : "server",
+ label : "Server",
+ content: "text",
+ defaultValue : "-",
+ width : 100,
+ },
+
+ { id : "status",
+ label : "Status",
+ content: "text",
+ defaultValue : "-",
+ width: 100,
+ }
+];
+
+function __load_status_table(info, container)
+{
+ var table = new QxListView(s);
+ var i;
+ for (i in info) {
+ table.addData( {server : i, status : info[i]} );
+ }
+ container.add(table);
+ container.setVisible(true);
+}
+
+function getServerStatus(container)
+{
+ server_call_url("/scripting/server/status.esp", 'serverInfo',
+ function(info) { __load_status_table(info, container); });
+}
diff --git a/swat/scripting/server/status.esp b/swat/scripting/server/status.esp
new file mode 100644
index 0000000000..8ca2067d49
--- /dev/null
+++ b/swat/scripting/server/status.esp
@@ -0,0 +1,27 @@
+<%
+
+libinclude("management.js");
+libinclude("server_call.js");
+
+function serverInfo()
+{
+ var info = new Object();
+ info["NBT Server"] = server_status("nbt");
+ info["WINS Server"] = server_status("wins");
+ info["CLDAP Server"] = server_status("cldap");
+ info["Kerberos Server"] = server_status("kdc");
+ info["SMB Server"] = stream_server_status("smb");
+ info["LDAP Server"] = stream_server_status("ldap");
+ info["RPC Server"] = stream_server_status("rpc");
+
+ return info;
+}
+
+/* register a call for clients to make */
+var call = servCallObj();
+call.add('serverInfo', serverInfo);
+
+/* run the function that was asked for */
+call.run();
+
+%>