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

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


//    map.put("username", Formatter.truncate(creator.getName(),18));
   
    map.put("modified", f.formatDateAndTime(m.getLastModified()));
    // message attachments
    OlatRootFolderImpl msgContainer = fm.getMessageContainer(forum.getKey(), m.getKey());
    map.put("messageContainer", msgContainer);
    List<VFSItem> attachments = new ArrayList<VFSItem>(msgContainer.getItems(new VFSItemExcludePrefixFilter(MessageEditController.ATTACHMENT_EXCLUDE_PREFIXES)));
//    List attachments = msgContainer.getItems();
    map.put("attachments", attachments);
    if (attachments == null || attachments.size() == 0) map.put("hasAttachments", Boolean.FALSE);
    else map.put("hasAttachments", Boolean.TRUE);
    // number of children and modify/delete permissions
View Full Code Here


    }
    return counter;
  }

  private VFSContainer getArchiveContainer(UserRequest ureq) {
    VFSContainer container = new OlatRootFolderImpl(FolderConfig.getUserHomes() + File.separator + ureq.getIdentity().getName() + "/private/archive", null);
    // append export timestamp to avoid overwriting previous export
    Date tmp = new Date(System.currentTimeMillis());
    java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH_mm_ss");
    String folder = "forum_" + forum.getKey().toString()+"_"+formatter.format(tmp);
    VFSItem vfsItem = container.resolve(folder);
    if (vfsItem == null || !(vfsItem instanceof VFSContainer)) {
      vfsItem = container.createChildContainer(folder);
    }
    container = (VFSContainer) vfsItem;
    return container;
  }
View Full Code Here

  public void doIndex(SearchResourceContext parentResourceContext, Object parentObject, OlatFullIndexer indexWriter) {

    try {
      // get public folder for user
      Identity identity = (Identity) parentObject;
      OlatRootFolderImpl rootContainer = new OlatRootFolderImpl(FolderConfig.getUserHome(identity.getName()) + "/public", null);
      if (!rootContainer.getBasefile().exists()) return;
      // build new resource context
      SearchResourceContext searchResourceContext = new SearchResourceContext(parentResourceContext);
      searchResourceContext.setParentContextName(identity.getName());
      searchResourceContext.setBusinessControlFor(BUSINESS_CONTROL_TYPE);
      searchResourceContext.setDocumentType(TYPE);
View Full Code Here

  /**
   *
   *
   */
  public void archiveWikiToCP() {
    LocalFolderImpl tempFolder =  new OlatRootFolderImpl("/tmp/"+ident.getKey()+"-"+ores.getResourceableId(), null);
    if (tempFolder.resolve("imsmanifest.xml") != null) {
      tempFolder.delete(); //delete all content if already exists...
      tempFolder =  new OlatRootFolderImpl("/tmp/"+ident.getKey()+"-"+ores.getResourceableId(), null);
    }
    Wiki wiki = WikiManager.getInstance().getOrLoadWiki(ores);
    String dateStamp = Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
    LocalFolderImpl exportDir =  new OlatRootFolderImpl(FolderConfig.getUserHomes() +"/"+ ident.getName() +"/private/archive/wiki-export-"+dateStamp+".zip", null);
   
    //create the ims manifest
    StringBuilder sb = createIMSManifest(wiki, ident);
    VFSLeaf manifest = tempFolder.createChildLeaf("imsmanifest.xml");
    copyMediaFiles(WikiManager.getInstance().getMediaFolder(ores), tempFolder);
    FileUtils.save(manifest.getOutputStream(false), sb.toString(), "utf-8");
   
    //create the javascript mapping file
    StringBuilder jsContent = createJsMappingContent(wiki);
    VFSLeaf jsFile = tempFolder.createChildLeaf("mapping.js");
    FileUtils.save(jsFile.getOutputStream(false), jsContent.toString(), "utf-8");
   
    renderWikiToHtmlFiles(ores, tempFolder);
    CPOfflineReadableManager.getInstance().makeCPOfflineReadable(tempFolder.getBasefile(), exportDir.getBasefile(), null);
    tempFolder.delete();
  }
View Full Code Here

  public void doIndex(SearchResourceContext parentResourceContext, Object businessObj, OlatFullIndexer indexWriter) throws IOException,InterruptedException {
    if (!(businessObj instanceof BusinessGroup) )
      throw new AssertException("businessObj must be BusinessGroup");
    BusinessGroup businessGroup = (BusinessGroup)businessObj;
   
    OlatRootFolderImpl rootContainer = new OlatRootFolderImpl(getFolderRelPath(businessGroup), null);
    SearchResourceContext forumSearchResourceContext = new SearchResourceContext(parentResourceContext);
    forumSearchResourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLFOLDER);
    forumSearchResourceContext.setDocumentType(TYPE);
    forumSearchResourceContext.setParentContextType(GroupDocument.TYPE);
    forumSearchResourceContext.setParentContextName(businessGroup.getName());
View Full Code Here

//    map.put("username", Formatter.truncate(creator.getName(),18));
   
    map.put("modified", dateFormat.format(m.getLastModified()));
    // message attachments
    ForumManager fm = ForumManager.getInstance();
    OlatRootFolderImpl msgContainer = fm.getMessageContainer(forum.getKey(), m.getKey());
    map.put("messageContainer", msgContainer);
    List<VFSItem> attachments = new ArrayList<VFSItem>(msgContainer.getItems(new VFSItemExcludePrefixFilter(MessageEditController.ATTACHMENT_EXCLUDE_PREFIXES)));
//    List attachments = msgContainer.getItems();
    map.put("attachments", attachments);
    if (attachments == null || attachments.size() == 0) map.put("hasAttachments", Boolean.FALSE);
    else map.put("hasAttachments", Boolean.TRUE);
    // number of children and modify/delete permissions
View Full Code Here

  /**
   *
   * @return e.g. olatdata\bcroot\course\
   */
  private File getCourseBaseContainer() {
    OlatRootFolderImpl courseRootContainer = new OlatRootFolderImpl(File.separator + PersistingCourseImpl.COURSE_ROOT_DIR_NAME + File.separator, null);
    return courseRootContainer.getBasefile();
    }
View Full Code Here

   
    translator = new PackageTranslator(PACKAGE, ureq.getLocale());
    myContent = new VelocityContainer("taskVC", VELOCITY_ROOT + "/solutionRun.html", translator, this);
   
    // returnbox display
    OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(
      SolutionController.getSolutionPathRelToFolderRoot(userCourseEnv.getCourseEnvironment(), node), null);
    OlatNamedContainerImpl namedContainer = new OlatNamedContainerImpl("solutions", rootFolder);
    namedContainer.setLocalSecurityCallback(new ReadOnlyCallback());
    solutionFolderRunController = new FolderRunController(namedContainer, false, ureq, wControl);
    solutionFolderRunController.addControllerListener(this);
View Full Code Here

  public Controller createPeekViewRunController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv,
      NodeEvaluation ne) {
    if (ne.isAtLeastOneAccessible()) {
      // Create a folder peekview controller that shows the latest two entries   
      String path = getFoldernodePathRelToFolderBase(userCourseEnv.getCourseEnvironment(), ne.getCourseNode());
      OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(path, null);
      Controller peekViewController = new BCPeekviewController(ureq, wControl, rootFolder, ne.getCourseNode().getIdent(), 4);
      return peekViewController;     
    } else {
      // use standard peekview
      return super.createPeekViewRunController(ureq, wControl, userCourseEnv, ne);
View Full Code Here

   * @param courseEnv
   * @return
   */
  public static OlatNamedContainerImpl getNodeFolderContainer(BCCourseNode node, CourseEnvironment courseEnv) {
    String path = getFoldernodePathRelToFolderBase(courseEnv, node);
    OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(path, null);
    OlatNamedContainerImpl namedFolder = new OlatNamedContainerImpl(node.getShortTitle(), rootFolder);
    return namedFolder;
  }
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.