Make “show custom avatars” option configurable.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 7 Dec 2011 15:08:01 +0000 (16:08 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 7 Dec 2011 15:08:01 +0000 (16:08 +0100)
src/main/java/net/pterodactylus/sone/web/OptionsPage.java
src/main/resources/i18n/sone.en.properties
src/main/resources/static/css/sone.css
src/main/resources/templates/options.html

index 49b1275..1847b9c 100644 (file)
@@ -22,6 +22,7 @@ import java.util.List;
 
 import net.pterodactylus.sone.core.Core.Preferences;
 import net.pterodactylus.sone.data.Sone;
+import net.pterodactylus.sone.data.Sone.ShowCustomAvatars;
 import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired;
 import net.pterodactylus.sone.web.page.FreenetRequest;
 import net.pterodactylus.util.number.Numbers;
@@ -73,6 +74,8 @@ public class OptionsPage extends SoneTemplatePage {
                                currentSone.getOptions().getBooleanOption("ShowNotification/NewPosts").set(showNotificationNewPosts);
                                boolean showNotificationNewReplies = request.getHttpRequest().isPartSet("show-notification-new-replies");
                                currentSone.getOptions().getBooleanOption("ShowNotification/NewReplies").set(showNotificationNewReplies);
+                               String showCustomAvatars = request.getHttpRequest().getPartAsStringFailsafe("show-custom-avatars", 32);
+                               currentSone.getOptions().<ShowCustomAvatars> getEnumOption("ShowCustomAvatars").set(ShowCustomAvatars.valueOf(showCustomAvatars));
                                webInterface.getCore().touchConfiguration();
                        }
                        Integer insertionDelay = Numbers.safeParseInteger(request.getHttpRequest().getPartAsStringFailsafe("insertion-delay", 16));
@@ -139,6 +142,7 @@ public class OptionsPage extends SoneTemplatePage {
                        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("show-custom-avatars", currentSone.getOptions().<ShowCustomAvatars> getEnumOption("ShowCustomAvatars").get().name());
                }
                templateContext.set("insertion-delay", preferences.getInsertionDelay());
                templateContext.set("posts-per-page", preferences.getPostsPerPage());
index 845327e..c3c1bc1 100644 (file)
@@ -44,7 +44,12 @@ Page.Options.Option.ShowNotificationNewSones.Description=Show notifications for
 Page.Options.Option.ShowNotificationNewPosts.Description=Show notifications for new posts.
 Page.Options.Option.ShowNotificationNewReplies.Description=Show notifications for new replies.
 Page.Options.Section.AvatarOptions.Title=Avatar Options
-
+Page.Options.Option.ShowAvatars.Description=You can disable custom avatars here, depending on the selected criteria. If an avatar is disabled for a Sone, the automatically generated avatar is shown instead.
+Page.Options.Option.ShowAvatars.Never.Description=Never show custom avatars.
+Page.Options.Option.ShowAvatars.Followed.Description=Only show avatars for Sones that you follow.
+Page.Options.Option.ShowAvatars.ManuallyTrusted.Description=Only show avatars for Sones that you have manually assigned a trust value larger than 0 to.
+Page.Options.Option.ShowAvatars.Trusted.Description=Only show avatars for Sones that have a trust value larger than 0.
+Page.Options.Option.ShowAvatars.Always.Description=Always show custom avatars. Be warned: some avatars might contain disturbing or offensive imagery.
 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.
index d065f78..7754528 100644 (file)
@@ -862,3 +862,11 @@ textarea {
 #sone #avatar-selection li#no-avatar {
        display: block;
 }
+
+#sone form#options ul {
+       padding-left: 1em;
+}
+
+#sone form#options li {
+       list-style-type: none;
+}
index 86c1388..94e01dc 100644 (file)
                        <%= Page.Options.Option.ShowNotificationNewReplies.Description|l10n|html>
                </p>
 
-               <%ifnull !currentSone>
-               <%/if>
+               <h2><%= Page.Options.Section.AvatarOptions.Title|l10n|html></h2>
+
+               <p><%= Page.Options.Option.ShowAvatars.Description|l10n|html></p>
+               
+               <ul>
+                       <li>
+                               <input type="radio" name="show-custom-avatars" value="NEVER"<%if show-custom-avatars|match value=NEVER> checked="checked"<%/if>/>
+                               <%=Page.Options.Option.ShowAvatars.Never.Description|l10n|html>
+                       </li>
+                       <li>
+                               <input type="radio" name="show-custom-avatars" value="FOLLOWED"<%if show-custom-avatars|match value=FOLLOWED> checked="checked"<%/if>/>
+                               <%=Page.Options.Option.ShowAvatars.Followed.Description|l10n|html>
+                       </li>
+                       <li>
+                               <input type="radio" name="show-custom-avatars" value="MANUALLY_TRUSTED"<%if show-custom-avatars|match value=MANUALLY_TRUSTED> checked="checked"<%/if>/>
+                               <%=Page.Options.Option.ShowAvatars.ManuallyTrusted.Description|l10n|html>
+                       </li>
+                       <li>
+                               <input type="radio" name="show-custom-avatars" value="TRUSTED"<%if show-custom-avatars|match value=TRUSTED> checked="checked"<%/if>/>
+                               <%=Page.Options.Option.ShowAvatars.Trusted.Description|l10n|html>
+                       </li>
+                       <li>
+                               <input type="radio" name="show-custom-avatars" value="ALWAYS"<%if show-custom-avatars|match value=ALWAYS> checked="checked"<%/if>/>
+                               <%=Page.Options.Option.ShowAvatars.Always.Description|l10n|html>
+                       </li>
+               </ul>
 
                <h2><%= Page.Options.Section.RuntimeOptions.Title|l10n|html></h2>