Search in sources :

Example 26 with EntryChangedEvent

use of org.olat.repository.controllers.EntryChangedEvent in project openolat by klemens.

the class RepositoryEntryRuntimeController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (cmc == source) {
        cleanUp();
    } else if (source == accessController) {
        if (event.equals(AccessEvent.ACCESS_OK_EVENT)) {
            doPostSuccessfullAccess(ureq);
        } else if (event.equals(AccessEvent.ACCESS_FAILED_EVENT)) {
            String msg = ((AccessEvent) event).getMessage();
            if (StringHelper.containsNonWhitespace(msg)) {
                getWindowControl().setError(msg);
            } else {
                showError("error.accesscontrol");
            }
        }
    } else if (accessCtrl == source) {
        if (event == Event.CHANGED_EVENT) {
            refreshRepositoryEntry(accessCtrl.getEntry());
            if (ordersLink != null) {
                boolean booking = acService.isResourceAccessControled(re.getOlatResource(), null);
                ordersLink.setVisible(!corrupted && booking);
            }
        } else if (event == Event.CLOSE_EVENT) {
            doClose(ureq);
        }
    } else if (descriptionCtrl == source) {
        if (event == Event.CHANGED_EVENT) {
            RepositoryEntry entry = descriptionCtrl.getEntry();
            refreshRepositoryEntry(entry);
            handler.onDescriptionChanged(entry);
            // update name of root bread crumb and opened tabs in top nav in case the title has been modified
            if (toolbarPanel.getBreadCrumbs().size() > 0) {
                String newTitle = entry.getDisplayname();
                String oldTitle = toolbarPanel.getBreadCrumbs().get(0).getCustomDisplayText();
                if (!newTitle.equals(oldTitle)) {
                    // 1: update breadcrumb in toolbar
                    toolbarPanel.getBreadCrumbs().get(0).setCustomDisplayText(newTitle);
                    // 2: update dynamic tab in topnav
                    OLATResourceable reOres = OresHelper.clone(entry);
                    getWindowControl().getWindowBackOffice().getWindow().getDTabs().updateDTabTitle(reOres, newTitle);
                }
            }
        } else if (event == Event.CLOSE_EVENT) {
            doClose(ureq);
        }
    } else if (detailsCtrl == source) {
        if (event instanceof LeavingEvent) {
            doClose(ureq);
        } else if (event == Event.DONE_EVENT) {
            popToRoot(ureq);
            cleanUp();
            if (getRuntimeController() == null) {
                doRun(ureq, reSecurity);
            }
        }
    } else if (confirmDeleteCtrl == source) {
        if (event == Event.CANCELLED_EVENT) {
            cmc.deactivate();
            removeAsListenerAndDispose(confirmDeleteCtrl);
            removeAsListenerAndDispose(cmc);
            confirmDeleteCtrl = null;
            cmc = null;
        } else if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            cmc.deactivate();
            EntryChangedEvent e = new EntryChangedEvent(getRepositoryEntry(), getIdentity(), Change.deleted, "runtime");
            ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, RepositoryService.REPOSITORY_EVENT_ORES);
            doClose(ureq);
            cleanUp();
        }
    } else if (copyCtrl == source) {
        cmc.deactivate();
        if (event == Event.DONE_EVENT) {
            RepositoryEntryRef copy = copyCtrl.getCopiedEntry();
            String businessPath = "[RepositoryEntry:" + copy.getKey() + "][EditDescription:0]";
            NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
            EntryChangedEvent e = new EntryChangedEvent(getRepositoryEntry(), getIdentity(), Change.added, "runtime");
            ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, RepositoryService.REPOSITORY_EVENT_ORES);
        }
        cleanUp();
    }
}
Also used : LeavingEvent(org.olat.repository.ui.list.LeavingEvent) AccessEvent(org.olat.resource.accesscontrol.ui.AccessEvent) OLATResourceable(org.olat.core.id.OLATResourceable) EntryChangedEvent(org.olat.repository.controllers.EntryChangedEvent) RepositoryEntry(org.olat.repository.RepositoryEntry) RepositoryEntryRef(org.olat.repository.RepositoryEntryRef)

Example 27 with EntryChangedEvent

use of org.olat.repository.controllers.EntryChangedEvent in project openolat by klemens.

the class ConfirmCloseController method setReadOnlyEntries.

private boolean setReadOnlyEntries(UserRequest ureq, List<RepositoryEntry> entries) {
    boolean allOk = true;
    for (RepositoryEntry entry : entries) {
        RepositoryEntry reloadedEntry = repositoryService.loadByKey(entry.getKey());
        if (reloadedEntry != null) {
            repositoryService.closeRepositoryEntry(reloadedEntry);
            ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.LEARNING_RESOURCE_DEACTIVATE, getClass(), LoggingResourceable.wrap(reloadedEntry, OlatResourceableType.genRepoEntry));
            fireEvent(ureq, new EntryChangedEvent(reloadedEntry, getIdentity(), Change.closed, "closed"));
        }
    }
    return allOk;
}
Also used : EntryChangedEvent(org.olat.repository.controllers.EntryChangedEvent) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 28 with EntryChangedEvent

use of org.olat.repository.controllers.EntryChangedEvent in project openolat by klemens.

the class ConfirmDeleteSoftlyController method deleteEntries.

private boolean deleteEntries(UserRequest ureq, List<RepositoryEntry> entries) {
    boolean allOk = true;
    for (RepositoryEntry entry : entries) {
        RepositoryEntry reloadedEntry = repositoryService.loadByKey(entry.getKey());
        if (reloadedEntry != null) {
            reloadedEntry = repositoryService.deleteSoftly(reloadedEntry, getIdentity(), false);
            ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.LEARNING_RESOURCE_TRASH, getClass(), LoggingResourceable.wrap(reloadedEntry, OlatResourceableType.genRepoEntry));
            EntryChangedEvent e = new EntryChangedEvent(reloadedEntry, getIdentity(), Change.deleted, "delete");
            ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, RepositoryService.REPOSITORY_EVENT_ORES);
        }
    }
    return allOk;
}
Also used : EntryChangedEvent(org.olat.repository.controllers.EntryChangedEvent) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 29 with EntryChangedEvent

use of org.olat.repository.controllers.EntryChangedEvent in project openolat by klemens.

the class ConfirmRestoreController method doCompleteRestore.

private void doCompleteRestore(UserRequest ureq) {
    for (RepositoryEntry entry : rows) {
        RepositoryEntry reloadedEntry = repositoryService.loadByKey(entry.getKey());
        if (reloadedEntry != null) {
            repositoryService.restoreRepositoryEntry(reloadedEntry);
            ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.LEARNING_RESOURCE_RESTORE, getClass(), LoggingResourceable.wrap(reloadedEntry, OlatResourceableType.genRepoEntry));
            fireEvent(ureq, new EntryChangedEvent(reloadedEntry, getIdentity(), Change.restored, "restored"));
        }
    }
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : EntryChangedEvent(org.olat.repository.controllers.EntryChangedEvent) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 30 with EntryChangedEvent

use of org.olat.repository.controllers.EntryChangedEvent in project openolat by klemens.

the class CreateRepositoryEntryController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    doCreate();
    fireEvent(ureq, Event.DONE_EVENT);
    fireEvent(ureq, new EntryChangedEvent(addedEntry, getIdentity(), Change.added, "create"));
}
Also used : EntryChangedEvent(org.olat.repository.controllers.EntryChangedEvent)

Aggregations

EntryChangedEvent (org.olat.repository.controllers.EntryChangedEvent)32 RepositoryEntry (org.olat.repository.RepositoryEntry)12 MultiUserEvent (org.olat.core.util.event.MultiUserEvent)10 OLATResourceable (org.olat.core.id.OLATResourceable)8 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 List (java.util.List)2 LicenseType (org.olat.core.commons.services.license.LicenseType)2 StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)2 Roles (org.olat.core.id.Roles)2 LocalFileImpl (org.olat.core.util.vfs.LocalFileImpl)2 LocalFolderImpl (org.olat.core.util.vfs.LocalFolderImpl)2 VFSContainer (org.olat.core.util.vfs.VFSContainer)2 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)2 BusinessGroup (org.olat.group.BusinessGroup)2 BusinessGroupSelectionEvent (org.olat.group.model.BusinessGroupSelectionEvent)2 ExportFormatOptions (org.olat.modules.qpool.ExportFormatOptions)2 QuestionItemShort (org.olat.modules.qpool.QuestionItemShort)2 QItemList (org.olat.modules.qpool.model.QItemList)2