Author: dbkr
Date: 2006-03-16 02:53:32 +0000 (Thu, 16 Mar 2006)
New Revision: 8262

Removed:
   trunk/freenet/src/freenet/clients/http/CSSNameCallback.java
Modified:
   trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
   trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
   trunk/freenet/src/freenet/clients/http/FproxyToadlet.java
   trunk/freenet/src/freenet/clients/http/PageMaker.java
   trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
   trunk/freenet/src/freenet/clients/http/StaticToadlet.java
   trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java
   trunk/freenet/src/freenet/clients/http/Toadlet.java
   trunk/freenet/src/freenet/clients/http/ToadletContainer.java
   trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java
   trunk/freenet/src/freenet/clients/http/TrivialToadlet.java
   trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
   trunk/freenet/src/freenet/clients/http/staticfiles/themes/aqua/theme.css
   trunk/freenet/src/freenet/clients/http/staticfiles/themes/clean/theme.css
   trunk/freenet/src/freenet/node/Version.java
   trunk/freenet/src/freenet/pluginmanager/PproxyToadlet.java
Log:
542:
- Change theme configuration to avoid the Toadlets and set up the PageMaker 
with the correct theme in ToadletContextImpl instead.
- Make XHTML valid in ConfigToadlet, and other minor XHTML tidy-ups
- Add items to the themes for the config
- Remove meta refresh in ConfigToadlet and replaced it with a 'Goodbye' page
- Make redirects work with POST requests
- Add confirmation page to shutdown button


Deleted: trunk/freenet/src/freenet/clients/http/CSSNameCallback.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/CSSNameCallback.java 2006-03-16 
01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/CSSNameCallback.java 2006-03-16 
02:53:32 UTC (rev 8262)
@@ -1,9 +0,0 @@
-package freenet.clients.http;
-
-public interface CSSNameCallback {
-
-       public String getCSSName();
-       
-       public void setCSSName(String name);
-       
-}

Modified: trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ConfigToadlet.java   2006-03-16 
01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/ConfigToadlet.java   2006-03-16 
02:53:32 UTC (rev 8262)
@@ -18,15 +18,16 @@
 public class ConfigToadlet extends Toadlet {
        private Config config;

-       ConfigToadlet(HighLevelSimpleClient client, Config conf, 
CSSNameCallback cb) {
-               super(client, cb);
+       ConfigToadlet(HighLevelSimpleClient client, Config conf) {
+               super(client);
                config=conf;
        }

        public void handlePost(URI uri, Bucket data, ToadletContext ctx) throws 
ToadletContextClosedException, IOException {
-               StringBuffer buf = new StringBuffer();
+               StringBuffer errbuf = new StringBuffer();
                SubConfig[] sc = config.getConfigs();

+               
                if(data.size() > 1024*1024) {
                        this.writeReply(ctx, 400, "text/plain", "Too big", "Too 
much data, config servlet limited to 1MB");
                        return;
@@ -56,15 +57,34 @@
                                                try{
                                                        
o[j].setValue(request.getParam(prefix+"."+configName));
                                                }catch(Exception e){
-                                                       
buf.append(o[j].getName()+" "+e+"\n");
+                                                       
errbuf.append(o[j].getName()+" "+e+"\n");
                                                }
                                        }
                                }
                        }
                }
                config.store();
-               writeReply(ctx, 200, "text/html", "OK", mkForwardPage(ctx, 
"Applying configuration", buf.toString(), "/config/", 10));

+               StringBuffer outbuf = new StringBuffer();
+               
+               ctx.getPageMaker().makeHead(outbuf, "Configuration Applied");
+               outbuf.append("<div class=\"infobox\">\n");
+               if (errbuf.length() == 0) {
+                       outbuf.append("Your configuration changes were applied 
successfully<br />\n");
+               } else {
+                       outbuf.append("Your configuration changes were applied 
with the following exceptions:<br />\n");
+                       outbuf.append(errbuf.toString());
+                       outbuf.append("<br />\n");
+               }
+               
+               outbuf.append("<a href=\".\" title=\"Configuration\">Return to 
Node Configuration</a><br />\n");
+               outbuf.append("<a href=\"/\" title=\"Node 
Homepage\">Homepage</a>\n");
+               
+               outbuf.append("</div>\n");
+               
+               ctx.getPageMaker().makeTail(outbuf);
+               writeReply(ctx, 200, "text/html", "OK", outbuf.toString());
+               
        }

        public void handleGet(URI uri, ToadletContext ctx) throws 
ToadletContextClosedException, IOException {
@@ -72,24 +92,27 @@
                SubConfig[] sc = config.getConfigs();

                HTTPRequest request = new HTTPRequest(uri);
-               ctx.getPageMaker().makeHead(buf, "Freenet Node Configuration", 
getCSSName());
-               buf.append("<h1 class=\"title\">Node Configuration</h1>\n");
+               ctx.getPageMaker().makeHead(buf, "Freenet Node Configuration");
+               buf.append("<form method=\"post\" action=\".\">");
                buf.append("<div class=\"config\">\n");
-               buf.append("    <ul class=\"config\">\n");
-               buf.append("<form method=\"post\">");
+               
                String last = null;

                for(int i=0; i<sc.length;i++){
                        Option[] o = sc[i].getOptions();
-                       String prefix = new String(sc[i].getPrefix());
+                       //String prefix = new String(sc[i].getPrefix());

+                       /*
                        if(last == null || ! last.equalsIgnoreCase(prefix)){
-                               buf.append("</p>\n");
+                               //buf.append("</p>\n");
                                buf.append("</span>\n");
                                buf.append("<span id=\""+prefix+"\">\n");
-                               buf.append("<p>\n");
+                               //buf.append("<p>\n");
                        }
+                       */

+                       buf.append("<ul class=\"config\">\n");
+                       
                        for(int j=0; j<o.length; j++){
                                String configName = new String(o[j].getName());
                                /*
@@ -101,20 +124,20 @@

                                buf.append("<li>");
                                buf.append(o[j].getShortDesc());
-                               buf.append("<br> <i>");
-                               
buf.append(prefix+"."+configName+"</i>=&gt;<input 
alt=\""+o[j].getShortDesc()+"\" class=\"config\"" +
-                                               " type=\"text\" 
name=\""+prefix+"."+configName+"\" 
value=\""+o[j].getValueString()+"\"></li>\n");
+                               buf.append("<br /> <i>");
+                               
buf.append(sc[i].getPrefix()+"."+configName+"</i>=&gt;<input 
alt=\""+o[j].getShortDesc()+"\" class=\"config\"" +
+                                               " type=\"text\" 
name=\""+sc[i].getPrefix()+"."+configName+"\" 
value=\""+o[j].getValueString()+"\" /></li>\n");
                        }

-                       buf.append("<hr>");
+                       
+                       buf.append("</ul>\n");
                }

-               buf.append("<br>");
-               buf.append("<input type=\"submit\" value=\"Apply\">");
-               buf.append("<input type=\"reset\" value=\"Cancel\">");
+               buf.append("<br />");
+               buf.append("<input type=\"submit\" value=\"Apply\" />");
+               buf.append("<input type=\"reset\" value=\"Reset\" />");
+               buf.append("</div>\n");
                buf.append("</form>");
-               buf.append("    </ul>\n");
-               buf.append("</div>\n");

                ctx.getPageMaker().makeTail(buf);


Modified: trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java       
2006-03-16 01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/DarknetConnectionsToadlet.java       
2006-03-16 02:53:32 UTC (rev 8262)
@@ -32,8 +32,8 @@

        Node node;

-       protected DarknetConnectionsToadlet(Node n, HighLevelSimpleClient 
client, CSSNameCallback cb) {
-               super(client, cb);
+       protected DarknetConnectionsToadlet(Node n, HighLevelSimpleClient 
client) {
+               super(client);
                this.node = n;
        }

@@ -45,8 +45,7 @@
                StringBuffer buf = new StringBuffer();

                HTTPRequest request = new HTTPRequest(uri);
-               ctx.getPageMaker().makeHead(buf, "Darknet Connections", 
getCSSName());
-               buf.append("<h1 class=\"title\">Darknet Connections</h1>\n");
+               ctx.getPageMaker().makeHead(buf, "Darknet Connections");
                // FIXME! 1) Probably would be better to use CSS
                // FIXME! 2) We need some nice images
                PeerNode[] peerNodes = node.getDarknetConnections();

Modified: trunk/freenet/src/freenet/clients/http/FproxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FproxyToadlet.java   2006-03-16 
01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/FproxyToadlet.java   2006-03-16 
02:53:32 UTC (rev 8262)
@@ -26,36 +26,27 @@

 public class FproxyToadlet extends Toadlet {

-       public FproxyToadlet(HighLevelSimpleClient client, CSSNameCallback 
server) {
-               super(client, server);
+       public FproxyToadlet(HighLevelSimpleClient client) {
+               super(client);
        }

        public String supportedMethods() {
                return "GET";
        }

-       public void handlePost(URI uri, Bucket data, ToadletContext ctx) throws 
ToadletContextClosedException, IOException {
+       public void handlePost(URI uri, Bucket data, ToadletContext ctx) throws 
ToadletContextClosedException, IOException, RedirectException {
+               String ks = uri.getPath();

-               if(data.size() > 1024*1024) {
-                       this.writeReply(ctx, 400, "text/plain", "Too big", "Too 
much data, config servlet limited to 1MB");
-                       return;
+               if (ks.equals("/")) {
+                       RedirectException re = new RedirectException();
+                       try {
+                               re.newuri = new URI("/welcome/");
+                       } catch (URISyntaxException e) {
+                               // HUH!?!
+                       }
+                       throw re;
                }
-               byte[] d = BucketTools.toByteArray(data);
-               String s = new String(d, "us-ascii");
-               HTTPRequest request;
-               try {
-                       request = new HTTPRequest("/", s);
-               } catch (URISyntaxException e) {
-                       Logger.error(this, "Impossible: "+e, e);
-                       return;
-               }

-               if(request.hasParameters() && 
request.getParam("exit").equalsIgnoreCase("true")){       
-                       System.out.println("Goodbye.");
-                       writeReply(ctx, 200, "text/html", "OK", 
mkForwardPage(ctx, "Shutting down the node", "" , "/", 5));
-                       System.exit(0);
-               }
-               
        }

        public void handleGet(URI uri, ToadletContext ctx) 
@@ -127,26 +118,26 @@
                        HighLevelSimpleClient client = 
node.makeClient(RequestStarter.INTERACTIVE_PRIORITY_CLASS);

                        node.setToadletContainer(server);
-                       FproxyToadlet fproxy = new FproxyToadlet(client, 
server);
+                       FproxyToadlet fproxy = new FproxyToadlet(client);
                        node.setFproxy(fproxy);
                        server.register(fproxy, "/", false);

-                       PproxyToadlet pproxy = new PproxyToadlet(client, 
node.pluginManager, server);
+                       PproxyToadlet pproxy = new PproxyToadlet(client, 
node.pluginManager);
                        server.register(pproxy, "/plugins/", true);

-                       WelcomeToadlet welcometoadlet = new 
WelcomeToadlet(client, node, server);
+                       WelcomeToadlet welcometoadlet = new 
WelcomeToadlet(client, node);
                        server.register(welcometoadlet, "/welcome/", true);

-                       ConfigToadlet configtoadlet = new ConfigToadlet(client, 
config, server);
+                       ConfigToadlet configtoadlet = new ConfigToadlet(client, 
config);
                        server.register(configtoadlet, "/config/", true);

-                       StaticToadlet statictoadlet = new StaticToadlet(client, 
server);
+                       StaticToadlet statictoadlet = new StaticToadlet(client);
                        server.register(statictoadlet, "/static/", true);

-                       SymlinkerToadlet symlinkToadlet = new 
SymlinkerToadlet(client, server, node);
+                       SymlinkerToadlet symlinkToadlet = new 
SymlinkerToadlet(client, node);
                        server.register(symlinkToadlet, "/sl/", true);

-                       DarknetConnectionsToadlet darknetToadlet = new 
DarknetConnectionsToadlet(node, client, server);
+                       DarknetConnectionsToadlet darknetToadlet = new 
DarknetConnectionsToadlet(node, client);
                        server.register(darknetToadlet, "/darknet/", true);

                } catch (IOException ioe) {

Modified: trunk/freenet/src/freenet/clients/http/PageMaker.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PageMaker.java       2006-03-16 
01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/PageMaker.java       2006-03-16 
02:53:32 UTC (rev 8262)
@@ -18,14 +18,6 @@
                }
        }

-       public void setCSSName(String name){
-               if (name == null || !this.getThemes().contains(name)) {
-                       this.theme = this.defaulttheme;
-               } else {
-                       this.theme = name;
-               }
-       }
-
        public void makeTopHead(StringBuffer buf) {
                buf.append("<!DOCTYPE\n"
                                + "     html PUBLIC \"-//W3C//DTD XHTML 
1.1//EN\">\n"
@@ -38,7 +30,7 @@
                }
        }

-       public void makeBottomHead(StringBuffer buf, String title) {
+       public void makeBottomHead(StringBuffer buf, String title, boolean 
navbars) {
                buf.append("<title>"+title+" - Freenet</title>\n"
                                + "</head>\n"
                                + "<body>\n"
@@ -46,16 +38,24 @@
                                + "<div id=\"topbar\">\n"
                                + "<h1>"+title+"</h1>\n"
                                + "</div>\n");
-               this.makeNavBar(buf);
+               if (navbars) this.makeNavBar(buf);
                buf.append("<div id=\"content\">\n");
        }

-       public void makeHead(StringBuffer buf, String title, String CSSName) {
-               setCSSName(CSSName);
+       public void makeBottomHead(StringBuffer buf, String title) {
+               makeBottomHead(buf, title, true);
+       }
+       
+       public void makeHead(StringBuffer buf, String title) {
                makeTopHead(buf);
                makeBottomHead(buf, title);
        }

+       public void makeHead(StringBuffer buf, String title, boolean navbars) {
+               makeTopHead(buf);
+               makeBottomHead(buf, title, navbars);
+       }
+       
        public void makeTail(StringBuffer buf) {
                buf.append("<br style=\"clear: all;\"/>\n"
                                + "</div>\n"

Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2006-03-16 01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2006-03-16 02:53:32 UTC (rev 8262)
@@ -25,7 +25,7 @@
 import freenet.support.io.FilenameGenerator;
 import freenet.support.io.TempBucketFactory;

-public class SimpleToadletServer implements ToadletContainer, Runnable, 
CSSNameCallback {
+public class SimpleToadletServer implements ToadletContainer, Runnable {

        public class ToadletElement {
                public ToadletElement(Toadlet t2, String urlPrefix) {
@@ -190,7 +190,7 @@
         Logger.globalAddHook(logger);
         logger.start();
                SimpleToadletServer server = new SimpleToadletServer(1111, 
"127.0.0.1", new TempBucketFactory(new FilenameGenerator(new 
DummyRandomSource(), true, new File("temp-test"), "test-temp-")), "aqua");
-               server.register(new TrivialToadlet(null,null), "", true);
+               server.register(new TrivialToadlet(null), "", true);
                System.out.println("Bound to port 1111.");
                while(true) {
                        try {

Modified: trunk/freenet/src/freenet/clients/http/StaticToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StaticToadlet.java   2006-03-16 
01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/StaticToadlet.java   2006-03-16 
02:53:32 UTC (rev 8262)
@@ -13,8 +13,8 @@
  * Serve up static files
  */
 public class StaticToadlet extends Toadlet {
-       StaticToadlet(HighLevelSimpleClient client, CSSNameCallback CSSName) {
-               super(client, CSSName);
+       StaticToadlet(HighLevelSimpleClient client) {
+               super(client);
        }

        final String rootURL = new String("/static/");

Modified: trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java        
2006-03-16 01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java        
2006-03-16 02:53:32 UTC (rev 8262)
@@ -32,8 +32,8 @@
        private final Node node;
        SubConfig tslconfig;

-       public SymlinkerToadlet(HighLevelSimpleClient client, CSSNameCallback 
CSSName, Node node) {
-               super(client, CSSName);
+       public SymlinkerToadlet(HighLevelSimpleClient client, Node node) {
+               super(client);
                this.node = node;
                tslconfig = new SubConfig("toadletsymlinker", node.config);
                tslconfig.register("symlinks", null, 9, true, "Symlinks in 
ToadletServer", 

Modified: trunk/freenet/src/freenet/clients/http/Toadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Toadlet.java 2006-03-16 01:31:33 UTC 
(rev 8261)
+++ trunk/freenet/src/freenet/clients/http/Toadlet.java 2006-03-16 02:53:32 UTC 
(rev 8262)
@@ -32,19 +32,13 @@
  */
 public abstract class Toadlet {

-       protected Toadlet(HighLevelSimpleClient client, CSSNameCallback cb) {
+       protected Toadlet(HighLevelSimpleClient client) {
                this.client = client;
-               this.cssName = cb;
        }

-       private final CSSNameCallback cssName;
        private final HighLevelSimpleClient client;
        ToadletContainer container;

-       public final String getCSSName() {
-               return cssName.getCSSName();
-       }
-       
        /**
         * Handle a GET request.
         * If not overridden by the client, send 'Method not supported'
@@ -56,7 +50,7 @@
        public void handleGet(URI uri, ToadletContext ctx) throws 
ToadletContextClosedException, IOException, RedirectException {
                StringBuffer buf = new StringBuffer();

-               ctx.getPageMaker().makeHead(buf, "Not supported", getCSSName());
+               ctx.getPageMaker().makeHead(buf, "Not supported");

                buf.append("Operation not supported");
                ctx.getPageMaker().makeTail(buf);
@@ -74,7 +68,7 @@
        public void handlePut(URI uri, Bucket data, ToadletContext ctx) throws 
ToadletContextClosedException, IOException, RedirectException {
                StringBuffer buf = new StringBuffer();

-               ctx.getPageMaker().makeHead(buf, "Not supported", getCSSName());
+               ctx.getPageMaker().makeHead(buf, "Not supported");

                buf.append("Operation not supported");
                ctx.getPageMaker().makeTail(buf);
@@ -88,7 +82,7 @@
        public void handlePost(URI uri, Bucket data, ToadletContext ctx) throws 
ToadletContextClosedException, IOException, RedirectException {
                StringBuffer buf = new StringBuffer();

-               ctx.getPageMaker().makeHead(buf, "Not supported", getCSSName());
+               ctx.getPageMaker().makeHead(buf, "Not supported");

                buf.append("Operation not supported");
                ctx.getPageMaker().makeTail(buf);
@@ -150,7 +144,7 @@
        protected void sendErrorPage(ToadletContext ctx, int code, String desc, 
String message) throws ToadletContextClosedException, IOException {
                StringBuffer buf = new StringBuffer();

-               ctx.getPageMaker().makeHead(buf, desc, getCSSName());
+               ctx.getPageMaker().makeHead(buf, desc);
                buf.append(message);
                ctx.getPageMaker().makeTail(buf);
                writeReply(ctx, code, "text/html", desc, buf.toString());

Modified: trunk/freenet/src/freenet/clients/http/ToadletContainer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ToadletContainer.java        
2006-03-16 01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/ToadletContainer.java        
2006-03-16 02:53:32 UTC (rev 8262)
@@ -16,4 +16,9 @@
         * Find a Toadlet by URI.
         */
        public Toadlet findToadlet(URI uri);
+       
+       /**
+        * Get the name of the theme to be used by all the Toadlets
+        */
+       public String getCSSName();
 }

Modified: trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java      
2006-03-16 01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/ToadletContextImpl.java      
2006-03-16 02:53:32 UTC (rev 8262)
@@ -32,14 +32,13 @@
        private final MultiValueTable headers;
        private final OutputStream sockOutputStream;
        private final PageMaker pagemaker;
-       private String CSSName;

        /** Is the context closed? If so, don't allow any more writes. This is 
because there
         * may be later requests.
         */
        private boolean closed;

-       public ToadletContextImpl(Socket sock, MultiValueTable headers) throws 
IOException {
+       public ToadletContextImpl(Socket sock, MultiValueTable headers, String 
CSSName) throws IOException {
                this.sock = sock;
                this.headers = headers;
                this.closed = false;
@@ -186,8 +185,37 @@

                                boolean shouldDisconnect = 
shouldDisconnectAfterHandled(split[2].equals("HTTP/1.0"), headers);

-                               ToadletContextImpl ctx = new 
ToadletContextImpl(sock, headers);
+                               ToadletContextImpl ctx = new 
ToadletContextImpl(sock, headers, container.getCSSName());

+                               /*
+                                * if we're handling a POST, copy the data into 
a bucket now,
+                                * before we go into the redirect loop
+                                */
+                               
+                               Bucket data;
+                               
+                               if(method.equals("POST")) {
+                                       String slen = (String) 
headers.get("content-length");
+                                       if(slen == null) {
+                                               
sendError(sock.getOutputStream(), 400, "No content-length in POST", true, null);
+                                               return;
+                                       }
+                                       long len;
+                                       try {
+                                               len = Integer.parseInt(slen);
+                                               if(len < 0) throw new 
NumberFormatException("content-length less than 0");
+                                       } catch (NumberFormatException e) {
+                                               
sendError(sock.getOutputStream(), 400, "content-length parse error: "+e, true, 
null);
+                                               return;
+                                       }
+                                       data = bf.makeBucket(len);
+                                       BucketTools.copyFrom(data, is, len);
+                               } else {
+                                       // we're not doing to use it, but we 
have to keep
+                                       // the compiler happy
+                                       data = null;
+                               }
+                               
                                // Handle it.
                                boolean redirect = true;
                                while (redirect) {
@@ -218,23 +246,7 @@
                                                }

                                        } else if(method.equals("POST")) {
-                                               String slen = (String) 
headers.get("content-length");
-                                               if(slen == null) {
-                                                       
sendError(sock.getOutputStream(), 400, "No content-length in POST", true, null);
-                                                       return;
-                                               }
-                                               long len;
                                                try {
-                                                       len = 
Integer.parseInt(slen);
-                                                       if(len < 0) throw new 
NumberFormatException("content-length less than 0");
-                                               } catch (NumberFormatException 
e) {
-                                                       
sendError(sock.getOutputStream(), 400, "content-length parse error: "+e, true, 
null);
-                                                       return;
-                                               }
-                                               Bucket data = 
bf.makeBucket(len);
-                                               BucketTools.copyFrom(data, is, 
len);
-
-                                               try {
                                                        t.handlePost(uri, data, 
ctx);
                                                } catch (RedirectException re) {
                                                        uri = re.newuri;

Modified: trunk/freenet/src/freenet/clients/http/TrivialToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/TrivialToadlet.java  2006-03-16 
01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/TrivialToadlet.java  2006-03-16 
02:53:32 UTC (rev 8262)
@@ -9,8 +9,8 @@

 public class TrivialToadlet extends Toadlet {

-       TrivialToadlet(HighLevelSimpleClient client, CSSNameCallback CSSName) {
-               super(client, CSSName);
+       TrivialToadlet(HighLevelSimpleClient client) {
+               super(client);
        }

        public void handleGet(URI uri, ToadletContext ctx) throws 
ToadletContextClosedException, IOException {

Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2006-03-16 
01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java  2006-03-16 
02:53:32 UTC (rev 8262)
@@ -15,8 +15,8 @@
 public class WelcomeToadlet extends Toadlet {
        Node node;

-       WelcomeToadlet(HighLevelSimpleClient client, Node n, CSSNameCallback 
CSSName) {
-               super(client, CSSName);
+       WelcomeToadlet(HighLevelSimpleClient client, Node n) {
+               super(client);
                this.node = n;
        }

@@ -36,23 +36,48 @@
                        return;
                }

-               if(request.hasParameters() && 
request.getParam("exit").equalsIgnoreCase("true")){       
-                       System.out.println("Goodbye.");
-                       writeReply(ctx, 200, "text/html", "OK", 
mkForwardPage(ctx, "Shutting down the node", "" , "/", 5));
-                       System.exit(0);
+               StringBuffer buf = new StringBuffer();
+               
+               if (request.getParam("shutdownconfirm").length() > 0) {
+                       // false for no navigation bars, because that would be 
very silly
+                       ctx.getPageMaker().makeHead(buf, "Node Shut down", 
false);
+                       buf.append("<div class=\"infobox\">\n");
+                       buf.append("The Freenet node has been successfully shut 
down\n");
+                       buf.append("<br />\n");
+                       buf.append("Thank you for using Freenet\n");
+                       buf.append("</div>\n");
+                       ctx.getPageMaker().makeTail(buf);
+                               
+                       writeReply(ctx, 200, "text/html", "OK", buf.toString());
+                       this.node.exit();
+               } else if (request.getParam("exit").equalsIgnoreCase("true")) {
+                       ctx.getPageMaker().makeHead(buf, "Node Shutdown");
+                       buf.append("<form action=\"/\" method=\"post\">\n");
+                       buf.append("<div class=\"infobox\">\n");
+                       buf.append("Are you sure you wish to shut down your 
Freenet node?<br />\n");
+                       buf.append("<div class=\"cancel\">\n");
+                       buf.append("<input type=\"submit\" name=\"cancel\" 
value=\"Cancel\" />\n");
+                       buf.append("</div>\n");
+                       buf.append("<div class=\"confirm\">\n");
+                       buf.append("<input type=\"submit\" 
name=\"shutdownconfirm\" value=\"Shut Down\" />\n");
+                       buf.append("</div>\n");
+                       buf.append("<br style=\"clear: all;\">\n");
+                       buf.append("</div>\n");
+                       buf.append("</form>\n");
+                       ctx.getPageMaker().makeTail(buf);
+                       writeReply(ctx, 200, "text/html", "OK", buf.toString());
+               } else {
+                       this.handleGet(uri, ctx);
                }
-               
        }

        public void handleGet(URI uri, ToadletContext ctx) throws 
ToadletContextClosedException, IOException {
                StringBuffer buf = new StringBuffer();
-               HTTPRequest request = new HTTPRequest(uri);


-               String name = "Freenet FProxy Homepage";
+               ctx.getPageMaker().makeHead(buf, "Freenet FProxy Homepage");
                if(node.isTestnetEnabled())
-                       name = name +"<br><font color=red>WARNING: TESTNET MODE 
ENABLED</font>";
-               ctx.getPageMaker().makeHead(buf, name, getCSSName());
+                       buf.append("<div style=\"color: red; font-size: 200%; 
\">WARNING: TESTNET MODE ENABLED</div>");

                // Version info
                buf.append("<div class=\"infobox\">\n");
@@ -75,11 +100,11 @@
                buf.append("</form>\n");

                // Quit Form
-               buf.append("<div class=\"exit\" target=\".\">\n");
-               buf.append("<form method=\"post\">\n");
-               buf.append("<input type=\"hidden\" name=\"exit\" 
value=\"true\"><input type=\"submit\" value=\"Shutdown the node\">\n");
+               buf.append("<form method=\"post\" action=\".\">\n");
+               buf.append("<div class=\"exit\">\n");
+               buf.append("<input type=\"hidden\" name=\"exit\" value=\"true\" 
/><input type=\"submit\" value=\"Shut down the node\" />\n");
+               buf.append("</div>\n");
                buf.append("</form>\n");
-               buf.append("</div>\n");

                // Activity
                buf.append("<ul id=\"activity\">\n"

Modified: 
trunk/freenet/src/freenet/clients/http/staticfiles/themes/aqua/theme.css
===================================================================
--- trunk/freenet/src/freenet/clients/http/staticfiles/themes/aqua/theme.css    
2006-03-16 01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/staticfiles/themes/aqua/theme.css    
2006-03-16 02:53:32 UTC (rev 8262)
@@ -9,9 +9,6 @@
        position: relative;
 }

-#page {
-}
-
 #topbar {
        margin: 0px;
        margin-bottom: 10px;
@@ -23,22 +20,21 @@
 }

 #navbar {
-       float: left;
+       margin:0 5px 0 0;
+       padding:10px;
+       width:150px;
+       float:right;
        border: 2px solid #5e88d8;
-       margin-right: 10px;
-       text-align: center;
-       padding: 5px;
 }

 #navlist {
-       display: inline;
        margin: 0;
        padding: 0;
        text-align: center;
+       text-align: left;
 }

 #navlist li {
-       display: inline;
        margin: 0;
        padding: 0;
        list-style-type: none;
@@ -47,17 +43,14 @@
 }

 #navlist a {
-       display: block;
        color: black;
 }

 #navlist a:visited {
-       display: block;
        color: black;
 }

 #navlist a:active {
-       display: block;
        color: black;
 }

@@ -68,36 +61,6 @@
        display: table-cell;
 }

-#themeselect {
-       position: absolute;
-       bottom: 0px;
-       right: 0px;
-}
-
-#themeselect ul {
-       display: inline;
-       margin: 0;
-       padding: 0;
-}
-
-#themeselect ul li {
-       display: inline;
-       margin: 0;
-       padding: 0;
-       list-style-type: none;
-       list-style-position: outside;
-}
-
-.themeitem a {
-       text-decoration: none;
-       color: black;
-}
-
-.currentthemeitem a {
-       color: #356ace;
-       font-weight: bold;
-}
-
 #activity {
        border: 1px solid #5e88d8;
        padding: 5px;
@@ -106,3 +69,18 @@
        list-style-position: inside;
 }

+.config ul {
+       border: 1px solid #5e88d8;
+       padding: 5px;
+       margin: 15px;
+       list-style-position: inside;
+       display: table;
+}
+
+.cancel {
+       float: left;
+}
+
+.confirm {
+       float: right;
+}

Modified: 
trunk/freenet/src/freenet/clients/http/staticfiles/themes/clean/theme.css
===================================================================
--- trunk/freenet/src/freenet/clients/http/staticfiles/themes/clean/theme.css   
2006-03-16 01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/clients/http/staticfiles/themes/clean/theme.css   
2006-03-16 02:53:32 UTC (rev 8262)
@@ -1,103 +1,91 @@
 body {
-  margin:0;
-  padding:0;
-  background-color:#f0f0f0;
-  position: relative;
+       margin:0;
+       padding:0;
+       background-color:#f0f0f0;
+       position: relative;
 }

 #topbar {
-  margin:0 0 5px 0;
-  padding:5px;
-  height:50px;
-  background-color:#e8e8e8;
-  background-image:url(logo.png);
-  background-repeat:no-repeat;
-  background-position:30px 3px;
-  border-bottom:1px solid #d0d0d0;
-  font-family:Arial;
+       margin:0 0 5px 0;
+       padding:5px;
+       min-height:50px;
+       background-color:#e8e8e8;
+       background-image:url(logo.png);
+       background-repeat:no-repeat;
+       background-position:30px 3px;
+       border-bottom:1px solid #d0d0d0;
+       font-family:Arial;
 }

 #topbar h1 {
-  margin:0;
-  padding:7px 0 0 0;
-  text-align:center;
-  font-weight:normal;
-  font-size:20pt;
+       margin:0;
+       padding:7px 0 0 0;
+       text-align:center;
+       font-weight:normal;
+       font-size:20pt;
 }

 #navbar {
-  margin:0 5px 0 0;
-  padding:10px;
-  width:150px;
-  float:left;
-  background-color:#e8e8e8;
-  border:1px solid #d0d0d0;
+       margin:0 5px 0 0;
+       padding:10px;
+       width:150px;
+       float:left;
+       background-color:#e8e8e8;
+       border:1px solid #d0d0d0;
 }

 #navbar a {
-  font-family:Arial;
-  color:#000000;
-  text-decoration:underline;
+       font-family:Arial;
+       color:#000000;
+       text-decoration:underline;
 }

 #navbar a:hover {
-  color:#ff0000;
+       color:#ff0000;
 }

 #content {
-  float:left;
+       float:left;
 }

 .infobox {
-  margin:0 0 5px 0;
-  padding:10px;
-  background-color:#f0f0f0;
-  border:1px solid #d0d0d0;
+       margin:0 0 5px 0;
+       padding:10px;
+       background-color:#f0f0f0;
+       border:1px solid #d0d0d0;
 }

 .infobox h2 {
-  margin:0 0 15px 0;
-  padding:0;
-  border-bottom:1px dotted #000000;
-  font-family:Arial;
-  font-weight:normal;
-  font-size:13pt;
+       margin:0 0 15px 0;
+       padding:0;
+       border-bottom:1px dotted #000000;
+       font-family:Arial;
+       font-weight:normal;
+       font-size:13pt;
 }

-#themeselect {
-        position: absolute;
-        top: 0px;
-        right: 0px;
+#activity {
+       margin:0 0 5px 0;
+       padding:10px;
+       background-color:#f0f0f0;
+       border:1px solid #d0d0d0;
+       list-style-position: inside;
 }

-#themeselect ul {
-        display: inline;
-        margin: 0;
-        padding: 0;
+.config ul {
+       margin: 0 0 15px 0;
+       padding: 10px;
+       border: 1px dotted #000000;
+       font-family: Arial;
+       font-weight: normal;
+       font-size: 13pt;
+       list-style-position: inside;
 }

-#themeselect ul li {
-        display: inline;
-        margin: 0;
-        padding: 0;
-        list-style-type: none;
-        list-style-position: outside;
+.cancel {
+       float: left;
 }

-.themeitem a {
-        text-decoration: none;
-        color: black;
+.confirm {
+       float: right;
 }
-
-.currentthemeitem a {
-       font-weight: bold;
-}
-
-#activity {
-  margin:0 0 5px 0;
-  padding:10px;
-  background-color:#f0f0f0;
-  border:1px solid #d0d0d0;
-  list-style-position: inside;
-}
-

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-03-16 01:31:33 UTC (rev 
8261)
+++ trunk/freenet/src/freenet/node/Version.java 2006-03-16 02:53:32 UTC (rev 
8262)
@@ -20,7 +20,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       private static final int buildNumber = 541;
+       private static final int buildNumber = 542;

        /** Oldest build of Fred we will talk to */
        private static final int lastGoodBuild = 507;

Modified: trunk/freenet/src/freenet/pluginmanager/PproxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/PproxyToadlet.java  2006-03-16 
01:31:33 UTC (rev 8261)
+++ trunk/freenet/src/freenet/pluginmanager/PproxyToadlet.java  2006-03-16 
02:53:32 UTC (rev 8262)
@@ -9,7 +9,6 @@
 import java.util.Iterator;

 import freenet.client.HighLevelSimpleClient;
-import freenet.clients.http.CSSNameCallback;
 import freenet.clients.http.Toadlet;
 import freenet.clients.http.ToadletContext;
 import freenet.clients.http.ToadletContextClosedException;
@@ -21,8 +20,8 @@
 public class PproxyToadlet extends Toadlet {
        private PluginManager pm = null;

-       public PproxyToadlet(HighLevelSimpleClient client, PluginManager pm, 
CSSNameCallback CSSName) {
-               super(client, CSSName);
+       public PproxyToadlet(HighLevelSimpleClient client, PluginManager pm) {
+               super(client);
                this.pm = pm;
        }

@@ -120,7 +119,7 @@
        private void showPluginList(ToadletContext ctx, HTTPRequest request) 
throws ToadletContextClosedException, IOException {
                if (!request.hasParameters()) {
                        StringBuffer out = new StringBuffer();
-                       ctx.getPageMaker().makeHead(out, "Plugin List", 
getCSSName());
+                       ctx.getPageMaker().makeHead(out, "Plugin List");
                        out.append("<table style=\"border: 1pt solid 
#c0c0c0;\">");
                        out.append("  <tr>\n");
                        out.append("    <th>Name</th>\n");


Reply via email to