]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
webui: merge 'move' form with 'rename' form
authorBrian Warner <warner@lothar.com>
Wed, 9 May 2012 21:18:44 +0000 (14:18 -0700)
committerBrian Warner <warner@lothar.com>
Wed, 9 May 2012 21:21:37 +0000 (14:21 -0700)
src/allmydata/test/test_web.py
src/allmydata/web/directory.py
src/allmydata/web/directory.xhtml
src/allmydata/web/move-form.xhtml [deleted file]
src/allmydata/web/rename-form.xhtml

index 7c7b0caec83282796bcec051351df6aec4d02ca8..4421ef8a71f82613b5d356f7a8295e513f25c33b 100644 (file)
@@ -1267,7 +1267,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
                                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
@@ -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)
index 112595cd6ec74e44e187107dd459cb69cbf85070..bb1d67466f516890b993ab5c227e08d43bb5b8ed 100644 (file)
@@ -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")
 
index 6c2b58002d03f26b2e5b9e54191c00c96a4e3f9d..540da00d9f801e3bd52509e9654871bb3770b2c6 100644 (file)
@@ -33,7 +33,6 @@
       <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>
 
diff --git a/src/allmydata/web/move-form.xhtml b/src/allmydata/web/move-form.xhtml
deleted file mode 100644 (file)
index 1df427c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<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>
index 97a413902af0fff7e679567b911219cb13750f28..cac8c2ac90ad77018e0c2ba8ba070b5ecf141598 100644 (file)
             <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>