Index: lams_bb_integration/.classpath =================================================================== diff -u -r8af1746d179f41095b074fef269722c6689b39eb -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea --- lams_bb_integration/.classpath (.../.classpath) (revision 8af1746d179f41095b074fef269722c6689b39eb) +++ lams_bb_integration/.classpath (.../.classpath) (revision 7313b5c073ae563d642a7ef9a2acec81caa2a8ea) @@ -1,21 +1,16 @@ - - - - - - + Index: lams_bb_integration/WEB-INF/bb-manifest.xml =================================================================== diff -u -r3c527d0998e4797bdfaefc359e036fa01a560ad9 -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea --- lams_bb_integration/WEB-INF/bb-manifest.xml (.../bb-manifest.xml) (revision 3c527d0998e4797bdfaefc359e036fa01a560ad9) +++ lams_bb_integration/WEB-INF/bb-manifest.xml (.../bb-manifest.xml) (revision 7313b5c073ae563d642a7ef9a2acec81caa2a8ea) @@ -5,7 +5,7 @@ - + @@ -27,6 +27,7 @@ + @@ -40,16 +41,16 @@ - + - - - - - + + + + + - + Index: lams_bb_integration/WEB-INF/web.xml =================================================================== diff -u -r3c527d0998e4797bdfaefc359e036fa01a560ad9 -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea --- lams_bb_integration/WEB-INF/web.xml (.../web.xml) (revision 3c527d0998e4797bdfaefc359e036fa01a560ad9) +++ lams_bb_integration/WEB-INF/web.xml (.../web.xml) (revision 7313b5c073ae563d642a7ef9a2acec81caa2a8ea) @@ -13,6 +13,10 @@ LamsActionRequestServlet org.lamsfoundation.ld.integration.blackboard.LamsActionRequestServlet + + GradebookServlet + org.lamsfoundation.ld.integration.blackboard.GradebookServlet + LamsActionRequestServlet @@ -22,6 +26,9 @@ UserDataServlet /UserData + + GradebookServlet + /Gradebook + - Index: lams_bb_integration/build.xml =================================================================== diff -u -r3c527d0998e4797bdfaefc359e036fa01a560ad9 -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea --- lams_bb_integration/build.xml (.../build.xml) (revision 3c527d0998e4797bdfaefc359e036fa01a560ad9) +++ lams_bb_integration/build.xml (.../build.xml) (revision 7313b5c073ae563d642a7ef9a2acec81caa2a8ea) @@ -2,7 +2,7 @@ - + Index: lams_bb_integration/lib/bb-cms-admin.jar =================================================================== diff -u -r2d8a22624f79146eff859c52775648266d47b826 -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/lib/bb-platform.jar =================================================================== diff -u -r2d8a22624f79146eff859c52775648266d47b826 -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/lib/bb-taglibs.jar =================================================================== diff -u -r2d8a22624f79146eff859c52775648266d47b826 -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/lib/commons-io-1.4.jar =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/readme.txt =================================================================== diff -u -r3c527d0998e4797bdfaefc359e036fa01a560ad9 -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea --- lams_bb_integration/readme.txt (.../readme.txt) (revision 3c527d0998e4797bdfaefc359e036fa01a560ad9) +++ lams_bb_integration/readme.txt (.../readme.txt) (revision 7313b5c073ae563d642a7ef9a2acec81caa2a8ea) @@ -4,10 +4,7 @@ By Luke Foxton LAMS Foundation Copyright (C) 2007 (http://lamsfoundation.org) -Updated for the Blackboard 9.1 SP6 Building block by -Richard Stals (www.stals.com.au) -Edith Cowan University -2011 +Updated for the Blackboard 9.1 SP6 Building block by Richard Stals (www.stals.com.au) Edith Cowan University 2011 Contents ================================================================================ @@ -17,6 +14,9 @@ 2. Installing the module in Blackboard 3. Configuring the module in Blackboard 4. Configuring the LAMS Server for Blackboard Integration +5. Creating BB course +6. Creating LAMS lesson +7. Accessing Gradebook marks 1. Requirements @@ -25,15 +25,16 @@ - Blackboard Learning System 9.1 1.2 Minimum requirement to build the module from source - - Java 2 Platform, Standard Edition, v 1.5 + - Java 2 Platform, Standard Edition, v 1.6 - Ant 1.6 + 2. Installing the module in Blackboard ================================================================================ 1. Download lams2-bb-plugin-1.x.war 2. Log into Blackboard as Administrator 3. Click on - System Admin->Building Blocks->Install Building Block + System Admin->Building Blocks->Installed Tools->Upload Building Block 4. Click on Browse and select lams2-bb-plugin-1.x.war 5. Submit 6. Select "Available" in the Availability drop-down menu and click ok @@ -43,7 +44,7 @@ 3. Configuring the module in Blackboard ================================================================================ 1. Once the LAMS2 integration Block is installed, Goto - System Admin->Building Blocks + System Admin->Building Blocks->Installed Tools 2. Click the "Properties" button in the LAMS Module row 3. Fill in the LAMS server url, this is the url that points to the login page for LAMS. The same as the server URL set during LAMS installation @@ -74,16 +75,27 @@ (See step 7 of "Configuring the module in Blackboard") 8. You can optionally put a timeout URL and choose an organisation to add the integrated server to. - - - - - - - - - - - +5. Creating BB course +================================================================================ + 1. Click on My Institution->Launch the Course Creation Wizard and follow all required steps. + 2. To browse available courses head to Courses and there is a "Course List" + + +6. Creating LAMS lesson +================================================================================ + 1. Create BB Course as described above + 2. Go to Courses->${YOUR_COURSE_NAME}->Information->Tools->Lams2. + If you don't have Lams2 in the list then something went wrong on installation of lams2-bb-plugin-1.x.war + 3. Enter all necessary information and press submit. + + +7. Accessing Gradebook marks +================================================================================ + 1. Created LAMS lesson. + Once you created LAMS lesson it automatically adds grade to gradebook using the next algorithm: if LAMS lesson contains MCQ or Assessment + it creates scorable grade, otherwise - complete/incomplete grade. + 2. Go to Courses->${YOUR_COURSE_NAME}->Grade Center->Full Grade Center. + And you'll see there the grade with lesson's name. That is the column which will hold all the grades for that lesson. + * One note though: only learners receive grades (thus Administrators don't get one) Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/Constants.java =================================================================== diff -u -r8af1746d179f41095b074fef269722c6689b39eb -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea --- lams_bb_integration/src/org/lamsfoundation/ld/integration/Constants.java (.../Constants.java) (revision 8af1746d179f41095b074fef269722c6689b39eb) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/Constants.java (.../Constants.java) (revision 7313b5c073ae563d642a7ef9a2acec81caa2a8ea) @@ -23,36 +23,38 @@ package org.lamsfoundation.ld.integration; /** - * Constants used for blackboard integration - * - * @author Luke Foxton + * Constants used for blackboard integration + * + * @author Luke Foxton */ public class Constants { - + public static final String PARAM_USER_ID = "uid"; public static final String PARAM_SERVER_ID = "sid"; public static final String PARAM_TIMESTAMP = "ts"; public static final String PARAM_HASH = "hash"; - //public static final String PARAM_URL = "url"; + // public static final String PARAM_URL = "url"; public static final String PARAM_METHOD = "method"; - public static final String PARAM_LEARNING_SESSION_ID = "lsid"; + public static final String PARAM_LESSON_ID = "lsId"; public static final String PARAM_LEARNING_DESIGN_ID = "ldid"; public static final String PARAM_COURSE_ID = "course_id"; - public static final String SERVLET_LOGIN_REQUEST = "/lams/LoginRequest"; public static final String SERVLET_ACTION_REQUEST = "/LamsActionRequest"; - + public static final String URLDECODER_CODING = "US-ASCII"; - + public static final String METHOD_AUTHOR = "author"; public static final String METHOD_MONITOR = "monitor"; public static final String METHOD_LEARNER = "learner"; - // XML format constnats - public static final String ELEM_FOLDER = "Folder"; - public static final String ELEM_LEARNING_DESIGN = "LearningDesign"; - public static final String ATTR_NAME = "name"; - public static final String ATTR_RESOURCE_ID = "resourceId"; - + public static final String GRADEBOOK_LINEITEM_TYPE = "LAMS grades"; + public static final int GRADEBOOK_POINTS_POSSIBLE = 100; + + // XML format constnats + public static final String ELEM_FOLDER = "Folder"; + public static final String ELEM_LEARNING_DESIGN = "LearningDesign"; + public static final String ATTR_NAME = "name"; + public static final String ATTR_RESOURCE_ID = "resourceId"; + } Fisheye: Tag c8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc refers to a dead (removed) revision in file `lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/GradebookServlet.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsSecurityUtil.java =================================================================== diff -u -r3c527d0998e4797bdfaefc359e036fa01a560ad9 -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea --- lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsSecurityUtil.java (.../LamsSecurityUtil.java) (revision 3c527d0998e4797bdfaefc359e036fa01a560ad9) +++ lams_bb_integration/src/org/lamsfoundation/ld/integration/blackboard/LamsSecurityUtil.java (.../LamsSecurityUtil.java) (revision 7313b5c073ae563d642a7ef9a2acec81caa2a8ea) @@ -22,11 +22,10 @@ */ package org.lamsfoundation.ld.integration.blackboard; -import java.lang.IllegalStateException; -import java.net.ConnectException; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; +import java.net.ConnectException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; @@ -35,476 +34,572 @@ import java.rmi.RemoteException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import blackboard.platform.context.Context; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + import org.apache.commons.codec.binary.Hex; +import org.apache.commons.io.IOUtils; +import org.apache.log4j.Logger; import org.lamsfoundation.ld.integration.Constants; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; -import org.apache.log4j.Logger; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; +import blackboard.platform.context.Context; /** - * This class creates URLs, servlet calls and webservice calls - * for communication with LAMS - * - * @author Luke Foxton + * This class creates URLs, servlet calls and webservice calls for communication with LAMS + * + * @author Luke Foxton */ public class LamsSecurityUtil { - + static Logger logger = Logger.getLogger(LamsSecurityUtil.class); - - + /** * Generates login requests to LAMS for author, monitor and learner * - * @param ctx the blackboard contect, contains session data - * @param method the mehtod to request of LAMS "author", "monitor", "learner" + * @param ctx + * the blackboard contect, contains session data + * @param method + * the mehtod to request of LAMS "author", "monitor", "learner" * @return a url pointing to the LAMS lesson, monitor, author session * @throws Exception */ - public static String generateRequestURL(Context ctx, String method) throws Exception - { - String serverAddr = getServerAddress(); - String serverId = getServerID(); - String reqSrc = getReqSrc(); - - // If lams.properties could not be read, throw exception - if(serverAddr == null || serverId == null || reqSrc==null){ - throw new Exception("Configuration Exception " + serverAddr + ", " + serverId); - } - - String timestamp = new Long(System.currentTimeMillis()).toString(); - String username = ctx.getUser().getUserName(); - String hash = generateAuthenticationHash(timestamp, username, method, serverId); - String courseId = ctx.getCourse().getCourseId(); - - String locale = ctx.getUser().getLocale(); - String country = getCountry(locale); - String lang = getLanguage(locale); + public static String generateRequestURL(Context ctx, String method) throws Exception { +// Course c = CourseDbLoader.Default.getInstance().loadByCourseId("aa"); +// Id cID = c.getId(); +// +// OutcomeDefinition def = new OutcomeDefinition(); +// Id sID = OutcomeDefinitionScaleDbLoader.Default.getInstance().loadByCourseIdAndTitle(cID, OutcomeDefinitionScale.COMPLETE_INCOMPLETE).getId(); +// def.setScaleId(sID); +// //def.setScorable(false); +// OutcomeDefinitionDbPersister.Default.getInstance().persist(def); + + String serverAddr = getServerAddress(); + String serverId = getServerID(); + String reqSrc = getReqSrc(); - String url; - try { - url = serverAddr + "/LoginRequest?" - + "&uid=" + URLEncoder.encode(username, "UTF8") - + "&method=" + method - + "&ts=" + timestamp - + "&sid=" + serverId - + "&hash=" + hash - + "&courseid=" + URLEncoder.encode(courseId, "UTF8") - + "&country=" + country - + "&lang=" + lang - + "&requestSrc=" + URLEncoder.encode(reqSrc, "UTF8"); - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(); - } - - logger.info("LAMS Req: " + url); - //System.out.println(url); + // If lams.properties could not be read, throw exception + if (serverAddr == null || serverId == null || reqSrc == null) { + throw new Exception("Configuration Exception " + serverAddr + ", " + serverId); + } - return url; + String timestamp = new Long(System.currentTimeMillis()).toString(); + String username = ctx.getUser().getUserName(); + String hash = generateAuthenticationHash(timestamp, username, method, serverId); + String courseId = ctx.getCourse().getCourseId(); + + String locale = ctx.getUser().getLocale(); + String country = getCountry(locale); + String lang = getLanguage(locale); + + String url; + try { + url = serverAddr + "/LoginRequest?" + "&uid=" + URLEncoder.encode(username, "UTF8") + "&method=" + method + + "&ts=" + timestamp + "&sid=" + serverId + "&hash=" + hash + "&courseid=" + + URLEncoder.encode(courseId, "UTF8") + "&country=" + country + "&lang=" + lang + "&requestSrc=" + + URLEncoder.encode(reqSrc, "UTF8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(); } + + logger.info("LAMS Req: " + url); + // System.out.println(url); + + return url; + } /** + * Generates default + */ + public static String generateAuthenticateParameters(Context ctx) throws Exception { + String serverAddr = getServerAddress(); + String serverId = getServerID(); + String reqSrc = getReqSrc(); + + // If lams.properties could not be read, throw exception + if (serverAddr == null || serverId == null || reqSrc == null) { + throw new Exception("Configuration Exception " + serverAddr + ", " + serverId); + } + + String timestamp = new Long(System.currentTimeMillis()).toString(); + String username = ctx.getUser().getUserName(); + String hash = generateAuthenticationHash(timestamp, username, serverId); + + String authenticateParameters = "&serverId=" + serverId + "&datetime=" + timestamp + "&hashValue=" + hash + + "&username=" + URLEncoder.encode(username, "UTF8"); + + return authenticateParameters; + } + + /** + * Generates url request to LAMS for LearningDesignImage. + * + * @param ctx + * the blackboard contect, contains session data + * @return a url pointing to the LAMS lesson, monitor, author session + * @throws Exception + */ + public static String generateRequestLearningDesignImage(Context ctx, boolean isSvgImage) throws Exception { + String serverAddr = getServerAddress(); + int svgFormat = (isSvgImage) ? 1 : 2; + + //$request = "$CFG->lamslesson_serverurl/services/LearningDesignSVG?serverId=" . $CFG->lamslesson_serverid . "&datetime=" . $datetime_encoded . "&hashValue=" . + //$hashvalue . "&username=" . $username . "&courseId=" . $courseid . "&courseName=" . urlencode($coursename) . "&mode=2&country=" . $country . "&lang=" . $lang . + //"&ldId=" . $ldid . "&svgFormat=" . $format; + String url = serverAddr + "/services/LearningDesignSVG?" + generateAuthenticateParameters(ctx) + "&svgFormat=" + svgFormat; + + logger.info("LAMS Req: " + url); + + return url; + } + + /** + * Checks whether lesson has scorable outputs (i.e. MCQ or Assessment activity). + * + * @param ctx + * the blackboard contect, contains session data + * @return a url pointing to the LAMS lesson, monitor, author session + * @throws Exception + */ + public static boolean hasLessonScoreOutputs(Context ctx) throws Exception { + String ldId = ctx.getRequestParameter("sequence_id").trim(); + String learningDesignSvgUrl = generateRequestLearningDesignImage(ctx, true) + "&ldId=" + ldId; + + URL url = new URL(learningDesignSvgUrl); + URLConnection conn = url.openConnection(); + if (!(conn instanceof HttpURLConnection)) { + logger.error("Unable to open connection to: " + learningDesignSvgUrl); + } + + HttpURLConnection httpConn = (HttpURLConnection) conn; + + if (httpConn.getResponseCode() != HttpURLConnection.HTTP_OK) { + String errorMsg = "HTTP Response Code: " + httpConn.getResponseCode() + ", HTTP Response Message: " + + httpConn.getResponseMessage(); + logger.error(errorMsg); + throw new RuntimeException(errorMsg); + } + + // InputStream is = url.openConnection().getInputStream(); + InputStream is = conn.getInputStream(); + + // parse xml response + String learningDesignSvg = IOUtils.toString(is, "UTF-8"); + boolean hasLessonScoreOutputs = (learningDesignSvg.indexOf("icon_mcq.png") != -1) || (learningDesignSvg.indexOf("icon_assessment.png") != -1); + + return hasLessonScoreOutputs; + } + + /** * Gets a list of learning designs for the current user from LAMS * - * @param ctx the blackboard contect, contains session data - * @param mode the mode to call upon learning designes + * @param ctx + * the blackboard contect, contains session data + * @param mode + * the mode to call upon learning designes * @return a string containing the LAMS workspace tree in tigra format * @throws Exception */ - public static String getLearningDesigns(Context ctx, Integer mode) throws Exception - { - String serverAddr = getServerAddress(); - String serverId = getServerID(); - String serverKey = getServerKey(); - - // If lams.properties could not be read, throw exception - if(serverAddr == null || serverId == null || serverKey==null){ - throw new Exception("Configuration Exception " + serverAddr + ", " + serverId); - } - - String timestamp = new Long(System.currentTimeMillis()).toString(); - String username = ctx.getUser().getUserName(); - String hash = generateAuthenticationHash(timestamp, username, serverId); - String courseId = ctx.getCourse().getCourseId(); + public static String getLearningDesigns(Context ctx, Integer mode) throws Exception { + String serverAddr = getServerAddress(); + String serverId = getServerID(); + String serverKey = getServerKey(); - String locale = ctx.getUser().getLocale(); - String country = getCountry(locale); - String lang = getLanguage(locale); + // If lams.properties could not be read, throw exception + if (serverAddr == null || serverId == null || serverKey == null) { + throw new Exception("Configuration Exception " + serverAddr + ", " + serverId); + } - // TODO: Make locale settings work - String learningDesigns = "[]"; // empty javascript array - try { - String serviceURL = serverAddr + "/services/xml/LearningDesignRepository?" - + "datetime=" + timestamp - + "&username=" + URLEncoder.encode(username, "utf8") - + "&serverId=" + URLEncoder.encode(serverId, "utf8") - + "&hashValue=" + hash - + "&courseId=" + URLEncoder.encode(courseId, "UTF8") - + "&country=" + country - + "&lang=" + lang - + "&mode=" + mode; - - URL url = new URL(serviceURL); - URLConnection conn = url.openConnection(); - if (!(conn instanceof HttpURLConnection)) { - logger.error("Unable to open connection to: " + serviceURL); - } - - HttpURLConnection httpConn = (HttpURLConnection)conn; - - - if (httpConn.getResponseCode() != HttpURLConnection.HTTP_OK) { - logger.error("HTTP Response Code: " + httpConn.getResponseCode() - + ", HTTP Response Message: " + httpConn.getResponseMessage()); - return "error"; - } - - - //InputStream is = url.openConnection().getInputStream(); - InputStream is = conn.getInputStream(); - - - // parse xml response - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - Document document = db.parse(is); - - learningDesigns = "[" + convertToTigraFormat(document.getDocumentElement()) + "]"; - - // replace sequence id with javascript method - String pattern = "'(\\d+)'"; - String replacement = "'javascript:selectSequence($1)'"; - learningDesigns = learningDesigns.replaceAll(pattern, replacement); - - // TODO better error handling - } catch (MalformedURLException e) { - logger.error("Unable to get LAMS learning designs, bad URL: '" - + serverAddr - + "', please check lams.properties", e); - e.printStackTrace(); - return "error"; - }catch (IllegalStateException e){ - logger.error("LAMS Server timeout, did not get a response from the LAMS server. Please contact your systems administrator", e); - e.printStackTrace(); - return "error"; - }catch (ConnectException e){ - logger.error("LAMS Server timeout, did not get a response from the LAMS server. Please contact your systems administrator", e); - e.printStackTrace(); - return "error"; - } catch (UnsupportedEncodingException e) { - logger.error(e); - e.printStackTrace(); - return "error"; - } catch (IOException e) { - logger.error(e); - e.printStackTrace(); - return "error"; - } catch (ParserConfigurationException e) { - logger.error(e); - e.printStackTrace(); - return "error"; - } catch (SAXException e) { - logger.error(e); - e.printStackTrace(); - return "error"; - } - return learningDesigns; + String timestamp = new Long(System.currentTimeMillis()).toString(); + String username = ctx.getUser().getUserName(); + String hash = generateAuthenticationHash(timestamp, username, serverId); + String courseId = ctx.getCourse().getCourseId(); + + String locale = ctx.getUser().getLocale(); + String country = getCountry(locale); + String lang = getLanguage(locale); + + // TODO: Make locale settings work + String learningDesigns = "[]"; // empty javascript array + try { + String serviceURL = serverAddr + "/services/xml/LearningDesignRepository?" + "datetime=" + timestamp + + "&username=" + URLEncoder.encode(username, "utf8") + "&serverId=" + + URLEncoder.encode(serverId, "utf8") + "&hashValue=" + hash + "&courseId=" + + URLEncoder.encode(courseId, "UTF8") + "&country=" + country + "&lang=" + lang + "&mode=" + mode; + + URL url = new URL(serviceURL); + URLConnection conn = url.openConnection(); + if (!(conn instanceof HttpURLConnection)) { + logger.error("Unable to open connection to: " + serviceURL); + } + + HttpURLConnection httpConn = (HttpURLConnection) conn; + + if (httpConn.getResponseCode() != HttpURLConnection.HTTP_OK) { + logger.error("HTTP Response Code: " + httpConn.getResponseCode() + ", HTTP Response Message: " + + httpConn.getResponseMessage()); + return "error"; + } + + // InputStream is = url.openConnection().getInputStream(); + InputStream is = conn.getInputStream(); + + // parse xml response + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document document = db.parse(is); + + learningDesigns = "[" + convertToTigraFormat(document.getDocumentElement()) + "]"; + + // replace sequence id with javascript method + //String pattern = "'(\\d+)'"; + //String replacement = "'javascript:selectSequence($1)'"; + //learningDesigns = learningDesigns.replaceAll(pattern, replacement); + + // TODO better error handling + } catch (MalformedURLException e) { + logger.error("Unable to get LAMS learning designs, bad URL: '" + serverAddr + + "', please check lams.properties", e); + e.printStackTrace(); + return "error"; + } catch (IllegalStateException e) { + logger.error( + "LAMS Server timeout, did not get a response from the LAMS server. Please contact your systems administrator", + e); + e.printStackTrace(); + return "error"; + } catch (ConnectException e) { + logger.error( + "LAMS Server timeout, did not get a response from the LAMS server. Please contact your systems administrator", + e); + e.printStackTrace(); + return "error"; + } catch (UnsupportedEncodingException e) { + logger.error(e); + e.printStackTrace(); + return "error"; + } catch (IOException e) { + logger.error(e); + e.printStackTrace(); + return "error"; + } catch (ParserConfigurationException e) { + logger.error(e); + e.printStackTrace(); + return "error"; + } catch (SAXException e) { + logger.error(e); + e.printStackTrace(); + return "error"; + } + return learningDesigns; } - + /** * Starts lessons in lams through a LAMS webservice * - * @param ctx the blackboard contect, contains session data - * @param ldId the learning design id for which you wish to start a lesson - * @param title the title of the lesson - * @param desc the description of the lesson + * @param ctx + * the blackboard contect, contains session data + * @param ldId + * the learning design id for which you wish to start a lesson + * @param title + * the title of the lesson + * @param desc + * the description of the lesson + * * @return the learning session id */ - public static Long startLesson(Context ctx, long ldId, String title, String desc) - { - Long error = new Long(-1); - String serverId = getServerID(); - String serverAddr = getServerAddress(); - String serverKey = getServerKey(); - String courseId = ctx.getCourse().getCourseId(); - String username = ctx.getUser().getUserName(); - String locale = ctx.getUser().getLocale(); - String country = getCountry(locale); - String lang = getLanguage(locale); - - if (serverId == null || serverAddr == null || serverKey == null ) { - logger.error("Unable to retrieve learning designs from LAMS, one or more lams configuration properties is null"); - return null; - } - - try { - - String timestamp = new Long(System.currentTimeMillis()).toString(); - String hash = generateAuthenticationHash(timestamp, username, serverId); - - // (serverId, datetime, hashValue, username, ldId, courseId, title, desc, country, lang) + public static Long startLesson(Context ctx, long ldId, String title, String desc, boolean isPreview) { + Long error = new Long(-1); + String serverId = getServerID(); + String serverAddr = getServerAddress(); + String serverKey = getServerKey(); + String courseId = ctx.getCourse().getCourseId(); + String username = ctx.getUser().getUserName(); + String locale = ctx.getUser().getLocale(); + String country = getCountry(locale); + String lang = getLanguage(locale); + String method = (isPreview) ? "preview" : "start"; - String serviceURL = serverAddr + "/services/xml/LessonManager?" - + "&serverId=" + URLEncoder.encode(serverId, "utf8") - + "&datetime=" + timestamp - + "&username=" + URLEncoder.encode(username, "utf8") - + "&hashValue=" + hash - + "&courseId=" + URLEncoder.encode(courseId, "utf8") - + "&ldId=" + new Long(ldId).toString() - + "&country=" + country - + "&lang=" + lang - + "&method=" + "start" - + "&title=" + URLEncoder.encode(title, "utf8").trim() - + "&desc=" + URLEncoder.encode(desc, "utf8").trim(); - - - logger.info("LAMS START LESSON Req: " + serviceURL); - //System.out.println("START LESSON: " + serviceURL); - - URL url = new URL(serviceURL); - URLConnection conn = url.openConnection(); - if (!(conn instanceof HttpURLConnection)) { - logger.error("Unable to open connection to: " + serviceURL); - } - - HttpURLConnection httpConn = (HttpURLConnection)conn; - - if (httpConn.getResponseCode() != HttpURLConnection.HTTP_OK) { - logger.error("HTTP Response Code: " + httpConn.getResponseCode() - + ", HTTP Response Message: " + httpConn.getResponseMessage()); - return error; - } - - //InputStream is = url.openConnection().getInputStream(); - InputStream is = conn.getInputStream(); - - - // parse xml response - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - DocumentBuilder db = dbf.newDocumentBuilder(); - Document document = db.parse(is); - - // get the lesson id from the response - - /* - * The getTextContext is not a java 1.4 method, so Blackboard 7.1 comes up with errors - * using getNodeValue() instead - */ - //return Long.parseLong(document.getElementsByTagName("Lesson").item(0).getAttributes().getNamedItem("lessonId").getTextContent()); - return Long.parseLong(document.getElementsByTagName("Lesson").item(0).getAttributes().getNamedItem("lessonId").getNodeValue()); - } catch (MalformedURLException e) { - logger.error("Unable to start LAMS lesson, bad URL: '" - + serverAddr - + "', please check lams.properties", e); - e.printStackTrace(); - return error; - }catch (IllegalStateException e){ - logger.error("LAMS Server timeout, did not get a response from the LAMS server. Please contact your systems administrator", e); - e.printStackTrace(); - return error; - } catch (RemoteException e) { - logger.error("Unable to start LAMS lesson, RMI Remote Exception",e); - e.printStackTrace(); - return error; - } catch (UnsupportedEncodingException e) - { - logger.error("Unable to start LAMS lesson, Unsupported Encoding Exception",e); - e.printStackTrace(); - return error; - } - catch (ConnectException e) - { - logger.error("LAMS Server timeout, did not get a response from the LAMS server. Please contact your systems administrator", e); - e.printStackTrace(); - return error; - } - catch (Exception e) { - logger.error("Unable to start LAMS lesson. Please contact your system administrator.",e); - e.printStackTrace(); - return error; - } - + if (serverId == null || serverAddr == null || serverKey == null) { + logger.error("Unable to retrieve learning designs from LAMS, one or more lams configuration properties is null"); + return null; } - - + + try { + + String timestamp = new Long(System.currentTimeMillis()).toString(); + String hash = generateAuthenticationHash(timestamp, username, serverId); + + // (serverId, datetime, hashValue, username, ldId, courseId, title, desc, country, lang) + + String serviceURL = serverAddr + "/services/xml/LessonManager?" + "&serverId=" + + URLEncoder.encode(serverId, "utf8") + "&datetime=" + timestamp + "&username=" + + URLEncoder.encode(username, "utf8") + "&hashValue=" + hash + "&courseId=" + + URLEncoder.encode(courseId, "utf8") + "&ldId=" + new Long(ldId).toString() + "&country=" + + country + "&lang=" + lang + "&method=" + method + "&title=" + + URLEncoder.encode(title, "utf8").trim() + "&desc=" + URLEncoder.encode(desc, "utf8").trim(); + + logger.info("LAMS START LESSON Req: " + serviceURL); + // System.out.println("START LESSON: " + serviceURL); + + URL url = new URL(serviceURL); + URLConnection conn = url.openConnection(); + if (!(conn instanceof HttpURLConnection)) { + logger.error("Unable to open connection to: " + serviceURL); + } + + HttpURLConnection httpConn = (HttpURLConnection) conn; + + if (httpConn.getResponseCode() != HttpURLConnection.HTTP_OK) { + logger.error("HTTP Response Code: " + httpConn.getResponseCode() + ", HTTP Response Message: " + + httpConn.getResponseMessage()); + return error; + } + + // InputStream is = url.openConnection().getInputStream(); + InputStream is = conn.getInputStream(); + + // parse xml response + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document document = db.parse(is); + + // get the lesson id from the response + + /* + * The getTextContext is not a java 1.4 method, so Blackboard 7.1 comes up with errors using getNodeValue() + * instead + */ + // return + // Long.parseLong(document.getElementsByTagName("Lesson").item(0).getAttributes().getNamedItem("lessonId").getTextContent()); + return Long.parseLong(document.getElementsByTagName("Lesson").item(0).getAttributes() + .getNamedItem("lessonId").getNodeValue()); + } catch (MalformedURLException e) { + logger.error("Unable to start LAMS lesson, bad URL: '" + serverAddr + "', please check lams.properties", e); + e.printStackTrace(); + return error; + } catch (IllegalStateException e) { + logger.error( + "LAMS Server timeout, did not get a response from the LAMS server. Please contact your systems administrator", + e); + e.printStackTrace(); + return error; + } catch (RemoteException e) { + logger.error("Unable to start LAMS lesson, RMI Remote Exception", e); + e.printStackTrace(); + return error; + } catch (UnsupportedEncodingException e) { + logger.error("Unable to start LAMS lesson, Unsupported Encoding Exception", e); + e.printStackTrace(); + return error; + } catch (ConnectException e) { + logger.error( + "LAMS Server timeout, did not get a response from the LAMS server. Please contact your systems administrator", + e); + e.printStackTrace(); + return error; + } catch (Exception e) { + logger.error("Unable to start LAMS lesson. Please contact your system administrator.", e); + e.printStackTrace(); + return error; + } + + } + /** * @return gets server address from the lams.properties file */ - public static String getServerAddress() - { - return LamsPluginUtil.getProperties().getProperty(LamsPluginUtil.PROP_LAMS_URL); + public static String getServerAddress() { + return LamsPluginUtil.getProperties().getProperty(LamsPluginUtil.PROP_LAMS_URL); } - + /** * @return gets server id from the lams.properties file */ - public static String getServerID() - { - return LamsPluginUtil.getProperties().getProperty(LamsPluginUtil.PROP_LAMS_SERVER_ID); + public static String getServerID() { + return LamsPluginUtil.getProperties().getProperty(LamsPluginUtil.PROP_LAMS_SERVER_ID); } - + /** * @return gets server key from the lams.properties file */ - public static String getServerKey() - { - return LamsPluginUtil.getProperties().getProperty(LamsPluginUtil.PROP_LAMS_SECRET_KEY); + public static String getServerKey() { + return LamsPluginUtil.getProperties().getProperty(LamsPluginUtil.PROP_LAMS_SECRET_KEY); } - + /** * @return gets request source from the lams.properties file */ - public static String getReqSrc() - { - return LamsPluginUtil.getProperties().getProperty(LamsPluginUtil.PROP_REQ_SRC); + public static String getReqSrc() { + return LamsPluginUtil.getProperties().getProperty(LamsPluginUtil.PROP_REQ_SRC); } - - + + +// +// if (empty($array['#']['LearningDesign']) && empty($array['#']['Folder'])) { +// $output .= ",expanded:0,children:[{type:'HTML',html:'-" . get_string('empty', 'lamslesson') . "-', id:0}]}"; +// return $output; +// } else { +// $output .= ",children:["; +// } +// +// if (!empty($array['#']['LearningDesign'])) { +// $lds = $array['#']['LearningDesign']; +// for($i=0; $i-empty-', id:0}]}"); return sb.toString(); + } else { + sb.append(",children:["); + + + sb.append(convertToTigraFormat(children.item(0))); + for (int i = 1; i < children.getLength(); i++) { + sb.append(',').append(convertToTigraFormat(children.item(i))); + } + + sb.append("]}"); + } + + } else if (node.getNodeName().equals(Constants.ELEM_LEARNING_DESIGN)) { + + +// $ld_name = preg_replace("/'/", "$1\'", $xml_node['@']['name']); +// $output .= "{type:'Text',label:'" . $ld_name . "',id:'" . $xml_node['@']['resourceId'] . "'}"; + + StringBuilder attrName = new StringBuilder(node.getAttributes().getNamedItem(Constants.ATTR_NAME) + .getNodeValue().replace("'", "\\'")); + StringBuilder attrResId = new StringBuilder(node.getAttributes().getNamedItem(Constants.ATTR_RESOURCE_ID) + .getNodeValue().replace("'", "\\'")); + + sb.append("{type:'Text',label:'"); + sb.append(attrName); + sb.append("',id:'"); + sb.append(attrResId); + sb.append("'}"); } + return sb.toString(); + } - //generate authentication hash code to validate parameters + // generate authentication hash code to validate parameters public static String generateAuthenticationHash(String datetime, String login, String method, String serverId) { - String secretkey = LamsPluginUtil.getSecretKey(); - - String plaintext = datetime.toLowerCase().trim() + - login.toLowerCase().trim() + - method.toLowerCase().trim() + - serverId.toLowerCase().trim() + - secretkey.toLowerCase().trim(); - - String hash = sha1(plaintext); - return hash; + String secretkey = LamsPluginUtil.getSecretKey(); + + String plaintext = datetime.toLowerCase().trim() + login.toLowerCase().trim() + method.toLowerCase().trim() + + serverId.toLowerCase().trim() + secretkey.toLowerCase().trim(); + + String hash = sha1(plaintext); + return hash; } - - - //generate authentication hash code to validate parameters + // generate authentication hash code to validate parameters + public static String generateAuthenticationHash(String datetime, String login, String serverId) { - String secretkey = getServerKey(); - - String plaintext = datetime.toLowerCase().trim() + - login.toLowerCase().trim() + - serverId.toLowerCase().trim() + - secretkey.toLowerCase().trim(); - - String hash = sha1(plaintext); - - return hash; + String secretkey = getServerKey(); + + String plaintext = datetime.toLowerCase().trim() + login.toLowerCase().trim() + serverId.toLowerCase().trim() + + secretkey.toLowerCase().trim(); + + String hash = sha1(plaintext); + + return hash; } - - //generate authentication hash code to validate parameters - public static String generateAuthenticationHash(String datetime, String serverId) - throws NoSuchAlgorithmException { - String secretkey = LamsPluginUtil.getSecretKey(); - - String plaintext = datetime.toLowerCase().trim() + - serverId.toLowerCase().trim() + - secretkey.toLowerCase().trim() ; - - return sha1(plaintext); + + // generate authentication hash code to validate parameters + public static String generateAuthenticationHash(String datetime, String serverId) throws NoSuchAlgorithmException { + String secretkey = LamsPluginUtil.getSecretKey(); + + String plaintext = datetime.toLowerCase().trim() + serverId.toLowerCase().trim() + + secretkey.toLowerCase().trim(); + + return sha1(plaintext); } - - + /** - * The parameters are: - * uid - the username on the external system - * method - either author, monitor or learner - * ts - timestamp - * sid - serverID - * str is [ts + uid + method + serverID + serverKey] (Note: all lower case) + * The parameters are: uid - the username on the external system method - either author, monitor or learner ts - + * timestamp sid - serverID str is [ts + uid + method + serverID + serverKey] (Note: all lower case) * - * @param str The string to be hashed + * @param str + * The string to be hashed * @return The hased string */ - private static String sha1(String str){ - try{ - MessageDigest md = MessageDigest.getInstance("SHA1"); - return new String(Hex.encodeHex(md.digest(str.getBytes()))); - } catch(NoSuchAlgorithmException e){ - throw new RuntimeException(e); - } + private static String sha1(String str) { + try { + MessageDigest md = MessageDigest.getInstance("SHA1"); + return new String(Hex.encodeHex(md.digest(str.getBytes()))); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); } - - /** - * - * @param localeStr the full balckboard locale string - * @return the language - */ - public static String getLanguage(String localeStr) - { - if (localeStr==null) - return "xx"; - String[] split = localeStr.split("_"); - return split[0]; - } - - /** - * - * @param localeStr the full balckboard locale string - * @return the country - */ - public static String getCountry(String localeStr) - { - if (localeStr==null) - return "XX"; - String[] split = localeStr.split("_"); - return split[1]; - } - - - + } + + /** + * + * @param localeStr + * the full balckboard locale string + * @return the language + */ + public static String getLanguage(String localeStr) { + if (localeStr == null) + return "xx"; + String[] split = localeStr.split("_"); + return split[0]; + } + + /** + * + * @param localeStr + * the full balckboard locale string + * @return the country + */ + public static String getCountry(String localeStr) { + if (localeStr == null) + return "XX"; + String[] split = localeStr.split("_"); + return split[1]; + } + } Index: lams_bb_integration/web/images/folders/lm.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/folders/lmh.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/folders/ln.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/folders/loading.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/folders/lp.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/folders/lph.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/folders/tm.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/folders/tmh.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/folders/tn.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/folders/tp.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/folders/tph.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/folders/vline.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/sam/check0.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/sam/check1.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/sam/check2.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/sam/loading.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/sam/treeview-loading.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Index: lams_bb_integration/web/images/sam/treeview-sprite.gif =================================================================== diff -u -rc8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea Binary files differ Fisheye: Tag e145b2587e58d80c54fb208848e06d290c5473cd refers to a dead (removed) revision in file `lams_bb_integration/web/lib/tree/treeview-min.js'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag e145b2587e58d80c54fb208848e06d290c5473cd refers to a dead (removed) revision in file `lams_bb_integration/web/lib/tree/yahoo-dom-event.js'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_bb_integration/web/modules/create.jsp =================================================================== diff -u -r3c527d0998e4797bdfaefc359e036fa01a560ad9 -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea --- lams_bb_integration/web/modules/create.jsp (.../create.jsp) (revision 3c527d0998e4797bdfaefc359e036fa01a560ad9) +++ lams_bb_integration/web/modules/create.jsp (.../create.jsp) (revision 7313b5c073ae563d642a7ef9a2acec81caa2a8ea) @@ -10,8 +10,7 @@ Then the user must select a LAMS lesson before proceeding to Step 2. Step 1 - create.jsp - Step 2 - start_lesson.jsp - Step 3 - start_lesson_proc.jsp + Step 2 - start_lesson_proc.jsp --%> <%@ page import="blackboard.platform.plugin.PlugInUtil"%> <%@ page import="blackboard.platform.plugin.PlugInException"%> @@ -21,8 +20,11 @@ <%@ taglib uri="/bbNG" prefix="bbNG"%> - - + + + + + <% // SECURITY! // Authorise current user for Course Control Panel (automatic redirect) @@ -38,11 +40,12 @@ // Get the list of Learning Designs String learningDesigns = LamsSecurityUtil.getLearningDesigns(ctx, 2); - // Error checking - if (learningDesigns.equals("error")) { - response.sendRedirect("lamsServerDown.jsp"); - return; - } + // Error checking + if (learningDesigns.equals("error")) { + response.sendRedirect("lamsServerDown.jsp"); + return; + } + String lamsServerUrl = LamsSecurityUtil.getServerAddress(); %> <%-- Breadcrumbs --%> @@ -55,38 +58,108 @@ - <%-- Action Control Bar --%> - - <%-- Open the LAMS Author Window --%> - <%-- Refresh the list of LAMS sequences --%> - <%-- Go to Next Step --%> - - <%-- Form to Collect ID of Selected LAMS Sequence --%> - + "> "> - <%-- Display LAMS Sequence tree (Using tigra) --%> - + + + + + + + + + + + + + + + + <%-- Preview and Author Buttons --%> + + + + + Preview this lesson + + + + + + + + Author new LAMS lessons + + + + + + + + + Display image design? + + + <%-- Display LAMS Sequence tree (Using tigra) --%> + + + + + + Yes + No + + + Yes + No + + + + + + + + + - Fisheye: Tag e145b2587e58d80c54fb208848e06d290c5473cd refers to a dead (removed) revision in file `lams_bb_integration/web/modules/css/folders.css'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag e145b2587e58d80c54fb208848e06d290c5473cd refers to a dead (removed) revision in file `lams_bb_integration/web/modules/css/treeview.css'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c8c8851ebc6c34fc0e8e13c8a880fe21fc03b8cc refers to a dead (removed) revision in file `lams_bb_integration/web/modules/delete.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 7313b5c073ae563d642a7ef9a2acec81caa2a8ea refers to a dead (removed) revision in file `lams_bb_integration/web/modules/gradeit.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 7313b5c073ae563d642a7ef9a2acec81caa2a8ea refers to a dead (removed) revision in file `lams_bb_integration/web/modules/index.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_bb_integration/web/modules/learnermonitor.jsp =================================================================== diff -u -r3c527d0998e4797bdfaefc359e036fa01a560ad9 -r7313b5c073ae563d642a7ef9a2acec81caa2a8ea --- lams_bb_integration/web/modules/learnermonitor.jsp (.../learnermonitor.jsp) (revision 3c527d0998e4797bdfaefc359e036fa01a560ad9) +++ lams_bb_integration/web/modules/learnermonitor.jsp (.../learnermonitor.jsp) (revision 7313b5c073ae563d642a7ef9a2acec81caa2a8ea) @@ -20,6 +20,8 @@ <%@ page import="blackboard.data.content.*"%> <%@ page import="blackboard.persist.content.*"%> <%@ page import="blackboard.persist.navigation.CourseTocDbLoader"%> +<%@ page import="blackboard.persist.gradebook.*"%> +<%@ page import="blackboard.data.gradebook.*"%> <%@ page import="blackboard.db.*"%> <%@ page import="blackboard.base.*"%> <%@ page import="blackboard.platform.*"%> @@ -83,6 +85,29 @@ if (!isActive) { PlugInUtil.sendAccessDeniedRedirect(request, response); } + + String strIsDisplayDesignImage = request.getParameter("isDisplayDesignImage"); + boolean isDisplayDesignImage = strIsDisplayDesignImage.equals("true")?true:false; + + String learningDesignImageUrl = ""; + if (isDisplayDesignImage) { + String strLearningDesignId = request.getParameter("ldid").trim(); + long learningDesignId = Long.parseLong(strLearningDesignId); + + learningDesignImageUrl = LamsSecurityUtil.generateRequestLearningDesignImage(ctx, false) + "&ldId=" + learningDesignId; + } + + //check whether user has score for this lesson + String strLineitemId = request.getParameter("lineitemid").trim(); + Id lineitemId = bbPm.generateId(Lineitem.LINEITEM_DATA_TYPE, strLineitemId); + ScoreDbLoader scoreLoader = (ScoreDbLoader) bbPm.getLoader(ScoreDbLoader.TYPE); + Score current_score = null; + try { + current_score = scoreLoader.loadByCourseMembershipIdAndLineitemId(courseMembership.getId(), lineitemId); + } catch (KeyNotFoundException c) { + //no score availalbe + } + boolean isScoreAvailable = (current_score != null); %> <%-- Breadcrumbs --%> @@ -103,6 +128,26 @@ <% } %> <%-- Cancel (Go Back) --%> + + + <%=request.getParameter("title")%> + + + <%=request.getParameter("description")%> + + + <% if(isDisplayDesignImage) { %> + + + + <% } %> + + <% if(isScoreAvailable) { %> + + You have completed this lesson. + + <% } %> +