From 0ed6260a3c1bf67b25557a0dd759777196b962cb Mon Sep 17 00:00:00 2001
From: Marcus Wanner <marcus@wanners.net>
Date: Thu, 17 Nov 2011 21:49:23 +0000
Subject: [PATCH] 1585-webui.darcs.patch

---
 src/allmydata/test/test_web.py                     |  2 +-
 src/allmydata/web/check-and-repair-results.xhtml   |  3 +--
 src/allmydata/web/check-results.xhtml              |  3 +--
 .../web/deep-check-and-repair-results.xhtml        |  3 +--
 src/allmydata/web/deep-check-results.xhtml         |  3 +--
 src/allmydata/web/directory.xhtml                  |  3 +--
 src/allmydata/web/download-status-timeline.xhtml   |  3 +--
 src/allmydata/web/download-status.xhtml            |  3 +--
 src/allmydata/web/helper.xhtml                     |  3 +--
 src/allmydata/web/info.xhtml                       |  3 +--
 src/allmydata/web/literal-check-results.xhtml      |  3 +--
 src/allmydata/web/manifest.xhtml                   |  2 +-
 src/allmydata/web/map-update-status.xhtml          |  3 +--
 src/allmydata/web/provisioning.xhtml               |  3 +--
 src/allmydata/web/publish-status.xhtml             |  3 +--
 src/allmydata/web/reliability.xhtml                |  3 +--
 src/allmydata/web/rename-form.xhtml                |  3 +--
 src/allmydata/web/retrieve-status.xhtml            |  3 +--
 src/allmydata/web/root.py                          | 14 ++++----------
 src/allmydata/web/{ => static}/d3-2.4.6.min.js     |  0
 .../web/{ => static}/d3-2.4.6.time.min.js          |  0
 .../web/{ => static}/download_status_timeline.js   |  0
 src/allmydata/web/{ => static}/jquery-1.6.1.min.js |  0
 src/allmydata/web/{ => static}/tahoe.css           |  0
 src/allmydata/web/statistics.xhtml                 |  3 +--
 src/allmydata/web/status.xhtml                     |  2 +-
 src/allmydata/web/storage_status.xhtml             |  1 -
 src/allmydata/web/upload-results.xhtml             |  3 +--
 src/allmydata/web/upload-status.xhtml              |  3 +--
 src/allmydata/web/welcome.xhtml                    |  3 +--
 30 files changed, 27 insertions(+), 54 deletions(-)
 rename src/allmydata/web/{ => static}/d3-2.4.6.min.js (100%)
 rename src/allmydata/web/{ => static}/d3-2.4.6.time.min.js (100%)
 rename src/allmydata/web/{ => static}/download_status_timeline.js (100%)
 rename src/allmydata/web/{ => static}/jquery-1.6.1.min.js (100%)
 rename src/allmydata/web/{ => static}/tahoe.css (100%)

diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py
index dc7ab9ea..efa89c0f 100644
--- a/src/allmydata/test/test_web.py
+++ b/src/allmydata/test/test_web.py
@@ -1276,7 +1276,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
         return d
 
     def test_CSS_FILE(self):
-        d = self.GET("/tahoe_css", followRedirect=True)
+        d = self.GET("/tahoe.css", followRedirect=True)
         def _check(res):
             CSS_STYLE=re.compile('toolbar\s{.+text-align:\scenter.+toolbar-item.+display:\sinline',re.DOTALL)
             self.failUnless(CSS_STYLE.search(res), res)
diff --git a/src/allmydata/web/check-and-repair-results.xhtml b/src/allmydata/web/check-and-repair-results.xhtml
index 6d27af6f..c8476199 100644
--- a/src/allmydata/web/check-and-repair-results.xhtml
+++ b/src/allmydata/web/check-and-repair-results.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Check Results</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
diff --git a/src/allmydata/web/check-results.xhtml b/src/allmydata/web/check-results.xhtml
index 06e527d3..9d9c53b0 100644
--- a/src/allmydata/web/check-results.xhtml
+++ b/src/allmydata/web/check-results.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Check Results</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
diff --git a/src/allmydata/web/deep-check-and-repair-results.xhtml b/src/allmydata/web/deep-check-and-repair-results.xhtml
index 7dd1793a..e52a06e4 100644
--- a/src/allmydata/web/deep-check-and-repair-results.xhtml
+++ b/src/allmydata/web/deep-check-and-repair-results.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Deep Check Results</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <meta n:render="refresh" />
   </head>
diff --git a/src/allmydata/web/deep-check-results.xhtml b/src/allmydata/web/deep-check-results.xhtml
index 6b0f81b8..91f86223 100644
--- a/src/allmydata/web/deep-check-results.xhtml
+++ b/src/allmydata/web/deep-check-results.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Deep Check Results</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <meta n:render="refresh" />
   </head>
diff --git a/src/allmydata/web/directory.xhtml b/src/allmydata/web/directory.xhtml
index 4875738d..4bcee9aa 100644
--- a/src/allmydata/web/directory.xhtml
+++ b/src/allmydata/web/directory.xhtml
@@ -1,7 +1,6 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1"><head>
   <title n:render="title"></title>
-  <link href="/webform_css" rel="stylesheet" type="text/css"/>
-  <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
+  <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 </head><body class="tahoe-directory-page">
 
diff --git a/src/allmydata/web/download-status-timeline.xhtml b/src/allmydata/web/download-status-timeline.xhtml
index 0a7002c1..1f36d219 100644
--- a/src/allmydata/web/download-status-timeline.xhtml
+++ b/src/allmydata/web/download-status-timeline.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>AllMyData - Tahoe - File Download Status Timeline</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <script type="text/javascript" src="/jquery-1.6.1.min.js"></script>
     <script type="text/javascript" src="/d3-2.4.6.min.js"></script>
diff --git a/src/allmydata/web/download-status.xhtml b/src/allmydata/web/download-status.xhtml
index b3560ed7..5ee3c8bf 100644
--- a/src/allmydata/web/download-status.xhtml
+++ b/src/allmydata/web/download-status.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - File Download Status</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
diff --git a/src/allmydata/web/helper.xhtml b/src/allmydata/web/helper.xhtml
index 05f185e2..b3c6c26f 100644
--- a/src/allmydata/web/helper.xhtml
+++ b/src/allmydata/web/helper.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Helper Status</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
diff --git a/src/allmydata/web/info.xhtml b/src/allmydata/web/info.xhtml
index 0c82064e..dcc8b39d 100644
--- a/src/allmydata/web/info.xhtml
+++ b/src/allmydata/web/info.xhtml
@@ -1,7 +1,6 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1"><head>
   <title n:render="title"></title>
-  <link href="/webform_css" rel="stylesheet" type="text/css"/>
-  <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
+  <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
 </head><body>
diff --git a/src/allmydata/web/literal-check-results.xhtml b/src/allmydata/web/literal-check-results.xhtml
index aa117982..ee990dfb 100644
--- a/src/allmydata/web/literal-check-results.xhtml
+++ b/src/allmydata/web/literal-check-results.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Check Results</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
diff --git a/src/allmydata/web/manifest.xhtml b/src/allmydata/web/manifest.xhtml
index ecc6e0cc..5c53360a 100644
--- a/src/allmydata/web/manifest.xhtml
+++ b/src/allmydata/web/manifest.xhtml
@@ -1,7 +1,7 @@
 <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"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <meta n:render="refresh" />
   </head>
diff --git a/src/allmydata/web/map-update-status.xhtml b/src/allmydata/web/map-update-status.xhtml
index a4c1a7df..29661f62 100644
--- a/src/allmydata/web/map-update-status.xhtml
+++ b/src/allmydata/web/map-update-status.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Mutable File Servermap Update Status</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
diff --git a/src/allmydata/web/provisioning.xhtml b/src/allmydata/web/provisioning.xhtml
index 1217bf9c..d28c4e29 100644
--- a/src/allmydata/web/provisioning.xhtml
+++ b/src/allmydata/web/provisioning.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Provisioning Tool</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
diff --git a/src/allmydata/web/publish-status.xhtml b/src/allmydata/web/publish-status.xhtml
index 38e6dacb..f8b2b1c1 100644
--- a/src/allmydata/web/publish-status.xhtml
+++ b/src/allmydata/web/publish-status.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Mutable File Publish Status</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
diff --git a/src/allmydata/web/reliability.xhtml b/src/allmydata/web/reliability.xhtml
index 795bf623..bc06805f 100644
--- a/src/allmydata/web/reliability.xhtml
+++ b/src/allmydata/web/reliability.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Reliability Tool</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
diff --git a/src/allmydata/web/rename-form.xhtml b/src/allmydata/web/rename-form.xhtml
index 55399a34..b29b06c9 100644
--- a/src/allmydata/web/rename-form.xhtml
+++ b/src/allmydata/web/rename-form.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title n:render="title"></title>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
 
diff --git a/src/allmydata/web/retrieve-status.xhtml b/src/allmydata/web/retrieve-status.xhtml
index 4e457f47..48e9d751 100644
--- a/src/allmydata/web/retrieve-status.xhtml
+++ b/src/allmydata/web/retrieve-status.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Mutable File Retrieve Status</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
diff --git a/src/allmydata/web/root.py b/src/allmydata/web/root.py
index 3fbe5b88..6481289d 100644
--- a/src/allmydata/web/root.py
+++ b/src/allmydata/web/root.py
@@ -1,4 +1,4 @@
-import time
+import time, os
 
 from twisted.internet import address
 from twisted.web import http
@@ -168,21 +168,15 @@ class Root(rend.Page):
         self.child_named = FileHandler(client)
         self.child_status = status.Status(client.get_history())
         self.child_statistics = status.Statistics(client.stats_provider)
-        def f(name):
-            return nevow_File(resource_filename('allmydata.web', name))
-        self.putChild("download_status_timeline.js", f("download_status_timeline.js"))
-        self.putChild("jquery-1.6.1.min.js", f("jquery-1.6.1.min.js"))
-        self.putChild("d3-2.4.6.min.js", f("d3-2.4.6.min.js"))
-        self.putChild("d3-2.4.6.time.min.js", f("d3-2.4.6.time.min.js"))
+        static_dir = resource_filename("allmydata.web", "static")
+        for filen in os.listdir(static_dir):
+            self.putChild(filen, nevow_File(os.path.join(static_dir, filen)))
 
     def child_helper_status(self, ctx):
         # the Helper isn't attached until after the Tub starts, so this child
         # needs to created on each request
         return status.HelperStatus(self.client.helper)
 
-    child_webform_css = webform.defaultCSS
-    child_tahoe_css = nevow_File(resource_filename('allmydata.web', 'tahoe.css'))
-
     child_provisioning = provisioning.ProvisioningTool()
     if reliability.is_available():
         child_reliability = reliability.ReliabilityTool()
diff --git a/src/allmydata/web/d3-2.4.6.min.js b/src/allmydata/web/static/d3-2.4.6.min.js
similarity index 100%
rename from src/allmydata/web/d3-2.4.6.min.js
rename to src/allmydata/web/static/d3-2.4.6.min.js
diff --git a/src/allmydata/web/d3-2.4.6.time.min.js b/src/allmydata/web/static/d3-2.4.6.time.min.js
similarity index 100%
rename from src/allmydata/web/d3-2.4.6.time.min.js
rename to src/allmydata/web/static/d3-2.4.6.time.min.js
diff --git a/src/allmydata/web/download_status_timeline.js b/src/allmydata/web/static/download_status_timeline.js
similarity index 100%
rename from src/allmydata/web/download_status_timeline.js
rename to src/allmydata/web/static/download_status_timeline.js
diff --git a/src/allmydata/web/jquery-1.6.1.min.js b/src/allmydata/web/static/jquery-1.6.1.min.js
similarity index 100%
rename from src/allmydata/web/jquery-1.6.1.min.js
rename to src/allmydata/web/static/jquery-1.6.1.min.js
diff --git a/src/allmydata/web/tahoe.css b/src/allmydata/web/static/tahoe.css
similarity index 100%
rename from src/allmydata/web/tahoe.css
rename to src/allmydata/web/static/tahoe.css
diff --git a/src/allmydata/web/statistics.xhtml b/src/allmydata/web/statistics.xhtml
index b10d6793..f038ee17 100644
--- a/src/allmydata/web/statistics.xhtml
+++ b/src/allmydata/web/statistics.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Stats</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body n:data="get_stats">
diff --git a/src/allmydata/web/status.xhtml b/src/allmydata/web/status.xhtml
index d891e0d8..fef0e804 100644
--- a/src/allmydata/web/status.xhtml
+++ b/src/allmydata/web/status.xhtml
@@ -1,7 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Current Uploads/Downloads</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
diff --git a/src/allmydata/web/storage_status.xhtml b/src/allmydata/web/storage_status.xhtml
index 3133a709..3ab0ee66 100644
--- a/src/allmydata/web/storage_status.xhtml
+++ b/src/allmydata/web/storage_status.xhtml
@@ -1,7 +1,6 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - Storage Server Status</title>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
 <body>
diff --git a/src/allmydata/web/upload-results.xhtml b/src/allmydata/web/upload-results.xhtml
index 2886fc34..f9ff3f77 100644
--- a/src/allmydata/web/upload-results.xhtml
+++ b/src/allmydata/web/upload-results.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - File Uploaded</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
diff --git a/src/allmydata/web/upload-status.xhtml b/src/allmydata/web/upload-status.xhtml
index 7c5633fc..0ea9d087 100644
--- a/src/allmydata/web/upload-status.xhtml
+++ b/src/allmydata/web/upload-status.xhtml
@@ -1,8 +1,7 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1">
   <head>
     <title>Tahoe-LAFS - File Upload Status</title>
-    <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
-    <link href="/webform_css" rel="stylesheet" type="text/css"/>
+    <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   </head>
   <body>
diff --git a/src/allmydata/web/welcome.xhtml b/src/allmydata/web/welcome.xhtml
index c2b1d174..8abb3123 100644
--- a/src/allmydata/web/welcome.xhtml
+++ b/src/allmydata/web/welcome.xhtml
@@ -1,7 +1,6 @@
 <html xmlns:n="http://nevow.com/ns/nevow/0.1"><head>
   <title>Tahoe-LAFS - Welcome</title>
-  <link href="/webform_css" rel="stylesheet" type="text/css"/>
-  <link href="/tahoe_css" rel="stylesheet" type="text/css"/>
+  <link href="/tahoe.css" rel="stylesheet" type="text/css"/>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 </head><body>
 
-- 
2.45.2