@Override protected void event(UserRequest ureq, Controller source, Event event) { if (newMethodCtrl == source) { if (event.equals(Event.DONE_EVENT)) { OfferAccess newLink = newMethodCtrl.commitChanges(); newLink = acService.saveOfferAccess(newLink); addConfiguration(newLink); fireEvent(ureq, Event.CHANGED_EVENT); } cmc.deactivate(); cleanUp(); } else if (editMethodCtrl == source) { if (event.equals(Event.DONE_EVENT)) { OfferAccess newLink = editMethodCtrl.commitChanges(); newLink = acService.saveOfferAccess(newLink); replace(newLink); fireEvent(ureq, Event.CHANGED_EVENT); } cmc.deactivate(); cleanUp(); } else if (cmc == source) { cleanUp(); } else { super.event(ureq, source, event); } }
/** * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, * org.olat.core.gui.components.Component, org.olat.core.gui.control.Event) */ @Override public void event(final UserRequest ureq, final Component source, final Event event) { if (source == myEntriesLink) { searchCtr.doSearchByOwnerLimitType(ureq.getIdentity(), limitTypes); mainVC.contextPut("subtitle", translate("referencableSearch." + CMD_MY_ENTRIES)); myEntriesLink.setCustomEnabledLinkCSS("b_selected"); allEntriesLink.removeCSS(); searchEntriesLink.removeCSS(); } if (source == allEntriesLink) { searchCtr.doSearchForReferencableResourcesLimitType( ureq.getIdentity(), limitTypes, ureq.getUserSession().getRoles()); mainVC.contextPut("subtitle", translate("referencableSearch." + CMD_ALL_ENTRIES)); allEntriesLink.setCustomEnabledLinkCSS("b_selected"); myEntriesLink.removeCSS(); searchEntriesLink.removeCSS(); } if (source == searchEntriesLink) { mainVC.contextPut("subtitle", translate("referencableSearch." + CMD_SEARCH_ENTRIES)); // start with search view searchCtr.displaySearchForm(); mainVC.contextPut("subtitle", translate("referencableSearch." + CMD_SEARCH)); searchEntriesLink.setCustomEnabledLinkCSS("b_selected"); myEntriesLink.removeCSS(); allEntriesLink.removeCSS(); } if (source == createRessourceButton) { removeAsListenerAndDispose(addController); addController = new RepositoryAddController(ureq, getWindowControl(), getAction(ACTION_CREATE)); listenTo(addController); removeAsListenerAndDispose(cmc); cmc = new CloseableModalController( getWindowControl(), translate("close"), addController.getInitialComponent()); listenTo(cmc); cmc.activate(); } if (source == importRessourceButton) { removeAsListenerAndDispose(addController); addController = new RepositoryAddController(ureq, getWindowControl(), getAction(ACTION_IMPORT)); listenTo(addController); removeAsListenerAndDispose(cmc); cmc = new CloseableModalController( getWindowControl(), translate("close"), addController.getInitialComponent()); listenTo(cmc); cmc.activate(); } }
protected void addMethod(UserRequest ureq, AccessMethod method) { Offer offer = acService.createOffer(resource, displayName); OfferAccess link = acService.createOfferAccess(offer, method); removeAsListenerAndDispose(newMethodCtrl); AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType()); if (handler != null) { newMethodCtrl = handler.createConfigurationController(ureq, getWindowControl(), link); } if (newMethodCtrl != null) { listenTo(newMethodCtrl); String title = handler.getMethodName(getLocale()); cmc = new CloseableModalController( getWindowControl(), translate("close"), newMethodCtrl.getInitialComponent(), true, title); cmc.activate(); listenTo(cmc); } else { OfferAccess newLink = acService.saveOfferAccess(link); addConfiguration(newLink); } }
private void doCreateSolutionEditor(UserRequest ureq, Solution solution) { String documentName = solution.getFilename(); VFSItem item = solutionContainer.resolve(documentName); if (item == null) { solutionContainer.createChildLeaf(documentName); } else { documentName = VFSManager.rename(solutionContainer, documentName); solutionContainer.createChildLeaf(documentName); } newSolutionEditorCtrl = WysiwygFactory.createWysiwygController( ureq, getWindowControl(), solutionContainer, documentName, "media", true, true); newSolutionEditorCtrl.getRichTextConfiguration().disableMedia(); newSolutionEditorCtrl.getRichTextConfiguration().setAllowCustomMediaFactory(false); newSolutionEditorCtrl.setNewFile(true); newSolutionEditorCtrl.setUserObject(solution); listenTo(newSolutionEditorCtrl); cmc = new CloseableModalController( getWindowControl(), "close", newSolutionEditorCtrl.getInitialComponent()); listenTo(cmc); cmc.activate(); }
/** @param controller The <code>FormBasicController</code> to be displayed in the modal dialog. */ private void activateModalDialog(final FormBasicController controller) { listenTo(controller); cmc = new CloseableModalController( getWindowControl(), translate("close"), controller.getInitialComponent()); listenTo(cmc); cmc.activate(); }
/** {@inheritDoc} */ @Override protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) { if (source instanceof TextElement) { int i = lTargetInputList.indexOf(source); if (i >= 0) { String linkValue = ((TextElement) source).getValue(); if (!linkValue.contains("://")) { linkValue = "http://".concat(linkValue.trim()); } boolean selected = lHtmlTargetInputList.get(i).isSelected(0); if (selected && linkValue.startsWith(Settings.getServerContextPathURI())) { lHtmlTargetInputList.get(i).select(BLANK_KEY, false); } } } else if (source.getComponent() instanceof Link) { if (lAddButtonList.contains(source)) { // add a new form link final LLModel link = (LLModel) ((FormLink) source).getUserObject(); final LLModel newLink = new LLModel(); linkList.add(linkList.indexOf(link) + 1, newLink); addNewFormLink(linkList.indexOf(link) + 1, newLink); } else if (lDelButtonList.contains(source)) { // special case: only one line existent if (linkList.size() == 1) { // clear this line lTargetInputList.get(0).setValue(""); lTargetInputList.get(0).setEnabled(true); lDescriptionInputList.get(0).setValue(""); lCommentInputList.get(0).setValue(""); } else { final LLModel link = (LLModel) ((FormLink) source).getUserObject(); removeFormLink(link); } } else if (lCustomMediaButtonList.contains(source)) { currentLink = (LLModel) ((FormLink) source).getUserObject(); removeAsListenerAndDispose(mediaDialogBox); removeAsListenerAndDispose(mediaChooserController); VFSContainer courseContainer = courseEnv.getCourseFolderContainer(); mediaChooserController = new MediaChooserController( ureq, getWindowControl(), courseContainer, null, null, "", null); listenTo(mediaChooserController); mediaDialogBox = new CloseableModalController( getWindowControl(), translate("choose"), mediaChooserController.getInitialComponent()); mediaDialogBox.activate(); listenTo(mediaDialogBox); } } super.formInnerEvent(ureq, source, event); fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT); }
@Override protected void event(UserRequest ureq, Controller source, Event event) { if (recordingsCtrl == source) { cmc.deactivate(); cleanUp(); } else if (cmc == source) { cleanUp(); } super.event(ureq, source, event); }
private void doCreateSolution(UserRequest ureq) { newSolutionCtrl = new NewSolutionController(ureq, getWindowControl(), solutionContainer); listenTo(newSolutionCtrl); cmc = new CloseableModalController( getWindowControl(), "close", newSolutionCtrl.getInitialComponent()); listenTo(cmc); cmc.activate(); }
@Override protected void event(UserRequest ureq, Controller source, Event event) { if (addSolutionCtrl == source) { if (event == Event.DONE_EVENT) { Solution newSolution = addSolutionCtrl.getSolution(); solutions.getSolutions().add(newSolution); fireEvent(ureq, Event.DONE_EVENT); updateModel(); } cmc.deactivate(); cleanUp(); } else if (editSolutionCtrl == source) { if (event == Event.DONE_EVENT) { fireEvent(ureq, Event.DONE_EVENT); updateModel(); } cmc.deactivate(); cleanUp(); } else if (newSolutionCtrl == source) { Solution newSolution = newSolutionCtrl.getSolution(); cmc.deactivate(); cleanUp(); if (event == Event.DONE_EVENT) { solutions.getSolutions().add(newSolution); doCreateSolutionEditor(ureq, newSolution); updateModel(); } } else if (newSolutionEditorCtrl == source) { if (event == Event.DONE_EVENT) { updateModel(); fireEvent(ureq, Event.DONE_EVENT); } cmc.deactivate(); cleanUp(); } else if (editSolutionEditorCtrl == source) { cmc.deactivate(); cleanUp(); } else if (cmc == source) { cleanUp(); } super.event(ureq, source, event); }
private void doAddSolution(UserRequest ureq) { addSolutionCtrl = new EditSolutionController(ureq, getWindowControl(), solutionDir, solutionContainer); listenTo(addSolutionCtrl); String title = translate("add.solution"); cmc = new CloseableModalController( getWindowControl(), null, addSolutionCtrl.getInitialComponent(), true, title, false); listenTo(cmc); cmc.activate(); }
protected RegistrationController openRegistration(UserRequest ureq) { removeAsListenerAndDispose(cmc); removeAsListenerAndDispose(subController); subController = new RegistrationController(ureq, getWindowControl()); listenTo(subController); cmc = new CloseableModalController( getWindowControl(), translate("close"), subController.getInitialComponent()); listenTo(cmc); cmc.activate(); return (RegistrationController) subController; }
private void createRemovedNotificationMail(UserRequest ureq, String subjectStr) { MailTemplate mailTempl = denManager.getRemovedMailTemplate(ureq, subjectStr, getTranslator()); removeAsListenerAndDispose(addedNotificationCtr); addedNotificationCtr = new MailNotificationEditController(getWindowControl(), ureq, mailTempl, false, false, true); listenTo(addedNotificationCtr); VelocityContainer sendNotificationVC = createVelocityContainer("sendnotification"); sendNotificationVC.put("notificationForm", addedNotificationCtr.getInitialComponent()); removeAsListenerAndDispose(notificationCmc); notificationCmc = new CloseableModalController(getWindowControl(), "close", sendNotificationVC); listenTo(notificationCmc); notificationCmc.activate(); }
private void doEditSolutionEditor(UserRequest ureq, Solution solution) { String documentName = solution.getFilename(); editSolutionEditorCtrl = WysiwygFactory.createWysiwygController( ureq, getWindowControl(), solutionContainer, documentName, "media", true, true); editSolutionEditorCtrl.getRichTextConfiguration().disableMedia(); editSolutionEditorCtrl.getRichTextConfiguration().setAllowCustomMediaFactory(false); listenTo(editSolutionEditorCtrl); cmc = new CloseableModalController( getWindowControl(), "close", editSolutionEditorCtrl.getInitialComponent()); listenTo(cmc); cmc.activate(); }
private void doOpenRecordings(UserRequest ureq) { if (recordingsCtrl != null) return; recordingsCtrl = new GoToRecordingsController(ureq, getWindowControl(), meeting); listenTo(recordingsCtrl); cmc = new CloseableModalController( getWindowControl(), translate("close"), recordingsCtrl.getInitialComponent(), true, translate("recordings")); cmc.activate(); listenTo(cmc); }
@Override protected void event(UserRequest ureq, Controller source, Event event) { if (source == mediaDialogBox) { removeAsListenerAndDispose(mediaDialogBox); removeAsListenerAndDispose(mediaChooserController); mediaDialogBox = null; mediaChooserController = null; } else if (source == mediaChooserController) { if (event instanceof URLChoosenEvent) { URLChoosenEvent choosenEvent = (URLChoosenEvent) event; String url = choosenEvent.getURL(); if (url.startsWith(Settings.getServerContextPathURI())) { // doesn't allow absolute path -> the mapper check if the link is in the list! url = url.substring(Settings.getServerContextPathURI().length()); } currentLink.setTarget(url); currentLink.setIntern(true); currentLink.setHtmlTarget(SELF_KEY); if (StringHelper.containsNonWhitespace(choosenEvent.getDisplayName())) { currentLink.setDescription(choosenEvent.getDisplayName()); } int index = 0; for (TextElement targetEl : lTargetInputList) { if (currentLink.equals(targetEl.getUserObject())) { targetEl.setValue(url); targetEl.setEnabled(false); lDescriptionInputList.get(index).setValue(currentLink.getDescription()); lHtmlTargetInputList.get(index).select(SELF_KEY, true); break; } index++; } } mediaDialogBox.deactivate(); removeAsListenerAndDispose(mediaDialogBox); removeAsListenerAndDispose(mediaChooserController); mediaDialogBox = null; mediaChooserController = null; } super.event(ureq, source, event); }
/** * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, * org.olat.core.gui.components.Component, org.olat.core.gui.control.Event) */ public void event(UserRequest ureq, Component source, Event event) { if (source == showFileButton) { ICourse course = CourseFactory.loadCourse(ores); String personalFolderDir = CourseFactory.getPersonalDirectory(ureq.getIdentity()).getPath(); String targetDir = CourseFactory.getOrCreateDataExportDirectory(ureq.getIdentity(), course.getCourseTitle()) .getPath(); String relPath = ""; if (targetDir.startsWith(personalFolderDir)) { // that should always be the case relPath = targetDir.substring(personalFolderDir.length()).replace("\\", "/"); targetDir = targetDir.substring(0, personalFolderDir.length()); } VFSContainer targetFolder = new LocalFolderImpl(new File(targetDir)); FolderRunController bcrun = new FolderRunController(targetFolder, true, ureq, getWindowControl()); Component folderComponent = bcrun.getInitialComponent(); if (relPath.length() != 0) { if (!relPath.endsWith("/")) { relPath = relPath + "/"; } bcrun.activatePath(ureq, relPath); } String personalFolder = Util.createPackageTranslator(HomeMainController.class, ureq.getLocale(), null) .translate("menu.bc"); removeAsListenerAndDispose(cmc); cmc = new CloseableModalController( getWindowControl(), translate("close"), folderComponent, true, personalFolder); listenTo(cmc); cmc.activate(); } }
private void createParticipantsMail(UserRequest ureq, List<Identity> participants) { VelocityContainer sendMessageVC = createVelocityContainer("sendmessage"); ContactMessage cmsg = new ContactMessage(ureq.getIdentity()); ContactList contactList = new ContactList(translate("participants.message.to")); contactList.addAllIdentites(participants); cmsg.addEmailTo(contactList); removeAsListenerAndDispose(contactCtr); contactCtr = new ContactFormController(ureq, getWindowControl(), false, false, false, false, cmsg); listenTo(contactCtr); sendMessageVC.contextPut("title", translate("participants.message")); sendMessageVC.put("contactForm", contactCtr.getInitialComponent()); removeAsListenerAndDispose(notificationCmc); notificationCmc = new CloseableModalController(getWindowControl(), "close", sendMessageVC); listenTo(notificationCmc); notificationCmc.activate(); }
private void editMethod(UserRequest ureq, AccessInfo infos) { OfferAccess link = infos.getLink(); removeAsListenerAndDispose(editMethodCtrl); AccessMethodHandler handler = acModule.getAccessMethodHandler(link.getMethod().getType()); if (handler != null) { editMethodCtrl = handler.editConfigurationController(ureq, getWindowControl(), link); } if (editMethodCtrl != null) { listenTo(editMethodCtrl); String title = handler.getMethodName(getLocale()); cmc = new CloseableModalController( getWindowControl(), translate("close"), editMethodCtrl.getInitialComponent(), true, title); cmc.activate(); listenTo(cmc); } }
protected void openChangePassword(UserRequest ureq, String initialEmail) { // double-check if allowed first if (!userModule.isAnyPasswordChangeAllowed()) { throw new OLATSecurityException("chose password to be changed, but disallowed by config"); } removeAsListenerAndDispose(cmc); removeAsListenerAndDispose(subController); subController = new PwChangeController(ureq, getWindowControl(), initialEmail, true); listenTo(subController); String title = ((PwChangeController) subController).getWizardTitle(); cmc = new CloseableModalController( getWindowControl(), translate("close"), subController.getInitialComponent(), true, title); listenTo(cmc); cmc.activate(); }
/** Event-handling from controllers */ @Override protected void event(final UserRequest ureq, final Controller source, final Event event) { if (source == cmc) { if (event.equals(CloseableModalController.CLOSE_MODAL_EVENT)) { removeAsListenerAndDispose(cmc); cmc = null; removeAsListenerAndDispose(uploadCtr); uploadCtr = null; } } else if (source == uploadCtr) { if (event instanceof NewCPPageEvent) { // TODO:GW Is it necessary to set component dirty? // getInitialComponent().setDirty(true); fireEvent(ureq, event); } // Dispose the cmc and the podcastFormCtr. cmc.deactivate(); removeAsListenerAndDispose(cmc); cmc = null; removeAsListenerAndDispose(uploadCtr); uploadCtr = null; } else if (source == treeCtr) { // event from extJSTree (TreeController) if (event instanceof MoveTreeNodeEvent) { /** move * */ final MoveTreeNodeEvent moveEvent = (MoveTreeNodeEvent) event; final String selectedNodeID = treeModel.getIdentifierForNodeID(moveEvent.getNodeId()); currentPage = new CPPage(selectedNodeID, cp); final MoveTreeNodeEvent newmoveEvent = new MoveTreeNodeEvent( treeModel.getIdentifierForNodeID(moveEvent.getNodeId()), treeModel.getIdentifierForNodeID(moveEvent.getOldParentNodeId()), treeModel.getIdentifierForNodeID(moveEvent.getNewParentNodeId()), moveEvent.getPosition()); final boolean success = movePage(newmoveEvent); // setResult is important. If sucess is not true, the ajax tree will // popup a dialog with error-msg moveEvent.setResult(success, "Error", "Error while moving node"); } else if (event instanceof TreeNodeClickedEvent) { /** click * */ TreeNodeClickedEvent clickedEvent = (TreeNodeClickedEvent) event; final String selectedNodeID = treeModel.getIdentifierForNodeID(clickedEvent.getNodeId()); currentPage = new CPPage(selectedNodeID, cp); clickedEvent = new TreeNodeClickedEvent(currentPage.getIdentifier()); fireEvent(ureq, clickedEvent); } else if (event instanceof TreeNodeModifiedEvent) { /** a node (name) has been modified * */ fireEvent(ureq, event); } } else if (source == dialogCtr) { // event from dialog (really-delete-dialog) if (event != Event.CANCELLED_EVENT) { final int position = DialogBoxUIFactory.getButtonPos(event); // 0 = delete with resource // 1 = delete without resource // 2 = cancel if (position == 0 || position == 1) { boolean deleteResource = false; if (position == 0) { // Delete element including files deleteResource = true; } final String parentIdentifier = getParentIdentifier(); // finally delete the page deletePage(currentPage.getIdentifier(), deleteResource); if (parentIdentifier != null) { contentCtr.displayPage(ureq, parentIdentifier); } } else { // Cancel dialog and close window. } } } }
@Override public void event(UserRequest ureq, Controller source, Event event) { if (source == tableListParticipants) { if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) { TableEvent tableEvent = (TableEvent) event; // open window for choosen date to manage the enrolled users or manually add if (tableEvent.getActionId().equals(DENListTableDataModel.CHANGE_ACTION)) { selectedEvent = (KalendarEvent) listTableData.getObject(tableEvent.getRowId()); List<Identity> participants = denManager.getEventParticipants(selectedEvent); participantsTableData = new DENParticipantsTableDataModel(participants); removeAsListenerAndDispose(tableManageParticipants); tableManageParticipants = denManager.createParticipantsTable( ureq, getWindowControl(), getTranslator(), participantsTableData); listenTo(tableManageParticipants); removeAsListenerAndDispose(formManageParticipants); formManageParticipants = new DENManageParticipantsForm(ureq, getWindowControl()); listenTo(formManageParticipants); participantsVC = createVelocityContainer("participants"); SimpleText dateTitle = new SimpleText( "dateTitle", translate("dates.table.subject") + ": " + selectedEvent.getSubject()); DateFormat df = new SimpleDateFormat(); SimpleText dateTimeframe = new SimpleText( "dateTimeframe", translate("dates.table.date") + ": " + df.format(selectedEvent.getBegin()) + " - " + df.format(selectedEvent.getEnd())); participantsVC.put("dateTitle", dateTitle); participantsVC.put("dateTimeframe", dateTimeframe); participantsVC.put("participantsTable", tableManageParticipants.getInitialComponent()); participantsVC.put("addParticipants", formManageParticipants.getInitialComponent()); removeAsListenerAndDispose(manageParticipantsModalCntrl); manageParticipantsModalCntrl = new CloseableModalController( getWindowControl(), "close", participantsVC, true, translate("dates.table.participant.manage")); listenTo(manageParticipantsModalCntrl); manageParticipantsModalCntrl.activate(); } } else { TableMultiSelectEvent tmse = (TableMultiSelectEvent) event; BitSet selection = tmse.getSelection(); // delete all users from the selected dates if (tmse.getAction().equals(DENListTableDataModel.DELETE_ACTION) && selection.cardinality() > 0) { removed = denManager.getSelectedEventParticipants(dateList, selection); dateList = denManager.deleteParticipants( ores, courseNode, denManager.getSelectedEventIDs(dateList, selection)); listTableData.setObjects(dateList); // send notification mail createRemovedNotificationMail(ureq, dateList.get(0).getSubject()); } else if (tmse.getAction().equals(DENListTableDataModel.MAIL_ACTION) && selection.cardinality() > 0) { // send email to all users from the selected dates List<Identity> participants = denManager.getSelectedEventParticipants(dateList, selection); createParticipantsMail(ureq, participants); } else if (selection.cardinality() == 0) { showWarning("participants.message.empty"); } } } else if (source == formManageParticipants && event == DENManageParticipantsForm.ADD_PARTICIPANTS) { // open user search controller to manually add users in date removeAsListenerAndDispose(userSearchCntrl); userSearchCntrl = new UserSearchController(ureq, getWindowControl(), true, true); listenTo(userSearchCntrl); removeAsListenerAndDispose(userSearchCMC); userSearchCMC = new CloseableModalController( getWindowControl(), "close", userSearchCntrl.getInitialComponent()); listenTo(userSearchCMC); userSearchCMC.activate(); } else if (source == userSearchCntrl) { if (event == Event.CANCELLED_EVENT) { userSearchCMC.deactivate(); } else { List<Identity> toAdd = null; added = new ArrayList<Identity>(); if (event instanceof SingleIdentityChosenEvent) { SingleIdentityChosenEvent singleEvent = (SingleIdentityChosenEvent) event; Identity choosenIdentity = singleEvent.getChosenIdentity(); toAdd = new ArrayList<Identity>(); toAdd.add(choosenIdentity); } else if (event instanceof MultiIdentityChosenEvent) { MultiIdentityChosenEvent multiEvent = (MultiIdentityChosenEvent) event; toAdd = multiEvent.getChosenIdentities(); } boolean showMessage = false; if (toAdd != null && toAdd.size() > 0) { for (Identity identity : toAdd) { status = denManager.doEnroll(identity, selectedEvent, ores, courseNode, true); if (!status.isEnrolled() && status.getErrorMessage().equals(DENStatus.ERROR_ALREADY_ENROLLED)) showMessage = true; else added.add(identity); } if (showMessage) showWarning("enrollment.warning.manual"); refreshTables(); } userSearchCMC.deactivate(); if (added.size() > 0) { // write notification mail createAddedNotificationMail(ureq, dateList.get(0).getSubject()); } } } else if (source == tableManageParticipants) { if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) { TableEvent tableEvent = (TableEvent) event; // delete single user from event if (tableEvent.getActionId().equals(DENParticipantsTableDataModel.REMOVE_ACTION)) { Identity identity = participantsTableData.getEntryAt(tableEvent.getRowId()); status = denManager.cancelEnroll(identity, selectedEvent, ores, courseNode); if (!status.isCancelled()) showError(); // send notification mail else { removed.clear(); removed.add(identity); createRemovedNotificationMail(ureq, dateList.get(0).getSubject()); } refreshTables(); // write email to single user } else if (tableEvent.getActionId().equals(DENParticipantsTableDataModel.MAIL_ACTION)) { List<Identity> participants = new ArrayList<Identity>(); participants.add(participantsTableData.getEntryAt(tableEvent.getRowId())); createParticipantsMail(ureq, participants); } } } else if (source == addedNotificationCtr && event == Event.DONE_EVENT) { if (addedNotificationCtr.getMailTemplate() != null) { Identity sender = ureq.getIdentity(); MailerResult result = new MailerResult(); String metaId = UUID.randomUUID().toString().replace("-", ""); MailContext context = new MailContextImpl(getWindowControl().getBusinessControl().getAsString()); MailBundle[] bundles = mailManager.makeMailBundles( context, added, addedNotificationCtr.getMailTemplate(), sender, metaId, result); result.append(mailManager.sendMessage(bundles)); if (addedNotificationCtr.getMailTemplate().getCpfrom()) { MailBundle ccBundles = mailManager.makeMailBundle( context, sender, addedNotificationCtr.getMailTemplate(), sender, metaId, result); result.append(mailManager.sendMessage(ccBundles)); } MailHelper.printErrorsAndWarnings(result, getWindowControl(), ureq.getLocale()); } notificationCmc.deactivate(); added.clear(); } else if (source == removedNotificationCtr && event == Event.DONE_EVENT) { if (removedNotificationCtr.getMailTemplate() != null) { // fxdiff VCRP-16: intern mail system Identity sender = ureq.getIdentity(); MailerResult result = new MailerResult(); String metaId = UUID.randomUUID().toString().replace("-", ""); MailContext context = new MailContextImpl(getWindowControl().getBusinessControl().getAsString()); MailBundle[] bundles = mailManager.makeMailBundles( context, added, addedNotificationCtr.getMailTemplate(), sender, metaId, result); result.append(mailManager.sendMessage(bundles)); if (addedNotificationCtr.getMailTemplate().getCpfrom()) { MailBundle ccBundle = mailManager.makeMailBundle( context, sender, addedNotificationCtr.getMailTemplate(), sender, metaId, result); result.append(mailManager.sendMessage(ccBundle)); } MailHelper.printErrorsAndWarnings(result, getWindowControl(), ureq.getLocale()); } notificationCmc.deactivate(); removed.clear(); } else if (source == contactCtr) { notificationCmc.deactivate(); } }
/** * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, * org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event) */ @Override public void event(UserRequest ureq, Controller source, Event event) { if (source == loginForm && event == Event.DONE_EVENT) { String login = loginForm.getLogin(); String pass = loginForm.getPass(); if (loginModule.isLoginBlocked(login)) { // do not proceed when blocked showError("login.blocked", loginModule.getAttackPreventionTimeoutMin().toString()); getLogger() .audit( "Login attempt on already blocked login for " + login + ". IP::" + ureq.getHttpReq().getRemoteAddr(), null); return; } authenticatedIdentity = olatAuthenticationSpi.authenticate(null, login, pass); if (authenticatedIdentity == null) { if (loginModule.registerFailedLoginAttempt(login)) { getLogger() .audit( "Too many failed login attempts for " + login + ". Login blocked. IP::" + ureq.getHttpReq().getRemoteAddr(), null); showError("login.blocked", loginModule.getAttackPreventionTimeoutMin().toString()); return; } else { showError("login.error", WebappHelper.getMailConfig("mailReplyTo")); return; } } else { try { String language = authenticatedIdentity.getUser().getPreferences().getLanguage(); UserSession usess = ureq.getUserSession(); if (StringHelper.containsNonWhitespace(language)) { usess.setLocale(I18nManager.getInstance().getLocaleOrDefault(language)); } } catch (Exception e) { logError("Cannot set the user language", e); } } loginModule.clearFailedLoginAttempts(login); // Check if disclaimer has been accepted if (registrationManager.needsToConfirmDisclaimer(authenticatedIdentity)) { // accept disclaimer first removeAsListenerAndDispose(disclaimerCtr); disclaimerCtr = new DisclaimerController(ureq, getWindowControl()); listenTo(disclaimerCtr); removeAsListenerAndDispose(cmc); cmc = new CloseableModalController( getWindowControl(), translate("close"), disclaimerCtr.getInitialComponent()); listenTo(cmc); cmc.activate(); } else { // disclaimer acceptance not required authenticated(ureq, authenticatedIdentity); } } else if (source == disclaimerCtr) { cmc.deactivate(); if (event == Event.DONE_EVENT) { // disclaimer accepted registrationManager.setHasConfirmedDislaimer(authenticatedIdentity); authenticated(ureq, authenticatedIdentity); } } else if (cmc == source) { cleanUp(); } if (source == subController) { if (event == Event.CANCELLED_EVENT) { cmc.deactivate(); cleanUp(); } } }
/** * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, * org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event) */ @Override public void event(final UserRequest ureq, final Controller source, final Event event) { final String cmd = event.getCommand(); if (source == searchCtr) { if (cmd.equals(RepositoryTableModel.TABLE_ACTION_SELECT_ENTRY)) { // user selected entry to get a preview selectedRepositoryEntry = searchCtr.getSelectedEntry(); final RepositoryEntry repositoryEntry = searchCtr.getSelectedEntry(); final RepositoryHandler typeToLaunch = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repositoryEntry); if (typeToLaunch == null) { final StringBuilder sb = new StringBuilder(translate("error.launch")); sb.append(": No launcher for repository entry: "); sb.append(repositoryEntry.getKey()); throw new OLATRuntimeException(RepositoryDetailsController.class, sb.toString(), null); } // do skip the increment launch counter, this is only a preview! final OLATResourceable ores = repositoryEntry.getOlatResource(); removeAsListenerAndDispose(previewCtr); previewCtr = typeToLaunch.createLaunchController(ores, null, ureq, getWindowControl()); listenTo(previewCtr); removeAsListenerAndDispose(previewModalCtr); previewModalCtr = new CloseableModalController( getWindowControl(), translate("referencableSearch.preview.close"), previewCtr.getInitialComponent()); listenTo(previewModalCtr); previewModalCtr.activate(); } else if (cmd.equals(RepositoryTableModel.TABLE_ACTION_SELECT_LINK)) { // done, user selected a repo entry selectedRepositoryEntry = searchCtr.getSelectedEntry(); fireEvent(ureq, EVENT_REPOSITORY_ENTRY_SELECTED); } initLinks(); } else if (source == addController) { if (event.equals(Event.DONE_EVENT)) { cmc.deactivate(); selectedRepositoryEntry = addController.getAddedEntry(); fireEvent(ureq, EVENT_REPOSITORY_ENTRY_SELECTED); // info message final String message = translate( "message.entry.selected", new String[] { addController.getAddedEntry().getDisplayname(), addController.getAddedEntry().getResourcename() }); getWindowControl().setInfo(message); } else if (event.equals(Event.CANCELLED_EVENT)) { cmc.deactivate(); } else if (event.equals(Event.FAILED_EVENT)) { showError("add.failed"); } } }