import java.util.logging.Level;
import java.util.logging.Logger;
+import net.pterodactylus.sone.core.Core;
import net.pterodactylus.sone.main.SonePlugin;
import net.pterodactylus.sone.web.page.CSSPage;
import net.pterodactylus.sone.web.page.PageToadlet;
* The Sone plugin
*/
public WebInterface(SonePlugin sonePlugin) {
+ super("Sone Web Interface");
this.sonePlugin = sonePlugin;
}
//
/**
+ * Returns the Sone core used by the Sone plugin.
+ *
+ * @return The Sone core
+ */
+ public Core core() {
+ return sonePlugin.core();
+ }
+
+ /**
* Returns the l10n helper of the node.
*
* @return The node’s l10n helper
*/
private void registerToadlets() {
TemplateFactory templateFactory = new SoneTemplateFactory(l10n());
+ String formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword();
Template loginTemplate = templateFactory.createTemplate(createReader("/templates/login.html"));
- loginTemplate.set("formPassword", sonePlugin.pluginRespirator().getToadletContainer().getFormPassword());
+ loginTemplate.set("formPassword", formPassword);
PageToadletFactory pageToadletFactory = new PageToadletFactory(sonePlugin.pluginRespirator().getHLSimpleClient(), "/Sone/");
pageToadlets.add(pageToadletFactory.createPageToadlet(new LoginPage(loginTemplate, this), "Login"));
pageToadlets.add(pageToadletFactory.createPageToadlet(new CSSPage("css/", "/static/css/")));
ToadletContainer toadletContainer = sonePlugin.pluginRespirator().getToadletContainer();
- toadletContainer.getPageMaker().addNavigationCategory("/Sone/", "Navigation.Menu.Name", "Navigation.Menu.Tooltip", sonePlugin);
+ toadletContainer.getPageMaker().addNavigationCategory("/Sone/index.html", "Navigation.Menu.Name", "Navigation.Menu.Tooltip", sonePlugin);
for (PageToadlet toadlet : pageToadlets) {
String menuName = toadlet.getMenuName();
if (menuName != null) {
- toadletContainer.register(toadlet, "Navigation.Menu.Name", toadlet.path(), true, "Navigation.Menu.Item." + menuName + ".Name", "Navigation.Menu.Item." + menuName + ".Tooltip", false, new AlwaysEnabledCallback());
+ toadletContainer.register(toadlet, "Navigation.Menu.Name", toadlet.path(), true, "Navigation.Menu.Item." + menuName + ".Name", "Navigation.Menu.Item." + menuName + ".Tooltip", false, toadlet);
} else {
toadletContainer.register(toadlet, null, toadlet.path(), true, false);
}