svn commit: samba r22005 - in branches/SAMBA_4_0/webapps/swat/source/class/swat/module/netmgr: .

mimir at samba.org mimir at samba.org
Wed Mar 28 23:01:36 GMT 2007


Author: mimir
Date: 2007-03-28 23:01:35 +0000 (Wed, 28 Mar 2007)
New Revision: 22005

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=22005

Log:
Add more code (doesn't work at the moment) preparing a place for
listing user accounts.


rafal


Modified:
   branches/SAMBA_4_0/webapps/swat/source/class/swat/module/netmgr/Fsm.js
   branches/SAMBA_4_0/webapps/swat/source/class/swat/module/netmgr/Gui.js


Changeset:
Modified: branches/SAMBA_4_0/webapps/swat/source/class/swat/module/netmgr/Fsm.js
===================================================================
--- branches/SAMBA_4_0/webapps/swat/source/class/swat/module/netmgr/Fsm.js	2007-03-28 22:52:37 UTC (rev 22004)
+++ branches/SAMBA_4_0/webapps/swat/source/class/swat/module/netmgr/Fsm.js	2007-03-28 23:01:35 UTC (rev 22005)
@@ -62,7 +62,9 @@
           "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 @@
     "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 @@
     {
       "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 @@
   {
     "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);
   
 };

Modified: branches/SAMBA_4_0/webapps/swat/source/class/swat/module/netmgr/Gui.js
===================================================================
--- branches/SAMBA_4_0/webapps/swat/source/class/swat/module/netmgr/Gui.js	2007-03-28 22:52:37 UTC (rev 22004)
+++ branches/SAMBA_4_0/webapps/swat/source/class/swat/module/netmgr/Gui.js	2007-03-28 23:01:35 UTC (rev 22005)
@@ -13,22 +13,22 @@
 
 
 //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 @@
              backgroundColor: 255,
 	     border: qx.renderer.border.BorderPresets.getInstance().thinInset,
              overflow: "hidden",
-             width: "30%",
-             height: "1*",
+             width: "20%",
+             height: "100%",
              alwaysShowOpenCloseSymbol: true
            });
 
@@ -48,10 +48,44 @@
 
   // 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;
   
-  // Add the label to the horizontal layout
-  vlayout.add(tree);
+  panel.set({
+              top: 0,
+              right: 20,
+              width: "80%",
+              height: "100%"
+            });
+  
+  // 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 @@
   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._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 @@
   tree.addEventListener("changeSelection", fsm.eventListener, fsm);
 
   var hostNode = dataModel.getData()[hostNodeId];
+
+  // Set host-specific properties
   hostNode.credentials = undefined;
+  hostNode.local = local
 };
 
 



More information about the samba-cvs mailing list