diff options
Diffstat (limited to '1.1.x/share/www/database.html')
-rw-r--r-- | 1.1.x/share/www/database.html | 267 |
1 files changed, 267 insertions, 0 deletions
diff --git a/1.1.x/share/www/database.html b/1.1.x/share/www/database.html new file mode 100644 index 00000000..9a9f121e --- /dev/null +++ b/1.1.x/share/www/database.html @@ -0,0 +1,267 @@ +<!DOCTYPE html> +<!-- + +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed +under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +CONDITIONS OF ANY KIND, either express or implied. See the License for the +specific language governing permissions and limitations under the License. + +--> +<html lang="en"> + <head> + <title>Browse Database</title> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> + <link rel="stylesheet" href="style/layout.css?0.11.0" type="text/css"> + <script src="script/json2.js"></script> + <script src="script/sha1.js"></script> + <script src="script/jquery.js?1.4.2"></script> + <script src="script/jquery.couch.js?0.11.0"></script> + <script src="script/jquery.dialog.js?0.11.0"></script> + <script src="script/futon.js?0.11.0"></script> + <script src="script/jquery.resizer.js?0.11.0"></script> + <script src="script/jquery.suggest.js?0.11.0"></script> + <script src="script/futon.browse.js?0.11.0"></script> + <script src="script/futon.format.js?0.11.0"></script> + <script> + var page = new $.futon.CouchDatabasePage(); + $.futon.navigation.ready(function() { + this.addDatabase(page.db.name); + this.updateSelection(location.pathname, "?" + page.db.name); + }); + + $(function() { + if (page.redirecting) return; + $("h1 strong").text(page.db.name); + var viewPath = page.viewName || "_all_docs"; + if (viewPath != "_temp_view" && viewPath != "_design_docs") { + viewPath = $.map(viewPath.split("/"), function (part) { + return encodeURIComponent(part); + }).join("/"); + + $("h1 a.raw").attr("href", "/" + encodeURIComponent(page.db.name) + + "/" + viewPath); + } + + $("#viewcode span").click(function() { + $("#viewcode").toggleClass("collapsed"); + }); + $("#viewcode button.run").click(function() { + page.updateDocumentListing(); + }); + $("#viewcode button.revert").click(function() { + page.revertViewChanges(); + }); + $("#viewcode button.save").click(function() { + page.saveViewChanges(); + }); + $("#viewcode button.saveas").click(function() { + page.saveViewAs(); + }); + $("#viewcode textarea").makeResizable({ + always: true, + grippie: $("#viewcode .bottom"), + vertical: true + }); + $("#viewcode td.map").makeResizable({ + always: true, + grippie: $("#viewcode td.splitter"), + horizontal: true + }); + + // Restore preferences/state + $("#documents thead th.key").toggleClass("desc", !!$.futon.storage.get("desc")); + var reduce = !!$.futon.storage.get("reduce"); + $("#reduce :checkbox")[0].checked = reduce; + $("#grouplevel select").val(parseInt($.futon.storage.get("group_level"))); + $("#grouplevel").toggleClass("disabled", !reduce).find("select").each(function() { + this.disabled = !reduce; + }); + + $("#perpage").val(parseInt($.futon.storage.get("per_page"))); + + var staleViews = !!$.futon.storage.get("stale"); + $("#staleviews :checkbox")[0].checked = staleViews; + + page.populateViewsMenu(); + page.populateViewEditor(); + if (page.isTempView) { + $("#viewcode").show().removeClass("collapsed").find("textarea")[0].focus(); + $("#documents").hide(); + } + + $("#switch select").change(function() { + var viewName = $(this).val(); + if (!viewName) $.futon.storage.del("view"); + location.href = "?" + encodeURIComponent(page.db.name) + + (viewName ? "/" + viewName : ""); + }); + $("#staleviews :checkbox").click(function() { + $.futon.storage.set("stale", this.checked); + }); + $("#documents thead th.key span").click(function() { + $(this).closest("th").toggleClass("desc"); + page.updateDocumentListing(); + }); + $("#grouplevel select").change(function() { + page.updateDocumentListing(); + $.futon.storage.set("group_level", this.value); + }); + $("#reduce :checkbox").click(function() { + page.updateDocumentListing(); + var cb = this; + $("#grouplevel").toggleClass("disabled", !cb.checked).find("select").each(function() { + this.disabled = !cb.checked; + }); + $.futon.storage.set("reduce", this.checked); + }); + $("#perpage").change(function() { + page.updateDocumentListing(); + $.futon.storage.set("per_page", this.value); + }); + $("#toolbar button.add").click(page.newDocument); + $("#toolbar button.compact").click(page.compactAndCleanup); + $("#toolbar button.delete").click(page.deleteDatabase); + $("#toolbar button.security").click(page.databaseSecurity); + + $('#jumpto input').suggest(function(text, callback) { + page.db.allDocs({ + limit: 10, startkey: text, endkey: text + 'zzz', + success: function(docs) { + var matches = []; + for (var i = 0; i < docs.rows.length; i++) { + if (docs.rows[i].id.indexOf(text) == 0) { + matches[i] = docs.rows[i].id; + } + } + callback(matches); + } + }); + }).keypress(function(e) { + if (e.keyCode == 13) { + page.jumpToDocument($(this).val()); + } + }); + }); + </script> + </head> + + <body><div id="wrap"> + <h1> + <a href="index.html">Overview</a> + <strong>?</strong> + <a class="raw" title="Raw view"></a> + </h1> + <div id="content"> + <div id="staleviews"> + <label>Stale views + <input name="staleviews" type="checkbox" /> + </label> + </div> + <div id="switch"> + <label>View: <select autocomplete="false"> + <option value="_all_docs">All documents</option> + <option value="_design_docs">Design documents</option> + <option value="_temp_view">Temporary view…</option> + </select></label> + </div> + <div id="jumpto"> + <label>Jump to: + <input type="text" name="docid" placeholder="Document ID" autocomplete="off" /> + </label> + </div> + <ul id="toolbar"> + <li><button class="add">New Document</button></li> + <li><button class="security">Security…</button></li> + <li><button class="compact">Compact & Cleanup…</button></li> + <li><button class="delete">Delete Database…</button></li> + </ul> + + <div id="viewcode" class="collapsed" style="display: none"> + <div class="top"> + <a id="designdoc-link"></a> + <span id="view-toggle">View Code</span> + </div> + <table summary="View functions" cellspacing="0"><tr> + <td class="code map"> + <label for="viewcode_map">Map Function:</label> + <textarea id="viewcode_map" class="map" rows="5" cols="20" spellcheck="false" wrap="off"></textarea> + </td> + <td class="splitter"></td> + <td class="code reduce"> + <label for="viewcode_reduce">Reduce Function (optional):</label> + <textarea id="viewcode_reduce" class="reduce" rows="5" cols="20" spellcheck="false" wrap="off"></textarea> + </td> + </tr></table> + <div class="bottom"> + <button class="save" type="button" disabled>Save</button> + <button class="saveas" type="button">Save As…</button> + <button class="revert" type="button" disabled>Revert</button> + <button class="run" type="button">Run</button> + <label>Language: <select id="language"></select></label> + </div> + </div> + <p id="tempwarn"> + <strong>Warning</strong>: Please note that temporary views are not + suitable for use in production, as they are really slow for any + database with more than a few dozen documents. You can use a temporary + view to experiment with view functions, but switch to a permanent view + before using them in an application. + </p> + + <table id="documents" class="listing" cellspacing="0"> + <caption>Documents</caption> + <thead> + <tr> + <th class="key"> + <label id="grouplevel"> + Grouping: <select> + <option value="0">none</option> + <option value="1">level 1</option> + <option value="2">level 2</option> + <option value="3">level 3</option> + <option value="4">level 4</option> + <option value="5">level 5</option> + <option value="6">level 6</option> + <option value="7">level 7</option> + <option value="8">level 8</option> + <option value="9">level 9</option> + <option value="100" selected>exact</option> + </select> + </label> + <span>Key</span> + </th> + <th class="value"> + <label id="reduce"><input type="checkbox" autocomplete="off" checked> Reduce</label> + Value + </th> + </tr> + </thead> + <tbody class="content"> + </tbody> + <tbody class="footer"> + <tr> + <td colspan="4"> + <div id="paging"> + <a class="prev">← Previous Page</a> | + <label>Rows per page: <select id="perpage"> + <option selected>10</option> + <option>25</option> + <option>50</option> + <option>100</option> + </select></label> | + <a class="next">Next Page →</a> + </div> + <span></span> + </td> + </tr> + </tbody> + </table> + </div> + </div></body> +</html> |