Search in sources :

Example 6 with FilesLocked

use of org.olat.course.nodes.gta.TaskHelper.FilesLocked in project OpenOLAT by OpenOLAT.

the class GTACoachController method doConfirmCollectTask.

private void doConfirmCollectTask(UserRequest ureq, Task assignedTask) {
    String toName = null;
    if (assessedGroup != null) {
        toName = assessedGroup.getName();
    } else if (assessedIdentity != null) {
        toName = userManager.getUserDisplayName(assessedIdentity);
    }
    File[] submittedDocuments;
    VFSContainer documentsContainer;
    if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
        documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, assessedGroup);
        File documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, assessedGroup);
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
    } else {
        documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, getIdentity());
        File documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, getIdentity());
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
    }
    FilesLocked lockedBy = TaskHelper.getDocumentsLocked(documentsContainer, submittedDocuments);
    if (lockedBy != null) {
        showWarning("warning.submit.documents.edited", new String[] { lockedBy.getLockedBy(), lockedBy.getLockedFiles() });
    } else {
        String title = translate("coach.collect.confirm.title");
        String text = translate("coach.collect.confirm.text", new String[] { toName });
        text = "<div class='o_warning'>" + text + "</div>";
        confirmCollectCtrl = activateOkCancelDialog(ureq, title, text, confirmCollectCtrl);
        confirmCollectCtrl.setUserObject(assignedTask);
        listenTo(confirmCollectCtrl);
    }
}
Also used : FilesLocked(org.olat.course.nodes.gta.TaskHelper.FilesLocked) VFSContainer(org.olat.core.util.vfs.VFSContainer) SystemFilenameFilter(org.olat.core.util.io.SystemFilenameFilter) File(java.io.File)

Example 7 with FilesLocked

use of org.olat.course.nodes.gta.TaskHelper.FilesLocked in project OpenOLAT by OpenOLAT.

the class GTAParticipantController method doConfirmSubmit.

private void doConfirmSubmit(UserRequest ureq, Task task) {
    String title = translate("run.submit.button");
    String text;
    File[] submittedDocuments;
    VFSContainer documentsContainer;
    if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
        documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, assessedGroup);
        File documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, assessedGroup);
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
        if (submittedDocuments.length == 0) {
            text = "<div class='o_warning'>" + translate("run.submit.confirm.warning.group", new String[] { StringHelper.escapeHtml(assessedGroup.getName()) }) + "</div>";
        } else {
            text = translate("run.submit.confirm.group", new String[] { StringHelper.escapeHtml(assessedGroup.getName()) });
        }
    } else {
        documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, getIdentity());
        File documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, getIdentity());
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
        if (submittedDocuments.length == 0) {
            text = "<div class='o_warning'>" + translate("run.submit.confirm.warning") + "</div>";
        } else {
            text = translate("run.submit.confirm");
        }
    }
    FilesLocked lockedBy = TaskHelper.getDocumentsLocked(documentsContainer, submittedDocuments);
    if (lockedBy != null) {
        showWarning("warning.submit.documents.edited", new String[] { lockedBy.getLockedBy(), lockedBy.getLockedFiles() });
    } else {
        confirmSubmitDialog = activateOkCancelDialog(ureq, title, text, confirmSubmitDialog);
        confirmSubmitDialog.setUserObject(task);
    }
}
Also used : FilesLocked(org.olat.course.nodes.gta.TaskHelper.FilesLocked) VFSContainer(org.olat.core.util.vfs.VFSContainer) SystemFilenameFilter(org.olat.core.util.io.SystemFilenameFilter) File(java.io.File)

Example 8 with FilesLocked

use of org.olat.course.nodes.gta.TaskHelper.FilesLocked in project openolat by klemens.

the class GTACoachController method doConfirmCollectTask.

private void doConfirmCollectTask(UserRequest ureq, Task assignedTask) {
    String toName = null;
    if (assessedGroup != null) {
        toName = assessedGroup.getName();
    } else if (assessedIdentity != null) {
        toName = userManager.getUserDisplayName(assessedIdentity);
    }
    File[] submittedDocuments;
    VFSContainer documentsContainer;
    if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
        documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, assessedGroup);
        File documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, assessedGroup);
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
    } else {
        documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, getIdentity());
        File documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, getIdentity());
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
    }
    FilesLocked lockedBy = TaskHelper.getDocumentsLocked(documentsContainer, submittedDocuments);
    if (lockedBy != null) {
        showWarning("warning.submit.documents.edited", new String[] { lockedBy.getLockedBy(), lockedBy.getLockedFiles() });
    } else {
        String title = translate("coach.collect.confirm.title");
        String text = translate("coach.collect.confirm.text", new String[] { toName });
        text = "<div class='o_warning'>" + text + "</div>";
        confirmCollectCtrl = activateOkCancelDialog(ureq, title, text, confirmCollectCtrl);
        confirmCollectCtrl.setUserObject(assignedTask);
        listenTo(confirmCollectCtrl);
    }
}
Also used : FilesLocked(org.olat.course.nodes.gta.TaskHelper.FilesLocked) VFSContainer(org.olat.core.util.vfs.VFSContainer) SystemFilenameFilter(org.olat.core.util.io.SystemFilenameFilter) File(java.io.File)

Aggregations

File (java.io.File)8 SystemFilenameFilter (org.olat.core.util.io.SystemFilenameFilter)8 VFSContainer (org.olat.core.util.vfs.VFSContainer)8 FilesLocked (org.olat.course.nodes.gta.TaskHelper.FilesLocked)8