summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2007-02-14 05:16:05 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:13 -0500
commitbe8a93a1d8efd6766729f0800721b756b050aa13 (patch)
treeed517df64f0ab14d4f1d6bd75fbce06202b558f8
parentb79bf0623235672684d7dd79dd7a6b202adfb35f (diff)
downloadsamba-be8a93a1d8efd6766729f0800721b756b050aa13.tar.gz
samba-be8a93a1d8efd6766729f0800721b756b050aa13.tar.bz2
samba-be8a93a1d8efd6766729f0800721b756b050aa13.zip
r21328: Ok, now we can successfully modify the ldb and refresh the tree
but ... - we have a problem with removeAll() in ldbmodify - we seem to not properly cactch errors, we always return a "success" alert even if the operation is not successful :( (This used to be commit 8ed568ae10e9068874c90058b9777658f1e58df5)
-rw-r--r--webapps/swat/source/class/swat/module/ldbbrowse/Gui.js65
-rw-r--r--webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js22
2 files changed, 56 insertions, 31 deletions
diff --git a/webapps/swat/source/class/swat/module/ldbbrowse/Gui.js b/webapps/swat/source/class/swat/module/ldbbrowse/Gui.js
index a9db18b712..b819c2aab4 100644
--- a/webapps/swat/source/class/swat/module/ldbbrowse/Gui.js
+++ b/webapps/swat/source/class/swat/module/ldbbrowse/Gui.js
@@ -138,10 +138,16 @@ qx.Proto.displayData = function(module, rpcRequest)
this._displaySearchResults(module, rpcRequest);
break;
- case "add":
case "modify":
+ this._displayModifyResults(module, rpcRequest);
+ break;
+
+ case "add":
+ this._displayAddResults(module, rpcRequest);
+ break;
+
case "delete":
- this._displayCommitResults(module, rpcRequest, requestType);
+ this._displayDeleteResults(module, rpcRequest);
break;
case "tree_open":
@@ -475,34 +481,51 @@ qx.Proto._switchToModrecord = function()
qx.Proto._confirmDeleteRecord = function()
{
- //this._newb.setEnabled(false);
- //this._modb.setEnabled(false);
- //this._delb.setEnabled(false);
this._ldbmod.showConfirmDelete();
};
-qx.Proto._displayCommitResults = function(module, rpcRequest, type)
+qx.Proto._displayModifyResults = function(module, rpcRequest)
{
- var result = rpcRequest.getUserData("result");
+ var tree = module.fsm.getObject("tree");
+ tree.createDispatchDataEvent("changeSelection", tree.getSelectedNodes());
- switch (type) {
- case "add":
- alert("Object successfully added!");
- break;
+ alert("Object successfully modified!");
- case "modify":
- alert("Object successfully modified!");
- break;
+ this._switchToNormal();
+ //this._ldbmod.postCleanUp();
+}
- case "delete":
- alert("Object Successfully deleted!");
- break;
- }
+qx.Proto._displayAddResults = function(module, rpcRequest)
+{
+ var result = rpcRequest.getUserData("result");
+
+ var tree = module.fsm.getObject("tree");
+ var node = tree.getSelectedNodes()[0];
+
+ tree.getDataModel().prune(node.nodeId, false);
+ node.bOpened = false;
+ tree.toggleOpened(node);
+
+ alert("Object successfully added!");
this._switchToNormal();
+ //this._ldbmod.postCleanUp();
+};
- //TODO: reload tree after add or delete
+qx.Proto._displayDeleteResults = function(module, rpcRequest, type)
+{
+ var result = rpcRequest.getUserData("result");
+
+ var tree = module.fsm.getObject("tree");
+ var node = tree.getDataModel().getData()[tree.getSelectedNodes()[0].parentNodeId];
+
+ tree.getDataModel().prune(node.nodeId, false);
+ node.bOpened = false;
+ tree.toggleOpened(node);
+ alert("Object Successfully deleted!");
+
+ this._ldbmod.setBase("");
};
qx.Proto._displaySearchResults = function(module, rpcRequest)
@@ -559,12 +582,14 @@ qx.Proto._displayTreeOpenResults = function(module, rpcRequest)
var parentNode = rpcRequest.getUserData("parentNode");
var attributes = rpcRequest.getUserData("attributes");
+ // Remove any existing children, they will be replaced by the result of this call (refresh)
+ dataModel.setData();
+
// Any children?
if (! result || result["length"] == 0)
{
// Nope. Remove parent's expand/contract button.
dataModel.setState(parentNode.nodeId, { bHideOpenClose : true });
- dataModel.setData();
return;
}
diff --git a/webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js b/webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js
index e9a7d4890f..aff8ec0495 100644
--- a/webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js
+++ b/webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js
@@ -97,8 +97,7 @@ qx.Proto.setBase = function(base) {
if (this._active) {
if (this._type == "add") {
- this._basedn.setValue(this.basedn);
- this._basedn.setWidth(8 * this.basedn.length);
+ this._basedn.setHtml(this.basedn);
}
}
}
@@ -113,6 +112,12 @@ qx.Proto.initNew = function(callback, obj) {
this._setExitCallback(callback, obj);
+ if (this.basedn == "") {
+ alert("Please select the parent node in the tree first!");
+ this._callExitCallback();
+ return;
+ }
+
this._active = true;
this._type = "add";
@@ -130,8 +135,7 @@ qx.Proto.initNew = function(callback, obj) {
// The basedn of the object
// TODO: add validator
- this._basedn = new qx.ui.form.TextField(this.basedn);
- this._basedn.setWidth(8 * this.basedn.length);
+ this._basedn = new qx.ui.basic.Label(this.basedn);
hlayout.add(dnlabel, this._rdn, dnsep, this._basedn);
@@ -211,18 +215,14 @@ qx.Proto._reset = function() {
this._mainArea.removeAll();
this._active = false;
this._type = "null";
- return;
}
-qx.Proto._cancelOp = function() {
-
+qx.Proto.postCleanUp = function() {
this._reset();
- this._callExitCallback();
}
-qx.Proto._okOp = function() {
+qx.Proto._cancelOp = function() {
- //TODO: disable ok/cancel buttons and call fsm instead
this._reset();
this._callExitCallback();
}
@@ -291,7 +291,7 @@ qx.Proto.getLdif = function() {
case "add":
- var ldif = "dn: " + this._rdn.getValue() + "," + this._basedn.getValue() + "\n";
+ var ldif = "dn: " + this._rdn.getValue() + "," + this.basedn + "\n";
for (var i = 0; i < c.length; i++) {
if (c[i] instanceof qx.ui.layout.HorizontalBoxLayout) {