Author: nextgens
Date: 2007-05-31 00:00:13 +0000 (Thu, 31 May 2007)
New Revision: 13408

Modified:
   trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
Log:
More work on the wizard, should be feature complete now ... the wording has to 
be imrpoved but I'm tired and would like it to be reviewed by a native english 
speaker in any case.

I've removed the "choose your language" step; we detect it from the locale ... 
and if the user doesn't want that language we assume he is smart enough to 
change it himself afterwards.

Modified: trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java  
2007-05-30 23:25:29 UTC (rev 13407)
+++ trunk/freenet/src/freenet/clients/http/FirstTimeWizardToadlet.java  
2007-05-31 00:00:13 UTC (rev 13408)
@@ -8,7 +8,6 @@
 import java.net.NetworkInterface;
 import java.net.URI;
 import java.util.Enumeration;
-import java.util.Locale;

 import freenet.client.HighLevelSimpleClient;
 import freenet.config.Config;
@@ -25,16 +24,16 @@
  * A first time wizard aimed to ease the configuration of the node.
  * 
  * @author Florent Daignière <nextgens at freenetproject.org>
+ * 
+ * TODO: a choose your CSS step ?
  */
 public class FirstTimeWizardToadlet extends Toadlet {
-       private final Node node;
        private final NodeClientCore core;
        private final Config config;


        FirstTimeWizardToadlet(HighLevelSimpleClient client, Node node) {
                super(client);
-               this.node = node;
                this.core = node.clientCore;
                this.config = node.config;
        }
@@ -53,36 +52,17 @@
                        HTMLNode pageNode = 
ctx.getPageMaker().getPageNode(l10n("step1Title"), false, ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

-                       HTMLNode languageInfobox = contentNode.addChild("div", 
"class", "infobox infobox-normal");
-                       HTMLNode languageInfoboxHeader = 
languageInfobox.addChild("div", "class", "infobox-header");
-                       HTMLNode languageInfoboxContent = 
languageInfobox.addChild("div", "class", "infobox-content");
+                       HTMLNode nnameInfobox = contentNode.addChild("div", 
"class", "infobox infobox-normal");
+                       HTMLNode nnameInfoboxHeader = 
nnameInfobox.addChild("div", "class", "infobox-header");
+                       HTMLNode nnameInfoboxContent = 
nnameInfobox.addChild("div", "class", "infobox-content");

-                       languageInfoboxHeader.addChild("#", 
l10n("selectLanguage"));
-                       languageInfoboxContent.addChild("#", 
l10n("selectLanguageLong"));
-                       HTMLNode languageForm = 
ctx.addFormChild(languageInfoboxContent, ".", "languageForm");
-                       HTMLNode result = languageForm.addChild("select", 
"name", "language");
+                       nnameInfoboxHeader.addChild("#", 
l10n("chooseNodeName"));
+                       nnameInfoboxContent.addChild("#", 
l10n("chooseNodeNameLong"));
+                       HTMLNode nnameForm = 
ctx.addFormChild(nnameInfoboxContent, ".", "nnameForm");
+                       nnameForm.addChild("input", "name", "nname");

-                       Locale currentLocale = Locale.getDefault();
-                       boolean isTranslationFound = false;
-                       for(int i=0; i<L10n.AVAILABLE_LANGUAGES.length; i++) {
-                               if(isTranslationFound = 
L10n.AVAILABLE_LANGUAGES[i].equals(currentLocale.getCountry().toLowerCase()))
-                                       break;
-                       }
-                       
-                       if(isTranslationFound) {
-                               result.addChild("option", new String[] { 
"value", "selected" }, new String[] { 
Locale.getDefault().getCountry().toLowerCase(), "selected" }, 
Locale.getDefault().getDisplayName());
-                               result.addChild("option", "value", "en", 
"English");
-                       } else
-                               result.addChild("option", new String[] { 
"value", "selected" }, new String[] { "en" , "selected" }, "English");          
               
-                       result.addChild("option", "value", "fr", "Fran?ais");
-                       result.addChild("option", "value", "pl", "Polski");
-                       result.addChild("option", "value", "it", "Italiano");
-                       result.addChild("option", "value", "se", "Svenska");
-                       result.addChild("option", "value", "no", "Norsk");
-                       // We don't propose unknown languages here
-                       
-                       languageForm.addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "submit", "languageF", 
L10n.getString("Toadlet.clickHere")});
-                       languageForm.addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "submit", "cancel", 
L10n.getString("Toadlet.cancel")});
+                       nnameForm.addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "submit", "nnameF", 
L10n.getString("Toadlet.clickHere")});
+                       nnameForm.addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "submit", "cancel", 
L10n.getString("Toadlet.cancel")});
                        this.writeReply(ctx, 200, "text/html; charset=utf-8", 
"OK", pageNode.generate());
                        return;
                } else if(currentStep == 2) {
@@ -141,12 +121,12 @@
                        HTMLNode pageNode = 
ctx.getPageMaker().getPageNode(l10n("step4Title"), false, ctx);
                        HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);

-                       HTMLNode bandwidthInfobox = contentNode.addChild("div", 
"class", "infobox infobox-normal");
-                       HTMLNode bandwidthnfoboxHeader = 
bandwidthInfobox.addChild("div", "class", "infobox-header");
-                       HTMLNode bandwidthInfoboxContent = 
bandwidthInfobox.addChild("div", "class", "infobox-content");
+                       HTMLNode networkInfobox = contentNode.addChild("div", 
"class", "infobox infobox-normal");
+                       HTMLNode networkInfoboxHeader = 
networkInfobox.addChild("div", "class", "infobox-header");
+                       HTMLNode networkInfoboxContent = 
networkInfobox.addChild("div", "class", "infobox-content");

                        Enumeration interfaces = 
NetworkInterface.getNetworkInterfaces();
-                       HTMLNode bandwidthForm = 
ctx.addFormChild(bandwidthInfoboxContent, ".", "networkForm");
+                       HTMLNode networkForm = new HTMLNode("div");

                        short ifCount = 0;
                        HTMLNode ifList = new HTMLNode("div", "class", 
"interface");
@@ -167,18 +147,32 @@
                        }

                        if(ifCount > 0) {
-                               bandwidthnfoboxHeader.addChild("#", 
l10n("isNetworkTrusted"));
-                               bandwidthInfoboxContent.addChild("#", 
l10n("isNetworkTrustedLong"));
-                               bandwidthForm.addChild(ifList);
+                               networkInfoboxHeader.addChild("#", 
l10n("isNetworkTrusted"));
+                               networkInfoboxContent.addChild("#", 
l10n("isNetworkTrustedLong"));
+                               networkForm.addChild(ifList);
                        } else {
-                               bandwidthnfoboxHeader.addChild("#", 
l10n("noNetworkIF"));
-                               bandwidthInfoboxContent.addChild("#", 
l10n("noNetworkIFLong"));                         
+                               networkInfoboxHeader.addChild("#", 
l10n("noNetworkIF"));
+                               networkInfoboxContent.addChild("#", 
l10n("noNetworkIFLong"));                           
                        }
+                       ctx.addFormChild(networkInfoboxContent, ".", 
"networkForm").addChild(networkForm);

-                       bandwidthForm.addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "submit", "networkF", 
L10n.getString("Toadlet.clickHere")});
-                       bandwidthForm.addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "submit", "cancel", 
L10n.getString("Toadlet.cancel")});
+                       networkForm.addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "submit", "networkF", 
L10n.getString("Toadlet.clickHere")});
+                       networkForm.addChild("input", new String[] { "type", 
"name", "value" }, new String[] { "submit", "cancel", 
L10n.getString("Toadlet.cancel")});
                        this.writeReply(ctx, 200, "text/html; charset=utf-8", 
"OK", pageNode.generate());
                        return;
+               }else if(currentStep == 5) {
+                       HTMLNode pageNode = 
ctx.getPageMaker().getPageNode(l10n("step5Title"), true, ctx);
+                       HTMLNode contentNode = 
ctx.getPageMaker().getContentNode(pageNode);
+                       
+                       HTMLNode congratzInfobox = contentNode.addChild("div", 
"class", "infobox infobox-normal");
+                       HTMLNode congratzInfoboxHeader = 
congratzInfobox.addChild("div", "class", "infobox-header");
+                       HTMLNode congratzInfoboxContent = 
congratzInfobox.addChild("div", "class", "infobox-content");
+
+                       congratzInfoboxHeader.addChild("#", l10n("congratz"));
+                       congratzInfoboxContent.addChild("#", 
l10n("congratzLong"));
+
+                       this.writeReply(ctx, 200, "text/html; charset=utf-8", 
"OK", pageNode.generate());
+                       return;
                }

                HTMLNode pageNode = 
ctx.getPageMaker().getPageNode(l10n("homepageTitle"), false, ctx);
@@ -214,12 +208,12 @@
                        return;
                }

-               if(request.isPartSet("languageF")) {
-                       String selectedLanguage = 
request.getPartAsString("language", 4);
+               if(request.isPartSet("nnameF")) {
+                       String selectedNName = request.getPartAsString("nname", 
255);

                        try {
-                               config.get("node").set("l10n", 
selectedLanguage);
-                               Logger.normal(this, "The language has been set 
to "+ selectedLanguage);
+                               config.get("node").set("name", selectedNName);
+                               Logger.normal(this, "The node name has been set 
to "+ selectedNName);
                        } catch (InvalidConfigValueException e) {
                                Logger.error(this, "Should not happen, please 
report!" + e);
                        }
@@ -282,6 +276,7 @@
                                        config.get("fproxy").set("bindTo", 
sb.toString());
                                        
config.get("fproxy").set("allowedHosts", "*");
                                        
config.get("fproxy").set("allowedHostsFullAccess", "*");
+                                       config.store();

                                        Logger.normal(this, "Network allowance 
list has been set to "+ sb.toString());
                                } catch (InvalidConfigValueException e) {

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2007-05-30 
23:25:29 UTC (rev 13407)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2007-05-31 
00:00:13 UTC (rev 13408)
@@ -164,23 +164,26 @@
 ExtOldAgeUserAlert.extTooOld=Your freenet-ext.jar file seems to be outdated: 
we strongly advise you to update it using 
http://downloads.freenetproject.org/alpha/freenet-ext.jar.
 ExtOldAgeUserAlert.extTooOldTitle=Freenet-ext too old
 FirstTimeWizardToadlet.homepageTitle=Freenet first time wizard!
+FirstTimeWizardToadlet.chooseNodeName=Node name required!
+FirstTimeWizardToadlet.chooseNodeNameLong=Please enter a node name in the 
field below. This name won't be published to anyone but the peers you are 
connected to. We recommend to put your real-name or IRC nick in there possibly 
with some contact information so that you can be reached in case there is a 
problem ("John Doe <noname at nowhere.com>"). 
 FirstTimeWizardToadlet.welcomeInfoboxTitle=Welcome to freenet first time 
wizard!
 FirstTimeWizardToadlet.welcomeInfoboxContent1=Welcome to freenet first time 
wizard. This tool will enable you to configure your node quickly and easily to 
get you started. Please
-FirstTimeWizardToadlet.selectLanguage=Language
-FirstTimeWizardToadlet.selectLanguageLong=Please select a language from the 
list below:
 FirstTimeWizardToadlet.bandwidthLimit=Bandwidth limits
-FirstTimeWizardToadlet.bandwidthLimitLong=Please select your connection type 
from the dropdown menu below.
+FirstTimeWizardToadlet.bandwidthLimitLong=Please select your internet 
connection type and speed from the dropdown menu below.
 FirstTimeWizardToadlet.datastoreSize=Datastore size
-FirstTimeWizardToadlet.datastoreSizeLong=Please select a size for your 
datastore.
+FirstTimeWizardToadlet.datastoreSizeLong=Please select a size for your 
datastore. The datastore acts like a cache; storing data for the network will 
help you to get better thoughputs when requesting popular files. The most space 
you can afford the best it is for the community and the faster your node will 
go.
 FirstTimeWizardToadlet.isNetworkTrusted=Is your local network trusted ?
 FirstTimeWizardToadlet.isNetworkTrustedLong=Is your local network trusted ? If 
you don't answer the default option all the services provided by your node will 
be wide open to everyone willing to access them. If you want to do more 
selective access controls you can proceed later on from the configuration page.
 FirstTimeWizardToadlet.noNetworkIF=No additionnal network interface found
 FirstTimeWizardToadlet.noNetworkIFLong=Freenet hasn't found any additionnal 
network interface. It will assume that you will connect to it from your 
computer and only from it.
 FirstTimeWizardToadlet.iDoTrust=Do you trust people connected to ${interface} 
(${ip}) ?
-FirstTimeWizardToadlet.step1Title=Freenet first time wizard! - Choose your 
language
+FirstTimeWizardToadlet.congratz=Welcome on board!
+FirstTimeWizardToadlet.congratzLong=Contratulations, the base configuration of 
your freenet node is now done. You can change and edit any of the parameters 
you have just set going to the "configuration" page, reachable anytime from the 
menu on the left of the interface. We wish you a pleasant freenet experience.
+FirstTimeWizardToadlet.step1Title=Freenet first time wizard! - Choose a node 
name
 FirstTimeWizardToadlet.step2Title=Freenet first time wizard! - Bandwidth limits
 FirstTimeWizardToadlet.step3Title=Freenet first time wizard! - Datastore size
 FirstTimeWizardToadlet.step4Title=Freenet first time wizard! - Network 
configuration
+FirstTimeWizardToadlet.step5Title=Freenet first time wizard! - 
Congratulations, your node is now configured
 FirstTimeWizardToadlet.skipWizard=I am not a newbie, please skip the wizard!
 FProxyToadlet.abortToHomepage=Abort and return to the FProxy home page
 FProxyToadlet.backToFProxy=${link}Click here${/link} to go to the FProxy home 
page.


Reply via email to