Search in sources :

Example 1 with SystemFilenameFilter

use of org.olat.core.util.io.SystemFilenameFilter 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 SystemFilenameFilter

use of org.olat.core.util.io.SystemFilenameFilter in project OpenOLAT by OpenOLAT.

the class GTAAbstractController method getNumberOfRevisionDocuments.

protected int getNumberOfRevisionDocuments(Task assignedTask) {
    File[] submittedDocuments;
    int iteration = assignedTask.getRevisionLoop();
    if (GTAType.group.name().equals(gtaNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
        File documentsDir = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, iteration, assessedGroup);
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
    } else {
        File documentsDir = gtaManager.getRevisedDocumentsDirectory(courseEnv, gtaNode, iteration, assessedIdentity);
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
    }
    return submittedDocuments == null ? 0 : submittedDocuments.length;
}
Also used : SystemFilenameFilter(org.olat.core.util.io.SystemFilenameFilter) File(java.io.File)

Example 3 with SystemFilenameFilter

use of org.olat.core.util.io.SystemFilenameFilter in project OpenOLAT by OpenOLAT.

the class GTANotifications method getNumberOfSubmittedDocuments.

private int getNumberOfSubmittedDocuments(Identity assessedIdentity, BusinessGroup assessedGroup) {
    File[] submittedDocuments;
    if (GTAType.group.name().equals(gtaNode.getModuleConfiguration().getStringValue(GTACourseNode.GTASK_TYPE))) {
        File documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, assessedGroup);
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
    } else {
        File documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, assessedIdentity);
        submittedDocuments = documentsDir.listFiles(new SystemFilenameFilter(true, false));
    }
    return submittedDocuments == null ? 0 : submittedDocuments.length;
}
Also used : SystemFilenameFilter(org.olat.core.util.io.SystemFilenameFilter) File(java.io.File)

Example 4 with SystemFilenameFilter

use of org.olat.core.util.io.SystemFilenameFilter 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 5 with SystemFilenameFilter

use of org.olat.core.util.io.SystemFilenameFilter 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)

Aggregations

File (java.io.File)18 SystemFilenameFilter (org.olat.core.util.io.SystemFilenameFilter)18 VFSContainer (org.olat.core.util.vfs.VFSContainer)8 FilesLocked (org.olat.course.nodes.gta.TaskHelper.FilesLocked)8 TaskMultiUserEvent (org.olat.course.nodes.gta.ui.events.TaskMultiUserEvent)4 Identity (org.olat.core.id.Identity)2 ICourse (org.olat.course.ICourse)2 UserCourseEnvironment (org.olat.course.run.userview.UserCourseEnvironment)2