Examples of OlatRootFolderImpl


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

      if (command.equals(ACTION_SHOW_FILE)) {
        doFileDelivery(ureq, selectedElement.getForumKey());
      }
    } else if (source == uploadButton){
      Forum forum = forumMgr.addAForum();
      OlatRootFolderImpl forumContainer = getForumContainer(forum.getKey());
      fileUplCtr = new FileUploadController(getWindowControl(),forumContainer, ureq, (int)FolderConfig.getLimitULKB(), Quota.UNLIMITED, null, false);
      fileUplCtr.addControllerListener(this);
      recentDialogElement = new DialogElement();
      recentDialogElement.setForumKey(forum.getKey());
      recentDialogElement.setAuthor(ureq.getIdentity().getName());
View Full Code Here

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

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

    baseFile.mkdirs();
    return forumContainer;
  }
 
  public static String getFileSize(Long forumKey){
    OlatRootFolderImpl forumContainer = getForumContainer(forumKey);
    VFSLeaf vl = (VFSLeaf) forumContainer.getItems().get(0);
    return StringHelper.formatMemory(vl.getSize());
  }
View Full Code Here

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

   *
   * @param res
   * @return
   */
  public OlatRootFolderImpl getGlossaryRootFolder(OLATResourceable res) {
    OlatRootFolderImpl resRoot = FileResourceManager.getInstance().getFileResourceRootImpl(res);
    if (resRoot == null) return null;
    VFSItem glossaryRoot = resRoot.resolve(INTERNAL_FOLDER_NAME);
    if (glossaryRoot == null) {
      // Glossary has been imported but not yet renamed to the internal folder.
      // This is ugly but no other way to do since the add resource callback
      // somehow does not provide this hook?
      VFSItem unzipped = resRoot.resolve(FileResourceManager.ZIPDIR);
      if (unzipped == null) {
        // Should not happen, but since we have no unzipped folder we better
        // continue with an empty glossary than crashing
        resRoot.createChildContainer(INTERNAL_FOLDER_NAME);
      } else {
        // We do not use the unzipped folder anymore, this was only for import.
        // We rename it to the internal glossary folder and use it from now on
        unzipped.rename(INTERNAL_FOLDER_NAME);
      }
      glossaryRoot = resRoot.resolve(INTERNAL_FOLDER_NAME);
    }
    return (OlatRootFolderImpl) glossaryRoot;
  }
View Full Code Here

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

    sb.append("/forum/");
    sb.append(fKey);
    sb.append("/");
    sb.append(mKey);
    String pathToMsgDir = sb.toString();
    OlatRootFolderImpl messageContainer = new OlatRootFolderImpl(pathToMsgDir, null);
    File baseFile = messageContainer.getBasefile();
    baseFile.mkdirs();
    return messageContainer;
  }
View Full Code Here

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

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

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

    // add local course folder's children as read/write source and any sharedfolder as subfolder
    MergeSource courseFolderContainer = new MergeSource(null, getCourseTitle());
    courseFolderContainer.addContainersChildren(getIsolatedCourseFolder(), true);
   
    // grab any shared folder that is configured
    OlatRootFolderImpl sharedFolder = null;
    String sfSoftkey = getCourseConfig().getSharedFolderSoftkey();
    if (sfSoftkey != null) {
      RepositoryManager rm = RepositoryManager.getInstance();
      RepositoryEntry re = rm.lookupRepositoryEntryBySoftkey(sfSoftkey, false);
      if (re != null) {
        sharedFolder = SharedFolderManager.getInstance().getSharedFolder(re.getOlatResource());
        if (sharedFolder != null){
          sharedFolder.setLocalSecurityCallback(new ReadOnlyCallback());
          //add local course folder's children as read/write source and any sharedfolder as subfolder
          courseFolderContainer.addContainer(new NamedContainerImpl("_sharedfolder", sharedFolder));
        }
      }
    }
View Full Code Here

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

      CourseNode child = (CourseNode) courseNode.getChildAt(i);
      if (child instanceof BCCourseNode) {
        BCCourseNode bcNode = (BCCourseNode) child;
        // add folder not to merge source. Use name and node id to have unique name
        String path = BCCourseNode.getFoldernodePathRelToFolderBase(getCourseEnvironment(), bcNode);
        OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(path, null);
        String folderName = bcNode.getShortTitle() + " (" + bcNode.getIdent() + ")";
        OlatNamedContainerImpl BCFolder = new OlatNamedContainerImpl(folderName, rootFolder);
        BCNodesContainer.addContainer(BCFolder);       
      }
      // recursion for all childrenØ
View Full Code Here

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

   * Prepares the filesystem for this course.
   */
  private void prepareFilesystem() {
    // generate course base path
    String relPath = File.separator + COURSE_ROOT_DIR_NAME + File.separator + getResourceableId().longValue();
    courseRootContainer = new OlatRootFolderImpl(relPath, null);
    File fBasePath = courseRootContainer.getBasefile();
    if (!fBasePath.exists() && !fBasePath.mkdirs())
      throw new OLATRuntimeException(this.getClass(), "Could not create course base path:" + courseRootContainer, null);
  }
View Full Code Here

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

      throw new OLATRuntimeException(this.getClass(), "Could not create course base path:" + courseRootContainer, null);
  }

  protected OlatRootFolderImpl getIsolatedCourseFolder() {
    // create local course folder
    OlatRootFolderImpl isolatedCourseFolder = new OlatRootFolderImpl(courseRootContainer.getRelPath() + File.separator + COURSEFOLDER, null);
    // generate course folder
    File fCourseFolder = isolatedCourseFolder.getBasefile();
    if (!fCourseFolder.exists() && !fCourseFolder.mkdirs()) throw new OLATRuntimeException(this.getClass(),
        "could not create course's coursefolder path:" + fCourseFolder.getAbsolutePath(), null);
   
    QuotaManager qm = QuotaManager.getInstance();
    Quota q = qm.getCustomQuota(isolatedCourseFolder.getRelPath());
    if (q == null){
      Quota defQuota = qm.getDefaultQuota(QuotaConstants.IDENTIFIER_DEFAULT_COURSE);
      q = QuotaManager.getInstance().createQuota(isolatedCourseFolder.getRelPath(), defQuota.getQuotaKB(), defQuota.getUlLimitKB());
    }
    FullAccessWithQuotaCallback secCallback = new FullAccessWithQuotaCallback(q);
    isolatedCourseFolder.setLocalSecurityCallback(secCallback);
    return isolatedCourseFolder;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.