diff --git a/src/main/java/org/olat/course/editor/PublishProcess.java b/src/main/java/org/olat/course/editor/PublishProcess.java index 75d68b95d17bfd4a1fd2124f87a15c77149d1f12..0b59b5c73ec586317f8e6f6853630fac2068feb1 100644 --- a/src/main/java/org/olat/course/editor/PublishProcess.java +++ b/src/main/java/org/olat/course/editor/PublishProcess.java @@ -75,6 +75,7 @@ import org.olat.properties.Property; import org.olat.repository.CatalogEntry; import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryManager; +import org.olat.repository.RepositoryService; import org.olat.repository.controllers.EntryChangedEvent; import org.olat.repository.controllers.EntryChangedEvent.Change; import org.olat.repository.manager.CatalogManager; @@ -727,6 +728,7 @@ public class PublishProcess { MultiUserEvent modifiedEvent = new EntryChangedEvent(repositoryEntry, author, Change.modifiedAtPublish, "publish"); CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, repositoryEntry); + CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, RepositoryService.REPOSITORY_EVENT_ORES); } diff --git a/src/main/java/org/olat/repository/ui/author/AuthorListController.java b/src/main/java/org/olat/repository/ui/author/AuthorListController.java index b3b44ab1148d2d9201a569561dae19750c6c32d3..9cdc87ca34d84884ea059c1ad730364bbadaea12 100644 --- a/src/main/java/org/olat/repository/ui/author/AuthorListController.java +++ b/src/main/java/org/olat/repository/ui/author/AuthorListController.java @@ -656,7 +656,7 @@ public class AuthorListController extends FormBasicController implements Activat } protected void reloadDirtyRows() { - if(dirtyRows.size() > 0) { + if(!dirtyRows.isEmpty() && model.isAuthoringEntryRowLoaded(dirtyRows)) { reloadRows(); } } diff --git a/src/main/java/org/olat/repository/ui/author/AuthoringEditAccessController.java b/src/main/java/org/olat/repository/ui/author/AuthoringEditAccessController.java index f935f040ba40ba71db7787739e758424e55f403f..14cb837d70ec6864575406c4cf8015c5b08e9b93 100644 --- a/src/main/java/org/olat/repository/ui/author/AuthoringEditAccessController.java +++ b/src/main/java/org/olat/repository/ui/author/AuthoringEditAccessController.java @@ -135,7 +135,8 @@ public class AuthoringEditAccessController extends BasicController { // 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, entry); + CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(modifiedEvent, RepositoryService.REPOSITORY_EVENT_ORES); fireEvent(ureq, Event.CHANGED_EVENT); } } @@ -149,6 +150,7 @@ public class AuthoringEditAccessController extends BasicController { } 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); } } diff --git a/src/main/java/org/olat/repository/ui/author/AuthoringEntryDataModel.java b/src/main/java/org/olat/repository/ui/author/AuthoringEntryDataModel.java index 45a4ef7abce4eac6a77ebe91be2b2cc80eac02df..2ffbb255acb4e7ee7a32a658bae27ce053f08a74 100644 --- a/src/main/java/org/olat/repository/ui/author/AuthoringEntryDataModel.java +++ b/src/main/java/org/olat/repository/ui/author/AuthoringEntryDataModel.java @@ -19,6 +19,9 @@ */ package org.olat.repository.ui.author; +import java.util.ArrayList; +import java.util.List; + import org.olat.core.CoreSpringFactory; import org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableDataSourceModel; import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel; @@ -46,6 +49,26 @@ class AuthoringEntryDataModel extends DefaultFlexiTableDataSourceModel<Authoring public DefaultFlexiTableDataSourceModel<AuthoringEntryRow> createCopyWithEmptyList() { return new AuthoringEntryDataModel(getSourceDelegate(), getTableColumnModel()); } + + public boolean isAuthoringEntryRowLoaded(List<Long> repoEntryKeys) { + if(repoEntryKeys == null || repoEntryKeys.isEmpty()) return false; + for(Long repoEntryKey:repoEntryKeys) { + if(isAuthoringEntryRowLoaded(repoEntryKey)) { + return true; + } + } + return false; + } + + public boolean isAuthoringEntryRowLoaded(Long repoEntryKey) { + List<AuthoringEntryRow> copyOfObjects = new ArrayList<>(getObjects()); + for(AuthoringEntryRow row:copyOfObjects) { + if(row != null && row.getKey().equals(repoEntryKey)) { + return true; + } + } + return false; + } @Override public AuthoringEntryDataSource getSourceDelegate() { diff --git a/src/main/java/org/olat/repository/ui/author/OverviewAuthoringController.java b/src/main/java/org/olat/repository/ui/author/OverviewAuthoringController.java index 1a7be95e200134a5429153bdf5b8c9fc1b23b432..b91bede5068e11fa22e69199b1c895febb29ff80 100644 --- a/src/main/java/org/olat/repository/ui/author/OverviewAuthoringController.java +++ b/src/main/java/org/olat/repository/ui/author/OverviewAuthoringController.java @@ -41,6 +41,7 @@ import org.olat.core.id.context.StateEntry; import org.olat.core.logging.activity.ThreadLocalUserActivityLogger; import org.olat.core.util.UserSession; import org.olat.core.util.Util; +import org.olat.core.util.coordinate.CoordinatorManager; import org.olat.core.util.event.EventBus; import org.olat.core.util.event.GenericEventListener; import org.olat.core.util.resource.OresHelper; @@ -101,21 +102,25 @@ public class OverviewAuthoringController extends BasicController implements Acti eventBus = ureq.getUserSession().getSingleUserEventCenter(); eventBus.registerFor(this, getIdentity(), RepositoryService.REPOSITORY_EVENT_ORES); - + + CoordinatorManager.getInstance().getCoordinator().getEventBus().registerFor(this, getIdentity(), RepositoryService.REPOSITORY_EVENT_ORES); putInitialPanel(mainPanel); } @Override protected void doDispose() { eventBus.deregisterFor(this, RepositoryService.REPOSITORY_EVENT_ORES); + CoordinatorManager.getInstance().getCoordinator().getEventBus().deregisterFor(this, RepositoryService.REPOSITORY_EVENT_ORES); } @Override public void event(Event event) { if(EntryChangedEvent.CHANGE_CMD.equals(event.getCommand()) && event instanceof EntryChangedEvent) { EntryChangedEvent ece = (EntryChangedEvent)event; - if(ece.getChange() == Change.addBookmark || ece.getChange() == Change.removeBookmark - || ece.getChange() == Change.added || ece.getChange() == Change.deleted) { + if(ece.getChange() == Change.addBookmark + || ece.getChange() == Change.removeBookmark + || ece.getChange() == Change.added + || ece.getChange() == Change.deleted) { if(markedCtrl != null && !markedCtrl.getI18nName().equals(ece.getSource())) { favoritDirty = true; } @@ -125,6 +130,18 @@ public class OverviewAuthoringController extends BasicController implements Acti if(deletedEntriesCtrl != null && !deletedEntriesCtrl.getI18nName().equals(ece.getSource())) { deletedDirty = true; } + } else if(ece.getChange() == Change.modifiedAccess + || ece.getChange() == Change.modifiedAtPublish + || ece.getChange() == Change.modifiedDescription) { + if(markedCtrl != null) { + markedCtrl.addDirtyRows(ece.getRepositoryEntryKey()); + } + if(myEntriesCtrl != null) { + myEntriesCtrl.addDirtyRows(ece.getRepositoryEntryKey()); + } + if(deletedEntriesCtrl != null) { + deletedEntriesCtrl.addDirtyRows(ece.getRepositoryEntryKey()); + } } } } @@ -148,9 +165,13 @@ public class OverviewAuthoringController extends BasicController implements Acti } if(favoritDirty && markedCtrl != null) { markedCtrl.reloadRows(); + } else if(markedCtrl != null) { + markedCtrl.reloadDirtyRows(); } if(myDirty && myEntriesCtrl != null) { myEntriesCtrl.reloadRows(); + } else if(myEntriesCtrl != null) { + myEntriesCtrl.reloadDirtyRows(); } addToHistory(ureq, currentCtrl); } else { @@ -215,6 +236,8 @@ public class OverviewAuthoringController extends BasicController implements Acti listenTo(markedCtrl); } else if(favoritDirty) { markedCtrl.reloadRows(); + } else { + markedCtrl.reloadDirtyRows(); } favoritDirty = false; @@ -237,6 +260,8 @@ public class OverviewAuthoringController extends BasicController implements Acti listenTo(myEntriesCtrl); } else if(myDirty) { myEntriesCtrl.reloadRows(); + } else { + myEntriesCtrl.reloadDirtyRows(); } myDirty = false; @@ -281,6 +306,8 @@ public class OverviewAuthoringController extends BasicController implements Acti listenTo(deletedEntriesCtrl); } else if(deletedDirty) { deletedEntriesCtrl.reloadRows(); + } else { + deletedEntriesCtrl.reloadDirtyRows(); } deletedDirty = false; diff --git a/src/main/java/org/olat/repository/ui/author/RepositoryEditDescriptionController.java b/src/main/java/org/olat/repository/ui/author/RepositoryEditDescriptionController.java index 214b031b36391160f68630a2880439a09766273e..728bc47ed6cbd34d268751a2d835b2c8f4a43136 100644 --- a/src/main/java/org/olat/repository/ui/author/RepositoryEditDescriptionController.java +++ b/src/main/java/org/olat/repository/ui/author/RepositoryEditDescriptionController.java @@ -55,6 +55,8 @@ import org.olat.core.gui.control.WindowControl; import org.olat.core.util.FileUtils; import org.olat.core.util.StringHelper; import org.olat.core.util.WebappHelper; +import org.olat.core.util.coordinate.CoordinatorManager; +import org.olat.core.util.event.MultiUserEvent; import org.olat.core.util.vfs.LocalFileImpl; import org.olat.core.util.vfs.LocalFolderImpl; import org.olat.core.util.vfs.VFSContainer; @@ -64,6 +66,8 @@ import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntryManagedFlag; import org.olat.repository.RepositoryManager; import org.olat.repository.RepositoryService; +import org.olat.repository.controllers.EntryChangedEvent; +import org.olat.repository.controllers.EntryChangedEvent.Change; import org.olat.repository.handlers.RepositoryHandler; import org.olat.repository.handlers.RepositoryHandlerFactory; import org.olat.repository.manager.RepositoryEntryLifecycleDAO; @@ -580,6 +584,9 @@ public class RepositoryEditDescriptionController extends FormBasicController { fireEvent(ureq, Event.CLOSE_EVENT); } else { fireEvent(ureq, Event.CHANGED_EVENT); + MultiUserEvent modifiedEvent = new EntryChangedEvent(repositoryEntry, getIdentity(), Change.modifiedDescription, "authoring"); + CoordinatorManager.getInstance().getCoordinator().getEventBus() + .fireEventToListenersOf(modifiedEvent, RepositoryService.REPOSITORY_EVENT_ORES); } }