From 88ca883d8fa52c96a68db1c441c72a7fdf5dbfe2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 11 Nov 2011 11:02:17 +0100 Subject: [PATCH] Make new options configurable. --- src/main/java/net/pterodactylus/sone/web/OptionsPage.java | 9 +++++++++ src/main/resources/i18n/sone.en.properties | 3 +++ src/main/resources/templates/options.html | 15 +++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java index 7b4a634..49b1275 100644 --- a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java +++ b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java @@ -67,6 +67,12 @@ public class OptionsPage extends SoneTemplatePage { currentSone.getOptions().getBooleanOption("AutoFollow").set(autoFollow); boolean enableSoneInsertNotifications = request.getHttpRequest().isPartSet("enable-sone-insert-notifications"); currentSone.getOptions().getBooleanOption("EnableSoneInsertNotifications").set(enableSoneInsertNotifications); + boolean showNotificationNewSones = request.getHttpRequest().isPartSet("show-notification-new-sones"); + currentSone.getOptions().getBooleanOption("ShowNotification/NewSones").set(showNotificationNewSones); + boolean showNotificationNewPosts = request.getHttpRequest().isPartSet("show-notification-new-posts"); + currentSone.getOptions().getBooleanOption("ShowNotification/NewPosts").set(showNotificationNewPosts); + boolean showNotificationNewReplies = request.getHttpRequest().isPartSet("show-notification-new-replies"); + currentSone.getOptions().getBooleanOption("ShowNotification/NewReplies").set(showNotificationNewReplies); webInterface.getCore().touchConfiguration(); } Integer insertionDelay = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("insertion-delay", 16)); @@ -130,6 +136,9 @@ public class OptionsPage extends SoneTemplatePage { if (currentSone != null) { templateContext.set("auto-follow", currentSone.getOptions().getBooleanOption("AutoFollow").get()); templateContext.set("enable-sone-insert-notifications", currentSone.getOptions().getBooleanOption("EnableSoneInsertNotifications").get()); + templateContext.set("show-notification-new-sones", currentSone.getOptions().getBooleanOption("ShowNotification/NewSones").get()); + templateContext.set("show-notification-new-posts", currentSone.getOptions().getBooleanOption("ShowNotification/NewPosts").get()); + templateContext.set("show-notification-new-replies", currentSone.getOptions().getBooleanOption("ShowNotification/NewReplies").get()); } templateContext.set("insertion-delay", preferences.getInsertionDelay()); templateContext.set("posts-per-page", preferences.getPostsPerPage()); diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties index 4210930..fb592df 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -40,6 +40,9 @@ Page.Options.Section.SoneSpecificOptions.NotLoggedIn=These options are only avai Page.Options.Section.SoneSpecificOptions.LoggedIn=These options are only available while you are logged in and they are only valid for the Sone you are logged in as. Page.Options.Option.AutoFollow.Description=If a new Sone is discovered, follow it automatically. Note that this will only follow Sones that are discovered after you activate this option! Page.Options.Option.EnableSoneInsertNotifications.Description=If enabled, this will display notifications every time your Sone is being inserted or finishes inserting. +Page.Options.Option.ShowNotificationNewSones.Description=Show notifications for new Sones. +Page.Options.Option.ShowNotificationNewPosts.Description=Show notifications for new posts. +Page.Options.Option.ShowNotificationNewReplies.Description=Show notifications for new replies. Page.Options.Section.RuntimeOptions.Title=Runtime Behaviour Page.Options.Option.InsertionDelay.Description=The number of seconds the Sone inserter waits after a modification of a Sone before it is being inserted. Page.Options.Option.PostsPerPage.Description=The number of posts to display on a page before pagination controls are being shown. diff --git a/src/main/resources/templates/options.html b/src/main/resources/templates/options.html index 2adf57e..57f3c5f 100644 --- a/src/main/resources/templates/options.html +++ b/src/main/resources/templates/options.html @@ -51,6 +51,21 @@ <%= Page.Options.Option.EnableSoneInsertNotifications.Description|l10n|html>

+

+ disabled="disabled"<%/if><%if show-notification-new-sones> checked="checked"<%/if>/> + <%= Page.Options.Option.ShowNotificationNewSones.Description|l10n|html> +

+ +

+ disabled="disabled"<%/if><%if show-notification-new-posts> checked="checked"<%/if>/> + <%= Page.Options.Option.ShowNotificationNewPosts.Description|l10n|html> +

+ +

+ disabled="disabled"<%/if><%if show-notification-new-replies> checked="checked"<%/if>/> + <%= Page.Options.Option.ShowNotificationNewReplies.Description|l10n|html> +

+

<%= Page.Options.Section.RuntimeOptions.Title|l10n|html>

<%= Page.Options.Option.InsertionDelay.Description|l10n|html>

-- 2.7.4