Package org.olat.catalog

Examples of org.olat.catalog.CatalogManager


      // Setting some node attributes - see the Treenode or the extjs
      // documentation on what else you could use
      node.put(AjaxTreeNode.CONF_LEAF, (catalogEntry.getType() == CatalogEntry.TYPE_LEAF));
      if (catalogEntry.getType() == CatalogEntry.TYPE_NODE) {
        // set different css class depending on access rights
        CatalogManager cm = CatalogManager.getInstance();     
        if (ownedEntries != null && !cm.isEntryWithinCategory(catalogEntry, ownedEntries)) {
          node.put(AjaxTreeNode.CONF_ICON_CSS_CLASS, "o_catalog_cat_noaccess_icon");
        } else {
          node.put(AjaxTreeNode.CONF_ICON_CSS_CLASS, "o_catalog_cat_icon");         
        }
        // Check if node is expandable. ignore this check in d&d mode,
        // otherwhise those categories could not act as drop zones
        if (!allowDragNdrop && !cm.hasChildEntries(catalogEntry, CatalogEntry.TYPE_NODE)) {
          node.put(AjaxTreeNode.CONF_LEAF, true);
        }
       
      } else {
        node.put(AjaxTreeNode.CONF_ICON_CSS_CLASS, "o_catalog_entry_icon");
View Full Code Here


    cat.setAttribute("date", String.valueOf(System.currentTimeMillis()));        // set date in catalog element
    Element root = doc.createElement(XML_NODE);                                  // root node
    root.setAttribute("name", "root");
    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
    }
   
View Full Code Here

       * 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));
        updateToolAccessRights(ureq, parent, historyStack.indexOf(parent));
        fireEvent(ureq, Event.CHANGED_EVENT);
      }
      // in any case, remove the lock
      if (catModificationLock != null && catModificationLock.isSuccess()) {
        CoordinatorManager.getCoordinator().getLocker().releaseLock(catModificationLock);
        catModificationLock = null;
      }

    }
    /*
     * from remove link dialog -> yes or no
     */
    else if (source == dialogDeleteLink) {
      if (DialogBoxUIFactory.isYesEvent(event)) {
        cm.deleteCatalogEntry(linkMarkedToBeDeleted);
        updateContent(ureq.getIdentity(), currentCatalogEntry, currentCatalogEntryLevel);
      }
      // in any case, remove the lock
      if (catModificationLock != null && catModificationLock.isSuccess()) {
        CoordinatorManager.getCoordinator().getLocker().releaseLock(catModificationLock);
View Full Code Here

TOP

Related Classes of org.olat.catalog.CatalogManager

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.