[freenet-cvs] r15647 - in trunk/freenet/src/freenet: clients/http l10n pluginmanager
Author: bombe
Date: 2007-10-29 18:45:34 + (Mon, 29 Oct 2007)
New Revision: 15647
Modified:
trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
trunk/freenet/src/freenet/pluginmanager/PluginInfoWrapper.java
Log:
let users change the reload-on-startup setting for plugins from the web
interface
Modified: trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
===
--- trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2007-10-29
18:30:50 UTC (rev 15646)
+++ trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2007-10-29
18:45:34 UTC (rev 15647)
@@ -141,6 +141,21 @@
ctx.sendReplyHeaders(302, "Found", headers,
null, 0);
return;
}
+ if (request.isPartSet("change-reload-submit")) {
+ int pluginInfoWrapperHashCode =
request.getIntPart("plugin-id", -1);
+ boolean newReload =
request.isPartSet("reload-on-startup");
+ Iterator/**/ pluginIterator
= pm.getPlugins().iterator();
+ while (pluginIterator.hasNext()) {
+ PluginInfoWrapper pluginInfoWrapper =
(PluginInfoWrapper) pluginIterator.next();
+ if (pluginInfoWrapper.hashCode() ==
pluginInfoWrapperHashCode) {
+
pluginInfoWrapper.setAutoRefresh(newReload);
+ break;
+ }
+ }
+ headers.put("Location", ".");
+ ctx.sendReplyHeaders(302, "Found", headers,
null, 0);
+ return;
+ }
if (request.isPartSet("cancel")){
headers.put("Location", "/plugins/");
ctx.sendReplyHeaders(302, "Found", headers,
null, 0);
@@ -379,7 +394,10 @@
headerRow.addChild("th", l10n("classNameTitle"));
headerRow.addChild("th", l10n("internalIDTitle"));
headerRow.addChild("th", l10n("startedAtTitle"));
+ headerRow.addChild("th", l10n("reloadOnStartupShort"));
headerRow.addChild("th");
+ headerRow.addChild("th");
+ headerRow.addChild("th");
Iterator it = pm.getPlugins().iterator();
while (it.hasNext()) {
PluginInfoWrapper pi = (PluginInfoWrapper)
it.next();
@@ -387,19 +405,29 @@
pluginRow.addChild("td",
pi.getPluginClassName());
pluginRow.addChild("td", pi.getThreadName());
pluginRow.addChild("td", new
Date(pi.getStarted()).toString());
- HTMLNode actionCell = pluginRow.addChild("td");
+ HTMLNode autoReloadChangeForm =
ctx.addFormChild(pluginRow.addChild("td", "align", "center"), ".",
"changeAutoReloadForm");
+ if (pi.isAutoRefresh()) {
+ autoReloadChangeForm.addChild("input",
new String[] { "name", "type", "checked" }, new String[] { "reload-on-startup",
"checkbox", "checked" });
+ } else {
+ autoReloadChangeForm.addChild("input",
new String[] { "name", "type" }, new String[] { "reload-on-startup", "checkbox"
});
+ }
+ autoReloadChangeForm.addChild("input", new
String[] { "name", "type", "value" }, new String[] { "plugin-id", "hidden",
String.valueOf(pi.hashCode()) });
+ autoReloadChangeForm.addChild("input", new
String[] { "name", "type", "value" }, new String[] { "change-reload-submit",
"submit", l10n("changeReloadOnStartup") });
if (pi.isStopping()) {
- actionCell.addChild("#",
l10n("pluginStopping"));
+ pluginRow.addChild("td",
l10n("pluginStopping"));
+ /* add two empty cells. */
+ pluginRow.addChild("td");
+ pluginRow.addChild("td");
} else {
if (pi.isPproxyPlugin()) {
- HTMLNode visitForm =
actionCell.addChild("form", new String[] { "method", "action", "target" }, new
String[] { "get", pi.getPluginClassName(), "_new
[freenet-cvs] r15647 - in trunk/freenet/src/freenet: clients/http l10n pluginmanager
Author: bombe
Date: 2007-10-29 18:45:34 + (Mon, 29 Oct 2007)
New Revision: 15647
Modified:
trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
trunk/freenet/src/freenet/pluginmanager/PluginInfoWrapper.java
Log:
let users change the reload-on-startup setting for plugins from the web
interface
Modified: trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
===
--- trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2007-10-29
18:30:50 UTC (rev 15646)
+++ trunk/freenet/src/freenet/clients/http/PproxyToadlet.java 2007-10-29
18:45:34 UTC (rev 15647)
@@ -141,6 +141,21 @@
ctx.sendReplyHeaders(302, "Found", headers,
null, 0);
return;
}
+ if (request.isPartSet("change-reload-submit")) {
+ int pluginInfoWrapperHashCode =
request.getIntPart("plugin-id", -1);
+ boolean newReload =
request.isPartSet("reload-on-startup");
+ Iterator/**/ pluginIterator
= pm.getPlugins().iterator();
+ while (pluginIterator.hasNext()) {
+ PluginInfoWrapper pluginInfoWrapper =
(PluginInfoWrapper) pluginIterator.next();
+ if (pluginInfoWrapper.hashCode() ==
pluginInfoWrapperHashCode) {
+
pluginInfoWrapper.setAutoRefresh(newReload);
+ break;
+ }
+ }
+ headers.put("Location", ".");
+ ctx.sendReplyHeaders(302, "Found", headers,
null, 0);
+ return;
+ }
if (request.isPartSet("cancel")){
headers.put("Location", "/plugins/");
ctx.sendReplyHeaders(302, "Found", headers,
null, 0);
@@ -379,7 +394,10 @@
headerRow.addChild("th", l10n("classNameTitle"));
headerRow.addChild("th", l10n("internalIDTitle"));
headerRow.addChild("th", l10n("startedAtTitle"));
+ headerRow.addChild("th", l10n("reloadOnStartupShort"));
headerRow.addChild("th");
+ headerRow.addChild("th");
+ headerRow.addChild("th");
Iterator it = pm.getPlugins().iterator();
while (it.hasNext()) {
PluginInfoWrapper pi = (PluginInfoWrapper)
it.next();
@@ -387,19 +405,29 @@
pluginRow.addChild("td",
pi.getPluginClassName());
pluginRow.addChild("td", pi.getThreadName());
pluginRow.addChild("td", new
Date(pi.getStarted()).toString());
- HTMLNode actionCell = pluginRow.addChild("td");
+ HTMLNode autoReloadChangeForm =
ctx.addFormChild(pluginRow.addChild("td", "align", "center"), ".",
"changeAutoReloadForm");
+ if (pi.isAutoRefresh()) {
+ autoReloadChangeForm.addChild("input",
new String[] { "name", "type", "checked" }, new String[] { "reload-on-startup",
"checkbox", "checked" });
+ } else {
+ autoReloadChangeForm.addChild("input",
new String[] { "name", "type" }, new String[] { "reload-on-startup", "checkbox"
});
+ }
+ autoReloadChangeForm.addChild("input", new
String[] { "name", "type", "value" }, new String[] { "plugin-id", "hidden",
String.valueOf(pi.hashCode()) });
+ autoReloadChangeForm.addChild("input", new
String[] { "name", "type", "value" }, new String[] { "change-reload-submit",
"submit", l10n("changeReloadOnStartup") });
if (pi.isStopping()) {
- actionCell.addChild("#",
l10n("pluginStopping"));
+ pluginRow.addChild("td",
l10n("pluginStopping"));
+ /* add two empty cells. */
+ pluginRow.addChild("td");
+ pluginRow.addChild("td");
} else {
if (pi.isPproxyPlugin()) {
- HTMLNode visitForm =
actionCell.addChild("form", new String[] { "method", "action", "target" }, new
String[] { "get", pi.getPluginClassName(), "_new
