Skip to content
Snippets Groups Projects
Commit d1b42451 authored by srosse's avatar srosse
Browse files

Merge OpenOLAT 10.4 to OpenOLAT 10.5 with e10a530757704a73b422f59b61abbbc263f60649

parents e71cc6c2 d08342e1
No related branches found
No related tags found
No related merge requests found
......@@ -135,6 +135,7 @@ import org.olat.repository.RepositoryEntry;
import org.olat.repository.RepositoryManager;
import org.olat.repository.RepositoryService;
import org.olat.resource.references.Reference;
import org.olat.resource.references.ReferenceManager;
import org.olat.user.UserManager;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -266,6 +267,8 @@ public class QTIEditorMainController extends MainLayoutBasicController implement
@Autowired
private RepositoryManager repositoryManager;
@Autowired
private ReferenceManager referenceManager;
@Autowired
private RepositoryService repositoryService;
@Autowired
private QTIQPoolServiceProvider qtiQpoolServiceProvider;
......@@ -279,18 +282,27 @@ public class QTIEditorMainController extends MainLayoutBasicController implement
try {
ICourse course = CourseFactory.loadCourse(ref.getSource().getResourceableId());
CourseNode courseNode = course.getEditorTreeModel().getCourseNode(ref.getUserdata());
String repositorySoftKey = (String) courseNode.getModuleConfiguration().get(IQEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
//check softly that the setting if ok
if(qtiEntry.getSoftkey().equals(repositorySoftKey)) {
restrictedEdit = ((CoordinatorManager.getInstance().getCoordinator().getLocker().isLocked(course, null))
|| qtiResultManager.countResults(course.getResourceableId(), courseNode.getIdent(), qtiEntry.getKey()) > 0) ? true : false;
if(courseNode == null) {
courseNode = course.getRunStructure().getNode(ref.getUserdata());
}
if(courseNode == null) {
referenceManager.delete(ref);
} else {
logError("The course node soft key doesn't match the test/survey sotf key. Course resourceable id: "
+ course.getResourceableId() + " (" + course.getCourseTitle() + ") course node: " + courseNode.getIdent() + " (" + courseNode.getShortTitle() + " )"
+ " soft key of test/survey in course: " + repositorySoftKey + " test/survey soft key: " + qtiEntry.getSoftkey(), null);
String repositorySoftKey = (String) courseNode.getModuleConfiguration().get(IQEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
//check softly that the setting if ok
if(qtiEntry.getSoftkey().equals(repositorySoftKey)) {
restrictedEdit = ((CoordinatorManager.getInstance().getCoordinator().getLocker().isLocked(course, null))
|| qtiResultManager.countResults(course.getResourceableId(), courseNode.getIdent(), qtiEntry.getKey()) > 0) ? true : false;
} else {
logError("The course node soft key doesn't match the test/survey sotf key. Course resourceable id: "
+ course.getResourceableId() + " (" + course.getCourseTitle() + ") course node: " + courseNode.getIdent() + " (" + courseNode.getShortTitle() + " )"
+ " soft key of test/survey in course: " + repositorySoftKey + " test/survey soft key: " + qtiEntry.getSoftkey(), null);
}
}
} catch(CorruptedCourseException e) {
logError("", e);
referenceManager.delete(ref);
}
}
if(restrictedEdit) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment