Search in sources :

Example 1 with FilesLocked

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

the class GTACoachRevisionAndCorrectionsController method doConfirmCollect.

private void doConfirmCollect(UserRequest ureq) {
    String toName = null;
    if (assessedGroup != null) {
        toName = assessedGroup.getName();
    } else if (assessedIdentity != null) {
        toName = userManager.getUserDisplayName(assessedIdentity);
    }
    File[] submittedDocuments;
    VFSContainer documentsContainer;
    int iteration = assignedTask.getRevisionLoop();
    if (GTAType.group.name().equals(gtaNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
        documentsContainer = gtaManager.getRevisedDocumentsContainer(courseEnv, gtaNode, iteration, assessedGroup);
        File documentsDir = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, iteration, assessedGroup);
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
    } else {
        documentsContainer = gtaManager.getRevisedDocumentsContainer(courseEnv, gtaNode, iteration, getIdentity());
        File documentsDir = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, iteration, 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.revisions.confirm.title");
        String text = translate("coach.collect.revisions.confirm.text", new String[] { toName });
        text = "<div class='o_warning'>" + text + "</div>";
        confirmCollectCtrl = activateOkCancelDialog(ureq, title, text, confirmCollectCtrl);
        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 2 with FilesLocked

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

the class GTAParticipantRevisionAndCorrectionsController method doConfirmSubmit.

private void doConfirmSubmit(UserRequest ureq) {
    int iteration = assignedTask.getRevisionLoop();
    String title = translate("run.submit.revision.button");
    String text;
    File[] submittedDocuments;
    VFSContainer documentsContainer;
    if (GTAType.group.name().equals(gtaNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
        documentsContainer = gtaManager.getRevisedDocumentsContainer(courseEnv, gtaNode, iteration, assessedGroup);
        File documentsDir = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, iteration, assessedGroup);
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
        if (submittedDocuments.length == 0) {
            text = "<div class='o_warning'>" + translate("run.submit.revision.confirm.warning.group", new String[] { StringHelper.escapeHtml(assessedGroup.getName()) }) + "</div>";
        } else {
            text = translate("run.submit.revision.confirm.group", new String[] { StringHelper.escapeHtml(assessedGroup.getName()) });
        }
    } else {
        documentsContainer = gtaManager.getRevisedDocumentsContainer(courseEnv, gtaNode, iteration, getIdentity());
        File documentsDir = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, iteration, getIdentity());
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
        if (submittedDocuments.length == 0) {
            text = "<div class='o_warning'>" + translate("run.submit.revision.confirm.warning") + "</div>";
        } else {
            text = translate("run.submit.revision.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);
    }
}
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 3 with FilesLocked

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

the class GTACoachRevisionAndCorrectionsController method doConfirmCollect.

private void doConfirmCollect(UserRequest ureq) {
    String toName = null;
    if (assessedGroup != null) {
        toName = assessedGroup.getName();
    } else if (assessedIdentity != null) {
        toName = userManager.getUserDisplayName(assessedIdentity);
    }
    File[] submittedDocuments;
    VFSContainer documentsContainer;
    int iteration = assignedTask.getRevisionLoop();
    if (GTAType.group.name().equals(gtaNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
        documentsContainer = gtaManager.getRevisedDocumentsContainer(courseEnv, gtaNode, iteration, assessedGroup);
        File documentsDir = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, iteration, assessedGroup);
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
    } else {
        documentsContainer = gtaManager.getRevisedDocumentsContainer(courseEnv, gtaNode, iteration, getIdentity());
        File documentsDir = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, iteration, 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.revisions.confirm.title");
        String text = translate("coach.collect.revisions.confirm.text", new String[] { toName });
        text = "<div class='o_warning'>" + text + "</div>";
        confirmCollectCtrl = activateOkCancelDialog(ureq, title, text, confirmCollectCtrl);
        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 4 with FilesLocked

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

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 5 with FilesLocked

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

the class GTAParticipantRevisionAndCorrectionsController method doConfirmSubmit.

private void doConfirmSubmit(UserRequest ureq) {
    int iteration = assignedTask.getRevisionLoop();
    String title = translate("run.submit.revision.button");
    String text;
    File[] submittedDocuments;
    VFSContainer documentsContainer;
    if (GTAType.group.name().equals(gtaNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
        documentsContainer = gtaManager.getRevisedDocumentsContainer(courseEnv, gtaNode, iteration, assessedGroup);
        File documentsDir = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, iteration, assessedGroup);
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
        if (submittedDocuments.length == 0) {
            text = "<div class='o_warning'>" + translate("run.submit.revision.confirm.warning.group", new String[] { StringHelper.escapeHtml(assessedGroup.getName()) }) + "</div>";
        } else {
            text = translate("run.submit.revision.confirm.group", new String[] { StringHelper.escapeHtml(assessedGroup.getName()) });
        }
    } else {
        documentsContainer = gtaManager.getRevisedDocumentsContainer(courseEnv, gtaNode, iteration, getIdentity());
        File documentsDir = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, iteration, getIdentity());
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
        if (submittedDocuments.length == 0) {
            text = "<div class='o_warning'>" + translate("run.submit.revision.confirm.warning") + "</div>";
        } else {
            text = translate("run.submit.revision.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);
    }
}
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