use of org.olat.course.nodes.gta.model.TaskDefinition in project openolat by klemens.
the class AbstractAssignmentEditController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (addTaskCtrl == source) {
if (event == Event.DONE_EVENT) {
TaskDefinition newTask = addTaskCtrl.getTask();
gtaManager.addTaskDefinition(newTask, courseEnv, gtaNode);
fireEvent(ureq, Event.DONE_EVENT);
updateModel();
notificationsManager.markPublisherNews(subscriptionContext, null, false);
}
cmc.deactivate();
cleanUp();
// fireEvent(ureq, Event.DONE_EVENT);
} else if (editTaskCtrl == source) {
if (event == Event.DONE_EVENT) {
doFinishReplacementOfTask(editTaskCtrl.getFilenameToReplace(), editTaskCtrl.getTask());
updateModel();
// fireEvent(ureq, Event.DONE_EVENT);
notificationsManager.markPublisherNews(subscriptionContext, null, false);
}
cmc.deactivate();
cleanUp();
} else if (newTaskCtrl == source) {
TaskDefinition newTask = newTaskCtrl.getTaskDefinition();
cmc.deactivate();
cleanUp();
if (event == Event.DONE_EVENT) {
gtaManager.addTaskDefinition(newTask, courseEnv, gtaNode);
doCreateTaskEditor(ureq, newTask);
updateModel();
}
} else if (newTaskEditorCtrl == source) {
if (event == Event.DONE_EVENT) {
updateModel();
// fireEvent(ureq, Event.DONE_EVENT);
notificationsManager.markPublisherNews(subscriptionContext, null, false);
}
cmc.deactivate();
cleanUp();
} else if (editTaskEditorCtrl == source) {
if (event == Event.DONE_EVENT) {
gtaManager.updateTaskDefinition(null, editTaskEditorCtrl.getTask(), courseEnv, gtaNode);
updateModel();
// fireEvent(ureq, Event.DONE_EVENT);
notificationsManager.markPublisherNews(subscriptionContext, null, false);
}
cmc.deactivate();
cleanUp();
} else if (confirmDeleteCtrl == source) {
if (DialogBoxUIFactory.isOkEvent(event) || DialogBoxUIFactory.isYesEvent(event)) {
TaskDefinition row = (TaskDefinition) confirmDeleteCtrl.getUserObject();
doDelete(ureq, row);
}
cleanUp();
} else if (cmc == source) {
cleanUp();
}
super.event(ureq, source, event);
}
use of org.olat.course.nodes.gta.model.TaskDefinition in project openolat by klemens.
the class AbstractAssignmentEditController method doReplaceTask.
private void doReplaceTask(UserRequest ureq, TaskDefinition taskDef) {
List<TaskDefinition> currentDefinitions = gtaManager.getTaskDefinitions(courseEnv, gtaNode);
editTaskCtrl = new EditTaskController(ureq, getWindowControl(), taskDef, tasksFolder, currentDefinitions);
listenTo(editTaskCtrl);
String title = translate("edit.task");
cmc = new CloseableModalController(getWindowControl(), null, editTaskCtrl.getInitialComponent(), true, title, false);
listenTo(cmc);
cmc.activate();
}
use of org.olat.course.nodes.gta.model.TaskDefinition in project openolat by klemens.
the class GTAParticipantController method getTaskDefinition.
private TaskDefinition getTaskDefinition(Task task) {
if (task == null)
return null;
TaskDefinition taskDef = null;
List<TaskDefinition> availableTasks = gtaManager.getTaskDefinitions(courseEnv, gtaNode);
for (TaskDefinition availableTask : availableTasks) {
if (availableTask.getFilename() != null && availableTask.getFilename().equals(task.getTaskName())) {
taskDef = availableTask;
break;
}
}
return taskDef;
}
use of org.olat.course.nodes.gta.model.TaskDefinition in project openolat by klemens.
the class TaskDefinitionTableModel method getValueAt.
@Override
public Object getValueAt(int row, int col) {
TaskDefinitionRow taskDefRow = getObject(row);
TaskDefinition taskDef = taskDefRow.getTaskDefinition();
switch(TDCols.values()[col]) {
case title:
return taskDef.getTitle();
case file:
return taskDefRow.getDownloadLink() == null ? taskDef.getFilename() : taskDefRow.getDownloadLink();
case edit:
return taskDef.getFilename().endsWith(".html");
default:
return "ERROR";
}
}
use of org.olat.course.nodes.gta.model.TaskDefinition in project OpenOLAT by OpenOLAT.
the class GTAAvailableTaskController method loadModel.
private void loadModel() {
File taskFolder = gtaManager.getTasksDirectory(courseEnv, gtaNode);
List<AvailableTask> availableTasks = new ArrayList<>(taskDefs.size());
List<String> usedSlotes;
if (GTACourseNode.GTASK_SAMPLING_UNIQUE.equals(gtaNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_SAMPLING))) {
usedSlotes = gtaManager.getAssignedTasks(taskList);
} else {
usedSlotes = Collections.emptyList();
}
for (TaskDefinition taskDef : taskDefs) {
String filename = taskDef.getFilename();
if (usedSlotes.contains(filename)) {
continue;
}
FormLink descriptionLink = null;
if (StringHelper.containsNonWhitespace(taskDef.getDescription())) {
descriptionLink = uifactory.addFormLink("preview-" + CodeHelper.getRAMUniqueID(), "description", "task.description", null, flc, Link.LINK);
descriptionLink.setIconLeftCSS("o_icon o_icon_description");
}
FormItem download = null;
boolean preview = gtaNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_PREVIEW);
if (preview) {
if (taskDef.getFilename().endsWith(".html")) {
download = uifactory.addFormLink("prev-html-" + CodeHelper.getRAMUniqueID(), "preview-html", filename, null, flc, Link.LINK | Link.NONTRANSLATED);
download.setUserObject(filename);
} else {
File taskFile = new File(taskFolder, filename);
download = uifactory.addDownloadLink("prev-" + CodeHelper.getRAMUniqueID(), filename, null, taskFile, tableEl);
}
}
AvailableTask wrapper = new AvailableTask(taskDef, descriptionLink, download);
availableTasks.add(wrapper);
if (descriptionLink != null) {
descriptionLink.setUserObject(wrapper);
}
}
taskModel.setObjects(availableTasks);
tableEl.reset();
if (availableTasks.isEmpty()) {
flc.contextPut("noMoreTasks", Boolean.TRUE);
} else {
flc.contextPut("noMoreTasks", Boolean.FALSE);
}
}
Aggregations