1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

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 commit is contained in:
Deryck Hodge 2005-08-24 11:53:01 +00:00 committed by Gerald (Jerry) Carter
parent ba909a64e9
commit f95bf0adf7
3 changed files with 209 additions and 124 deletions

View File

@ -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 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 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);
});
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);
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 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 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 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 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();
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);
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(); %>

View File

@ -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); });
}

View File

@ -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();
%>