Search in sources :

Example 26 with CloseableModalController

use of org.olat.core.gui.control.generic.closablewrapper.CloseableModalController in project OpenOLAT by OpenOLAT.

the class CPTreeController method event.

/**
 * Event-handling from components
 */
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == importLink) {
        uploadCtr = new CPFileImportController(ureq, getWindowControl(), cp, currentPage);
        listenTo(uploadCtr);
        String title = translate("cpfileuploadcontroller.form.title");
        cmc = new CloseableModalController(getWindowControl(), translate("close"), uploadCtr.getInitialComponent(), true, title);
        listenTo(cmc);
        cmc.activate();
    } else if (source == newLink) {
        fireEvent(ureq, new Event("New Page"));
    } else if (source == copyLink) {
        if (currentPage.isOrgaPage()) {
            showInfo("cptreecontroller.orga.cannot.be.copied");
        } else {
            String newIdentifier = copyPage(currentPage);
            contentCtr.displayPageWithMetadataEditor(ureq, newIdentifier);
        }
    } else if (source == deleteLink) {
        if (currentPage.isOrgaPage()) {
            showInfo("cptreecontroller.orga.cannot.be.deleted");
        } else {
            List<String> buttonLables = new ArrayList<String>();
            buttonLables.add(translate("cptreecontrolller.delete.items.and.files"));
            buttonLables.add(translate("cptreecontrolller.delete.items.only"));
            buttonLables.add(translate("cancel"));
            dialogCtr = DialogBoxUIFactory.createGenericDialog(ureq, getWindowControl(), translate("cptreecontroller.q_delete_title"), translate("cptreecontroller.q_delete_text", getCurrentPageInfoStringHTML()), buttonLables);
            listenTo(dialogCtr);
            dialogCtr.activate();
        }
    } else if (source == treeCtr) {
        if (event instanceof TreeEvent) {
            TreeEvent te = (TreeEvent) event;
            String selectedNodeID = treeModel.getIdentifierForNodeID(te.getNodeId());
            currentPage = new CPPage(selectedNodeID, cp);
            fireEvent(ureq, new TreeEvent(TreeEvent.COMMAND_TREENODE_CLICKED, selectedNodeID));
        } else if (event instanceof TreeDropEvent) {
            TreeDropEvent te = (TreeDropEvent) event;
            doDrop(ureq, te.getDroppedNodeId(), te.getTargetNodeId(), te.isAsChild());
        }
    }
}
Also used : TreeEvent(org.olat.core.gui.components.tree.TreeEvent) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent) Event(org.olat.core.gui.control.Event) ArrayList(java.util.ArrayList) List(java.util.List) TreeDropEvent(org.olat.core.gui.components.tree.TreeDropEvent)

Example 27 with CloseableModalController

use of org.olat.core.gui.control.generic.closablewrapper.CloseableModalController in project OpenOLAT by OpenOLAT.

the class OAuthAdminController method doAddOpenIDConnectIFCustom.

private void doAddOpenIDConnectIFCustom(UserRequest ureq) {
    addConfigCtrl = new AddOpenIDConnectIFFullConfigurableController(ureq, getWindowControl());
    listenTo(addConfigCtrl);
    String title = translate("add.openidconnectif.custom");
    cmc = new CloseableModalController(getWindowControl(), null, addConfigCtrl.getInitialComponent(), true, title, true);
    listenTo(cmc);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)

Example 28 with CloseableModalController

use of org.olat.core.gui.control.generic.closablewrapper.CloseableModalController in project OpenOLAT by OpenOLAT.

the class OAuthRegistrationController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    String lang = langEl.getSelectedKey();
    String username = usernameEl.getValue();
    OAuthUser oauthUser = registration.getOauthUser();
    User newUser = userManager.createUser(null, null, null);
    for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
        FormItem propertyItem = this.flc.getFormComponent(userPropertyHandler.getName());
        userPropertyHandler.updateUserFromFormItem(newUser, propertyItem);
    }
    // Init preferences
    newUser.getPreferences().setLanguage(lang);
    newUser.getPreferences().setInformSessionTimeout(true);
    String id;
    if (StringHelper.containsNonWhitespace(oauthUser.getId())) {
        id = oauthUser.getId();
    } else if (StringHelper.containsNonWhitespace(oauthUser.getEmail())) {
        id = oauthUser.getEmail();
    } else {
        id = username;
    }
    authenticatedIdentity = securityManager.createAndPersistIdentityAndUser(username, null, newUser, registration.getAuthProvider(), id, null);
    // Add user to system users group
    SecurityGroup olatuserGroup = securityManager.findSecurityGroupByName(Constants.GROUP_OLATUSERS);
    securityManager.addIdentityToSecurityGroup(authenticatedIdentity, olatuserGroup);
    // open disclaimer
    removeAsListenerAndDispose(disclaimerController);
    disclaimerController = new DisclaimerController(ureq, getWindowControl());
    listenTo(disclaimerController);
    cmc = new CloseableModalController(getWindowControl(), translate("close"), disclaimerController.getInitialComponent(), true, translate("disclaimer.title"));
    cmc.activate();
    listenTo(cmc);
}
Also used : OAuthUser(org.olat.login.oauth.model.OAuthUser) User(org.olat.core.id.User) DisclaimerController(org.olat.registration.DisclaimerController) OAuthUser(org.olat.login.oauth.model.OAuthUser) FormItem(org.olat.core.gui.components.form.flexible.FormItem) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) SecurityGroup(org.olat.basesecurity.SecurityGroup) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 29 with CloseableModalController

use of org.olat.core.gui.control.generic.closablewrapper.CloseableModalController in project OpenOLAT by OpenOLAT.

the class StudentCoursesController method contact.

private void contact(UserRequest ureq) {
    removeAsListenerAndDispose(cmc);
    ContactMessage cmsg = new ContactMessage(getIdentity());
    ContactList contactList = new ContactList("to");
    contactList.add(student);
    cmsg.addEmailTo(contactList);
    contactCtrl = new ContactFormController(ureq, getWindowControl(), true, false, false, cmsg);
    listenTo(contactCtrl);
    cmc = new CloseableModalController(getWindowControl(), translate("close"), contactCtrl.getInitialComponent());
    cmc.activate();
    listenTo(cmc);
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ContactFormController(org.olat.modules.co.ContactFormController) ContactList(org.olat.core.util.mail.ContactList) ContactMessage(org.olat.core.util.mail.ContactMessage)

Example 30 with CloseableModalController

use of org.olat.core.gui.control.generic.closablewrapper.CloseableModalController in project OpenOLAT by OpenOLAT.

the class ParticipantLectureBlocksController method doAppeal.

private void doAppeal(UserRequest ureq, LectureBlockAndRollCall row) {
    if (appealCtrl != null)
        return;
    LectureBlock block = lectureService.getLectureBlock(row.getLectureBlockRef());
    List<Identity> teachers = lectureService.getTeachers(block);
    List<Identity> onwers = repositoryService.getMembers(entry, GroupRoles.owner.name());
    ContactList contactList = new ContactList(translate("appeal.contact.list"));
    contactList.addAllIdentites(teachers);
    contactList.addAllIdentites(onwers);
    StringBuilder teacherNames = new StringBuilder();
    for (Identity teacher : teachers) {
        if (teacherNames.length() > 0)
            teacherNames.append(", ");
        teacherNames.append(teacher.getUser().getFirstName()).append(" ").append(teacher.getUser().getLastName());
    }
    String date = Formatter.getInstance(getLocale()).formatDate(block.getStartDate());
    String[] args = new String[] { row.getLectureBlockTitle(), teacherNames.toString(), date };
    ContactMessage cmsg = new ContactMessage(getIdentity());
    cmsg.addEmailTo(contactList);
    cmsg.setSubject(translate("appeal.subject", args));
    cmsg.setBodyText(translate("appeal.body", args));
    appealCtrl = new ContactFormController(ureq, getWindowControl(), true, false, false, cmsg);
    appealCtrl.setUserObject(row);
    appealCtrl.setContactFormTitle(translate("new.appeal.title"));
    listenTo(appealCtrl);
    String title = translate("appeal.title", new String[] { row.getLectureBlockTitle() });
    cmc = new CloseableModalController(getWindowControl(), "close", appealCtrl.getInitialComponent(), true, title);
    listenTo(cmc);
    cmc.activate();
}
Also used : LectureBlock(org.olat.modules.lecture.LectureBlock) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ContactFormController(org.olat.modules.co.ContactFormController) ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity) ContactMessage(org.olat.core.util.mail.ContactMessage)

Aggregations

CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)789 RepositoryEntry (org.olat.repository.RepositoryEntry)52 ArrayList (java.util.ArrayList)48 Identity (org.olat.core.id.Identity)42 ReferencableEntriesSearchController (org.olat.repository.controllers.ReferencableEntriesSearchController)38 VFSContainer (org.olat.core.util.vfs.VFSContainer)24 Component (org.olat.core.gui.components.Component)20 ContactMessage (org.olat.core.util.mail.ContactMessage)20 ContactFormController (org.olat.modules.co.ContactFormController)20 File (java.io.File)17 List (java.util.List)16 UserSearchController (org.olat.admin.user.UserSearchController)16 TableEvent (org.olat.core.gui.components.table.TableEvent)16 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)16 ContactList (org.olat.core.util.mail.ContactList)16 MailTemplate (org.olat.core.util.mail.MailTemplate)14 OLATResourceable (org.olat.core.id.OLATResourceable)12 MailNotificationEditController (org.olat.core.util.mail.MailNotificationEditController)12 OLATSecurityException (org.olat.core.logging.OLATSecurityException)10 Roles (org.olat.core.id.Roles)8