summaryrefslogtreecommitdiff
path: root/webapps/swat/source/class
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2007-01-31 00:04:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:44:26 -0500
commitbe2ad3d8d4a6593e59331b070658af647935e4f7 (patch)
treec44255b060bd5d9bd0cf8b64ddcb0d02e8b54454 /webapps/swat/source/class
parent6c138c8a58a622fd95164d34df0d79246a720fc1 (diff)
downloadsamba-be2ad3d8d4a6593e59331b070658af647935e4f7.tar.gz
samba-be2ad3d8d4a6593e59331b070658af647935e4f7.tar.bz2
samba-be2ad3d8d4a6593e59331b070658af647935e4f7.zip
r21065: The framework is complete (yes the gui layout still sucks but that will
be handled later) next will be to build out the code to actually commit changes (This used to be commit f0ddc503820aeec3557fe8d80b31c971fae7cdc1)
Diffstat (limited to 'webapps/swat/source/class')
-rw-r--r--webapps/swat/source/class/swat/module/ldbbrowse/Gui.js2
-rw-r--r--webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js90
2 files changed, 88 insertions, 4 deletions
diff --git a/webapps/swat/source/class/swat/module/ldbbrowse/Gui.js b/webapps/swat/source/class/swat/module/ldbbrowse/Gui.js
index b082ec0719..3f9cda0053 100644
--- a/webapps/swat/source/class/swat/module/ldbbrowse/Gui.js
+++ b/webapps/swat/source/class/swat/module/ldbbrowse/Gui.js
@@ -449,7 +449,7 @@ qx.Proto._switchToModrecord = function()
this._ldbmod.setDisplay(true);
this._newb.setEnabled(false);
this._modb.setEnabled(false);
- this._ldbmod.initMod(this._table, this._switchToNormal, this);
+ this._ldbmod.initMod(this._table.getTableModel(), this._switchToNormal, this);
}
qx.Proto._displaySearchResults = function(module, rpcRequest)
diff --git a/webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js b/webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js
index 2b5dfc18f6..16476bf070 100644
--- a/webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js
+++ b/webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js
@@ -126,10 +126,12 @@ qx.Proto.initNew = function(callback, obj) {
this._mainArea.add(hlayout);
+ this._createAttributesArea();
+
return;
}
-qx.Proto.initMod = function(table, callback, obj) {
+qx.Proto.initMod = function(tablemodel, callback, obj) {
this._setExitCallback(callback, obj);
@@ -145,9 +147,14 @@ qx.Proto.initMod = function(table, callback, obj) {
this._mainArea.add(this._dn);
- //TODO: for each entry in the table, add new entries in the object
+ this._createAttributesArea();
- return;
+ // for each entry in the table, add new entries in the object
+ var count = tablemodel.getRowCount();
+ for (var i = 0; i < count; i++) {
+ var row = tablemodel.getRowData(i);
+ this._addNewAttribute(row[0], row[1]);
+ }
}
qx.Proto._setExitCallback = function(vFunction, vObject) {
@@ -195,3 +202,80 @@ qx.Proto._cancelOp = function() {
this._reset();
this._callExitCallback();
}
+
+qx.Proto._addNewAttribute = function(name, value, before) {
+
+ // do not add a new attribute if the name is null
+ if (name == null || name == "") {
+ return;
+ }
+
+ var hlayout = new qx.ui.layout.HorizontalBoxLayout();
+ hlayout.set({ width: "auto", height: "auto", spacing: 10 });
+
+ var rButton = new qx.ui.form.Button("-");
+ rButton.addEventListener("execute", function() {
+ hlayout.setParent(null);
+ });
+
+ var aLabel = new qx.ui.basic.Label(name);
+
+ var aTextField = new qx.ui.form.TextField(value);
+
+ var aButton = new qx.ui.form.Button("+");
+ aButton.addEventListener("execute", function() {
+ this._addNewAttribute(name, null, hlayout);
+ }, this);
+
+ hlayout.add(rButton, aLabel, aTextField, aButton);
+
+ if (before) {
+ this._attrArea.addAfter(hlayout, before);
+ } else {
+ this._attrArea.addBefore(hlayout, this._attrAddButton);
+ }
+}
+
+qx.Proto._createNewAttribute = function() {
+
+ var main = qx.ui.core.ClientDocument.getInstance();
+
+ var amw = new qx.ui.window.Window("New Attribute Name");
+ amw.setSpace(100, 200, 100, 150);
+ amw.setModal(true);
+ amw.setShowMinimize(false);
+ amw.setShowMaximize(false);
+ amw.setShowClose(false);
+ amw.setResizeable(false);
+
+ var hlayout = new qx.ui.layout.HorizontalBoxLayout();
+ hlayout.set({ width: "auto", height: "auto", spacing: 10 });
+
+ attrName = new qx.ui.form.TextField();
+
+ var okButton = new qx.ui.form.Button("OK");
+ okButton.addEventListener("execute", function() {
+ this._addNewAttribute(attrName.getValue());
+ amw.close();
+ }, this);
+
+ hlayout.add(attrName, okButton);
+
+ amw.add(hlayout);
+
+ main.add(amw);
+
+ amw.open();
+}
+
+qx.Proto._createAttributesArea = function() {
+
+ this._attrArea = new qx.ui.layout.VerticalBoxLayout();
+
+ this._attrAddButton = new qx.ui.form.Button("+");
+ this._attrAddButton.addEventListener("execute", this._createNewAttribute, this);
+
+ this._attrArea.add(this._attrAddButton);
+
+ this._mainArea.add(this._attrArea);
+}