Package org.olat.core.util.vfs

Examples of org.olat.core.util.vfs.LocalFolderImpl


        relFilePath = relFilePath.substring(0, lastSlash + 1);
      } else {
        String containerPath = documentBaseContainer.getName();
        // try to get more information if it's a local folder impl
        if (documentBaseContainer instanceof LocalFolderImpl) {
          LocalFolderImpl folder = (LocalFolderImpl) documentBaseContainer;
          containerPath = folder.getBasefile().getAbsolutePath();
        }
        log.warn("Could not parse relative file path::" + relFilePath + " in container::" + containerPath);
      }
    } else {
      relFilePath = "";
View Full Code Here


    // closes / reopens the cp from the same CPRuncontroller instance)
    boolean activateFirstPage = true;
    if ( (nodecmd != null) && !nodecmd.equals("") ) {
       activateFirstPage = false;
    }
    cpDispC = CPUIFactory.getInstance().createContentOnlyCPDisplayController(ureq, getWindowControl(), new LocalFolderImpl(cpRoot), activateFirstPage, nodecmd, ores);
    cpDispC.addControllerListener(this);

    main.setContent(cpDispC.getInitialComponent());
    if (isExternalMenuConfigured()) {
      treeModel = cpDispC.getTreeModel();
View Full Code Here

        + TACourseNode.getTaskFolderPathRelToFolderRoot(userCourseEnv.getCourseEnvironment(), node));
      if (assignedTask.toLowerCase().endsWith(".html") || assignedTask.toLowerCase().endsWith(".htm") || assignedTask.toLowerCase().endsWith(".txt")) {

        if (getWindowControl().getWindowBackOffice().getWindowManager().isForScreenReader()) {
          // render content for screenreaders always inline
          HtmlStaticPageComponent cpc = new HtmlStaticPageComponent("cpc", new LocalFolderImpl(fTaskfolder));
          cpc.setCurrentURI(assignedTask);
          if (cmc != null) cmc.dispose();
          cmc = new CloseableModalController(getWindowControl(), translator.translate("close"), cpc);
          cmc.activate();
        } else {
View Full Code Here

  private VFSContainer makeTempVFSContainer() {   
    Long forumKey = (Long) metaInfo.get(ForumFormatter.MANDATORY_METAINFO_KEY);
    String dateStamp = String.valueOf(System.currentTimeMillis());
    //TODO: (LD) could this filename regarded as unique or use System.nanoTime() instead?
    String fileName = "forum" + forumKey.toString() + "_" + dateStamp;
    LocalFolderImpl tempFolder =  new OlatRootFolderImpl("/tmp/" + fileName, null);
    return tempFolder;
  }
View Full Code Here

    mimeTypes.add("image/gif");
    mimeTypes.add("image/jpg");
    mimeTypes.add("image/jpeg");
    mimeTypes.add("image/png");
    File uploadDir = new File(FolderConfig.getCanonicalRoot() + FolderConfig.getRepositoryHome());
    VFSContainer uploadContainer = new LocalFolderImpl(uploadDir);
    uploadCtr = new FileUploadController(getWindowControl(), uploadContainer, ureq, limitKB, Quota.UNLIMITED, mimeTypes, false);
    uploadCtr.hideTitleAndFieldset();
    listenTo(uploadCtr);
    vContainer.put("uploadCtr", uploadCtr.getInitialComponent());
    // init the delete button
View Full Code Here

    courseNodeResourceContext.setTitle(courseNode.getShortTitle());
    courseNodeResourceContext.setDescription(courseNode.getLongTitle());
   
    // Index Task
    File fTaskfolder = new File(FolderConfig.getCanonicalRoot() + TACourseNode.getTaskFolderPathRelToFolderRoot(course.getCourseEnvironment(), courseNode));
    VFSContainer taskRootContainer = new LocalFolderImpl(fTaskfolder);
    courseNodeResourceContext.setDocumentType(TYPE_TASK);
    doIndexVFSContainer(courseNodeResourceContext, taskRootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
   
    // Index Dropbox
    String dropboxFilePath = FolderConfig.getCanonicalRoot() + DropboxController.getDropboxPathRelToFolderRoot(course.getCourseEnvironment(), courseNode);
    File fDropboxFolder = new File(dropboxFilePath);
    VFSContainer dropboxRootContainer = new LocalFolderImpl(fDropboxFolder);
    courseNodeResourceContext.setDocumentType(TYPE_DROPBOX);
    doIndexVFSContainer(courseNodeResourceContext, dropboxRootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
   
    // Index Returnbox
    String returnboxFilePath = FolderConfig.getCanonicalRoot() + ReturnboxController.getReturnboxPathRelToFolderRoot(course.getCourseEnvironment(), courseNode);
    File fResturnboxFolder = new File(returnboxFilePath);
    VFSContainer returnboxRootContainer = new LocalFolderImpl(fResturnboxFolder);
    courseNodeResourceContext.setDocumentType(TYPE_RETURNBOX);
    doIndexVFSContainer(courseNodeResourceContext, returnboxRootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
   
    // Index Solutionbox
    String solutionFilePath = FolderConfig.getCanonicalRoot() + SolutionController.getSolutionPathRelToFolderRoot(course.getCourseEnvironment(), courseNode);
    File fSolutionFolder = new File(solutionFilePath);
    VFSContainer solutionRootContainer = new LocalFolderImpl(fSolutionFolder);
    courseNodeResourceContext.setDocumentType(TYPE_SOLUTIONBOX);
    doIndexVFSContainer(courseNodeResourceContext, solutionRootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
   
    // go further, index my child nodes
    courseNodeIndexer.doIndexCourse(repositoryResourceContext, course, courseNode, indexWriter);
View Full Code Here

   */
  public void doArchiveElement(DialogElement element, File exportDirectory) {
    VFSContainer forumContainer = getForumContainer(element.getForumKey());
    //there is only one file (leave) in the top forum container
    VFSItem dialogFile = (VFSLeaf)forumContainer.getItems(new VFSLeafFilter()).get(0);
    VFSContainer exportContainer = new LocalFolderImpl(exportDirectory);
   
    // append export timestamp to avoid overwriting previous export
    java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH_mm_ss_SSS");
    String exportDirName = getShortTitle()+"_"+element.getForumKey()+"_"+formatter.format(new Date(System.currentTimeMillis()));
    VFSContainer diaNodeElemExportContainer = exportContainer.createChildContainer(exportDirName);
    // don't check quota
    diaNodeElemExportContainer.setLocalSecurityCallback(new FullAccessCallback());
    diaNodeElemExportContainer.copyFrom(dialogFile);

    ForumArchiveManager fam = ForumArchiveManager.getInstance();
View Full Code Here

  /**
   * @see org.olat.repository.handlers.RepositoryHandler#getLaunchController(org.olat.core.id.OLATResourceable java.lang.String, org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)
   */
  public MainLayoutController getLaunchController(OLATResourceable res, String initialViewIdentifier, UserRequest ureq, WindowControl wControl) {
    File cpRoot = FileResourceManager.getInstance().unzipFileResource(res);
    LocalFolderImpl vfsWrapper = new LocalFolderImpl(cpRoot);
    Controller realController = null;
   
    // jump to either the forum or the folder if the business-launch-path says so.
    BusinessControl bc = wControl.getBusinessControl();
    ContextEntry ce = bc.popLauncherContextEntry();
View Full Code Here

   *      org.olat.core.gui.control.WindowControl)
   */
  public Controller getEditorController(OLATResourceable res, UserRequest ureq, WindowControl wControl) {
    // only unzips, if not already unzipped
    File cpRoot = FileResourceManager.getInstance().unzipFileResource(res);
    LocalFolderImpl vfsWrapper = new LocalFolderImpl(cpRoot);
    return new CPEditMainController(ureq, wControl, vfsWrapper, res);

  }
View Full Code Here

   */
  public void updateModuleConfigFromQTIFile(OLATResource res) {
    FileResourceManager frm = FileResourceManager.getInstance();
    File unzippedRoot = frm.unzipFileResource(res);
    //with VFS FIXME:pb:c: remove casts to LocalFileImpl and LocalFolderImpl if no longer needed.
    VFSContainer vfsUnzippedRoot = new LocalFolderImpl(unzippedRoot);
    VFSItem vfsQTI = vfsUnzippedRoot.resolve("qti.xml");
    if (vfsQTI==null){
      throw new AssertException("qti file did not exist even it should be guaranteed by repositor check-in "
          + ((LocalFileImpl)vfsQTI).getBasefile().getAbsolutePath());
    }
    //ensures that InputStream is closed in every case.
View Full Code Here

TOP

Related Classes of org.olat.core.util.vfs.LocalFolderImpl

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.