Search in sources :

Example 71 with CatalogEntry

use of org.olat.repository.CatalogEntry in project OpenOLAT by OpenOLAT.

the class CatalogNodeManagerController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (addEntryCtrl == source) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            loadNodesChildren();
        }
        cmc.deactivate();
        cleanUp();
        fireEvent(ureq, Event.CHANGED_EVENT);
    } else if (editEntryCtrl == source) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            catalogEntry = editEntryCtrl.getEditedCatalogEntry();
            loadEntryInfos();
        }
        cmc.deactivate();
        cleanUp();
        fireEvent(ureq, Event.CHANGED_EVENT);
    } else if (categoryMoveCtrl == source) {
        cmc.deactivate();
        CatalogEntry moveMe = null;
        if (event.equals(Event.DONE_EVENT)) {
            showInfo("tools.move.catalog.entry.success", catalogEntry.getName());
            moveMe = categoryMoveCtrl.getMoveMe();
        } else if (event.equals(Event.FAILED_EVENT)) {
            showError("tools.move.catalog.entry.failed");
            loadNodesChildren();
        }
        cleanUp();
        // in any case, remove the lock
        if (catModificationLock != null && catModificationLock.isSuccess()) {
            CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(catModificationLock);
            catModificationLock = null;
        }
        // only after jump to the moved entry
        if (moveMe != null) {
            launchCatalogEntry(ureq, moveMe);
        }
    } else if (dialogDeleteSubtree == source) {
        // from remove subtree dialog -> yes or no
        if (DialogBoxUIFactory.isYesEvent(event)) {
            catalogManager.deleteCatalogEntry(catalogEntry);
            fireEvent(ureq, Event.BACK_EVENT);
        }
        // in any case, remove the lock
        if (catModificationLock != null && catModificationLock.isSuccess()) {
            CoordinatorManager.getInstance().getCoordinator().getLocker().releaseLock(catModificationLock);
            catModificationLock = null;
        }
    } else if (childNodeCtrl == source) {
        if (event == Event.BACK_EVENT) {
            toolbarPanel.popUpToController(this);
            removeAsListenerAndDispose(childNodeCtrl);
            childNodeCtrl = null;
            loadNodesChildren();
        }
    } else if (entrySearchCtrl == source) {
        if (event.getCommand().equals(RepositoryTableModel.TABLE_ACTION_SELECT_LINK)) {
            // successfully selected a repository entry which will be a link within
            // the current Category
            RepositoryEntry selectedEntry = entrySearchCtrl.getSelectedEntry();
            doAddResource(ureq, selectedEntry);
            fireEvent(ureq, Event.CHANGED_EVENT);
        }
        cmc.deactivate();
        cleanUp();
    } else if (groupCtrl == source) {
        if (event instanceof IdentitiesAddEvent || event instanceof IdentitiesRemoveEvent) {
            doAddRemoveOwners(event);
        }
    } else if (contactCtrl == source) {
        cmc.deactivate();
        cleanUp();
    } else if (dialogDeleteLink == source) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            CatalogEntryRow row = (CatalogEntryRow) dialogDeleteLink.getUserObject();
            catalogManager.deleteCatalogEntry(row, catalogEntry);
            loadResources(ureq);
        }
    } else if (entryResourceMoveCtrl == source) {
        if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            CatalogEntry moveMe = entryResourceMoveCtrl.getMoveMe();
            showInfo("tools.move.catalog.entry.success", moveMe.getName());
            loadResources(ureq);
        }
        cmc.deactivate();
        cleanUp();
    } else if (cmc == source) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : IdentitiesRemoveEvent(org.olat.admin.securitygroup.gui.IdentitiesRemoveEvent) CatalogEntry(org.olat.repository.CatalogEntry) IdentitiesAddEvent(org.olat.admin.securitygroup.gui.IdentitiesAddEvent) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 72 with CatalogEntry

use of org.olat.repository.CatalogEntry in project OpenOLAT by OpenOLAT.

the class CatalogNodeManagerController method doContact.

private void doContact(UserRequest ureq) {
    removeAsListenerAndDispose(cmc);
    removeAsListenerAndDispose(contactCtrl);
    ContactList caretaker = new ContactList(translate("contact.to.groupname.caretaker"));
    List<Identity> owners = new ArrayList<Identity>();
    CatalogEntry parent = catalogEntry;
    while (parent != null && owners.isEmpty()) {
        SecurityGroup parentOwner = parent.getOwnerGroup();
        if (parentOwner != null) {
            owners = securityManager.getIdentitiesOfSecurityGroup(parentOwner);
        }
        parent = parent.getParent();
    }
    for (int i = owners.size(); i-- > 0; ) {
        caretaker.add(owners.get(i));
    }
    // create e-mail Message
    ContactMessage cmsg = new ContactMessage(ureq.getIdentity());
    cmsg.addEmailTo(caretaker);
    contactCtrl = new ContactFormController(ureq, getWindowControl(), true, false, false, cmsg);
    listenTo(contactCtrl);
    // open form in dialog
    cmc = new CloseableModalController(getWindowControl(), "close", contactCtrl.getInitialComponent(), true, translate("contact.caretaker"));
    listenTo(cmc);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) ContactFormController(org.olat.modules.co.ContactFormController) ArrayList(java.util.ArrayList) CatalogEntry(org.olat.repository.CatalogEntry) ContactList(org.olat.core.util.mail.ContactList) Identity(org.olat.core.id.Identity) SecurityGroup(org.olat.basesecurity.SecurityGroup) ContactMessage(org.olat.core.util.mail.ContactMessage)

Example 73 with CatalogEntry

use of org.olat.repository.CatalogEntry in project OpenOLAT by OpenOLAT.

the class OverviewRepositoryListController method doOpenCatalog.

private CatalogNodeController doOpenCatalog(UserRequest ureq) {
    if (!repositoryModule.isCatalogEnabled() || !repositoryModule.isCatalogBrowsingEnabled()) {
        return null;
    }
    cleanUp();
    List<CatalogEntry> entries = catalogManager.getRootCatalogEntries();
    CatalogEntry rootEntry = null;
    if (entries.size() > 0) {
        rootEntry = entries.get(0);
    }
    OLATResourceable ores = OresHelper.createOLATResourceableInstance("Catalog", 0l);
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
    WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl());
    catalogStackPanel = new BreadcrumbedStackedPanel("catstack", getTranslator(), this);
    catalogCtrl = new CatalogNodeController(ureq, bwControl, getWindowControl(), rootEntry, catalogStackPanel, false);
    catalogStackPanel.pushController(translate("search.catalog"), catalogCtrl);
    listenTo(catalogCtrl);
    currentCtrl = catalogCtrl;
    addToHistory(ureq, catalogCtrl);
    mainVC.put("segmentCmp", catalogStackPanel);
    return catalogCtrl;
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) CatalogEntry(org.olat.repository.CatalogEntry) WindowControl(org.olat.core.gui.control.WindowControl) BreadcrumbedStackedPanel(org.olat.core.gui.components.stack.BreadcrumbedStackedPanel) CatalogNodeController(org.olat.repository.ui.catalog.CatalogNodeController)

Example 74 with CatalogEntry

use of org.olat.repository.CatalogEntry in project OpenOLAT by OpenOLAT.

the class CatalogSettingsController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    String catalogPage = velocity_root + "/catalog_info.html";
    catalog = FormLayoutContainer.createCustomFormLayout("info", getTranslator(), catalogPage);
    catalog.setRootForm(mainForm);
    formLayout.add(catalog);
    FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("catalog.path", 0));
    columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("remove", translate("remove"), "remove"));
    List<CatalogEntry> catalogEntries = catalogManager.getCatalogCategoriesFor(entry);
    model = new CategoriesListModel(catalogEntries, columnsModel);
    tableEl = uifactory.addTableElement(getWindowControl(), "table", model, 200, true, getTranslator(), formLayout);
    tableEl.setCustomizeColumns(false);
    tableEl.setVisible(true);
    if (catalogEntries.size() == 0) {
        catalog.contextPut("hasContent", false);
        tableEl.setEmtpyTableMessageKey("no.catalog.entries");
    } else {
        catalog.contextPut("hasContent", true);
    }
}
Also used : CatalogEntry(org.olat.repository.CatalogEntry) FlexiTableColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel) DefaultFlexiColumnModel(org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)

Example 75 with CatalogEntry

use of org.olat.repository.CatalogEntry in project OpenOLAT by OpenOLAT.

the class CatalogSettingsController method doRemove.

private void doRemove(CatalogEntry catEntry) {
    List<CatalogEntry> children = catalogManager.getChildrenOf(catEntry);
    // find all child element of this level that reference our repo entry
    for (CatalogEntry child : children) {
        RepositoryEntry childRepoEntry = child.getRepositoryEntry();
        if (childRepoEntry != null && childRepoEntry.equalsByPersistableKey(entry)) {
            // remove from catalog
            catalogManager.deleteCatalogEntry(child);
        }
    }
    // update table
    updateTable();
}
Also used : CatalogEntry(org.olat.repository.CatalogEntry) RepositoryEntry(org.olat.repository.RepositoryEntry)

Aggregations

CatalogEntry (org.olat.repository.CatalogEntry)122 Test (org.junit.Test)30 CatalogEntryVO (org.olat.restapi.support.vo.CatalogEntryVO)30 URI (java.net.URI)28 HttpResponse (org.apache.http.HttpResponse)28 Identity (org.olat.core.id.Identity)28 ArrayList (java.util.ArrayList)20 Path (javax.ws.rs.Path)18 SecurityGroup (org.olat.basesecurity.SecurityGroup)18 RepositoryEntry (org.olat.repository.RepositoryEntry)18 Produces (javax.ws.rs.Produces)14 HttpPut (org.apache.http.client.methods.HttpPut)12 GET (javax.ws.rs.GET)10 WebApplicationException (javax.ws.rs.WebApplicationException)10 HttpPost (org.apache.http.client.methods.HttpPost)10 OLATResourceable (org.olat.core.id.OLATResourceable)10 ContextEntry (org.olat.core.id.context.ContextEntry)10 LockResult (org.olat.core.util.coordinate.LockResult)10 CatalogManager (org.olat.repository.manager.CatalogManager)8 Link (org.olat.core.gui.components.link.Link)6