Index: lams_learning/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r425e130a9496467f8b5329e504e5d285d1af6bde -rc493aaa335594d0b24929d885b1ab6c0da659c1b --- lams_learning/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 425e130a9496467f8b5329e504e5d285d1af6bde) +++ lams_learning/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision c493aaa335594d0b24929d885b1ab6c0da659c1b) @@ -11,6 +11,7 @@ error.message.404 =The page you have requested can not be found. error.message.login =You need login here error.title =Error occured +error.learner.not.finished =Cannot export portfolio, the user did not finish the lesson yet. message.activity.loading =The next task is loading. Please wait.... message.lesson.finished =Congratulations, {0}, you have finished. message.lesson.finishedCont =You have now completed the {0} lesson. You can return at anytime to this lesson and revisit and review activities by double clicking on the blue icons in the left hand progress bar. You can now close this window. Index: lams_learning/src/java/org/lamsfoundation/lams/learning/export/web/action/MainExportServlet.java =================================================================== diff -u -rd0e01c78ed4b531b052fbd0f292100634bca9ad8 -rc493aaa335594d0b24929d885b1ab6c0da659c1b --- lams_learning/src/java/org/lamsfoundation/lams/learning/export/web/action/MainExportServlet.java (.../MainExportServlet.java) (revision d0e01c78ed4b531b052fbd0f292100634bca9ad8) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/export/web/action/MainExportServlet.java (.../MainExportServlet.java) (revision c493aaa335594d0b24929d885b1ab6c0da659c1b) @@ -121,21 +121,23 @@ throw new ExportPortfolioException("Lesson with ID: " + lesson.getLessonId() + " does not allow export portfolio for learners"); } + if (!securityService.isLessonLearner(lesson.getLessonId(), currentUserId, "export portfolio", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "The user is not a learner in the lesson"); + // the way that LAMS works here will make 403 actually send 200, so it's better to use 500 + response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "The user is not a learner in the lesson"); return; } - LearnerProgress learnerProgress = lessonService.getUserProgressForLesson(currentUserId, lesson.getLessonId()); - if (learnerProgress == null || !learnerProgress.isComplete()) { - log.error("Learner with ID: " + currentUserId + " has not finished lesson with ID: " - + lesson.getLessonId()); - response.sendError(HttpServletResponse.SC_FORBIDDEN, "The learner has not finished the lesson"); + if ((learnerProgress == null) || !learnerProgress.isComplete()) { + MainExportServlet.log.error("Learner with ID: " + currentUserId + + " has not finished lesson with ID: " + lesson.getLessonId()); + response.sendError(HttpServletResponse.SC_NO_CONTENT, "The learner has not finished the lesson"); return; } } else if (!securityService.isLessonMonitor(lesson.getLessonId(), currentUserId, "export portfolio", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "The user is not a learner in the lesson"); + // the way that LAMS works here will make 403 actually send 200, so it's better to use 500 + response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "The user is not a learner in the lesson"); return; } @@ -147,7 +149,8 @@ + learnerLogin + ".zip"; } else if (mode.equals(ToolAccessMode.TEACHER.toString())) { if (!securityService.isLessonMonitor(lesson.getLessonId(), currentUserId, "export portfolio", false)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "The user is not a monitor in the lesson"); + // the way that LAMS works here will make 403 actually send 200, so it's better to use 500 + response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "The user is not a monitor in the lesson"); return; } Index: lams_learning/web/exportWaitingPage.jsp =================================================================== diff -u -r5151f2b39fb40766b3f75f367ef3825ea8e6dc31 -rc493aaa335594d0b24929d885b1ab6c0da659c1b --- lams_learning/web/exportWaitingPage.jsp (.../exportWaitingPage.jsp) (revision 5151f2b39fb40766b3f75f367ef3825ea8e6dc31) +++ lams_learning/web/exportWaitingPage.jsp (.../exportWaitingPage.jsp) (revision c493aaa335594d0b24929d885b1ab6c0da659c1b) @@ -106,11 +106,15 @@ window.location.href = url; break; + case 204: + msg = ""; + document.getElementById("message").innerHTML = msg; + break; case 404: //status 404 Not Found msg = "."; alert(msg); break; - case 500: //status 500 Internal Server Error + case 500: // status 500 Internal Server Error msg = "

Status 500

"; document.getElementById("message").innerHTML = msg; break;