Package org.olat.core.gui.media

Examples of org.olat.core.gui.media.MediaResource


  @Override
  protected void event(UserRequest ureq, Component source, Event event) {
    if (source == showFileButton){
      File exportFile = new File(exportDir, targetFileName);
      MediaResource resource = new MimedFileMediaResource(exportFile, "application/vnd.ms-excel; charset="+charset, true);
      ureq.getDispatchResult().setResultingMediaResource(resource);
      showFileButton.setDirty(false);
    }
  }
View Full Code Here


   *
   */
  public boolean exportDoExportContent() {
    // export resource
    RepositoryHandler rh = RepositoryHandlerFactory.getInstance().getRepositoryHandler(re);
    MediaResource mr = rh.getAsMediaResource(re.getOlatResource());
    FileOutputStream fOut = null;
    try {
      fOut = new FileOutputStream(new File(baseDirectory, CONTENT_FILE));
      FileUtils.copy(mr.getInputStream(), fOut);
    } catch (FileNotFoundException fnfe) {
      return false;
    } finally {
      FileUtils.closeSafely(fOut);
      mr.release();
    }
    return true;
  }
View Full Code Here

     
      // successfull login
      UserDeletionManager.getInstance().setIdentityAsActiv(ureq.getIdentity());
      ureq.getUserSession().getIdentityEnvironment().addAttributes(
          ShibbolethModule.getAttributeTranslator().translateAttributesMap(attributesMap));
      MediaResource mr = ureq.getDispatchResult().getResultingMediaResource();
      if (!(mr instanceof RedirectMediaResource)) {
        DispatcherAction.redirectToDefaultDispatcher(resp); // error, redirect to login screen
        return;
      }
     
View Full Code Here

          }
          dts.activate(ureq, dt, null); // null: start with main entry point of controller
        } else if (repoEntry.getCanDownload()) {
          // else not launchable in olat, but downloadable -> send the document
          // directly to browser but "downloadable" (pdf, word, excel)
          MediaResource mr = handler.getAsMediaResource(ores);
          RepositoryManager.getInstance().incrementDownloadCounter(repoEntry);
          ureq.getDispatchResult().setResultingMediaResource(mr);
          return;
        } else { // neither launchable nor downloadable -> show details         
          //REVIEW:pb:replace EntryChangedEvent with a more specific event
View Full Code Here

TOP

Related Classes of org.olat.core.gui.media.MediaResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.