Search in sources :

Example 46 with BusinessControl

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

the class CertificateAndEfficiencyStatementController method doOpenHome.

private void doOpenHome(UserRequest ureq) {
    List<ContextEntry> ces = new ArrayList<ContextEntry>(1);
    ces.add(BusinessControlFactory.getInstance().createContextEntry(statementOwner));
    BusinessControl bc = BusinessControlFactory.getInstance().createFromContextEntries(ces);
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
    NewControllerFactory.getInstance().launch(ureq, bwControl);
}
Also used : BusinessControl(org.olat.core.id.context.BusinessControl) ArrayList(java.util.ArrayList) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 47 with BusinessControl

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

the class PortfolioCourseNodeRunController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source == newMapLink) {
        RepositoryEntry courseEntry = userCourseEnv.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
        Date deadline = courseNode.getDeadline();
        if (templateMap != null) {
            copyMap = ePFMgr.assignStructuredMapToUser(getIdentity(), templateMap, courseEntry, courseNode.getIdent(), null, deadline);
            if (copyMap != null) {
                showInfo("map.copied", StringHelper.escapeHtml(templateMap.getTitle()));
                ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapPortfolioOres(copyMap));
                ThreadLocalUserActivityLogger.log(EPLoggingAction.EPORTFOLIO_TASK_STARTED, getClass());
            }
        } else if (templateBinder != null) {
            if (copyBinder == null) {
                copyBinder = portfolioService.assignBinder(getIdentity(), templateBinder, courseEntry, courseNode.getIdent(), deadline);
                if (copyBinder != null) {
                    showInfo("map.copied", StringHelper.escapeHtml(templateBinder.getTitle()));
                    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(copyBinder));
                    ThreadLocalUserActivityLogger.log(PortfolioLoggingAction.PORTFOLIO_TASK_STARTED, getClass());
                }
            } else if (copyBinder != null && copyBinder.getBinderStatus() == BinderStatus.deleted) {
                String title = translate("trashed.binder.confirm.title");
                String text = translate("trashed.binder.confirm.descr", new String[] { StringHelper.escapeHtml(copyBinder.getTitle()) });
                restoreBinderCtrl = activateYesNoDialog(ureq, title, text, restoreBinderCtrl);
                restoreBinderCtrl.setUserObject(copyBinder);
                return;
            }
        }
        updateUI(ureq);
    } else if (source == selectMapLink) {
        String resourceUrl;
        if (copyMap != null) {
            resourceUrl = "[HomeSite:" + getIdentity().getKey() + "][Portfolio:0][EPStructuredMap:" + copyMap.getKey() + "]";
        } else if (copyBinder != null) {
            resourceUrl = "[HomeSite:" + getIdentity().getKey() + "][PortfolioV2:0][MyBinders:0][Binder:" + copyBinder.getKey() + "]";
        } else {
            return;
        }
        BusinessControl bc = BusinessControlFactory.getInstance().createFromString(resourceUrl);
        WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
        NewControllerFactory.getInstance().launch(ureq, bwControl);
    } else if ("ONCLICK".equals(event.getCommand())) {
        String cmd = ureq.getParameter("fcid");
        String panelId = ureq.getParameter("panel");
        if (StringHelper.containsNonWhitespace(cmd) && StringHelper.containsNonWhitespace(panelId)) {
            saveOpenPanel(ureq, panelId, "show".equals(cmd));
        }
    }
}
Also used : BusinessControl(org.olat.core.id.context.BusinessControl) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl) Date(java.util.Date)

Example 48 with BusinessControl

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

the class CollaborationTools method createWikiController.

/**
 * return an controller for the wiki tool
 * @param ureq
 * @param wControl
 * @return
 */
public Controller createWikiController(UserRequest ureq, WindowControl wControl) {
    // Check for jumping to certain wiki page
    BusinessControl bc = wControl.getBusinessControl();
    ContextEntry ce = bc.popLauncherContextEntry();
    SubscriptionContext subContext = new SubscriptionContext(ores, WikiManager.WIKI_RESOURCE_FOLDER_NAME);
    boolean isOlatAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
    boolean isGuestOnly = ureq.getUserSession().getRoles().isGuestOnly();
    boolean isResourceOwner = BaseSecurityManager.getInstance().isIdentityPermittedOnResourceable(ureq.getIdentity(), Constants.PERMISSION_ACCESS, ores);
    WikiSecurityCallback callback = new WikiSecurityCallbackImpl(null, isOlatAdmin, isGuestOnly, true, isResourceOwner, subContext);
    if (ce != null) {
        // jump to a certain context
        OLATResourceable ceOres = ce.getOLATResourceable();
        String typeName = ceOres.getResourceableTypeName();
        String page = typeName.substring("page=".length());
        if (page != null && page.endsWith(":0")) {
            page = page.substring(0, page.length() - 2);
        }
        return WikiManager.getInstance().createWikiMainController(ureq, wControl, ores, callback, page);
    } else {
        return WikiManager.getInstance().createWikiMainController(ureq, wControl, ores, callback, null);
    }
}
Also used : WikiSecurityCallbackImpl(org.olat.modules.wiki.WikiSecurityCallbackImpl) OLATResourceable(org.olat.core.id.OLATResourceable) BusinessControl(org.olat.core.id.context.BusinessControl) SubscriptionContext(org.olat.core.commons.services.notifications.SubscriptionContext) WikiSecurityCallback(org.olat.modules.wiki.WikiSecurityCallback) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 49 with BusinessControl

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

the class NotificationsPortletRunController method 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 == showAllLink) {
        // activate homes tab in top navigation and active bookmarks menu item
        String resourceUrl = "[HomeSite:" + ureq.getIdentity().getKey() + "][notifications:0]";
        BusinessControl bc = BusinessControlFactory.getInstance().createFromString(resourceUrl);
        WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
        NewControllerFactory.getInstance().launch(ureq, bwControl);
    } else if (event == ComponentUtil.VALIDATE_EVENT && needsModelReload) {
        // updateTableModel(ureq.getLocale(), ureq.getIdentity());
        reloadModel(sortingCriteria);
        needsModelReload = false;
    }
}
Also used : BusinessControl(org.olat.core.id.context.BusinessControl) WindowControl(org.olat.core.gui.control.WindowControl)

Example 50 with BusinessControl

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

the class MembersAvatarDisplayRunController method doOpenHomePage.

private void doOpenHomePage(Member member, UserRequest ureq) {
    String url = "[HomePage:" + member.getKey() + "]";
    BusinessControl bc = BusinessControlFactory.getInstance().createFromString(url);
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
    NewControllerFactory.getInstance().launch(ureq, bwControl);
}
Also used : BusinessControl(org.olat.core.id.context.BusinessControl) WindowControl(org.olat.core.gui.control.WindowControl)

Aggregations

BusinessControl (org.olat.core.id.context.BusinessControl)80 WindowControl (org.olat.core.gui.control.WindowControl)56 OLATResourceable (org.olat.core.id.OLATResourceable)24 ContextEntry (org.olat.core.id.context.ContextEntry)22 RepositoryEntry (org.olat.repository.RepositoryEntry)16 ArrayList (java.util.ArrayList)14 Controller (org.olat.core.gui.control.Controller)8 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)6 Window (org.olat.core.gui.components.Window)6 HistoryPoint (org.olat.core.id.context.HistoryPoint)6 CourseNode (org.olat.course.nodes.CourseNode)6 Date (java.util.Date)4 UserRequest (org.olat.core.gui.UserRequest)4 DTab (org.olat.core.gui.control.generic.dtabs.DTab)4 DTabs (org.olat.core.gui.control.generic.dtabs.DTabs)4 Identity (org.olat.core.id.Identity)4 Roles (org.olat.core.id.Roles)4 BusinessControlFactory (org.olat.core.id.context.BusinessControlFactory)4 NodeRunConstructionResult (org.olat.course.run.navigation.NodeRunConstructionResult)4 IOException (java.io.IOException)3