couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cml...@apache.org
Subject svn commit: r647923 - in /incubator/couchdb/branches/futon-async/share/www/script: browse.js jquery.couch.js
Date Mon, 14 Apr 2008 18:35:33 GMT
Author: cmlenz
Date: Mon Apr 14 11:35:31 2008
New Revision: 647923

URL: http://svn.apache.org/viewvc?rev=647923&view=rev
Log:
futon-async branch: more URL encoding fixes, and more meaningful default error messages.

Modified:
    incubator/couchdb/branches/futon-async/share/www/script/browse.js
    incubator/couchdb/branches/futon-async/share/www/script/jquery.couch.js

Modified: incubator/couchdb/branches/futon-async/share/www/script/browse.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/futon-async/share/www/script/browse.js?rev=647923&r1=647922&r2=647923&view=diff
==============================================================================
--- incubator/couchdb/branches/futon-async/share/www/script/browse.js [utf-8] (original)
+++ incubator/couchdb/branches/futon-async/share/www/script/browse.js [utf-8] Mon Apr 14 11:35:31
2008
@@ -273,7 +273,9 @@
               success: function(resp) {
                 callback();
                 page.isDirty = false;
-                location.href = "database.html?" + dbName + "/" + doc._id + "/" + data.name;
+                location.href = "database.html?" + encodeURIComponent(dbName) +
+                  "/" + encodeURIComponent(doc._id) +
+                  "/" + encodeURIComponent(data.name);
               }
             });
           }
@@ -295,6 +297,7 @@
     var viewNameParts = viewName.split("/");
     var designDocId = viewNameParts[1];
     var localViewName = viewNameParts[2];
+    $(document.body).addClass("loading");
     db.openDoc(["_design", designDocId].join("/"), {
       success: function(doc) {
         doc.views[localViewName] = $("#viewcode textarea").val();
@@ -303,6 +306,7 @@
             page.isDirty = false;
             $("#viewcode button.revert, #viewcode button.save")
               .attr("disabled", "disabled");
+            $(document.body).removeClass("loading");
           }
         });
       }
@@ -312,7 +316,8 @@
   this.updateDesignDocLink = function() {
     if (viewName && /^_design/.test(viewName)) {
       var docId = "_design/" + viewName.split("/")[1];
-      $("#designdoc-link").attr("href", "document.html?" + dbName + "/" + docId).text(docId);
+      $("#designdoc-link").attr("href", "document.html?" +
+        encodeURIComponent(dbName) + "/" + encodeURIComponent(docId)).text(docId);
     } else {
       $("#designdoc-link").removeAttr("href").text("");
     }
@@ -540,7 +545,7 @@
         db.removeDoc(page.doc, {
           success: function(resp) {
             callback();
-            location.href = "database.html?" + dbName;
+            location.href = "database.html?" + encodeURIComponent(dbName);
           }
         });
       }
@@ -552,7 +557,8 @@
     db.saveDoc(page.doc, {
       success: function(resp) {
         page.isDirty = false;
-        location.href = "?" + dbName + "/" + docId;
+        location.href = "?" + encodeURIComponent(dbName) +
+          "/" + encodeURIComponent(docId);
       }
     });
   }

Modified: incubator/couchdb/branches/futon-async/share/www/script/jquery.couch.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/branches/futon-async/share/www/script/jquery.couch.js?rev=647923&r1=647922&r2=647923&view=diff
==============================================================================
--- incubator/couchdb/branches/futon-async/share/www/script/jquery.couch.js [utf-8] (original)
+++ incubator/couchdb/branches/futon-async/share/www/script/jquery.couch.js [utf-8] Mon Apr
14 11:35:31 2008
@@ -24,7 +24,8 @@
           } else if (options.error) {
             options.error(req.status, resp.error, resp.reason);
           } else {
-            alert(resp.reason);
+            alert("An error occurred retrieving the list of all databases: " +
+              resp.reason);
           }
         }
       });
@@ -45,7 +46,7 @@
               } else if (options.error) {
                 options.error(req.status, resp.error, resp.reason);
               } else {
-                alert(resp.reason);
+                alert("The database could not be compacted: " + resp.reason);
               }
             }
           });
@@ -60,7 +61,7 @@
               } else if (options.error) {
                 options.error(req.status, resp.error, resp.reason);
               } else {
-                alert(resp.reason);
+                alert("The database could not be created: " + resp.reason);
               }
             }
           });
@@ -75,7 +76,7 @@
               } else if (options.error) {
                 options.error(req.status, resp.error, resp.reason);
               } else {
-                alert(resp.reason);
+                alert("The database could not be deleted: " + resp.reason);
               }
             }
           });
@@ -90,7 +91,8 @@
               } else  if (options.error) {
                 options.error(req.status, resp.error, resp.reason);
               } else {
-                alert(resp.reason);
+                alert("Database information could not be retrieved: " +
+                  resp.reason);
               }
             }
           });
@@ -106,7 +108,8 @@
               } else if (options.error) {
                 options.error(req.status, resp.error, resp.reason);
               } else {
-                alert(resp.reason);
+                alert("An error occurred retrieving a list of all documents: " +
+                  resp.reason);
               }
             },
           });
@@ -123,7 +126,7 @@
               } else if (options.error) {
                 options.error(req.status, resp.error, resp.reason);
               } else {
-                alert(resp.reason);
+                alert("The document could not be retrieved: " + resp.reason);
               }
             }
           });
@@ -149,7 +152,7 @@
               } else if (options.error) {
                 options.error(req.status, resp.error, resp.reason);
               } else {
-                alert(resp.reason);
+                alert("The document could not be saved: " + resp.reason);
               }
             }
           });
@@ -157,7 +160,7 @@
         removeDoc: function(doc, options) {
           $.ajax({
             type: "DELETE",
-            url: this.uri + encodeURIComponent(docId) + encodeOptions({rev: doc._rev}),
+            url: this.uri + encodeURIComponent(doc._id) + encodeOptions({rev: doc._rev}),
             dataType: "json",
             complete: function(req) {
               var resp = $.httpData(req, "json");
@@ -166,7 +169,7 @@
               } else if (options.error) {
                 options.error(req.status, resp.error, resp.reason);
               } else {
-                alert(resp.reason);
+                alert("The document could not be deleted: " + resp.reason);
               }
             }
           });
@@ -184,7 +187,7 @@
               } else if (options.error) {
                 options.error(req.status, resp.error, resp.reason);
               } else {
-                alert(resp.reason);
+                alert("An error occurred querying the database: " + resp.reason);
               }
             }
           });
@@ -200,7 +203,7 @@
               } else if (options.error) {
                 options.error(req.status, resp.error, resp.reason);
               } else {
-                alert(resp.reason);
+                alert("An error occurred accessing the view: " + resp.reason);
               }
             }
           });
@@ -218,7 +221,7 @@
           } else if (options.error) {
             options.error(req.status, resp.error, resp.reason);
           } else {
-            alert(resp.reason);
+            alert("Server information could not be retrieved: " + resp.reason);
           }
         }
       });



Mime
View raw message