Skip to content

Commit

Permalink
Merge branch 'clickable-labels-in-forms' of https://github.com/AC4BB2…
Browse files Browse the repository at this point in the history
…1B/fred into AC4BB21B-clickable-labels-in-forms
  • Loading branch information
ArneBab committed Oct 17, 2021
2 parents f652770 + f498203 commit 48b799f
Show file tree
Hide file tree
Showing 12 changed files with 178 additions and 80 deletions.
2 changes: 1 addition & 1 deletion src/freenet/client/ArchiveManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ public void run() {
}
} catch (IOException ioe) {
throw new ArchiveFailureException("An IOE occured: "+ioe.getMessage(), ioe);
}finally {
} finally {
Closer.close(is);
}
}
Expand Down
18 changes: 12 additions & 6 deletions src/freenet/clients/http/ContentFilterToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,20 @@ private HTMLNode createContent(PageMaker pageMaker, ToadletContext ctx) {

// display in browser or save to disk
filterForm.addChild("input",
new String[] { "type", "name", "value" },
new String[] { "radio", "result-handling", ResultHandling.DISPLAY.toString() });
filterForm.addChild("#", l10n("displayResultLabel"));
new String[] { "type", "name", "value", "id" },
new String[] { "radio", "result-handling", ResultHandling.DISPLAY.toString(), "result-handling-display" });
filterForm.addChild("label",
new String[] { "for" },
new String[] { "result-handling-display" },
l10n("displayResultLabel"));
filterForm.addChild("br");
filterForm.addChild("input",
new String[] { "type", "name", "value" },
new String[] { "radio", "result-handling", ResultHandling.SAVE.toString() });
filterForm.addChild("#", l10n("saveResultLabel"));
new String[] { "type", "name", "value", "id" },
new String[] { "radio", "result-handling", ResultHandling.SAVE.toString(), "result-handling-save" });
filterForm.addChild("label",
new String[] { "for" },
new String[] { "result-handling-save" },
l10n("saveResultLabel"));
filterForm.addChild("br");
filterForm.addChild("br");

Expand Down
55 changes: 36 additions & 19 deletions src/freenet/clients/http/FileInsertWizardToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,33 +88,42 @@ private HTMLNode createInsertBox (PageMaker pageMaker, ToadletContext ctx, boole
NETWORK_THREAT_LEVEL seclevel = core.node.securityLevels.getNetworkThreatLevel();
HTMLNode insertForm = ctx.addFormChild(insertContent, QueueToadlet.PATH_UPLOADS, "queueInsertForm");
HTMLNode input = insertForm.addChild("input",
new String[] { "type", "name", "value" },
new String[] { "radio", "keytype", "CHK" });
new String[] { "type", "name", "value", "id" },
new String[] { "radio", "keytype", "CHK", "keytypeChk" });
if ((!rememberedLastTime && seclevel == NETWORK_THREAT_LEVEL.LOW) ||
(rememberedLastTime && wasCanonicalLastTime && seclevel != NETWORK_THREAT_LEVEL.MAXIMUM)) {
input.addAttribute("checked", "checked");
}
insertForm.addChild("b", l10n("insertCanonicalTitle"));
insertForm.addChild("label",
new String[] { "for" },
new String[] { "keytypeChk" }
).addChild("b", l10n("insertCanonicalTitle"));
insertForm.addChild("#", ": "+l10n("insertCanonical"));
if(isAdvancedModeEnabled)
insertForm.addChild("#", " "+l10n("insertCanonicalAdvanced"));
insertForm.addChild("br");
input = insertForm.addChild("input",
new String[] { "type", "name", "value" },
new String[] { "radio", "keytype", "SSK" });
new String[] { "type", "name", "value", "id" },
new String[] { "radio", "keytype", "SSK", "keytypeSsk" });
if (seclevel == NETWORK_THREAT_LEVEL.MAXIMUM || (rememberedLastTime && !wasCanonicalLastTime)) {
input.addAttribute("checked", "checked");
}
insertForm.addChild("b", l10n("insertRandomTitle"));
insertForm.addChild("label",
new String[] { "for" },
new String[] { "keytypeSsk" }
).addChild("b", l10n("insertRandomTitle"));
insertForm.addChild("#", ": "+l10n("insertRandom"));
if(isAdvancedModeEnabled)
insertForm.addChild("#", " "+l10n("insertRandomAdvanced"));
if (isAdvancedModeEnabled) {
insertForm.addChild("br");
insertForm.addChild("input",
new String[] { "type", "name", "value" },
new String[] { "radio", "keytype", "specify" });
insertForm.addChild("b", l10n("insertSpecificKeyTitle"));
new String[] { "type", "name", "value", "id" },
new String[] { "radio", "keytype", "specify", "keytypeSpecify" });
insertForm.addChild("label",
new String[] { "for" },
new String[] { "keytypeSpecify" }
).addChild("b", l10n("insertSpecificKeyTitle"));
insertForm.addChild("#", ": "+l10n("insertSpecificKey")+" ");
insertForm.addChild("input",
new String[] { "type", "name", "value" },
Expand All @@ -124,10 +133,12 @@ private HTMLNode createInsertBox (PageMaker pageMaker, ToadletContext ctx, boole
insertForm.addChild("br");
insertForm.addChild("br");
insertForm.addChild("input",
new String[] { "type", "name", "checked" },
new String[] { "checkbox", "compress", "checked" });
insertForm.addChild("#", ' ' +
NodeL10n.getBase().getString("QueueToadlet.insertFileCompressLabel"));
new String[] { "type", "name", "checked", "id" },
new String[] { "checkbox", "compress", "checked", "checkboxCompress" });
insertForm.addChild("label",
new String[] { "for" },
new String[] { "checkboxCompress" },
' ' + NodeL10n.getBase().getString("QueueToadlet.insertFileCompressLabel"));
} else {
insertForm.addChild("input",
new String[] { "type", "name", "value" },
Expand Down Expand Up @@ -195,14 +206,20 @@ private HTMLNode createFilterBox (PageMaker pageMaker, ToadletContext ctx) {

// display in browser or save to disk
insertForm.addChild("input",
new String[] { "type", "name", "value" },
new String[] { "radio", "result-handling", ResultHandling.DISPLAY.toString() });
insertForm.addChild("#", ContentFilterToadlet.l10n("displayResultLabel"));
new String[] { "type", "name", "value", "id" },
new String[] { "radio", "result-handling", ResultHandling.DISPLAY.toString(), "resHandlingDisplay" });
insertForm.addChild("label",
new String[] { "for" },
new String[] { "resHandlingDisplay" },
ContentFilterToadlet.l10n("displayResultLabel"));
insertForm.addChild("br");
insertForm.addChild("input",
new String[] { "type", "name", "value" },
new String[] { "radio", "result-handling", ResultHandling.SAVE.toString() });
insertForm.addChild("#", ContentFilterToadlet.l10n("saveResultLabel"));
new String[] { "type", "name", "value", "id" },
new String[] { "radio", "result-handling", ResultHandling.SAVE.toString(), "resHandlingSave" });
insertForm.addChild("label",
new String[] { "for" },
new String[] { "resHandlingSave" },
ContentFilterToadlet.l10n("saveResultLabel"));
insertForm.addChild("br");
insertForm.addChild("br");

Expand Down
38 changes: 28 additions & 10 deletions src/freenet/clients/http/PproxyToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -569,17 +569,25 @@ private void showOfficialPluginLoader(ToadletContext toadletContext, HTMLNode co

boolean loadFromWeb = pm.loadOfficialPluginsFromWeb();

HTMLNode input = addOfficialForm.addChild("input", new String[] { "type", "name", "value" },
new String[] { "radio", "pluginSource", "freenet" });
HTMLNode input = addOfficialForm.addChild("input",
new String[] { "type", "name", "value", "id" },
new String[] { "radio", "pluginSource", "freenet", "pluginSourceFreenet" });
if(!loadFromWeb)
input.addAttribute("checked", "true");
addOfficialForm.addChild("#", l10n("pluginSourceFreenet"));
addOfficialForm.addChild("label",
new String[] { "for" },
new String[] { "pluginSourceFreenet" },
l10n("pluginSourceFreenet"));
addOfficialForm.addChild("br");
input = addOfficialForm.addChild("input", new String[] { "type", "name", "value" },
new String[] { "radio", "pluginSource", "https" });
input = addOfficialForm.addChild("input",
new String[] { "type", "name", "value", "id" },
new String[] { "radio", "pluginSource", "https", "pluginSourceHTTPS" });
if(loadFromWeb)
input.addAttribute("checked", "true");
addOfficialForm.addChild("#", l10n("pluginSourceHTTPS"));
addOfficialForm.addChild("label",
new String[] { "for" },
new String[] { "pluginSourceHTTPS" },
l10n("pluginSourceHTTPS"));
addOfficialForm.addChild("#", " ");
if(node.getOpennet() == null)
addOfficialForm.addChild("b").addChild("font", "color", "red", l10n("pluginSourceHTTPSWarning"));
Expand All @@ -602,8 +610,13 @@ private void showOfficialPluginLoader(ToadletContext toadletContext, HTMLNode co
continue;
}
HTMLNode pluginNode = pluginGroupNode.addChild("div", "class", "plugin");
HTMLNode option = pluginNode.addChild("input", new String[] { "type", "name", "value" }, new String[] { "radio", "plugin-name", pluginDescription.name });
option.addChild("i", pluginDescription.getLocalisedPluginName());
HTMLNode option = pluginNode.addChild("input",
new String[] { "type", "name", "value", "id" },
new String[] { "radio", "plugin-name", pluginDescription.name, "radioPlugin" + pluginDescription.name });
option.addChild("label",
new String[] { "for" },
new String[] { "radioPlugin" + pluginDescription.name }
).addChild("i", pluginDescription.getLocalisedPluginName());
if(pluginDescription.deprecated)
option.addChild("b", " ("+l10n("loadLabelDeprecated")+")");
if(pluginDescription.experimental)
Expand Down Expand Up @@ -639,8 +652,13 @@ private void showUnofficialPluginLoader(ToadletContext toadletContext, HTMLNode
addOtherForm.addChild("#", " ");
addOtherForm.addChild("input", new String[] { "type", "name", "value" }, new String[] { "submit", "submit-other", l10n("Load") });
addOtherForm.addChild("br");
addOtherForm.addChild("input", new String[] { "type", "name", "checked" }, new String[] { "checkbox", "fileonly", "checked" });
addOtherForm.addChild("#", " " + l10n("fileonly"));
addOtherForm.addChild("input",
new String[] { "type", "name", "checked", "id" },
new String[] { "checkbox", "fileonly", "checked", "fileonly" });
addOtherForm.addChild("label",
new String[] { "for" },
new String[] { "fileonly" },
" " + l10n("fileonly"));
}

private void showFreenetPluginLoader(ToadletContext toadletContext, HTMLNode contentNode) {
Expand Down
27 changes: 18 additions & 9 deletions src/freenet/clients/http/QueueToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -2011,22 +2011,31 @@ private HTMLNode createBulkDownloadForm(ToadletContext ctx, PageMaker pageMaker)
} else {
downloadForm.addChild("br");
downloadForm.addChild("input",
new String[] { "type", "value", "name" },
new String[] { "radio", "disk", "target" },
new String[] { "type", "value", "name", "id" },
new String[] { "radio", "disk", "target", "bulkDownloadSelectOptionDisk" }
//Nicer spacing for radio button
' '+l10n("bulkDownloadSelectOptionDisk")+' ');
).addChild("label",
new String[] { "for" },
new String[] { "bulkDownloadSelectOptionDisk" },
' '+l10n("bulkDownloadSelectOptionDisk")+' ');
selectLocation(downloadForm);
downloadForm.addChild("br");
downloadForm.addChild("input",
new String[] { "type", "value", "name", "checked" },
new String[] { "radio", "direct", "target", "checked" },
' '+l10n("bulkDownloadSelectOptionDirect")+' ');
new String[] { "type", "value", "name", "checked", "id" },
new String[] { "radio", "direct", "target", "checked", "bulkDownloadSelectOptionDirect" }
).addChild("label",
new String[] { "for" },
new String[] { "bulkDownloadSelectOptionDirect" },
' '+l10n("bulkDownloadSelectOptionDirect")+' ');
}
HTMLNode filterControl = downloadForm.addChild("div", l10n("filterData"));
filterControl.addChild("input",
new String[] { "type", "name", "value", "checked" },
new String[] { "checkbox", "filterData", "filterData", "checked"});
filterControl.addChild("#", l10n("filterDataMessage"));
new String[] { "type", "name", "value", "checked", "id" },
new String[] { "checkbox", "filterData", "filterData", "checked", "filterDataMessage"});
filterControl.addChild("label",
new String[] { "for" },
new String[] { "filterDataMessage" },
l10n("filterDataMessage"));
downloadForm.addChild("br");
downloadForm.addChild("input",
new String[] { "type", "name", "value" },
Expand Down
43 changes: 32 additions & 11 deletions src/freenet/clients/http/SecurityLevelsToadlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -491,12 +491,19 @@ private void drawSecurityLevelsPage(HTMLNode contentNode, ToadletContext ctx) {
String controlName = "security-levels.networkThreatLevel";
for(NETWORK_THREAT_LEVEL level : NETWORK_THREAT_LEVEL.getOpennetValues()) {
HTMLNode input;
if(level == networkLevel) {
input = div.addChild("p").addChild("input", new String[] { "type", "checked", "name", "value" }, new String[] { "radio", "on", controlName, level.name() });
if (level == networkLevel) {
input = div.addChild("p").addChild("input",
new String[] { "type", "checked", "name", "value", "id" },
new String[] { "radio", "on", controlName, level.name(), controlName + level.name() });
} else {
input = div.addChild("p").addChild("input", new String[] { "type", "name", "value" }, new String[] { "radio", controlName, level.name() });
input = div.addChild("p").addChild("input",
new String[] { "type", "name", "value", "id" },
new String[] { "radio", controlName, level.name(), controlName + level.name() });
}
input.addChild("b", l10nSec("networkThreatLevel.name."+level));
input.addChild("label",
new String[] { "for" },
new String[] { controlName + level.name() }
).addChild("b", l10nSec("networkThreatLevel.name."+level));
input.addChild("#", ": ");
NodeL10n.getBase().addL10nSubstitution(input, "SecurityLevels.networkThreatLevel.choice."+level, new String[] { "bold" },
new HTMLNode[] { HTMLNode.STRONG });
Expand All @@ -514,11 +521,18 @@ private void drawSecurityLevelsPage(HTMLNode contentNode, ToadletContext ctx) {
for(NETWORK_THREAT_LEVEL level : NETWORK_THREAT_LEVEL.getDarknetValues()) {
HTMLNode input;
if(level == networkLevel) {
input = div.addChild("p").addChild("input", new String[] { "type", "checked", "name", "value" }, new String[] { "radio", "on", controlName, level.name() });
input = div.addChild("p").addChild("input",
new String[] { "type", "checked", "name", "value", "id" },
new String[] { "radio", "on", controlName, level.name(), controlName + level.name() });
} else {
input = div.addChild("p").addChild("input", new String[] { "type", "name", "value" }, new String[] { "radio", controlName, level.name() });
input = div.addChild("p").addChild("input",
new String[] { "type", "name", "value", "id" },
new String[] { "radio", controlName, level.name(), controlName + level.name() });
}
input.addChild("b", l10nSec("networkThreatLevel.name."+level));
input.addChild("label",
new String[] { "for" },
new String[] { controlName + level.name() }
).addChild("b", l10nSec("networkThreatLevel.name."+level));
input.addChild("#", ": ");
NodeL10n.getBase().addL10nSubstitution(input, "SecurityLevels.networkThreatLevel.choice."+level, new String[] { "bold" },
new HTMLNode[] { HTMLNode.STRONG });
Expand Down Expand Up @@ -552,12 +566,19 @@ private void drawSecurityLevelsPage(HTMLNode contentNode, ToadletContext ctx) {
controlName = "security-levels.physicalThreatLevel";
for(PHYSICAL_THREAT_LEVEL level : PHYSICAL_THREAT_LEVEL.values()) {
HTMLNode input;
if(level == physicalLevel) {
input = seclevelGroup.addChild("p").addChild("input", new String[] { "type", "checked", "name", "value" }, new String[] { "radio", "on", controlName, level.name() });
if (level == physicalLevel) {
input = seclevelGroup.addChild("p").addChild("input",
new String[] { "type", "checked", "name", "value", "id" },
new String[] { "radio", "on", controlName, level.name(), controlName + level.name() });
} else {
input = seclevelGroup.addChild("p").addChild("input", new String[] { "type", "name", "value" }, new String[] { "radio", controlName, level.name() });
input = seclevelGroup.addChild("p").addChild("input",
new String[] { "type", "name", "value", "id" },
new String[] { "radio", controlName, level.name(), controlName + level.name() });
}
input.addChild("b", l10nSec("physicalThreatLevel.name."+level));
input.addChild("label",
new String[] { "for" },
new String[] { controlName + level.name() }
).addChild("b", l10nSec("physicalThreatLevel.name."+level));
input.addChild("#", ": ");
NodeL10n.getBase().addL10nSubstitution(input, "SecurityLevels.physicalThreatLevel.choice."+level, new String[] { "bold" },
new HTMLNode[] { HTMLNode.STRONG });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ public PeerTrustInputForAddPeerBoxNode() {
for (DarknetPeerNode.FRIEND_TRUST trust : DarknetPeerNode.FRIEND_TRUST.valuesBackwards()) { // FIXME reverse order
HTMLNode input = this.addChild("br")
.addChild("input",
new String[] { "type", "name", "value" },
new String[] { "radio", "trust", trust.name() });
new String[] { "type", "name", "value", "id" },
new String[] { "radio", "trust", trust.name(), "trust" + trust.name() });
if (trust.isDefaultValue())
input.addAttribute("checked", "checked");
input.addChild("b", l10n("DarknetConnectionsToadlet.peerTrust." + trust.name()));
input.addChild("label",
new String[] { "for" },
new String[] { "trust" + trust.name() }
).addChild("b", l10n("DarknetConnectionsToadlet.peerTrust." + trust.name()));
input.addChild("#", ": ");
input.addChild("#", l10n("DarknetConnectionsToadlet.peerTrustExplain." + trust.name()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ public PeerVisibilityInputForAddPeerBoxNode() {
for (DarknetPeerNode.FRIEND_VISIBILITY visibility : DarknetPeerNode.FRIEND_VISIBILITY.values()) { // FIXME reverse order
HTMLNode input = this.addChild("br")
.addChild("input",
new String[] { "type", "name", "value" },
new String[] { "radio", "visibility", visibility.name() });
new String[] { "type", "name", "value", "id" },
new String[] { "radio", "visibility", visibility.name(), "visibility" + visibility.name() });
if (visibility.isDefaultValue())
input.addAttribute("checked", "checked");
input.addChild("b", l10n("DarknetConnectionsToadlet.peerVisibility." + visibility.name()));
input.addChild("label",
new String[] { "for" },
new String[] { "visibility" + visibility.name() }
).addChild("b", l10n("DarknetConnectionsToadlet.peerVisibility." + visibility.name()));
input.addChild("#", ": ");
input.addChild("#", l10n("DarknetConnectionsToadlet.peerVisibilityExplain." + visibility.name()));
}
Expand Down
Loading

0 comments on commit 48b799f

Please sign in to comment.