Search in sources :

Example 66 with BusinessControl

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

the class BlogArtefactHandler method prefillArtefactAccordingToSource.

/**
 * @see org.olat.portfolio.EPAbstractHandler#prefillArtefactAccordingToSource(org.olat.portfolio.model.artefacts.AbstractArtefact, java.lang.Object)
 */
@Override
public void prefillArtefactAccordingToSource(AbstractArtefact artefact, Object source) {
    super.prefillArtefactAccordingToSource(artefact, source);
    Feed feed = null;
    if (source instanceof Feed) {
        feed = (Feed) source;
        String subPath = getItemUUID(artefact.getBusinessPath());
        for (Item item : FeedManager.getInstance().loadItems(feed)) {
            if (subPath.equals(item.getGuid())) {
                prefillBlogArtefact(artefact, feed, item);
            }
        }
        artefact.setSignature(70);
    }
    String origBPath = artefact.getBusinessPath();
    String artSource = "";
    BusinessControl bc = BusinessControlFactory.getInstance().createFromString(origBPath);
    if (origBPath.contains(CourseNode.class.getSimpleName())) {
        // blog-post from inside a course, rebuild "course-name - feed-name"
        OLATResourceable ores = bc.popLauncherContextEntry().getOLATResourceable();
        RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntry(ores.getResourceableId());
        artSource = repoEntry.getDisplayname();
        if (feed != null) {
            artSource += " - " + feed.getTitle();
        }
    } else if (origBPath.contains(RepositoryEntry.class.getSimpleName())) {
        // blog-post from blog-LR, only get name itself
        if (feed != null) {
            artSource = feed.getTitle();
        }
    } else {
        // collecting a post from live-blog, [Identity:xy]
        if (feed != null) {
            artSource = feed.getTitle();
        }
    }
    artefact.setSource(artSource);
}
Also used : Item(org.olat.modules.webFeed.Item) OLATResourceable(org.olat.core.id.OLATResourceable) BusinessControl(org.olat.core.id.context.BusinessControl) CourseNode(org.olat.course.nodes.CourseNode) RepositoryEntry(org.olat.repository.RepositoryEntry) Feed(org.olat.modules.webFeed.Feed)

Example 67 with BusinessControl

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

the class OpenMeetingsAdminRoomsController method openResource.

protected void openResource(UserRequest ureq, OpenMeetingsRoom room) {
    OpenMeetingsRoomReference prop = room.getReference();
    if (prop != null) {
        String url;
        if (prop.getGroup() != null) {
            url = "[BusinessGroup:" + prop.getGroup().getKey() + "]";
        } else {
            OLATResourceable ores = OresHelper.createOLATResourceableInstance(prop.getResourceTypeName(), prop.getResourceTypeId());
            RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(ores, false);
            if (re != null) {
                url = "[RepositoryEntry:" + re.getKey() + "]";
                if (StringHelper.containsNonWhitespace(prop.getSubIdentifier()) && "CourseModule".equals(ores.getResourceableTypeName())) {
                    url += "[CourseNode:" + prop.getSubIdentifier() + "]";
                }
            } else {
                showWarning("resource.dont.exist");
                return;
            }
        }
        BusinessControl bc = BusinessControlFactory.getInstance().createFromString(url);
        WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
        NewControllerFactory.getInstance().launch(ureq, bwControl);
    }
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) OpenMeetingsRoomReference(org.olat.modules.openmeetings.model.OpenMeetingsRoomReference) BusinessControl(org.olat.core.id.context.BusinessControl) RepositoryEntry(org.olat.repository.RepositoryEntry) WindowControl(org.olat.core.gui.control.WindowControl)

Example 68 with BusinessControl

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

the class MembersTableController method doOpenHomePage.

private void doOpenHomePage(MemberView member, UserRequest ureq) {
    String url = "[HomePage:" + member.getIdentityKey() + "]";
    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)

Example 69 with BusinessControl

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

the class InfoMessagePortletRunController method event.

@Override
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == showAllLink) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        cal.add(Calendar.MONTH, -1);
        // fxdiff activate homes tab in top navigation and activate the correct
        // menu item
        String resourceUrl = "[HomeSite:" + ureq.getIdentity().getKey() + "][notifications:0][type=" + InfoMessage.class.getSimpleName() + ":0]" + BusinessControlFactory.getInstance().getContextEntryStringForDate(cal.getTime());
        BusinessControl bc = BusinessControlFactory.getInstance().createFromString(resourceUrl);
        WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
        NewControllerFactory.getInstance().launch(ureq, bwControl);
    }
}
Also used : InfoMessage(org.olat.commons.info.InfoMessage) Calendar(java.util.Calendar) BusinessControl(org.olat.core.id.context.BusinessControl) WindowControl(org.olat.core.gui.control.WindowControl) Date(java.util.Date)

Example 70 with BusinessControl

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

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)

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