Author: toad
Date: 2009-01-07 17:15:08 +0000 (Wed, 07 Jan 2009)
New Revision: 24958
Modified:
trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
trunk/freenet/src/freenet/clients/http/QueueToadlet.java
Log:
Reintroduce the URI parameter to fproxy, and explain why we need it.
Lots of fixURI()s.
Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java 2009-01-07
17:14:25 UTC (rev 24957)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java 2009-01-07
17:15:08 UTC (rev 24958)
@@ -108,7 +108,27 @@
}
}
- public static void handleDownload(ToadletContext context, Bucket data,
BucketFactory bucketFactory, String mimeType, String requestedMimeType, String
forceString, boolean forceDownload, String basePath, FreenetURI key, String
extras, String referrer, boolean downloadLink, ToadletContext ctx,
NodeClientCore core) throws ToadletContextClosedException, IOException {
+ /**
+ * @param context
+ * @param data
+ * @param bucketFactory
+ * @param mimeType
+ * @param requestedMimeType
+ * @param forceString
+ * @param forceDownload
+ * @param basePath
+ * @param key
+ * @param uri If specified, use as base URI for filtering. Needed
because some pages are /u...@... and some
+ * are /freenet:u...@...
+ * @param extras
+ * @param referrer
+ * @param downloadLink
+ * @param ctx
+ * @param core
+ * @throws ToadletContextClosedException
+ * @throws IOException
+ */
+ public static void handleDownload(ToadletContext context, Bucket data,
BucketFactory bucketFactory, String mimeType, String requestedMimeType, String
forceString, boolean forceDownload, String basePath, FreenetURI key, URI uri,
String extras, String referrer, boolean downloadLink, ToadletContext ctx,
NodeClientCore core) throws ToadletContextClosedException, IOException {
ToadletContainer container = context.getContainer();
if(Logger.shouldLog(Logger.MINOR, FProxyToadlet.class))
Logger.minor(FProxyToadlet.class,
"handleDownload(data.size="+data.size()+", mimeType="+mimeType+",
requestedMimeType="+requestedMimeType+", forceDownload="+forceDownload+",
basePath="+basePath+", key="+key);
@@ -133,7 +153,7 @@
Bucket toFree = null;
try {
if((!force) && (!forceDownload)) {
- FilterOutput fo = ContentFilter.filter(data,
bucketFactory, mimeType, key.toURI(basePath), container.enableInlinePrefetch()
? prefetchHook : null, ctx);
+ FilterOutput fo = ContentFilter.filter(data,
bucketFactory, mimeType, uri == null ? key.toURI(basePath) : uri,
container.enableInlinePrefetch() ? prefetchHook : null, ctx);
if(data != fo.data) toFree = fo.data;
data = fo.data;
mimeType = fo.type;
@@ -152,7 +172,7 @@
L10n.addL10nSubstitution(option,
"FProxyToadlet.openPossRSSAsPlainText", new String[] { "link", "/link", "bold",
"/bold" },
new String[] {
- "<a
href=\""+basePath+key.toString()+"?type=text/plain&force="+getForceValue(key,now)+extrasNoMime+"\">",
+ "<a
href=\""+ctx.fixLink(basePath+key.toString()+"?type=text/plain&force="+getForceValue(key,now)+extrasNoMime)+"\">",
"</a>",
"<b>",
"</b>" });
@@ -160,7 +180,7 @@
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.openPossRSSForceDisk", new String[] { "link", "/link", "bold",
"/bold" },
new String[] {
- "<a
href=\""+basePath+key.toString()+"?forcedownload"+extras+"\">",
+ "<a
href=\""+ctx.fixLink(basePath+key.toString()+"?forcedownload"+extras)+"\">",
"</a>",
"<b>",
"</b>" });
@@ -169,7 +189,7 @@
option =
optionList.addChild("li");
L10n.addL10nSubstitution(option, "FProxyToadlet.openRSSForce", new String[] {
"link", "/link", "bold", "/bold", "mime" },
new String[] {
- "<a
href=\""+basePath+key.toString()+"?force="+getForceValue(key, now)+extras+"\">",
+ "<a
href=\""+ctx.fixLink(basePath+key.toString()+"?force="+getForceValue(key,
now)+extras)+"\">",
"</a>",
"<b>",
"</b>",
@@ -178,18 +198,18 @@
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.openRSSAsRSS", new String[] { "link", "/link", "bold", "/bold" },
new String[] {
- "<a
href=\""+basePath + key.toString() + "?type=application/xml+rss&force=" +
getForceValue(key, now)+extrasNoMime+"\">",
+ "<a
href=\""+ctx.fixLink(basePath + key.toString() +
"?type=application/xml+rss&force=" + getForceValue(key,
now)+extrasNoMime)+"\">",
"</a>",
"<b>",
"</b>" });
if(referrer != null) {
option =
optionList.addChild("li");
L10n.addL10nSubstitution(option, "FProxyToadlet.backToReferrer", new String[] {
"link", "/link" },
- new String[] {
"<a href=\""+HTMLEncoder.encode(referrer)+"\">", "</a>" });
+ new String[] {
"<a href=\""+HTMLEncoder.encode(ctx.fixLink(referrer))+"\">", "</a>" });
}
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.backToFProxy", new String[] { "link", "/link" },
- new String[] { "<a
href=\"/\">", "</a>" });
+ new String[] { "<a
href=\""+ctx.fixLink("/")+"\">", "</a>" });
byte[] pageBytes =
pageNode.generate().getBytes("UTF-8");
context.sendReplyHeaders(200, "OK", new
MultiValueTable<String, String>(), "text/html; charset=utf-8",
pageBytes.length);
@@ -227,27 +247,27 @@
if((mimeType.equals("application/x-freenet-index")) &&
(core.node.pluginManager.isPluginLoaded("plugins.ThawIndexBrowser.ThawIndexBrowser")))
{
option = optionList.addChild("li");
- L10n.addL10nSubstitution(option,
"FProxyToadlet.openAsThawIndex", new String[] { "link", "/link" }, new String[]
{ "<b><a href=\""+basePath +
"plugins/plugins.ThawIndexBrowser.ThawIndexBrowser/?key=" + key.toString() +
"\">", "</a></b>" });
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openAsThawIndex", new String[] { "link", "/link" }, new String[]
{ "<b><a href=\""+ctx.fixLink(basePath +
"plugins/plugins.ThawIndexBrowser.ThawIndexBrowser/?key=" + key.toString()) +
"\">", "</a></b>" });
}
option = optionList.addChild("li");
// FIXME: is this safe? See bug #131
- L10n.addL10nSubstitution(option,
"FProxyToadlet.openAsText", new String[] { "link", "/link" }, new String[] {
"<a href=\""+basePath+key.toString()+"?type=text/plain"+extrasNoMime+"\">",
"</a>" });
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openAsText", new String[] { "link", "/link" }, new String[] {
"<a
href=\""+ctx.fixLink(basePath+key.toString()+"?type=text/plain"+extrasNoMime)+"\">",
"</a>" });
option = optionList.addChild("li");
- L10n.addL10nSubstitution(option,
"FProxyToadlet.openForceDisk", new String[] { "link", "/link" }, new String[] {
"<a href=\""+basePath+key.toString()+"?forcedownload"+extras+"\">", "</a>" });
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openForceDisk", new String[] { "link", "/link" }, new String[] {
"<a
href=\""+ctx.fixLink(basePath+key.toString()+"?forcedownload"+extras)+"\">",
"</a>" });
if(!(mimeType.equals("application/octet-stream") ||
mimeType.equals("application/x-msdownload"))) {
option = optionList.addChild("li");
- L10n.addL10nSubstitution(option,
"FProxyToadlet.openForce", new String[] { "link", "/link", "mime" }, new
String[] { "<a href=\""+basePath + key.toString() + "?force=" +
getForceValue(key, now)+extras+"\">", "</a>", HTMLEncoder.encode(mimeType)});
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openForce", new String[] { "link", "/link", "mime" }, new
String[] { "<a href=\""+ctx.fixLink(basePath + key.toString() + "?force=" +
getForceValue(key, now)+extras)+"\">", "</a>", HTMLEncoder.encode(mimeType)});
}
if(referrer != null) {
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.backToReferrer", new String[] { "link", "/link" },
- new String[] { "<a
href=\""+HTMLEncoder.encode(referrer)+"\">", "</a>" });
+ new String[] { "<a
href=\""+HTMLEncoder.encode(ctx.fixLink(referrer))+"\">", "</a>" });
}
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.backToFProxy", new String[] { "link", "/link" },
- new String[] { "<a href=\"/\">", "</a>"
});
+ new String[] { "<a
href=\""+ctx.fixLink("/")+"\">", "</a>" });
if(ctx.isAllowedFullAccess() ||
!container.publicGatewayMode()) {
option = optionList.addChild("li");
HTMLNode optionForm = ctx.addFormChild(option,
"/queue/", "tooBigQueueForm");
@@ -450,7 +470,7 @@
String referer = sanitizeReferer(ctx);
- handleDownload(ctx, data, ctx.getBucketFactory(),
mimeType, requestedMimeType, httprequest.getParam("force", null),
httprequest.isParameterSet("forcedownload"), "/", key, maxSize != MAX_LENGTH ?
"&max-size="+SizeUtil.formatSizeWithoutSpace(maxSize) : "", referer, true, ctx,
core);
+ handleDownload(ctx, data, ctx.getBucketFactory(),
mimeType, requestedMimeType, httprequest.getParam("force", null),
httprequest.isParameterSet("forcedownload"), "/", key, uri, maxSize !=
MAX_LENGTH ? "&max-size="+SizeUtil.formatSizeWithoutSpace(maxSize) : "",
referer, true, ctx, core);
} catch (FetchException e) {
String msg = e.getMessage();
@@ -468,7 +488,7 @@
HTMLNode fileInformationList =
infoboxContent.addChild("ul");
HTMLNode option =
fileInformationList.addChild("li");
option.addChild("#", (l10n("filenameLabel") + '
'));
- option.addChild("a", "href", '/' +
key.toString(), getFilename(e, key, e.getExpectedMimeType()));
+ option.addChild("a", "href", ctx.fixLink('/' +
key.toString()), getFilename(e, key, e.getExpectedMimeType()));
String mime =
writeSizeAndMIME(fileInformationList, e);
@@ -493,7 +513,7 @@
optionForm.addChild("input", new
String[] { "type", "name", "value" }, new String[] { "submit", "download",
l10n("downloadInBackgroundToDisk") });
}
- optionList.addChild("li").addChild("a", new
String[] { "href", "title" }, new String[] { "/",
L10n.getString("Toadlet.homepage") }, l10n("abortToHomepage"));
+ optionList.addChild("li").addChild("a", new
String[] { "href", "title" }, new String[] { ctx.fixLink("/"),
L10n.getString("Toadlet.homepage") }, l10n("abortToHomepage"));
option = optionList.addChild("li");
option.addChild(ctx.getPageMaker().createBackLink(ctx, l10n("goBackToPrev")));
@@ -509,7 +529,7 @@
HTMLNode fileInformationList =
infoboxContent.addChild("ul");
HTMLNode option =
fileInformationList.addChild("li");
option.addChild("#", (l10n("filenameLabel") + '
'));
- option.addChild("a", "href", '/' +
key.toString(), getFilename(e, key, e.getExpectedMimeType()));
+ option.addChild("a", "href", ctx.fixLink('/' +
key.toString()), getFilename(e, key, e.getExpectedMimeType()));
String mime =
writeSizeAndMIME(fileInformationList, e);
infobox.addChild("div", "class",
"infobox-header", l10n("explanationTitle"));
@@ -529,7 +549,7 @@
if((e.mode == FetchException.NOT_IN_ARCHIVE) &&
(core.node.pluginManager.isPluginLoaded("plugins.KeyExplorer.KeyExplorer"))) {
option = optionList.addChild("li");
- L10n.addL10nSubstitution(option,
"FProxyToadlet.openWithKeyExplorer", new String[] { "link", "/link" }, new
String[] { "<a href=\"/plugins/plugins.KeyExplorer.KeyExplorer/?key=" +
key.toString() + "\">", "</a>" });
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openWithKeyExplorer", new String[] { "link", "/link" }, new
String[] { "<a
href=\""+ctx.fixLink("/plugins/plugins.KeyExplorer.KeyExplorer/?key=" +
key.toString()) + "\">", "</a>" });
}
if(!e.isFatal() && (ctx.isAllowedFullAccess()
|| !container.publicGatewayMode())) {
@@ -544,10 +564,10 @@
optionForm.addChild("input", new
String[] { "type", "name", "value" }, new String[] { "submit", "download",
l10n("downloadInBackgroundToDisk")});
optionList.addChild("li").
- addChild("a", "href",
getLink(key, requestedMimeType, maxSize, httprequest.getParam("force", null),
httprequest.isParameterSet("forcedownload"))).addChild("#", l10n("retryNow"));
+ addChild("a", "href",
ctx.fixLink(getLink(key, requestedMimeType, maxSize,
httprequest.getParam("force", null),
httprequest.isParameterSet("forcedownload")))).addChild("#", l10n("retryNow"));
}
- optionList.addChild("li").addChild("a", new
String[] { "href", "title" }, new String[] { "/",
L10n.getString("Toadlet.homepage") }, l10n("abortToHomepage"));
+ optionList.addChild("li").addChild("a", new
String[] { "href", "title" }, new String[] { ctx.fixLink("/"),
L10n.getString("Toadlet.homepage") }, l10n("abortToHomepage"));
option = optionList.addChild("li");
option.addChild(ctx.getPageMaker().createBackLink(ctx, l10n("goBackToPrev")));
@@ -702,6 +722,7 @@
QueueToadlet queueToadlet = new QueueToadlet(core,
core.getFCPServer(), client);
server.register(queueToadlet, "/queue/", true,
"FProxyToadlet.queueTitle", "FProxyToadlet.queue", false, queueToadlet);
+ queueToadlet.loadCompletedIdentifiers();
StatisticsToadlet statisticsToadlet = new
StatisticsToadlet(node, core, client);
server.register(statisticsToadlet, "/stats/", true,
"FProxyToadlet.statsTitle", "FProxyToadlet.stats", true, null);
Modified: trunk/freenet/src/freenet/clients/http/QueueToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/QueueToadlet.java 2009-01-07
17:14:25 UTC (rev 24957)
+++ trunk/freenet/src/freenet/clients/http/QueueToadlet.java 2009-01-07
17:15:08 UTC (rev 24958)
@@ -86,7 +86,6 @@
this.fcp = fcp;
if(fcp == null) throw new NullPointerException();
fcp.setCompletionCallback(this);
- loadCompletedIdentifiers();
}
@Override
@@ -127,7 +126,7 @@
}
MultiValueTable<String, String> responseHeaders
= new MultiValueTable<String, String>();
- responseHeaders.put("Location",
"/files/?key="+insertURI.toASCIIString());
+ responseHeaders.put("Location",
ctx.fixLink("/files/?key="+insertURI.toASCIIString()));
ctx.sendReplyHeaders(302, "Found",
responseHeaders, null, 0);
return;
}
@@ -135,7 +134,7 @@
String pass = request.getPartAsString("formPassword",
32);
if ((pass.length() == 0) ||
!pass.equals(core.formPassword)) {
MultiValueTable<String, String> headers = new
MultiValueTable<String, String>();
- headers.put("Location", "/queue/");
+ headers.put("Location", ctx.fixLink("/queue/"));
ctx.sendReplyHeaders(302, "Found", headers,
null, 0);
if(logMINOR) Logger.minor(this, "No
formPassword: "+pass);
return;
@@ -168,7 +167,7 @@
}
}
fcp.forceStorePersistentRequests();
- writePermanentRedirect(ctx, "Done", "/queue/");
+ writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
return;
} else if(request.isPartSet("remove_AllRequests") &&
(request.getPartAsString("remove_AllRequests", 32).length() > 0)) {
@@ -197,7 +196,7 @@
new
String[]{ failedIdentifiers.toString() }
));
else
- writePermanentRedirect(ctx, "Done",
"/queue/");
+ writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
fcp.forceStorePersistentRequests();
return;
}else if(request.isPartSet("download")) {
@@ -225,13 +224,13 @@
this.writeError(L10n.getString("QueueToadlet.errorDToDisk"),
L10n.getString("QueueToadlet.errorDToDiskConfig"), ctx);
return;
}
- writePermanentRedirect(ctx, "Done", "/queue/");
+ writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
return;
}else if(request.isPartSet("bulkDownloads")) {
String bulkDownloadsAsString =
request.getPartAsString("bulkDownloads", Integer.MAX_VALUE);
String[] keys =
bulkDownloadsAsString.split("\n");
if(("".equals(bulkDownloadsAsString)) ||
(keys.length < 1)) {
- writePermanentRedirect(ctx, "Done",
"/queue/");
+ writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
return;
}
LinkedList<String> success = new
LinkedList<String>(), failure = new LinkedList<String>();
@@ -278,7 +277,7 @@
}
failureDiv.addChild("br");
}
- alertContent.addChild("a", "href", "/queue/",
L10n.getString("Toadlet.returnToQueuepage"));
+ alertContent.addChild("a", "href",
ctx.fixLink("/queue/"), L10n.getString("Toadlet.returnToQueuepage"));
writeHTMLReply(ctx, 200, "OK",
pageNode.generate());
return;
} else if (request.isPartSet("change_priority")) {
@@ -292,7 +291,7 @@
break loop;
}
}
- writePermanentRedirect(ctx, "Done", "/queue/");
+ writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
fcp.forceStorePersistentRequests();
return;
} else if (request.getPartAsString("insert",
128).length() > 0) {
@@ -342,7 +341,7 @@
writeError(L10n.getString("QueueToadlet.errorInvalidURI"),
L10n.getString("QueueToadlet.errorInvalidURIToU"), ctx);
return;
}
- writePermanentRedirect(ctx, "Done", "/queue/");
+ writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
return;
} else if (request.isPartSet("insert-local-file")) {
String filename =
request.getPartAsString("filename", MAX_FILENAME_LENGTH);
@@ -380,7 +379,7 @@
this.writeError(L10n.getString("QueueToadlet.errorAccessDenied"),
L10n.getString("QueueToadlet.errorAccessDeniedFile", new String[]{ "file" },
new String[]{ file.getName() }), ctx);
return;
}
- writePermanentRedirect(ctx, "Done", "/queue/");
+ writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
return;
} else if (request.isPartSet("insert-local-dir")) {
String filename =
request.getPartAsString("filename", MAX_FILENAME_LENGTH);
@@ -411,7 +410,7 @@
this.writeError(L10n.getString("QueueToadlet.errorNoFileOrCannotRead"),
L10n.getString("QueueToadlet.errorAccessDeniedFile", new String[]{ "file" },
new String[]{ file.toString() }), ctx);
return;
}
- writePermanentRedirect(ctx, "Done", "/queue/");
+ writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
return;
} else if (request.isPartSet("get")) {
String identifier =
request.getPartAsString("identifier", MAX_IDENTIFIER_LENGTH);
@@ -520,7 +519,7 @@
String mimeType =
clientGet.getMIMEType();
String
requestedMimeType = request.getParam("type", null);
String forceString =
request.getParam("force");
-
FProxyToadlet.handleDownload(ctx, data, ctx.getBucketFactory(), mimeType,
requestedMimeType, forceString, request.isParameterSet("forcedownload"),
"/queue/", key, "", "/queue/", false, ctx, core);
+
FProxyToadlet.handleDownload(ctx, data, ctx.getBucketFactory(), mimeType,
requestedMimeType, forceString, request.isParameterSet("forcedownload"),
"/queue/", key, uri, "", "/queue/", false, ctx, core);
return;
}
}
@@ -983,10 +982,10 @@
return panicBox;
}
- private HTMLNode createIdentifierCell(FreenetURI uri, String
identifier, boolean directory) {
+ private HTMLNode createIdentifierCell(FreenetURI uri, String
identifier, boolean directory, ToadletContext ctx) {
HTMLNode identifierCell = new HTMLNode("td", "class",
"request-identifier");
if (uri != null) {
- identifierCell.addChild("span", "class",
"identifier_with_uri").addChild("a", "href", "/" + uri + (directory ? "/" :
""), identifier);
+ identifierCell.addChild("span", "class",
"identifier_with_uri").addChild("a", "href", ctx.fixLink("/" + uri + (directory
? "/" : "")), identifier);
} else {
identifierCell.addChild("span", "class",
"identifier_without_uri", identifier);
}
@@ -1005,9 +1004,9 @@
return persistenceCell;
}
- private HTMLNode createDownloadCell(PageMaker pageMaker, ClientGet p) {
+ private HTMLNode createDownloadCell(PageMaker pageMaker, ClientGet p,
ToadletContext ctx) {
HTMLNode downloadCell = new HTMLNode("td", "class",
"request-download");
- downloadCell.addChild("a", "href", p.getURI().toString(),
L10n.getString("QueueToadlet.download"));
+ downloadCell.addChild("a", "href",
ctx.fixLink("/queue/"+p.getURI().toString()),
L10n.getString("QueueToadlet.download"));
return downloadCell;
}
@@ -1031,10 +1030,10 @@
return sizeCell;
}
- private HTMLNode createKeyCell(FreenetURI uri, boolean addSlash) {
+ private HTMLNode createKeyCell(FreenetURI uri, boolean addSlash,
ToadletContext ctx) {
HTMLNode keyCell = new HTMLNode("td", "class", "request-key");
if (uri != null) {
- keyCell.addChild("span", "class",
"key_is").addChild("a", "href", '/' + uri.toString() + (addSlash ? "/" : ""),
uri.toShortString() + (addSlash ? "/" : ""));
+ keyCell.addChild("span", "class",
"key_is").addChild("a", "href", ctx.fixLink('/' + uri.toString() + (addSlash ?
"/" : "")), uri.toShortString() + (addSlash ? "/" : ""));
} else {
keyCell.addChild("span", "class", "key_unknown",
L10n.getString("QueueToadlet.unknown"));
}
@@ -1094,9 +1093,9 @@
for (int columnIndex = 0, columnCount = columns.length;
columnIndex < columnCount; columnIndex++) {
int column = columns[columnIndex];
if (column == LIST_IDENTIFIER) {
- headerRow.addChild("th").addChild("a", "href",
(isReversed ? "?sortBy=id" : "?sortBy=id&reversed")).addChild("#",
L10n.getString("QueueToadlet.identifier"));
+ headerRow.addChild("th").addChild("a", "href",
ctx.fixLink((isReversed ? "?sortBy=id" : "?sortBy=id&reversed"))).addChild("#",
L10n.getString("QueueToadlet.identifier"));
} else if (column == LIST_SIZE) {
- headerRow.addChild("th").addChild("a", "href",
(isReversed ? "?sortBy=size" : "?sortBy=size&reversed")).addChild("#",
L10n.getString("QueueToadlet.size"));
+ headerRow.addChild("th").addChild("a", "href",
ctx.fixLink((isReversed ? "?sortBy=size" :
"?sortBy=size&reversed"))).addChild("#", L10n.getString("QueueToadlet.size"));
} else if (column == LIST_DOWNLOAD) {
headerRow.addChild("th",
L10n.getString("QueueToadlet.download"));
} else if (column == LIST_MIME_TYPE) {
@@ -1108,13 +1107,13 @@
} else if (column == LIST_FILENAME) {
headerRow.addChild("th",
L10n.getString("QueueToadlet.fileName"));
} else if (column == LIST_PRIORITY) {
- headerRow.addChild("th").addChild("a", "href",
(isReversed ? "?sortBy=priority" : "?sortBy=priority&reversed")).addChild("#",
L10n.getString("QueueToadlet.priority"));
+ headerRow.addChild("th").addChild("a", "href",
ctx.fixLink((isReversed ? "?sortBy=priority" :
"?sortBy=priority&reversed"))).addChild("#",
L10n.getString("QueueToadlet.priority"));
} else if (column == LIST_FILES) {
headerRow.addChild("th",
L10n.getString("QueueToadlet.files"));
} else if (column == LIST_TOTAL_SIZE) {
headerRow.addChild("th",
L10n.getString("QueueToadlet.totalSize"));
} else if (column == LIST_PROGRESS) {
- headerRow.addChild("th").addChild("a", "href",
(isReversed ? "?sortBy=progress" : "?sortBy=progress&reversed")).addChild("#",
L10n.getString("QueueToadlet.progress"));
+ headerRow.addChild("th").addChild("a", "href",
ctx.fixLink((isReversed ? "?sortBy=progress" :
"?sortBy=progress&reversed"))).addChild("#",
L10n.getString("QueueToadlet.progress"));
} else if (column == LIST_REASON) {
headerRow.addChild("th",
L10n.getString("QueueToadlet.reason"));
}
@@ -1127,11 +1126,11 @@
int column = columns[columnIndex];
if (column == LIST_IDENTIFIER) {
if (clientRequest instanceof ClientGet)
{
-
requestRow.addChild(createIdentifierCell(((ClientGet) clientRequest).getURI(),
clientRequest.getIdentifier(), false));
+
requestRow.addChild(createIdentifierCell(((ClientGet) clientRequest).getURI(),
clientRequest.getIdentifier(), false, ctx));
} else if (clientRequest instanceof
ClientPutDir) {
-
requestRow.addChild(createIdentifierCell(((ClientPutDir)
clientRequest).getFinalURI(), clientRequest.getIdentifier(), true));
+
requestRow.addChild(createIdentifierCell(((ClientPutDir)
clientRequest).getFinalURI(), clientRequest.getIdentifier(), true, ctx));
} else if (clientRequest instanceof
ClientPut) {
-
requestRow.addChild(createIdentifierCell(((ClientPut)
clientRequest).getFinalURI(), clientRequest.getIdentifier(), false));
+
requestRow.addChild(createIdentifierCell(((ClientPut)
clientRequest).getFinalURI(), clientRequest.getIdentifier(), false, ctx));
}
} else if (column == LIST_SIZE) {
if (clientRequest instanceof ClientGet)
{
@@ -1140,7 +1139,7 @@
requestRow.addChild(createSizeCell(((ClientPut) clientRequest).getDataSize(),
true, advancedModeEnabled));
}
} else if (column == LIST_DOWNLOAD) {
-
requestRow.addChild(createDownloadCell(pageMaker, (ClientGet) clientRequest));
+
requestRow.addChild(createDownloadCell(pageMaker, (ClientGet) clientRequest,
ctx));
} else if (column == LIST_MIME_TYPE) {
if (clientRequest instanceof ClientGet)
{
requestRow.addChild(createTypeCell(((ClientGet) clientRequest).getMIMEType()));
@@ -1151,11 +1150,11 @@
requestRow.addChild(createPersistenceCell(clientRequest.isPersistent(),
clientRequest.isPersistentForever()));
} else if (column == LIST_KEY) {
if (clientRequest instanceof ClientGet)
{
-
requestRow.addChild(createKeyCell(((ClientGet) clientRequest).getURI(), false));
+
requestRow.addChild(createKeyCell(((ClientGet) clientRequest).getURI(), false,
ctx));
} else if (clientRequest instanceof
ClientPut) {
-
requestRow.addChild(createKeyCell(((ClientPut) clientRequest).getFinalURI(),
false));
+
requestRow.addChild(createKeyCell(((ClientPut) clientRequest).getFinalURI(),
false, ctx));
}else {
-
requestRow.addChild(createKeyCell(((ClientPutDir) clientRequest).getFinalURI(),
true));
+
requestRow.addChild(createKeyCell(((ClientPutDir) clientRequest).getFinalURI(),
true, ctx));
}
} else if (column == LIST_FILENAME) {
if (clientRequest instanceof ClientGet)
{
@@ -1211,7 +1210,7 @@
}, "Save completed identifiers");
}
- private void loadCompletedIdentifiers() {
+ void loadCompletedIdentifiers() {
File completedIdentifiersList = new
File(core.node.getNodeDir(), "completed.list");
File completedIdentifiersListNew = new
File(core.node.getNodeDir(), "completed.list.bak");
if(!readCompletedIdentifiers(completedIdentifiersList)) {
@@ -1335,7 +1334,7 @@
HTMLNode text = new HTMLNode("div");
L10n.addL10nSubstitution(text,
"QueueToadlet.downloadSucceeded",
new String[] { "link", "/link",
"origlink", "/origlink", "filename", "size" },
- new String[] { "<a
href=\"/queue/"+uri.toASCIIString()+"\">", "</a>", "<a
href=\"/"+uri.toASCIIString()+"\">", "</a>", name, SizeUtil.formatSize(size) }
);
+ new String[] { "<a
href=\""+container.fixLink("/queue/"+uri.toASCIIString())+"\">", "</a>", "<a
href=\""+container.fixLink("/"+uri.toASCIIString())+"\">", "</a>", name,
SizeUtil.formatSize(size) } );
UserAlert alert =
new SimpleHTMLUserAlert(true, title, title, text,
UserAlert.MINOR) {
@Override
@@ -1369,7 +1368,7 @@
HTMLNode text = new HTMLNode("div");
L10n.addL10nSubstitution(text,
"QueueToadlet.uploadSucceeded",
new String[] { "link", "/link",
"filename", "size" },
- new String[] { "<a
href=\"/"+uri.toASCIIString()+"\">", "</a>", name, SizeUtil.formatSize(size) }
);
+ new String[] { "<a
href=\""+container.fixLink("/"+uri.toASCIIString())+"\">", "</a>", name,
SizeUtil.formatSize(size) } );
UserAlert alert =
new SimpleHTMLUserAlert(true, title, title, text,
UserAlert.MINOR) {
@Override
@@ -1400,7 +1399,7 @@
HTMLNode text = new HTMLNode("div");
L10n.addL10nSubstitution(text,
"QueueToadlet.siteUploadSucceeded",
new String[] { "link", "/link",
"filename", "size", "files" },
- new String[] { "<a
href=\"/"+uri.toASCIIString()+"\">", "</a>", name, SizeUtil.formatSize(size),
Integer.toString(files) } );
+ new String[] { "<a
href=\""+container.fixLink("/"+uri.toASCIIString())+"\">", "</a>", name,
SizeUtil.formatSize(size), Integer.toString(files) } );
UserAlert alert =
new SimpleHTMLUserAlert(true, title, title, text,
UserAlert.MINOR) {
@Override
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs