You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by cm...@apache.org on 2008/04/11 23:27:06 UTC

svn commit: r647317 - in /incubator/couchdb/branches/mochiweb: ./ share/ share/www/browse/ share/www/image/ share/www/script/ share/www/style/ src/couchdb/

Author: cmlenz
Date: Fri Apr 11 14:27:02 2008
New Revision: 647317

URL: http://svn.apache.org/viewvc?rev=647317&view=rev
Log:
mochiweb branch: Merged revisions 645682-647315 via svnmerge from /incubator/couchdb/trunk

Added:
    incubator/couchdb/branches/mochiweb/share/www/browse/_compact_database.html
      - copied unchanged from r647314, incubator/couchdb/trunk/share/www/browse/_compact_database.html
    incubator/couchdb/branches/mochiweb/share/www/image/compact.gif
      - copied unchanged from r647314, incubator/couchdb/trunk/share/www/image/compact.gif
Modified:
    incubator/couchdb/branches/mochiweb/   (props changed)
    incubator/couchdb/branches/mochiweb/THANKS
    incubator/couchdb/branches/mochiweb/share/Makefile.am
    incubator/couchdb/branches/mochiweb/share/www/browse/database.html
    incubator/couchdb/branches/mochiweb/share/www/script/browse.js
    incubator/couchdb/branches/mochiweb/share/www/script/jquery.dialog.js
    incubator/couchdb/branches/mochiweb/share/www/style/layout.css
    incubator/couchdb/branches/mochiweb/src/couchdb/couch_btree.erl

Propchange: incubator/couchdb/branches/mochiweb/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Apr 11 14:27:02 2008
@@ -1 +1 @@
-/incubator/couchdb/trunk:1-645681
+/incubator/couchdb/trunk:1-647315

Modified: incubator/couchdb/branches/mochiweb/THANKS
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/THANKS?rev=647317&r1=647316&r2=647317&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/THANKS (original)
+++ incubator/couchdb/branches/mochiweb/THANKS Fri Apr 11 14:27:02 2008
@@ -10,6 +10,7 @@
  * Benoit Chesneau <bc...@gmail.com>
  * Till Klampaeckel <ti...@klampaeckel.de>
  * Roger Leigh <rl...@debian.org>
+ * Jim Lindley <we...@jimlindley.com>
  * Sam Ruby <ru...@intertwingly.net>
  * Dirk Schalge <di...@epd-me.net>
  * Carlos Valiente <su...@gmail.com>

Modified: incubator/couchdb/branches/mochiweb/share/Makefile.am
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/share/Makefile.am?rev=647317&r1=647316&r2=647317&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/share/Makefile.am (original)
+++ incubator/couchdb/branches/mochiweb/share/Makefile.am Fri Apr 11 14:27:02 2008
@@ -14,6 +14,7 @@
 
 nobase_dist_pkgdata_DATA = \
     server/main.js \
+    www/browse/_compact_database.html \
     www/browse/_create_database.html \
     www/browse/_create_document.html \
     www/browse/_delete_database.html \
@@ -28,6 +29,7 @@
     www/image/apply.gif \
     www/image/bg.png \
     www/image/cancel.gif \
+    www/image/compact.gif \
     www/image/delete-mini.gif \
     www/image/delete.gif \
     www/image/grippie.gif \

Modified: incubator/couchdb/branches/mochiweb/share/www/browse/database.html
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/share/www/browse/database.html?rev=647317&r1=647316&r2=647317&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/share/www/browse/database.html [utf-8] (original)
+++ incubator/couchdb/branches/mochiweb/share/www/browse/database.html [utf-8] Fri Apr 11 14:27:02 2008
@@ -78,6 +78,7 @@
           $.cookies.set(page.dbName + ".perpage", this.value);
         });
         $("#toolbar button.add").click(page.addDocument);
+        $("#toolbar button.compact").click(page.compactDatabase);
         $("#toolbar button.delete").click(page.deleteDatabase);
       });
     </script>
@@ -98,6 +99,7 @@
       </div>
       <ul id="toolbar">
         <li><button class="add">Create Document …</button></li>
+        <li><button class="compact">Compact Database</button></li>
         <li><button class="delete">Delete Database</button></li>
       </ul>
 

Modified: incubator/couchdb/branches/mochiweb/share/www/script/browse.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/share/www/script/browse.js?rev=647317&r1=647316&r2=647317&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/share/www/script/browse.js [utf-8] (original)
+++ incubator/couchdb/branches/mochiweb/share/www/script/browse.js [utf-8] Fri Apr 11 14:27:02 2008
@@ -58,10 +58,11 @@
   var urlParts = location.search.substr(1).split("/");
   var dbName = urlParts.shift();
   var viewName = (urlParts.length > 0) ? urlParts.join("/") : null;
-  if (!viewName) {
-    viewName = $.cookies.get(dbName + ".view") || "";
-  } else {
+  if (viewName) {
+    viewName = decodeURIComponent(viewName);
     $.cookies.set(dbName + ".view", viewName);
+  } else {
+    viewName = $.cookies.get(dbName + ".view") || "";
   }
   var db = new CouchDB(dbName);
 
@@ -84,6 +85,14 @@
     });
   }
 
+  this.compactDatabase = function() {
+    $.showDialog("_compact_database.html", {
+      submit: function() {
+        db.compact();
+      }
+    });
+  }
+
   this.deleteDatabase = function() {
     $.showDialog("_delete_database.html", {
       submit: function() {
@@ -368,7 +377,7 @@
   var urlParts = location.search.substr(1).split("/");
   var dbName = urlParts.shift();
   var idParts = urlParts.join("/").split("@", 2);
-  var docId = idParts[0];
+  var docId = decodeURIComponent(idParts[0]);
   var docRev = (idParts.length > 1) ? idParts[1] : null;
   var db = new CouchDB(dbName);
   var doc = db.open(docId, {revs_info: true});

Modified: incubator/couchdb/branches/mochiweb/share/www/script/jquery.dialog.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/share/www/script/jquery.dialog.js?rev=647317&r1=647316&r2=647317&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/share/www/script/jquery.dialog.js [utf-8] (original)
+++ incubator/couchdb/branches/mochiweb/share/www/script/jquery.dialog.js [utf-8] Fri Apr 11 14:27:02 2008
@@ -76,7 +76,7 @@
             data[field.name] = field.value;
           });
           var errors = options.submit(data);
-          if (errors == {}) {
+          if (errors == null || errors == {}) {
             dismiss();
           } else {
             for (var name in errors) {

Modified: incubator/couchdb/branches/mochiweb/share/www/style/layout.css
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/share/www/style/layout.css?rev=647317&r1=647316&r2=647317&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/share/www/style/layout.css (original)
+++ incubator/couchdb/branches/mochiweb/share/www/style/layout.css Fri Apr 11 14:27:02 2008
@@ -179,6 +179,7 @@
 #toolbar button:hover { background-position: 2px -30px; color: #000; }
 #toolbar button:active { background-position: 2px -62px; color: #000; }
 #toolbar button.add { background-image: url(../image/add.gif); }
+#toolbar button.compact { background-image: url(../image/compact.gif); }
 #toolbar button.delete { background-image: url(../image/delete.gif); }
 #toolbar button.edit { background-image: url(../image/edit.gif); }
 #toolbar button.load { background-image: url(../image/load.gif); }

Modified: incubator/couchdb/branches/mochiweb/src/couchdb/couch_btree.erl
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/mochiweb/src/couchdb/couch_btree.erl?rev=647317&r1=647316&r2=647317&view=diff
==============================================================================
--- incubator/couchdb/branches/mochiweb/src/couchdb/couch_btree.erl (original)
+++ incubator/couchdb/branches/mochiweb/src/couchdb/couch_btree.erl Fri Apr 11 14:27:02 2008
@@ -289,17 +289,20 @@
     ],
     {ok, ResultList, Bt}.
 
+
 modify_kpnode(Bt, KPs, [], ResultNode, QueryOutput) ->
     % processed all queries for the current tree
     {ok, lists:reverse(ResultNode, KPs), QueryOutput, Bt};
 
+modify_kpnode(Bt, [], Actions, [], QueryOutput) ->
+    modify_node(Bt, nil, Actions, QueryOutput);
+
 modify_kpnode(Bt, [], Actions, [{_Key, PointerInfo} | ResultNode], QueryOutput) ->
     {ok, ChildKPs, QueryOutput2, Bt2} = modify_node(Bt, PointerInfo, Actions, QueryOutput),
     {ok, lists:reverse(ResultNode, ChildKPs), QueryOutput2, Bt2};
 
 modify_kpnode(Bt, [{Key,PointerInfo} | RestKPs], Actions, ResultNode, QueryOutput) ->
-    % Split the actions into two lists, queries of values less
-    % than equals, and greater than the current key
+    % Split the actions into two lists, queries of values <= and > than the current key
     SplitFun = fun({_ActionType, ActionKey, _ActionValue}) ->
             not less(Bt, Key, ActionKey)
         end,