summaryrefslogtreecommitdiff
path: root/webapps/swat/source
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2007-04-24 08:36:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:51:34 -0500
commit5d2daefcf27eeb8fa74b90a0cdf91932ce58e16e (patch)
tree6340e09bd4517e844fea2ee98598f0beef189c93 /webapps/swat/source
parent6d69e67dfdd68edbf682936d4c50562095039034 (diff)
downloadsamba-5d2daefcf27eeb8fa74b90a0cdf91932ce58e16e.tar.gz
samba-5d2daefcf27eeb8fa74b90a0cdf91932ce58e16e.tar.bz2
samba-5d2daefcf27eeb8fa74b90a0cdf91932ce58e16e.zip
r22499: UsrCtx should be created within UsersView. Tree widget just
opens it and passes the domain name(s) to operate on (selectable via combo box). rafal (This used to be commit c438284adf17faff2cd76d14c9de252e995166bd)
Diffstat (limited to 'webapps/swat/source')
-rw-r--r--webapps/swat/source/class/swat/module/netmgr/Fsm.js39
-rw-r--r--webapps/swat/source/class/swat/module/netmgr/Gui.js22
-rw-r--r--webapps/swat/source/class/swat/module/netmgr/UsersView.js47
3 files changed, 90 insertions, 18 deletions
diff --git a/webapps/swat/source/class/swat/module/netmgr/Fsm.js b/webapps/swat/source/class/swat/module/netmgr/Fsm.js
index 70f84904ef..c2e499a18f 100644
--- a/webapps/swat/source/class/swat/module/netmgr/Fsm.js
+++ b/webapps/swat/source/class/swat/module/netmgr/Fsm.js
@@ -73,6 +73,13 @@ qx.Proto.buildFsm = function(module)
"Transition_Idle_to_Idle_via_tree_selection_changed"
},
+ "changeSelected":
+ {
+ // this one is dispatched from UsersView widget
+ "domainName":
+ "Transition_Idle_to_AwaitRpcResult_via_domainName_changed"
+ },
+
"changeNetCtx" :
{
"swat.module.netmgr.Gui" :
@@ -120,7 +127,7 @@ qx.Proto.buildFsm = function(module)
var trans = new qx.util.fsm.Transition(
"Transition_Idle_to_Idle_via_tree_selection_changed",
{
- "nextState" : "State_AwaitRpcResult",
+ "nextState" : "State_Idle",
"ontransition" : function(fsm, event)
{
@@ -135,15 +142,14 @@ qx.Proto.buildFsm = function(module)
{
module.setNetCtx(parentNode.netCtx);
}
-
+
+ var domainName = parentNode.label;
var nodeName = selectedNode.label;
- var callName = undefined; // rpc call name
- var callArgs = [ gui.getNetCtx() ]; // NetContex goes first
switch (nodeName)
{
case "Users":
- callName = "UserMgr";
+ gui.openUserManager(module, domainName);
break;
case "Groups":
@@ -155,14 +161,26 @@ qx.Proto.buildFsm = function(module)
default:
alert("Undefined call selected for node=['" + nodeName + "']");
}
+ }
+
+ });
- // Bail out if no appropriate call name has been found
- if (callName == undefined) return;
+ // Add the new transition
+ state.addTransition(trans);
- var req = _this.callRpc(fsm, "samba.ejsnet", callName, callArgs);
+ var trans = new qx.util.fsm.Transition(
+ "Transition_Idle_to_AwaitRpcResult_via_domainName_changed",
+ {
+ "nextState" : "State_AwaitRpcResult",
+
+ "ontransition" : function(fsm, event)
+ {
+ var domainName = fsm.getObject("domainName").getValue();
+ var netCtxId = swat.module.netmgr.Gui.getInstance().getNetCtx();
+
+ var req = _this.callRpc(fsm, "samba.ejsnet", "UserMgr", [ netCtxId, domainName ]);
req.setUserData("requestType", "UserMgr");
}
-
});
// Add the new transition
@@ -175,7 +193,8 @@ qx.Proto.buildFsm = function(module)
"ontransition" : function(fsm, event)
{
- var netCtxId = 0;
+ var netCtxId = swat.module.netmgr.Gui.getInstance().getNetCtx();
+
var req = _this.callRpc(fsm, "samba.ejsnet", "NetContextCreds", [ netCtxId ]);
req.setUserData("requestType", "NetContextCreds");
}
diff --git a/webapps/swat/source/class/swat/module/netmgr/Gui.js b/webapps/swat/source/class/swat/module/netmgr/Gui.js
index 8e92f4753d..8f9f664a74 100644
--- a/webapps/swat/source/class/swat/module/netmgr/Gui.js
+++ b/webapps/swat/source/class/swat/module/netmgr/Gui.js
@@ -213,6 +213,20 @@ qx.Proto.getParentNode = function(module, node)
};
+qx.Proto.openUserManager = function(module, domainName)
+{
+ // Remove existing panel if there is any
+ if (this._panel.getChildrenLength() > 0)
+ {
+ this._panel.removeAll();
+ }
+
+ // Create user view, pass the context and the view to the panel
+ var view = new swat.module.netmgr.UsersView(module.fsm, domainName);
+ this._panel.add(view);
+};
+
+
qx.Proto._addHostNode = function(module, rpcRequest, local)
{
var fsm = module.fsm;
@@ -260,14 +274,8 @@ qx.Proto._updateNetContextCreds = function(module, rpcRequest)
qx.Proto._initUserManager = function(module, rpcRequest)
{
- // Get obtained UsrCtx handle
+ // Get obtained usrCtx handle
var usrCtx = rpcRequest.getUserData("result").data;
-
- // Create user view and pass the context
- var view = new swat.module.netmgr.UsersView(module.fsm);
- view.setUsrCtx(usrCtx);
-
- this._panel.add(view);
};
diff --git a/webapps/swat/source/class/swat/module/netmgr/UsersView.js b/webapps/swat/source/class/swat/module/netmgr/UsersView.js
index b1b16b61bd..2e87a27b4b 100644
--- a/webapps/swat/source/class/swat/module/netmgr/UsersView.js
+++ b/webapps/swat/source/class/swat/module/netmgr/UsersView.js
@@ -11,7 +11,7 @@
* Users View
*/
qx.OO.defineClass("swat.module.netmgr.UsersView", qx.ui.layout.HorizontalBoxLayout,
-function(fsm)
+function(fsm, domainName)
{
qx.ui.layout.HorizontalBoxLayout.call(this);
@@ -38,6 +38,39 @@ function(fsm)
var cmbDomain = new qx.ui.form.ComboBox();
cmbDomain.setEditable(false);
+ // there's always BUILTIN domain so add it to the list
+ var item = new qx.ui.form.ListItem("BUILTIN");
+ cmbDomain.add(item);
+
+ var selectedItem = undefined;
+
+ // Simply add the domain name if it is passed as a string
+ if (typeof(domainName) == "string")
+ {
+ item = new qx.ui.form.ListItem(domainName);
+ cmbDomain.add(item);
+
+ selectedItem = item;
+ }
+ else // if it's not a string we assume it is a list of strings
+ {
+ for (var s in domainName)
+ {
+ item = new qx.ui.form.ListItem(s);
+ cmbDomain.add(s);
+ }
+
+ selectedItem = new qx.ui.form.ListItem(domainName[0]);
+ }
+
+ // Add event handling
+ cmbDomain.addEventListener("changeSelected", fsm.eventListener, fsm);
+ fsm.addObject("domainName", cmbDomain);
+
+ // Set default selection and dispatch the respective event to initialise the view
+ cmbDomain.setSelected(selectedItem);
+ cmbDomain.dispatchEvent(new qx.event.type.Event("changeSelected"), true);
+
// Create an empty list view with sample column
this._columns = { username : { label: "Username", width: 150, type: "text" }};
this._items = [];
@@ -60,3 +93,15 @@ function(fsm)
// UsrMgr context is required for any operation on user accounts
qx.OO.addProperty({ name : "usrCtx", type : "number" });
+
+
+qx.Proto.refreshView = function()
+{
+}
+
+
+qx.Proto._initUserManager = function(module, rpcRequest)
+{
+ // Get obtained UsrCtx handle
+ var usrCtx = rpcRequest.getUserData("result").data;
+};