Package org.olat.ims.cp

Examples of org.olat.ims.cp.CPManager


    super(ureq, wControl);

    // acquire lock for resource
    lock = CoordinatorManager.getCoordinator().getLocker().acquireLock(ores, ureq.getIdentity(), null);

    CPManager cpMgm = CPManager.getInstance();

    this.cp = cpMgm.load(cpContainer, ores);

    String errorString = cp.getLastError();
    if (errorString == null) {
      if (lock.isSuccess()) {
        initDefaultView(ureq, wControl);
View Full Code Here


    return pageFile.getName();
  }

  protected CPResource getResource() {
    CPResource resource = null;
    CPManager mgr = CPManager.getInstance();
    DefaultElement resElement = mgr.getElementByIdentifier(cp, idRef);
    if (resElement instanceof CPResource) {
      resource = (CPResource)resElement;
    }
    return resource;
  }
View Full Code Here

    contentVC = createVelocityContainer("treeView");

    this.cp = cp;

    String rootTitle = cp.getFirstOrganizationInManifest().getTitle();
    CPManager cpMgm = CPManager.getInstance();
    treeModel = cpMgm.getTreeDataModel(cp);
    treeCtr = new TreeController(ureq, control, rootTitle, treeModel, null);
    treeCtr.setTreeInlineEditing(true, null, null);

    // do not sort jsTree (structure is given by manifest)
    treeCtr.setTreeSorting(false, false, false);
View Full Code Here

   */
  private void deletePage(String identifier, boolean deleteResource) {
    if (identifier.equals("")) {
      // no page selected
    } else {
      CPManager cpMgm = CPManager.getInstance();
      String path = treeModel.getPath(identifier);
      treeCtr.removePath(path);
      cpMgm.removeElement(cp, identifier, deleteResource);
      cpMgm.writeToFile(cp);
    }
  }
View Full Code Here

   * @param nodeID
   */
  private String copyPage(CPPage page) {
    String newIdentifier = null;
    if (page != null) {
      CPManager cpMgm = CPManager.getInstance();
      newIdentifier = cpMgm.copyElement(cp, page.getIdentifier());
      cpMgm.writeToFile(cp);
    }
    return newIdentifier;
  }
View Full Code Here

   * Adds a page to the CP
   *
   * @return
   */
  protected String addPage(CPPage page) {
    CPManager cpMgm = CPManager.getInstance();
    String newNodeID = "";

    if (currentPage.getIdentifier().equals("")) {
      newNodeID = cpMgm.addBlankPage(cp, page.getTitle());
    } else {
      // adds new page as child of currentPage
      newNodeID = cpMgm.addBlankPage(cp, page.getTitle(), currentPage.getIdentifier());
    }
    setCurrentPage(new CPPage(newNodeID, cp));

    cpMgm.writeToFile(cp);
    // treeCtr.getInitialComponent().setDirty(true);
    return newNodeID;
  }
View Full Code Here

  /**
   * @param page
   */
  protected void updatePage(CPPage page) {
    setCurrentPage(page);
    CPManager cpMgm = CPManager.getInstance();
    cpMgm.updatePage(cp, page);
    cpMgm.writeToFile(cp);
    if (page.isOrgaPage()) {
      // TODO:GW Shall the repo entry title be updated when the organization
      // title changes?
      // // If the organization title changed, also update the repo entry
      // // title.
View Full Code Here

   *
   * @param event
   * @return returns true, if move was successfull
   */
  private boolean movePage(MoveTreeNodeEvent event) {
    CPManager cpMgm = CPManager.getInstance();
    String movedNodeId = event.getNodeId();
    cpMgm.moveElement(cp, movedNodeId, event.getNewParentNodeId(), event.getPosition());
    cpMgm.writeToFile(cp);
    selectTreeNodeById(movedNodeId);
    return true;
  }
View Full Code Here

   * @return HTML-String
   */
  private String getCurrentPageInfoStringHTML() {
    // test if currentPage links to resource, which is used (linked) somewhere
    // else in the manifest
    CPManager cpMgm = CPManager.getInstance();
    DefaultElement ele = cpMgm.getElementByIdentifier(cp, currentPage.getIdRef());
    boolean single = false;
    if (ele instanceof CPResource) {
      CPResource res = (CPResource) ele;
      single = cpMgm.isSingleUsedResource(res, cp);
    }

    StringBuilder b = new StringBuilder();
    b.append("<br /><ul>");
    b.append("<li><b>" + translate("cptreecontroller.pagetitle") + "</b> " + currentPage.getTitle() + "</li>");
View Full Code Here

   *
   * @param item
   * @param parentId
   */
  private CPPage addItem(VFSItem item, String parentId, boolean isRoot) {
    CPManager cpMgr = CPManager.getInstance();

    // Make an item in the menu tree only if the item is a container that
    // contains any items to be added or its type is selected in the form.
    // Upload any files in case they are referenced to.

    // Get the file types that should be added as items in the menu tree
    Set<String> menuItemTypes = checkboxes.getSelectedKeys();
    if (menuItemTypes.contains("htm")) menuItemTypes.add("html");

    // If item is the root node and it doesn't contain any items to be added,
    // show info.
    if (isRoot && item instanceof VFSContainer && !containsItemsToAdd((VFSContainer) item, menuItemTypes)) {
      showInfo("cpfileuploadcontroller.no.files.imported");
    }

    CPPage newPage = null;
    if (isSingleFile || item instanceof VFSLeaf && isToBeAdded((VFSLeaf) item, menuItemTypes) || item instanceof VFSContainer
        && containsItemsToAdd((VFSContainer) item, menuItemTypes)) {
      // Create the menu item
      String newId = cpMgr.addBlankPage(cp, item.getName(), parentId);
      newPage = new CPPage(newId, cp);
      if (item instanceof VFSLeaf) {
        VFSLeaf leaf = (VFSLeaf) item;
        newPage.setFile(leaf);
      }
      cpMgr.updatePage(cp, newPage);
    }

    // Add any sub items
    if (item instanceof VFSContainer && containsItemsToAdd((VFSContainer) item, menuItemTypes)) {
      VFSContainer dir = (VFSContainer) item;
View Full Code Here

TOP

Related Classes of org.olat.ims.cp.CPManager

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.