Search in sources :

Example 16 with MediaResource

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

the class AssessmentTestComposerController method doExportDocx.

private void doExportDocx(UserRequest ureq) {
    exportLatch = new CountDownLatch(1);
    MediaResource mr = new QTI21WordExport(resolvedAssessmentTest, unzippedContRoot, unzippedDirRoot, getLocale(), "UTF-8", exportLatch);
    ureq.getDispatchResult().setResultingMediaResource(mr);
}
Also used : MediaResource(org.olat.core.gui.media.MediaResource) CountDownLatch(java.util.concurrent.CountDownLatch) QTI21WordExport(org.olat.ims.qti21.manager.openxml.QTI21WordExport)

Example 17 with MediaResource

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

the class PaypalAccessController method redirectToPaypal.

private void redirectToPaypal(UserRequest ureq, PayResponse response) {
    String nextUrl = paypalManager.getPayRedirectUrl(response);
    MediaResource redirect = new RedirectMediaResource(nextUrl);
    ureq.getDispatchResult().setResultingMediaResource(redirect);
}
Also used : RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) MediaResource(org.olat.core.gui.media.MediaResource) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource)

Example 18 with MediaResource

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

the class PaypalMapper method handle.

@Override
public MediaResource handle(String relPath, HttpServletRequest request) {
    List<ContextEntry> entries = null;
    UserSession usess = CoreSpringFactory.getImpl(UserSessionManager.class).getUserSession(request);
    try {
        entries = BusinessControlFactory.getInstance().createCEListFromString(businessPath);
        if (relPath.indexOf(';') > 0) {
            relPath = relPath.substring(0, relPath.indexOf(';'));
        }
        if (relPath.indexOf('?') > 0) {
            relPath = relPath.substring(0, relPath.indexOf('?'));
        }
        String uuid = relPath.substring(1, relPath.length() - 5);
        paypalManager.updateTransaction(uuid);
        usess.putEntryInNonClearedStore("paypal-uuid", uuid);
    } catch (Exception e) {
        log.error("", e);
        usess.putEntryInNonClearedStore("paypal-mapper-error", Boolean.TRUE);
    }
    String resourceUrl = BusinessControlFactory.getInstance().getBusinessPathAsURIFromCEList(entries);
    MediaResource redirect = new RedirectMediaResource(Settings.getServerContextPathURI() + "/auth/" + resourceUrl);
    return redirect;
}
Also used : UserSessionManager(org.olat.core.util.session.UserSessionManager) UserSession(org.olat.core.util.UserSession) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) MediaResource(org.olat.core.gui.media.MediaResource) RedirectMediaResource(org.olat.core.gui.media.RedirectMediaResource) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 19 with MediaResource

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

the class IQIdentityListCourseNodeController method doExportResults.

private void doExportResults(UserRequest ureq) {
    List<Identity> identities = getIdentities();
    if (identities != null && !identities.isEmpty()) {
        MediaResource resource;
        CourseEnvironment courseEnv = getCourseEnvironment();
        if (isTestQTI21()) {
            resource = new QTI21ResultsExportMediaResource(courseEnv, identities, (IQTESTCourseNode) courseNode, getLocale());
        } else {
            resource = new QTI12ResultsExportMediaResource(courseEnv, getLocale(), identities, (IQTESTCourseNode) courseNode);
        }
        ureq.getDispatchResult().setResultingMediaResource(resource);
    } else {
        showWarning("error.no.assessed.users");
    }
}
Also used : IQTESTCourseNode(org.olat.course.nodes.IQTESTCourseNode) UserCourseEnvironment(org.olat.course.run.userview.UserCourseEnvironment) CourseEnvironment(org.olat.course.run.environment.CourseEnvironment) QTI12ResultsExportMediaResource(org.olat.ims.qti.resultexport.QTI12ResultsExportMediaResource) MediaResource(org.olat.core.gui.media.MediaResource) QTI21ResultsExportMediaResource(org.olat.ims.qti21.resultexport.QTI21ResultsExportMediaResource) Identity(org.olat.core.id.Identity) QTI21ResultsExportMediaResource(org.olat.ims.qti21.resultexport.QTI21ResultsExportMediaResource) QTI12ResultsExportMediaResource(org.olat.ims.qti.resultexport.QTI12ResultsExportMediaResource)

Example 20 with MediaResource

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

the class PFCoachController method downloadFromSelection.

private void downloadFromSelection(UserRequest ureq) {
    List<Long> identitykeys = new ArrayList<>();
    for (Integer i : dropboxTable.getMultiSelectedIndex()) {
        identitykeys.add(tableModel.getObject(i).getIdentity().getIdentityKey());
    }
    List<Identity> identities = securityManager.loadIdentityByKeys(identitykeys);
    MediaResource resource = new FileSystemExport(identities, pfNode, courseEnv, getLocale());
    ureq.getDispatchResult().setResultingMediaResource(resource);
}
Also used : ArrayList(java.util.ArrayList) MediaResource(org.olat.core.gui.media.MediaResource) Identity(org.olat.core.id.Identity) FileSystemExport(org.olat.course.nodes.pf.manager.FileSystemExport)

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