summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2007-04-23 13:37:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:51:32 -0500
commit9e752901b229149fc08937df4d897340611c671a (patch)
tree3e5085acedf10ed8430ba2ef69209e0f43db3de4
parentf66bd1ae54c2d69b84790f4a2a860d4a3c65873e (diff)
downloadsamba-9e752901b229149fc08937df4d897340611c671a.tar.gz
samba-9e752901b229149fc08937df4d897340611c671a.tar.bz2
samba-9e752901b229149fc08937df4d897340611c671a.zip
r22487: Add a separate widget class for listing users and reposition
things on NetManager's screen. Qooxdoo layout positioning can be tricky sometimes... rafal (This used to be commit 3face29cc2a69b456b78f2384e1b306417b6817d)
-rw-r--r--webapps/swat/source/class/swat/module/netmgr/Gui.js56
-rw-r--r--webapps/swat/source/class/swat/module/netmgr/UsersView.js62
2 files changed, 83 insertions, 35 deletions
diff --git a/webapps/swat/source/class/swat/module/netmgr/Gui.js b/webapps/swat/source/class/swat/module/netmgr/Gui.js
index b78d484f51..8e92f4753d 100644
--- a/webapps/swat/source/class/swat/module/netmgr/Gui.js
+++ b/webapps/swat/source/class/swat/module/netmgr/Gui.js
@@ -2,6 +2,7 @@
* Copyright (C) Rafal Szczesniak 2007
*/
+
/**
* Swat Net Manager class graphical user interface
*/
@@ -14,7 +15,6 @@ function()
//qx.OO.addProperty({ name : "_tree", type : "object" });
//qx.OO.addProperty({ name : "_panel", type : "object" });
-//qx.OO.addProperty({ name : "_view", type : "object" });
//qx.OO.addProperty({ name : "_txtDomain", type : "object" });
//qx.OO.addProperty({ name : "_txtUsername", type : "object" });
@@ -30,9 +30,9 @@ qx.Proto.buildGui = function(module)
// Main layout composing the whole form
var vlayout = new qx.ui.layout.VerticalBoxLayout();
vlayout.set({
- top: 20,
- left: 20,
- width: "100%",
+ top: 10,
+ left: 10,
+ right: 10,
bottom: 20
});
@@ -70,37 +70,17 @@ qx.Proto.buildGui = function(module)
// "Panel" for list view
this._panel = new qx.ui.layout.VerticalBoxLayout();
var panel = this._panel;
-
+
+ // TODO: Find out what's causing this bug - specifying 'width' works fine,
+ // but setting 'right' instead does not which makes impossible to position
+ // the panel against right boundary of a box
panel.set({
top: 0,
left: 10,
- width: "80%",
+ width:"80%",
height: "100%"
});
- // Setup some initial columns and (empty) item list - to be replaced soon
- // with default view loading
- var columns = { name : { label: "Name", width: 120, type: "text" }};
- var items = [];
-
- // Setup the list view
- this._view = new qx.ui.listview.ListView(items, columns);
- var view = this._view;
- view.setBorder(qx.renderer.border.BorderPresets.getInstance().shadow);
- view.setBackgroundColor("white");
- view.set({
- top: 0,
- left: 0,
- width: "80%",
- height: "100%"
- });
-
- // Give a list view name to handle
- fsm.addObject("view", view);
-
- // and the list view to the panel
- panel.add(view);
-
// Add the tree view and panel for list view to the layout
hlayout.add(tree);
hlayout.add(panel);
@@ -110,8 +90,8 @@ qx.Proto.buildGui = function(module)
statusLayout.set({
top: 10,
left: 0,
- right: 0,
- height: "100%"
+ width: "100%",
+ height: "20%"
});
// First "column" of status fields
@@ -119,13 +99,13 @@ qx.Proto.buildGui = function(module)
colALayout.set({
top: 0,
left: 0,
- width: 150,
+ width: "25%",
height: "100%"
});
// Domain name (credentials) - label and text box
var statusDomain = new qx.ui.layout.HorizontalBoxLayout();
- statusDomain.set({ top: 0, left: 0, width: "100%", height: 20,
+ statusDomain.set({ top: 0, left: 0, width: "100%", height: "auto",
verticalChildrenAlign: "middle" });
var lblDomain = new qx.ui.basic.Atom();
@@ -141,7 +121,7 @@ qx.Proto.buildGui = function(module)
// Username (credentials) - label and text box
var statusUsername = new qx.ui.layout.HorizontalBoxLayout();
- statusUsername.set({ top: 0, left: 0, width: "100%", height: 20,
+ statusUsername.set({ top: 0, left: 0, width: "100%", height: "auto",
verticalChildrenAlign: "middle" });
var lblUsername = new qx.ui.basic.Atom();
@@ -281,7 +261,13 @@ qx.Proto._updateNetContextCreds = function(module, rpcRequest)
qx.Proto._initUserManager = function(module, rpcRequest)
{
// Get obtained UsrCtx handle
- var result = rpcRequest.getUserData("result").data;
+ 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
new file mode 100644
index 0000000000..b1b16b61bd
--- /dev/null
+++ b/webapps/swat/source/class/swat/module/netmgr/UsersView.js
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) Rafal Szczesniak 2007
+ */
+
+//qx.OO.addProperty({ name: "_fsm", type: "object"});
+//qx.OO.addProperty({ name: "_columns", type: "object"});
+//qx.OO.addProperty({ name: "_items", type: "object"});
+//qx.OO.addProperty({ name: "_view", type: "object" });
+
+/**
+ * Users View
+ */
+qx.OO.defineClass("swat.module.netmgr.UsersView", qx.ui.layout.HorizontalBoxLayout,
+function(fsm)
+{
+ qx.ui.layout.HorizontalBoxLayout.call(this);
+
+ this._fsm = fsm;
+
+ // Set the whole view panel size and spacing between boxes
+ this.set({ top: 0, left: 0, width: "100%", height: "100%" });
+ this.setSpacing(5);
+
+ // Provide vertical positioning of combo box and list view
+ var innerBox = new qx.ui.layout.VerticalBoxLayout();
+ innerBox.set({ top: 0, left: 0, width: "100%", height: "100%"});
+
+ // horizontal box for domain selection label and combo box
+ var selectDomainBox = new qx.ui.layout.HorizontalBoxLayout();
+ selectDomainBox.set({ top: 0, left: 0, width: "auto", height: "10%" });
+ selectDomainBox.setVerticalChildrenAlign("middle");
+ selectDomainBox.setSpacing(5);
+
+ // Setup domain selection combo box
+ var lblDomain = new qx.ui.basic.Atom("Domain:");
+ lblDomain.setHorizontalChildrenAlign("right");
+
+ var cmbDomain = new qx.ui.form.ComboBox();
+ cmbDomain.setEditable(false);
+
+ // Create an empty list view with sample column
+ this._columns = { username : { label: "Username", width: 150, type: "text" }};
+ this._items = [];
+ this._view = new qx.ui.listview.ListView(this._items, this._columns);
+ var view = this._view;
+ view.set({ top: 0, left: 0, width: "90%", height: "90%" });
+ view.setBorder(qx.renderer.border.BorderPresets.getInstance().shadow);
+
+ // Arrange widgets and boxes
+ selectDomainBox.add(lblDomain);
+ selectDomainBox.add(cmbDomain);
+
+ innerBox.add(selectDomainBox);
+ innerBox.add(view);
+
+ // place the inner box in the UsersView box
+ this.add(innerBox);
+});
+
+
+// UsrMgr context is required for any operation on user accounts
+qx.OO.addProperty({ name : "usrCtx", type : "number" });