@Override protected void event(final UserRequest ureq, final Component source, final Event event) { // default wizard will lissen to cancel wizard event super.event(ureq, source, event); if (source == nextButton) { if (mailTemplate == null) { // wizard stops here - no mail template to fill out fireEvent(ureq, new MultiIdentityChosenEvent(this.oks)); } else { // next step is the notification mail form removeAsListenerAndDispose(mailCtr); mailCtr = new MailNotificationEditController(getWindowControl(), ureq, mailTemplate, false); listenTo(mailCtr); setNextWizardStep(translate("import.title.email"), mailCtr.getInitialComponent()); } } else if (source == backButton) { // go back one step in wizard setBackWizardStep(translate("import.title.select"), usersForm.getInitialComponent()); } }
@Override protected void event(final UserRequest ureq, final Controller source, final Event event) { if (source == usersForm) { if (event == Event.DONE_EVENT) { // calc stuff, preview final List existIdents = securityManager.getIdentitiesOfSecurityGroup(securityGroup); oks = new ArrayList<Identity>(); final List<String> anonymous = new ArrayList<String>(); final List<String> notFounds = new ArrayList<String>(); final List<String> alreadyIn = new ArrayList<String>(); // get the logins final String inp = usersForm.getLoginsString(); final String[] lines = inp.split("\r?\n"); for (int i = 0; i < lines.length; i++) { final String username = lines[i].trim(); if (!username.equals("")) { // skip empty lines final Identity ident = securityManager.findIdentityByName(username); if (ident == null) { // not found, add to not-found-list notFounds.add(username); } else if (getBaseSecurityEBL().isAnonymous(ident)) { anonymous.add(username); } else { // check if already in group final boolean inGroup = containsIdentity(existIdents, ident); if (inGroup) { // added to warning: already in group alreadyIn.add(ident.getName()); } else { // ok to add -> preview (but filter duplicate entries) if (!containsIdentity(oks, ident)) { oks.add(ident); } } } } } // push table and other infos to velocity removeAsListenerAndDispose(newTableC); newTableC = UserControllerFactory.createTableControllerFor( null, oks, ureq, getWindowControl(), null); listenTo(newTableC); mainVc.put("table", newTableC.getInitialComponent()); mainVc.contextPut("isanonymous", listNames(anonymous)); mainVc.contextPut("notfound", listNames(notFounds)); mainVc.contextPut("alreadyin", listNames(alreadyIn)); mainVc.contextPut("usercount", new Integer(oks.size())); // set table page as next wizard step setNextWizardStep(translate("import.title.finish"), mainVc); } } else if (source == mailCtr) { if (event == Event.DONE_EVENT) { final MultiIdentityChosenEvent multiEvent = new MultiIdentityChosenEvent(this.oks); multiEvent.setMailTemplate(mailCtr.getMailTemplate()); fireEvent(ureq, multiEvent); } } }