r'\s+<td align="right">%d</td>' % len(self.BAR_CONTENTS),
])
self.failUnless(re.search(get_bar, res), res)
- for label in ['unlink', 'rename', 'move']:
+ for label in ['unlink', 'rename/move']:
for line in res.split("\n"):
# find the line that contains the relevant button for bar.txt
if ("form action" in line and
self.failUnlessIn('method="post"', line)
break
else:
- self.fail("unable to find '%s bar.txt' line" % (label,), res)
+ self.fail("unable to find '%s bar.txt' line" % (label,))
# the DIR reference just points to a URI
sub_url = ("%s/uri/%s/" % (ROOT, urllib.quote(self._sub_uri)))
d.addCallback(_check)
return d
- def test_GET_move_form(self):
- d = self.GET(self.public_url + "/foo?t=move-form&name=bar.txt",
- followRedirect=True)
- def _check(res):
- self.failUnless('name="when_done" value="."' in res, res)
- self.failUnless(re.search(r'name="from_name" value="bar\.txt"', res))
- d.addCallback(_check)
- return d
-
def log(self, res, msg):
#print "MSG: %s RES: %s" % (msg, res)
log.msg(msg)
return DirectoryReadonlyURI(ctx, self.node)
if t == 'rename-form':
return RenameForm(self.node)
- if t == 'move-form':
- return MoveForm(self.node)
raise WebError("GET directory: bad t=%s" % t)
if self.node.is_unknown() or self.node.is_readonly():
unlink = "-"
rename = "-"
- move = "-"
else:
# this creates a button which will cause our _POST_unlink method
# to be invoked, which unlinks the file and then redirects the
T.input(type='hidden', name='t', value='rename-form'),
T.input(type='hidden', name='name', value=name),
T.input(type='hidden', name='when_done', value="."),
- T.input(type='submit', value='rename', name="rename"),
- ]
-
- move = T.form(action=here, method="get")[
- T.input(type='hidden', name='t', value='move-form'),
- T.input(type='hidden', name='name', value=name),
- T.input(type='hidden', name='when_done', value="."),
- T.input(type='submit', value='move', name="move"),
+ T.input(type='submit', value='rename/move', name="rename"),
]
ctx.fillSlots("unlink", unlink)
ctx.fillSlots("rename", rename)
- ctx.fillSlots("move", move)
times = []
linkcrtime = metadata.get('tahoe', {}).get("linkcrtime")
ctx.tag.attributes['value'] = name
return ctx.tag
-class MoveForm(rend.Page):
- addSlash = True
- docFactory = getxmlfile("move-form.xhtml")
-
- def render_title(self, ctx, data):
- return ctx.tag["Directory SI=%s" % abbreviated_dirnode(self.original)]
-
- def render_header(self, ctx, data):
- header = ["Move "
- "from directory SI=%s" % abbreviated_dirnode(self.original),
- ]
-
- if self.original.is_readonly():
- header.append(" (readonly!)")
- header.append(":")
- return ctx.tag[header]
-
- def render_when_done(self, ctx, data):
- return T.input(type="hidden", name="when_done", value=".")
-
- def render_get_name(self, ctx, data):
- req = IRequest(ctx)
- name = get_arg(req, "name", "")
- ctx.tag.attributes['value'] = name
- return ctx.tag
-
-
class ManifestResults(rend.Page, ReloadMixin):
docFactory = getxmlfile("manifest.xhtml")
<td><n:slot name="times"/></td>
<td><n:slot name="unlink"/></td>
<td><n:slot name="rename"/></td>
- <td><n:slot name="move"/></td>
<td><n:slot name="info"/></td>
</tr>
+++ /dev/null
-<html xmlns:n="http://nevow.com/ns/nevow/0.1">
- <head>
- <title n:render="title"></title>
- <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- </head>
-
-<body>
-
-<h2 n:render="header" />
-
-<div class="freeform-form">
- <form action="." method="post" enctype="multipart/form-data">
- <fieldset>
- <legend class="freeform-form-label">Rename child</legend>
- <input type="hidden" name="t" value="move" />
- <input n:render="when_done" />
-
- Move child:
- <input type="text" name="from_name" readonly="true"
- n:render="get_name" /><br />
- to
- <input type="text" name="to_dir" /><br />
- <input checked="checked" type="radio" id="tt-name"
- value="name" name="target_type" />
- <label for="tt-name"> Subdirectory</label>
- <input type="radio" id="tt-uri" value="uri" name="target_type"/>
- <label for="tt-uri"> URI</label> <br /><br />
- New name?
- <input type="text" name="to_name" />
- <input type="submit" value="move" /><br />
- </fieldset>
- </form>
-</div>
-
-</body></html>
<input n:render="when_done" />
Rename child:
- <input type="text" name="from_name" readonly="true" n:render="get_name" />
- to
- <input type="text" name="to_name" />
+ <input type="text" name="from_name" readonly="true" n:render="get_name" /><br />
+ to name:
+ <input type="text" name="to_name" /><br />
<input type="submit" value="rename" />
</fieldset>
</form>
+
+ <form action="." method="post" enctype="multipart/form-data">
+ <fieldset>
+ <legend class="freeform-form-label">Move Child to Different Directory</legend>
+ <input type="hidden" name="t" value="move" />
+ <input n:render="when_done" />
+
+ Move child: <input type="text" name="from_name" readonly="true"
+ n:render="get_name" /><br />
+ to name: <input type="text" name="to_name" n:render="get_name"/><br />
+ in directory: <input type="text" name="to_dir" />
+ <input checked="checked" type="radio" id="tt-name"
+ value="name" name="target_type" />
+ <label for="tt-name"> Subdirectory</label>
+ <input type="radio" id="tt-uri" value="uri" name="target_type"/>
+ <label for="tt-uri"> URI</label>
+ <br />
+ <input type="submit" value="move" /><br />
+ </fieldset>
+ </form>
+
</div>
</body></html>