Package org.olat.core.commons.modules.bc.vfs

Examples of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl


    StringBuilder sb = new StringBuilder();
    sb.append("/forum/");
    sb.append(forumKey);
    sb.append("/");
    String pathToForumDir = sb.toString();
    OlatRootFolderImpl forumContainer = new OlatRootFolderImpl(pathToForumDir, null);
    File baseFile = forumContainer.getBasefile();
    baseFile.mkdirs();
    return forumContainer;
  }
View Full Code Here


          if (serial == serialMax) continue; // continue without adding mount point
          name = name + serial;
        }
       
        // create container and set quota
        OlatRootFolderImpl localImpl = new OlatRootFolderImpl(tools.getFolderRelPath(), cfRoot);
        localImpl.getBasefile().mkdirs(); // lazy initialize dirs
        NamedContainerImpl grpContainer = new NamedContainerImpl(Formatter.makeStringFilesystemSave(name), localImpl);
        Quota q = qm.getCustomQuota(tools.getFolderRelPath());
        if (q == null) {
          Quota defQuota = qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_GROUPS);
          q = QuotaManager.getInstance().createQuota(tools.getFolderRelPath(), defQuota.getQuotaKB(), defQuota.getUlLimitKB());
View Full Code Here

  protected void initReturnbox(UserRequest ureq, WindowControl wControl, ModuleConfiguration config, CourseNode node, UserCourseEnvironment userCourseEnv, boolean previewMode) {
    translator = new PackageTranslator(PACKAGE, ureq.getLocale());
    myContent = new VelocityContainer("taskVC", VELOCITY_ROOT + "/returnbox.html", translator, this);
    // returnbox display
    OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(getReturnboxPathFor(userCourseEnv.getCourseEnvironment(), node, ureq.getIdentity()) , null);
    OlatNamedContainerImpl namedContainer = new OlatNamedContainerImpl(ureq.getIdentity().getName(), rootFolder);
    namedContainer.setLocalSecurityCallback(new ReadOnlyCallback());
    returnboxFolderRunController = new FolderRunController(namedContainer, false, ureq, wControl);
    returnboxFolderRunController.addControllerListener(this);
    myContent.put("returnbox", returnboxFolderRunController.getInitialComponent());
View Full Code Here

        // reinitalize form data
        initConfigForm();
      }
    } else if (source == uploadButton) {
      Forum forum = ForumManager.getInstance().addAForum();
      OlatRootFolderImpl forumContainer = DialogElementsController.getForumContainer(forum.getKey());
      fileUplCtr = new FileUploadController(getWindowControl(),forumContainer, ureq, (int)FolderConfig.getLimitULKB(), Quota.UNLIMITED, null, false);     
      this.listenTo(fileUplCtr);
      recentElement = new DialogElement();
      recentElement.setForumKey(forum.getKey());
      recentElement.setAuthor(ureq.getIdentity().getName());
View Full Code Here

    // and can not reuse the standard briefcase way of file delivering, some
    // very old fancy code
    // Mapper is cleaned up automatically by basic controller
    String baseUrl = registerMapper(new Mapper() {
      public MediaResource handle(String relPath, HttpServletRequest request) {
        OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(ProjectBrokerManagerFactory.getProjectBrokerManager().getAttamchmentRelativeRootPath(project,courseEnv,cNode),null);
        VFSLeaf vfsfile = (VFSLeaf) rootFolder.resolve(relPath);
        if (vfsfile == null) {
          return new NotFoundMediaResource(relPath);
        } else {
          return new VFSMediaResource(vfsfile);
        }
View Full Code Here

    log.audit("ProjectBroker: Deleted ProjectBroker=" + projectBroker);
  }

  public void saveAttachedFile(Project project, String fileName, VFSLeaf uploadedItem, CourseEnvironment courseEnv, CourseNode cNode) {
    log.debug("saveAttachedFile file-name=" + uploadedItem.getName());
    OlatRootFolderImpl uploadVFSContainer = new OlatRootFolderImpl(getAttamchmentRelativeRootPath(project,courseEnv,cNode), null);
    log.debug("saveAttachedFile uploadVFSContainer.relPath=" + uploadVFSContainer.getRelPath());
    // only one attachment, delete other file
    for (Iterator<VFSItem> iterator = uploadVFSContainer.getItems().iterator(); iterator.hasNext();) {
      VFSItem item =  iterator.next();
      // Project.getAttachmentFileName is the previous file-name, will not be deleted; student could have open detail-project page with previous attachemnt-link
      if (!item.getName().equals(project.getAttachmentFileName())) {
        item.delete();
      }
    }
    VFSLeaf newFile = (VFSLeaf)uploadVFSContainer.resolve(fileName);
    if (newFile == null) {
      newFile = uploadVFSContainer.createChildLeaf(fileName);
    }
    BufferedInputStream in = new BufferedInputStream(uploadedItem.getInputStream());
    BufferedOutputStream out = new BufferedOutputStream(newFile.getOutputStream(false));
    boolean success = false;
    if (in != null) {
View Full Code Here

  public String getAttachmentBasePathRelToFolderRoot(CourseEnvironment courseEnvironment, CourseNode courseNode) {
    return courseEnvironment.getCourseBaseContainer().getRelPath() + File.separator + ATTACHEMENT_DIR_NAME + File.separator + courseNode.getIdent();
  }

  private void deleteAllAttachmentFilesOfProject(Project project, CourseEnvironment courseEnv, CourseNode cNode) {
    VFSContainer attachmentDir = new OlatRootFolderImpl(getAttamchmentRelativeRootPath(project,courseEnv,cNode), null);
    attachmentDir.delete();
    log.debug("deleteAllAttachmentFilesOfProject path=" + attachmentDir);
  }
View Full Code Here

    attachmentDir.delete();
    log.debug("deleteAllAttachmentFilesOfProject path=" + attachmentDir);
  }
 
  private void deleteAllDropboxFilesOfProject(Project project, CourseEnvironment courseEnv, CourseNode cNode) {
    VFSContainer dropboxDir = new OlatRootFolderImpl(ProjectBrokerDropboxController.getDropboxBasePathForProject(project,courseEnv,cNode), null);
    dropboxDir.delete();
    log.debug("deleteAllDropboxFilesOfProject path=" + dropboxDir);
  }
View Full Code Here

    dropboxDir.delete();
    log.debug("deleteAllDropboxFilesOfProject path=" + dropboxDir);
  }
 
  private void deleteAllReturnboxFilesOfProject(Project project, CourseEnvironment courseEnv, CourseNode cNode) {
    VFSContainer returnboxDir = new OlatRootFolderImpl(ProjectBrokerReturnboxController.getReturnboxBasePathForProject(project,courseEnv,cNode), null);
    returnboxDir.delete();
    log.debug("deleteAllReturnboxFilesOfProject path=" + returnboxDir);
  }
View Full Code Here

      }
    } else if (source == dialogBoxController) {     
      if (DialogBoxUIFactory.isOkEvent(event)) {
        // ok: open task folder
        String relPath = TACourseNode.getTaskFolderPathRelToFolderRoot(CourseFactory.loadCourse(courseId), node);
        OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(relPath, null);
        OlatNamedContainerImpl namedFolder = new OlatNamedContainerImpl(translate("taskfolder"), rootFolder);
        namedFolder.setLocalSecurityCallback(new FolderCallback(relPath, false));
       
        removeAsListenerAndDispose(frc);
        frc = new FolderRunController(namedFolder, false, urequest, getWindowControl());
View Full Code Here

TOP

Related Classes of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl

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.