Use a notification!
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 16 Nov 2010 04:53:46 +0000 (05:53 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 16 Nov 2010 21:18:30 +0000 (22:18 +0100)
src/main/java/net/pterodactylus/sone/web/WebInterface.java
src/main/resources/templates/notify/wotMissingNotification.html [new file with mode: 0644]

index a74c125..f68fec2 100644 (file)
@@ -237,6 +237,23 @@ public class WebInterface implements CoreListener {
                                startupNotification.dismiss();
                        }
                }, "Sone Startup Notification Remover");
+
+               Template wotMissingNotificationTemplate = templateFactory.createTemplate(createReader("/templates/notify/wotMissingNotification.html"));
+               final TemplateNotification wotMissingNotification = new TemplateNotification("wot-missing-notification", wotMissingNotificationTemplate);
+               Ticker.getInstance().registerEvent(System.currentTimeMillis() + (15 * 1000), new Runnable() {
+
+                       @Override
+                       @SuppressWarnings("synthetic-access")
+                       public void run() {
+                               if (getCore().getIdentityManager().isConnected()) {
+                                       wotMissingNotification.dismiss();
+                               } else {
+                                       notificationManager.addNotification(wotMissingNotification);
+                               }
+                               Ticker.getInstance().registerEvent(System.currentTimeMillis() + (15 * 1000), this, "Sone WoT Connector Checker");
+                       }
+
+               }, "Sone WoT Connector Checker");
        }
 
        /**
diff --git a/src/main/resources/templates/notify/wotMissingNotification.html b/src/main/resources/templates/notify/wotMissingNotification.html
new file mode 100644 (file)
index 0000000..02fc451
--- /dev/null
@@ -0,0 +1,4 @@
+<div class="text">
+       <%= Page.WotPluginMissing.Text.WotRequired|l10n|html>
+       <%= Page.WotPluginMissing.Text.LoadPlugin|l10n|html|replace needle="{link}" replacement='<a href="/plugins/">'|replace needle="{/link}" replacement='</a>'>
+</div>