Search in sources :

Example 51 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class BusinessGroupMainRunController method doChat.

private void doChat(UserRequest ureq) {
    ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(ORES_TOOLCHAT);
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
    addToHistory(ureq, bwControl);
    CollaborationTools collabTools = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroup);
    collabToolCtr = collabTools.createChatController(ureq, bwControl, businessGroup, isAdmin);
    if (collabToolCtr == null) {
        showWarning("groupchat.not.available");
        mainPanel.setContent(new Panel("empty"));
    } else {
        mainPanel.setContent(collabToolCtr.getInitialComponent());
    }
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) Panel(org.olat.core.gui.components.panel.Panel) CollaborationTools(org.olat.collaboration.CollaborationTools) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 52 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class OverviewBusinessGroupListController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty()) {
        if (currentCtrl == null) {
            if (isGuestOnly) {
                updateOpenGroups(ureq);
                segmentView.select(openGroupsLink);
            } else {
                boolean markedEmpty = updateMarkedGroups(ureq).isEmpty();
                if (markedEmpty) {
                    updateMyGroups(ureq);
                    segmentView.select(myGroupsLink);
                } else {
                    segmentView.select(markedGroupsLink);
                }
            }
        }
        addToHistory(ureq, currentCtrl);
    } else {
        ContextEntry entry = entries.get(0);
        String segment = entry.getOLATResourceable().getResourceableTypeName();
        List<ContextEntry> subEntries = entries.subList(1, entries.size());
        if ("Favorits".equals(segment)) {
            if (isGuestOnly) {
                updateOpenGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
                segmentView.select(openGroupsLink);
            } else {
                updateMarkedGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
                segmentView.select(markedGroupsLink);
            }
        } else if ("AllGroups".equals(segment)) {
            if (isGuestOnly) {
                updateOpenGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
                segmentView.select(openGroupsLink);
            } else {
                updateMyGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
                segmentView.select(myGroupsLink);
            }
        } else if ("OwnedGroups".equals(segment)) {
            updateOpenGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(openGroupsLink);
        } else if ("Search".equals(segment) && searchOpenLink != null) {
            updateSearch(ureq).activate(ureq, subEntries, entry.getTransientState());
            segmentView.select(searchOpenLink);
        } else {
            // default all groups
            if (isGuestOnly) {
                updateOpenGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
                segmentView.select(openGroupsLink);
            } else {
                updateMyGroups(ureq).activate(ureq, subEntries, entry.getTransientState());
                segmentView.select(myGroupsLink);
            }
        }
    }
}
Also used : ContextEntry(org.olat.core.id.context.ContextEntry)

Example 53 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class OLATAuthManager method sendConfirmationEmail.

private void sendConfirmationEmail(Identity doer, Identity identity) {
    String prefsLanguage = identity.getUser().getPreferences().getLanguage();
    Locale locale = I18nManager.getInstance().getLocaleOrDefault(prefsLanguage);
    Translator translator = Util.createPackageTranslator(OLATAuthenticationController.class, locale);
    ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(OresHelper.createOLATResourceableInstance("changepw", 0l));
    String changePwUrl = BusinessControlFactory.getInstance().getAsURIString(Collections.singletonList(ce), false);
    String[] args = new String[] { // 0: changed users username
    identity.getName(), // 1: changed users email address
    UserManager.getInstance().getUserDisplayEmail(identity, locale), // 2: Name (first and last name) of user who changed the password
    userManager.getUserDisplayName(doer.getUser()), // 3: configured support email address
    WebappHelper.getMailConfig("mailSupport"), // 4: direct link to change password workflow (e.g. https://xx.xx.xx/olat/url/changepw/0)
    changePwUrl };
    String subject = translator.translate("mail.pwd.subject", args);
    String body = translator.translate("mail.pwd.body", args);
    MailContext context = new MailContextImpl(null, null, "[Identity:" + identity.getKey() + "]");
    MailBundle bundle = new MailBundle();
    bundle.setContext(context);
    bundle.setToId(identity);
    bundle.setContent(subject, body);
    mailManager.sendMessage(bundle);
}
Also used : Locale(java.util.Locale) MailContextImpl(org.olat.core.util.mail.MailContextImpl) Translator(org.olat.core.gui.translator.Translator) MailContext(org.olat.core.util.mail.MailContext) MailBundle(org.olat.core.util.mail.MailBundle) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 54 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class OLATAuthenticationController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    ContextEntry entry = entries.get(0);
    String type = entry.getOLATResourceable().getResourceableTypeName();
    if ("changepw".equals(type)) {
        String email = null;
        if (entries.size() > 1) {
            email = entries.get(1).getOLATResourceable().getResourceableTypeName();
        }
        openChangePassword(ureq, email);
    } else if ("registration".equals(type)) {
        if (registrationModule.isSelfRegistrationEnabled() && registrationModule.isSelfRegistrationLinkEnabled()) {
            List<ContextEntry> subEntries = entries.subList(1, entries.size());
            openRegistration(ureq).activate(ureq, subEntries, entry.getTransientState());
        }
    }
}
Also used : List(java.util.List) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 55 with ContextEntry

use of org.olat.core.id.context.ContextEntry in project OpenOLAT by OpenOLAT.

the class WikiHandler method createLaunchController.

@Override
public MainLayoutController createLaunchController(RepositoryEntry re, RepositoryEntrySecurity reSecurity, UserRequest ureq, WindowControl wControl) {
    // first handle special case: disabled wiki for security (XSS Attacks) reasons
    BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
    if (!securityModule.isWikiEnabled()) {
        return RepositoyUIFactory.createRepoEntryDisabledDueToSecurityMessageController(ureq, wControl);
    }
    // check role
    boolean isOLatAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isGuestOnly = ureq.getUserSession().getRoles().isGuestOnly();
    boolean isResourceOwner = false;
    if (isOLatAdmin) {
        isResourceOwner = true;
    } else {
        isResourceOwner = reSecurity.isOwner();
    }
    OLATResource res = re.getOlatResource();
    BusinessControl bc = wControl.getBusinessControl();
    final ContextEntry ce = bc.popLauncherContextEntry();
    SubscriptionContext subsContext = new SubscriptionContext(res, WikiManager.WIKI_RESOURCE_FOLDER_NAME);
    final WikiSecurityCallback callback = new WikiSecurityCallbackImpl(null, isOLatAdmin, isGuestOnly, false, isResourceOwner, subsContext);
    RepositoryEntryRuntimeController runtime = new RepositoryEntryRuntimeController(ureq, wControl, re, reSecurity, new RuntimeControllerCreator() {

        @Override
        public Controller create(UserRequest uureq, WindowControl wwControl, TooledStackedPanel toolbarPanel, RepositoryEntry entry, RepositoryEntrySecurity security, AssessmentMode assessmentMode) {
            CoreSpringFactory.getImpl(UserCourseInformationsManager.class).updateUserCourseInformations(entry.getOlatResource(), uureq.getIdentity());
            Controller controller;
            if (ce != null) {
                // jump to a certain context
                OLATResourceable ores = ce.getOLATResourceable();
                String typeName = ores.getResourceableTypeName();
                String page = typeName.substring("page=".length());
                controller = new WikiMainController(uureq, wwControl, entry.getOlatResource(), callback, page);
            } else {
                controller = new WikiMainController(uureq, wwControl, entry.getOlatResource(), callback, null);
            }
            return new OLATResourceableListeningWrapperController(uureq, wwControl, entry.getOlatResource(), controller, null, uureq.getIdentity());
        }
    });
    return runtime;
}
Also used : TooledStackedPanel(org.olat.core.gui.components.stack.TooledStackedPanel) AssessmentMode(org.olat.course.assessment.AssessmentMode) OLATResourceable(org.olat.core.id.OLATResourceable) WikiMainController(org.olat.modules.wiki.WikiMainController) BusinessControl(org.olat.core.id.context.BusinessControl) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl) OLATResourceableListeningWrapperController(org.olat.core.util.controller.OLATResourceableListeningWrapperController) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) MainLayoutController(org.olat.core.gui.control.generic.layout.MainLayoutController) RepositoryEntryRuntimeController(org.olat.repository.ui.RepositoryEntryRuntimeController) Controller(org.olat.core.gui.control.Controller) WikiMainController(org.olat.modules.wiki.WikiMainController) ContextEntry(org.olat.core.id.context.ContextEntry) RepositoryEntryRuntimeController(org.olat.repository.ui.RepositoryEntryRuntimeController) RuntimeControllerCreator(org.olat.repository.ui.RepositoryEntryRuntimeController.RuntimeControllerCreator) WikiSecurityCallbackImpl(org.olat.modules.wiki.WikiSecurityCallbackImpl) RepositoryEntrySecurity(org.olat.repository.model.RepositoryEntrySecurity) OLATResourceableListeningWrapperController(org.olat.core.util.controller.OLATResourceableListeningWrapperController) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) WikiSecurityCallback(org.olat.modules.wiki.WikiSecurityCallback) UserRequest(org.olat.core.gui.UserRequest)

Aggregations

ContextEntry (org.olat.core.id.context.ContextEntry)270 OLATResourceable (org.olat.core.id.OLATResourceable)78 WindowControl (org.olat.core.gui.control.WindowControl)58 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)44 ArrayList (java.util.ArrayList)42 TreeNode (org.olat.core.gui.components.tree.TreeNode)30 Controller (org.olat.core.gui.control.Controller)26 RepositoryEntry (org.olat.repository.RepositoryEntry)24 List (java.util.List)22 Identity (org.olat.core.id.Identity)22 BusinessControl (org.olat.core.id.context.BusinessControl)22 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)20 BusinessControlFactory (org.olat.core.id.context.BusinessControlFactory)18 HistoryPoint (org.olat.core.id.context.HistoryPoint)18 CollaborationTools (org.olat.collaboration.CollaborationTools)16 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)14 UserSession (org.olat.core.util.UserSession)14 CourseNode (org.olat.course.nodes.CourseNode)14 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)12 Translator (org.olat.core.gui.translator.Translator)12