diff options
author | Rafal Szczesniak <mimir@samba.org> | 2007-03-16 00:19:40 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:49:37 -0500 |
commit | fe0d6a155352d036dc51cace4b02ddb5231c99da (patch) | |
tree | 8afc1e7b10694c9f6648c4f16fc0a7d9efdf085e | |
parent | dcd65a50a150db139a8ec9a2fec0f7fef91c19ff (diff) | |
download | samba-fe0d6a155352d036dc51cace4b02ddb5231c99da.tar.gz samba-fe0d6a155352d036dc51cace4b02ddb5231c99da.tar.bz2 samba-fe0d6a155352d036dc51cace4b02ddb5231c99da.zip |
r21852: Further work on initialising libnet context from netmgr.
rafal
(This used to be commit 2ee075605e54813ebdae20995deb0e090faa5a9a)
-rw-r--r-- | webapps/swat/source/class/swat/module/netmgr/Fsm.js | 41 | ||||
-rw-r--r-- | webapps/swat/source/class/swat/module/netmgr/Gui.js | 42 |
2 files changed, 69 insertions, 14 deletions
diff --git a/webapps/swat/source/class/swat/module/netmgr/Fsm.js b/webapps/swat/source/class/swat/module/netmgr/Fsm.js index 09e8316fef..b5844ced37 100644 --- a/webapps/swat/source/class/swat/module/netmgr/Fsm.js +++ b/webapps/swat/source/class/swat/module/netmgr/Fsm.js @@ -43,7 +43,7 @@ qx.Proto.buildFsm = function(module) result.data.origin == origins.Server && result.data.code == serverErrors.ResourceError) { - this.debug("error" + result); + alert("Error when receiving rpc: '" + result.id + "'" + " exception: " + result.data); } else { @@ -63,7 +63,13 @@ qx.Proto.buildFsm = function(module) { "swat.main.canvas" : "Transition_Idle_to_AwaitRpcResult_via_canvas_appear" - } + }, + + "changeSelection" : + { + "tree" : + "Transition_Idle_to_AwaitRpcResult_via_tree_selection_changed" + } } }); @@ -87,6 +93,37 @@ qx.Proto.buildFsm = function(module) // Add the new transition state.addTransition(trans); + var trans = new qx.util.fsm.Transition( + "Transition_Idle_to_AwaitRpcResult_via_tree_selection_changed", + { + "nextState" : "State_AwaitRpcResult", + + "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 + } + } + + }); + + // Add the new transition + state.addTransition(trans); + blockedEvents = { "appear": diff --git a/webapps/swat/source/class/swat/module/netmgr/Gui.js b/webapps/swat/source/class/swat/module/netmgr/Gui.js index d1376ab4c6..74a6eede33 100644 --- a/webapps/swat/source/class/swat/module/netmgr/Gui.js +++ b/webapps/swat/source/class/swat/module/netmgr/Gui.js @@ -85,6 +85,26 @@ qx.Proto.displayData = function(module, rpcRequest) }; +qx.Proto.getParentNode = function(module, node) +{ + var tree = this._tree; + var nodes = tree.getTableModel().getData(); + if (nodes == undefined) + { + return undefined; + } + + if (node.parentNodeId == 0) + { + // there is no parent node + return node; + } + + var parentNode = nodes[node.parentNodeId]; + return parentNode; +}; + + qx.Proto._addHostNode = function(module, rpcRequest) { var fsm = module.fsm; @@ -93,22 +113,20 @@ qx.Proto._addHostNode = function(module, rpcRequest) // Get the tree widget var tree = this._tree; var dataModel = tree.getDataModel(); - - // Add new host and its service branches + + // Add new host and its service leaves var hostNodeId = dataModel.addBranch(null, hostname, false); - var domainNodeId = dataModel.addBranch(hostNodeId, "Domain", false); - var usersNodeId = dataModel.addBranch(hostNodeId, "Users", false); - var groupsNodeId = dataModel.addBranch(hostNodeId, "Groups", false); - var srvcsNodeId = dataModel.addBranch(hostNodeId, "Services", false); - - // Services don't expand - dataModel.setState(domainNodeId, { bHideOpenClose : true }); - dataModel.setState(usersNodeId, { bHideOpenClose : true }); - dataModel.setState(groupsNodeId, { bHideOpenClose : true }); - dataModel.setState(srvcsNodeId, { bHideOpenClose : true }); + var domainNodeId = dataModel.addLeaf(hostNodeId, "Domain", false); + var usersNodeId = dataModel.addLeaf(hostNodeId, "Users", false); + var groupsNodeId = dataModel.addLeaf(hostNodeId, "Groups", false); + var srvcsNodeId = dataModel.addLeaf(hostNodeId, "Services", false); dataModel.setData(); + tree.addEventListener("changeSelection", fsm.eventListener, fsm); + + var hostNode = dataModel.getData()[hostNodeId]; + hostNode.credentials = undefined; }; |