Author: toad
Date: 2009-01-07 19:59:47 +0000 (Wed, 07 Jan 2009)
New Revision: 24969
Modified:
trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
trunk/freenet/src/freenet/clients/http/BrowserTestToadlet.java
trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java
trunk/freenet/src/freenet/clients/http/ConnectivityToadlet.java
trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
trunk/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java
trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java
trunk/freenet/src/freenet/clients/http/PageMaker.java
trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
trunk/freenet/src/freenet/clients/http/QueueToadlet.java
trunk/freenet/src/freenet/clients/http/SimpleHelpToadlet.java
trunk/freenet/src/freenet/clients/http/StaticToadlet.java
trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
trunk/freenet/src/freenet/clients/http/Toadlet.java
trunk/freenet/src/freenet/clients/http/ToadletContext.java
trunk/freenet/src/freenet/clients/http/TranslationToadlet.java
trunk/freenet/src/freenet/clients/http/UserAlertsToadlet.java
trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java
Log:
Don't use ToadletContext as a proxy to provide LinkFixer, use the
ToadletContainer itself directly.
Modified: trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
2009-01-07 19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/BookmarkEditorToadlet.java
2009-01-07 19:59:47 UTC (rev 24969)
@@ -256,7 +256,7 @@
}
HTMLNode bookmarksBox =
content.addChild(pageMaker.getInfobox("infobox-normal",
L10n.getString("BookmarkEditorToadlet.myBookmarksTitle")));
-
pageMaker.getContentNode(bookmarksBox).addChild(getBookmarksList(ctx));
+
pageMaker.getContentNode(bookmarksBox).addChild(getBookmarksList(container));
HTMLNode addDefaultBookmarksForm = ctx.addFormChild(content,
"", "AddDefaultBookmarks");
addDefaultBookmarksForm.addChild("input", new String[]{"type",
"name", "value"}, new String[]{"submit", "AddDefaultBookmarks",
L10n.getString("BookmarkEditorToadlet.addDefaultBookmarks")});
@@ -354,7 +354,7 @@
pageMaker.getContentNode(errorBox).addChild("#",
L10n.getString("BookmarkEditorToadlet.invalidKey"));
}
HTMLNode bookmarksBox =
content.addChild(pageMaker.getInfobox("infobox-normal",
L10n.getString("BookmarkEditorToadlet.myBookmarksTitle")));
-
pageMaker.getContentNode(bookmarksBox).addChild(getBookmarksList(ctx));
+
pageMaker.getContentNode(bookmarksBox).addChild(getBookmarksList(container));
HTMLNode addDefaultBookmarksForm = ctx.addFormChild(content,
"", "AddDefaultBookmarks");
addDefaultBookmarksForm.addChild("input", new String[]{"type",
"name", "value"}, new String[]{"submit", "AddDefaultBookmarks",
L10n.getString("BookmarkEditorToadlet.addDefaultBookmarks")});
Modified: trunk/freenet/src/freenet/clients/http/BrowserTestToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/BrowserTestToadlet.java
2009-01-07 19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/BrowserTestToadlet.java
2009-01-07 19:59:47 UTC (rev 24969)
@@ -191,7 +191,7 @@
HTMLNode contentNode =
ctx.getPageMaker().getContentNode(pageNode);
if(ctx.isAllowedFullAccess())
- contentNode.addChild(core.alerts.createSummary(ctx));
+
contentNode.addChild(core.alerts.createSummary(container));
// #### Test MIME inline
HTMLNode mimeAutodetectBox =
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-warning", "MIME
Inline"));
Modified: trunk/freenet/src/freenet/clients/http/ConfigToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ConfigToadlet.java 2009-01-07
19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/ConfigToadlet.java 2009-01-07
19:59:47 UTC (rev 24969)
@@ -322,9 +322,9 @@
HTMLNode infobox =
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-normal",
l10n("possibilitiesTitle")));
HTMLNode content = ctx.getPageMaker().getContentNode(infobox);
- content.addChild("a", new String[]{"href", "title"}, new
String[]{ctx.fixLink("/config/"), l10n("shortTitle")},
l10n("returnToNodeConfig"));
+ content.addChild("a", new String[]{"href", "title"}, new
String[]{container.fixLink("/config/"), l10n("shortTitle")},
l10n("returnToNodeConfig"));
content.addChild("br");
- addHomepageLink(content, ctx);
+ addHomepageLink(content, container);
writeHTMLReply(ctx, 200, "OK", pageNode.generate());
@@ -350,9 +350,9 @@
HTMLNode pageNode =
ctx.getPageMaker().getPageNode(L10n.getString("ConfigToadlet.fullTitle", new
String[] { "name" }, new String[] { node.getMyName() }), ctx);
HTMLNode contentNode =
ctx.getPageMaker().getContentNode(pageNode);
- contentNode.addChild(core.alerts.createSummary(ctx));
+ contentNode.addChild(core.alerts.createSummary(container));
- final int mode =
ctx.getPageMaker().drawModeSelectionArray(core, ctx, req, contentNode,
MODE_SECURITY_LEVELS, "SecurityLevels.title", "SecurityLevels.tooltip",
"/config/");
+ final int mode =
ctx.getPageMaker().drawModeSelectionArray(core, container, req, contentNode,
MODE_SECURITY_LEVELS, "SecurityLevels.title", "SecurityLevels.tooltip",
"/config/");
if(mode == MODE_SECURITY_LEVELS) {
drawSecurityLevelsPage(contentNode, ctx);
@@ -362,7 +362,7 @@
HTMLNode navigationBar =
ctx.getPageMaker().getInfobox("navbar", l10n("configNavTitle"));
HTMLNode navigationContent =
ctx.getPageMaker().getContentNode(navigationBar).addChild("ul");
if(!L10n.getSelectedLanguage().equals(L10n.LANGUAGE.getDefault()))
- navigationContent.addChild("a", "href",
ctx.fixLink(TranslationToadlet.TOADLET_URL), l10n("contributeTranslation"));
+ navigationContent.addChild("a", "href",
container.fixLink(TranslationToadlet.TOADLET_URL),
l10n("contributeTranslation"));
HTMLNode navigationTable =
navigationContent.addChild("table", "class", "config_navigation");
HTMLNode navigationTableRow =
navigationTable.addChild("tr");
HTMLNode nextTableCell = navigationTableRow;
@@ -390,9 +390,9 @@
String defaultValue = "128";
item.addChild("span", new String[]{ "class",
"title", "style" },
new String[]{
"configshortdesc", L10n.getString("ConfigToadlet.defaultIs", new String[] {
"default" }, new String[] { defaultValue }),
- "cursor: help;"
}).addChild(L10n.getHTMLNode("WrapperConfig."+configName+".short", ctx));
+ "cursor: help;"
}).addChild(L10n.getHTMLNode("WrapperConfig."+configName+".short", container));
item.addChild("span", "class",
"config").addChild("input", new String[] { "type", "class", "name", "value" },
new String[] { "text", "config", configName, curValue });
- item.addChild("span", "class",
"configlongdesc").addChild(L10n.getHTMLNode("WrapperConfig."+configName+".long",
ctx));
+ item.addChild("span", "class",
"configlongdesc").addChild(L10n.getHTMLNode("WrapperConfig."+configName+".long",
container));
}
}
@@ -411,7 +411,7 @@
HTMLNode configItemNode =
configGroupUlNode.addChild("li");
configItemNode.addChild("span", new
String[]{ "class", "title", "style" },
new String[]{
"configshortdesc", L10n.getString("ConfigToadlet.defaultIs", new String[] {
"default" }, new String[] { o[j].getDefault() }) + (mode >=
PageMaker.MODE_ADVANCED ? " ["+sc[i].getPrefix() + '.' + o[j].getName() + ']' :
""),
- "cursor: help;"
}).addChild(L10n.getHTMLNode(o[j].getShortDesc(), ctx));
+ "cursor: help;"
}).addChild(L10n.getHTMLNode(o[j].getShortDesc(), container));
HTMLNode configItemValueNode =
configItemNode.addChild("span", "class", "config");
if(o[j].getValueString() == null){
Logger.error(this,
sc[i].getPrefix() + configName + "has returned null from config!);");
@@ -436,7 +436,7 @@
new String[] { "text",
"config", o[j].getShortDesc(),
sc[i].getPrefix() + '.' + configName, o[j].getValueString() });
- configItemNode.addChild("span",
"class", "configlongdesc").addChild(L10n.getHTMLNode(o[j].getLongDesc(), ctx));
+ configItemNode.addChild("span",
"class", "configlongdesc").addChild(L10n.getHTMLNode(o[j].getLongDesc(),
container));
}
}
Modified: trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java
2009-01-07 19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java
2009-01-07 19:59:47 UTC (rev 24969)
@@ -236,8 +236,8 @@
long now = System.currentTimeMillis();
if(ctx.isAllowedFullAccess())
- contentNode.addChild(core.alerts.createSummary(ctx));
- final int mode =
ctx.getPageMaker().drawModeSelectionArray(core, ctx, request, contentNode,
getURL());
+
contentNode.addChild(core.alerts.createSummary(container));
+ final int mode =
ctx.getPageMaker().drawModeSelectionArray(core, container, request,
contentNode, getURL());
if(peerNodeStatuses.length>0){
@@ -360,7 +360,7 @@
if (mode >= PageMaker.MODE_ADVANCED) {
if (!path.endsWith("displaymessagetypes.html"))
{
peerTableInfoboxHeader.addChild("#", "
");
- peerTableInfoboxHeader.addChild("a",
"href", "displaymessagetypes.html", "(more detailed)");
+ peerTableInfoboxHeader.addChild("a",
"href", container.fixLink(getURL()+"displaymessagetypes.html"), "(more
detailed)");
}
}
HTMLNode peerTableInfoboxContent =
peerTableInfobox.addChild("div", "class", "infobox-content");
@@ -380,30 +380,30 @@
HTMLNode peerTableHeaderRow =
peerTable.addChild("tr");
if(enablePeerActions)
peerTableHeaderRow.addChild("th");
- peerTableHeaderRow.addChild("th").addChild("a",
"href", sortString(isReversed, "status")).addChild("#", l10n("statusTitle"));
+ peerTableHeaderRow.addChild("th").addChild("a",
"href", container.fixLink(sortString(isReversed, "status"))).addChild("#",
l10n("statusTitle"));
if(hasNameColumn())
-
peerTableHeaderRow.addChild("th").addChild("a", "href", sortString(isReversed,
"name")).addChild("span", new String[] { "title", "style" }, new String[] {
l10n("nameClickToMessage"), "border-bottom: 1px dotted; cursor: help;" },
l10n("nameTitle"));
+
peerTableHeaderRow.addChild("th").addChild("a", "href",
container.fixLink(sortString(isReversed, "name"))).addChild("span", new
String[] { "title", "style" }, new String[] { l10n("nameClickToMessage"),
"border-bottom: 1px dotted; cursor: help;" }, l10n("nameTitle"));
if (mode >= PageMaker.MODE_ADVANCED) {
-
peerTableHeaderRow.addChild("th").addChild("a", "href", sortString(isReversed,
"address")).addChild("span", new String[] { "title", "style" }, new String[] {
l10n("ipAddress"), "border-bottom: 1px dotted; cursor: help;" },
l10n("ipAddressTitle"));
+
peerTableHeaderRow.addChild("th").addChild("a", "href",
container.fixLink(sortString(isReversed, "address"))).addChild("span", new
String[] { "title", "style" }, new String[] { l10n("ipAddress"),
"border-bottom: 1px dotted; cursor: help;" }, l10n("ipAddressTitle"));
}
- peerTableHeaderRow.addChild("th").addChild("a",
"href", sortString(isReversed, "version")).addChild("#", l10n("versionTitle"));
+ peerTableHeaderRow.addChild("th").addChild("a",
"href", container.fixLink(sortString(isReversed, "version"))).addChild("#",
l10n("versionTitle"));
if (mode >= PageMaker.MODE_ADVANCED) {
-
peerTableHeaderRow.addChild("th").addChild("a", "href", sortString(isReversed,
"location")).addChild("#", "Location");
-
peerTableHeaderRow.addChild("th").addChild("a", "href", sortString(isReversed,
"backoff")).addChild("span", new String[] { "title", "style" }, new String[] {
"Other node busy? Display: Percentage of time the node is overloaded, Current
wait time remaining (0=not overloaded)/total/last overload reason",
"border-bottom: 1px dotted; cursor: help;" }, "Backoff");
+
peerTableHeaderRow.addChild("th").addChild("a", "href",
container.fixLink(sortString(isReversed, "location"))).addChild("#",
"Location");
+
peerTableHeaderRow.addChild("th").addChild("a", "href",
container.fixLink(sortString(isReversed, "backoff"))).addChild("span", new
String[] { "title", "style" }, new String[] { "Other node busy? Display:
Percentage of time the node is overloaded, Current wait time remaining (0=not
overloaded)/total/last overload reason", "border-bottom: 1px dotted; cursor:
help;" }, "Backoff");
-
peerTableHeaderRow.addChild("th").addChild("a", "href", sortString(isReversed,
"overload_p")).addChild("span", new String[] { "title", "style" }, new String[]
{ "Probability of the node rejecting a request due to overload or causing a
timeout.", "border-bottom: 1px dotted; cursor: help;" }, "Overload
Probability");
+
peerTableHeaderRow.addChild("th").addChild("a", "href",
container.fixLink(sortString(isReversed, "overload_p"))).addChild("span", new
String[] { "title", "style" }, new String[] { "Probability of the node
rejecting a request due to overload or causing a timeout.", "border-bottom: 1px
dotted; cursor: help;" }, "Overload Probability");
}
- peerTableHeaderRow.addChild("th").addChild("a",
"href", sortString(isReversed, "idle")).addChild("span", new String[] {
"title", "style" }, new String[] { l10n("idleTime"), "border-bottom: 1px
dotted; cursor: help;" }, l10n("idleTimeTitle"));
+ peerTableHeaderRow.addChild("th").addChild("a",
"href", container.fixLink(sortString(isReversed, "idle"))).addChild("span", new
String[] { "title", "style" }, new String[] { l10n("idleTime"), "border-bottom:
1px dotted; cursor: help;" }, l10n("idleTimeTitle"));
if(hasPrivateNoteColumn())
-
peerTableHeaderRow.addChild("th").addChild("a", "href", sortString(isReversed,
"privnote")).addChild("span", new String[] { "title", "style" }, new String[] {
l10n("privateNote"), "border-bottom: 1px dotted; cursor: help;" },
l10n("privateNoteTitle"));
+
peerTableHeaderRow.addChild("th").addChild("a", "href",
container.fixLink(sortString(isReversed, "privnote"))).addChild("span", new
String[] { "title", "style" }, new String[] { l10n("privateNote"),
"border-bottom: 1px dotted; cursor: help;" }, l10n("privateNoteTitle"));
if(mode >= PageMaker.MODE_ADVANCED) {
-
peerTableHeaderRow.addChild("th").addChild("a", "href", sortString(isReversed,
"time_routable")).addChild("#", "%\u00a0Time Routable");
-
peerTableHeaderRow.addChild("th").addChild("a", "href", sortString(isReversed,
"selection_percentage")).addChild("#", "%\u00a0Selection");
-
peerTableHeaderRow.addChild("th").addChild("a", "href", sortString(isReversed,
"total_traffic")).addChild("#", "Total\u00a0Traffic\u00a0(in/out/resent)");
+
peerTableHeaderRow.addChild("th").addChild("a", "href",
container.fixLink(sortString(isReversed, "time_routable"))).addChild("#",
"%\u00a0Time Routable");
+
peerTableHeaderRow.addChild("th").addChild("a", "href",
container.fixLink(sortString(isReversed,
"selection_percentage"))).addChild("#", "%\u00a0Selection");
+
peerTableHeaderRow.addChild("th").addChild("a", "href",
container.fixLink(sortString(isReversed, "total_traffic"))).addChild("#",
"Total\u00a0Traffic\u00a0(in/out/resent)");
peerTableHeaderRow.addChild("th",
"Congestion\u00a0Control");
-
peerTableHeaderRow.addChild("th").addChild("a", "href", sortString(isReversed,
"time_delta")).addChild("#", "Time\u00a0Delta");
-
peerTableHeaderRow.addChild("th").addChild("a", "href", sortString(isReversed,
"uptime")).addChild("#", "Reported\u00a0Uptime");
+
peerTableHeaderRow.addChild("th").addChild("a", "href",
container.fixLink(sortString(isReversed, "time_delta"))).addChild("#",
"Time\u00a0Delta");
+
peerTableHeaderRow.addChild("th").addChild("a", "href",
container.fixLink(sortString(isReversed, "uptime"))).addChild("#",
"Reported\u00a0Uptime");
}
SimpleColumn[] endCols = endColumnHeaders(mode
>= PageMaker.MODE_ADVANCED);
@@ -413,7 +413,7 @@
HTMLNode header =
peerTableHeaderRow.addChild("th");
String sortString =
col.getSortString();
if(sortString != null)
- header =
header.addChild("a", "href", sortString(isReversed, sortString));
+ header =
header.addChild("a", "href", container.fixLink(sortString(isReversed,
sortString)));
header.addChild("span", new
String[] { "title", "style" }, new String[] {
L10n.getString(col.getExplanationKey()), "border-bottom: 1px dotted; cursor:
help;" }, L10n.getString(col.getTitleKey()));
}
}
Modified: trunk/freenet/src/freenet/clients/http/ConnectivityToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ConnectivityToadlet.java
2009-01-07 19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/ConnectivityToadlet.java
2009-01-07 19:59:47 UTC (rev 24969)
@@ -64,12 +64,12 @@
/* add alert summary box */
if(ctx.isAllowedFullAccess())
- contentNode.addChild(core.alerts.createSummary(ctx));
- final int mode =
ctx.getPageMaker().drawModeSelectionArray(core, ctx, request, contentNode,
"/connectivity/");
+
contentNode.addChild(core.alerts.createSummary(container));
+ final int mode =
ctx.getPageMaker().drawModeSelectionArray(core, container, request,
contentNode, "/connectivity/");
// Add connection type box.
- node.ipDetector.addConnectionTypeBox(contentNode, ctx);
+ node.ipDetector.addConnectionTypeBox(contentNode, container);
UdpSocketHandler[] handlers = node.getPacketSocketHandlers();
Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java 2009-01-07
19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java 2009-01-07
19:59:47 UTC (rev 24969)
@@ -107,7 +107,7 @@
String pass = req.getPartAsString("formPassword", 32);
if ((pass.length() == 0) || !pass.equals(core.formPassword)) {
MultiValueTable<String, String> headers = new
MultiValueTable<String, String>();
- headers.put("Location", ctx.fixLink("/"));
+ headers.put("Location", container.fixLink("/"));
ctx.sendReplyHeaders(302, "Found", headers, null, 0);
return;
}
@@ -204,7 +204,7 @@
Bucket toFree = null;
try {
if((!force) && (!forceDownload)) {
- FilterOutput fo = ContentFilter.filter(data,
bucketFactory, mimeType, uri == null ? key.toURI(basePath) : uri,
container.enableInlinePrefetch() ? prefetchHook : null, ctx);
+ FilterOutput fo = ContentFilter.filter(data,
bucketFactory, mimeType, uri == null ? key.toURI(basePath) : uri,
container.enableInlinePrefetch() ? prefetchHook : null, container);
if(data != fo.data) toFree = fo.data;
data = fo.data;
mimeType = fo.type;
@@ -223,7 +223,7 @@
L10n.addL10nSubstitution(option,
"FProxyToadlet.openPossRSSAsPlainText", new String[] { "link", "/link", "bold",
"/bold" },
new String[] {
- "<a
href=\""+ctx.fixLink(basePath+key.toString()+"?type=text/plain&force="+getForceValue(key,now)+extrasNoMime)+"\">",
+ "<a
href=\""+container.fixLink(basePath+key.toString()+"?type=text/plain&force="+getForceValue(key,now)+extrasNoMime)+"\">",
"</a>",
"<b>",
"</b>" });
@@ -231,7 +231,7 @@
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.openPossRSSForceDisk", new String[] { "link", "/link", "bold",
"/bold" },
new String[] {
- "<a
href=\""+ctx.fixLink(basePath+key.toString()+"?forcedownload"+extras)+"\">",
+ "<a
href=\""+container.fixLink(basePath+key.toString()+"?forcedownload"+extras)+"\">",
"</a>",
"<b>",
"</b>" });
@@ -240,7 +240,7 @@
option =
optionList.addChild("li");
L10n.addL10nSubstitution(option, "FProxyToadlet.openRSSForce", new String[] {
"link", "/link", "bold", "/bold", "mime" },
new String[] {
- "<a
href=\""+ctx.fixLink(basePath+key.toString()+"?force="+getForceValue(key,
now)+extras)+"\">",
+ "<a
href=\""+container.fixLink(basePath+key.toString()+"?force="+getForceValue(key,
now)+extras)+"\">",
"</a>",
"<b>",
"</b>",
@@ -249,18 +249,18 @@
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.openRSSAsRSS", new String[] { "link", "/link", "bold", "/bold" },
new String[] {
- "<a
href=\""+ctx.fixLink(basePath + key.toString() +
"?type=application/xml+rss&force=" + getForceValue(key,
now)+extrasNoMime)+"\">",
+ "<a
href=\""+container.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(ctx.fixLink(referrer))+"\">", "</a>" });
+ new String[] {
"<a href=\""+HTMLEncoder.encode(container.fixLink(referrer))+"\">", "</a>" });
}
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.backToFProxy", new String[] { "link", "/link" },
- new String[] { "<a
href=\""+ctx.fixLink("/")+"\">", "</a>" });
+ new String[] { "<a
href=\""+container.fixLink("/")+"\">", "</a>" });
byte[] pageBytes =
pageNode.generate().getBytes("UTF-8");
context.sendReplyHeaders(200, "OK", new
MultiValueTable<String, String>(), "text/html; charset=utf-8",
pageBytes.length);
@@ -298,27 +298,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=\""+ctx.fixLink(basePath +
"plugins/plugins.ThawIndexBrowser.ThawIndexBrowser/?key=" + key.toString()) +
"\">", "</a></b>" });
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openAsThawIndex", new String[] { "link", "/link" }, new String[]
{ "<b><a href=\""+container.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=\""+ctx.fixLink(basePath+key.toString()+"?type=text/plain"+extrasNoMime)+"\">",
"</a>" });
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openAsText", new String[] { "link", "/link" }, new String[] {
"<a
href=\""+container.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=\""+ctx.fixLink(basePath+key.toString()+"?forcedownload"+extras)+"\">",
"</a>" });
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openForceDisk", new String[] { "link", "/link" }, new String[] {
"<a
href=\""+container.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=\""+ctx.fixLink(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=\""+container.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(ctx.fixLink(referrer))+"\">", "</a>" });
+ new String[] { "<a
href=\""+HTMLEncoder.encode(container.fixLink(referrer))+"\">", "</a>" });
}
option = optionList.addChild("li");
L10n.addL10nSubstitution(option,
"FProxyToadlet.backToFProxy", new String[] { "link", "/link" },
- new String[] { "<a
href=\""+ctx.fixLink("/")+"\">", "</a>" });
+ new String[] { "<a
href=\""+container.fixLink("/")+"\">", "</a>" });
if(ctx.isAllowedFullAccess() ||
!container.publicGatewayMode()) {
option = optionList.addChild("li");
HTMLNode optionForm = ctx.addFormChild(option,
"/queue/", "tooBigQueueForm");
@@ -494,7 +494,7 @@
errorContent.addChild("br");
errorContent.addChild(ctx.getPageMaker().createBackLink(ctx, l10n("goBack")));
errorContent.addChild("br");
- addHomepageLink(errorContent, ctx);
+ addHomepageLink(errorContent, container);
this.writeHTMLReply(ctx, 400, l10n("invalidKeyTitle"),
pageNode.generate());
return;
@@ -528,7 +528,7 @@
if(Logger.shouldLog(Logger.MINOR, this))
Logger.minor(this, "Failed to fetch "+uri+" :
"+e);
if(e.newURI != null) {
- Toadlet.writePermanentRedirect(ctx, msg,
ctx.fixLink('/' +e.newURI.toASCIIString() + override));
+ Toadlet.writePermanentRedirect(ctx, msg,
container.fixLink('/' +e.newURI.toASCIIString() + override));
} else if(e.mode == FetchException.TOO_BIG) {
HTMLNode pageNode =
ctx.getPageMaker().getPageNode(l10n("fileInformationTitle"), ctx);
HTMLNode contentNode =
ctx.getPageMaker().getContentNode(pageNode);
@@ -539,7 +539,7 @@
HTMLNode fileInformationList =
infoboxContent.addChild("ul");
HTMLNode option =
fileInformationList.addChild("li");
option.addChild("#", (l10n("filenameLabel") + '
'));
- option.addChild("a", "href", ctx.fixLink('/' +
key.toString()), getFilename(e, key, e.getExpectedMimeType()));
+ option.addChild("a", "href",
container.fixLink('/' + key.toString()), getFilename(e, key,
e.getExpectedMimeType()));
String mime =
writeSizeAndMIME(fileInformationList, e);
@@ -564,7 +564,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[] { ctx.fixLink("/"),
L10n.getString("Toadlet.homepage") }, l10n("abortToHomepage"));
+ optionList.addChild("li").addChild("a", new
String[] { "href", "title" }, new String[] { container.fixLink("/"),
L10n.getString("Toadlet.homepage") }, l10n("abortToHomepage"));
option = optionList.addChild("li");
option.addChild(ctx.getPageMaker().createBackLink(ctx, l10n("goBackToPrev")));
@@ -580,7 +580,7 @@
HTMLNode fileInformationList =
infoboxContent.addChild("ul");
HTMLNode option =
fileInformationList.addChild("li");
option.addChild("#", (l10n("filenameLabel") + '
'));
- option.addChild("a", "href", ctx.fixLink('/' +
key.toString()), getFilename(e, key, e.getExpectedMimeType()));
+ option.addChild("a", "href",
container.fixLink('/' + key.toString()), getFilename(e, key,
e.getExpectedMimeType()));
String mime =
writeSizeAndMIME(fileInformationList, e);
infobox.addChild("div", "class",
"infobox-header", l10n("explanationTitle"));
@@ -600,7 +600,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=\""+ctx.fixLink("/plugins/plugins.KeyExplorer.KeyExplorer/?key=" +
key.toString()) + "\">", "</a>" });
+ L10n.addL10nSubstitution(option,
"FProxyToadlet.openWithKeyExplorer", new String[] { "link", "/link" }, new
String[] { "<a
href=\""+container.fixLink("/plugins/plugins.KeyExplorer.KeyExplorer/?key=" +
key.toString()) + "\">", "</a>" });
}
if(!e.isFatal() && (ctx.isAllowedFullAccess()
|| !container.publicGatewayMode())) {
@@ -615,10 +615,10 @@
optionForm.addChild("input", new
String[] { "type", "name", "value" }, new String[] { "submit", "download",
l10n("downloadInBackgroundToDisk")});
optionList.addChild("li").
- addChild("a", "href",
ctx.fixLink(getLink(key, requestedMimeType, maxSize,
httprequest.getParam("force", null),
httprequest.isParameterSet("forcedownload")))).addChild("#", l10n("retryNow"));
+ addChild("a", "href",
container.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[] { ctx.fixLink("/"),
L10n.getString("Toadlet.homepage") }, l10n("abortToHomepage"));
+ optionList.addChild("li").addChild("a", new
String[] { "href", "title" }, new String[] { container.fixLink("/"),
L10n.getString("Toadlet.homepage") }, l10n("abortToHomepage"));
option = optionList.addChild("li");
option.addChild(ctx.getPageMaker().createBackLink(ctx, l10n("goBackToPrev")));
Modified: trunk/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java
2009-01-07 19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java
2009-01-07 19:59:47 UTC (rev 24969)
@@ -76,7 +76,7 @@
HTMLNode pageNode = pageMaker.getPageNode(l10n("listingTitle",
"path", currentPath.getAbsolutePath()), toadletContext);
HTMLNode contentNode = pageMaker.getContentNode(pageNode);
if(toadletContext.isAllowedFullAccess())
-
contentNode.addChild(core.alerts.createSummary(toadletContext));
+
contentNode.addChild(core.alerts.createSummary(container));
HTMLNode infoboxDiv = contentNode.addChild("div", "class",
"infobox");
infoboxDiv.addChild("div", "class", "infobox-header",
l10n("listing", "path", currentPath.getAbsolutePath()));
Modified: trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java 2009-01-07
19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/N2NTMToadlet.java 2009-01-07
19:59:47 UTC (rev 24969)
@@ -74,7 +74,7 @@
if (peernode_name == null) {
contentNode.addChild(createPeerInfobox("infobox-error",
l10n("peerNotFoundTitle"),
l10n("peerNotFoundWithHash",
- "hash",
input_hashcode_string), ctx));
+ "hash",
input_hashcode_string), container));
this.writeHTMLReply(ctx, 200, "OK", pageNode
.generate());
return;
@@ -100,7 +100,7 @@
}
private static HTMLNode createPeerInfobox(String infoboxType,
- String header, String message, ToadletContext ctx) {
+ String header, String message, LinkFixer ctx) {
HTMLNode infobox = new HTMLNode("div", "class", "infobox "
+ infoboxType);
infobox.addChild("div", "class", "infobox-header", header);
@@ -153,7 +153,7 @@
filename = new File(fnam);
if(!(filename.exists() && filename.canRead())) {
peerTableInfobox.addChild("#",
l10n("noSuchFileOrCannotRead"));
-
Toadlet.addHomepageLink(peerTableInfobox, ctx);
+
Toadlet.addHomepageLink(peerTableInfobox, container);
this.writeHTMLReply(ctx, 400, "OK",
pageNode.generate());
return;
}
@@ -174,7 +174,7 @@
status =
pn.sendFileOffer(filename, message);
} catch (IOException e) {
peerTableInfobox.addChild("#", l10n("noSuchFileOrCannotRead"));
-
Toadlet.addHomepageLink(peerTableInfobox, ctx);
+
Toadlet.addHomepageLink(peerTableInfobox, container);
this.writeHTMLReply(ctx, 200, "OK", pageNode.generate());
return;
}
@@ -221,7 +221,7 @@
"n2ntm-message-text");
infoboxContent.addChild("#", message);
HTMLNode list = peerTableInfobox.addChild("ul");
- Toadlet.addHomepageLink(list, ctx);
+ Toadlet.addHomepageLink(list, container);
list.addChild("li").addChild("a", new String[] {
"href", "title" },
new String[] { "/friends/",
l10n("returnToFriends") },
l10n("friends"));
Modified: trunk/freenet/src/freenet/clients/http/PageMaker.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PageMaker.java 2009-01-07
19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/PageMaker.java 2009-01-07
19:59:47 UTC (rev 24969)
@@ -140,18 +140,19 @@
public HTMLNode getPageNode(String title, boolean
renderNavigationLinks, ToadletContext ctx) {
boolean fullAccess = ctx == null ? false :
ctx.isAllowedFullAccess();
+ LinkFixer fixer = ctx.getContainer();
HTMLNode pageNode = new HTMLNode.HTMLDoctype("html",
"-//W3C//DTD XHTML 1.1//EN");
HTMLNode htmlNode = pageNode.addChild("html", "xml:lang",
L10n.getSelectedLanguage().isoCode);
HTMLNode headNode = htmlNode.addChild("head");
headNode.addChild("meta", new String[] { "http-equiv",
"content" }, new String[] { "Content-Type", "text/html; charset=utf-8" });
headNode.addChild("title", title + " - Freenet");
if(override == null)
- headNode.addChild("link", new String[] { "rel", "href",
"type", "title" }, new String[] { "stylesheet", ctx.fixLink("/static/themes/" +
theme.code + "/theme.css"), "text/css", theme.code });
+ headNode.addChild("link", new String[] { "rel", "href",
"type", "title" }, new String[] { "stylesheet", fixer.fixLink("/static/themes/"
+ theme.code + "/theme.css"), "text/css", theme.code });
else
headNode.addChild(getOverrideContent());
for (THEME t: THEME.values()) {
String themeName = t.code;
- headNode.addChild("link", new String[] { "rel", "href",
"type", "media", "title" }, new String[] { "alternate stylesheet",
ctx.fixLink("/static/themes/" + themeName + "/theme.css"), "text/css",
"screen", themeName });
+ headNode.addChild("link", new String[] { "rel", "href",
"type", "media", "title" }, new String[] { "alternate stylesheet",
fixer.fixLink("/static/themes/" + themeName + "/theme.css"), "text/css",
"screen", themeName });
}
HTMLNode bodyNode = htmlNode.addChild("body");
@@ -168,9 +169,9 @@
String navigationPath =
navigationLinks.get(navigationLink);
HTMLNode listItem = navbarUl.addChild("li");
if (plugin != null)
- listItem.addChild("a", new String[] {
"href", "title" }, new String[] { ctx.fixLink(navigationPath),
plugin.getString(navigationTitle) }, plugin.getString(navigationLink));
+ listItem.addChild("a", new String[] {
"href", "title" }, new String[] { fixer.fixLink(navigationPath),
plugin.getString(navigationTitle) }, plugin.getString(navigationLink));
else
- listItem.addChild("a", new String[] {
"href", "title" }, new String[] { ctx.fixLink(navigationPath),
L10n.getString(navigationTitle) }, L10n.getString(navigationLink));
+ listItem.addChild("a", new String[] {
"href", "title" }, new String[] { fixer.fixLink(navigationPath),
L10n.getString(navigationTitle) }, L10n.getString(navigationLink));
}
}
HTMLNode contentDiv = pageDiv.addChild("div", "id", "content");
Modified: trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2009-01-07
19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2009-01-07
19:59:47 UTC (rev 24969)
@@ -307,13 +307,13 @@
}
HTMLNode contentNode =
ctx.getPageMaker().getContentNode(pageNode);
-
contentNode.addChild(core.alerts.createSummary(ctx));
+
contentNode.addChild(core.alerts.createSummary(container));
UserAlert[] userAlerts =
core.alerts.getAlerts();
for (int index = 0, count = userAlerts.length;
index < count; index++) {
UserAlert userAlert = userAlerts[index];
if (userAlert.isValid() &&
(userAlert.getUserIdentifier() == PluginManager.class)) {
-
contentNode.addChild(core.alerts.renderAlert(userAlert, ctx));
+
contentNode.addChild(core.alerts.renderAlert(userAlert, container));
}
}
Modified: trunk/freenet/src/freenet/clients/http/QueueToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/QueueToadlet.java 2009-01-07
19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/QueueToadlet.java 2009-01-07
19:59:47 UTC (rev 24969)
@@ -126,7 +126,7 @@
}
MultiValueTable<String, String> responseHeaders
= new MultiValueTable<String, String>();
- responseHeaders.put("Location",
ctx.fixLink("/files/?key="+insertURI.toASCIIString()));
+ responseHeaders.put("Location",
container.fixLink("/files/?key="+insertURI.toASCIIString()));
ctx.sendReplyHeaders(302, "Found",
responseHeaders, null, 0);
return;
}
@@ -134,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", ctx.fixLink("/queue/"));
+ headers.put("Location",
container.fixLink("/queue/"));
ctx.sendReplyHeaders(302, "Found", headers,
null, 0);
if(logMINOR) Logger.minor(this, "No
formPassword: "+pass);
return;
@@ -167,7 +167,7 @@
}
}
fcp.forceStorePersistentRequests();
- writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done",
container.fixLink("/queue/"));
return;
} else if(request.isPartSet("remove_AllRequests") &&
(request.getPartAsString("remove_AllRequests", 32).length() > 0)) {
@@ -196,7 +196,7 @@
new
String[]{ failedIdentifiers.toString() }
));
else
- writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done",
container.fixLink("/queue/"));
fcp.forceStorePersistentRequests();
return;
}else if(request.isPartSet("download")) {
@@ -224,13 +224,13 @@
this.writeError(L10n.getString("QueueToadlet.errorDToDisk"),
L10n.getString("QueueToadlet.errorDToDiskConfig"), ctx);
return;
}
- writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done",
container.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",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done",
container.fixLink("/queue/"));
return;
}
LinkedList<String> success = new
LinkedList<String>(), failure = new LinkedList<String>();
@@ -277,7 +277,7 @@
}
failureDiv.addChild("br");
}
- alertContent.addChild("a", "href",
ctx.fixLink("/queue/"), L10n.getString("Toadlet.returnToQueuepage"));
+ alertContent.addChild("a", "href",
container.fixLink("/queue/"), L10n.getString("Toadlet.returnToQueuepage"));
writeHTMLReply(ctx, 200, "OK",
pageNode.generate());
return;
} else if (request.isPartSet("change_priority")) {
@@ -291,7 +291,7 @@
break loop;
}
}
- writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done",
container.fixLink("/queue/"));
fcp.forceStorePersistentRequests();
return;
} else if (request.getPartAsString("insert",
128).length() > 0) {
@@ -341,7 +341,7 @@
writeError(L10n.getString("QueueToadlet.errorInvalidURI"),
L10n.getString("QueueToadlet.errorInvalidURIToU"), ctx);
return;
}
- writePermanentRedirect(ctx, "Done",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done",
container.fixLink("/queue/"));
return;
} else if (request.isPartSet("insert-local-file")) {
String filename =
request.getPartAsString("filename", MAX_FILENAME_LENGTH);
@@ -379,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",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done",
container.fixLink("/queue/"));
return;
} else if (request.isPartSet("insert-local-dir")) {
String filename =
request.getPartAsString("filename", MAX_FILENAME_LENGTH);
@@ -410,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",
ctx.fixLink("/queue/"));
+ writePermanentRedirect(ctx, "Done",
container.fixLink("/queue/"));
return;
} else if (request.isPartSet("get")) {
String identifier =
request.getPartAsString("identifier", MAX_IDENTIFIER_LENGTH);
@@ -472,7 +472,7 @@
HTMLNode pageNode = pageMaker.getPageNode(header, context);
HTMLNode contentNode = pageMaker.getContentNode(pageNode);
if(context.isAllowedFullAccess())
-
contentNode.addChild(core.alerts.createSummary(context));
+
contentNode.addChild(core.alerts.createSummary(container));
HTMLNode infobox =
contentNode.addChild(pageMaker.getInfobox("infobox-error", header));
HTMLNode infoboxContent = pageMaker.getContentNode(infobox);
infoboxContent.addChild("#", message);
@@ -554,7 +554,7 @@
HTMLNode contentNode =
pageMaker.getContentNode(pageNode);
/* add alert summary box */
if(ctx.isAllowedFullAccess())
-
contentNode.addChild(core.alerts.createSummary(ctx));
+
contentNode.addChild(core.alerts.createSummary(container));
HTMLNode infobox =
contentNode.addChild(pageMaker.getInfobox("infobox-information",
L10n.getString("QueueToadlet.globalQueueIsEmpty")));
HTMLNode infoboxContent =
pageMaker.getContentNode(infobox);
infoboxContent.addChild("#",
L10n.getString("QueueToadlet.noTaskOnGlobalQueue"));
@@ -672,8 +672,8 @@
/* add alert summary box */
if(ctx.isAllowedFullAccess())
- contentNode.addChild(core.alerts.createSummary(ctx));
- final int mode = pageMaker.drawModeSelectionArray(core, ctx,
request, contentNode, "/queue/");
+
contentNode.addChild(core.alerts.createSummary(container));
+ final int mode = pageMaker.drawModeSelectionArray(core,
container, request, contentNode, "/queue/");
/* add file insert box */
contentNode.addChild(createInsertBox(pageMaker, ctx, mode >=
PageMaker.MODE_ADVANCED));
@@ -985,7 +985,7 @@
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", ctx.fixLink("/" + uri + (directory
? "/" : "")), identifier);
+ identifierCell.addChild("span", "class",
"identifier_with_uri").addChild("a", "href", container.fixLink("/" + uri +
(directory ? "/" : "")), identifier);
} else {
identifierCell.addChild("span", "class",
"identifier_without_uri", identifier);
}
@@ -1006,7 +1006,7 @@
private HTMLNode createDownloadCell(PageMaker pageMaker, ClientGet p,
ToadletContext ctx) {
HTMLNode downloadCell = new HTMLNode("td", "class",
"request-download");
- downloadCell.addChild("a", "href",
ctx.fixLink("/queue/"+p.getURI().toString()),
L10n.getString("QueueToadlet.download"));
+ downloadCell.addChild("a", "href",
container.fixLink("/queue/"+p.getURI().toString()),
L10n.getString("QueueToadlet.download"));
return downloadCell;
}
@@ -1033,7 +1033,7 @@
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", ctx.fixLink('/' + uri.toString() + (addSlash ?
"/" : "")), uri.toShortString() + (addSlash ? "/" : ""));
+ keyCell.addChild("span", "class",
"key_is").addChild("a", "href", container.fixLink('/' + uri.toString() +
(addSlash ? "/" : "")), uri.toShortString() + (addSlash ? "/" : ""));
} else {
keyCell.addChild("span", "class", "key_unknown",
L10n.getString("QueueToadlet.unknown"));
}
@@ -1093,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",
ctx.fixLink((isReversed ? "?sortBy=id" : "?sortBy=id&reversed"))).addChild("#",
L10n.getString("QueueToadlet.identifier"));
+ headerRow.addChild("th").addChild("a", "href",
container.fixLink((isReversed ? "?sortBy=id" :
"?sortBy=id&reversed"))).addChild("#",
L10n.getString("QueueToadlet.identifier"));
} else if (column == LIST_SIZE) {
- headerRow.addChild("th").addChild("a", "href",
ctx.fixLink((isReversed ? "?sortBy=size" :
"?sortBy=size&reversed"))).addChild("#", L10n.getString("QueueToadlet.size"));
+ headerRow.addChild("th").addChild("a", "href",
container.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) {
@@ -1107,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",
ctx.fixLink((isReversed ? "?sortBy=priority" :
"?sortBy=priority&reversed"))).addChild("#",
L10n.getString("QueueToadlet.priority"));
+ headerRow.addChild("th").addChild("a", "href",
container.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",
ctx.fixLink((isReversed ? "?sortBy=progress" :
"?sortBy=progress&reversed"))).addChild("#",
L10n.getString("QueueToadlet.progress"));
+ headerRow.addChild("th").addChild("a", "href",
container.fixLink((isReversed ? "?sortBy=progress" :
"?sortBy=progress&reversed"))).addChild("#",
L10n.getString("QueueToadlet.progress"));
} else if (column == LIST_REASON) {
headerRow.addChild("th",
L10n.getString("QueueToadlet.reason"));
}
Modified: trunk/freenet/src/freenet/clients/http/SimpleHelpToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleHelpToadlet.java
2009-01-07 19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/SimpleHelpToadlet.java
2009-01-07 19:59:47 UTC (rev 24969)
@@ -34,7 +34,7 @@
HTMLNode contentNode =
ctx.getPageMaker().getContentNode(pageNode);
if(ctx.isAllowedFullAccess())
- contentNode.addChild(core.alerts.createSummary(ctx));
+
contentNode.addChild(core.alerts.createSummary(container));
// Description infobox
HTMLNode helpScreenBox1 =
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-content",
L10n.getString("SimpleHelpToadlet.descriptionTitle")));
Modified: trunk/freenet/src/freenet/clients/http/StaticToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StaticToadlet.java 2009-01-07
19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/StaticToadlet.java 2009-01-07
19:59:47 UTC (rev 24969)
@@ -68,7 +68,7 @@
if(mimeType.equals("text/css")) {
// Easiest way to fix the links is just to pass it
through the content filter.
- FilterOutput fo = ContentFilter.filter(data,
ctx.getBucketFactory(), mimeType, uri, null, ctx);
+ FilterOutput fo = ContentFilter.filter(data,
ctx.getBucketFactory(), mimeType, uri, null, container);
data = fo.data;
}
Modified: trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2009-01-07 19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/StatisticsToadlet.java
2009-01-07 19:59:47 UTC (rev 24969)
@@ -150,8 +150,8 @@
final long nodeUptimeSeconds = (now - node.startupTime) / 1000;
if(ctx.isAllowedFullAccess())
- contentNode.addChild(core.alerts.createSummary(ctx));
- final int mode =
ctx.getPageMaker().drawModeSelectionArray(core, ctx, request, contentNode,
"/stats/");
+
contentNode.addChild(core.alerts.createSummary(container));
+ final int mode =
ctx.getPageMaker().drawModeSelectionArray(core, container, request,
contentNode, "/stats/");
double swaps = node.getSwaps();
double noSwaps = node.getNoSwaps();
Modified: trunk/freenet/src/freenet/clients/http/Toadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/Toadlet.java 2009-01-07 19:42:07 UTC
(rev 24968)
+++ trunk/freenet/src/freenet/clients/http/Toadlet.java 2009-01-07 19:59:47 UTC
(rev 24969)
@@ -228,7 +228,7 @@
infoboxContent.addChild("br");
infoboxContent.addChild("a", "href", ".",
l10n("returnToPrevPage"));
infoboxContent.addChild("br");
- addHomepageLink(infoboxContent, ctx);
+ addHomepageLink(infoboxContent, container);
writeHTMLReply(ctx, code, desc, pageNode.generate());
}
@@ -259,7 +259,7 @@
infoboxContent.addChild("pre", sw.toString());
infoboxContent.addChild("br");
infoboxContent.addChild("a", "href", ".",
l10n("returnToPrevPage"));
- addHomepageLink(infoboxContent, ctx);
+ addHomepageLink(infoboxContent, container);
writeHTMLReply(ctx, 500, desc, pageNode.generate());
}
@@ -276,8 +276,8 @@
writeHTMLReply(ctx, 500, "Internal Error", msg);
}
- protected static void addHomepageLink(HTMLNode content, ToadletContext
ctx) {
- content.addChild("a", new String[]{"href", "title"}, new
String[]{ctx.fixLink("/"), l10n("homepage")}, l10n("returnToNodeHomepage"));
+ protected static void addHomepageLink(HTMLNode content, LinkFixer
fixer) {
+ content.addChild("a", new String[]{"href", "title"}, new
String[]{fixer.fixLink("/"), l10n("homepage")}, l10n("returnToNodeHomepage"));
}
/**
Modified: trunk/freenet/src/freenet/clients/http/ToadletContext.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ToadletContext.java 2009-01-07
19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/ToadletContext.java 2009-01-07
19:59:47 UTC (rev 24969)
@@ -12,7 +12,7 @@
* Object represents context for a single request. Is used as a token,
* when the Toadlet wants to e.g. write a reply.
*/
-public interface ToadletContext extends LinkFixer {
+public interface ToadletContext {
/**
* Write reply headers.
@@ -85,13 +85,5 @@
boolean doRobots();
ToadletContainer getContainer();
-
- /**
- * Add a valid ?sessionid= to a link
- * @param string
- * @param string2
- * @return
- */
- String fixLink(String orig);
}
Modified: trunk/freenet/src/freenet/clients/http/TranslationToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/TranslationToadlet.java
2009-01-07 19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/TranslationToadlet.java
2009-01-07 19:59:47 UTC (rev 24969)
@@ -159,12 +159,12 @@
HTMLNode translationNode = contentNode.addChild("div", "class",
"translation");
HTMLNode translationHeaderNode = translationNode.addChild("p");
translationHeaderNode.addChild("#",
l10n("contributingToLabelWithLang", "lang",
L10n.getSelectedLanguage().fullName));
- translationHeaderNode.addChild("a", "href",
ctx.fixLink(TOADLET_URL+"?getOverrideTranlationFile")).addChild("#",
l10n("downloadTranslationsFile"));
+ translationHeaderNode.addChild("a", "href",
container.fixLink(TOADLET_URL+"?getOverrideTranlationFile")).addChild("#",
l10n("downloadTranslationsFile"));
translationHeaderNode.addChild("#", " ");
if(showEverything)
- translationHeaderNode.addChild("a", "href",
ctx.fixLink(TOADLET_URL+"?toTranslateOnly")).addChild("#",
l10n("hideAlreadyTranslated"));
+ translationHeaderNode.addChild("a", "href",
container.fixLink(TOADLET_URL+"?toTranslateOnly")).addChild("#",
l10n("hideAlreadyTranslated"));
else
- translationHeaderNode.addChild("a", "href",
ctx.fixLink(TOADLET_URL)).addChild("#", l10n("showEverything"));
+ translationHeaderNode.addChild("a", "href",
container.fixLink(TOADLET_URL)).addChild("#", l10n("showEverything"));
HTMLNode legendTable = translationNode.addChild("table",
"class", "translation");
HTMLNode legendRow = legendTable.addChild("tr");
@@ -188,7 +188,7 @@
L10n.getDefaultString(key)
);
- contentRow.addChild("td", "class",
"translation-new").addChild(_setOrRemoveOverride(key, isOverriden,
showEverything, ctx));
+ contentRow.addChild("td", "class",
"translation-new").addChild(_setOrRemoveOverride(key, isOverriden,
showEverything, container));
}
}
@@ -245,7 +245,7 @@
private void redirectTo(ToadletContext ctx, String target) throws
ToadletContextClosedException, IOException {
MultiValueTable<String, String> headers = new
MultiValueTable<String, String>();
- headers.put("Location", ctx.fixLink(target));
+ headers.put("Location", container.fixLink(target));
ctx.sendReplyHeaders(302, "Found", headers, null, 0);
return;
}
Modified: trunk/freenet/src/freenet/clients/http/UserAlertsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/UserAlertsToadlet.java
2009-01-07 19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/UserAlertsToadlet.java
2009-01-07 19:59:47 UTC (rev 24969)
@@ -43,7 +43,7 @@
HTMLNode pageNode =
ctx.getPageMaker().getPageNode(l10n("titleWithName", "name", node.getMyName()),
ctx);
HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode);
- contentNode.addChild(alerts.createAlerts(ctx));
+ contentNode.addChild(alerts.createAlerts(container));
writeHTMLReply(ctx, 200, "OK", pageNode.generate());
}
Modified: trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java 2009-01-07
19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/clients/http/WelcomeToadlet.java 2009-01-07
19:59:47 UTC (rev 24969)
@@ -51,12 +51,12 @@
void redirectToRoot(ToadletContext ctx) throws
ToadletContextClosedException, IOException {
MultiValueTable<String, String> headers = new MultiValueTable<String,
String>();
- headers.put("Location", ctx.fixLink("/"));
+ headers.put("Location", container.fixLink("/"));
ctx.sendReplyHeaders(302, "Found", headers, null, 0);
return;
}
- private void addCategoryToList(BookmarkCategory cat, HTMLNode list,
boolean noActiveLinks, ToadletContext ctx) {
+ private void addCategoryToList(BookmarkCategory cat, HTMLNode list,
boolean noActiveLinks, LinkFixer ctx) {
List<BookmarkItem> items = cat.getItems();
if (items.size() > 0) {
// FIXME CSS noborder ...
@@ -289,7 +289,7 @@
}
}
content.addChild("br");
- addHomepageLink(content, ctx);
+ addHomepageLink(content, container);
writeHTMLReply(ctx, 200, "OK", pageNode.generate());
request.freeParts();
@@ -344,7 +344,7 @@
}
content.addChild("br");
- addHomepageLink(content, ctx);
+ addHomepageLink(content, container);
writeHTMLReply(ctx, 200, "OK", pageNode.generate());
request.freeParts();
@@ -366,7 +366,7 @@
return;
}
MultiValueTable<String, String> headers = new
MultiValueTable<String, String>();
- headers.put("Location", ctx.fixLink("/?terminated&formPassword=" +
core.formPassword));
+ headers.put("Location",
container.fixLink("/?terminated&formPassword=" + core.formPassword));
ctx.sendReplyHeaders(302, "Found", headers, null, 0);
node.ps.queueTimedJob(new Runnable() {
@@ -393,7 +393,7 @@
}
MultiValueTable<String, String> headers = new
MultiValueTable<String, String>();
- headers.put("Location", ctx.fixLink("/?restarted&formPassword=" +
core.formPassword));
+ headers.put("Location",
container.fixLink("/?restarted&formPassword=" + core.formPassword));
ctx.sendReplyHeaders(302, "Found", headers, null, 0);
node.ps.queueTimedJob(new Runnable() {
@@ -548,7 +548,7 @@
// Alerts
if (ctx.isAllowedFullAccess()) {
-
contentNode.addChild(core.alerts.createAlertsShort(l10n("alertsSummary"),
advancedModeOutputEnabled, true, ctx));
+
contentNode.addChild(core.alerts.createAlertsShort(l10n("alertsSummary"),
advancedModeOutputEnabled, true, container));
}
// Search Box
@@ -578,7 +578,7 @@
bookmarkBoxHeader.addChild("#",
L10n.getString("BookmarkEditorToadlet.myBookmarksTitle"));
if (ctx.isAllowedFullAccess()) {
bookmarkBoxHeader.addChild("#", " [");
- bookmarkBoxHeader.addChild("span", "id",
"bookmarkedit").addChild("a", new String[]{"href", "class"}, new
String[]{ctx.fixLink("/bookmarkEditor/"), "interfacelink"},
L10n.getString("BookmarkEditorToadlet.edit"));
+ bookmarkBoxHeader.addChild("span", "id",
"bookmarkedit").addChild("a", new String[]{"href", "class"}, new
String[]{container.fixLink("/bookmarkEditor/"), "interfacelink"},
L10n.getString("BookmarkEditorToadlet.edit"));
bookmarkBoxHeader.addChild("#", "]");
}
@@ -586,7 +586,7 @@
HTMLNode bookmarksList = bookmarkBoxContent.addChild("ul", "id",
"bookmarks");
- addCategoryToList(BookmarkManager.MAIN_CATEGORY, bookmarksList,
useragent != null && useragent.contains("khtml") &&
!useragent.contains("chrome"), ctx);
+ addCategoryToList(BookmarkManager.MAIN_CATEGORY, bookmarksList,
useragent != null && useragent.contains("khtml") &&
!useragent.contains("chrome"), container);
// Fetch-a-key box
HTMLNode fetchKeyBox =
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-normal",
l10n("fetchKeyLabel")));
Modified: trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java
===================================================================
--- trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java
2009-01-07 19:42:07 UTC (rev 24968)
+++ trunk/freenet/src/freenet/node/useralerts/UserAlertManager.java
2009-01-07 19:59:47 UTC (rev 24969)
@@ -125,7 +125,7 @@
* Write each alert in uber-concise form as HTML, with a link to
* /alerts/[ anchor pointing to the real alert].
*/
- public HTMLNode createAlertsShort(String title, boolean advancedMode,
boolean drawDumpEventsForm, ToadletContext ctx) {
+ public HTMLNode createAlertsShort(String title, boolean advancedMode,
boolean drawDumpEventsForm, LinkFixer ctx) {
UserAlert[] currentAlerts = getAlerts();
short maxLevel = Short.MAX_VALUE;
int events = 0;