/**
  * Updates a page by nodeId.
  *
  * @param nodeId
  */
 protected void updateNode(final String nodeId, final String title) {
   final String nodeIdentifier = treeModel.getIdentifierForNodeID(nodeId);
   final CPPage page = new CPPage(nodeIdentifier, cp);
   page.setTitle(title);
   if (page.isOrgaPage()) {
     treeCtr.setRootNodeTitle(title);
   }
   updatePage(page);
 }
 /**
  * deletes a page from the manifest
  *
  * @param nodeID
  */
 private void deletePage(final String identifier, final boolean deleteResource) {
   if (identifier.equals("")) {
     // no page selected
   } else {
     final CPManager cpMgm = CPManager.getInstance();
     final String path = treeModel.getPath(identifier);
     treeCtr.removePath(path);
     cpMgm.removeElement(cp, identifier, deleteResource);
     cpMgm.writeToFile(cp);
   }
 }
  protected CPTreeController(
      final UserRequest ureq, final WindowControl control, final ContentPackage cp) {
    super(ureq, control);
    contentVC = createVelocityContainer("treeView");

    this.cp = cp;

    final String rootTitle = cp.getFirstOrganizationInManifest().getTitle();
    final 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);
    listenTo(treeCtr);

    setLinks();
    contentVC.put("cptreecontroller.tree", treeCtr.getInitialComponent());

    putInitialPanel(contentVC);
  }
 /** @param page */
 protected void updatePage(final CPPage page) {
   setCurrentPage(page);
   final 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.
     // RepositoryManager resMgr = RepositoryManager.getInstance();
     // RepositoryEntry cpEntry =
     // resMgr.lookupRepositoryEntry(cp.getResourcable(), false);
     // cpEntry.setDisplayname(page.getTitle());
     treeCtr.setRootNodeTitle(page.getTitle());
   }
   selectTreeNodeByCPPage(page);
 }
 /**
  * Selects the node in the tree with the given page (if found). Returns false, if node is not
  * found, true otherwise info: todo: implement selection of node in js tree
  *
  * @param page
  * @return
  */
 protected boolean selectTreeNodeByCPPage(final CPPage page) {
   currentPage = page;
   final String path = treeModel.getPath(page.getIdentifier());
   treeCtr.selectPath(path);
   return true;
 }