+ super("login.html", template, "Page.Login.Title", webInterface, false);
+ }
+
+ //
+ // TEMPLATEPAGE METHODS
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void processTemplate(Request request, Template template) throws RedirectException {
+ super.processTemplate(request, template);
+ /* get all own identities. */
+ List<Sone> localSones = new ArrayList<Sone>(webInterface.getCore().getLocalSones());
+ Collections.sort(localSones, Sone.NICE_NAME_COMPARATOR);
+ template.set("sones", localSones);
+ if (request.getMethod() == Method.POST) {
+ String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone-id", 100);
+ Sone selectedSone = null;
+ for (Sone sone : webInterface.getCore().getSones()) {
+ if (sone.getId().equals(soneId)) {
+ selectedSone = sone;
+ break;
+ }
+ }
+ if (selectedSone != null) {
+ setCurrentSone(request.getToadletContext(), selectedSone);
+ throw new RedirectException("index.html");
+ }
+ }
+ List<OwnIdentity> ownIdentitiesWithoutSone = CreateSonePage.getOwnIdentitiesWithoutSone(webInterface.getCore());
+ template.set("identitiesWithoutSone", ownIdentitiesWithoutSone);
+ }
+
+ //
+ // SONETEMPLATEPAGE METHODS
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isEnabled(ToadletContext toadletContext) {
+ return getCurrentSone(toadletContext) == null;