[freenet-cvs] r15634 - in trunk/freenet/src/freenet: clients/http pluginmanager

bombe at freenetproject.org bombe at freenetproject.org
Mon Oct 29 10:02:11 UTC 2007


Author: bombe
Date: 2007-10-29 10:02:11 +0000 (Mon, 29 Oct 2007)
New Revision: 15634

Modified:
   trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
   trunk/freenet/src/freenet/pluginmanager/PluginManager.java
Log:
register user identifier with alerts from the plugin manager
show alert summary on plugin page
show all plugin user alerts on plugin page

Modified: trunk/freenet/src/freenet/clients/http/PproxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/PproxyToadlet.java	2007-10-29 10:01:11 UTC (rev 15633)
+++ trunk/freenet/src/freenet/clients/http/PproxyToadlet.java	2007-10-29 10:02:11 UTC (rev 15634)
@@ -15,6 +15,7 @@
 import freenet.l10n.L10n;
 import freenet.node.Node;
 import freenet.node.NodeClientCore;
+import freenet.node.useralerts.UserAlert;
 import freenet.pluginmanager.AccessDeniedPluginHTTPException;
 import freenet.pluginmanager.DownloadPluginHTTPException;
 import freenet.pluginmanager.NotFoundPluginHTTPException;
@@ -137,6 +138,13 @@
 				ctx.sendReplyHeaders(302, "Found", headers, null, 0);
 				return;
 			}
+			if (request.isPartSet("dismiss-user-alert")) {
+				int userAlertHashCode = request.getIntPart("disable", -1);
+				core.alerts.dismissAlert(userAlertHashCode);
+				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);
@@ -234,6 +242,16 @@
 				HTMLNode pageNode = ctx.getPageMaker().getPageNode(l10n("pluginsWithNodeName", "name", core.getMyName()), ctx);
 				HTMLNode contentNode = ctx.getPageMaker().getContentNode(pageNode);
 
+				contentNode.addChild(core.alerts.createSummary());
+
+				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));
+					}
+				}
+
 				this.showStartingPlugins(ctx, request, pm, contentNode);
 				this.showPluginList(ctx, request, pm, contentNode);
 
@@ -362,7 +380,8 @@
 			addOfficialForm.addChild("div", l10n("loadOfficialPluginText"));
 			addOfficialForm.addChild("#", (l10n("loadOfficialPluginLabel") + ": "));
 			addOfficialForm.addChild("input", new String[] { "type", "name", "size" }, new String[] { "text", "plugin-name", "40" });
-			addOfficialForm.addChild("input", new String[] { "type", "name", "value", "checked" }, new String[] { "checkbox", "refresh-on-startup", "tue", "checked" }, l10n("refreshOnStartup"));
+			addOfficialForm.addChild("input", new String[] { "type", "name", "value", "checked" }, new String[] { "checkbox", "refresh-on-startup", "true", "checked" });
+			addOfficialForm.addChild("#", l10n("refreshOnStartup"));
 			addOfficialForm.addChild("input", new String[] { "type", "name", "value" }, new String[] { "submit", "submit-official", l10n("Load") });
 
 			/* box for unofficial plugins. */
@@ -373,7 +392,8 @@
 			addOtherForm.addChild("div", l10n("loadOtherPluginText"));
 			addOtherForm.addChild("#", (l10n("loadOtherURLLabel") + ": "));
 			addOtherForm.addChild("input", new String[] { "type", "name", "size" }, new String[] { "text", "plugin-url", "80" });
-			addOtherForm.addChild("input", new String[] { "type", "name", "value" }, new String[] { "checkbox", "refresh-on-startup", "true" }, l10n("refreshOnStartup"));
+			addOtherForm.addChild("input", new String[] { "type", "name", "value" }, new String[] { "checkbox", "refresh-on-startup", "true" });
+			addOtherForm.addChild("#", l10n("refreshOnStartup"));
 			addOtherForm.addChild("input", new String[] { "type", "name", "value" }, new String[] { "submit", "submit-other", l10n("Load") });
 		} 
 	}

Modified: trunk/freenet/src/freenet/pluginmanager/PluginManager.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/PluginManager.java	2007-10-29 10:01:11 UTC (rev 15633)
+++ trunk/freenet/src/freenet/pluginmanager/PluginManager.java	2007-10-29 10:02:11 UTC (rev 15634)
@@ -165,7 +165,7 @@
 				} catch (PluginNotFoundException e) {
 					Logger.normal(this, "Loading plugin failed (" + filename + ')', e);
 					String message = e.getMessage();
-					core.alerts.register(new SimpleUserAlert(true, l10n("pluginLoadingFailedTitle"), l10n("pluginLoadingFailedWithMessage", new String[] { "name", "message" }, new String[] { filename, message }), UserAlert.ERROR));
+					core.alerts.register(new SimpleUserAlert(true, l10n("pluginLoadingFailedTitle"), l10n("pluginLoadingFailedWithMessage", new String[] { "name", "message" }, new String[] { filename, message }), UserAlert.ERROR, PluginManager.class));
 				} catch (UnsupportedClassVersionError e) {
 					Logger.error(this, "Could not load plugin " + filename + " : " + e, e);
 					System.err.println("Could not load plugin " + filename + " : " + e);
@@ -174,7 +174,7 @@
 					if (jvmVersion.startsWith("1.4.") || jvmVersion.equals("1.4")) {
 						System.err.println("Plugin " + filename + " appears to require a later JVM");
 						Logger.error(this, "Plugin " + filename + " appears to require a later JVM");
-						core.alerts.register(new SimpleUserAlert(true, l10n("pluginReqNewerJVMTitle", "name", filename), l10n("pluginReqNewerJVM", "name", filename), UserAlert.ERROR));
+						core.alerts.register(new SimpleUserAlert(true, l10n("pluginReqNewerJVMTitle", "name", filename), l10n("pluginReqNewerJVM", "name", filename), UserAlert.ERROR, PluginManager.class));
 					}
 				} finally {
 					synchronized (startingPlugins) {




More information about the cvs mailing list