mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-01 18:56:41 +00:00
fix rename-form
This commit is contained in:
parent
d12078abe2
commit
e2304326fd
@ -234,7 +234,10 @@ class DirectoryNodeHandler(ReplaceMeMixin, Resource, object):
|
|||||||
if t == "readonly-uri":
|
if t == "readonly-uri":
|
||||||
return DirectoryReadonlyURI(req, self.node)
|
return DirectoryReadonlyURI(req, self.node)
|
||||||
if t == 'rename-form':
|
if t == 'rename-form':
|
||||||
return RenameForm(self.node)
|
return renderElement(
|
||||||
|
req,
|
||||||
|
RenameForm(self.node),
|
||||||
|
)
|
||||||
|
|
||||||
raise WebError("GET directory: bad t=%s" % t)
|
raise WebError("GET directory: bad t=%s" % t)
|
||||||
|
|
||||||
@ -877,6 +880,12 @@ class DirectoryAsHTML(Element):
|
|||||||
def forms(self, req, data):
|
def forms(self, req, data):
|
||||||
forms = []
|
forms = []
|
||||||
|
|
||||||
|
# making this consistent with the other forms, and also
|
||||||
|
# because action="." doesn't get us back to the dir page (but
|
||||||
|
# instead /uri itself)
|
||||||
|
root = get_root(req)
|
||||||
|
here = "{}/uri/{}/".format(root, urllib.quote(self.node.get_uri()))
|
||||||
|
|
||||||
if self.node.is_readonly():
|
if self.node.is_readonly():
|
||||||
return tags.div("No upload forms: directory is read-only")
|
return tags.div("No upload forms: directory is read-only")
|
||||||
if self.dirnode_children is None:
|
if self.dirnode_children is None:
|
||||||
@ -918,7 +927,7 @@ class DirectoryAsHTML(Element):
|
|||||||
),
|
),
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
action=".",
|
action=here,
|
||||||
method="post",
|
method="post",
|
||||||
enctype="multipart/form-data",
|
enctype="multipart/form-data",
|
||||||
)
|
)
|
||||||
@ -977,7 +986,7 @@ class DirectoryAsHTML(Element):
|
|||||||
tags.input(type="submit", class_="btn", value="Attach"),
|
tags.input(type="submit", class_="btn", value="Attach"),
|
||||||
], class_="form-inline"),
|
], class_="form-inline"),
|
||||||
),
|
),
|
||||||
action=".",
|
action=here,
|
||||||
method="post",
|
method="post",
|
||||||
enctype="multipart/form-data",
|
enctype="multipart/form-data",
|
||||||
)
|
)
|
||||||
@ -1046,31 +1055,39 @@ def DirectoryURI(req, dirnode):
|
|||||||
def DirectoryReadonlyURI(req, dirnode):
|
def DirectoryReadonlyURI(req, dirnode):
|
||||||
return text_plain(dirnode.get_readonly_uri(), req)
|
return text_plain(dirnode.get_readonly_uri(), req)
|
||||||
|
|
||||||
class RenameForm(Element):
|
class RenameForm(Element, object):
|
||||||
addSlash = True
|
addSlash = True
|
||||||
docFactory = getxmlfile("rename-form.xhtml")
|
loader = XMLFile(FilePath(__file__).sibling("rename-form.xhtml"))
|
||||||
|
|
||||||
def render_title(self, req, data):
|
def __init__(self, original):
|
||||||
return req.tag["Directory SI=%s" % abbreviated_dirnode(self.original)]
|
self.original = original
|
||||||
|
super(RenameForm, self).__init__()
|
||||||
|
|
||||||
def render_header(self, req, data):
|
@renderer
|
||||||
header = ["Rename "
|
def title(self, req, tag):
|
||||||
"in directory SI=%s" % abbreviated_dirnode(self.original),
|
return tag("Directory SI={}".format(abbreviated_dirnode(self.original)))
|
||||||
]
|
|
||||||
|
@renderer
|
||||||
|
def header(self, req, tag):
|
||||||
|
header = [
|
||||||
|
"Rename "
|
||||||
|
"in directory SI=%s" % abbreviated_dirnode(self.original),
|
||||||
|
]
|
||||||
|
|
||||||
if self.original.is_readonly():
|
if self.original.is_readonly():
|
||||||
header.append(" (readonly!)")
|
header.append(" (readonly!)")
|
||||||
header.append(":")
|
header.append(":")
|
||||||
return req.tag[header]
|
return tag(header)
|
||||||
|
|
||||||
def render_when_done(self, req, data):
|
@renderer
|
||||||
|
def when_done(self, req, tag):
|
||||||
return tags.input(type="hidden", name="when_done", value=".")
|
return tags.input(type="hidden", name="when_done", value=".")
|
||||||
|
|
||||||
def render_get_name(self, req, data):
|
@renderer
|
||||||
|
def get_name(self, req, tag):
|
||||||
name = get_arg(req, "name", "")
|
name = get_arg(req, "name", "")
|
||||||
req.tag.attributes['value'] = name
|
tag.attributes['value'] = name
|
||||||
return req.tag
|
return tag
|
||||||
|
|
||||||
|
|
||||||
class ReloadableMonitorElement(Element):
|
class ReloadableMonitorElement(Element):
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<html xmlns:n="http://nevow.com/ns/nevow/0.1">
|
<html xmlns:t="http://twistedmatrix.com/ns/twisted.web.template/0.1">
|
||||||
<head>
|
<head>
|
||||||
<title t:render="title"></title>
|
<title t:render="title"></title>
|
||||||
<link href="/tahoe.css" rel="stylesheet" type="text/css"/>
|
<link href="/tahoe.css" rel="stylesheet" type="text/css"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user