summaryrefslogtreecommitdiff
path: root/webapps/swat
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2007-03-28 23:01:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:49:41 -0500
commitcd5745d37855175d9cb4750d67e21f12e1c302d5 (patch)
treeb7ddfa90f37f0aabadf5d8f23f2e4642dbe342f5 /webapps/swat
parentcbd42dc5a1a296d0f4038448933d68bc4b94ff22 (diff)
downloadsamba-cd5745d37855175d9cb4750d67e21f12e1c302d5.tar.gz
samba-cd5745d37855175d9cb4750d67e21f12e1c302d5.tar.bz2
samba-cd5745d37855175d9cb4750d67e21f12e1c302d5.zip
r22005: Add more code (doesn't work at the moment) preparing a place for
listing user accounts. rafal (This used to be commit aac34f79d05654d094c8d91ad8e8b7f8e17710d6)
Diffstat (limited to 'webapps/swat')
-rw-r--r--webapps/swat/source/class/swat/module/netmgr/Fsm.js47
-rw-r--r--webapps/swat/source/class/swat/module/netmgr/Gui.js68
2 files changed, 81 insertions, 34 deletions
diff --git a/webapps/swat/source/class/swat/module/netmgr/Fsm.js b/webapps/swat/source/class/swat/module/netmgr/Fsm.js
index b5844ced37..f35e644241 100644
--- a/webapps/swat/source/class/swat/module/netmgr/Fsm.js
+++ b/webapps/swat/source/class/swat/module/netmgr/Fsm.js
@@ -62,7 +62,9 @@ qx.Proto.buildFsm = function(module)
"appear" :
{
"swat.main.canvas" :
- "Transition_Idle_to_AwaitRpcResult_via_canvas_appear"
+ "Transition_Idle_to_AwaitRpcResult_via_canvas_appear",
+ "vlayout":
+ "Transition_Idle_to_AwaitRpcResult_via_vlayout_appear"
},
"changeSelection" :
@@ -80,14 +82,29 @@ qx.Proto.buildFsm = function(module)
"Transition_Idle_to_AwaitRpcResult_via_canvas_appear",
{
"nextState" : "State_AwaitRpcResult",
-
+
+ "ontransition" : function(fsm, event)
+ {
+ var request = _this.callRpc(fsm, "samba.ejsnet", "NetContext", []);
+ request.setUserData("requestType", "NetContext");
+ }
+ });
+
+ // Add the new transition
+ state.addTransition(trans);
+
+ var trans = new qx.util.fsm.Transition(
+ "Transition_Idle_to_AwaitRpcResult_via_vlayout_appear",
+ {
+ "nextState" : "State_AwaitRpcResult",
+
"ontransition" :
- function(fsm, event)
- {
+ function(fsm, event)
+ {
// Request our netbios name to add proper node to the tree
var request = _this.callRpc(fsm, "samba.config", "lp_get", [ "netbios name" ]);
request.setUserData("requestType", "hostname");
- }
+ }
});
// Add the new transition
@@ -98,25 +115,15 @@ qx.Proto.buildFsm = function(module)
{
"nextState" : "State_AwaitRpcResult",
- "ontransition" :
- function(fsm, event)
+ "ontransition" : function(fsm, event)
{
var nodes = event.getData();
var selectedNode = nodes[0];
var gui = swat.module.netmgr.Gui.getInstance();
var parentNode = gui.getParentNode(module, selectedNode);
-
- if (typeof(parentNode.credentials) == "object")
- {
- var creds = parentNode.credentials;
- var request = _this.callRpc("samba.ejsnet", "NetContext", [ creds ]);
- request.setUserData("requestType", "NetContext");
- }
- else
- {
- // TODO: display a login dialog
- }
+
+ var params = (parentNode.credentials == undefined) ? [] : [ parentNode.credentials ];
}
});
@@ -128,10 +135,12 @@ qx.Proto.buildFsm = function(module)
{
"appear":
{
- "tree" : qx.util.fsm.FiniteStateMachine.EventHandling.BLOCKED
+ "tree" : qx.util.fsm.FiniteStateMachine.EventHandling.BLOCKED,
+ "vlayout" : qx.util.fsm.FiniteStateMachine.EventHandling.BLOCKED
}
}
+ // Add blocked events
this.addAwaitRpcResultState(module, blockedEvents);
};
diff --git a/webapps/swat/source/class/swat/module/netmgr/Gui.js b/webapps/swat/source/class/swat/module/netmgr/Gui.js
index 74a6eede33..44bba3f5ab 100644
--- a/webapps/swat/source/class/swat/module/netmgr/Gui.js
+++ b/webapps/swat/source/class/swat/module/netmgr/Gui.js
@@ -13,22 +13,22 @@ function()
//qx.OO.addProperty({ name : "_tree", type : "object" });
+//qx.OO.addProperty({ name : "_panel", type : "object" });
qx.Proto.buildGui = function(module)
{
var fsm = module.fsm;
- // We need a horizontal box layout for the database name
- var vlayout = new qx.ui.layout.VerticalBoxLayout();
- vlayout.set({
- top: 20,
- left: 20,
- right: 20,
- bottom: 20
+ var hlayout = new qx.ui.layout.HorizontalBoxLayout();
+ hlayout.set({
+ top: 0,
+ left: 0,
+ right: 0,
+ height: "80%"
});
-
+
// Create a hosts tree
- this._tree = new qx.ui.treevirtual.TreeVirtual(["Net"]);
+ this._tree = new qx.ui.treevirtual.TreeVirtual(["Hosts"]);
var tree = this._tree;
// Set the tree's properties
@@ -36,8 +36,8 @@ qx.Proto.buildGui = function(module)
backgroundColor: 255,
border: qx.renderer.border.BorderPresets.getInstance().thinInset,
overflow: "hidden",
- width: "30%",
- height: "1*",
+ width: "20%",
+ height: "100%",
alwaysShowOpenCloseSymbol: true
});
@@ -48,9 +48,43 @@ qx.Proto.buildGui = function(module)
// Give a tree widget nicer name to handle
fsm.addObject("tree", tree, "swat.main.fsmUtils.disable_during_rpc");
+
+ // "Panel" for list view
+ this._panel = new qx.ui.layout.VerticalBoxLayout();
+ var panel = this._panel;
+
+ panel.set({
+ top: 0,
+ right: 20,
+ width: "80%",
+ height: "100%"
+ });
- // Add the label to the horizontal layout
- vlayout.add(tree);
+ // Add the tree view and panel for list view to the layout
+ hlayout.add(tree);
+ hlayout.add(panel);
+
+ var statusLayout = new qx.ui.layout.HorizontalBoxLayout();
+ statusLayout.set({
+ top: 0,
+ left: 0,
+ right: 0,
+ height: "100%"
+ });
+
+ var vlayout = new qx.ui.layout.VerticalBoxLayout();
+ vlayout.set({
+ top: 20,
+ left: 20,
+ width: "100%",
+ bottom: 20
+ });
+
+ vlayout.add(hlayout);
+ vlayout.add(statusLayout);
+
+ vlayout.addEventListener("appear", fsm.eventListener, fsm);
+ fsm.addObject("vlayout", vlayout);
module.canvas.add(vlayout);
};
@@ -73,7 +107,8 @@ qx.Proto.displayData = function(module, rpcRequest)
switch (requestType)
{
case "hostname":
- this._addHostNode(module, rpcRequest);
+ // Add local host node
+ this._addHostNode(module, rpcRequest, true);
break;
case "NetContext":
@@ -105,7 +140,7 @@ qx.Proto.getParentNode = function(module, node)
};
-qx.Proto._addHostNode = function(module, rpcRequest)
+qx.Proto._addHostNode = function(module, rpcRequest, local)
{
var fsm = module.fsm;
var hostname = rpcRequest.getUserData("result").data;
@@ -126,7 +161,10 @@ qx.Proto._addHostNode = function(module, rpcRequest)
tree.addEventListener("changeSelection", fsm.eventListener, fsm);
var hostNode = dataModel.getData()[hostNodeId];
+
+ // Set host-specific properties
hostNode.credentials = undefined;
+ hostNode.local = local
};