svn commit: samba r21328 - in branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse: .

idra at samba.org idra at samba.org
Wed Feb 14 05:16:06 GMT 2007


Author: idra
Date: 2007-02-14 05:16:05 +0000 (Wed, 14 Feb 2007)
New Revision: 21328

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

Log:

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 :(


Modified:
   branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/Gui.js
   branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js


Changeset:
Modified: branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/Gui.js
===================================================================
--- branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/Gui.js	2007-02-14 04:47:15 UTC (rev 21327)
+++ branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/Gui.js	2007-02-14 05:16:05 UTC (rev 21328)
@@ -138,10 +138,16 @@
     this._displaySearchResults(module, rpcRequest);
     break;
 
+  case "modify":
+    this._displayModifyResults(module, rpcRequest);
+    break;
+
   case "add":
-  case "modify":
+    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._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 tree = module.fsm.getObject("tree");
+  tree.createDispatchDataEvent("changeSelection", tree.getSelectedNodes());
+
+  alert("Object successfully modified!");
+
+  this._switchToNormal();
+  //this._ldbmod.postCleanUp();
+}
+
+qx.Proto._displayAddResults = function(module, rpcRequest)
+{
   var result = rpcRequest.getUserData("result");
 
-  switch (type) {
-  case "add":
-    alert("Object successfully added!");
-    break;
+  var tree = module.fsm.getObject("tree");
+  var node = tree.getSelectedNodes()[0];
+  
+  tree.getDataModel().prune(node.nodeId, false);
+  node.bOpened = false;
+  tree.toggleOpened(node);
 
-  case "modify":
-    alert("Object successfully modified!");
-    break;
+  alert("Object successfully added!");
 
-  case "delete":
-    alert("Object Successfully deleted!");
-    break;
-  }
-
   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 @@
   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;
   }
 

Modified: branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js
===================================================================
--- branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js	2007-02-14 04:47:15 UTC (rev 21327)
+++ branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/LdbModify.js	2007-02-14 05:16:05 UTC (rev 21328)
@@ -97,8 +97,7 @@
   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 @@
 
   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 @@
 
   // 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 @@
   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 @@
 
   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) {



More information about the samba-cvs mailing list