Index: lams_build/lib/lams/lams.jar =================================================================== diff -u -r2abc3485dc2d24ea02044a64271f3ee0d3b8c11b -r453898dc3e1802c2280217b914be130fd19fe4d5 Binary files differ Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20170411.sql =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20170411.sql (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20170411.sql (revision 453898dc3e1802c2280217b914be130fd19fe4d5) @@ -0,0 +1,16 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +----------------------Put all sql statements below here------------------------- + +-- LDEV-4312 Handle unsuccessful mark submission to integrated servers + +INSERT INTO lams_log_event_type VALUES (7, 'TYPE_LEARNER_LESSON_COMPLETE'); +INSERT INTO lams_log_event_type VALUES (8, 'TYPE_LEARNER_LESSON_MARK_SUBMIT'); + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; Index: lams_common/src/java/org/lamsfoundation/lams/logevent/LogEvent.java =================================================================== diff -u -r51fb2a37254f24bb2a805d4ffd54482c779f43fa -r453898dc3e1802c2280217b914be130fd19fe4d5 --- lams_common/src/java/org/lamsfoundation/lams/logevent/LogEvent.java (.../LogEvent.java) (revision 51fb2a37254f24bb2a805d4ffd54482c779f43fa) +++ lams_common/src/java/org/lamsfoundation/lams/logevent/LogEvent.java (.../LogEvent.java) (revision 453898dc3e1802c2280217b914be130fd19fe4d5) @@ -47,6 +47,8 @@ public static final int TYPE_TEACHER_LESSON_CHANGE_STATE = 4; public static final int TYPE_LEARNER_ACTIVITY_START = 5; public static final int TYPE_LEARNER_ACTIVITY_FINISH = 6; + public static final int TYPE_LEARNER_LESSON_COMPLETE = 7; + public static final int TYPE_LEARNER_LESSON_MARK_SUBMIT = 8; /** *************************************************************** */ /** identifier field */ Index: lams_learning/src/java/org/lamsfoundation/lams/learning/progress/ProgressEngine.java =================================================================== diff -u -r81bec2c4c018269cb6a8d65212aae7e37b406fb3 -r453898dc3e1802c2280217b914be130fd19fe4d5 --- lams_learning/src/java/org/lamsfoundation/lams/learning/progress/ProgressEngine.java (.../ProgressEngine.java) (revision 81bec2c4c018269cb6a8d65212aae7e37b406fb3) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/progress/ProgressEngine.java (.../ProgressEngine.java) (revision 453898dc3e1802c2280217b914be130fd19fe4d5) @@ -370,6 +370,11 @@ learnerProgress.setCurrentActivity(null); learnerProgress.setNextActivity(null); learnerProgress.setLessonComplete(completionStatus); + + // log learner has completed the current lesson event + logEventService.logEvent(LogEvent.TYPE_LEARNER_LESSON_COMPLETE, learnerProgress.getUser().getUserId(), null, + learnerProgress.getLesson().getLessonId(), null); + return learnerProgress; } Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/LogLessonMarkPushedToIntegrationsServlet.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/LogLessonMarkPushedToIntegrationsServlet.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/LogLessonMarkPushedToIntegrationsServlet.java (revision 453898dc3e1802c2280217b914be130fd19fe4d5) @@ -0,0 +1,81 @@ +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ +package org.lamsfoundation.lams.learning.web; + +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.logevent.LogEvent; +import org.lamsfoundation.lams.logevent.service.ILogEventService; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +@SuppressWarnings("serial") +public class LogLessonMarkPushedToIntegrationsServlet extends HttpServlet { + + private static Logger log = Logger.getLogger(LogLessonMarkPushedToIntegrationsServlet.class); + + private static ILogEventService logEventService; + + @Override + public void init() throws ServletException { + WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()); + logEventService = (ILogEventService) ctx.getBean("logEventService"); + } + + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + //not supported + } + + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + long lessonID = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); + UserDTO user = (UserDTO) SessionManager.getSession().getAttribute(AttributeNames.USER); + if (user == null) { + return; + } + + //log mark has been successfullly pushed to the integrated server + logEventService.logEvent(LogEvent.TYPE_LEARNER_LESSON_MARK_SUBMIT, user.getUserID(), null, lessonID, null); + + response.setContentType("text/html"); + PrintWriter out = response.getWriter(); + out.write("OK"); + out.flush(); + out.close(); + } +} Index: lams_learning/web/WEB-INF/web.xml =================================================================== diff -u -r2a70ed7d169b7c8fe70237c266eb6194f3392164 -r453898dc3e1802c2280217b914be130fd19fe4d5 --- lams_learning/web/WEB-INF/web.xml (.../web.xml) (revision 2a70ed7d169b7c8fe70237c266eb6194f3392164) +++ lams_learning/web/WEB-INF/web.xml (.../web.xml) (revision 453898dc3e1802c2280217b914be130fd19fe4d5) @@ -103,10 +103,23 @@ org.lamsfoundation.lams.learning.web.RepopulateProgressMarksServlet + + + LogLessonMarkPushedToIntegrationsServlet + + org.lamsfoundation.lams.learning.web.LogLessonMarkPushedToIntegrationsServlet + + + RepopulateProgressMarksServlet /repopulateProgress + + + LogLessonMarkPushedToIntegrationsServlet + /logLessonMarkPushedToIntegrations + Index: lams_learning/web/lessonComplete.jsp =================================================================== diff -u -rce40f93aa0cb3599324749fbc619c7a6eee63187 -r453898dc3e1802c2280217b914be130fd19fe4d5 --- lams_learning/web/lessonComplete.jsp (.../lessonComplete.jsp) (revision ce40f93aa0cb3599324749fbc619c7a6eee63187) +++ lams_learning/web/lessonComplete.jsp (.../lessonComplete.jsp) (revision 453898dc3e1802c2280217b914be130fd19fe4d5) @@ -19,34 +19,52 @@ http://www.gnu.org/licenses/gpl.txt --%> -<%@ page language="java" pageEncoding="UTF-8" - contentType="text/html;charset=utf-8"%> +<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%> <%@ taglib uri="tags-bean" prefix="bean"%> <%@ taglib uri="tags-html" prefix="html"%> <%@ taglib uri="tags-core" prefix="c"%> <%@ taglib uri="tags-fmt" prefix="fmt"%> <%@ taglib uri="tags-lams" prefix="lams"%> + + + - - - - - - - - -
  @@ -95,7 +113,3 @@ - - - -