1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00
samba-mirror/swat/desktop/index.esp
Deryck Hodge f95bf0adf7 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
2007-10-10 13:34:31 -05:00

201 lines
4.4 KiB
Plaintext

<%
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/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. */
var browser = QxClient().engine;
function docWidth()
{
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;
}
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);
}
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 menu = new QxMenu;
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.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);
// 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());
}
function showReg()
{
var regedit = regedit_widget("ncalrpc:");
w.add(regedit);
regedit.startup();
}
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);
}
</script>
<div id="toolbar">
<h3><a href="javascript:startSwat()">SWAT (Start)</a></h3>
</div>
<% page_footer(); %>