]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
web/directory: add a link from readwrite directories to a read-only version, and...
authorBrian Warner <warner@allmydata.com>
Sat, 31 Jan 2009 02:32:05 +0000 (19:32 -0700)
committerBrian Warner <warner@allmydata.com>
Sat, 31 Jan 2009 02:32:05 +0000 (19:32 -0700)
src/allmydata/web/directory.py
src/allmydata/web/directory.xhtml

index dbcc34c54c1a53ce1dfb3c6c6de0cf54c6f70d12..a4c401f6024f30d4614193b80e5b0e28cdfb414c 100644 (file)
@@ -438,7 +438,7 @@ class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin):
 
 def abbreviated_dirnode(dirnode):
     u = from_string_dirnode(dirnode.get_uri())
-    return u.abbrev()
+    return u.abbrev_si()
 
 class DirectoryAsHTML(rend.Page):
     # The remainder of this class is to render the directory into
@@ -466,6 +466,14 @@ class DirectoryAsHTML(rend.Page):
         link = get_root(ctx)
         return T.div[T.a(href=link)["Return to Welcome page"]]
 
+    def render_show_readonly(self, ctx, data):
+        if self.node.is_readonly():
+            return ""
+        rocap = self.node.get_readonly_uri()
+        root = get_root(ctx)
+        uri_link = "%s/uri/%s/" % (root, urllib.quote(rocap))
+        return ctx.tag[T.a(href=uri_link)["Read-Only Version"]]
+
     def data_children(self, ctx, data):
         d = self.node.list()
         d.addCallback(lambda dict: sorted(dict.items()))
index f8635a5d6ef7c1ae5ef9c5dd7310b3fa8cd6607d..8911e255e2473b7a299c3b073264807005b1ca8c 100644 (file)
@@ -15,6 +15,7 @@
 <div n:render="welcome" />
 
 <div><a href="?t=info">More info on this directory</a></div>
+<div n:render="show_readonly" />
 
 <div>
 <table n:render="sequence" n:data="children" border="1">