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

idra at samba.org idra at samba.org
Wed Jan 31 17:57:45 GMT 2007


Author: idra
Date: 2007-01-31 17:57:44 +0000 (Wed, 31 Jan 2007)
New Revision: 21095

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

Log:

Expose all naming contexts


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


Changeset:
Modified: branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js
===================================================================
--- branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js	2007-01-31 17:30:52 UTC (rev 21094)
+++ branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/Fsm.js	2007-01-31 17:57:44 UTC (rev 21095)
@@ -78,7 +78,7 @@
 
       "events" :
         {
-          // If the search button is activated, issue a seacrh request
+          // If the search button is activated, issue a search request
           "execute" :
           {
             "search" :
@@ -200,7 +200,7 @@
           if (parent == tree)
           {
             // ... then we want the defaultNamingContext, ...
-            attributes = [ "defaultNamingContext" ];
+            attributes = [ "defaultNamingContext", "namingContexts" ];
 
             // ... and we want only base scope
             scope = "base";

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-01-31 17:30:52 UTC (rev 21094)
+++ branches/SAMBA_4_0/webapps/swat/source/class/swat/module/ldbbrowse/Gui.js	2007-01-31 17:57:44 UTC (rev 21095)
@@ -510,33 +510,63 @@
     return;
   }
 
-  for (var i = 0; i < result.length; i++)
-  {
-    var name;
+  // base object, add naming contexts to the root
+  if ((result.length == 1) &&
+      ((result[0]["dn"] == "") ||
+       (result[0]["dn"].toLowerCase() == "cn=rootdse"))) {
 
-    child = result[i];
+    defnc = result[0]["defaultNamingContext"];
 
-    // Determine name for new tree row.  If first level, use entire
-    // DN.  Otherwise, strip off first additional component.
-    if (attributes == "defaultNamingContext")
-    {
-      name = child["defaultNamingContext"];
+    // Build a tree row for the defaultNamingContext
+    if (defnc) {
+      trs = qx.ui.treefullcontrol.TreeRowStructure.getInstance().standard(defnc);
+      // This row is a "folder" (it can have children)
+      t = new qx.ui.treefullcontrol.TreeFolder(trs);
+      t.setAlwaysShowPlusMinusSymbol(true);
+
+      // Add this row to its parent
+      parent.add(t);
     }
-    else
+
+    var ncs = result[0]["namingContexts"];
+
+    // If it's multi-valued (type is an array) we have other naming contexts to show
+    if (typeof(ncs) == "object") {
+      
+      for (var i = 0; i < ncs.length; i++) {
+        if (ncs[i] != defnc) { //skip default naming context
+          trs = qx.ui.treefullcontrol.TreeRowStructure.getInstance().standard(ncs[i]);
+          // This row is a "folder" (it can have children)
+          t = new qx.ui.treefullcontrol.TreeFolder(trs);
+          t.setAlwaysShowPlusMinusSymbol(true);
+  
+          // Add this row to its parent
+          parent.add(t);
+        }
+      }
+    }
+  }
+  else {
+
+    for (var i = 0; i < result.length; i++)
     {
-      //FIXME: must check for escapes, as ',' is also a valid value, not only a separator
+      var name;
+  
+      child = result[i];
+  
       name = child["dn"].split(",")[0];
+  
+      // Build a standard tree row
+      trs = qx.ui.treefullcontrol.TreeRowStructure.getInstance().standard(name);
+  
+      // This row is a "folder" (it can have children)
+      t = new qx.ui.treefullcontrol.TreeFolder(trs);
+      t.setAlwaysShowPlusMinusSymbol(true);
+  
+      // Add this row to its parent
+      parent.add(t);
     }
 
-    // Build a standard tree row
-    trs = qx.ui.treefullcontrol.TreeRowStructure.getInstance().standard(name);
-
-    // This row is a "folder" (it can have children)
-    t = new qx.ui.treefullcontrol.TreeFolder(trs);
-    t.setAlwaysShowPlusMinusSymbol(true);
-
-    // Add this row to its parent
-    parent.add(t);
   }
 };
 



More information about the samba-cvs mailing list