use of org.olat.repository.controllers.EntryChangedEvent in project openolat by klemens.
the class AuthoringEditAccessController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == propPupForm) {
if (event == Event.DONE_EVENT) {
// inform user about inconsistent configuration: doesn't make sense to set a repositoryEntry canReference=true if it is only accessible to owners
if (!entry.getCanReference() && propPupForm.canReference() && (propPupForm.getAccess() < RepositoryEntry.ACC_OWNERS_AUTHORS && !propPupForm.isMembersOnly())) {
showError("warn.config.reference.no.access");
}
int access = propPupForm.getAccess();
int numOfBookingConfigs = acCtr.getNumOfBookingConfigurations();
entry = repositoryManager.setAccessAndProperties(entry, access, propPupForm.isMembersOnly(), propPupForm.canCopy(), propPupForm.canReference(), propPupForm.canDownload());
if (entry == null) {
showWarning("repositoryentry.not.existing");
fireEvent(ureq, Event.CLOSE_EVENT);
} else {
boolean managedBookings = RepositoryEntryManagedFlag.isManaged(entry, RepositoryEntryManagedFlag.bookings);
if (access == RepositoryEntry.ACC_USERS || access == RepositoryEntry.ACC_USERS_GUESTS) {
if ((!managedBookings && acModule.isEnabled()) || numOfBookingConfigs > 0) {
editproptabpubVC.put("accesscontrol", acCtr.getInitialComponent());
editproptabpubVC.contextPut("isGuestAccess", Boolean.valueOf(access == RepositoryEntry.ACC_USERS_GUESTS));
}
} else {
editproptabpubVC.remove(acCtr.getInitialComponent());
}
// inform anybody interested about this change
MultiUserEvent modifiedEvent = new EntryChangedEvent(entry, getIdentity(), Change.modifiedAccess, "authoring");
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, entry);
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, RepositoryService.REPOSITORY_EVENT_ORES);
fireEvent(ureq, Event.CHANGED_EVENT);
}
}
} else if (source == leaveForm) {
if (event == Event.DONE_EVENT) {
RepositoryEntryAllowToLeaveOptions leaveSetting = leaveForm.getSelectedLeaveSetting();
entry = repositoryManager.setLeaveSetting(entry, leaveSetting);
if (entry == null) {
showWarning("repositoryentry.not.existing");
fireEvent(ureq, Event.CLOSE_EVENT);
} else {
MultiUserEvent modifiedEvent = new EntryChangedEvent(entry, getIdentity(), Change.modifiedAccess, "authorings");
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, entry);
CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, RepositoryService.REPOSITORY_EVENT_ORES);
fireEvent(ureq, Event.CHANGED_EVENT);
}
}
} else if (acCtr == source) {
if (event == Event.CHANGED_EVENT) {
fireEvent(ureq, Event.CHANGED_EVENT);
}
}
}
use of org.olat.repository.controllers.EntryChangedEvent in project openolat by klemens.
the class ConfirmDeletePermanentlyController method deleteEntries.
private boolean deleteEntries(UserRequest ureq, List<RepositoryEntry> entries, List<ErrorList> errorList) {
boolean allOk = true;
Roles roles = ureq.getUserSession().getRoles();
for (RepositoryEntry entry : entries) {
RepositoryEntry reloadedEntry = repositoryService.loadByKey(entry.getKey());
if (reloadedEntry != null) {
ErrorList errors = repositoryService.deletePermanently(reloadedEntry, getIdentity(), roles, getLocale());
ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.LEARNING_RESOURCE_DELETE, getClass(), LoggingResourceable.wrap(reloadedEntry, OlatResourceableType.genRepoEntry));
if (errors.hasErrors()) {
allOk = false;
errorList.add(errors);
} else {
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 OpenOLAT.
the class RepositoryEntryListController method doMark.
protected boolean doMark(UserRequest ureq, RepositoryEntryRow row) {
OLATResourceable item = OresHelper.createOLATResourceableInstance("RepositoryEntry", row.getKey());
if (markManager.isMarked(item, getIdentity(), null)) {
markManager.removeMark(item, getIdentity(), null);
EntryChangedEvent e = new EntryChangedEvent(row, getIdentity(), Change.removeBookmark, name);
ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, RepositoryService.REPOSITORY_EVENT_ORES);
return false;
} else {
String businessPath = "[RepositoryEntry:" + item.getResourceableId() + "]";
markManager.setMark(item, getIdentity(), null, businessPath);
EntryChangedEvent e = new EntryChangedEvent(row, getIdentity(), Change.addBookmark, name);
ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, RepositoryService.REPOSITORY_EVENT_ORES);
return true;
}
}
use of org.olat.repository.controllers.EntryChangedEvent in project OpenOLAT by OpenOLAT.
the class ConfirmDeletePermanentlyController method deleteEntries.
private boolean deleteEntries(UserRequest ureq, List<RepositoryEntry> entries, List<ErrorList> errorList) {
boolean allOk = true;
Roles roles = ureq.getUserSession().getRoles();
for (RepositoryEntry entry : entries) {
RepositoryEntry reloadedEntry = repositoryService.loadByKey(entry.getKey());
if (reloadedEntry != null) {
ErrorList errors = repositoryService.deletePermanently(reloadedEntry, getIdentity(), roles, getLocale());
ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.LEARNING_RESOURCE_DELETE, getClass(), LoggingResourceable.wrap(reloadedEntry, OlatResourceableType.genRepoEntry));
if (errors.hasErrors()) {
allOk = false;
errorList.add(errors);
} else {
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 OpenOLAT.
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);
}
Aggregations