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();
}
}
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;
}
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;
}
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);
}
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"));
}
Aggregations