r27168 - in trunk/freenet/src/freenet: clients/http l10n

[email protected] Tue, 21 Apr 2009 19:34:12 +0000
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: toad
Date: 2009-04-21 19:34:12 +0000 (Tue, 21 Apr 2009)
New Revision: 27168

Modified:
   trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
Log:
More work on the UI. Hopefully somebody who knows more about UIs can tidy this up. The next step is to try to get information about MIME type and file size out of the client layer a lot earlier.


Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java	2009-04-21 19:02:50 UTC (rev 27167)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java	2009-04-21 19:34:12 UTC (rev 27168)
@@ -512,29 +512,27 @@
 				break;
 			} else {
 				// Still in progress
-				HTMLNode pageNode = ctx.getPageMaker().getPageNode(l10n("fileInformationTitle"), ctx);
+				HTMLNode pageNode = ctx.getPageMaker().getPageNode(l10n("fetchingPageTitle"), ctx);
 				HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode);
 				
 				HTMLNode infobox = contentNode.addChild("div", "class", "infobox infobox-information");
-				infobox.addChild("div", "class", "infobox-header", l10n("largeFile"));
+				infobox.addChild("div", "class", "infobox-header", l10n("fetchingPageBox"));
 				HTMLNode infoboxContent = infobox.addChild("div", "class", "infobox-content");
-				infoboxContent.addChild("p", "Filename: "+key.getPreferredFilename());
-				infoboxContent.addChild("p", "Key: "+key);
+				infoboxContent.addChild("#", "Filename: "+key.getPreferredFilename());
+				infoboxContent.addChild("br", "Key: "+key);
 				if(fr.mimeType != null) infoboxContent.addChild("p", "Content type: "+mimeType);
 				if(core.isAdvancedModeEnabled()) {
-					infoboxContent.addChild("p", "Blocks: need "+fr.requiredBlocks+" total "+fr.totalBlocks+" fetched "+fr.fetchedBlocks+" failed "+fr.failedBlocks+" fatally failed "+fr.fatallyFailedBlocks);
+					infoboxContent.addChild("br", "Blocks: need "+fr.requiredBlocks+" total "+fr.totalBlocks+" fetched "+fr.fetchedBlocks+" failed "+fr.failedBlocks+" fatally failed "+fr.fatallyFailedBlocks);
 				}
-				infoboxContent.addChild("p", "Time elapsed: "+TimeUtil.formatTime(System.currentTimeMillis() - fr.timeStarted));
+				infoboxContent.addChild("br", "Time elapsed: "+TimeUtil.formatTime(System.currentTimeMillis() - fr.timeStarted));
 				long eta = fr.eta;
 				if(eta > 0)
-					infoboxContent.addChild("p", "ETA: "+TimeUtil.formatTime(eta));
+					infoboxContent.addChild("br", "ETA: "+TimeUtil.formatTime(eta));
 				if(fr.goneToNetwork)
-					infoboxContent.addChild("p", "Your node is downloading this file from Freenet. This could take seconds or minutes depending on how big the file is and how popular.");
+					infoboxContent.addChild("p", "Your node is downloading this page or file from Freenet. This could take seconds or minutes depending on how big and how popular the page or file is.");
 				else
-					infoboxContent.addChild("p", "Your Freenet node is checking your local cache for this file. If it is not found in the cache, it will try to download it from Freenet.");
-				if(fr.finalizedBlocks)
-					infoboxContent.addChild("p", "The progress bar should be accurate.");
-				else
+					infoboxContent.addChild("p", "Your Freenet node is checking your local cache for this page or file. If it is not found in the cache, it will try to download it from Freenet.");
+				if(!fr.finalizedBlocks)
 					infoboxContent.addChild("p", "The progress bar is likely to jump around a lot as we have not downloaded enough blocks to know how big the file is.");
 				
 				HTMLNode table = infoboxContent.addChild("table", "border", "0");
@@ -568,6 +566,22 @@
 
 				}
 				
+				infobox = contentNode.addChild("div", "class", "infobox infobox-information");
+				infobox.addChild("div", "class", "infobox-header", l10n("fetchingPageOptions"));
+				infoboxContent = infobox.addChild("div", "class", "infobox-content");
+
+				HTMLNode ul = infoboxContent.addChild("ul");
+				ul.addChild("li").addChild("p", "You can wait for the page. This page will be refreshed every 2 seconds until the file is fetched or Freenet gives up. Alternatively:");
+				HTMLNode optionForm = ctx.addFormChild(ul.addChild("li").addChild("p"), "/queue/", "tooBigQueueForm");
+				optionForm.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "key", key.toString() });
+				optionForm.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "return-type", "disk" });
+				optionForm.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", "persistence", "forever" });
+				optionForm.addChild("input", new String[] { "type", "name", "value" }, new String[] { "submit", "download", l10n("downloadInBackgroundToDisk") });
+
+				ul.addChild("li").addChild("p").addChild(ctx.getPageMaker().createBackLink(ctx, l10n("goBackToPrev")));
+				
+				ul.addChild("li").addChild("p").addChild("a", new String[] { "href", "title" }, new String[] { "/", L10n.getString("Toadlet.homepage") }, l10n("abortToHomepage"));
+				
 				String location = getLink(key, requestedMimeType, maxSize, httprequest.getParam("force", null), httprequest.isParameterSet("forcedownload"));
 				MultiValueTable<String, String> retHeaders = new MultiValueTable<String, String>();
 				retHeaders.put("Refresh", "2; url="+location);

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties	2009-04-21 19:02:50 UTC (rev 27167)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties	2009-04-21 19:34:12 UTC (rev 27168)
@@ -342,6 +342,9 @@
 FProxyToadlet.expectedKeyButGot=Expected a Freenet key, but got:
 FProxyToadlet.expectedMimeType=Expected MIME type: ${mime}
 FProxyToadlet.explanationTitle=Explanation
+FProxyToadlet.fetchingPageTitle=Downloading a page
+FProxyToadlet.fetchingPageBox=Freenet is downloading the page you requested
+FProxyToadlet.fetchingPageOptions=Your options
 FProxyToadlet.fetchLargeFileAnywayAndDisplay=Fetch anyway and display file in browser
 FProxyToadlet.fileInformationTitle=File Information
 FProxyToadlet.filenameLabel=Filename: