Examples of CatalogEntry


Examples of org.olat.catalog.CatalogEntry

      TreeEvent te = (TreeEvent) event;
      if (te.getCommand().equals(TreeEvent.COMMAND_TREENODE_CLICKED)) {
        GenericTreeNode node = (GenericTreeNode) selectionTree.getSelectedNode();
        CatalogManager cm = CatalogManager.getInstance();
        Long newParentId = Long.parseLong(node.getIdent());
        CatalogEntry newParent = cm.loadCatalogEntry(newParentId);
        // check first if this repo entry is already attached to this new parent
        List<CatalogEntry> existingChildren = cm.getChildrenOf(newParent);
        for (CatalogEntry existingChild : existingChildren) {
          RepositoryEntry existingRepoEntry = existingChild.getRepositoryEntry();
          if (existingRepoEntry != null && existingRepoEntry.equalsByPersistableKey(toBeAddedEntry)) {
            showError("catalog.tree.add.already.exists", toBeAddedEntry.getDisplayname());
            return;
          }
        }
        CatalogEntry newEntry = cm.createCatalogEntry();
        newEntry.setRepositoryEntry(toBeAddedEntry);
        newEntry.setName(toBeAddedEntry.getDisplayname());
        newEntry.setDescription(toBeAddedEntry.getDescription());
        newEntry.setType(CatalogEntry.TYPE_LEAF);
        newEntry.setOwnerGroup(ManagerFactory.getManager().createAndPersistSecurityGroup());
        // save entry
        cm.addCatalogEntry(newParent, newEntry);
        fireEvent(ureq, Event.DONE_EVENT);

      } else if (te.getCommand().equals(TreeEvent.COMMAND_CANCELLED)) {
View Full Code Here

Examples of org.olat.catalog.CatalogEntry

  protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == tableCtr) { // process table actions
      TableEvent te = (TableEvent) event;
      String action  = te.getActionId();
      CategoriesListModel categoriesListModel = (CategoriesListModel) tableCtr.getTableDataModel();
      CatalogEntry selectedCategoryLevel = categoriesListModel.getCatalogEntry(te.getRowId());
     
      if (action.equals(CategoriesListModel.ACTION_GOTO)) {
        // select repo site and activate catalog entry in catalog
        DTabs dts = (DTabs) getWindowControl().getWindowBackOffice().getWindow().getAttribute("DTabs");
        dts.activateStatic(ureq, RepositorySite.class.getName(), "search.catalog:" + selectedCategoryLevel.getKey());
       
      } else if (action.equals(CategoriesListModel.ACTION_DELETE)) {
        // remove selected entry from the data model
        CatalogManager cm = CatalogManager.getInstance();
        List<CatalogEntry> children = cm.getChildrenOf(selectedCategoryLevel);
View Full Code Here

Examples of org.olat.catalog.CatalogEntry

  public List<AjaxTreeNode> getChildrenFor(String nodeId) {
    List<AjaxTreeNode> childNodes = new ArrayList<AjaxTreeNode>();
    CatalogManager cm = CatalogManager.getInstance();
    // load node with given id
    Long entryKey = Long.parseLong(nodeId);
    CatalogEntry entry = cm.loadCatalogEntry(entryKey);
    // load children of node and add them to the list
    List<CatalogEntry> childEntries = cm.getChildrenOf(entry);
    for (CatalogEntry childEntry : childEntries) {
      // don't add the to be moved child itself!
      if (toBeMovedEntry != null && toBeMovedEntry.getKey().equals(childEntry.getKey())) {
View Full Code Here

Examples of org.olat.catalog.CatalogEntry

        } else {
          getWindowControl().setWarning(translate("warn.cantlaunch"));
        }
      } else if (polyLink.getLinkType().equals(InstitutionPortlet.TYPE_CATALOG)) {
        try {
          CatalogEntry ce = CatalogManager.getInstance().loadCatalogEntry(resultIDForUser != null ? resultIDForUser : defaultID);
          DTabs dts = (DTabs) getWindowControl().getWindowBackOffice().getWindow().getAttribute("DTabs");
          dts.activateStatic(ureq, RepositorySite.class.getName(), "search.catalog:" + ce.getKey());
        } catch (Exception e) {
          Tracing.createLoggerFor(InstitutionPortletRunController.class).error(e.getMessage());
          getWindowControl().setWarning(translate("warn.cantlaunch"));
        }
      }
View Full Code Here

Examples of org.olat.catalog.CatalogEntry

    cat.appendChild(root);
   
    CatalogManager cm = CatalogManager.getInstance();                            // instanciate catalog manager
    List ces = cm.getRootCatalogEntries();
    for (Iterator it = ces.iterator(); it.hasNext();) {                          // for every root entry (currently only one)
      CatalogEntry ce = (CatalogEntry) it.next();
      getCatalogSubStructure(doc, root, cm, ce);                                // scan this entry
    }
   
    TransformerFactory tranFac = TransformerFactory.newInstance();              // init transfromer to write XML to file
    Transformer t;
View Full Code Here

Examples of org.olat.catalog.CatalogEntry

  private void getCatalogSubStructure(Document doc, Element parent, CatalogManager cm, CatalogEntry ce) {
    Element cur = null;                                                          // tmp. element
    List l = cm.getChildrenOf(ce);                                              // get catalog children
    // all nodes
    for (Iterator it = l.iterator(); it.hasNext();) {                            // scan for node entries
      CatalogEntry c = (CatalogEntry) it.next();
      if (c.getType() == CatalogEntry.TYPE_NODE) {                              // it's a node
       
        Element node = doc.createElement(XML_NODE);                              // node element
        node.setAttribute("name", c.getName());
        parent.appendChild(node);
       
        cur = doc.createElement(XML_DESCR);                                      // description element
        cur.appendChild(doc.createTextNode(c.getDescription()));
        node.appendChild(cur);

        if (cm.getChildrenOf(c).size() > 0) {                                    // children element containing all subentries
          cur = doc.createElement(XML_CHILDREN);
          node.appendChild(cur);
          getCatalogSubStructure(doc, cur, cm, c);                              // recursive scan
        }
       
        cur = doc.createElement(XML_CUSTOM);
        /*
         * Insert custom info here!
         */
        node.appendChild(cur);
       
      }
    }
    // all leafes
    for (Iterator it = l.iterator(); it.hasNext();) {                            // scan for leaf entries
      CatalogEntry c = (CatalogEntry) it.next();
      if (c.getType() == CatalogEntry.TYPE_LEAF) {
        RepositoryEntry re = c.getRepositoryEntry();                            // get repo entry
        if (re.getAccess() > RepositoryEntry.ACC_OWNERS_AUTHORS) {              // just show entries visible for registered users
          Element leaf = doc.createElement(XML_LEAF);                            // leaf element
          leaf.setAttribute("name", c.getName());
          parent.appendChild(leaf);
         
          cur = doc.createElement(XML_DESCR);                                    // description element
          cur.appendChild(doc.createTextNode(c.getDescription()));
          leaf.appendChild(cur);
         
          cur = doc.createElement(XML_TYPE);
          String typeName = re.getOlatResource().getResourceableTypeName();      // add the resource type
          StringOutput typeDisplayText = new StringOutput(100);
View Full Code Here

Examples of org.olat.catalog.CatalogEntry

    super(ureq, wControl, Util.createPackageTranslator(RepositoryManager.class, ureq.getLocale()));
   
    cm = CatalogManager.getInstance();

    List<CatalogEntry> rootNodes = cm.getRootCatalogEntries();
    CatalogEntry rootce;
    if (rootNodes.isEmpty()) throw new AssertException("No RootNodes found for Catalog! failed module init? corrupt DB?");
    rootce = (CatalogEntry) cm.getRootCatalogEntries().get(0);

    // Check AccessRights
    isAuthor = ureq.getUserSession().getRoles().isAuthor();
View Full Code Here

Examples of org.olat.catalog.CatalogEntry

      // - 'navigation path' history
      // - link selectionfires a leaf event
      //
      if (command.startsWith(CATENTRY_CHILD)) { // child clicked
        int pos = Integer.parseInt(command.substring(CATENTRY_CHILD.length()));
        CatalogEntry cur = (CatalogEntry) childCe.get(pos);
        // put new as trail on stack
        historyStack.add(cur);
        updateToolAccessRights(ureq, cur, historyStack.indexOf(cur));
        updateContent(ureq.getIdentity(), cur, historyStack.indexOf(cur));
        fireEvent(ureq, Event.CHANGED_EVENT);
       
      } else if (command.startsWith(CATCMD_HISTORY)) { // history clicked
        int pos = Integer.parseInt(command.substring(CATCMD_HISTORY.length()));
        CatalogEntry cur = historyStack.get(pos);
        historyStack = historyStack.subList(0, pos + 1);
        updateToolAccessRights(ureq, cur, historyStack.indexOf(cur));
        updateContent(ureq.getIdentity(), cur, historyStack.indexOf(cur));
        fireEvent(ureq, Event.CHANGED_EVENT);
       
      } else if (command.startsWith(CATENTRY_LEAF)) { // link clicked
        int pos = Integer.parseInt(command.substring(CATENTRY_LEAF.length()));
        CatalogEntry cur = (CatalogEntry) childCe.get(pos);
        RepositoryEntry repoEntry = cur.getRepositoryEntry();
        if (repoEntry == null) throw new AssertException("a leaf did not have a repositoryentry! catalogEntry = key:" + cur.getKey()
            + ", title " + cur.getName());
        // launch entry if launchable, otherwise offer it as download / launch
        // it as non-html in browser
        String displayName = cur.getName();
        RepositoryHandler handler = RepositoryHandlerFactory.getInstance().getRepositoryHandler(repoEntry);
        OLATResource ores = repoEntry.getOlatResource();
        if (ores == null) throw new AssertException("repoEntry had no olatresource, repoKey = " + repoEntry.getKey());
        if (repoEntry.getCanLaunch()) {
          // we can create a controller and launch
          // it in OLAT, e.g. if it is a
          // content-packacking or a course

          //was brasato:: DTabs dts = getWindowControl().getDTabs();
          DTabs dts = (DTabs)Windows.getWindows(ureq).getWindow(ureq).getAttribute("DTabs");
          DTab dt = dts.getDTab(ores);
          if (dt == null) {
            // does not yet exist -> create and add
            dt = dts.createDTab(ores, displayName);
            if (dt == null) return;
            Controller launchController = ControllerFactory.createLaunchController(ores, null, ureq, dt.getWindowControl(), true);
            dt.setController(launchController);
            dts.addDTab(dt);
          }
          dts.activate(ureq, dt, null); // null: start with main entry point of controller
        } else if (repoEntry.getCanDownload()) {
          // else not launchable in olat, but downloadable -> send the document
          // directly to browser but "downloadable" (pdf, word, excel)
          MediaResource mr = handler.getAsMediaResource(ores);
          RepositoryManager.getInstance().incrementDownloadCounter(repoEntry);
          ureq.getDispatchResult().setResultingMediaResource(mr);
          return;
        } else { // neither launchable nor downloadable -> show details         
          //REVIEW:pb:replace EntryChangedEvent with a more specific event
          fireEvent(ureq, new EntryChangedEvent(repoEntry, EntryChangedEvent.MODIFIED));
          return;
        }

      } else if (command.startsWith(CATCMD_MOVE)) {
        String s = command.substring(CATCMD_MOVE.length());
        if (s.startsWith(CATENTRY_LEAF)) {
          // move a resource in the catalog - moving of catalog leves is triggered by a toolbox action
          int pos = Integer.parseInt(s.substring(CATENTRY_LEAF.length()));
          linkMarkedToBeEdited = (CatalogEntry) childCe.get(pos);
          removeAsListenerAndDispose(catEntryMoveController);
          boolean ajax = getWindowControl().getWindowBackOffice().getWindowManager().isAjaxEnabled();
          if (ajax) {
            // fancy ajax tree
            catEntryMoveController= new CatalogAjaxMoveController(ureq, getWindowControl(), linkMarkedToBeEdited);
          } else {
            // old-school selection tree
            catEntryMoveController= new CatalogEntryMoveController(getWindowControl(), ureq, linkMarkedToBeEdited, getTranslator());
          }
          listenTo(catEntryMoveController);
          removeAsListenerAndDispose(cmc);
          cmc = new CloseableModalController(getWindowControl(), "close", catEntryMoveController.getInitialComponent());
          listenTo(cmc);
          cmc.activate();
        }
      } else if (command.startsWith(CATCMD_REMOVE)) {
        String s = command.substring(CATCMD_REMOVE.length());
        if (s.startsWith(CATENTRY_LEAF)) {
          int pos = Integer.parseInt(s.substring(CATENTRY_LEAF.length()));
          linkMarkedToBeDeleted = (CatalogEntry) childCe.get(pos);
          // create modal dialog
          String[] trnslP = { linkMarkedToBeDeleted.getName() };
          dialogDeleteLink = activateYesNoDialog(ureq, null, getTranslator().translate(NLS_DIALOG_MODAL_LEAF_DELETE_TEXT, trnslP), dialogDeleteLink);
          return;
        }
      } else if (command.startsWith(CATCMD_EDIT)) {
        String s = command.substring(CATCMD_EDIT.length());
        if (s.startsWith(CATENTRY_LEAF)) {
          int pos = Integer.parseInt(s.substring(CATENTRY_LEAF.length()));
          linkMarkedToBeEdited = (CatalogEntry) childCe.get(pos);
          repositoryEditDescriptionController = new RepositoryEditDescriptionController(ureq, getWindowControl(), linkMarkedToBeEdited.getRepositoryEntry(), false);
          repositoryEditDescriptionController.addControllerListener(this);
          // open form in dialog
          removeAsListenerAndDispose(cmc);
          cmc = new CloseableModalController(getWindowControl(), "close", repositoryEditDescriptionController.getInitialComponent(), true, translate("tools.edit.catalog.category"));
          listenTo(cmc);
          cmc.activate();         
        }
      } else if (command.startsWith(CATCMD_DETAIL)) {
        String s = command.substring(CATCMD_DETAIL.length());
        if (s.startsWith(CATENTRY_LEAF)) {
          int pos = Integer.parseInt(s.substring(CATENTRY_LEAF.length()));
          CatalogEntry showDetailForLink = (CatalogEntry) childCe.get(pos);
          RepositoryEntry repoEnt = showDetailForLink.getRepositoryEntry();         
          fireEvent(ureq, new EntryChangedEvent(repoEnt, EntryChangedEvent.MODIFIED));
          //TODO [ingkr]
          //getWindowControl().getDTabs().activateStatic(ureq, RepositorySite.class.getName(), RepositoryMainController.JUMPFROMEXTERN+RepositoryMainController.JUMPFROMCATALOG+repoEnt.getKey().toString());
          return;
        }
      }
    }
    /*
     * login link clicked
     */   
    else if (source == loginLink){
      DispatcherAction.redirectToDefaultDispatcher(ureq.getHttpResp());
    }
    /*
     * add/edit node
     */
    else if (source == addEntryForm) {
      // remove modal dialog
      cmc.deactivate();
      if (event == Form.EVNT_VALIDATION_OK) {
        CatalogEntry ce = cm.createCatalogEntry();
        addEntryForm.fillEntry(ce);
        ce.setOwnerGroup(ManagerFactory.getManager().createAndPersistSecurityGroup());
        ce.setRepositoryEntry(null);
        ce.setParent(currentCatalogEntry);
        // optimistic save: might fail in case the parent has been deleted in the meantime
        cm.saveCatalogEntry(ce);
      } else if (event == Form.EVNT_FORM_CANCELLED) {
        // nothing to do
      }
      CatalogEntry reloaded = cm.loadCatalogEntry(currentCatalogEntry);
      currentCatalogEntry = reloaded;// FIXME:pb:
      updateContent(ureq.getIdentity(), currentCatalogEntry, currentCatalogEntryLevel);
      updateToolAccessRights(ureq, currentCatalogEntry, currentCatalogEntryLevel);
      // in any case, remove the lock
      if (catModificationLock != null && catModificationLock.isSuccess()) {
        CoordinatorManager.getCoordinator().getLocker().releaseLock(catModificationLock);
        catModificationLock = null;
      }
      fireEvent(ureq, Event.CHANGED_EVENT);
     
    } else if (source == editEntryForm) {
      // remove modal dialog
      cmc.deactivate();
      // optimistic save: might fail in case the current entry has been deleted
      // in the meantime by someone else
      CatalogEntry reloaded = (CatalogEntry) DBFactory.getInstance().loadObject(currentCatalogEntry);
      currentCatalogEntry = reloaded;// FIXME:pb
      if (event == Form.EVNT_VALIDATION_OK) {
        editEntryForm.fillEntry(currentCatalogEntry);
        cm.updateCatalogEntry(currentCatalogEntry);
        // update the changed name in the history path
        historyStack.remove(historyStack.size() - 1);
        historyStack.add(currentCatalogEntry);
      } else if (event == Form.EVNT_FORM_CANCELLED) {
        // nothing to do
      }
      // in any case, remove the lock
      if (catModificationLock != null && catModificationLock.isSuccess()) {
        CoordinatorManager.getCoordinator().getLocker().releaseLock(catModificationLock);
        catModificationLock = null;
      }
      updateContent(ureq.getIdentity(), currentCatalogEntry, currentCatalogEntryLevel);
    }
    /*
     * admin submitted a new structure
     */
    else if (source == addStructureForm) {
      // remove modal dialog first
      cmc.deactivate();
      if (event == Form.EVNT_VALIDATION_OK) {
        importStructure();
      }
      CatalogEntry newRoot = (CatalogEntry) cm.getRootCatalogEntries().get(0);
      historyStack = new ArrayList<CatalogEntry>();
      historyStack.add(newRoot);
      updateContent(ureq.getIdentity(), newRoot, 0);
      updateToolAccessRights(ureq, currentCatalogEntry, currentCatalogEntryLevel);
      fireEvent(ureq, Event.CHANGED_EVENT);
View Full Code Here

Examples of org.olat.catalog.CatalogEntry

       */
      else if (event.getCommand().equals(ACTION_EDIT_CTLGCATOWNER)) {
        // add ownership management
        SecurityGroup secGroup = currentCatalogEntry.getOwnerGroup();
        if (secGroup == null) {
          CatalogEntry reloaded = cm.loadCatalogEntry(currentCatalogEntry);
          currentCatalogEntry = reloaded;// FIXME:pb:?
          secGroup = ManagerFactory.getManager().createAndPersistSecurityGroup();
          currentCatalogEntry.setOwnerGroup(secGroup);
          cm.saveCatalogEntry(currentCatalogEntry);
        }
        boolean keepAtLeastOne = currentCatalogEntryLevel == 0;
        removeAsListenerAndDispose(groupController);
        groupController = new GroupController(ureq, getWindowControl(), true, keepAtLeastOne, false, secGroup);
        listenTo(groupController);
        // open form in dialog
        removeAsListenerAndDispose(cmc);
        cmc = new CloseableModalController(getWindowControl(), "close", groupController.getInitialComponent(), true, translate("tools.edit.catalog.category.ownergroup"));
        listenTo(cmc);
        cmc.activate();         
      }
      /*
       * delete category (subtree)
       */
      else if (event.getCommand().equals(ACTION_DELETE_CTLGCATEGORY)) {
        catModificationLock = CoordinatorManager.getCoordinator().getLocker().acquireLock(OresHelper.createOLATResourceableType(CatalogController.class), ureq.getIdentity(), LOCK_TOKEN);
        if ( ! catModificationLock.isSuccess()) {
          showError("catalog.locked.by", catModificationLock.getOwner().getName());
          return;
        }
        String[] trnslP = { currentCatalogEntry.getName() };
        dialogDeleteSubtree = activateYesNoDialog(ureq, null, getTranslator().translate(NLS_DIALOG_MODAL_SUBTREE_DELETE_TEXT, trnslP), dialogDeleteSubtree);
        return;
      }
      /*
       * contact caretaker, request subcategory, request deletion of an entry,
       * etc.
       */
      else if (event.getCommand().equals(ACTION_NEW_CTGREQUEST)) {
        /*
         * find the first caretaker, looking from the leaf towards the root,
         * following the selected branch.
         */
        Manager mngr = ManagerFactory.getManager();
        ContactList caretaker = new ContactList(translate(NLS_CONTACT_TO_GROUPNAME_CARETAKER));
        final List emptyList = new ArrayList();
        List tmpIdent = new ArrayList();
        for (int i = historyStack.size() - 1; i >= 0 && tmpIdent.isEmpty(); i--) {
          // start at the selected category, the root category is asserted to
          // have the OLATAdministrator
          // so we end up having always at least one identity as receiver for a
          // request ;-)
          CatalogEntry tmp = historyStack.get(i);
          SecurityGroup tmpOwn = tmp.getOwnerGroup();
          if (tmpOwn != null) tmpIdent = mngr.getIdentitiesOfSecurityGroup(tmpOwn);
          else tmpIdent = emptyList;
        }
        for (int i = tmpIdent.size() - 1; i >= 0; i--) {
          caretaker.add((Identity) tmpIdent.get(i));
        }
       
        //create e-mail Message
        ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
        cmsg.addEmailTo(caretaker);
        removeAsListenerAndDispose(cfc);
        cfc = new ContactFormController(ureq, getWindowControl(), false, true, false, false, cmsg);
        listenTo(cfc);
        // open form in dialog
        removeAsListenerAndDispose(cmc);
        cmc = new CloseableModalController(getWindowControl(), "close", cfc.getInitialComponent(), true, translate("contact.caretaker"));
        listenTo(cmc);
        cmc.activate();         
      }
      /*
       * add a structure
       */
      else if (event.getCommand().equals(ACTION_ADD_STRUCTURE)) {
        addStructureForm = new EntryForm("ADDSTRUCTURE", getTranslator(), false);
        addStructureForm.addListener(this);
        cmc = new CloseableModalController(getWindowControl(), "close", addStructureForm, true, translate("contact.caretaker"));
        listenTo(cmc);
        cmc.activate();         
      }
     
      /*
       * add bookmark
       */
     
      else if (event.getCommand().equals(ACTION_ADD_BOOKMARK)){
        removeAsListenerAndDispose(bookmarkController);
        CatalogManager cm = CatalogManager.getInstance();
        OLATResourceable ores = cm.createOLATResouceableFor(currentCatalogEntry);
        bookmarkController = new AddAndEditBookmarkController(ureq, getWindowControl(), currentCatalogEntry.getName(), "", ores, CatalogManager.CATALOGENTRY);           
        listenTo(bookmarkController);
        removeAsListenerAndDispose(cmc);
        cmc = new CloseableModalController(getWindowControl(), "close", bookmarkController.getInitialComponent());
        listenTo(cmc);
        cmc.activate();
      }
      /*
       * move catalogentry
       */
      else if(event.getCommand().equals(ACTION_MOVE_ENTRY)){       
        // Move catalog level - moving of resources in the catalog (leafs) is triggered by a velocity command
        // so, reset stale link to the current resource first (OLAT-4253), the linkMarkedToBeEdited will be reset
        // when an edit or move operation on the resource is done
        linkMarkedToBeEdited = null;
        //
        catModificationLock = CoordinatorManager.getCoordinator().getLocker().acquireLock(OresHelper.createOLATResourceableType(CatalogController.class), ureq.getIdentity(), LOCK_TOKEN);
        if ( ! catModificationLock.isSuccess()) {
          showError("catalog.locked.by", catModificationLock.getOwner().getName());
          return;
        }
        // check if user surfs in ajax mode
        removeAsListenerAndDispose(catEntryMoveController);
        boolean ajax = getWindowControl().getWindowBackOffice().getWindowManager().isAjaxEnabled();
        if (ajax) {
          // fancy ajax tree
          catEntryMoveController= new CatalogAjaxMoveController(ureq, getWindowControl(), currentCatalogEntry);
        } else {
          // old-school selection tree
          catEntryMoveController= new CatalogEntryMoveController(getWindowControl(), ureq, currentCatalogEntry, getTranslator());         
        }
        listenTo(catEntryMoveController);
        removeAsListenerAndDispose(cmc);
        cmc = new CloseableModalController(getWindowControl(), "close", catEntryMoveController.getInitialComponent());
        listenTo(cmc);
        cmc.activate();
      }
    }
    /*
     * from the repository search, a entry was selected to add
     */
    else if (source == rsc) {
      // remove modal dialog
      cmc.deactivate();
      if (event.getCommand().equals(RepositoryTableModel.TABLE_ACTION_SELECT_LINK)) {
        /*
         * succesfully selected a repository entry which will be a link within
         * the current Category
         */
        RepositoryEntry re = rsc.getSelectedEntry();
        /*
         * create, but do not persist a new catalog entry
         */
        newLinkNotPersistedYet = cm.createCatalogEntry();
        newLinkNotPersistedYet.setName(re.getDisplayname());
        newLinkNotPersistedYet.setDescription(re.getDescription());
        newLinkNotPersistedYet.setRepositoryEntry(re);
        newLinkNotPersistedYet.setType(CatalogEntry.TYPE_LEAF);
        /*
         * open the confirm form, which allows to change the link-title,
         * link-description.
         */
        newLinkNotPersistedYet.setOwnerGroup(ManagerFactory.getManager().createAndPersistSecurityGroup());
        cm.addCatalogEntry(currentCatalogEntry, newLinkNotPersistedYet);
        newLinkNotPersistedYet = null;
        updateContent(ureq.getIdentity(), currentCatalogEntry, currentCatalogEntryLevel);
        updateToolAccessRights(ureq, currentCatalogEntry, currentCatalogEntryLevel);
        fireEvent(ureq, Event.CHANGED_EVENT);
      } else if (event == Event.CANCELLED_EVENT) {
        updateContent(ureq.getIdentity(), currentCatalogEntry, currentCatalogEntryLevel);
        updateToolAccessRights(ureq, currentCatalogEntry, currentCatalogEntryLevel);
        fireEvent(ureq, Event.CHANGED_EVENT);

      }
    }
    /*
     * from remove subtree dialog -> yes or no
     */
    else if (source == dialogDeleteSubtree) {
      if (DialogBoxUIFactory.isYesEvent(event)) {
        // remember the parent of the subtree being deleted
        CatalogEntry parent = currentCatalogEntry.getParent();
        // delete the subtree!!!
        cm.deleteCatalogEntry(currentCatalogEntry);
        // display the parent
        historyStack.remove(historyStack.size() - 1);
        updateContent(ureq.getIdentity(), parent, historyStack.indexOf(parent));
View Full Code Here

Examples of org.olat.catalog.CatalogEntry

    myContent.contextPut("canRemoveAllLinks", new Boolean(canRemoveAllLinks));
    myContent.contextPut("currentCatalogEntry", currentCatalogEntry);
    childCe = cm.getChildrenOf(ce);
    myContent.contextPut("children", childCe);
    for ( Object leaf : childCe ) {
      CatalogEntry entry = (CatalogEntry)leaf;
      if(entry.getType() == CatalogEntry.TYPE_NODE) continue;
      String name = "image" + childCe.indexOf(leaf);
      ImageComponent ic = RepositoryEntryImageController.getImageComponentForRepositoryEntry(name, entry.getRepositoryEntry());
      if(ic == null) {
        myContent.remove(myContent.getComponent(name));
        continue;
      }
      ic.setMaxWithAndHeightToFitWithin(200, 100);
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.