From: Brian Warner Date: Wed, 9 May 2012 21:18:44 +0000 (-0700) Subject: webui: merge 'move' form with 'rename' form X-Git-Url: https://git.rkrishnan.org/pf/content/en/footer/legal.html?a=commitdiff_plain;h=841757914786638a5324c5c7c231edfcabff7044;p=tahoe-lafs%2Ftahoe-lafs.git webui: merge 'move' form with 'rename' form --- diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 7c7b0cae..4421ef8a 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -1267,7 +1267,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi r'\s+%d' % 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 @@ -1285,7 +1285,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi 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))) @@ -3480,15 +3480,6 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi 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) diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py index 112595cd..bb1d6746 100644 --- a/src/allmydata/web/directory.py +++ b/src/allmydata/web/directory.py @@ -169,8 +169,6 @@ class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): 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) @@ -718,7 +716,6 @@ class DirectoryAsHTML(rend.Page): 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 @@ -734,19 +731,11 @@ class DirectoryAsHTML(rend.Page): 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") @@ -1008,33 +997,6 @@ class RenameForm(rend.Page): 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") diff --git a/src/allmydata/web/directory.xhtml b/src/allmydata/web/directory.xhtml index 6c2b5800..540da00d 100644 --- a/src/allmydata/web/directory.xhtml +++ b/src/allmydata/web/directory.xhtml @@ -33,7 +33,6 @@ - diff --git a/src/allmydata/web/move-form.xhtml b/src/allmydata/web/move-form.xhtml deleted file mode 100644 index 1df427cc..00000000 --- a/src/allmydata/web/move-form.xhtml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - -

- -
-
-
- Rename child - - - - Move child: -
- to -
- - - -

- New name? - -
-
-
-
- - diff --git a/src/allmydata/web/rename-form.xhtml b/src/allmydata/web/rename-form.xhtml index 97a41390..cac8c2ac 100644 --- a/src/allmydata/web/rename-form.xhtml +++ b/src/allmydata/web/rename-form.xhtml @@ -18,12 +18,33 @@ Rename child: - - to - +
+ to name: +
+ +
+
+ Move Child to Different Directory + + + + Move child:
+ to name:
+ in directory: + + + + +
+
+
+
+