[Ils-source] r1536 - in branches/1.6: . src/com/resolutions/ils/data webapp webapp/WEB-INF webapp/WEB-INF/classes webapp/WEB-INF/lib webapp/api/courseattempt/get webapp/examples

scribe at crosswire.org scribe at crosswire.org
Fri Apr 28 17:03:41 MST 2017


Author: scribe
Date: 2017-04-28 17:03:41 -0700 (Fri, 28 Apr 2017)
New Revision: 1536

Added:
   branches/1.6/webapp/WEB-INF/crosswire-i18n.tld
   branches/1.6/webapp/examples/testapilaunchcourse.php
Modified:
   branches/1.6/
   branches/1.6/src/com/resolutions/ils/data/CourseAttempt.java
   branches/1.6/webapp/WEB-INF/classes/versions.properties
   branches/1.6/webapp/WEB-INF/lib/ils.jar
   branches/1.6/webapp/api/courseattempt/get/index.jsp
   branches/1.6/webapp/header.jsp
Log:
moved i18n taglib into WEB-INF for newer versions of tomcat
Applying Adam's patch to add course attempt data lookup by user profle userdata key
Added example to show how to lauch a course for a user
Catch exception looking up saved course certs and continue if security error
1.81.3



Property changes on: branches/1.6
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:796-1502,1504-1505,1507,1509-1510,1512,1514-1515,1518,1527,1529-1530
   + /trunk:796-1502,1504-1505,1507,1509-1510,1512,1514-1515,1518,1527,1529-1530,1532-1535

Modified: branches/1.6/src/com/resolutions/ils/data/CourseAttempt.java
===================================================================
--- branches/1.6/src/com/resolutions/ils/data/CourseAttempt.java	2017-04-28 23:51:50 UTC (rev 1535)
+++ branches/1.6/src/com/resolutions/ils/data/CourseAttempt.java	2017-04-29 00:03:41 UTC (rev 1536)
@@ -809,25 +809,25 @@
 		Properties sysConfig = Utils.getSysConfig(null, getCompanyID());
 		String certsFolder = sysConfig.getProperty("certsFolder", "certs");
 logger.debug("certsFolder: " + certsFolder);
-		File sysConfigPath = Utils.getSysConfigFile(null, getCompanyID());
-		File certs = new File(sysConfigPath.getParentFile().getParent(), certsFolder);
-logger.debug("certsFolderPath: " + certs.getAbsolutePath());
-		if (certs.exists()) {
-			String certName = String.format("%08d_%08d_%08d.pdf", getCourseAttemptUserProfileID(), getCourseAttemptCourseID(), getCourseAttemptID());
-			File cert = new File(certs, certName);
-logger.debug("certPath: " + cert.getAbsolutePath());
-			if (cert.exists()) {
-				try {
-logger.debug("Exists!");
-					byte[] certBytes = DataObject.getBytes(new FileInputStream(cert));
-logger.debug("certBytes: " + certBytes);
-					return certBytes;
+		try {
+			File sysConfigPath = Utils.getSysConfigFile(null, getCompanyID());
+			File certs = new File(sysConfigPath.getParentFile().getParent(), certsFolder);
+	logger.debug("certsFolderPath: " + certs.getAbsolutePath());
+			if (certs.exists()) {
+				String certName = String.format("%08d_%08d_%08d.pdf", getCourseAttemptUserProfileID(), getCourseAttemptCourseID(), getCourseAttemptID());
+				File cert = new File(certs, certName);
+	logger.debug("certPath: " + cert.getAbsolutePath());
+				if (cert.exists()) {
+	logger.debug("Exists!");
+						byte[] certBytes = DataObject.getBytes(new FileInputStream(cert));
+	logger.debug("certBytes: " + certBytes);
+						return certBytes;
 				}
-				catch (Exception e) {
-logger.debug(e);
-				}
 			}
 		}
+		catch (Exception e) {
+			logger.error(e, e);
+		}
 		return null;
 	}
 

Modified: branches/1.6/webapp/WEB-INF/classes/versions.properties
===================================================================
--- branches/1.6/webapp/WEB-INF/classes/versions.properties	2017-04-28 23:51:50 UTC (rev 1535)
+++ branches/1.6/webapp/WEB-INF/classes/versions.properties	2017-04-29 00:03:41 UTC (rev 1536)
@@ -1 +1 @@
-LMS=V1.81.2
+LMS=V1.81.3

Copied: branches/1.6/webapp/WEB-INF/crosswire-i18n.tld (from rev 1532, trunk/webapp/WEB-INF/crosswire-i18n.tld)
===================================================================
--- branches/1.6/webapp/WEB-INF/crosswire-i18n.tld	                        (rev 0)
+++ branches/1.6/webapp/WEB-INF/crosswire-i18n.tld	2017-04-29 00:03:41 UTC (rev 1536)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
+<taglib>
+  <tlibversion>1.0</tlibversion>
+  <jspversion>1.1</jspversion>
+  <shortname>i18n</shortname>
+  <uri>http://www.crosswire.org/swordweb/i18n-1.0</uri>
+  <info>
+The i18n custom tag library contains tags that help manage the complexity of creating internationalized web applications. These tags provide similar (though not identical) functionality to the internationalization available in the struts framework, but do not require adopting the entire struts framework.
+
+"i18n" is a common abbreviation for internationalization, because there are 18
+letters between the first "i" and the last "n".
+
+For more information on internationalization with Java, the java.sun.com site
+contains a good
+tutorial written by Dale Green.
+</info>
+  <tag>
+    <name>pagestart</name>
+    <tagclass>org.crosswire.web.i18n.PageStart</tagclass>
+    <bodycontent>JSP</bodycontent>
+  </tag>
+  <tag>
+    <name>t</name>
+    <tagclass>org.crosswire.web.i18n.TranslateTag</tagclass>
+    <bodycontent>JSP</bodycontent>
+  </tag>
+</taglib>
+

Modified: branches/1.6/webapp/WEB-INF/lib/ils.jar
===================================================================
(Binary files differ)

Modified: branches/1.6/webapp/api/courseattempt/get/index.jsp
===================================================================
--- branches/1.6/webapp/api/courseattempt/get/index.jsp	2017-04-28 23:51:50 UTC (rev 1535)
+++ branches/1.6/webapp/api/courseattempt/get/index.jsp	2017-04-29 00:03:41 UTC (rev 1536)
@@ -7,6 +7,7 @@
 <%@ page import="com.resolutions.ils.ILSSession" %>
 <%@ page import="com.resolutions.ils.data.Company" %>
 <%@ page import="com.resolutions.ils.data.CourseAttempt" %>
+<%@ page import="com.resolutions.ils.data.UserProfile" %>
 <%@ page import="java.util.Vector" %>
 <%@ page import="java.util.Date" %>
 <%@ page import="java.util.TimeZone" %>
@@ -63,7 +64,17 @@
 	int courseAttemptID = -1; try { courseAttemptID = Integer.parseInt( request.getParameter("courseAttemptID") ); } catch(Exception e) {}
 	int userProfileID = -1; try { userProfileID = Integer.parseInt(request.getParameter("userProfileID")); } catch(Exception e) {};
 	int courseID = -1;  try { courseID = Integer.parseInt(request.getParameter("courseID")); } catch(Exception e) {};
+	String userProfileUserData = request.getParameter("userProfileUserData");
 
+	if (userProfileID == -1 && userProfileUserData != null && !userProfileUserData.isEmpty()) {
+		UserProfile up = UserProfile.getUserProfileByUserData(ilsSession, userProfileUserData);
+		if (up == null) {
+			out.print("<error message=\"UserProfileUserData: " + userProfileUserData + " not found.\"/>");
+			return;
+		}
+		userProfileID = up.getUserProfileID();
+	}
+
 	++errCode;
 	String val = request.getParameter("startDateTime");
 	Date startDateTime = null;
@@ -124,6 +135,7 @@
 <tr><th>startDateTime</th><td>retrieve a set of course attempts by filters, the start of the date and time range for which to retrieve Course Attempt records by completion date, inclusive (yyyyMMddHHmm), e.g., 201201240000</td></tr>
 <tr><th>endDateTime</th><td>the end of the date and time range for which to retrieve Course Attempt records by completion date, exclusive (yyyyMMddHHmm), e.g., 201201250000</td></tr>
 <tr><td><b>userProfileID</b></td><td>restrict results to a single user</td></tr>
+<tr><td><b>userProfileUserData</b></td><td>restrict results to a single user by their user data</td></tr>
 <tr><td><b>courseID</b></td><td>restrict results to a single course</td></tr>
 <tr><th>detail</th><td>(complete), brief, headeronly</td></tr>
 <tr><th>ILSUSER</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>

Copied: branches/1.6/webapp/examples/testapilaunchcourse.php (from rev 1534, trunk/webapp/examples/testapilaunchcourse.php)
===================================================================
--- branches/1.6/webapp/examples/testapilaunchcourse.php	                        (rev 0)
+++ branches/1.6/webapp/examples/testapilaunchcourse.php	2017-04-29 00:03:41 UTC (rev 1536)
@@ -0,0 +1,36 @@
+<?php
+require_once 'HTTP/Request2.php';
+
+$loginAPIURL = new HTTP_Request2('http://216.119.104.185:8081/api/session/login/index.jsp', HTTP_Request2::METHOD_POST);
+
+$launchAPIURL = 'http://216.119.104.185:8081/api/session/launch/index.jsp';
+$launchPoint = 'http://216.119.104.185:8081/aicc.jsp?courseid=1';
+
+$loginAPIURL->addPostParameter('ILSUSER', 'user1');
+$loginAPIURL->addPostParameter('ILSPASSWD', 'changeme');
+
+try {
+     $response = $loginAPIURL->send();
+     if (200 == $response->getStatus()) {
+          $loginToken = $response->getBody();
+          // check if we're a UUID
+          if (substr($loginToken, 8, 1) == '-' && substr($loginToken, 13, 1) == '-' && substr($loginToken, 18, 1) == '-') {
+               echo '
+<html><head>
+<meta http-equiv="Refresh" content="0;URL=' . $launchAPIURL . '?uuid=' . $loginToken . '&launchPoint=' . $launchPoint . '">
+</head></html>
+';
+          }
+          else {
+               echo 'Invalid Credentials (' . $loginToken . ')';
+          }
+     }
+     else {
+          echo 'Could not communicate with iLS (' . $response->getStatus() . ')';
+     }    
+} catch (HTTP_Request2_Exception $e) {
+     echo 'Error: ' . $e->getMessage();
+}
+
+?>
+

Modified: branches/1.6/webapp/header.jsp
===================================================================
--- branches/1.6/webapp/header.jsp	2017-04-28 23:51:50 UTC (rev 1535)
+++ branches/1.6/webapp/header.jsp	2017-04-29 00:03:41 UTC (rev 1536)
@@ -1,4 +1,4 @@
-<%@ taglib uri="/META-INF/crosswire-i18n.tld" prefix="t" %>
+<%@ taglib uri="/WEB-INF/crosswire-i18n.tld" prefix="t" %>
 	<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
 	<script type="text/javascript" src="js/chosen/chosen.jquery.min.js"></script>
 	<script type="text/javascript" src="crosswire.js"></script>




More information about the Ils-source mailing list