* The version to display
*/
public AboutPage(Template template, WebInterface webInterface, Version version) {
- super("about.html", template, "Page.About.Title", webInterface);
+ super("about.html", template, "Page.About.Title", webInterface, false);
this.version = version;
}
template.set("version", version);
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return false;
- }
-
}
* The Sone web interface
*/
public AddSonePage(Template template, WebInterface webInterface) {
- super("addSone.html", template, "Page.AddSone.Title", webInterface);
+ super("addSone.html", template, "Page.AddSone.Title", webInterface, false);
}
//
* The Sone web interface
*/
public BackupProfilePage(Template template, WebInterface webInterface) {
- super("backupProfile.html", template, "Page.BackupProfile.Title", webInterface);
+ super("backupProfile.html", template, "Page.BackupProfile.Title", webInterface, true);
}
//
return response;
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
- }
-
}
* The Sone web interface
*/
public BlacklistPage(Template template, WebInterface webInterface) {
- super("blacklist.html", template, "Page.Blacklist.Title", webInterface);
+ super("blacklist.html", template, "Page.Blacklist.Title", webInterface, false);
}
//
* The Sone web interface
*/
public BlacklistSonePage(Template template, WebInterface webInterface) {
- super("blacklistSone.html", template, "Page.BlacklistSone.Title", webInterface);
+ super("blacklistSone.html", template, "Page.BlacklistSone.Title", webInterface, false);
}
//
}
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return false;
- }
-
}
* The Sone web interface
*/
public BlockSonePage(Template template, WebInterface webInterface) {
- super("blockSone.html", template, "Page.BlockSone.Title", webInterface);
+ super("blockSone.html", template, "Page.BlockSone.Title", webInterface, true);
}
//
}
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- // TODO Auto-generated method stub
- return super.requiresLogin();
- }
-
}
* The Sone web interface
*/
public CreatePostPage(Template template, WebInterface webInterface) {
- super("createPost.html", template, "Page.CreatePost.Title", webInterface);
+ super("createPost.html", template, "Page.CreatePost.Title", webInterface, true);
}
//
template.set("returnPage", returnPage);
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
- }
-
}
* The Sone web interface
*/
public CreateReplyPage(Template template, WebInterface webInterface) {
- super("createReply.html", template, "Page.CreateReply.Title", webInterface);
+ super("createReply.html", template, "Page.CreateReply.Title", webInterface, true);
}
//
template.set("returnPage", returnPage);
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
- }
-
}
* The Sone web interface
*/
public CreateSonePage(Template template, WebInterface webInterface) {
- super("createSone.html", template, "Page.CreateSone.Title", webInterface);
+ super("createSone.html", template, "Page.CreateSone.Title", webInterface, false);
}
//
* The Sone web interface
*/
public DeletePostPage(Template template, WebInterface webInterface) {
- super("deletePost.html", template, "Page.DeletePost.Title", webInterface);
+ super("deletePost.html", template, "Page.DeletePost.Title", webInterface, true);
}
//
}
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
- }
-
}
* The Sone web interface
*/
public DeleteReplyPage(Template template, WebInterface webInterface) {
- super("deleteReply.html", template, "Page.DeleteReply.Title", webInterface);
+ super("deleteReply.html", template, "Page.DeleteReply.Title", webInterface, true);
}
//
template.set("returnPage", returnPage);
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
- }
-
}
* The Sone web interface
*/
public DeleteSonePage(Template template, WebInterface webInterface) {
- super("deleteSone.html", template, "Page.DeleteSone.Title", webInterface);
+ super("deleteSone.html", template, "Page.DeleteSone.Title", webInterface, true);
}
//
}
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
- }
-
}
* The Sone web interface
*/
public EditProfilePage(Template template, WebInterface webInterface) {
- super("editProfile.html", template, "Page.EditProfile.Title", webInterface);
+ super("editProfile.html", template, "Page.EditProfile.Title", webInterface, true);
}
//
template.set("birthYear", birthYear);
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
- }
-
}
* The Sone web interface
*/
public FollowSonePage(Template template, WebInterface webInterface) {
- super("followSone.html", template, "Page.FollowSone.Title", webInterface);
+ super("followSone.html", template, "Page.FollowSone.Title", webInterface, true);
}
//
}
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
- }
-
}
* The Sone web interface
*/
public ImportSonePage(Template template, WebInterface webInterface) {
- super("importSone.html", template, "Page.ImportSone.Title", webInterface);
+ super("importSone.html", template, "Page.ImportSone.Title", webInterface, false);
}
//
* The Sone web interface
*/
public IndexPage(Template template, WebInterface webInterface) {
- super("index.html", template, "Page.Index.Title", webInterface);
+ super("index.html", template, "Page.Index.Title", webInterface, true);
}
//
template.set("posts", allPosts);
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
- }
-
}
* The Sone web interface
*/
public KnownSonesPage(Template template, WebInterface webInterface) {
- super("knownSones.html", template, "Page.KnownSones.Title", webInterface);
+ super("knownSones.html", template, "Page.KnownSones.Title", webInterface, false);
}
//
* The Sone web interface
*/
public LikePage(Template template, WebInterface webInterface) {
- super("like.html", template, "Page.LikePost.Title", webInterface);
+ super("like.html", template, "Page.LikePost.Title", webInterface, true);
}
//
}
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
- }
-
}
* The Sone web interface
*/
public LoadSonePage(Template template, WebInterface webInterface) {
- super("loadSone.html", template, "Page.LoadSone.Title", webInterface);
+ super("loadSone.html", template, "Page.LoadSone.Title", webInterface, false);
}
//
import net.pterodactylus.sone.template.SoneAccessor;
import net.pterodactylus.sone.web.page.Page.Request.Method;
import net.pterodactylus.util.template.Template;
-import freenet.clients.http.ToadletContext;
/**
* The login page manages logging the user in.
* The Sone web interface
*/
public LoginPage(Template template, WebInterface webInterface) {
- super("login.html", template, "Page.Login.Title", webInterface);
+ super("login.html", template, "Page.Login.Title", webInterface, false);
}
//
}
}
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isEnabled(ToadletContext toadletContext) {
- return getCurrentSone(toadletContext) == null;
- }
-
}
* The Sone web interface
*/
public LogoutPage(Template template, WebInterface webInterface) {
- super("logout.html", template, "Page.Logout.Title", webInterface);
+ super("logout.html", template, "Page.Logout.Title", webInterface, true);
}
//
* {@inheritDoc}
*/
@Override
- protected boolean requiresLogin() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
public boolean isEnabled(ToadletContext toadletContext) {
return getCurrentSone(toadletContext) != null;
}
* The Sone web interface
*/
public OptionsPage(Template template, WebInterface webInterface) {
- super("options.html", template, "Page.Options.Title", webInterface);
+ super("options.html", template, "Page.Options.Title", webInterface, false);
}
//
template.set("really-clear-on-next-restart", options.getBooleanOption("ReallyClearOnNextRestart").get());
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return false;
- }
-
}
/** The Sone core. */
protected final WebInterface webInterface;
+ /** Whether to require a login. */
+ private final boolean requireLogin;
+
/**
- * Creates a new template page for Freetalk.
+ * Creates a new template page for Freetalk that does not require the user
+ * to be logged in.
*
* @param path
* The path of the page
* The Sone web interface
*/
public SoneTemplatePage(String path, Template template, String pageTitleKey, WebInterface webInterface) {
+ this(path, template, pageTitleKey, webInterface, false);
+ }
+
+ /**
+ * Creates a new template page for Freetalk.
+ *
+ * @param path
+ * The path of the page
+ * @param template
+ * The template to render
+ * @param pageTitleKey
+ * The l10n key of the page title
+ * @param webInterface
+ * The Sone web interface
+ * @param requireLogin
+ * Whether this page requires a login
+ */
+ public SoneTemplatePage(String path, Template template, String pageTitleKey, WebInterface webInterface, boolean requireLogin) {
super(path, template, webInterface.l10n(), pageTitleKey, "noPermission.html");
this.webInterface = webInterface;
+ this.requireLogin = requireLogin;
template.set("webInterface", webInterface);
}
* page, {@code false} otherwise
*/
protected boolean requiresLogin() {
- return false;
+ return requireLogin;
}
/**
* The Sone web interface
*/
public UnblacklistSonePage(Template template, WebInterface webInterface) {
- super("unblacklistSone.html", template, "Page.UnblacklistSone.Title", webInterface);
+ super("unblacklistSone.html", template, "Page.UnblacklistSone.Title", webInterface, false);
}
//
}
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return false;
- }
-
}
* The Sone web interface
*/
public UnblockSonePage(Template template, WebInterface webInterface) {
- super("unblockSone.html", template, "Page.UnblockSone.Title", webInterface);
+ super("unblockSone.html", template, "Page.UnblockSone.Title", webInterface, true);
}
//
}
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- // TODO Auto-generated method stub
- return super.requiresLogin();
- }
-
}
* The Sone web interface
*/
public UnfollowSonePage(Template template, WebInterface webInterface) {
- super("unfollowSone.html", template, "Page.UnfollowSone.Title", webInterface);
+ super("unfollowSone.html", template, "Page.UnfollowSone.Title", webInterface, true);
}
//
}
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
- }
-
}
* The Sone web interface
*/
public UnlikePage(Template template, WebInterface webInterface) {
- super("unlike.html", template, "Page.UnlikePost.Title", webInterface);
+ super("unlike.html", template, "Page.UnlikePost.Title", webInterface, true);
}
//
}
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
- }
-
}
* The Sone web interface
*/
public ViewPostPage(Template template, WebInterface webInterface) {
- super("viewPost.html", template, "Page.ViewPost.Title", webInterface);
+ super("viewPost.html", template, "Page.ViewPost.Title", webInterface, false);
}
//
template.set("post", post);
}
- //
- // SONETEMPLATEPAGE METHODS
- //
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected boolean requiresLogin() {
- return true;
- }
-
}
* The Sone web interface
*/
public ViewSonePage(Template template, WebInterface webInterface) {
- super("viewSone.html", template, "Page.ViewSone.Title", webInterface);
+ super("viewSone.html", template, "Page.ViewSone.Title", webInterface, false);
}
//