From a7483a08e0b2bebe36fd7b3014519e03dcbc5bcf Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 7 May 2011 02:14:15 +0200 Subject: [PATCH] Add require-full-access option to Options page. This fixes #181. --- src/main/java/net/pterodactylus/sone/web/OptionsPage.java | 3 +++ src/main/resources/i18n/sone.en.properties | 1 + src/main/resources/templates/options.html | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java index 39cacc6..bbc1084 100644 --- a/src/main/java/net/pterodactylus/sone/web/OptionsPage.java +++ b/src/main/java/net/pterodactylus/sone/web/OptionsPage.java @@ -65,6 +65,8 @@ public class OptionsPage extends SoneTemplatePage { preferences.setInsertionDelay(insertionDelay); Integer postsPerPage = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("posts-per-page", 4), null); preferences.setPostsPerPage(postsPerPage); + boolean requireFullAccess = request.getHttpRequest().isPartSet("require-full-access"); + preferences.setRequireFullAccess(requireFullAccess); Integer positiveTrust = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("positive-trust", 3)); preferences.setPositiveTrust(positiveTrust); Integer negativeTrust = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("negative-trust", 4)); @@ -88,6 +90,7 @@ public class OptionsPage extends SoneTemplatePage { } templateContext.set("insertion-delay", preferences.getInsertionDelay()); templateContext.set("posts-per-page", preferences.getPostsPerPage()); + templateContext.set("require-full-access", preferences.isRequireFullAccess()); templateContext.set("positive-trust", preferences.getPositiveTrust()); templateContext.set("negative-trust", preferences.getNegativeTrust()); templateContext.set("trust-comment", preferences.getTrustComment()); diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties index db782fc..21ebc8f 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -38,6 +38,7 @@ Page.Options.Option.AutoFollow.Description=If a new Sone is discovered, follow i 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. +Page.Options.Option.RequireFullAccess.Description=Whether to deny access to Sone to any host that has not been granted full access. Page.Options.Section.TrustOptions.Title=Trust Settings Page.Options.Option.PositiveTrust.Description=The amount of positive trust you want to assign to other Sones by clicking the checkmark below a post or reply. Page.Options.Option.NegativeTrust.Description=The amount of trust you want to assign to other Sones by clicking the red X below a post or reply. This value should be negative. diff --git a/src/main/resources/templates/options.html b/src/main/resources/templates/options.html index 2d956a1..c5130d7 100644 --- a/src/main/resources/templates/options.html +++ b/src/main/resources/templates/options.html @@ -48,6 +48,11 @@

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

+

+ checked="checked"<%/if> /> + <%= Page.Options.Option.RequireFullAccess.Description|l10n|html>

+

+

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

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

-- 2.7.4