]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
webish.py: add a web page to display the manifest for any particular directory
authorBrian Warner <warner@lothar.com>
Wed, 27 Jun 2007 02:55:21 +0000 (19:55 -0700)
committerBrian Warner <warner@lothar.com>
Wed, 27 Jun 2007 02:55:21 +0000 (19:55 -0700)
src/allmydata/web/directory.xhtml
src/allmydata/web/manifest.xhtml [new file with mode: 0644]
src/allmydata/webish.py

index a4b73b7ccc07ce3056892870792c3998f245a547..b6425e315f0c12f169034bb6ec4a79bfac8f5c50 100644 (file)
@@ -13,6 +13,7 @@
 
 <div><a href=".">Refresh this view</a></div>
 <div><a href="..">Parent Directory</a></div>
+<div><a href="@manifest">Manifest for this directory</a></div>
 <div>To share this directory, paste the following URI string into an
   "Add Shared Directory" box:
   <pre class="overflow" n:render="string" n:data="share_uri" /></div>
diff --git a/src/allmydata/web/manifest.xhtml b/src/allmydata/web/manifest.xhtml
new file mode 100644 (file)
index 0000000..0e57fe6
--- /dev/null
@@ -0,0 +1,27 @@
+<html xmlns:n="http://nevow.com/ns/nevow/0.1">
+  <head>
+    <title n:render="title"></title>
+    <!-- <link href="http://www.allmydata.com/common/css/styles.css"
+          rel="stylesheet" type="text/css"/> -->
+    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  </head>
+  <body>
+
+<h1><p n:render="header"></p></h1>
+
+
+<table n:render="sequence" n:data="items" border="1">
+  <tr n:pattern="header">
+    <td>Refresh Capabilities</td>
+  </tr>
+  <tr n:pattern="item" n:render="row">
+    <td><n:slot name="refresh_capability"/></td>
+  </tr>
+
+  <tr n:pattern="empty"><td>no items in the manifest!</td></tr>
+
+</table>
+
+  </body>
+</html>
index a49fcc18c3dc5267e5dfac9747ba8c43b2fc306a..70db09509d930b4e6a5f1d9e7d3ce668364db21a 100644 (file)
@@ -114,6 +114,8 @@ class Directory(rend.Page):
     def childFactory(self, ctx, name):
         if name.startswith("freeform"): # ick
             return None
+        if name == "@manifest": # ick, this time it's my fault
+            return Manifest(self._dirnode, self._dirname)
         if self._dirname == "/":
             dirname = "/" + name
         else:
@@ -350,6 +352,24 @@ class Downloader(resource.Resource):
         self._filenode.download(WebDownloadTarget(req))
         return server.NOT_DONE_YET
 
+class Manifest(rend.Page):
+    docFactory = getxmlfile("manifest.xhtml")
+    def __init__(self, dirnode, dirname):
+        self._dirnode = dirnode
+        self._dirname = dirname
+
+    def render_title(self, ctx):
+        return T.title["Manifest of %s" % self._dirname]
+
+    def render_header(self, ctx):
+        return T.p["Manifest of %s" % self._dirname]
+
+    def data_items(self, ctx, data):
+        return self._dirnode.build_manifest()
+
+    def render_row(self, ctx, refresh_cap):
+        ctx.fillSlots("refresh_capability", refresh_cap)
+        return ctx.tag
 
 
 class Root(rend.Page):