r19406: ldbbrowse: done!
authorDerrell Lipman <derrell@samba.org>
Thu, 19 Oct 2006 01:10:57 +0000 (01:10 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:21:27 +0000 (14:21 -0500)
With ldbbrowse, you can issue searches or browse the database in tree format.
To try it, ensure that "make installswat" is done (it's run by "make install"
so you shouldn't have to do anything special).  Run smbd and connect with your
browser to http://localhost:901/apps/samba/utils/ldbbrowse.html

(It looks great in firefox.  There's some problem with the layout in IE.
Maybe if I get really really motivated one of these days, I'll look into that.)

There's lots more that could be done with it, but as an example of using
qooxdoo and JSON-RPC, I think it accomplishes its task.

Enjoy!

Derrell
(This used to be commit 0888c7098daefc23738dd47fe1c072516ba55feb)

swat/apps/resource/css/layout-samba.css [new file with mode: 0644]
swat/apps/resource/css/layout-samba_ie.css [new file with mode: 0644]
swat/apps/samba/utils/ldbbrowse.html
swat/apps/script/layout-samba.js [new file with mode: 0644]

diff --git a/swat/apps/resource/css/layout-samba.css b/swat/apps/resource/css/layout-samba.css
new file mode 100644 (file)
index 0000000..b26af84
--- /dev/null
@@ -0,0 +1,116 @@
+body{
+  font-size: 11px;
+  font-family: Arial, "Bitstream Vera Sans", Verdana, sans-serif;
+  margin: 0;
+  padding: 0;
+}
+
+p{
+  margin: 6px 0;
+}
+
+#demoHead,
+#demoFoot{
+  position: absolute;
+  left: 0px;
+  right: 0px;
+  width: 100%;
+  background: #3878cd;
+  padding: 3px 8px;
+  height: 20px;
+  color: white;
+  font-weight: bold;
+  overflow: hidden;
+  z-index: 1000000000;
+}
+
+#demoHead{
+  top: 0px;
+  height: 80px;
+}
+
+#demoHead span{
+  font-weight: normal;
+}
+
+#demoFoot{
+  bottom: 0px;
+}
+
+#demoFoot a{
+  color: white;
+}
+
+#demoFrame{
+  position: absolute;
+  top: 20px;
+  bottom: 20px;
+  right: 0;
+  width: 280px;
+  background: #fff;
+  border-left: 10px solid #3878cd;
+  z-index: 1000000000;
+}
+
+#demoDebug{
+  position: absolute;
+  top: 104px;
+  bottom: 24px;
+  right: 4px;
+  width: 266px;
+  font-size: 10px;
+  font-family: "Bitstream Vera Sans Mono", "Courier New", "Courier", monospace;
+  z-index: 1000000102;
+}
+
+#demoDebug .log-body{
+  overflow: auto;
+  position: absolute;
+  top: 30px;
+  bottom: 0px;
+  width: 266px;
+  padding: 4px;
+}
+
+#demoDebug .log-debug{
+  color: gray;
+  padding-left: 6px;
+}
+
+#demoDebug .log-info{
+  background: #DFEBFD;
+  padding-left: 6px;
+}
+
+#demoDebug .log-warn{
+  background: #F5FAAD;
+  padding-left: 6px;
+}
+
+#demoDebug .log-error{
+  background: #D2623E;
+  color: black;
+  padding-left: 6px;
+}
+
+#demoDebug .log-group{
+  margin-top: 4px;
+  margin-bottom: 1px;
+  text-decoration: underline;
+}
+
+#demoDebug .log-head{
+  padding: 8px 2px 4px;
+}
+
+#demoDebug .log-head button{
+  border: 1px solid #335EA8;
+  margin: 0 2px;
+  font-size: 11px;
+  background: #EBE9ED;
+  font-family: Tahoma, Verdana, sans-serif;
+}
+
+#demoDebug .log-head button{
+  visibility: visible;
+}
diff --git a/swat/apps/resource/css/layout-samba_ie.css b/swat/apps/resource/css/layout-samba_ie.css
new file mode 100644 (file)
index 0000000..70de91b
--- /dev/null
@@ -0,0 +1,11 @@
+#demoFrame{
+  height: expression(document.body.offsetHeight - 40);
+}
+
+#demoDebug{
+  height: expression(document.body.offsetHeight - 184);
+}
+
+#demoDebug .log-body{
+  height: expression(document.body.offsetHeight - 214);
+}
index 9c959e86c4166c3b0dc51dc9c45f5f1ff3bf95b8..71ab62e559d89c4303b5e5ca625b2beae7ec5249 100644 (file)
@@ -1,22 +1,24 @@
 <html>
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-  <title>qooxdoo &raquo; Demo</title>
-  <link type="text/css" rel="stylesheet" href="../../resource/css/layout.css"/>
+  <title>ldbbrowse</title>
+  <link type="text/css" rel="stylesheet" href="../../resource/css/layout-samba.css"/>
   <!--[if IE]>
   <link
-   type="text/css" rel="stylesheet" href="../../resource/css/layout_ie.css"/>
+   type="text/css" rel="stylesheet" href="../../resource/css/layout-samba_ie.css"/>
   <![endif]-->
   <script type="text/javascript" src="../../script/qx.js"></script>
 </head>
 <body>
-  <script type="text/javascript" src="../../script/layout.js"></script>
+  <script type="text/javascript" src="../../script/layout-samba.js"></script>
 
+<div style="position: absolute; background-color: transparent; right:0; top:0; z-index: 1000000001;">
+     <img src="../../../images/logo.png">
+</div>
+<div id="demoHead">
+     ldbbrowse
+</div>
 
-  <div id="demoDescription">
-    <p>
-    A simple LDB browser.
-  </div>
 
 <script type="text/javascript">
 
@@ -24,6 +26,9 @@
 // object
 globals = new Object();
 
+// Name of database to use
+globals.dbFile = "sam.ldb";
+
 // No database is yet open
 globals.dbHandle = null;
         
@@ -66,7 +71,7 @@ function setupTabs(clientDocument)
     var tabView_ = new qx.ui.pageview.tabview.TabView;
     tabView_.set(
         {
-            top: 40,
+            top: 100,
             left: 20,
             right: 300,
             bottom: 30
@@ -364,7 +369,7 @@ function buildPageBrowse(page)
     splitpane.setEdge(0);
 
     // Create a tree row structure for the tree root
-    var trs = qx.ui.treefullcontrol.TreeRowStructure.getInstance().standard("sam.ldb");
+    var trs = qx.ui.treefullcontrol.TreeRowStructure.getInstance().standard(globals.dbFile);
 
     // Create the tree and set its characteristics
     var tree = new qx.ui.treefullcontrol.Tree(trs);
@@ -690,7 +695,7 @@ qx.core.Init.getInstance().defineMain(
         try
         {
             // Database handle
-            globals.dbHandle = rpc.callSync("connect", "sam.ldb");
+            globals.dbHandle = rpc.callSync("connect", globals.dbFile);
         }
         catch (ex)
         {
diff --git a/swat/apps/script/layout-samba.js b/swat/apps/script/layout-samba.js
new file mode 100644 (file)
index 0000000..fe15809
--- /dev/null
@@ -0,0 +1,15 @@
+(function()
+{
+  document.write('<div id="demoFoot">');
+  document.write('</div>');
+
+  document.write('<div id="demoDebug">');
+  document.write('</div>');
+  
+  document.write('<div id="demoFrame">');
+  document.write('&#160;');
+  document.write('</div>');
+
+  qx.dev.log.Logger.ROOT_LOGGER.removeAllAppenders();
+  qx.dev.log.Logger.ROOT_LOGGER.addAppender(new qx.dev.log.DivAppender("demoDebug"));
+})();