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

Merge remote-tracking branch 'origin/OpenOLAT_14.2'

parents b4cd32d6 dfb8dd15
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
*/ */
package org.olat.core.commons.modules.bc.commands; package org.olat.core.commons.modules.bc.commands;
import java.util.List;
import org.olat.core.CoreSpringFactory; import org.olat.core.CoreSpringFactory;
import org.olat.core.commons.editor.htmleditor.HTMLEditorConfig; import org.olat.core.commons.editor.htmleditor.HTMLEditorConfig;
import org.olat.core.commons.modules.bc.components.FolderComponent; import org.olat.core.commons.modules.bc.components.FolderComponent;
...@@ -87,8 +89,16 @@ public class CmdOpenContent extends BasicController implements FolderCommand { ...@@ -87,8 +89,16 @@ public class CmdOpenContent extends BasicController implements FolderCommand {
status = FolderCommandHelper.sanityCheck(wControl, folderComponent); status = FolderCommandHelper.sanityCheck(wControl, folderComponent);
if(status == FolderCommandStatus.STATUS_SUCCESS) { if(status == FolderCommandStatus.STATUS_SUCCESS) {
currentItem = folderComponent.getCurrentContainerChildren().get(Integer.parseInt(pos)); int index = Integer.parseInt(pos);
status = FolderCommandHelper.sanityCheck2(wControl, folderComponent, currentItem); List<VFSItem> children = folderComponent.getCurrentContainerChildren();
if(index >= 0 && index < children.size()) {
currentItem = folderComponent.getCurrentContainerChildren().get(index);
status = FolderCommandHelper.sanityCheck2(wControl, folderComponent, currentItem);
} else {
status = FolderCommandStatus.STATUS_FAILED;
getWindowControl().setError(translator.translate("failed"));
return null;
}
} }
if(status == FolderCommandStatus.STATUS_FAILED) { if(status == FolderCommandStatus.STATUS_FAILED) {
return null; return null;
......
...@@ -267,8 +267,13 @@ public class HighScoreEditController extends FormBasicController { ...@@ -267,8 +267,13 @@ public class HighScoreEditController extends FormBasicController {
config.set(CONFIG_KEY_DATESTART, dateStart.getDate()); config.set(CONFIG_KEY_DATESTART, dateStart.getDate());
config.set(CONFIG_KEY_ANONYMIZE, displayAnonymous.isSelected(0)); config.set(CONFIG_KEY_ANONYMIZE, displayAnonymous.isSelected(0));
if (showListing.isSelected(0)) { if (showListing.isSelected(0)) {
config.set(CONFIG_KEY_BESTONLY, bestOnlyEl.getSelected()); int bestOnly = bestOnlyEl.getSelected();
config.set(CONFIG_KEY_NUMUSER, numTableRows.getIntValue()); config.set(CONFIG_KEY_BESTONLY, bestOnly);
if(bestOnly == 1) {
config.set(CONFIG_KEY_NUMUSER, numTableRows.getIntValue());
} else {
config.remove(CONFIG_KEY_NUMUSER);
}
} }
fireEvent(ureq, Event.DONE_EVENT); fireEvent(ureq, Event.DONE_EVENT);
} }
......
...@@ -801,6 +801,14 @@ public class GTAManagerImpl implements GTAManager { ...@@ -801,6 +801,14 @@ public class GTAManagerImpl implements GTAManager {
.setParameter("taskListKey", taskList.getKey()) .setParameter("taskListKey", taskList.getKey())
.executeUpdate(); .executeUpdate();
StringBuilder taskSb = new StringBuilder(128);
taskSb.append("delete from gtataskrevision as taskrev where taskrev.task.key in (")
.append(" select task.key from gtatask as task where task.taskList.key=:taskListKey)");
numOfDeletedObjects += dbInstance.getCurrentEntityManager()
.createQuery(taskSb.toString())
.setParameter("taskListKey", taskList.getKey())
.executeUpdate();
String deleteTasks = "delete from gtatask as task where task.taskList.key=:taskListKey"; String deleteTasks = "delete from gtatask as task where task.taskList.key=:taskListKey";
numOfDeletedObjects += dbInstance.getCurrentEntityManager().createQuery(deleteTasks) numOfDeletedObjects += dbInstance.getCurrentEntityManager().createQuery(deleteTasks)
.setParameter("taskListKey", taskList.getKey()) .setParameter("taskListKey", taskList.getKey())
......
...@@ -181,9 +181,11 @@ public class AdobeConnectRunController extends BasicController implements Activa ...@@ -181,9 +181,11 @@ public class AdobeConnectRunController extends BasicController implements Activa
} }
private void back() { private void back() {
mainVC.remove(meetingCtrl.getInitialComponent()); if(meetingCtrl != null) {
removeAsListenerAndDispose(meetingCtrl); mainVC.remove(meetingCtrl.getInitialComponent());
meetingCtrl = null; removeAsListenerAndDispose(meetingCtrl);
meetingCtrl = null;
}
} }
private void doOpenMeetings(UserRequest ureq) { private void doOpenMeetings(UserRequest ureq) {
......
...@@ -62,7 +62,12 @@ public class CurriculumElementViewsRowComparator extends FlexiTreeNodeComparator ...@@ -62,7 +62,12 @@ public class CurriculumElementViewsRowComparator extends FlexiTreeNodeComparator
// This case is usually not possible // This case is usually not possible
CurriculumElementWithViewsRow p1 = c1.getParent(); CurriculumElementWithViewsRow p1 = c1.getParent();
CurriculumElementWithViewsRow p2 = c2.getParent(); CurriculumElementWithViewsRow p2 = c2.getParent();
c = compareCurriculumElements(p1, p2); if(p1 == null || p2 == null) {
// reversed because no parent at the top, higher in the hierarchy
c = -compareNullObjects(p1, p2);
} else {
c = compareCurriculumElements(p1, p2);
}
} else { } else {
// This case is usually not possible // This case is usually not possible
c = compareDisplayName(c1, c2); c = compareDisplayName(c1, c2);
......
...@@ -519,6 +519,48 @@ public class GTAManagerTest extends OlatTestCase { ...@@ -519,6 +519,48 @@ public class GTAManagerTest extends OlatTestCase {
Assert.assertEquals(0, deletedAssignedTasks.size()); Assert.assertEquals(0, deletedAssignedTasks.size());
} }
@Test
public void deleteTaskList_withRevisions() {
Identity coach = JunitTestHelper.createAndPersistIdentityAsRndUser("gta-user-29");
Identity participant = JunitTestHelper.createAndPersistIdentityAsRndUser("gta-user-30");
BusinessGroup businessGroup = businessGroupDao.createAndPersist(coach, "gdao", "gdao-rev-delete-desc", -1, -1, false, false, false, false, false);
businessGroupRelationDao.addRole(participant, businessGroup, GroupRole.participant.name());
dbInstance.commit();
RepositoryEntry re = deployGTACourse();
GTACourseNode node = getGTACourseNode(re);
node.getModuleConfiguration().setStringValue(GTACourseNode.GTASK_TYPE, GTAType.group.name());
TaskList tasks = gtaManager.createIfNotExists(re, node);
File taskFile = new File("bg.txt");
Assert.assertNotNull(tasks);
dbInstance.commit();
//select
AssignmentResponse response = gtaManager.selectTask(businessGroup, tasks, node, taskFile, participant);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(response);
//check that there is tasks
List<Task> assignedTasks = gtaManager.getTasks(participant, re, node);
Assert.assertNotNull(assignedTasks);
Assert.assertEquals(1, assignedTasks.size());
// create a revision date
gtaManager.updateTaskRevisionComment(assignedTasks.get(0), TaskProcess.revision, 1, "Hello", coach);
dbInstance.commitAndCloseSession();
//delete
int numOfDeletedObjects = gtaManager.deleteTaskList(re, node);
Assert.assertEquals(3, numOfDeletedObjects);
dbInstance.commitAndCloseSession();
//check that there isn't any tasks
List<Task> deletedAssignedTasks = gtaManager.getTasks(participant, re, node);
Assert.assertNotNull(deletedAssignedTasks);
Assert.assertTrue(deletedAssignedTasks.isEmpty());
}
/** /**
* Create 2 pseudo nodes in a course, and delete the task of the first node * Create 2 pseudo nodes in a course, and delete the task of the first node
* and check that the task of second are always there. * and check that the task of second are always there.
......
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