]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
webish: add option to export/import shared directories (always read-write)
authorBrian Warner <warner@lothar.com>
Fri, 15 Jun 2007 09:31:23 +0000 (02:31 -0700)
committerBrian Warner <warner@lothar.com>
Fri, 15 Jun 2007 09:31:23 +0000 (02:31 -0700)
src/allmydata/web/directory.xhtml
src/allmydata/webish.py

index 430223cd76807f583f068fa11d2ea2bea4bcb0a1..03f26d8df0cc1a348b1161d31ba8665785ab7c80 100644 (file)
@@ -13,6 +13,9 @@
 
 <div><a href=".">Refresh this view</a></div>
 <div><a href="..">Parent Directory</a></div>
+<div>To share this directory, paste the following FURL string into an
+  "Add Shared Directory" box:
+  <pre class="overflow" n:render="string" n:data="share_url" /></div>
 
 <table n:render="sequence" n:data="children" border="1">
   <tr n:pattern="header">
index 9671ef6be68ffbb06242bc5651a76bc15d57b495..618c34b092526cba49c584f54dcf6836fb156cf5 100644 (file)
@@ -136,6 +136,9 @@ class Directory(rend.Page):
     def render_header(self, ctx, data):
         return "Directory of '%s':" % self._dirname
 
+    def data_share_url(self, ctx, data):
+        return self._dirnode.furl
+
     def data_children(self, ctx, data):
         d = self._dirnode.list()
         return d
@@ -265,6 +268,21 @@ class Directory(rend.Page):
         d.addCallback(_done)
         return d
 
+    def bind_mount(self, ctx):
+        namearg = annotate.Argument("name",
+                                    annotate.String("Name to place incoming directory: "))
+        furlarg = annotate.Argument("furl",
+                                    annotate.String("FURL of Shared Directory"))
+        meth = annotate.Method(arguments=[namearg, furlarg],
+                               label="Add Shared Directory")
+        return annotate.MethodBinding("mount", meth,
+                                      action="Mount Shared Directory")
+
+    def mount(self, name, furl):
+        d = self._dirnode.attach_shared_directory(name, furl)
+        d.addCallback(lambda done: url.here.child(name))
+        return d
+
     def child__delete(self, ctx):
         # perform the delete, then redirect back to the directory page
         args = inevow.IRequest(ctx).args