Add require-full-access option to Options page.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 7 May 2011 00:14:15 +0000 (02:14 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 7 May 2011 00:14:15 +0000 (02:14 +0200)
This fixes #181.

src/main/java/net/pterodactylus/sone/web/OptionsPage.java
src/main/resources/i18n/sone.en.properties
src/main/resources/templates/options.html

index 39cacc6..bbc1084 100644 (file)
@@ -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());
index db782fc..21ebc8f 100644 (file)
@@ -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.
index 2d956a1..c5130d7 100644 (file)
                <p><%= Page.Options.Option.PostsPerPage.Description|l10n|html></p>
                <p><input type="text" name="posts-per-page" value="<% posts-per-page|html>" /></p>
 
+               <p>
+                       <input type="checkbox" name="require-full-access"<%if require-full-access> checked="checked"<%/if> />
+                       <%= Page.Options.Option.RequireFullAccess.Description|l10n|html></p>
+               </p>
+
                <h2><%= Page.Options.Section.TrustOptions.Title|l10n|html></h2>
 
                <p><%= Page.Options.Option.PositiveTrust.Description|l10n|html></p>