From 1d86cd161beab42fa1d40bbf6e4d4d8f59e02153 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 26 Jun 2007 19:55:21 -0700 Subject: [PATCH] webish.py: add a web page to display the manifest for any particular directory --- src/allmydata/web/directory.xhtml | 1 + src/allmydata/web/manifest.xhtml | 27 +++++++++++++++++++++++++++ src/allmydata/webish.py | 20 ++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 src/allmydata/web/manifest.xhtml diff --git a/src/allmydata/web/directory.xhtml b/src/allmydata/web/directory.xhtml index a4b73b7c..b6425e31 100644 --- a/src/allmydata/web/directory.xhtml +++ b/src/allmydata/web/directory.xhtml @@ -13,6 +13,7 @@
Refresh this view
Parent Directory
+
Manifest for this directory
To share this directory, paste the following URI string into an "Add Shared Directory" box:
diff --git a/src/allmydata/web/manifest.xhtml b/src/allmydata/web/manifest.xhtml new file mode 100644 index 00000000..0e57fe6d --- /dev/null +++ b/src/allmydata/web/manifest.xhtml @@ -0,0 +1,27 @@ + + + + + + + + + +

+ + + + + + + + + + + + +
Refresh Capabilities
no items in the manifest!
+ + + diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py index a49fcc18..70db0950 100644 --- a/src/allmydata/webish.py +++ b/src/allmydata/webish.py @@ -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): -- 2.45.2