Index: lams_bb_integration/build.xml =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/build.xml,v diff -u -r1.8 -r1.9 --- lams_bb_integration/build.xml 4 Sep 2013 14:35:22 -0000 1.8 +++ lams_bb_integration/build.xml 12 Feb 2014 21:46:43 -0000 1.9 @@ -2,7 +2,7 @@ - + Index: lams_bb_integration/WEB-INF/bb-manifest.xml =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/WEB-INF/bb-manifest.xml,v diff -u -r1.12 -r1.13 --- lams_bb_integration/WEB-INF/bb-manifest.xml 7 Feb 2014 15:30:05 -0000 1.12 +++ lams_bb_integration/WEB-INF/bb-manifest.xml 12 Feb 2014 21:46:43 -0000 1.13 @@ -5,7 +5,7 @@ - + Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookServlet.java =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookServlet.java,v diff -u -r1.2 -r1.3 --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookServlet.java 22 Sep 2012 10:34:30 -0000 1.2 +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookServlet.java 12 Feb 2014 21:46:43 -0000 1.3 @@ -34,6 +34,7 @@ import java.security.NoSuchAlgorithmException; import java.text.DecimalFormat; import java.util.List; +import java.util.Set; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; @@ -51,23 +52,22 @@ import org.w3c.dom.NodeList; import org.xml.sax.SAXException; +import blackboard.data.content.Content; +import blackboard.data.content.CourseDocument; import blackboard.data.course.Course; import blackboard.data.course.CourseMembership; import blackboard.data.gradebook.Lineitem; import blackboard.data.gradebook.Score; -import blackboard.data.gradebook.impl.Outcome; -import blackboard.data.gradebook.impl.OutcomeDefinition.CalculationType; -import blackboard.data.gradebook.impl.OutcomeDefinitionCategory; -import blackboard.data.gradebook.impl.OutcomeDefinitionScale; import blackboard.data.user.User; import blackboard.persist.BbPersistenceManager; +import blackboard.persist.Container; +import blackboard.persist.Id; import blackboard.persist.KeyNotFoundException; -import blackboard.persist.PersistenceException; import blackboard.persist.PkId; +import blackboard.persist.content.ContentDbLoader; import blackboard.persist.course.CourseDbLoader; import blackboard.persist.course.CourseMembershipDbLoader; import blackboard.persist.gradebook.LineitemDbLoader; -import blackboard.persist.gradebook.LineitemDbPersister; import blackboard.persist.gradebook.ScoreDbLoader; import blackboard.persist.gradebook.ScoreDbPersister; import blackboard.persist.user.UserDbLoader; @@ -103,26 +103,52 @@ String userName = request.getParameter(Constants.PARAM_USER_ID); String timeStamp = request.getParameter(Constants.PARAM_TIMESTAMP); String hash = request.getParameter(Constants.PARAM_HASH); - String lessonIdStr = request.getParameter(Constants.PARAM_LESSON_ID); + String lessonId = request.getParameter(Constants.PARAM_LESSON_ID); - // check paramaeters - if (userName == null || timeStamp == null || hash == null) { + // check parameters + if (userName == null || timeStamp == null || hash == null || lessonId == null) { response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "missing expected parameters"); return; } + //check user rights String secretKey = LamsPluginUtil.getSecretKey(); String serverId = LamsPluginUtil.getServerId(); - if (!sha1( timeStamp.toLowerCase() + userName.toLowerCase() + serverId.toLowerCase() + secretKey.toLowerCase()).equals(hash)) { response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "authentication failed"); } + + //check if isGradebookcenter + PortalExtraInfo pei = PortalUtil.loadPortalExtraInfo(null, null, "LamsStorage"); + ExtraInfo ei = pei.getExtraInfo(); + Set internalLessonIds = ei.getKeys(); + String internalLessonId = null; + for (String internalLessonIdIter : internalLessonIds) { + String externalLessonId = ei.getValue(internalLessonIdIter); + if (lessonId.equals(externalLessonId)) { + internalLessonId = internalLessonIdIter; + break; + } + } + + // exit method as it was created in version prior to 1.2.1 and thus don't have lineitem + if (internalLessonId == null) { + return; + } + + // check if we need to store mark in Gradebook + BbPersistenceManager bbPm = BbServiceManager.getPersistenceService().getDbPersistenceManager(); + Container bbContainer = bbPm.getContainer(); + Id contentId = new PkId( bbContainer, CourseDocument.DATA_TYPE, internalLessonId ); + ContentDbLoader courseDocumentLoader = (ContentDbLoader) bbPm.getLoader( ContentDbLoader.TYPE ); + Content modifiedLesson = (Content)courseDocumentLoader.loadById( contentId ); + if (!modifiedLesson.getIsDescribed()) { + //isDescribed field is used for storing isGradecenter parameter and thus if it's false it means don't store mark to Gradecenter + return; + } - // get the persistence manager - BbPersistenceManager bbPm = BbServiceManager.getPersistenceService().getDbPersistenceManager(); - // get user list, but no role info since there are no course info UserDbLoader userLoader = (UserDbLoader) bbPm.getLoader(UserDbLoader.TYPE); User user = userLoader.loadByUserName(userName); @@ -136,7 +162,7 @@ Document document = null; String serviceURL = serverAddr + "/services/xml/LessonManager?" + LamsSecurityUtil.generateAuthenticateParameters(ctx) + "&courseId=" - + "&method=toolOutputsUser&lsId=" + lessonIdStr + "&outputsUser=" + + "&method=toolOutputsUser&lsId=" + lessonId + "&outputsUser=" + URLEncoder.encode(userName, "UTF8"); URL url = new URL(serviceURL); @@ -201,7 +227,7 @@ List lineitems = lineitemLoader.loadByCourseId(userCourse.getId()); for (Lineitem lineitemIter : lineitems) { - if (lineitemIter.getAssessmentId() != null && lineitemIter.getAssessmentId().equals(lessonIdStr)) { + if (lineitemIter.getAssessmentId() != null && lineitemIter.getAssessmentId().equals(lessonId)) { lineitem = lineitemIter; break; } Index: lams_bb_integration/web/modules/create.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/web/modules/create.jsp,v diff -u -r1.10 -r1.11 --- lams_bb_integration/web/modules/create.jsp 24 Oct 2013 14:29:44 -0000 1.10 +++ lams_bb_integration/web/modules/create.jsp 12 Feb 2014 21:46:43 -0000 1.11 @@ -27,7 +27,6 @@ <% - // SECURITY! // Authorise current user for Course Control Panel (automatic redirect) try{ if (!PlugInUtil.authorizeForCourseControlPanel(request, response)) @@ -141,7 +140,6 @@ No - Yes No Index: lams_bb_integration/web/modules/delete.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/web/modules/Attic/delete.jsp,v diff -u -r1.2 -r1.3 --- lams_bb_integration/web/modules/delete.jsp 24 Aug 2012 09:07:03 -0000 1.2 +++ lams_bb_integration/web/modules/delete.jsp 12 Feb 2014 21:46:43 -0000 1.3 @@ -36,7 +36,6 @@ <% - // SECURITY! // Authorise current user for Course Access (automatic redirect) try { if (!PlugInUtil.authorizeForCourse(request, response)) @@ -77,8 +76,12 @@ throw new ServletException("lineitem not found"); } + //delete lineitem (can't delete it simply doing linePersister.deleteById(lineitem.getId()) due to BB9 bug) + PkId lineitemPkId = (PkId) lineitem.getId(); + String lineitemIdStr = "_" + lineitemPkId.getPk1() + "_" + lineitemPkId.getPk2(); + Id lineitemId = bbPm.generateId(Lineitem.LINEITEM_DATA_TYPE, lineitemIdStr.trim()); LineitemDbPersister linePersister = (LineitemDbPersister) bbPm.getPersister(LineitemDbPersister.TYPE); - linePersister.deleteById(lineitem.getId()); + linePersister.deleteById(lineitemId); %> <%-- Page Header --%> Index: lams_bb_integration/web/modules/learnermonitor.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_bb_integration/web/modules/learnermonitor.jsp,v diff -u -r1.11 -r1.12 --- lams_bb_integration/web/modules/learnermonitor.jsp 18 Dec 2012 06:28:58 -0000 1.11 +++ lams_bb_integration/web/modules/learnermonitor.jsp 12 Feb 2014 21:46:43 -0000 1.12 @@ -33,7 +33,6 @@ <% - // SECURITY! // Authorise current user for Course Access (automatic redirect) try{ if (!PlugInUtil.authorizeForCourse(request, response)) @@ -87,9 +86,29 @@ PlugInUtil.sendAccessDeniedRedirect(request, response); } + //Get lessson's title and description + String contentIdStr = request.getParameter("content_id"); + String title = ""; + String description = ""; + //contentId is available in versions after 1.2.3 + if (contentIdStr != null) { + + Container bbContainer = bbPm.getContainer(); + Id contentId = new PkId( bbContainer, CourseDocument.DATA_TYPE, request.getParameter("content_id") ); + ContentDbLoader courseDocumentLoader = (ContentDbLoader) bbPm.getLoader( ContentDbLoader.TYPE ); + Content courseDoc = (Content)courseDocumentLoader.loadById( contentId ); + + title = courseDoc.getTitle(); + description = courseDoc.getBody().getText(); + } else { + + title = request.getParameter("title"); + description = request.getParameter("description"); + } + + //display learning design image String strIsDisplayDesignImage = request.getParameter("isDisplayDesignImage"); boolean isDisplayDesignImage = "true".equals(strIsDisplayDesignImage)?true:false; - String learningDesignImageUrl = ""; if (isDisplayDesignImage) { String strLearningDesignId = request.getParameter("ldid").trim(); @@ -111,7 +130,6 @@ //no score availalbe } } - boolean isScoreAvailable = (current_score != null); %> @@ -122,7 +140,7 @@ <%-- Page Header --%> - + <%-- Action Control Bar --%> @@ -134,15 +152,9 @@ <%-- Cancel (Go Back) --%> - <% if(request.getParameter("title") != null) { %> -

- <%=request.getParameter("title")%> -

- <% } %> - - <% if(request.getParameter("description") != null) { %> + <% if((description != "") && (description != null)) { %>

- <%=request.getParameter("description")%> + <%=description%>

<% } %> @@ -157,7 +169,6 @@ You have completed this lesson. <% } %> -