Search in sources :

Example 71 with MediaResource

use of org.olat.core.gui.media.MediaResource in project OpenOLAT by OpenOLAT.

the class OAuthAuthenticationController method redirect.

private void redirect(UserRequest ureq, OAuthSPI provider) {
    HttpSession session = ureq.getHttpReq().getSession();
    MediaResource redirectResource = new OAuthResource(provider, session);
    ureq.getDispatchResult().setResultingMediaResource(redirectResource);
}
Also used : HttpSession(javax.servlet.http.HttpSession) MediaResource(org.olat.core.gui.media.MediaResource) OAuthResource(org.olat.login.oauth.OAuthResource)

Example 72 with MediaResource

use of org.olat.core.gui.media.MediaResource in project OpenOLAT by OpenOLAT.

the class TableOfContentController method doExportBinderAsPdf.

private void doExportBinderAsPdf(UserRequest ureq) {
    MediaResource resource = new ExportBinderAsPDFResource(binder, ureq, getLocale());
    ureq.getDispatchResult().setResultingMediaResource(resource);
}
Also used : ExportBinderAsPDFResource(org.olat.modules.portfolio.ui.export.ExportBinderAsPDFResource) MediaResource(org.olat.core.gui.media.MediaResource)

Example 73 with MediaResource

use of org.olat.core.gui.media.MediaResource in project OpenOLAT by OpenOLAT.

the class MembersExportManager method getXlsMediaResource.

public MediaResource getXlsMediaResource(boolean showOwners, boolean showCoaches, boolean showParticipants, boolean showWaiting, List<Identity> owners, List<Identity> coaches, List<Identity> participants, List<Identity> waiting, Translator translator, List<UserPropertyHandler> userPropertyHandlers, RepositoryEntry repoEntry, BusinessGroup businessGroup) {
    // TODO
    Map<Long, BusinessGroupMembership> groupmemberships;
    Map<Long, RepositoryEntryMembership> repomemberships;
    if (repoEntry == null) {
        List<BusinessGroup> groups = new ArrayList<>();
        groups.add(businessGroup);
        groupmemberships = getGroupMembershipMap(groups);
        repomemberships = new HashMap<>();
    } else {
        repomemberships = getRepoMembershipMap(repoEntry);
        List<BusinessGroup> groups = businessGroupService.findBusinessGroups(null, repoEntry, 0, -1);
        groupmemberships = getGroupMembershipMap(groups);
    }
    List<List<Identity>> roleMembers = new ArrayList<>();
    if (showOwners) {
        roleMembers.add(owners);
    }
    if (showCoaches) {
        roleMembers.add(coaches);
    }
    if (showParticipants) {
        roleMembers.add(participants);
    }
    if (showWaiting) {
        roleMembers.add(waiting);
    }
    Translator repoTranslator = Util.createPackageTranslator(Member.class, translator.getLocale());
    Translator groupTranslator = Util.createPackageTranslator(GroupMembersRunController.class, translator.getLocale());
    Map<Identity, StringBuilder> membersMap = new HashMap<>();
    List<Identity> rows = new ArrayList<>();
    for (List<Identity> membersList : roleMembers) {
        for (Identity member : membersList) {
            Long memberKey = member.getKey();
            if (repomemberships != null && !repomemberships.isEmpty() && repomemberships.containsKey(memberKey)) {
                RepositoryEntryMembership repomembership = repomemberships.get(memberKey);
                if (repomembership.isOwner()) {
                    putRoleToMember(rows, membersMap, member, "owners", repoTranslator);
                }
                if (repomembership.isCoach()) {
                    putRoleToMember(rows, membersMap, member, "coaches", repoTranslator);
                }
                if (repomembership.isParticipant()) {
                    putRoleToMember(rows, membersMap, member, "participants", repoTranslator);
                }
            }
            if (groupmemberships != null && !groupmemberships.isEmpty() && groupmemberships.containsKey(memberKey)) {
                BusinessGroupMembership groupmembership = groupmemberships.get(memberKey);
                if (groupmembership.isOwner()) {
                    putRoleToMember(rows, membersMap, member, "coaches", groupTranslator);
                }
                if (groupmembership.isParticipant()) {
                    putRoleToMember(rows, membersMap, member, "participants", groupTranslator);
                }
                if (groupmembership.isWaiting()) {
                    putRoleToMember(rows, membersMap, member, "waiting", groupTranslator);
                }
            }
        }
    }
    Translator handlerTranslator = userManager.getPropertyHandlerTranslator(translator);
    XlsMembersExport exporter = new XlsMembersExport();
    MediaResource resource = exporter.export(rows, membersMap, handlerTranslator, userPropertyHandlers);
    return resource;
}
Also used : BusinessGroupMembership(org.olat.group.BusinessGroupMembership) RepositoryEntryMembership(org.olat.repository.model.RepositoryEntryMembership) BusinessGroup(org.olat.group.BusinessGroup) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Translator(org.olat.core.gui.translator.Translator) ArrayList(java.util.ArrayList) List(java.util.List) MediaResource(org.olat.core.gui.media.MediaResource) Identity(org.olat.core.id.Identity)

Example 74 with MediaResource

use of org.olat.core.gui.media.MediaResource in project OpenOLAT by OpenOLAT.

the class MembersAvatarDisplayRunController method doExport.

private void doExport(UserRequest ureq) {
    MediaResource resource = exportManager.getXlsMediaResource(showOwners, showCoaches, showParticipants, showWaiting, owners, coaches, participants, waiting, getTranslator(), userPropertyHandlers, repoEntry, businessGroup);
    ureq.getDispatchResult().setResultingMediaResource(resource);
}
Also used : MediaResource(org.olat.core.gui.media.MediaResource)

Example 75 with MediaResource

use of org.olat.core.gui.media.MediaResource in project OpenOLAT by OpenOLAT.

the class MembersListDisplayRunController method doExport.

private void doExport(UserRequest ureq) {
    MediaResource resource = exportManager.getXlsMediaResource(showOwners, showCoaches, showParticipants, showWaiting, owners, coaches, participants, waiting, getTranslator(), userPropertyHandlers, repoEntry, businessGroup);
    ureq.getDispatchResult().setResultingMediaResource(resource);
}
Also used : MediaResource(org.olat.core.gui.media.MediaResource)

Aggregations

MediaResource (org.olat.core.gui.media.MediaResource)141 VFSMediaResource (org.olat.core.util.vfs.VFSMediaResource)36 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)32 NotFoundMediaResource (org.olat.core.gui.media.NotFoundMediaResource)30 Identity (org.olat.core.id.Identity)18 VFSItem (org.olat.core.util.vfs.VFSItem)18 File (java.io.File)16 ArrayList (java.util.ArrayList)16 RedirectMediaResource (org.olat.core.gui.media.RedirectMediaResource)16 IOException (java.io.IOException)13 FileMediaResource (org.olat.core.gui.media.FileMediaResource)12 List (java.util.List)10 MetaInfo (org.olat.core.commons.modules.bc.meta.MetaInfo)10 MetaTagged (org.olat.core.commons.modules.bc.meta.tagged.MetaTagged)10 StringMediaResource (org.olat.core.gui.media.StringMediaResource)8 AssertException (org.olat.core.logging.AssertException)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 RepositoryHandler (org.olat.repository.handlers.RepositoryHandler)8 InputStream (java.io.InputStream)6 OLATResourceable (org.olat.core.id.OLATResourceable)6