diff --git a/src/main/java/org/olat/course/nodes/cl/ui/CheckListRunController.java b/src/main/java/org/olat/course/nodes/cl/ui/CheckListRunController.java index 4f685c12f1617d72e90310cd6e0fd2cccf157f4f..2110d61992955b3013decc9fcb54fcf7f24b6d5e 100644 --- a/src/main/java/org/olat/course/nodes/cl/ui/CheckListRunController.java +++ b/src/main/java/org/olat/course/nodes/cl/ui/CheckListRunController.java @@ -314,7 +314,6 @@ public class CheckListRunController extends FormBasicController implements Contr theOne = wrapper.getDbCheckbox(); } - boolean grantPoints = false; if(theOne == null) { //only warning because this happen in course preview logWarn("A checkbox is missing: " + courseOres + " / " + courseNode.getIdent(), null); @@ -325,10 +324,7 @@ public class CheckListRunController extends FormBasicController implements Contr } else { score = 0f; } - if(wrapper.getCheckbox().getPoints() != null) { - grantPoints = true; - } - + checkboxManager.check(theOne, getIdentity(), score, Boolean.valueOf(checked)); //make sure all results is on the database before calculating some scores //manager commit already @@ -337,11 +333,10 @@ public class CheckListRunController extends FormBasicController implements Contr Checkbox checkbox = wrapper.getCheckbox(); logUpdateCheck(checkbox.getCheckboxId(), checkbox.getTitle()); - } exposeUserDataToVC(ureq, flc); - return grantPoints; + return courseNode.hasScoreConfigured() || courseNode.hasPassedConfigured(); } private void logUpdateCheck(String checkboxId, String boxTitle) { diff --git a/src/main/java/org/olat/modules/docpool/manager/DocumentPoolNotificationsHandler.java b/src/main/java/org/olat/modules/docpool/manager/DocumentPoolNotificationsHandler.java index 6619c7f21d6d2fc920f9dca193c8fe695157f01c..8ada07c87de31e8ed19da30123486c0f38da6fad 100644 --- a/src/main/java/org/olat/modules/docpool/manager/DocumentPoolNotificationsHandler.java +++ b/src/main/java/org/olat/modules/docpool/manager/DocumentPoolNotificationsHandler.java @@ -47,9 +47,7 @@ import org.olat.core.logging.Tracing; import org.olat.core.util.FileUtils; import org.olat.core.util.StringHelper; import org.olat.core.util.Util; -import org.olat.core.util.nodes.INode; import org.olat.core.util.tree.TreeVisitor; -import org.olat.core.util.tree.Visitor; import org.olat.core.util.vfs.OlatRelPathImpl; import org.olat.core.util.vfs.VFSContainer; import org.olat.modules.docpool.DocumentPoolModule; @@ -59,6 +57,7 @@ import org.olat.modules.taxonomy.TaxonomyService; import org.olat.modules.taxonomy.manager.TaxonomyTreeBuilder; import org.olat.modules.taxonomy.model.TaxonomyRefImpl; import org.olat.modules.taxonomy.model.TaxonomyTreeNode; +import org.olat.modules.taxonomy.model.TaxonomyTreeNodeType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -122,46 +121,16 @@ public class DocumentPoolNotificationsHandler implements NotificationsHandler { TreeModel model = builder.buildTreeModel(); si = new SubscriptionInfo(subscriber.getKey(), p.getType(), getTitleItemForPublisher(), null); - new TreeVisitor(new Visitor() { - @Override - public void visit(INode node) { - TaxonomyTreeNode tNode = (TaxonomyTreeNode)node; - if(tNode.getTaxonomyLevel() != null && tNode.isDocumentsLibraryEnabled() && tNode.isCanRead()) { - VFSContainer container = taxonomyService.getDocumentsLibrary(tNode.getTaxonomyLevel()); - List<FileInfo> fInfos = FolderManager.getFileInfos(((OlatRelPathImpl)container).getRelPath(), compareDate); - - String prefixBusinessPath = "[DocumentPool:" + taxonomy.getKey() + "][TaxonomyLevel:" + tNode.getTaxonomyLevel().getKey() + "][path="; - for (FileInfo infos:fInfos) { - String title = infos.getRelPath(); - - // don't show changes in meta-directories. first quick check - // for any dot files and then compare with our black list of - // known exclude prefixes - if (title != null && title.indexOf("/.") != -1 && FileUtils.isMetaFilename(title)) { - // skip this file, continue with next item in folder - continue; - } - MetaInfo metaInfo = infos.getMetaInfo(); - String iconCssClass = null; - if (metaInfo != null) { - if (metaInfo.getTitle() != null) { - title += " (" + metaInfo.getTitle() + ")"; - } - iconCssClass = metaInfo.getIconCssClass(); - } - Identity ident = infos.getAuthor(); - Date modDate = infos.getLastModified(); - - String desc = translator.translate("notifications.document.entry", new String[] { title, NotificationHelper.getFormatedName(ident) }); - String urlToSend = null; - String businessPath = null; - if(p.getBusinessPath() != null) { - businessPath = prefixBusinessPath + infos.getRelPath() + "]"; - urlToSend = BusinessControlFactory.getInstance().getURLFromBusinessPathString(businessPath); - } - si.addSubscriptionListItem(new SubscriptionListItem(desc, urlToSend, businessPath, modDate, iconCssClass)); - } - } + new TreeVisitor(node -> { + TaxonomyTreeNode tNode = (TaxonomyTreeNode)node; + if(tNode.getTaxonomyLevel() != null && tNode.isDocumentsLibraryEnabled() && tNode.isCanRead()) { + VFSContainer container = taxonomyService.getDocumentsLibrary(tNode.getTaxonomyLevel()); + String prefixBusinessPath = "[DocumentPool:" + taxonomy.getKey() + "][TaxonomyLevel:" + tNode.getTaxonomyLevel().getKey() + "][path="; + createSubscriptionInfo(container, prefixBusinessPath, compareDate, si, p, translator); + } else if(tNode.getType() == TaxonomyTreeNodeType.templates) { + VFSContainer container = taxonomyService.getDocumentsLibrary(taxonomy); + String prefixBusinessPath = "[DocumentPool:" + taxonomy.getKey() + "][Templates:0s][path="; + createSubscriptionInfo(container, prefixBusinessPath, compareDate, si, p, translator); } }, model.getRootNode(), false).visitAll(); } else { @@ -173,6 +142,40 @@ public class DocumentPoolNotificationsHandler implements NotificationsHandler { return notificationsManager.getNoSubscriptionInfo(); } } + + private void createSubscriptionInfo(VFSContainer container, String prefixBusinessPath, Date compareDate, SubscriptionInfo si, Publisher p, Translator translator) { + List<FileInfo> fInfos = FolderManager.getFileInfos(((OlatRelPathImpl)container).getRelPath(), compareDate); + for (FileInfo infos:fInfos) { + String title = infos.getRelPath(); + + // don't show changes in meta-directories. first quick check + // for any dot files and then compare with our black list of + // known exclude prefixes + if (title != null && title.indexOf("/.") != -1 && FileUtils.isMetaFilename(title)) { + // skip this file, continue with next item in folder + continue; + } + MetaInfo metaInfo = infos.getMetaInfo(); + String iconCssClass = null; + if (metaInfo != null) { + if (metaInfo.getTitle() != null) { + title += " (" + metaInfo.getTitle() + ")"; + } + iconCssClass = metaInfo.getIconCssClass(); + } + Identity ident = infos.getAuthor(); + Date modDate = infos.getLastModified(); + + String desc = translator.translate("notifications.document.entry", new String[] { title, NotificationHelper.getFormatedName(ident) }); + String urlToSend = null; + String businessPath = null; + if(p.getBusinessPath() != null) { + businessPath = prefixBusinessPath + infos.getRelPath() + "]"; + urlToSend = BusinessControlFactory.getInstance().getURLFromBusinessPathString(businessPath); + } + si.addSubscriptionListItem(new SubscriptionListItem(desc, urlToSend, businessPath, modDate, iconCssClass)); + } + } @Override public String createTitleInfo(Subscriber subscriber, Locale locale) { diff --git a/src/main/java/org/olat/modules/taxonomy/model/TaxonomyTreeNode.java b/src/main/java/org/olat/modules/taxonomy/model/TaxonomyTreeNode.java index 12b0a77c45d616b44f6034b8dd4df1d3590b2f40..d0b08d08434122edf7f4006b122b1dab86a19d2c 100644 --- a/src/main/java/org/olat/modules/taxonomy/model/TaxonomyTreeNode.java +++ b/src/main/java/org/olat/modules/taxonomy/model/TaxonomyTreeNode.java @@ -80,7 +80,6 @@ public class TaxonomyTreeNode extends GenericTreeNode { return taxonomyLevel != null && taxonomyLevel.getType() != null && taxonomyLevel.getType().isDocumentsLibraryEnabled() && (taxonomyLevel.getType().isDocumentsLibraryManageCompetenceEnabled() - || taxonomyLevel.getType().isDocumentsLibraryTeachCompetenceReadEnabled() || taxonomyLevel.getType().isDocumentsLibraryTeachCompetenceReadEnabled() || taxonomyLevel.getType().isDocumentsLibraryHaveCompetenceReadEnabled() || taxonomyLevel.getType().isDocumentsLibraryTargetCompetenceReadEnabled());