Search in sources :

Example 1 with VFSContainer

use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.

the class GTACoachController method stepSolution.

@Override
protected Task stepSolution(UserRequest ureq, Task assignedTask) {
    assignedTask = super.stepSolution(ureq, assignedTask);
    if (config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT) || config.getBooleanSafe(GTACourseNode.GTASK_SUBMIT) || config.getBooleanSafe(GTACourseNode.GTASK_REVIEW_AND_CORRECTION) || config.getBooleanSafe(GTACourseNode.GTASK_REVISION_PERIOD)) {
        if (assignedTask == null || assignedTask.getTaskStatus() == TaskProcess.assignment || assignedTask.getTaskStatus() == TaskProcess.submit || assignedTask.getTaskStatus() == TaskProcess.review || assignedTask.getTaskStatus() == TaskProcess.correction || assignedTask.getTaskStatus() == TaskProcess.revision) {
            mainVC.contextPut("solutionCssClass", "");
        } else if (assignedTask.getTaskStatus() == TaskProcess.solution) {
            mainVC.contextPut("solutionCssClass", "o_active");
        } else {
            mainVC.contextPut("solutionCssClass", "o_done");
        }
    } else if (assignedTask == null || assignedTask.getTaskStatus() == TaskProcess.solution) {
        mainVC.contextPut("solutionCssClass", "o_active");
    } else {
        mainVC.contextPut("solutionCssClass", "o_done");
    }
    File documentsDir = gtaManager.getSolutionsDirectory(courseEnv, gtaNode);
    VFSContainer documentsContainer = gtaManager.getSolutionsContainer(courseEnv, gtaNode);
    solutionsCtrl = new DirectoryController(ureq, getWindowControl(), documentsDir, documentsContainer, "run.solutions.description", "bulk.solutions", "solutions");
    listenTo(solutionsCtrl);
    mainVC.put("solutions", solutionsCtrl.getInitialComponent());
    return assignedTask;
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) File(java.io.File)

Example 2 with VFSContainer

use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.

the class GTACoachController method stepSubmit.

@Override
protected Task stepSubmit(UserRequest ureq, Task assignedTask) {
    assignedTask = super.stepSubmit(ureq, assignedTask);
    if (collectSubmissionsLink != null) {
        // clean up
        mainVC.remove(collectSubmissionsLink);
    }
    if (backToSubmissionLink != null) {
        mainVC.remove(backToSubmissionLink);
    }
    // calculate state
    boolean viewSubmittedDocument = false;
    if (config.getBooleanSafe(GTACourseNode.GTASK_ASSIGNMENT)) {
        if (assignedTask == null || assignedTask.getTaskStatus() == TaskProcess.assignment) {
            mainVC.contextPut("submitCssClass", "");
        } else if (assignedTask == null || assignedTask.getTaskStatus() == TaskProcess.submit) {
            mainVC.contextPut("submitCssClass", "o_active");
            collect(assignedTask);
        } else {
            mainVC.contextPut("submitCssClass", "o_done");
            viewSubmittedDocument = true;
        }
    } else if (assignedTask == null || assignedTask.getTaskStatus() == TaskProcess.submit) {
        mainVC.contextPut("submitCssClass", "o_active");
        collect(assignedTask);
    } else {
        mainVC.contextPut("submitCssClass", "o_done");
        viewSubmittedDocument = true;
    }
    if (assignedTask == null || (assignedTask.getTaskStatus() != TaskProcess.submit)) {
        backToSubmission(assignedTask);
    }
    if (viewSubmittedDocument) {
        File documentsDir;
        VFSContainer documentsContainer = null;
        if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
            documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, assessedGroup);
            documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, assessedGroup);
        } else {
            documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, assessedIdentity);
            documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, assessedIdentity);
        }
        boolean hasDocuments = TaskHelper.hasDocuments(documentsDir);
        if (hasDocuments) {
            submittedDocCtrl = new DirectoryController(ureq, getWindowControl(), documentsDir, documentsContainer, "coach.submitted.documents.description", "bulk.submitted.documents", "submission");
            listenTo(submittedDocCtrl);
            mainVC.put("submittedDocs", submittedDocCtrl.getInitialComponent());
        } else {
            TextFactory.createTextComponentFromI18nKey("submittedDocs", "coach.submitted.nofiles", getTranslator(), null, true, mainVC);
        }
    }
    return assignedTask;
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) File(java.io.File)

Example 3 with VFSContainer

use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.

the class GTACoachController method setUploadCorrections.

private void setUploadCorrections(UserRequest ureq, Task task) {
    File documentsDir;
    VFSContainer documentsContainer;
    if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
        documentsDir = gtaManager.getCorrectionDirectory(courseEnv, gtaNode, assessedGroup);
        documentsContainer = gtaManager.getCorrectionContainer(courseEnv, gtaNode, assessedGroup);
    } else {
        documentsDir = gtaManager.getCorrectionDirectory(courseEnv, gtaNode, assessedIdentity);
        documentsContainer = gtaManager.getCorrectionContainer(courseEnv, gtaNode, assessedIdentity);
    }
    submitCorrectionsCtrl = new SubmitDocumentsController(ureq, getWindowControl(), task, documentsDir, documentsContainer, -1, gtaNode, courseEnv, coachCourseEnv.isCourseReadOnly(), null, "coach.document");
    listenTo(submitCorrectionsCtrl);
    mainVC.put("corrections", submitCorrectionsCtrl.getInitialComponent());
    reviewedButton.setVisible(!coachCourseEnv.isCourseReadOnly());
    if (config.getBooleanSafe(GTACourseNode.GTASK_REVISION_PERIOD)) {
        needRevisionsButton.setVisible(!coachCourseEnv.isCourseReadOnly());
    }
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) File(java.io.File)

Example 4 with VFSContainer

use of org.olat.core.util.vfs.VFSContainer in project OpenOLAT by OpenOLAT.

the class GTACoachController method setCorrections.

private void setCorrections(UserRequest ureq, boolean hasRevisions) {
    File documentsDir;
    VFSContainer documentsContainer;
    if (GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
        documentsDir = gtaManager.getCorrectionDirectory(courseEnv, gtaNode, assessedGroup);
        documentsContainer = gtaManager.getCorrectionContainer(courseEnv, gtaNode, assessedGroup);
    } else {
        documentsDir = gtaManager.getCorrectionDirectory(courseEnv, gtaNode, assessedIdentity);
        documentsContainer = gtaManager.getCorrectionContainer(courseEnv, gtaNode, assessedIdentity);
    }
    boolean hasDocuments = TaskHelper.hasDocuments(documentsDir);
    if (hasDocuments) {
        correctionsCtrl = new DirectoryController(ureq, getWindowControl(), documentsDir, documentsContainer, "coach.corrections.description", "bulk.review", "review");
        listenTo(correctionsCtrl);
        mainVC.put("corrections", correctionsCtrl.getInitialComponent());
    } else if (hasRevisions) {
        String msg = "<i class='o_icon o_icon_warn'> </i> " + translate("coach.corrections.rejected");
        TextFactory.createTextComponentFromString("corrections", msg, null, true, mainVC);
    } else {
        String msg = "<i class='o_icon o_icon_ok'> </i> " + translate("coach.corrections.closed");
        TextFactory.createTextComponentFromString("corrections", msg, null, true, mainVC);
    }
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) File(java.io.File)

Example 5 with VFSContainer

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

Aggregations

VFSContainer (org.olat.core.util.vfs.VFSContainer)962 VFSItem (org.olat.core.util.vfs.VFSItem)364 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)338 File (java.io.File)170 Test (org.junit.Test)136 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)86 Identity (org.olat.core.id.Identity)86 LocalFolderImpl (org.olat.core.util.vfs.LocalFolderImpl)76 RepositoryEntry (org.olat.repository.RepositoryEntry)76 IOException (java.io.IOException)74 InputStream (java.io.InputStream)64 ArrayList (java.util.ArrayList)64 Date (java.util.Date)60 URI (java.net.URI)56 MetaInfo (org.olat.core.commons.modules.bc.meta.MetaInfo)42 OutputStream (java.io.OutputStream)40 HttpResponse (org.apache.http.HttpResponse)38 MetaTagged (org.olat.core.commons.modules.bc.meta.tagged.MetaTagged)34 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)34 BlogFileResource (org.olat.fileresource.types.BlogFileResource)34