mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 10:46:24 +00:00
add 'make directory' button to webish
This commit is contained in:
parent
5c4b04e615
commit
b8ad3da5e5
@ -37,16 +37,31 @@ class Welcome(rend.Page):
|
||||
addSlash = True
|
||||
docFactory = getxmlfile("welcome.xhtml")
|
||||
|
||||
class IUpload(annotate.TypedInterface):
|
||||
class IDirectoryEditor(annotate.TypedInterface):
|
||||
def upload(contents=annotate.FileUpload(label="Choose a file to upload: ",
|
||||
required=True,
|
||||
requiredFailMessage="Do iT!"),
|
||||
ctx=annotate.Context(),
|
||||
):
|
||||
# Each method gets a box. The string in the autocallable(action=)
|
||||
# argument is put on the border of the box, as well as in the submit
|
||||
# button. The top-most contents of the box are the method's
|
||||
# docstring, if any. Each row contains a string for the argument
|
||||
# followed by the argument's input box. If you do not provide an
|
||||
# action= argument to autocallable, the method name is capitalized
|
||||
# and used instead.
|
||||
#"""Upload a file"""
|
||||
pass
|
||||
upload = annotate.autocallable(upload, action="Upload file")
|
||||
|
||||
def mkdir(name=annotate.String("Create a new directory named: ",
|
||||
required=True,
|
||||
requiredFailMessage="You must choose a directory"),
|
||||
):
|
||||
#"""Create a directory."""
|
||||
pass
|
||||
mkdir = annotate.autocallable(mkdir, action="Make directory")
|
||||
|
||||
class Directory(rend.Page):
|
||||
addSlash = True
|
||||
docFactory = getxmlfile("directory.xhtml")
|
||||
@ -104,7 +119,7 @@ class Directory(rend.Page):
|
||||
|
||||
# this tells formless about what functions can be invoked, giving it
|
||||
# enough information to construct form contents
|
||||
implements(IUpload)
|
||||
implements(IDirectoryEditor)
|
||||
|
||||
child_webform_css = webform.defaultCSS
|
||||
def render_forms(self, ctx, data):
|
||||
@ -127,6 +142,15 @@ class Directory(rend.Page):
|
||||
return url.here.add("results",
|
||||
"upload of '%s' complete!" % contents.filename)
|
||||
|
||||
def mkdir(self, name):
|
||||
log.msg("making new webish directory")
|
||||
d = self._dirnode.callRemote("add_directory", name)
|
||||
def _done(res):
|
||||
log.msg("webish mkdir complete")
|
||||
return res
|
||||
d.addCallback(_done)
|
||||
return d
|
||||
|
||||
class WebDownloadTarget:
|
||||
implements(IDownloadTarget)
|
||||
def __init__(self, req):
|
||||
|
Loading…
Reference in New Issue
Block a user