[Ils-source] r1485 - in branches/1.6: . db/mssql src/com/resolutions/ils src/com/resolutions/ils/data styles/Default_Horizontal/help webapp/WEB-INF/classes webapp/WEB-INF/lib webapp/api/ccure/user/put webapp/api/courseattempt webapp/api/courseattempt/get webapp/api/courseattempt/put webapp/api/group webapp/api/group/addmanager webapp/api/group/adduser webapp/api/group/removemanager webapp/api/group/removeuser webapp/api/session/login webapp/api/user/put
scribe at crosswire.org
scribe at crosswire.org
Wed Jul 13 04:36:13 MST 2016
Author: scribe
Date: 2016-07-13 04:36:13 -0700 (Wed, 13 Jul 2016)
New Revision: 1485
Added:
branches/1.6/db/mssql/upgrade1.80.7-1.sql
branches/1.6/webapp/WEB-INF/lib/batik-all-1.7.jar
branches/1.6/webapp/WEB-INF/lib/cssbox-4.10.jar
branches/1.6/webapp/WEB-INF/lib/fop.jar
branches/1.6/webapp/WEB-INF/lib/jstyleparser-1.21.jar
branches/1.6/webapp/api/courseattempt/put/
branches/1.6/webapp/api/courseattempt/put/index.jsp
branches/1.6/webapp/api/group/adduser/
branches/1.6/webapp/api/group/adduser/index.jsp
branches/1.6/webapp/api/group/removeuser/
branches/1.6/webapp/api/group/removeuser/index.jsp
Removed:
branches/1.6/webapp/api/courseattempt/put/index.jsp
branches/1.6/webapp/api/group/adduser/index.jsp
branches/1.6/webapp/api/group/removeuser/index.jsp
Modified:
branches/1.6/
branches/1.6/db/mssql/ilsdb.sql
branches/1.6/src/com/resolutions/ils/Utils.java
branches/1.6/src/com/resolutions/ils/data/Course.java
branches/1.6/src/com/resolutions/ils/data/CourseAttempt.java
branches/1.6/src/com/resolutions/ils/data/Group.java
branches/1.6/styles/Default_Horizontal/help/admin_userprofile.jsp
branches/1.6/webapp/WEB-INF/classes/versions.properties
branches/1.6/webapp/WEB-INF/lib/crosswire.jar
branches/1.6/webapp/WEB-INF/lib/ils.jar
branches/1.6/webapp/api/ccure/user/put/index.jsp
branches/1.6/webapp/api/courseattempt/get/index.jsp
branches/1.6/webapp/api/group/addmanager/index.jsp
branches/1.6/webapp/api/group/removemanager/index.jsp
branches/1.6/webapp/api/session/login/index.jsp
branches/1.6/webapp/api/user/put/index.jsp
Log:
merged in changes for 1.80.7
Property changes on: branches/1.6
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:796-1303,1306-1307,1309-1311,1319-1320,1322-1323,1325,1328-1330,1332,1334-1335,1337,1339,1349-1356,1359-1365,1369,1373-1374,1380-1383,1391,1393,1401-1404,1407,1409,1412,1416-1419,1421-1424,1427,1429,1431,1434,1436,1441,1446-1448,1457,1464
+ /trunk:796-1303,1306-1307,1309-1311,1319-1320,1322-1323,1325,1328-1330,1332,1334-1335,1337,1339,1349-1356,1359-1365,1369,1373-1374,1380-1383,1391,1393,1401-1404,1407,1409,1412,1416-1419,1421-1424,1427,1429,1431,1434,1436,1441,1446-1448,1457,1464,1466-1467,1470-1484
Modified: branches/1.6/db/mssql/ilsdb.sql
===================================================================
--- branches/1.6/db/mssql/ilsdb.sql 2016-07-13 10:57:10 UTC (rev 1484)
+++ branches/1.6/db/mssql/ilsdb.sql 2016-07-13 11:36:13 UTC (rev 1485)
@@ -1,7 +1,7 @@
CREATE TABLE ILSGROUP (COMPANYID INTEGER NOT NULL, ILSGROUPID INTEGER IDENTITY(1,1) NOT NULL, GROUPNAME VARCHAR(75) NOT NULL, GROUPDESC VARCHAR(255), GROUPTYPEID INTEGER, USERDATA VARCHAR(80), CONSTRAINT ILSGROUPPK1 PRIMARY KEY (COMPANYID, ILSGROUPID))
CREATE TABLE COURSE (COMPANYID INTEGER NOT NULL, COURSID INTEGER IDENTITY(1,1) NOT NULL, COURSNUM VARCHAR(20) NOT NULL, COURSNAME VARCHAR(100), COURSDESC VARCHAR(500), COURSTYPEID INTEGER, COURSPASS INTEGER, COURSPASSEXPDAYS INTEGER, COURSREASBEFDAYS INTEGER, COURSURL VARCHAR(255), COURSCKLISTURL VARCHAR(255), COURSCOST FLOAT, COURSSEATMINS INTEGER, COURSISCURRICULUM CHAR(1), COURSISQUICKVIEW CHAR(1), COURSPOSTDATE DATETIME, COURSISACTIVE CHAR(1), COURSISIPRESTRICTED char(1), COURSREQMGRAPPRVL CHAR(1), USERDATA VARCHAR(80), COURSISCURRICCERT char(1) DEFAULT 'F', COURSCERTGEN VARCHAR(60) DEFAULT null, CONSTRAINT COURSEPK1 PRIMARY KEY (COMPANYID, COURSID))
-CREATE TABLE USERPROFILE (COMPANYID INTEGER NOT NULL, USERPRID INTEGER IDENTITY(1,1) NOT NULL, USERPRNUM VARCHAR(50) NOT NULL, USERPRPASSWD VARCHAR(20), USERPRMNAME VARCHAR(40), USERPRSNAME VARCHAR(40), USERPRFNAME VARCHAR(40), USERPRLNAME VARCHAR(40), USERPRSTATUSID INTEGER, USERPRADDR1 VARCHAR(60),USERPRADDR2 VARCHAR(60),USERPRCITY VARCHAR(30),USERPRSTATE VARCHAR(2),USERPRZIP VARCHAR(12),USERPRCOUNTRY VARCHAR(50),USERPREMAIL VARCHAR(50), USERPRPHONE VARCHAR(50), USERPREMPTITLEID INTEGER, USERPRLASTLOGIN TIMESTAMP, USERPRACCESSLEVEL INTEGER, USERPRACCESSMOD INTEGER, USERPRINACTDATE DATETIME, USERPRHIREDATE DATETIME, USERPRTERMDATE DATETIME, USERPRIPRESTRICTOVERRIDE char(1), USERDATA VARCHAR(80), USERPRSECONDLOGINOVERRIDE char(1) DEFAULT 'F', USERPMGRRECUREMAILSOVERRIDE char(1) DEFAULT 'F', CONSTRAINT USERPROFILEPK1 PRIMARY KEY (COMPANYID, USERPRID))
+CREATE TABLE USERPROFILE (COMPANYID INTEGER NOT NULL, USERPRID INTEGER IDENTITY(1,1) NOT NULL, USERPRNUM VARCHAR(50) NOT NULL, USERPRPASSWD VARCHAR(50), USERPRMNAME VARCHAR(40), USERPRSNAME VARCHAR(40), USERPRFNAME VARCHAR(40), USERPRLNAME VARCHAR(40), USERPRSTATUSID INTEGER, USERPRADDR1 VARCHAR(60),USERPRADDR2 VARCHAR(60),USERPRCITY VARCHAR(30),USERPRSTATE VARCHAR(2),USERPRZIP VARCHAR(12),USERPRCOUNTRY VARCHAR(50),USERPREMAIL VARCHAR(50), USERPRPHONE VARCHAR(50), USERPREMPTITLEID INTEGER, USERPRLASTLOGIN TIMESTAMP, USERPRACCESSLEVEL INTEGER, USERPRACCESSMOD INTEGER, USERPRINACTDATE DATETIME, USERPRHIREDATE DATETIME, USERPRTERMDATE DATETIME, USERPRIPRESTRICTOVERRIDE char(1), USERDATA VARCHAR(80), USERPRSECONDLOGINOVERRIDE char(1) DEFAULT 'F', USERPMGRRECUREMAILSOVERRIDE char(1) DEFAULT 'F', CONSTRAINT USERPROFILEPK1 PRIMARY KEY (COMPANYID, USERPRID))
CREATE TABLE ANNOUNCEMENT (COMPANYID INTEGER NOT NULL, ANNOUNCID INTEGER IDENTITY(1,1) NOT NULL, ANNOUNCTITLE VARCHAR(100), ANNOUNCMESSAGE VARCHAR(255), ANNOUNCEXP DATETIME, ANNOUNCURL VARCHAR(255), ANNOUNCPOSTDATE DATETIME, USERDATA VARCHAR(80), CONSTRAINT ANNOUNCEMENTPK1 PRIMARY KEY (COMPANYID, ANNOUNCID))
CREATE TABLE RESOURCE (COMPANYID INTEGER NOT NULL, RESOURCID INTEGER IDENTITY(1,1) NOT NULL, RESOURCTITLE VARCHAR(100), RESOURCMESSAGE VARCHAR(255), RESOURCEXP DATETIME, RESOURCURL VARCHAR(255), RESOURCPOSTDATE DATETIME, RESOURCTYPE INTEGER, USERDATA VARCHAR(80), CONSTRAINT RESOURCEPK1 PRIMARY KEY (COMPANYID, RESOURCID))
CREATE TABLE USERGROUP (COMPANYID INTEGER NOT NULL, USERPRID INTEGER NOT NULL, ILSGROUPID INTEGER NOT NULL, CONSTRAINT USERGROUPPK1 PRIMARY KEY (COMPANYID, USERPRID, ILSGROUPID))
Copied: branches/1.6/db/mssql/upgrade1.80.7-1.sql (from rev 1482, trunk/db/mssql/upgrade1.80.7-1.sql)
===================================================================
--- branches/1.6/db/mssql/upgrade1.80.7-1.sql (rev 0)
+++ branches/1.6/db/mssql/upgrade1.80.7-1.sql 2016-07-13 11:36:13 UTC (rev 1485)
@@ -0,0 +1 @@
+ALTER TABLE USERPROFILE ALTER COLUMN USERPRPASSWD VARCHAR(50);
Modified: branches/1.6/src/com/resolutions/ils/Utils.java
===================================================================
--- branches/1.6/src/com/resolutions/ils/Utils.java 2016-07-13 10:57:10 UTC (rev 1484)
+++ branches/1.6/src/com/resolutions/ils/Utils.java 2016-07-13 11:36:13 UTC (rev 1485)
@@ -27,44 +27,44 @@
static Logger logger = Logger.getLogger(Utils.class);
- public static Properties getSysConfig(ServletContext context, int companyID) {
- Properties sysConfig = null;
- File propName = new File(context.getRealPath("/WEB-INF/sysconfig."+companyID+".properties"));
- if (!propName.exists()) {
- propName = new File(context.getRealPath("/WEB-INF/sysconfig.properties"));
- }
- if (propName.exists()) {
- try {
- FileInputStream propFile = new FileInputStream(propName);
- Properties p = new Properties();
- p.load(propFile);
- propFile.close();
- sysConfig = p;
- } catch (Exception e) {}
- }
- if (sysConfig == null) {
- logger.error("*** sysconfig.properties NOT PRESENT ON THE SYSTEM!!! ***");
- sysConfig = new Properties();
- }
- return sysConfig;
+ public static Properties getSysConfig(ServletContext context, int companyID) {
+ Properties sysConfig = null;
+ File propName = new File(context.getRealPath("/WEB-INF/sysconfig."+companyID+".properties"));
+ if (!propName.exists()) {
+ propName = new File(context.getRealPath("/WEB-INF/sysconfig.properties"));
+ }
+ if (propName.exists()) {
+ try {
+ FileInputStream propFile = new FileInputStream(propName);
+ Properties p = new Properties();
+ p.load(propFile);
+ propFile.close();
+ sysConfig = p;
+ } catch (Exception e) {}
+ }
+ if (sysConfig == null) {
+ logger.error("*** sysconfig.properties NOT PRESENT ON THE SYSTEM!!! ***");
+ sysConfig = new Properties();
+ }
+ return sysConfig;
}
-
- public static Properties getSysConfig(HttpSession session) {
- ILSSession ilsSession = (ILSSession)session.getAttribute("ilsSession");
- String sysConfigKey = "sysConfig" + ((ilsSession != null) ? "." + ilsSession.getCompanyID() : "");
- Properties sysConfig = (Properties) session.getAttribute(sysConfigKey);
- if (sysConfig == null) {
- sysConfig = getSysConfig(session.getServletContext(), (ilsSession != null ? ilsSession.getCompanyID() : 1));
- if (sysConfig != null) {
- session.setAttribute(sysConfigKey, sysConfig);
- }
- }
- return sysConfig;
- }
-
- public static String replaceParams(String inString, HashMap values) {
- int i = 1;
- for (int offset = inString.indexOf('{', i); offset > -1; offset = inString.indexOf('{', i)) {
+
+ public static Properties getSysConfig(HttpSession session) {
+ ILSSession ilsSession = (ILSSession)session.getAttribute("ilsSession");
+ String sysConfigKey = "sysConfig" + ((ilsSession != null) ? "." + ilsSession.getCompanyID() : "");
+ Properties sysConfig = (Properties) session.getAttribute(sysConfigKey);
+ if (sysConfig == null) {
+ sysConfig = getSysConfig(session.getServletContext(), (ilsSession != null ? ilsSession.getCompanyID() : 1));
+ if (sysConfig != null) {
+ session.setAttribute(sysConfigKey, sysConfig);
+ }
+ }
+ return sysConfig;
+ }
+
+ public static String replaceParams(String inString, HashMap values) {
+ int i = 1;
+ for (int offset = inString.indexOf('{', i); offset > -1; offset = inString.indexOf('{', i)) {
int end = inString.indexOf('}', offset);
if (end > -1) {
String paramName = inString.substring(offset + 1, end);
@@ -74,30 +74,30 @@
}
i = offset + 1;
}
- return inString;
- }
+ return inString;
+ }
- public static String getCompanyFromConfig(HttpSession session, String hostName) {
- Properties companyConfig = (Properties) session.getAttribute("companyConfig");
- if (companyConfig == null) {
- companyConfig = new Properties();
- File propName = new File(session.getServletContext().getRealPath("/WEB-INF/companies.properties"));
- if (propName.exists()) {
- try {
- FileInputStream propFile = new FileInputStream(propName);
- companyConfig.load(propFile);
- propFile.close();
- } catch (Exception e) {}
- }
- session.setAttribute("companyConfig", companyConfig);
- }
+ public static String getCompanyFromConfig(HttpSession session, String hostName) {
+ Properties companyConfig = (Properties) session.getAttribute("companyConfig");
+ if (companyConfig == null) {
+ companyConfig = new Properties();
+ File propName = new File(session.getServletContext().getRealPath("/WEB-INF/companies.properties"));
+ if (propName.exists()) {
+ try {
+ FileInputStream propFile = new FileInputStream(propName);
+ companyConfig.load(propFile);
+ propFile.close();
+ } catch (Exception e) {}
+ }
+ session.setAttribute("companyConfig", companyConfig);
+ }
for (String name: companyConfig.stringPropertyNames()) {
if (hostName.contains(name)) {
return companyConfig.getProperty(name);
}
}
- return null;
- }
+ return null;
+ }
public static Company getCompany(HttpServletRequest request) {
String requestURL = request.getRequestURL().toString() + "?" + request.getQueryString();
@@ -112,22 +112,22 @@
return company;
}
- public static String getVersionString() {
- String version = "";
- try {
- InputStream vin = Utils.class.getResourceAsStream("/versions.properties");
- Properties versions = new Properties();
+ public static String getVersionString() {
+ String version = "";
+ try {
+ InputStream vin = Utils.class.getResourceAsStream("/versions.properties");
+ Properties versions = new Properties();
versions.load(vin);
version = versions.getProperty("LMS");
} catch (Exception e) {
logger.error("Problem looking up version information from file versions.properties", e);
}
- return version;
- }
-
- public static Date parseDate(String text, int daysMin, int daysMax) {
- Date val = null;
- SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy");
+ return version;
+ }
+
+ public static Date parseDate(String text, int daysMin, int daysMax) {
+ Date val = null;
+ SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy");
Calendar cal = GregorianCalendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.DAY_OF_YEAR, -1 * daysMin);
@@ -137,167 +137,166 @@
Date maxDate = cal.getTime();
try {
val = df.parse(text);
- if ((val != null) && (daysMin != -1) && (val.getTime() < minDate.getTime())) {
+ if ((val != null) && (daysMin != -1) && (val.getTime() < minDate.getTime())) {
val = null;
- }
- if ((val != null) && (daysMax != -1) && (val.getTime() > maxDate.getTime())) {
+ }
+ if ((val != null) && (daysMax != -1) && (val.getTime() > maxDate.getTime())) {
val = null;
- }
+ }
}
catch (Exception e) {}
- return val;
+ return val;
}
-
- private static String getSystemProperty(String key, String def) {
- try {
- return System.getProperty(key, def);
- } catch(Throwable e) { // MS-Java throws com.ms.security.SecurityExceptionEx
- return def;
- }
- }
+
+ private static String getSystemProperty(String key, String def) {
+ try {
+ return System.getProperty(key, def);
+ } catch(Throwable e) { // MS-Java throws com.ms.security.SecurityExceptionEx
+ return def;
+ }
+ }
- public static String substVars(String val, Properties props) throws
- IllegalArgumentException {
- return substVars(val, props, null);
- }
+ public static String substVars(String val, Properties props) throws
+ IllegalArgumentException {
+ return substVars(val, props, null);
+ }
- static String DELIM_START = "${";
- static char DELIM_STOP = '}';
- static int DELIM_START_LEN = 2;
- static int DELIM_STOP_LEN = 1;
+ static String DELIM_START = "${";
+ static char DELIM_STOP = '}';
+ static int DELIM_START_LEN = 2;
+ static int DELIM_STOP_LEN = 1;
- public static String substVars(String val, Properties props, HttpSession session) throws IllegalArgumentException {
+ public static String substVars(String val, Properties props, HttpSession session) throws IllegalArgumentException {
- StringBuffer sbuf = new StringBuffer();
+ StringBuffer sbuf = new StringBuffer();
- int i = 0;
- int j, k;
+ int i = 0;
+ int j, k;
- while(true) {
- j=val.indexOf(DELIM_START, i);
- if(j == -1) {
- // no more variables
- if(i==0) { // this is a simple string
- return val;
- } else { // add the tail string which contains no variables and return the result.
- sbuf.append(val.substring(i, val.length()));
- return sbuf.toString();
- }
- } else {
- sbuf.append(val.substring(i, j));
- k = val.indexOf(DELIM_STOP, j);
- if(k == -1) {
- throw new IllegalArgumentException('"'+val+
- "\" has no closing brace. Opening brace at position " + j
- + '.');
- } else {
- j += DELIM_START_LEN;
- String key = val.substring(j, k);
- // first try in System properties
- String replacement = getSystemProperty(key, null);
- // then try props parameter
- if(replacement == null && props != null) {
- replacement = props.getProperty(key);
- }
- if(replacement == null && session != null) {
- if ("webapp.home".equals(key)) {
- replacement = session.getServletContext().getRealPath("/yoyo");
- }
- else {
- replacement = session.getAttribute(key).toString();
- }
- }
+ while(true) {
+ j = val.indexOf(DELIM_START, i);
+ if (j == -1) {
+ // no more variables
+ if (i==0) { // this is a simple string
+ return val;
+ }
+ else { // add the tail string which contains no variables and return the result.
+ sbuf.append(val.substring(i, val.length()));
+ return sbuf.toString();
+ }
+ }
+ else {
+ sbuf.append(val.substring(i, j));
+ k = val.indexOf(DELIM_STOP, j);
+ if (k == -1) {
+ throw new IllegalArgumentException('"'+val+ "\" has no closing brace. Opening brace at position " + j + '.');
+ }
+ else {
+ j += DELIM_START_LEN;
+ String key = val.substring(j, k);
+ // first try in System properties
+ String replacement = getSystemProperty(key, null);
+ // then try props parameter
+ if (replacement == null && props != null) {
+ replacement = props.getProperty(key);
+ }
+ if (replacement == null && session != null) {
+ if ("webapp.home".equals(key)) {
+ replacement = session.getServletContext().getRealPath("/yoyo");
+ }
+ else {
+ replacement = session.getAttribute(key).toString();
+ }
+ }
- if(replacement != null) {
- // Do variable substitution on the replacement string
- // such that we can solve "Hello ${x2}" as "Hello p1"
- // the where the properties are
- // x1=p1
- // x2=${x1}
- String recursiveReplacement = substVars(replacement, props);
- sbuf.append(recursiveReplacement);
- }
- i = k + DELIM_STOP_LEN;
- }
- }
- }
- }
+ if (replacement != null) {
+ // Do variable substitution on the replacement string
+ // such that we can solve "Hello ${x2}" as "Hello p1"
+ // the where the properties are
+ // x1=p1
+ // x2=${x1}
+ String recursiveReplacement = substVars(replacement, props);
+ sbuf.append(recursiveReplacement);
+ }
+ i = k + DELIM_STOP_LEN;
+ }
+ }
+ }
+ }
- static Transport transport = null;
- static public void closeMailConnection() {
- try {
- if (transport != null) transport.close();
+ static Transport transport = null;
+ static public void closeMailConnection() {
+ try {
+ if (transport != null) transport.close();
} catch (Exception e) {
logger.error("Problem closing outgoing mail connection", e);
}
transport = null;
- }
-
- static public void sendEmail(Properties sysConfig, String from, String to, String subject, String body) {
- sendEmail(sysConfig, from, to, subject, body, false);
- }
-
- static public void sendEmail(HttpSession httpSession, String from, String to, String subject, String body) {
- sendEmail(httpSession, from, to, subject, body, false);
- }
-
- static public void sendEmail(HttpSession httpSession, String from, String to, String subject, String body, boolean leaveConnectionOpen) {
- Properties sysConfig = getSysConfig(httpSession);
- sendEmail(sysConfig, from, to, subject, body, false);
- }
-
+ }
+
+ static public void sendEmail(Properties sysConfig, String from, String to, String subject, String body) {
+ sendEmail(sysConfig, from, to, subject, body, false);
+ }
+
+ static public void sendEmail(HttpSession httpSession, String from, String to, String subject, String body) {
+ sendEmail(httpSession, from, to, subject, body, false);
+ }
+
+ static public void sendEmail(HttpSession httpSession, String from, String to, String subject, String body, boolean leaveConnectionOpen) {
+ Properties sysConfig = getSysConfig(httpSession);
+ sendEmail(sysConfig, from, to, subject, body, false);
+ }
+
-static public void sendEmail(Properties sysConfig, String from, String to, String subject, String body, boolean leaveConnectionOpen) {
- String server = sysConfig.getProperty("SendMailServer", "localhost");
- String userID = sysConfig.getProperty("SendMailUser", "");
- String passwd = sysConfig.getProperty("SendMailPasswd", "");
- try {
- Properties props = new Properties();
- props.put("mail.smtp.host", server);
- Session session = Session.getDefaultInstance(props, null);
- if (transport == null) {
- if (userID != null && passwd != null && userID.length() > 0 && passwd.length() > 0) {
- transport = session.getTransport("smtp");
- transport.connect(server, 25, userID, passwd);
- }
- }
+ static public void sendEmail(Properties sysConfig, String from, String to, String subject, String body, boolean leaveConnectionOpen) {
+ String server = sysConfig.getProperty("SendMailServer", "localhost");
+ String userID = sysConfig.getProperty("SendMailUser", "");
+ String passwd = sysConfig.getProperty("SendMailPasswd", "");
try {
- Message msg = new MimeMessage(session);
+ Properties props = new Properties();
+ props.put("mail.smtp.host", server);
+ Session session = Session.getDefaultInstance(props, null);
+ if (transport == null) {
+ if (userID != null && passwd != null && userID.length() > 0 && passwd.length() > 0) {
+ transport = session.getTransport("smtp");
+ transport.connect(server, 25, userID, passwd);
+ }
+ }
+ try {
+ Message msg = new MimeMessage(session);
- InternetAddress addr = new InternetAddress(to);
- msg.addRecipients(Message.RecipientType.TO, new InternetAddress[] { addr });
+ InternetAddress addr = new InternetAddress(to);
+ msg.addRecipients(Message.RecipientType.TO, new InternetAddress[] { addr });
- InternetAddress from_addr = new InternetAddress(from);
- msg.setFrom(from_addr);
+ InternetAddress from_addr = new InternetAddress(from);
+ msg.setFrom(from_addr);
- msg.setSubject(subject);
- msg.setContent(body, "text/plain");
+ msg.setSubject(subject);
+ msg.setContent(body, "text/plain");
- if (transport != null) transport.sendMessage(msg, msg.getAllRecipients());
- else Transport.send(msg);
+ if (transport != null) transport.sendMessage(msg, msg.getAllRecipients());
+ else Transport.send(msg);
+ }
+ catch (Exception e) {
+ logger.error("Problem sending email [" + subject + "] to: " + to, e);
+ }
}
catch (Exception e) {
logger.error("Problem sending email [" + subject + "] to: " + to, e);
}
- }
- catch (Exception e) {
- logger.error("Problem sending email [" + subject + "] to: " + to, e);
- }
- finally {
- if (!leaveConnectionOpen) {
- closeMailConnection();
+ finally {
+ if (!leaveConnectionOpen) {
+ closeMailConnection();
+ }
}
}
+
}
-
-
-
-}
Modified: branches/1.6/src/com/resolutions/ils/data/Course.java
===================================================================
--- branches/1.6/src/com/resolutions/ils/data/Course.java 2016-07-13 10:57:10 UTC (rev 1484)
+++ branches/1.6/src/com/resolutions/ils/data/Course.java 2016-07-13 11:36:13 UTC (rev 1485)
@@ -13,522 +13,529 @@
public class Course extends DataObject {
- static String LOOKUPALLCOURSES = "SELECT * FROM COURSE WHERE (COURSISCURRICULUM IS NULL OR COURSISCURRICULUM<>'T') AND (COURSISQUICKVIEW IS NULL OR COURSISQUICKVIEW<>'T') AND COMPANYID={COMPANYID} ORDER BY COURSNAME";
- static String LOOKUPALLCOURSESWACTCHECK = "SELECT * FROM COURSE WHERE (COURSISCURRICULUM IS NULL OR COURSISCURRICULUM<>'T') AND (COURSISQUICKVIEW IS NULL OR COURSISQUICKVIEW<>'T') AND COMPANYID={COMPANYID} AND COURSISACTIVE={COURSISACTIVE} ORDER BY COURSNAME";
- static String LOOKUPALLQUICKVIEWS = "SELECT * FROM COURSE WHERE (COURSISCURRICULUM IS NULL OR COURSISCURRICULUM<>'T') AND COURSISQUICKVIEW='T' AND COMPANYID={COMPANYID} ORDER BY COURSNAME";
- static String LOOKUPALLCURRICULA = "SELECT * FROM COURSE WHERE COURSISCURRICULUM='T' AND (COURSISQUICKVIEW IS NULL OR COURSISQUICKVIEW<>'T') AND COMPANYID={COMPANYID} ORDER BY COURSNAME";
+ static String LOOKUPALLCOURSES = "SELECT * FROM COURSE WHERE (COURSISCURRICULUM IS NULL OR COURSISCURRICULUM<>'T') AND (COURSISQUICKVIEW IS NULL OR COURSISQUICKVIEW<>'T') AND COMPANYID={COMPANYID} ORDER BY COURSNAME";
+ static String LOOKUPALLCOURSESWACTCHECK = "SELECT * FROM COURSE WHERE (COURSISCURRICULUM IS NULL OR COURSISCURRICULUM<>'T') AND (COURSISQUICKVIEW IS NULL OR COURSISQUICKVIEW<>'T') AND COMPANYID={COMPANYID} AND COURSISACTIVE={COURSISACTIVE} ORDER BY COURSNAME";
+ static String LOOKUPALLQUICKVIEWS = "SELECT * FROM COURSE WHERE (COURSISCURRICULUM IS NULL OR COURSISCURRICULUM<>'T') AND COURSISQUICKVIEW='T' AND COMPANYID={COMPANYID} ORDER BY COURSNAME";
+ static String LOOKUPALLCURRICULA = "SELECT * FROM COURSE WHERE COURSISCURRICULUM='T' AND (COURSISQUICKVIEW IS NULL OR COURSISQUICKVIEW<>'T') AND COMPANYID={COMPANYID} ORDER BY COURSNAME";
- static String LOOKUPUSERGROUPCOURSES =
- "SELECT DISTINCT T2.USERPRID, T1.*" +
- " FROM COURSE T1" +
- " JOIN COURSEGROUP T3 ON T3.COMPANYID=T1.COMPANYID AND T1.COURSID=T3.COURSID" +
- " JOIN USERGROUP T2 ON T2.COMPANYID=T3.COMPANYID AND T2.ILSGROUPID=T3.ILSGROUPID" +
- " WHERE" +
- " (T1.COURSISCURRICULUM IS NULL OR T1.COURSISCURRICULUM<>'T')" +
- " AND (T1.COURSISQUICKVIEW IS NULL OR T1.COURSISQUICKVIEW<>'T')" +
- " AND T1.COMPANYID={COMPANYID}";
+ static String LOOKUPUSERGROUPCOURSES =
+ "SELECT DISTINCT T2.USERPRID, T1.*" +
+ " FROM COURSE T1" +
+ " JOIN COURSEGROUP T3 ON T3.COMPANYID=T1.COMPANYID AND T1.COURSID=T3.COURSID" +
+ " JOIN USERGROUP T2 ON T2.COMPANYID=T3.COMPANYID AND T2.ILSGROUPID=T3.ILSGROUPID" +
+ " WHERE" +
+ " (T1.COURSISCURRICULUM IS NULL OR T1.COURSISCURRICULUM<>'T')" +
+ " AND (T1.COURSISQUICKVIEW IS NULL OR T1.COURSISQUICKVIEW<>'T')" +
+ " AND T1.COMPANYID={COMPANYID}";
- static String LOOKUPUSERGROUPCOURSESACTIVE =
- LOOKUPUSERGROUPCOURSES + " AND T1.COURSISACTIVE='T'";
+ static String LOOKUPUSERGROUPCOURSESACTIVE =
+ LOOKUPUSERGROUPCOURSES + " AND T1.COURSISACTIVE='T'";
-
- static String LOOKUPUSERCURRICULUMCOURSES =
- "SELECT DISTINCT T2.USERPRID, T9.*" +
- " FROM USERGROUP T2" +
- " JOIN COURSEGROUP T3 ON T3.COMPANYID = T2.COMPANYID AND T3.ILSGROUPID = T2.ILSGROUPID" +
- " JOIN COURSE T1 ON T1.COMPANYID = T3.COMPANYID AND T1.COURSID = T3.COURSID AND T1.COURSISCURRICULUM='T'" +
- " JOIN CURRICULUMCOURSE T5 ON T5.COMPANYID = T1.COMPANYID AND T5.CURRICULUMID = T1.COURSID" +
- " JOIN COURSE T9 ON T9.COMPANYID = T5.COMPANYID AND T9.COURSID = T5.COURSID" +
- " WHERE" +
- " (T9.COURSISCURRICULUM IS NULL OR T9.COURSISCURRICULUM<>'T')" +
- " AND T2.COMPANYID={COMPANYID}";
+ static String LOOKUPUSERCURRICULUMCOURSES =
+ "SELECT DISTINCT T2.USERPRID, T9.*" +
+ " FROM USERGROUP T2" +
+ " JOIN COURSEGROUP T3 ON T3.COMPANYID = T2.COMPANYID AND T3.ILSGROUPID = T2.ILSGROUPID" +
+ " JOIN COURSE T1 ON T1.COMPANYID = T3.COMPANYID AND T1.COURSID = T3.COURSID AND T1.COURSISCURRICULUM='T'" +
+ " JOIN CURRICULUMCOURSE T5 ON T5.COMPANYID = T1.COMPANYID AND T5.CURRICULUMID = T1.COURSID" +
+ " JOIN COURSE T9 ON T9.COMPANYID = T5.COMPANYID AND T9.COURSID = T5.COURSID" +
+ " WHERE" +
+ " (T9.COURSISCURRICULUM IS NULL OR T9.COURSISCURRICULUM<>'T')" +
+ " AND T2.COMPANYID={COMPANYID}";
+
static String LOOKUPUSERCURRICULUMCOURSESACTIVE =
- LOOKUPUSERCURRICULUMCOURSES +" AND T1.COURSISACTIVE='T' AND T9.COURSISACTIVE='T'";
-
-
- static String LOOKUPGROUPCOURSES = "SELECT * FROM COURSE T1, COURSEGROUP T2 WHERE T1.COURSID=T2.COURSID AND T2.ILSGROUPID={ILSGROUPID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID}";
- static String LOOKUPUSERQUICKVIEWS = "SELECT * FROM COURSE T1, USERGROUP T2, COURSEGROUP T3 WHERE T1.COURSID=T3.COURSID AND T3.ILSGROUPID=T2.ILSGROUPID AND T1.COURSISQUICKVIEW='T' AND T1.COURSISACTIVE='T' AND T2.USERPRID={USERPRID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID} AND T3.COMPANYID={COMPANYID} ORDER BY T1.COURSPOSTDATE DESC";
+ LOOKUPUSERCURRICULUMCOURSES +" AND T1.COURSISACTIVE='T' AND T9.COURSISACTIVE='T'";
- static String LOOKUPUSERCURRICULA = "SELECT * FROM COURSE T1, USERGROUP T2, COURSEGROUP T3 WHERE T1.COURSID=T3.COURSID AND T3.ILSGROUPID=T2.ILSGROUPID AND T1.COURSISCURRICULUM='T' AND T1.COURSISACTIVE='T' AND T2.USERPRID={USERPRID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID} AND T3.COMPANYID={COMPANYID} ORDER BY SORTORDER";
- static String LOOKUPCURRICULUMCOURSES = "SELECT * FROM COURSE T1, CURRICULUMCOURSE T2 WHERE T1.COURSID=T2.COURSID AND (T1.COURSISCURRICULUM IS NULL OR T1.COURSISCURRICULUM<>'T') AND T1.COURSISACTIVE='T' AND T2.CURRICULUMID={COURSID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID} ORDER BY SORTORDER";
- static String LOOKUP = "SELECT * FROM COURSE WHERE COMPANYID={COMPANYID}";
- static String DELETE = "DELETE FROM COURSE WHERE COURSID={COURSID} AND COMPANYID={COMPANYID}";
- static String DELETECURRICULUMCOURSES = "DELETE FROM CURRICULUMCOURSE WHERE CURRICULUMID={COURSID} AND COMPANYID={COMPANYID}";
- static String ADDCOURSETOCURRIC = "INSERT INTO CURRICULUMCOURSE (COMPANYID, CURRICULUMID, COURSID, SORTORDER) VALUES ({COMPANYID}, {CURRICID}, {COURSID}, {SORTORDER})";
- static String ADDCOURSETOCURRICNOORDER = "INSERT INTO CURRICULUMCOURSE (COMPANYID, CURRICULUMID, COURSID) VALUES ({COMPANYID}, {CURRICID}, {COURSID})";
+ static String LOOKUPGROUPCOURSES = "SELECT * FROM COURSE T1, COURSEGROUP T2 WHERE T1.COURSID=T2.COURSID AND T2.ILSGROUPID={ILSGROUPID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID}";
+ static String LOOKUPUSERQUICKVIEWS = "SELECT * FROM COURSE T1, USERGROUP T2, COURSEGROUP T3 WHERE T1.COURSID=T3.COURSID AND T3.ILSGROUPID=T2.ILSGROUPID AND T1.COURSISQUICKVIEW='T' AND T1.COURSISACTIVE='T' AND T2.USERPRID={USERPRID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID} AND T3.COMPANYID={COMPANYID} ORDER BY T1.COURSPOSTDATE DESC";
+ static String LOOKUPUSERCURRICULA = "SELECT * FROM COURSE T1, USERGROUP T2, COURSEGROUP T3 WHERE T1.COURSID=T3.COURSID AND T3.ILSGROUPID=T2.ILSGROUPID AND T1.COURSISCURRICULUM='T' AND T1.COURSISACTIVE='T' AND T2.USERPRID={USERPRID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID} AND T3.COMPANYID={COMPANYID} ORDER BY SORTORDER";
+
+ static String LOOKUPCURRICULUMCOURSES = "SELECT * FROM COURSE T1, CURRICULUMCOURSE T2 WHERE T1.COURSID=T2.COURSID AND (T1.COURSISCURRICULUM IS NULL OR T1.COURSISCURRICULUM<>'T') AND T1.COURSISACTIVE='T' AND T2.CURRICULUMID={COURSID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID} ORDER BY SORTORDER";
+ static String LOOKUP = "SELECT * FROM COURSE WHERE COMPANYID={COMPANYID}";
+ static String DELETE = "DELETE FROM COURSE WHERE COURSID={COURSID} AND COMPANYID={COMPANYID}";
+ static String DELETECURRICULUMCOURSES = "DELETE FROM CURRICULUMCOURSE WHERE CURRICULUMID={COURSID} AND COMPANYID={COMPANYID}";
+ static String ADDCOURSETOCURRIC = "INSERT INTO CURRICULUMCOURSE (COMPANYID, CURRICULUMID, COURSID, SORTORDER) VALUES ({COMPANYID}, {CURRICID}, {COURSID}, {SORTORDER})";
+ static String ADDCOURSETOCURRICNOORDER = "INSERT INTO CURRICULUMCOURSE (COMPANYID, CURRICULUMID, COURSID) VALUES ({COMPANYID}, {CURRICID}, {COURSID})";
+
static Logger eventsLogger = Logger.getLogger("EVENTS");
- static Logger logger = Logger.getLogger(Course.class);
+ static Logger logger = Logger.getLogger(Course.class);
- public Course() {
- }
+ public Course() {
+ }
- protected DataObject createDataObject() {
- return new Course();
- }
+ protected DataObject createDataObject() {
+ return new Course();
+ }
- static public int deleteCourse(ILSSession session, int courseID) {
- Course query = new Course();
- query.setCourseID(courseID);
- query.setCompanyID(session.getCompanyID());
- return query.executeSQL(DELETE);
- }
+ static public int deleteCourse(ILSSession session, int courseID) {
+ Course query = new Course();
+ query.setCourseID(courseID);
+ query.setCompanyID(session.getCompanyID());
+ return query.executeSQL(DELETE);
+ }
- public int save(ILSSession session, Course orig) {
- String[] keyCols = new String[] {"COMPANYID", "COURSID"};
- eventsLogger.info("Course " + orig.getCourseNum() + " modified by user: " + session.getCurrentUserProfile().getUserProfileNum());
- return save(orig, "COURSE", keyCols);
- }
+ public int save(ILSSession session, Course orig) {
+ String[] keyCols = new String[] {"COMPANYID", "COURSID"};
+ eventsLogger.info("Course " + orig.getCourseNum() + " modified by user: " + session.getCurrentUserProfile().getUserProfileNum());
+ return save(orig, "COURSE", keyCols);
+ }
- public Course saveNew(ILSSession session) {
- setValue("COMPANYID", new Integer(session.getCompanyID()));
- saveNew("COURSE");
- eventsLogger.info("Course " + getCourseNum() + " created by user: "+session.getCurrentUserProfile().getUserProfileNum());
- return (Course) lookupThis("COURSE");
- }
+ public Course saveNew(ILSSession session) {
+ setValue("COMPANYID", new Integer(session.getCompanyID()));
+ saveNew("COURSE");
+ eventsLogger.info("Course " + getCourseNum() + " created by user: "+session.getCurrentUserProfile().getUserProfileNum());
+ return (Course) lookupThis("COURSE");
+ }
- static public Course getCourse(ILSSession session, int courseID) {
- Course query = new Course();
- String sql = LOOKUP + " AND COURSID={COURSID}";
- query.setCourseID(courseID);
- query.setCompanyID(session.getCompanyID());
- Vector rows = query.getDataSet(sql);
- return (rows.size() > 0) ? (Course) rows.get(0) : null;
- }
+ static public Course getCourse(ILSSession session, int courseID) {
+ return getCourse(session.getCompanyID(), courseID);
+ }
+ static public Course getCourse(int companyID, int courseID) {
+ Course query = new Course();
+ String sql = LOOKUP + " AND COURSID={COURSID}";
+ query.setCourseID(courseID);
+ query.setCompanyID(companyID);
+ Vector rows = query.getDataSet(sql);
+ return (rows.size() > 0) ? (Course) rows.get(0) : null;
+ }
+
static public Vector getGroupCourses(ILSSession session, int groupID) {
return getGroupCourses(session.getCompanyID(), groupID);
}
- static public Vector getGroupCourses(int companyID, int groupID) {
- Course query = new Course();
- query.setCompanyID(companyID);
- query.setValue("ILSGROUPID", new Integer(groupID));
- return query.getDataSet(LOOKUPGROUPCOURSES);
- }
+ static public Vector getGroupCourses(int companyID, int groupID) {
+ Course query = new Course();
+ query.setCompanyID(companyID);
+ query.setValue("ILSGROUPID", new Integer(groupID));
+ return query.getDataSet(LOOKUPGROUPCOURSES);
+ }
- static public Course getCourseByNum(ILSSession session, String courseNum) {
- Course query = new Course();
- String sql = LOOKUP + " AND COURSNUM={COURSNUM}";
- query.setCourseNum(courseNum);
- query.setCompanyID(session.getCompanyID());
- Vector rows = query.getDataSet(sql);
- return (rows.size() > 0) ? (Course) rows.get(0) : null;
- }
+ static public Course getCourseByNum(ILSSession session, String courseNum) {
+ Course query = new Course();
+ String sql = LOOKUP + " AND COURSNUM={COURSNUM}";
+ query.setCourseNum(courseNum);
+ query.setCompanyID(session.getCompanyID());
+ Vector rows = query.getDataSet(sql);
+ return (rows.size() > 0) ? (Course) rows.get(0) : null;
+ }
- static public Collection<Course> getUserCurricula(ILSSession session, int userID) {
- Course query = new Course();
- query.setCompanyID(session.getCompanyID());
- query.setValue("USERPRID", new Integer(userID));
- Map<Integer, Course> uniqueCurricula = new HashMap<Integer, Course>();
- for (Object o : query.getDataSet(LOOKUPUSERCURRICULA)) {
- Course c = (Course)o;
- uniqueCurricula.put(c.getCourseID(), c);
+ static public Collection<Course> getUserCurricula(ILSSession session, int userID) {
+ Course query = new Course();
+ query.setCompanyID(session.getCompanyID());
+ query.setValue("USERPRID", new Integer(userID));
+ Map<Integer, Course> uniqueCurricula = new HashMap<Integer, Course>();
+ for (Object o : query.getDataSet(LOOKUPUSERCURRICULA)) {
+ Course c = (Course)o;
+ uniqueCurricula.put(c.getCourseID(), c);
+ }
+ return uniqueCurricula.values();
}
- return uniqueCurricula.values();
- }
- static public Vector getAllCourses(ILSSession session) {
- Course query = new Course();
- query.setCompanyID(session.getCompanyID());
- return query.getDataSet(LOOKUPALLCOURSES);
- }
+ static public Vector getAllCourses(ILSSession session) {
+ Course query = new Course();
+ query.setCompanyID(session.getCompanyID());
+ return query.getDataSet(LOOKUPALLCOURSES);
+ }
- static public Vector getAllCourses(ILSSession session, boolean active) {
- Course query = new Course();
- query.setCompanyID(session.getCompanyID());
- query.setCourseActive(active);
- return query.getDataSet(LOOKUPALLCOURSESWACTCHECK);
- }
+ static public Vector getAllCourses(ILSSession session, boolean active) {
+ Course query = new Course();
+ query.setCompanyID(session.getCompanyID());
+ query.setCourseActive(active);
+ return query.getDataSet(LOOKUPALLCOURSESWACTCHECK);
+ }
- static public Vector getAllCurricula(ILSSession session) {
- Course query = new Course();
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- return query.getDataSet(LOOKUPALLCURRICULA);
- }
+ static public Vector getAllCurricula(ILSSession session) {
+ Course query = new Course();
+ query.setValue("COMPANYID", new Integer(session.getCompanyID()));
+ return query.getDataSet(LOOKUPALLCURRICULA);
+ }
- static public Vector getAllQuickViews(ILSSession session) {
- Course query = new Course();
- query.setCompanyID(session.getCompanyID());
- return query.getDataSet(LOOKUPALLQUICKVIEWS);
- }
+ static public Vector getAllQuickViews(ILSSession session) {
+ Course query = new Course();
+ query.setCompanyID(session.getCompanyID());
+ return query.getDataSet(LOOKUPALLQUICKVIEWS);
+ }
- static public Vector getActiveUserCourses(ILSSession session, int userID) {
- Course query = new Course();
- query.setCompanyID(session.getCompanyID());
- query.setValue("USERPRID", new Integer(userID));
- Vector retVal = query.getDataSet(
- "SELECT * FROM (" +
- LOOKUPUSERCURRICULUMCOURSESACTIVE +
- " UNION " +
- LOOKUPUSERGROUPCOURSESACTIVE +
- ") T1 WHERE T1.USERPRID={USERPRID}" +
- " ORDER BY COURSNUM"
- );
- return retVal;
- }
+ static public Vector getActiveUserCourses(ILSSession session, int userID) {
+ Course query = new Course();
+ query.setCompanyID(session.getCompanyID());
+ query.setValue("USERPRID", new Integer(userID));
+ Vector retVal = query.getDataSet(
+ "SELECT * FROM (" +
+ LOOKUPUSERCURRICULUMCOURSESACTIVE +
+ " UNION " +
+ LOOKUPUSERGROUPCOURSESACTIVE +
+ ") T1 WHERE T1.USERPRID={USERPRID}" +
+ " ORDER BY COURSNUM"
+ );
+ return retVal;
+ }
- static public Vector getAllUserCourses(ILSSession session, int userID) {
- Course query = new Course();
- query.setCompanyID(session.getCompanyID());
- query.setValue("USERPRID", new Integer(userID));
- Vector retVal = query.getDataSet(
- "SELECT * FROM (" +
- LOOKUPUSERCURRICULUMCOURSES +
- " UNION " +
- LOOKUPUSERGROUPCOURSES +
- ") T1 WHERE T1.USERPRID={USERPRID}"
- );
- return retVal;
- }
+ static public Vector getAllUserCourses(ILSSession session, int userID) {
+ Course query = new Course();
+ query.setCompanyID(session.getCompanyID());
+ query.setValue("USERPRID", new Integer(userID));
+ Vector retVal = query.getDataSet(
+ "SELECT * FROM (" +
+ LOOKUPUSERCURRICULUMCOURSES +
+ " UNION " +
+ LOOKUPUSERGROUPCOURSES +
+ ") T1 WHERE T1.USERPRID={USERPRID}"
+ );
+ return retVal;
+ }
- static public void appendUserCoursesFromAttempts(Vector courses, ILSSession session, int userID) {
- String LOOKUPUSERCOURSEATTEMPTS = "SELECT * FROM COURSE T1, COURSEATTEMPT T2 WHERE T1.COURSID = T2.COURSID AND T2.USERPRID={USERPRID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID}";
- Course query = new Course();
- query.setCompanyID(session.getCompanyID());
- query.setIntValue("USERPRID", userID);
- Vector retVal = query.getDataSet(LOOKUPUSERCOURSEATTEMPTS);
+ static public void appendUserCoursesFromAttempts(Vector courses, ILSSession session, int userID) {
+ String LOOKUPUSERCOURSEATTEMPTS = "SELECT * FROM COURSE T1, COURSEATTEMPT T2 WHERE T1.COURSID = T2.COURSID AND T2.USERPRID={USERPRID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID}";
+ Course query = new Course();
+ query.setCompanyID(session.getCompanyID());
+ query.setIntValue("USERPRID", userID);
+ Vector retVal = query.getDataSet(LOOKUPUSERCOURSEATTEMPTS);
- // remove duplicate courses assigned by different paths
- for (int i = 0; i < retVal.size(); i++) {
- Course cc = (Course)retVal.get(i);
- if ((cc.getIntValue("CASTATUSID") == CourseAttempt.STATUS_FAILED)
- || (cc.getIntValue("CASTATUSID") == CourseAttempt.STATUS_PASSED)) {
- int j;
- for (j = 0; j < courses.size(); j++) {
- Course c2 = (Course)courses.get(j);
- if (c2.getCourseID() == cc.getCourseID())
- break;
- }
- if (j == courses.size()) {
- courses.add(cc);
- }
- }
- }
- }
+ // remove duplicate courses assigned by different paths
+ for (int i = 0; i < retVal.size(); i++) {
+ Course cc = (Course)retVal.get(i);
+ if ((cc.getIntValue("CASTATUSID") == CourseAttempt.STATUS_FAILED) || (cc.getIntValue("CASTATUSID") == CourseAttempt.STATUS_PASSED)) {
+ int j;
+ for (j = 0; j < courses.size(); j++) {
+ Course c2 = (Course)courses.get(j);
+ if (c2.getCourseID() == cc.getCourseID())
+ break;
+ }
+ if (j == courses.size()) {
+ courses.add(cc);
+ }
+ }
+ }
+ }
- static public Vector getUserQuickViews(ILSSession session, int userID) {
- Course query = new Course();
- query.setCompanyID(session.getCompanyID());
- query.setValue("USERPRID", new Integer(userID));
- return query.getDataSet(LOOKUPUSERQUICKVIEWS);
- }
+ static public Vector getUserQuickViews(ILSSession session, int userID) {
+ Course query = new Course();
+ query.setCompanyID(session.getCompanyID());
+ query.setValue("USERPRID", new Integer(userID));
+ return query.getDataSet(LOOKUPUSERQUICKVIEWS);
+ }
- static public Vector getCurriculumCourses(ILSSession session,
- int curriculumID) {
- Course query = new Course();
- query.setCompanyID(session.getCompanyID());
- query.setCourseID(curriculumID);
- return query.getDataSet(LOOKUPCURRICULUMCOURSES);
- }
+ static public Vector<Course> getCurriculumCourses(ILSSession session, int curriculumID) {
+ Course query = new Course();
+ query.setCompanyID(session.getCompanyID());
+ query.setCourseID(curriculumID);
+ return query.getDataSet(LOOKUPCURRICULUMCOURSES);
+ }
- static public int deleteCurriculumCourses(ILSSession session, int courseID) {
- Course query = new Course();
- query.setCompanyID(session.getCompanyID());
- query.setCourseID(courseID);
- return query.executeSQL(DELETECURRICULUMCOURSES);
- }
+ static public int deleteCurriculumCourses(ILSSession session, int courseID) {
+ Course query = new Course();
+ query.setCompanyID(session.getCompanyID());
+ query.setCourseID(courseID);
+ return query.executeSQL(DELETECURRICULUMCOURSES);
+ }
- static public int addCourseToCurriculum(ILSSession session, int curricID,
- int courseID, Integer sortOrder) {
- Course query = new Course();
- query.setCompanyID(session.getCompanyID());
- query.setValue("CURRICID", new Integer(curricID));
- query.setValue("SORTORDER", sortOrder);
- query.setCourseID(courseID);
- return query.executeSQL((sortOrder != null) ? ADDCOURSETOCURRIC : ADDCOURSETOCURRICNOORDER);
- }
+ static public int addCourseToCurriculum(ILSSession session, int curricID, int courseID, Integer sortOrder) {
+ Course query = new Course();
+ query.setCompanyID(session.getCompanyID());
+ query.setValue("CURRICID", new Integer(curricID));
+ query.setValue("SORTORDER", sortOrder);
+ query.setCourseID(courseID);
+ return query.executeSQL((sortOrder != null) ? ADDCOURSETOCURRIC : ADDCOURSETOCURRICNOORDER);
+ }
- public Date getCoursePostDate() {
- return getDateValue("COURSPOSTDATE");
- }
+ public Date getCoursePostDate() {
+ return getDateValue("COURSPOSTDATE");
+ }
- public float getCourseCost() {
- try {
+ public float getCourseCost() {
+ try {
return getFloatValue("COURSCOST");
- } catch (Exception e) {}
- return 0;
- }
+ } catch (Exception e) {}
+ return 0;
+ }
- public String getCourseDesc() {
- return getStringValue("COURSDESC");
- }
+ public String getCourseDesc() {
+ return getStringValue("COURSDESC");
+ }
- public int getCourseID() {
- return getIntValue("COURSID");
- }
+ public int getCourseID() {
+ return getIntValue("COURSID");
+ }
- public void setCourseID(int id) {
- setIntValue("COURSID", id);
- }
+ public void setCourseID(int id) {
+ setIntValue("COURSID", id);
+ }
- public String getCourseURL() {
- return getStringValue("COURSURL");
- }
+ public String getCourseURL() {
+ return getStringValue("COURSURL");
+ }
- public String getCourseChecklistURL() {
- return getStringValue("COURSCKLISTURL");
- }
+ public String getCourseChecklistURL() {
+ return getStringValue("COURSCKLISTURL");
+ }
- public String getCourseName() {
- return getStringValue("COURSNAME");
- }
+ public String getCourseCertificateGenerator() {
+ return getStringValue("COURSCERTGEN");
+ }
- public String getCourseNum() {
- return getStringValue("COURSNUM");
- }
+ public String getCourseName() {
+ return getStringValue("COURSNAME");
+ }
- public int getCoursePass() {
- return getIntValue("COURSPASS");
- }
+ public String getCourseNum() {
+ return getStringValue("COURSNUM");
+ }
- public int getCourseReassignBeforeDays() {
- return getIntValue("COURSREASBEFDAYS");
- }
+ public int getCoursePass() {
+ return getIntValue("COURSPASS");
+ }
- public int getCoursePassExpireDays() {
- return getIntValue("COURSPASSEXPDAYS");
- }
+ public int getCourseReassignBeforeDays() {
+ return getIntValue("COURSREASBEFDAYS");
+ }
- public int getCourseSeatMinutes() {
- return getIntValue("COURSSEATMINS");
- }
+ public int getCoursePassExpireDays() {
+ return getIntValue("COURSPASSEXPDAYS");
+ }
- // todo
- public String getCourseType() {
- return getStringValue("COURSTYPE");
- }
+ public int getCourseSeatMinutes() {
+ return getIntValue("COURSSEATMINS");
+ }
- public int getCourseTypeID() {
- return getIntValue("COURSTYPEID");
- }
+ // todo
+ public String getCourseType() {
+ return getStringValue("COURSTYPE");
+ }
- public String getCourseIPRestricted() {
- return getStringValue("COURSISIPRESTRICTED");
- }
+ public int getCourseTypeID() {
+ return getIntValue("COURSTYPEID");
+ }
- public boolean isCourseIPRestricted() {
- return ("T".equals(getValue("COURSISIPRESTRICTED")));
- }
+ public String getCourseIPRestricted() {
+ return getStringValue("COURSISIPRESTRICTED");
+ }
- public boolean isCourseCurriculum() {
- return ("T".equals(getValue("COURSISCURRICULUM")));
- }
+ public boolean isCourseIPRestricted() {
+ return ("T".equals(getValue("COURSISIPRESTRICTED")));
+ }
- public boolean isCourseCurriculumCertificate() {
- return ("T".equals(getValue("COURSISCURRICCERT")));
- }
+ public boolean isCourseCurriculum() {
+ return ("T".equals(getValue("COURSISCURRICULUM")));
+ }
- public boolean isCourseQuickView() {
- return ("T".equals(getValue("COURSISQUICKVIEW")));
- }
+ public boolean isCourseCurriculumCertificate() {
+ return ("T".equals(getValue("COURSISCURRICCERT")));
+ }
- public boolean isCourseActive() {
- return ("T".equals(getValue("COURSISACTIVE")));
- }
+ public boolean isCourseAllowCurriculumPartRetake() {
+ return ("T".equals(getValue("COURSISALLOWCURRPARTRETAKE")));
+ }
- public boolean isCourseRequiresManagerApproval() {
- return ("T".equals(getValue("COURSREQMGRAPPRVL")));
- }
+ public boolean isCourseQuickView() {
+ return ("T".equals(getValue("COURSISQUICKVIEW")));
+ }
+ public boolean isCourseActive() {
+ return ("T".equals(getValue("COURSISACTIVE")));
+ }
- public void setCoursePostDate(Date postDate) {
- setDateValue("COURSPOSTDATE", postDate);
- }
+ public boolean isCourseRequiresManagerApproval() {
+ return ("T".equals(getValue("COURSREQMGRAPPRVL")));
+ }
- public void setCourseCost(float cost) {
- setFloatValue("COURSCOST", cost);
- }
- public void setCourseDesc(String desc) {
- setValue("COURSDESC", desc);
- }
+ public void setCoursePostDate(Date postDate) {
+ setDateValue("COURSPOSTDATE", postDate);
+ }
- public void setCourseURL(String url) {
- setValue("COURSURL", url);
- }
+ public void setCourseCost(float cost) {
+ setFloatValue("COURSCOST", cost);
+ }
- public void setCourseChecklistURL(String url) {
- setValue("COURSCKLISTURL", url);
- }
+ public void setCourseDesc(String desc) {
+ setValue("COURSDESC", desc);
+ }
- public void setCourseName(String name) {
- setValue("COURSNAME", name);
- }
+ public void setCourseURL(String url) {
+ setValue("COURSURL", url);
+ }
- public void setCourseNum(String num) {
- setValue("COURSNUM", num);
- }
+ public void setCourseChecklistURL(String url) {
+ setValue("COURSCKLISTURL", url);
+ }
- public void setCoursePass(int passScore) {
- setIntValue("COURSPASS", passScore);
- }
+ public void setCourseCertificateGenerator(String val) {
+ setValue("COURSCERTGEN", val);
+ }
- public void setCourseReassignBeforeDays(int days) {
- setIntValue("COURSREASBEFDAYS", days);
- }
+ public void setCourseName(String name) {
+ setValue("COURSNAME", name);
+ }
- public void setCoursePassExpireDays(int days) {
- setIntValue("COURSPASSEXPDAYS", days);
- }
+ public void setCourseNum(String num) {
+ setValue("COURSNUM", num);
+ }
- public void setCourseSeatMinutes(int mins) {
- setIntValue("COURSSEATMINS", mins);
- }
+ public void setCoursePass(int passScore) {
+ setIntValue("COURSPASS", passScore);
+ }
- public void setCourseTypeID(int courseTypeID) {
- setIntValue("COURSTYPEID", courseTypeID);
- }
+ public void setCourseReassignBeforeDays(int days) {
+ setIntValue("COURSREASBEFDAYS", days);
+ }
- public void setCourseCurriculum(boolean isCurriculum) {
- setValue("COURSISCURRICULUM", (isCurriculum) ? "T" : "F");
- }
+ public void setCoursePassExpireDays(int days) {
+ setIntValue("COURSPASSEXPDAYS", days);
+ }
- public void setCourseCurriculumCertificate(boolean val) {
- setValue("COURSISCURRICCERT", (val) ? "T" : "F");
- }
+ public void setCourseSeatMinutes(int mins) {
+ setIntValue("COURSSEATMINS", mins);
+ }
- public void setCourseQuickView(boolean isQuickView) {
- setValue("COURSISQUICKVIEW", (isQuickView) ? "T" : "F");
- }
+ public void setCourseTypeID(int courseTypeID) {
+ setIntValue("COURSTYPEID", courseTypeID);
+ }
- public void setCourseActive(boolean isActive) {
- setValue("COURSISACTIVE", (isActive) ? "T" : "F");
- }
+ public void setCourseCurriculum(boolean isCurriculum) {
+ setValue("COURSISCURRICULUM", (isCurriculum) ? "T" : "F");
+ }
- public void setCourseRequiresManagerApproval(boolean val) {
- setValue("COURSREQMGRAPPRVL", (val) ? "T" : "F");
- }
+ public void setCourseCurriculumCertificate(boolean val) {
+ setValue("COURSISCURRICCERT", (val) ? "T" : "F");
+ }
- public void setCourseIPRestricted(String val) {
- setValue("COURSISIPRESTRICTED", val);
- }
+ public void setCourseAllowCurriculumPartRetake(boolean val) {
+ setValue("COURSISALLOWCURRPARTRETAKE", (val) ? "T" : "F");
+ }
- public void setCourseIPRestricted(boolean val) {
- setValue("COURSISIPRESTRICTED", (val) ? "T" : "F");
- }
+ public void setCourseQuickView(boolean isQuickView) {
+ setValue("COURSISQUICKVIEW", (isQuickView) ? "T" : "F");
+ }
- public String getCourseSeatTimeText() {
- return getNiceTimeText(getCourseSeatMinutes());
- }
+ public void setCourseActive(boolean isActive) {
+ setValue("COURSISACTIVE", (isActive) ? "T" : "F");
+ }
- public static String getNiceTimeText(int minutes) {
- int seatMinutes = minutes;
- int seatDays = seatMinutes / (60 * 24);
- seatMinutes = seatMinutes % (60 * 24);
- int seatHours = seatMinutes / 60;
- seatMinutes = seatMinutes % 60;
- String timeFrame = (seatDays > 0) ?
- (Integer.toString(seatDays) + " Day" +
- ((seatDays != 1) ? "s " : " ")) : "";
- timeFrame += (seatHours > 0) ?
- (Integer.toString(seatHours) + " Hour" +
- ((seatHours != 1) ? "s " : " ")) : "";
- timeFrame += (seatMinutes > 0) ?
- (Integer.toString(seatMinutes) + " Minute" +
- ((seatMinutes != 1) ? "s" : "")) : "";
- return timeFrame;
- }
+ public void setCourseRequiresManagerApproval(boolean val) {
+ setValue("COURSREQMGRAPPRVL", (val) ? "T" : "F");
+ }
- public void defaultAll() {
- setCourseNum("");
- setCourseName("");
- setCourseDesc("");
- setCourseActive(true);
- setCourseRequiresManagerApproval(false);
- setCourseQuickView(false);
- setCourseTypeID(2);
- setCourseURL("");
- }
+ public void setCourseIPRestricted(String val) {
+ setValue("COURSISIPRESTRICTED", val);
+ }
+ public void setCourseIPRestricted(boolean val) {
+ setValue("COURSISIPRESTRICTED", (val) ? "T" : "F");
+ }
- public String getCourseFrameFeatures(javax.servlet.ServletContext context) {
+ public String getCourseSeatTimeText() {
+ return getNiceTimeText(getCourseSeatMinutes());
+ }
- /*
+ public static String getNiceTimeText(int minutes) {
+ int seatMinutes = minutes;
+ int seatDays = seatMinutes / (60 * 24);
+ seatMinutes = seatMinutes % (60 * 24);
+ int seatHours = seatMinutes / 60;
+ seatMinutes = seatMinutes % 60;
+ String timeFrame = (seatDays > 0) ? (Integer.toString(seatDays) + " Day" + ((seatDays != 1) ? "s " : " ")) : "";
+ timeFrame += (seatHours > 0) ? (Integer.toString(seatHours) + " Hour" + ((seatHours != 1) ? "s " : " ")) : "";
+ timeFrame += (seatMinutes > 0) ? (Integer.toString(seatMinutes) + " Minute" + ((seatMinutes != 1) ? "s" : "")) : "";
+ return timeFrame;
+ }
- Javascript window.open features, ','-separated. Many of these are =yes|no
+ public void defaultAll() {
+ setCourseNum("");
+ setCourseName("");
+ setCourseDesc("");
+ setCourseActive(true);
+ setCourseRequiresManagerApproval(false);
+ setCourseQuickView(false);
+ setCourseTypeID(2);
+ setCourseURL("");
+ }
- status The status bar at the bottom of the window.
- toolbar The standard browser toolbar, with buttons such as Back and Forward.
- location The Location entry field where you enter the URL.
- menubar The menu bar of the window
- directories The standard browser directory buttons, such as What's New and What's Cool
- resizable Allow/Disallow the user to resize the window.
- scrollbars Enable the scrollbars if the document is bigger than the window
- height Specifies the height of the window in pixels. (example: height='350')
- width Specifies the width of the window in pixels.
- */
+ public String getCourseFrameFeatures(javax.servlet.ServletContext context) {
- // Default
- String retVal = "width=800,height=600";
- String url = getCourseURL();
+ /*
+ Javascript window.open features, ','-separated. Many of these are =yes|no
+
+ status The status bar at the bottom of the window.
+ toolbar The standard browser toolbar, with buttons such as Back and Forward.
+ location The Location entry field where you enter the URL.
+ menubar The menu bar of the window
+ directories The standard browser directory buttons, such as What's New and What's Cool
+ resizable Allow/Disallow the user to resize the window.
+ scrollbars Enable the scrollbars if the document is bigger than the window
+ height Specifies the height of the window in pixels. (example: height='350')
+ width Specifies the width of the window in pixels.
+
+ */
+
+ // Default
+ String retVal = "width=800,height=600";
+ String url = getCourseURL();
+
if ((url != null) && (url.endsWith("frameset.htm"))) {
- url = url.substring(0, url.length()-"frameset.htm".length());
- url += "course.xml";
+ url = url.substring(0, url.length()-"frameset.htm".length());
+ url += "course.xml";
java.net.URL courseXML = null;
org.xml.sax.InputSource inputSource = null;
String expression = "/course";
- try {
+ try {
courseXML = new java.net.URL(url);
- inputSource = new org.xml.sax.InputSource(courseXML.openStream());
- } catch (Exception ex) {
-// logger.error(ex, ex);
- }
- if (inputSource == null) {
+ inputSource = new org.xml.sax.InputSource(courseXML.openStream());
+ }
+ catch (Exception ex) {
+// logger.error(ex, ex);
+ }
+ if (inputSource == null) {
try {
File f = new File(context.getRealPath(url));
- inputSource = new org.xml.sax.InputSource(new java.io.
- FileInputStream(f));
- } catch (Exception ex) {
+ inputSource = new org.xml.sax.InputSource(new java.io.FileInputStream(f));
+ }
+ catch (Exception ex) {
// logger.error(ex, ex);
}
- }
- if (inputSource != null) {
- try {
+ }
+ if (inputSource != null) {
+ try {
javax.xml.xpath.XPath xpath = javax.xml.xpath.XPathFactory.newInstance().newXPath();
- com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList nodes = (
- com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList)
- xpath.evaluate(expression, inputSource,
- javax.xml.xpath.XPathConstants.
- NODESET);
- if (nodes.getLength() > 0) {
- org.w3c.dom.Node n = nodes.item(0);
- org.w3c.dom.Node name = n.getAttributes().getNamedItem(
- "frameFeatures");
- if (name != null) {
- retVal = (String) name.getNodeValue();
- }
- }
- } catch (Exception ex) {
- logger.error(ex, ex);
- }
- }
- else {
- logger.error("Bad course URL: " + url);
+ com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList nodes = (com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList) xpath.evaluate(expression, inputSource, javax.xml.xpath.XPathConstants.NODESET);
+ if (nodes.getLength() > 0) {
+ org.w3c.dom.Node n = nodes.item(0);
+ org.w3c.dom.Node name = n.getAttributes().getNamedItem("frameFeatures");
+ if (name != null) {
+ retVal = (String) name.getNodeValue();
+ }
+ }
+ } catch (Exception ex) {
+ logger.error(ex, ex);
+ }
+ }
+ else {
+ logger.error("Bad course URL: " + url);
+ }
}
- }
- return retVal;
- }
+ return retVal;
+ }
- public boolean equals(Object o) {
- if (o instanceof Course) {
- return (getCourseID() == ((Course)o).getCourseID());
- }
- return super.equals(o);
- }
+ public boolean equals(Object o) {
+ if (o instanceof Course) {
+ return (getCourseID() == ((Course)o).getCourseID());
+ }
+ return super.equals(o);
+ }
public String toXML() {
return toXML(DETAIL_COMPLETE);
Modified: branches/1.6/src/com/resolutions/ils/data/CourseAttempt.java
===================================================================
--- branches/1.6/src/com/resolutions/ils/data/CourseAttempt.java 2016-07-13 10:57:10 UTC (rev 1484)
+++ branches/1.6/src/com/resolutions/ils/data/CourseAttempt.java 2016-07-13 11:36:13 UTC (rev 1485)
@@ -31,93 +31,94 @@
df.setTimeZone(TimeZone.getTimeZone("GMT"));
}
- public static final int STATUS_NEW = 0;
- public static final int STATUS_PASSED = 1;
- public static final int STATUS_FAILED = 2;
- public static final int STATUS_IN_PROGRESS = 3;
+ public static final int STATUS_NEW = 0;
+ public static final int STATUS_PASSED = 1;
+ public static final int STATUS_FAILED = 2;
+ public static final int STATUS_IN_PROGRESS = 3;
- static String LOOKUPUSERCOURSEATTEMPTS = "SELECT * FROM COURSEATTEMPT WHERE USERPRID={USERPRID} AND COURSID={COURSID} AND COMPANYID={COMPANYID} AND CAEXPIREDON IS NULL ORDER BY CASTARTDATE DESC";
- static String LOOKUPALLUSERCOURSEATTEMPTS = "SELECT * FROM COURSEATTEMPT WHERE USERPRID={USERPRID} AND COURSID={COURSID} AND COMPANYID={COMPANYID} ORDER BY CASTARTDATE DESC";
- static String LOOKUP = "SELECT * FROM COURSEATTEMPT WHERE COMPANYID={COMPANYID}";
- static String DELETE = "DELETE FROM COURSEATTEMPT WHERE COURSATTID={COURSATTID} AND COMPANYID={COMPANYID}";
+ static String LOOKUPUSERCOURSEATTEMPTS = "SELECT * FROM COURSEATTEMPT WHERE USERPRID={USERPRID} AND COURSID={COURSID} AND COMPANYID={COMPANYID} AND CAEXPIREDON IS NULL ORDER BY CASTARTDATE DESC";
+ static String LOOKUPALLUSERCOURSEATTEMPTS = "SELECT * FROM COURSEATTEMPT WHERE USERPRID={USERPRID} AND COURSID={COURSID} AND COMPANYID={COMPANYID} ORDER BY CASTARTDATE DESC";
+ static String LOOKUP = "SELECT * FROM COURSEATTEMPT WHERE COMPANYID={COMPANYID}";
+ static String DELETE = "DELETE FROM COURSEATTEMPT WHERE COURSATTID={COURSATTID} AND COMPANYID={COMPANYID}";
- static String LOOKUPCOURSECOMPLETE = "SELECT CA.COURSATTID, UP.USERPRID, UP.USERPRNUM, UP.USERPREMAIL, CC.COURSNAME FROM COURSEATTEMPT CA" +
- " join USERPROFILE UP on UP.USERPRID = CA.USERPRID" +
- " join COURSE CC on CC.COURSID=CA.COURSID";
-
- static String LOOKUPEXP = " SELECT COURSATTID FROM COURSEATTEMPT CA2 join COURSE CC on CC.COURSID=CA2.COURSID" +
- " WHERE CA2.COMPANYID={COMPANYID}" +
- " AND CA2.CASTATUSID=1" +
- " AND CA2.CAEXPIREDON IS NULL" +
- " AND CC.COURSPASSEXPDAYS > 0" +
- " AND CA2.CACOMPLETEDATE <= (current_timestamp - (CC.COURSPASSEXPDAYS - COALESCE(CC.COURSREASBEFDAYS,0)))";
-
- static String LOOKUPEXPCOURSE = LOOKUPEXP + " AND CA2.COURSID={COURSID}";
-
- static String REVOKE = "UPDATE COURSEATTEMPT SET CAEXPIREDON=current_timestamp, CAEXPREASON='Recurrent Training Assigned'";
- static String REVOKEEXPCOURSE = REVOKE + " WHERE COURSATTID IN (" + LOOKUPEXPCOURSE + ")";
- static String REVOKEEXP = REVOKE + " WHERE COURSATTID IN (" + LOOKUPEXP + ")";
+ static String LOOKUPCOURSECOMPLETE = "SELECT CA.COMPANYID, CA.COURSATTID, UP.USERPRID, UP.USERPRNUM, UP.USERPREMAIL, CC.COURSNAME, CC.COURSISCURRICULUM FROM COURSEATTEMPT CA" +
+ " join USERPROFILE UP on UP.USERPRID = CA.USERPRID" +
+ " join COURSE CC on CC.COURSID=CA.COURSID";
- static String LOOKUPCOURSECOMPLETEEXP = LOOKUPCOURSECOMPLETE + " WHERE CA.COURSATTID IN (" + LOOKUPEXP + ")";
- static String LOOKUPCOURSECOMPLETEEXPCOURSE = LOOKUPCOURSECOMPLETE + " WHERE CA.COURSATTID IN (" + LOOKUPEXPCOURSE + ")";
+ static String LOOKUPEXP = " SELECT COURSATTID FROM COURSEATTEMPT CA2 join COURSE CC on CC.COURSID=CA2.COURSID" +
+ " WHERE CA2.COMPANYID={COMPANYID}" +
+ " AND CA2.CASTATUSID=1" +
+ " AND CA2.CAEXPIREDON IS NULL" +
+ " AND CC.COURSPASSEXPDAYS > 0" +
+ " AND CA2.CACOMPLETEDATE <= (current_timestamp - (CC.COURSPASSEXPDAYS - COALESCE(CC.COURSREASBEFDAYS,0)))";
- //-------------- PENDING EXP
- static String LOOKUPPENDINGEXP = " SELECT COURSATTID FROM COURSEATTEMPT CA2 join COURSE CC on CC.COURSID=CA2.COURSID" +
- " WHERE CA2.COMPANYID={COMPANYID}" +
- " AND CA2.CASTATUSID=1" +
- " AND CA2.CAEXPIREDON IS NOT NULL" +
- " AND CC.COURSPASSEXPDAYS > 0" +
- " AND CA2.CACOMPLETEDATE <= (current_timestamp - (CC.COURSPASSEXPDAYS - {WARNDAYS}))";
-
- static String LOOKUPPENDINGEXPCOURSE = LOOKUPPENDINGEXP + " AND CA2.COURSID={COURSID}";
-
- static String LOOKUPCOURSECOMPLETEPENDINGEXP = LOOKUPCOURSECOMPLETE + " WHERE CA.COURSATTID IN (" + LOOKUPPENDINGEXP + ")";
- static String LOOKUPCOURSECOMPLETEPENDINGEXPCOURSE = LOOKUPCOURSECOMPLETE + " WHERE CA.COURSATTID IN (" + LOOKUPPENDINGEXPCOURSE + ")";
+ static String LOOKUPEXPCOURSE = LOOKUPEXP + " AND CA2.COURSID={COURSID}";
-
- protected DataObject createDataObject() {
- return new CourseAttempt();
- }
+ static String REVOKE = "UPDATE COURSEATTEMPT SET CAEXPIREDON=current_timestamp, CAEXPREASON='Recurrent Training Assigned'";
+ static String REVOKEEXPCOURSE = REVOKE + " WHERE COURSATTID IN (" + LOOKUPEXPCOURSE + ")";
+ static String REVOKEEXP = REVOKE + " WHERE COURSATTID IN (" + LOOKUPEXP + ")";
- static public Vector getUserCourseAttempts(ILSSession session, int userID,
- int courseID) {
- return getUserCourseAttempts(session, userID, courseID, true);
- }
+ static String LOOKUPCOURSECOMPLETEEXP = LOOKUPCOURSECOMPLETE + " WHERE CA.COURSATTID IN (" + LOOKUPEXP + ")";
+ static String LOOKUPCOURSECOMPLETEEXPCOURSE = LOOKUPCOURSECOMPLETE + " WHERE CA.COURSATTID IN (" + LOOKUPEXPCOURSE + ")";
- static public Vector getUserCourseAttempts(ILSSession session, int userID,
- int courseID, boolean includeExpireds) {
- CourseAttempt query = new CourseAttempt();
- query.setCompanyID(session.getCompanyID());
- query.setCourseAttemptUserProfileID(userID);
- query.setCourseAttemptCourseID(courseID);
- return query.getDataSet(includeExpireds?LOOKUPALLUSERCOURSEATTEMPTS:LOOKUPUSERCOURSEATTEMPTS);
- }
+ //-------------- PENDING EXP
+ static String LOOKUPPENDINGEXP = " SELECT COURSATTID FROM COURSEATTEMPT CA2 join COURSE CC on CC.COURSID=CA2.COURSID" +
+ " WHERE CA2.COMPANYID={COMPANYID}" +
+ " AND CA2.CASTATUSID=1" +
+ " AND CA2.CAEXPIREDON IS NOT NULL" +
+ " AND CC.COURSPASSEXPDAYS > 0" +
+ " AND CA2.CACOMPLETEDATE <= (current_timestamp - (CC.COURSPASSEXPDAYS - {WARNDAYS}))";
- static public int deleteCourseAttempt(ILSSession session, int courseAttemptID) {
- CourseAttempt query = new CourseAttempt();
- query.setCourseAttemptID(courseAttemptID);
- query.setCompanyID(session.getCompanyID());
- return query.executeSQL(DELETE);
- }
+ static String LOOKUPPENDINGEXPCOURSE = LOOKUPPENDINGEXP + " AND CA2.COURSID={COURSID}";
- /********************************
- *
- * @param session
- * @param email, pass the HTTP session if you wish to send email, otherwise pass null
- * @return
- */
- static public int revokeAllExpired(int companyID, ServletContext context, boolean sendEmail) {
- return revokeAllExpired(companyID, 0, context, sendEmail);
- }
-
- /*******************
- *
- * @param session
- * @param courseID
- * @param email, pass the HTTP session if you wish to send email, otherwise pass null
- * @return
- */
-static public synchronized int revokeAllExpired(int companyID, int courseID, ServletContext context, boolean sendEmail) {
+ static String LOOKUPCOURSECOMPLETEPENDINGEXP = LOOKUPCOURSECOMPLETE + " WHERE CA.COURSATTID IN (" + LOOKUPPENDINGEXP + ")";
+ static String LOOKUPCOURSECOMPLETEPENDINGEXPCOURSE = LOOKUPCOURSECOMPLETE + " WHERE CA.COURSATTID IN (" + LOOKUPPENDINGEXPCOURSE + ")";
+
+
+ protected DataObject createDataObject() {
+ return new CourseAttempt();
+ }
+
+ static public Vector getUserCourseAttempts(ILSSession session, int userID, int courseID) {
+ return getUserCourseAttempts(session, userID, courseID, true);
+ }
+
+ static public Vector getUserCourseAttempts(ILSSession session, int userID, int courseID, boolean includeExpireds) {
+ return getUserCourseAttempts(session.getCompanyID(), userID, courseID, includeExpireds);
+ }
+ static public Vector getUserCourseAttempts(int companyID, int userID, int courseID, boolean includeExpireds) {
+ CourseAttempt query = new CourseAttempt();
+ query.setCompanyID(companyID);
+ query.setCourseAttemptUserProfileID(userID);
+ query.setCourseAttemptCourseID(courseID);
+ return query.getDataSet(includeExpireds?LOOKUPALLUSERCOURSEATTEMPTS:LOOKUPUSERCOURSEATTEMPTS);
+ }
+
+ static public int deleteCourseAttempt(ILSSession session, int courseAttemptID) {
+ CourseAttempt query = new CourseAttempt();
+ query.setCourseAttemptID(courseAttemptID);
+ query.setCompanyID(session.getCompanyID());
+ return query.executeSQL(DELETE);
+ }
+
+ /********************************
+ *
+ * @param session
+ * @param email, pass the HTTP session if you wish to send email, otherwise pass null
+ * @return
+ */
+ static public int revokeAllExpired(int companyID, ServletContext context, boolean sendEmail) {
+ return revokeAllExpired(companyID, 0, context, sendEmail);
+ }
+
+ /*******************
+ *
+ * @param session
+ * @param courseID
+ * @param email, pass the HTTP session if you wish to send email, otherwise pass null
+ * @return
+ */
+ static public synchronized int revokeAllExpired(int companyID, int courseID, ServletContext context, boolean sendEmail) {
System.out.println("**** revokeAllExpired: start");
Properties sysConfig = Utils.getSysConfig(context, companyID);
CourseAttempt query = new CourseAttempt();
@@ -167,23 +168,23 @@
}
- /********************************
- *
- * @param session
- * @param email, pass the HTTP session if you wish to send email, otherwise pass null
- * @return
- */
- static public int warnAllPendingExpired(int companyID, ServletContext context, int warningNumber) {
- return warnAllPendingExpired(companyID, 0, context, warningNumber);
- }
-
- /*******************
- *
- * @param session
- * @param courseID
- * @param email, pass the HTTP session if you wish to send email, otherwise pass null
- * @return
- */
+ /********************************
+ *
+ * @param session
+ * @param email, pass the HTTP session if you wish to send email, otherwise pass null
+ * @return
+ */
+ static public int warnAllPendingExpired(int companyID, ServletContext context, int warningNumber) {
+ return warnAllPendingExpired(companyID, 0, context, warningNumber);
+ }
+
+ /*******************
+ *
+ * @param session
+ * @param courseID
+ * @param email, pass the HTTP session if you wish to send email, otherwise pass null
+ * @return
+ */
static public synchronized int warnAllPendingExpired(int companyID, int courseID, ServletContext context, int warningNumber) {
Properties sysConfig = Utils.getSysConfig(context, companyID);
CourseAttempt query = new CourseAttempt();
@@ -243,29 +244,29 @@
}
return count;
}
-
- public int save(CourseAttempt orig) {
- String[] keyCols = new String[] {"COMPANYID", "COURSATTID"};
- return save(orig, "COURSEATTEMPT", keyCols);
- }
- public CourseAttempt saveNew(ILSSession session) {
- setCompanyID(session.getCompanyID());
- saveNew("COURSEATTEMPT");
- return (CourseAttempt)lookupThis("COURSEATTEMPT");
- }
+ public int save(CourseAttempt orig) {
+ String[] keyCols = new String[] {"COMPANYID", "COURSATTID"};
+ return save(orig, "COURSEATTEMPT", keyCols);
+ }
+ public CourseAttempt saveNew(ILSSession session) {
+ setCompanyID(session.getCompanyID());
+ saveNew("COURSEATTEMPT");
+ return (CourseAttempt)lookupThis("COURSEATTEMPT");
+ }
- static public CourseAttempt getCourseAttempt(ILSSession session, int courseAttemptID) {
- CourseAttempt query = new CourseAttempt();
- String sql = LOOKUP + " AND COURSATTID={COURSATTID}";
- query.setCourseAttemptID(courseAttemptID);
- query.setCompanyID(session.getCompanyID());
- Vector rows = query.getDataSet(sql);
- return (rows.size() > 0) ? (CourseAttempt) rows.get(0) : null;
- }
+ static public CourseAttempt getCourseAttempt(ILSSession session, int courseAttemptID) {
+ CourseAttempt query = new CourseAttempt();
+ String sql = LOOKUP + " AND COURSATTID={COURSATTID}";
+ query.setCourseAttemptID(courseAttemptID);
+ query.setCompanyID(session.getCompanyID());
+ Vector rows = query.getDataSet(sql);
+ return (rows.size() > 0) ? (CourseAttempt) rows.get(0) : null;
+ }
+
static public boolean hasTime(Date date) {
if (date == null) {
return false;
@@ -307,331 +308,331 @@
int managerID, int courseID, int complianceID, Date sDate, Date eDate, boolean reqApprov) {
return getSearchUserCourseAttempts(session, locID != -1 ? new HashSet<Integer>(Arrays.asList(new Integer[] { locID })) : null, roleID != -1 ? new HashSet<Integer>(Arrays.asList(new Integer[] { roleID })) : null, lName, empNum, statusID, accessLevel, hireStartDate, hireEndDate, managerID, courseID, complianceID, sDate, eDate, reqApprov);
}
- static public Vector getSearchUserCourseAttempts(ILSSession session, Set<Integer> locIDs, Set<Integer> roleIDs,
- String lName, String empNum, int statusID, int accessLevel, Date hireStartDate, Date hireEndDate,
- int managerID, int courseID, int complianceID, Date sDate, Date eDate, boolean reqApprov) {
- String sql = "SELECT *, "+
- " (SELECT MAX(GROUPNAME) FROM USERGROUP UG JOIN ILSGROUP IG ON UG.COMPANYID=IG.COMPANYID AND UG.ILSGROUPID=IG.ILSGROUPID WHERE UG.USERPRID=UP.USERPRID AND GROUPTYPEID=2) WORKGROUP, " +
- " (SELECT MAX(GROUPNAME) FROM USERGROUP UG JOIN ILSGROUP IG ON UG.COMPANYID=IG.COMPANYID AND UG.ILSGROUPID=IG.ILSGROUPID WHERE UG.USERPRID=UP.USERPRID AND GROUPTYPEID=1) ROLE " +
- " FROM COURSEATTEMPT CA, USERPROFILE UP, COURSE CR WHERE CA.USERPRID=UP.USERPRID AND CA.COURSID=CR.COURSID AND UP.COMPANYID={COMPANYID} AND UP.USERPRSTATUSID={USERPRSTATUSID}";
- CourseAttempt retVal = new CourseAttempt();
- if (locIDs != null) {
- sql += " AND exists (select * from usergroup ug where ug.userprid=up.userprid and ilsgroupid in (";
- int i = 0;
- for (int l : locIDs) {
- if (i > 0) sql += ", ";
- sql += "{LOCATIONID" + i + "}";
- retVal.setIntValue("LOCATIONID"+i, l);
- ++i;
+ static public Vector getSearchUserCourseAttempts(ILSSession session, Set<Integer> locIDs, Set<Integer> roleIDs,
+ String lName, String empNum, int statusID, int accessLevel, Date hireStartDate, Date hireEndDate,
+ int managerID, int courseID, int complianceID, Date sDate, Date eDate, boolean reqApprov) {
+ String sql = "SELECT *, "+
+ " (SELECT MAX(GROUPNAME) FROM USERGROUP UG JOIN ILSGROUP IG ON UG.COMPANYID=IG.COMPANYID AND UG.ILSGROUPID=IG.ILSGROUPID WHERE UG.USERPRID=UP.USERPRID AND GROUPTYPEID=2) WORKGROUP, " +
+ " (SELECT MAX(GROUPNAME) FROM USERGROUP UG JOIN ILSGROUP IG ON UG.COMPANYID=IG.COMPANYID AND UG.ILSGROUPID=IG.ILSGROUPID WHERE UG.USERPRID=UP.USERPRID AND GROUPTYPEID=1) ROLE " +
+ " FROM COURSEATTEMPT CA, USERPROFILE UP, COURSE CR WHERE CA.USERPRID=UP.USERPRID AND CA.COURSID=CR.COURSID AND UP.COMPANYID={COMPANYID} AND UP.USERPRSTATUSID={USERPRSTATUSID}";
+ CourseAttempt retVal = new CourseAttempt();
+ if (locIDs != null) {
+ sql += " AND exists (select * from usergroup ug where ug.userprid=up.userprid and ilsgroupid in (";
+ int i = 0;
+ for (int l : locIDs) {
+ if (i > 0) sql += ", ";
+ sql += "{LOCATIONID" + i + "}";
+ retVal.setIntValue("LOCATIONID"+i, l);
+ ++i;
+ }
+ sql += ")) ";
}
- sql += ")) ";
- }
// why is this an else!!? Investigate and remove if possible
- else if (managerID > -1) {
- sql += " AND exists (select * from usergroup ugg, managergroup mg where ugg.ilsgroupid=mg.ilsgroupid and ugg.userprid=up.userprid and mg.userprid=" +
- managerID + ")";
- }
- if (accessLevel > -1) {
- sql += " AND USERPRACCESSLEVEL=" + accessLevel;
- }
+ else if (managerID > -1) {
+ sql += " AND exists (select * from usergroup ugg, managergroup mg where ugg.ilsgroupid=mg.ilsgroupid and ugg.userprid=up.userprid and mg.userprid=" +
+ managerID + ")";
+ }
+ if (accessLevel > -1) {
+ sql += " AND USERPRACCESSLEVEL=" + accessLevel;
+ }
- if (reqApprov) {
- sql += " AND (CR.COURSREQMGRAPPRVL='T' AND CA.CASTATUSID="+STATUS_PASSED+" AND (CA.CAISMGRAPPRVL<>'T' OR CA.CAISMGRAPPRVL IS NULL))";
- }
+ if (reqApprov) {
+ sql += " AND (CR.COURSREQMGRAPPRVL='T' AND CA.CASTATUSID="+STATUS_PASSED+" AND (CA.CAISMGRAPPRVL<>'T' OR CA.CAISMGRAPPRVL IS NULL))";
+ }
- if (hireStartDate != null) {
- sql += " AND UP.USERPRHIREDATE >= {HIRESTARTDATE}";
- retVal.setDateValue("HIRESTARTDATE", hireStartDate);
- }
+ if (hireStartDate != null) {
+ sql += " AND UP.USERPRHIREDATE >= {HIRESTARTDATE}";
+ retVal.setDateValue("HIRESTARTDATE", hireStartDate);
+ }
- if (hireEndDate != null) {
- sql += " AND UP.USERPRHIREDATE <= {HIREENDDATE}";
- retVal.setDateValue("HIREENDDATE", hireEndDate);
- }
+ if (hireEndDate != null) {
+ sql += " AND UP.USERPRHIREDATE <= {HIREENDDATE}";
+ retVal.setDateValue("HIREENDDATE", hireEndDate);
+ }
- if (roleIDs != null) {
- sql += " AND exists (select * from usergroup uggg where uggg.userprid=up.userprid and ilsgroupid in (";
- int i = 0;
- for (int l : roleIDs) {
- if (i > 0) sql += ", ";
- sql += "{ROLEID" + i + "}";
- retVal.setIntValue("ROLEID"+i, l);
- ++i;
+ if (roleIDs != null) {
+ sql += " AND exists (select * from usergroup uggg where uggg.userprid=up.userprid and ilsgroupid in (";
+ int i = 0;
+ for (int l : roleIDs) {
+ if (i > 0) sql += ", ";
+ sql += "{ROLEID" + i + "}";
+ retVal.setIntValue("ROLEID"+i, l);
+ ++i;
+ }
+ sql += ")) ";
}
- sql += ")) ";
- }
- if ((lName != null) && (lName.length() > 0)) {
- sql += " AND upper(up.USERPRLNAME) like {USERPRLNAME}";
- retVal.setValue("USERPRLNAME", lName.toUpperCase() + "%");
- }
- if ((empNum != null) && (empNum.length() > 0)) {
- sql += " AND upper(up.USERPRNUM) like {USERPRNUM}";
- retVal.setValue("USERPRNUM", empNum.toUpperCase() + "%");
- }
- if (courseID > -1) {
- sql += " AND CA.COURSID={COURSID}";
- retVal.setCourseAttemptCourseID(courseID);
- }
- if (complianceID > -1) {
- sql += " AND exists (SELECT * FROM COURSECOMPLC cc WHERE ca.COURSID=cc.COURSID AND cc.COMPLCID=" + complianceID + ")";
- }
- if (sDate != null) {
- // odd naming here, but it should be correct as-is
- sql += " AND CA.CACOMPLETEDATE>={CASTARTDATE}";
- retVal.setCourseAttemptStartDate(sDate);
- }
- if (eDate != null) {
- sql += " AND CA.CACOMPLETEDATE<={CAENDDATE}";
- retVal.setTSValue("CAENDDATE", makeEndOfDay(eDate));
- }
+ if ((lName != null) && (lName.length() > 0)) {
+ sql += " AND upper(up.USERPRLNAME) like {USERPRLNAME}";
+ retVal.setValue("USERPRLNAME", lName.toUpperCase() + "%");
+ }
+ if ((empNum != null) && (empNum.length() > 0)) {
+ sql += " AND upper(up.USERPRNUM) like {USERPRNUM}";
+ retVal.setValue("USERPRNUM", empNum.toUpperCase() + "%");
+ }
+ if (courseID > -1) {
+ sql += " AND CA.COURSID={COURSID}";
+ retVal.setCourseAttemptCourseID(courseID);
+ }
+ if (complianceID > -1) {
+ sql += " AND exists (SELECT * FROM COURSECOMPLC cc WHERE ca.COURSID=cc.COURSID AND cc.COMPLCID=" + complianceID + ")";
+ }
+ if (sDate != null) {
+ // odd naming here, but it should be correct as-is
+ sql += " AND CA.CACOMPLETEDATE>={CASTARTDATE}";
+ retVal.setCourseAttemptStartDate(sDate);
+ }
+ if (eDate != null) {
+ sql += " AND CA.CACOMPLETEDATE<={CAENDDATE}";
+ retVal.setTSValue("CAENDDATE", makeEndOfDay(eDate));
+ }
- sql += " ORDER BY CA.CASTARTDATE DESC";
+ sql += " ORDER BY CA.CASTARTDATE DESC";
- retVal.setCompanyID(session.getCompanyID());
- retVal.setIntValue("USERPRSTATUSID", statusID);
+ retVal.setCompanyID(session.getCompanyID());
+ retVal.setIntValue("USERPRSTATUSID", statusID);
- return retVal.getDataSet(sql);
- }
+ return retVal.getDataSet(sql);
+ }
- static public Vector getCourseAttemptsSummary(ILSSession session, boolean byRole, int managerID, int statusID) {
- String sql = "SELECT IG.GROUPNAME, CAS.CASTATUSDESC, COUNT(CA.CASTATUSID) AS STATUSTOTAL" +
- "FROM USERGROUP UG, " +
- "ILSGROUP IG, COURSEATTEMPT CA, COURSEATTSTATUS CAS, USERPROFILE UP " +
- "WHERE " +
- "UG.USERPRID=CA.USERPRID AND IG.ILSGROUPID=UG.ILSGROUPID AND CA.USERPRID=UP.USERPRID AND CA.CASTATUSID=CAS.CASTATUSID AND " +
- "UP.COMPANYID={COMPANYID} AND " +
- "UP.USERPRSTATUSID={USERPRSTATUSID}";
+ static public Vector getCourseAttemptsSummary(ILSSession session, boolean byRole, int managerID, int statusID) {
+ String sql = "SELECT IG.GROUPNAME, CAS.CASTATUSDESC, COUNT(CA.CASTATUSID) AS STATUSTOTAL" +
+ "FROM USERGROUP UG, " +
+ "ILSGROUP IG, COURSEATTEMPT CA, COURSEATTSTATUS CAS, USERPROFILE UP " +
+ "WHERE " +
+ "UG.USERPRID=CA.USERPRID AND IG.ILSGROUPID=UG.ILSGROUPID AND CA.USERPRID=UP.USERPRID AND CA.CASTATUSID=CAS.CASTATUSID AND " +
+ "UP.COMPANYID={COMPANYID} AND " +
+ "UP.USERPRSTATUSID={USERPRSTATUSID}";
- CourseAttempt retVal = new CourseAttempt();
-
- if (managerID > -1) {
- sql += " AND exists (select * from usergroup ugg, managergroup mg where ugg.ilsgroupid=mg.ilsgroupid and ugg.userprid=up.userprid and mg.userprid=" +
- managerID + ")";
- }
+ CourseAttempt retVal = new CourseAttempt();
- sql += " GROUP BY UG.ILSGROUPID, IG.GROUPNAME, CA.CASTATUSID, CAS.CASTATUSDESC";
- sql += " ORDER BY IG.GROUPNAME ASC";
+ if (managerID > -1) {
+ sql += " AND exists (select * from usergroup ugg, managergroup mg where ugg.ilsgroupid=mg.ilsgroupid and ugg.userprid=up.userprid and mg.userprid=" +
+ managerID + ")";
+ }
- retVal.setCompanyID(session.getCompanyID());
- retVal.setIntValue("USERPRSTATUSID", statusID);
+ sql += " GROUP BY UG.ILSGROUPID, IG.GROUPNAME, CA.CASTATUSID, CAS.CASTATUSDESC";
+ sql += " ORDER BY IG.GROUPNAME ASC";
- return retVal.getDataSet(sql);
- }
-
-
- public CourseAttempt() {
- setIntValue("CASTATUSID", 0);
- }
+ retVal.setCompanyID(session.getCompanyID());
+ retVal.setIntValue("USERPRSTATUSID", statusID);
- public Date getCourseAttemptCompleteDate() {
- return getTSValue("CACOMPLETEDATE");
- }
+ return retVal.getDataSet(sql);
+ }
- public void setCourseAttemptCompleteDate(Date val) {
- setTSValue("CACOMPLETEDATE", val);
- }
- public int getCourseAttemptID() {
- return getIntValue("COURSATTID");
- }
+ public CourseAttempt() {
+ setIntValue("CASTATUSID", 0);
+ }
- public void setCourseAttemptID(int val) {
- setIntValue("COURSATTID", val);
- }
+ public Date getCourseAttemptCompleteDate() {
+ return getTSValue("CACOMPLETEDATE");
+ }
- public int getCourseAttemptCourseID() {
- return getIntValue("COURSID");
- }
+ public void setCourseAttemptCompleteDate(Date val) {
+ setTSValue("CACOMPLETEDATE", val);
+ }
- public void setCourseAttemptCourseID(int id) {
- setIntValue("COURSID", id);
- }
+ public int getCourseAttemptID() {
+ return getIntValue("COURSATTID");
+ }
- public int getCourseAttemptScore() {
- return getIntValue("CASCORE");
- }
+ public void setCourseAttemptID(int val) {
+ setIntValue("COURSATTID", val);
+ }
- public void setCourseAttemptScore(int val) {
- setIntValue("CASCORE", val);
- }
+ public int getCourseAttemptCourseID() {
+ return getIntValue("COURSID");
+ }
- public String getCourseAttemptStage() {
- return getStringValue("CASTAGE");
- }
+ public void setCourseAttemptCourseID(int id) {
+ setIntValue("COURSID", id);
+ }
- public void setCourseAttemptStage(String val) {
- if (val == null || val.trim().length() == 0) {
- try {
+ public int getCourseAttemptScore() {
+ return getIntValue("CASCORE");
+ }
+
+ public void setCourseAttemptScore(int val) {
+ setIntValue("CASCORE", val);
+ }
+
+ public String getCourseAttemptStage() {
+ return getStringValue("CASTAGE");
+ }
+
+ public void setCourseAttemptStage(String val) {
+ if (val == null || val.trim().length() == 0) {
+ try {
+ String oldValue = getCourseAttemptStage();
+ if (oldValue != null && oldValue.length() > 0) {
+ throw new Exception("Refusing to set CourseAtteptStage to empty when previous value was not empty.");
+ }
+ }
+ catch (Exception e) { e.printStackTrace(); return; }
+ return;
+ }
+ if ("".equals(getINIValue(val, "lesson_location"))) {
String oldValue = getCourseAttemptStage();
if (oldValue != null && oldValue.length() > 0) {
- throw new Exception("Refusing to set CourseAtteptStage to empty when previous value was not empty.");
+ oldValue = getINIValue(oldValue, "lesson_location");
+ if (oldValue != null && oldValue.length() > 0 && !"0".equals(oldValue)) {
+ val = CourseAttempt.setINIValue(val, "lesson_location", oldValue);
+ }
}
}
- catch (Exception e) { e.printStackTrace(); return; }
- return;
+ setValue("CASTAGE", val);
}
- if ("".equals(getINIValue(val, "lesson_location"))) {
- String oldValue = getCourseAttemptStage();
- if (oldValue != null && oldValue.length() > 0) {
- oldValue = getINIValue(oldValue, "lesson_location");
- if (oldValue != null && oldValue.length() > 0 && !"0".equals(oldValue)) {
- val = CourseAttempt.setINIValue(val, "lesson_location", oldValue);
- }
- }
+
+ public Date getCourseAttemptStartDate() {
+ return getTSValue("CASTARTDATE");
}
- setValue("CASTAGE", val);
- }
- public Date getCourseAttemptStartDate() {
- return getTSValue("CASTARTDATE");
- }
+ public void setCourseAttemptStartDate(Date val) {
+ setTSValue("CASTARTDATE", val);
+ }
- public void setCourseAttemptStartDate(Date val) {
- setTSValue("CASTARTDATE", val);
- }
+ public int getCourseAttemptStatusID() {
+ return getIntValue("CASTATUSID");
+ }
- public int getCourseAttemptStatusID() {
- return getIntValue("CASTATUSID");
- }
+ public void setCourseAttemptStatusID(int val) {
+ setIntValue("CASTATUSID", val);
+ }
- public void setCourseAttemptStatusID(int val) {
- setIntValue("CASTATUSID", val);
- }
+ public int getCourseAttemptUserProfileID() {
+ return getIntValue("USERPRID");
+ }
- public int getCourseAttemptUserProfileID() {
- return getIntValue("USERPRID");
- }
+ public void setCourseAttemptUserProfileID(int id) {
+ setIntValue("USERPRID", id);
+ }
- public void setCourseAttemptUserProfileID(int id) {
- setIntValue("USERPRID", id);
- }
+ public void setCourseAttemptManagerApproved(boolean val) {
+ setValue("CAISMGRAPPRVL", (val) ? "T" : "F");
+ }
- public void setCourseAttemptManagerApproved(boolean val) {
- setValue("CAISMGRAPPRVL", (val) ? "T" : "F");
- }
+ public boolean isCourseAttemptManagerApproved() {
+ return ("T".equals(getValue("CAISMGRAPPRVL")));
+ }
- public boolean isCourseAttemptManagerApproved() {
- return ("T".equals(getValue("CAISMGRAPPRVL")));
- }
+ public void setCourseAttemptExpired(String reason) {
+ setTSValue("CAEXPIREDON", new Date());
+ setValue("CAEXPREASON", reason);
+ }
- public void setCourseAttemptExpired(String reason) {
- setTSValue("CAEXPIREDON", new Date());
- setValue("CAEXPREASON", reason);
- }
+ public boolean isCourseAttemptExpired() {
+ return (getTSValue("CAEXPIREDON") != null);
+ }
- public boolean isCourseAttemptExpired() {
- return (getTSValue("CAEXPIREDON") != null);
- }
+ public Date getCourseAttemptExpiredDate() {
+ return getTSValue("CAEXPIREDON");
+ }
- public Date getCourseAttemptExpiredDate() {
- return getTSValue("CAEXPIREDON");
- }
+ public String getCourseAttemptExpiredReason() {
+ return getStringValue("CAEXPREASON");
+ }
- public String getCourseAttemptExpiredReason() {
- return getStringValue("CAEXPREASON");
- }
+ public void setCourseAttemptForcePass(String reason) {
+ Date now = new Date();
+ setTSValue("CAFORCEPASSON", now);
+ if (getCourseAttemptCompleteDate() == null) {
+ setCourseAttemptCompleteDate(now);
+ }
+ setValue("CAFORCEPASSREASON", reason);
+ setCourseAttemptStatusID(STATUS_PASSED);
+ }
- public void setCourseAttemptForcePass(String reason) {
- Date now = new Date();
- setTSValue("CAFORCEPASSON", now);
- if (getCourseAttemptCompleteDate() == null) {
- setCourseAttemptCompleteDate(now);
- }
- setValue("CAFORCEPASSREASON", reason);
- setCourseAttemptStatusID(STATUS_PASSED);
- }
+ public boolean isCourseAttemptForcePass() {
+ return (getTSValue("CAFORCEPASSON") != null);
+ }
- public boolean isCourseAttemptForcePass() {
- return (getTSValue("CAFORCEPASSON") != null);
- }
+ public Date getCourseAttemptForcePassDate() {
+ return getTSValue("CAFORCEPASSON");
+ }
- public Date getCourseAttemptForcePassDate() {
- return getTSValue("CAFORCEPASSON");
- }
+ public String getCourseAttemptForcePassReason() {
+ return getStringValue("CAFORCEPASSREASON");
+ }
- public String getCourseAttemptForcePassReason() {
- return getStringValue("CAFORCEPASSREASON");
- }
+ public String getCourseAttemptCallbackStatus() {
+ return getStringValue("CACALLBACKSTATUS");
+ }
- public String getCourseAttemptCallbackStatus() {
- return getStringValue("CACALLBACKSTATUS");
- }
+ public void setCourseAttemptCallbackStatus(String status) {
+ setValue("CACALLBACKSTATUS", status);
+ }
- public void setCourseAttemptCallbackStatus(String status) {
- setValue("CACALLBACKSTATUS", status);
- }
-
- public void defaultAll() {
- setCourseAttemptScore(-1);
- setCourseAttemptStartDate(new Date());
- setCourseAttemptStatusID(STATUS_IN_PROGRESS);
- }
+ public void defaultAll() {
+ setCourseAttemptScore(-1);
+ setCourseAttemptStartDate(new Date());
+ setCourseAttemptStatusID(STATUS_IN_PROGRESS);
+ }
static Logger logger = Logger.getLogger(CourseAttempt.class);
- // returns error status
- public boolean sendStatusUpdateEvent(ServletContext context) {
- logger.debug("begin sendStatusUpdateEvent caid: " + this.getCourseAttemptID() + " user: " + this.getCourseAttemptUserProfileID());
- boolean error = false;
-
- ILSSession session = ILSSession.getAnonymous(getCompanyID());
- session.setIntValue("USERPRID", getCourseAttemptUserProfileID());
-
- Properties sysConfig = Utils.getSysConfig(context, getCompanyID());
- boolean apiEnabled = "on".equals(sysConfig.getProperty("APIEnable", "off"));
- String callbackURL = sysConfig.getProperty("APICallbackCourseComplete");
- String passedFailed = null;
+ // returns error status
+ public boolean sendStatusUpdateEvent(ServletContext context) {
+ logger.debug("begin sendStatusUpdateEvent caid: " + this.getCourseAttemptID() + " user: " + this.getCourseAttemptUserProfileID());
+ boolean error = false;
+
+ ILSSession session = ILSSession.getAnonymous(getCompanyID());
+ session.setIntValue("USERPRID", getCourseAttemptUserProfileID());
+
+ Properties sysConfig = Utils.getSysConfig(context, getCompanyID());
+ boolean apiEnabled = "on".equals(sysConfig.getProperty("APIEnable", "off"));
+ String callbackURL = sysConfig.getProperty("APICallbackCourseComplete");
+ String passedFailed = null;
if (getCourseAttemptStatusID() == CourseAttempt.STATUS_PASSED) {
passedFailed = "PASSED";
}
else if (getCourseAttemptStatusID() == CourseAttempt.STATUS_FAILED) {
passedFailed = "FAILED";
}
-
- if (apiEnabled && callbackURL != null) {
- StringBuffer result = new StringBuffer();
- try {
- StringBuffer params = new StringBuffer();
- UserProfile user = UserProfile.getUserProfile(session, getCourseAttemptUserProfileID());
- Course course = Course.getCourse(session, getCourseAttemptCourseID());
- params.append("companyID=").append(getCompanyID());
- params.append("&courseAttemptID=").append(getCourseAttemptID());
- params.append("&userProfileUserData=").append(URLEncoder.encode(user.getStringValue("USERDATA"), "UTF-8"));
- params.append("&userProfileID=").append(user.getUserProfileID());
- params.append("&userProfileLoginID=").append(URLEncoder.encode(user.getUserProfileNum(), "UTF-8"));
- params.append("&courseID=").append(course.getCourseID());
- params.append("&courseNumber=").append(URLEncoder.encode(course.getCourseNum(), "UTF-8"));
- params.append("&courseUserData=").append(URLEncoder.encode(course.getStringValue("USERDATA"), "UTF-8"));
- params.append("&courseName=").append(URLEncoder.encode(course.getCourseName(), "UTF-8"));
- params.append("&startDate=").append(URLEncoder.encode(getCourseAttemptStartDate().toString(), "UTF-8"));
- params.append("&completeDate=").append(URLEncoder.encode(getCourseAttemptCompleteDate().toString(), "UTF-8"));
- params.append("&score=").append(getCourseAttemptScore());
- params.append("&statusID=").append(getCourseAttemptStatusID());
- params.append("&statusDescription=").append(passedFailed);
- params.append("&aiccStage=").append(URLEncoder.encode(getCourseAttemptStage(), "UTF-8"));
- params.append("&isManagerApproved=").append(isCourseAttemptManagerApproved());
-logger.debug("POSTING to callback URL: " + callbackURL);
-logger.debug("POSTING data: " + params);
- result = HTTPUtils.postURL(callbackURL, params.toString());
-logger.debug("POSTING result: " + result.toString());
- }
- catch (Exception e) { e.printStackTrace(); }
- if (!"OK".equals(result.toString().trim())) {
- error = true;
- setCourseAttemptCallbackStatus("0");
- CourseAttempt orig = (CourseAttempt)this.clone();
- setCourseAttemptCallbackStatus("1");
- save(orig);
- }
- }
- logger.debug("end sendStatusUpdateEvent (error:"+error+")");
- return error;
+
+ if (apiEnabled && callbackURL != null) {
+ StringBuffer result = new StringBuffer();
+ try {
+ StringBuffer params = new StringBuffer();
+ UserProfile user = UserProfile.getUserProfile(session, getCourseAttemptUserProfileID());
+ Course course = Course.getCourse(session, getCourseAttemptCourseID());
+ params.append("companyID=").append(getCompanyID());
+ params.append("&courseAttemptID=").append(getCourseAttemptID());
+ params.append("&userProfileUserData=").append(URLEncoder.encode(user.getStringValue("USERDATA"), "UTF-8"));
+ params.append("&userProfileID=").append(user.getUserProfileID());
+ params.append("&userProfileLoginID=").append(URLEncoder.encode(user.getUserProfileNum(), "UTF-8"));
+ params.append("&courseID=").append(course.getCourseID());
+ params.append("&courseNumber=").append(URLEncoder.encode(course.getCourseNum(), "UTF-8"));
+ params.append("&courseUserData=").append(URLEncoder.encode(course.getStringValue("USERDATA"), "UTF-8"));
+ params.append("&courseName=").append(URLEncoder.encode(course.getCourseName(), "UTF-8"));
+ params.append("&startDate=").append(URLEncoder.encode(getCourseAttemptStartDate().toString(), "UTF-8"));
+ params.append("&completeDate=").append(URLEncoder.encode(getCourseAttemptCompleteDate().toString(), "UTF-8"));
+ params.append("&score=").append(getCourseAttemptScore());
+ params.append("&statusID=").append(getCourseAttemptStatusID());
+ params.append("&statusDescription=").append(passedFailed);
+ params.append("&aiccStage=").append(URLEncoder.encode(getCourseAttemptStage(), "UTF-8"));
+ params.append("&isManagerApproved=").append(isCourseAttemptManagerApproved());
+ logger.debug("POSTING to callback URL: " + callbackURL);
+ logger.debug("POSTING data: " + params);
+ result = HTTPUtils.postURL(callbackURL, params.toString());
+ logger.debug("POSTING result: " + result.toString());
+ }
+ catch (Exception e) { e.printStackTrace(); }
+ if (!"OK".equals(result.toString().trim())) {
+ error = true;
+ setCourseAttemptCallbackStatus("0");
+ CourseAttempt orig = (CourseAttempt)this.clone();
+ setCourseAttemptCallbackStatus("1");
+ save(orig);
+ }
+ }
+ logger.debug("end sendStatusUpdateEvent (error:"+error+")");
+ return error;
}
- static public Vector getCourseAttempts(ILSSession session, Date sDate, Date eDate) {
+ static public Vector getCourseAttempts(ILSSession session, Date sDate, Date eDate, int userProfileID, int courseID) {
String sql = "SELECT * FROM COURSEATTEMPT CA, USERPROFILE UP, COURSE CR WHERE CA.USERPRID=UP.USERPRID AND CA.COURSID=CR.COURSID AND UP.COMPANYID={COMPANYID}";
CourseAttempt retVal = new CourseAttempt();
if (sDate != null) {
@@ -643,6 +644,14 @@
// retVal.setTSValue("CAENDDATE", makeEndOfDay(eDate)); // TODO: should probably use makeEndOfDay and change above to <=, but don't want to change any other logic right now. Hunt down callers
retVal.setTSValue("CAENDDATE", eDate);
}
+ if (userProfileID > 0) {
+ sql += " AND CA.USERPRID={USERPRID}";
+ retVal.setIntValue("USERPRID", userProfileID);
+ }
+ if (courseID > 0) {
+ sql += " AND CA.COURSID={COURSID}";
+ retVal.setCourseAttemptCourseID(courseID);
+ }
sql += " ORDER BY CA.CASTARTDATE";
@@ -651,7 +660,11 @@
return retVal.getDataSet(sql);
}
+ static public Vector getCourseAttempts(ILSSession session, Date sDate, Date eDate) {
+ return getCourseAttempts(session, sDate, eDate, -1, -1);
+ }
+
public String toXML() {
return toXML(DETAIL_COMPLETE);
}
@@ -669,7 +682,7 @@
else if (getCourseAttemptStatusID() == CourseAttempt.STATUS_FAILED) {
passedFailed = "FAILED";
}
-
+
StringBuffer result = new StringBuffer();
StringBuffer xml = new StringBuffer();
UserProfile user = UserProfile.getUserProfile(session, getCourseAttemptUserProfileID());
@@ -697,38 +710,6 @@
return xml.toString();
}
-
- static public int resendDelayedCourseUpdates(int companyID, ServletContext context) {
- String CLEAR = "UPDATE COURSEATTEMPT SET CACALLBACKSTATUS=null";
- CourseAttempt query = new CourseAttempt();
- query.setCompanyID(companyID);
- Vector results = null;
- int count = 0;
-
- String LOOKUPRETRY = " FROM COURSEATTEMPT CA2 join COURSE CC on CC.COURSID=CA2.COURSID " +
- " WHERE CA2.COMPANYID={COMPANYID}" +
- " AND CA2.CACALLBACKSTATUS='1'";
-
- results = query.getDataSet("SELECT * " + LOOKUPRETRY);
-
- String CLEARRETRY = CLEAR + " WHERE COURSATTID IN (SELECT COURSATTID " + LOOKUPRETRY + ")";
-
- count = query.executeSQL(CLEARRETRY);
-
-
- if (results != null) {
- for (Object o: results) {
- CourseAttempt ca = (CourseAttempt)o;
- try {
- ca.sendStatusUpdateEvent(context);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- return count;
- }
public void assignRetake(String reason, ILSSession ilsSession, HttpSession httpSession) {
CourseAttempt ca = (CourseAttempt)this.clone();
@@ -754,42 +735,42 @@
}
}
- public static String getINIValue(String data, String key) {
- String value = "";
- int i = data.toLowerCase().indexOf(key.toLowerCase() + "=");
- if (i > -1) {
- i += key.length() + 1;
- int j = data.indexOf("\r", i);
- if (j < i) {
- j = data.indexOf("\n", i);
- }
- if (j < i) {
- value = data.substring(i);
- }
- else
- value = data.substring(i, j);
- }
- return value;
- }
+ public static String getINIValue(String data, String key) {
+ String value = "";
+ int i = data.toLowerCase().indexOf(key.toLowerCase() + "=");
+ if (i > -1) {
+ i += key.length() + 1;
+ int j = data.indexOf("\r", i);
+ if (j < i) {
+ j = data.indexOf("\n", i);
+ }
+ if (j < i) {
+ value = data.substring(i);
+ }
+ else
+ value = data.substring(i, j);
+ }
+ return value;
+ }
- public static String setINIValue(String data, String key, String value) {
- String cValue = "";
- String data1 = data;
- int i = data.indexOf(key + "=");
- if (i > -1) {
- int j = i + key.length() + 1;
- j = data.indexOf("\r\n", j);
- if (j < i) {
- data = data.substring(0, i);
- }
- else
- data = data.substring(0, i) + data1.substring(j+"\r\n".length());
- }
- if (!data.endsWith("\r\n"))
- data += "\r\n";
- data += key + "=" + value+"\r\n";
- return data;
- }
+ public static String setINIValue(String data, String key, String value) {
+ String cValue = "";
+ String data1 = data;
+ int i = data.indexOf(key + "=");
+ if (i > -1) {
+ int j = i + key.length() + 1;
+ j = data.indexOf("\r\n", j);
+ if (j < i) {
+ data = data.substring(0, i);
+ }
+ else
+ data = data.substring(0, i) + data1.substring(j+"\r\n".length());
+ }
+ if (!data.endsWith("\r\n"))
+ data += "\r\n";
+ data += key + "=" + value+"\r\n";
+ return data;
+ }
}
Modified: branches/1.6/src/com/resolutions/ils/data/Group.java
===================================================================
--- branches/1.6/src/com/resolutions/ils/data/Group.java 2016-07-13 10:57:10 UTC (rev 1484)
+++ branches/1.6/src/com/resolutions/ils/data/Group.java 2016-07-13 11:36:13 UTC (rev 1485)
@@ -9,18 +9,18 @@
public class Group extends DataObject implements Comparable<Group> {
- public static final int GROUPTYPE_ROLE = 1;
- public static final int GROUPTYPE_LOCATION = 2;
+ public static final int GROUPTYPE_ROLE = 1;
+ public static final int GROUPTYPE_LOCATION = 2;
- static String LOOKUPALLGROUPS = "SELECT * FROM ILSGROUP WHERE GROUPTYPEID={GROUPTYPEID} AND COMPANYID={COMPANYID} ORDER BY GROUPNAME";
- static String LOOKUPUSERGROUPS = "SELECT * FROM ILSGROUP T1, USERGROUP T2 WHERE GROUPTYPEID={GROUPTYPEID} AND T1.ILSGROUPID=T2.ILSGROUPID AND T2.USERPRID={USERPRID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID}";
- static String LOOKUPGROUPUSERS = "SELECT * FROM USERGROUP T2, USERPROFILE T3 WHERE T2.ILSGROUPID={ILSGROUPID} AND T2.COMPANYID={COMPANYID} AND T3.COMPANYID={COMPANYID} AND T3.USERPRID=T2.USERPRID";
- static String LOOKUPGROUPMANAGERS = "SELECT * FROM MANAGERGROUP T2, USERPROFILE T3 WHERE T2.ILSGROUPID={ILSGROUPID} AND T2.COMPANYID={COMPANYID} AND T3.COMPANYID={COMPANYID} AND T3.USERPRID=T2.USERPRID";
- static String LOOKUPMANAGERGROUPS = "SELECT * FROM ILSGROUP T1, MANAGERGROUP T2 WHERE T1.ILSGROUPID=T2.ILSGROUPID AND T2.USERPRID={USERPRID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID} ORDER BY GROUPNAME";
- static String LOOKUPCOURSEGROUPS = "SELECT * FROM ILSGROUP T1, COURSEGROUP T2 WHERE T1.ILSGROUPID=T2.ILSGROUPID AND T2.COURSID={COURSID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID}";
- static String LOOKUP = "SELECT * FROM ILSGROUP WHERE ILSGROUPID={ILSGROUPID} AND COMPANYID={COMPANYID}";
- static String LOOKUPBYNAME = "SELECT * FROM ILSGROUP WHERE GROUPTYPEID={GROUPTYPEID} AND GROUPNAME={GROUPNAME} AND COMPANYID={COMPANYID}";
- static String LOOKUPBYUSERDATA = "SELECT * FROM ILSGROUP WHERE ILSGROUP.USERDATA={USERDATA} AND COMPANYID={COMPANYID}";
+ static String LOOKUPALLGROUPS = "SELECT * FROM ILSGROUP WHERE GROUPTYPEID={GROUPTYPEID} AND COMPANYID={COMPANYID} ORDER BY GROUPNAME";
+ static String LOOKUPUSERGROUPS = "SELECT * FROM ILSGROUP T1, USERGROUP T2 WHERE GROUPTYPEID={GROUPTYPEID} AND T1.ILSGROUPID=T2.ILSGROUPID AND T2.USERPRID={USERPRID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID}";
+ static String LOOKUPGROUPUSERS = "SELECT * FROM USERGROUP T2, USERPROFILE T3 WHERE T2.ILSGROUPID={ILSGROUPID} AND T2.COMPANYID={COMPANYID} AND T3.COMPANYID={COMPANYID} AND T3.USERPRID=T2.USERPRID";
+ static String LOOKUPGROUPMANAGERS = "SELECT * FROM MANAGERGROUP T2, USERPROFILE T3 WHERE T2.ILSGROUPID={ILSGROUPID} AND T2.COMPANYID={COMPANYID} AND T3.COMPANYID={COMPANYID} AND T3.USERPRID=T2.USERPRID";
+ static String LOOKUPMANAGERGROUPS = "SELECT * FROM ILSGROUP T1, MANAGERGROUP T2 WHERE T1.ILSGROUPID=T2.ILSGROUPID AND T2.USERPRID={USERPRID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID} ORDER BY GROUPNAME";
+ static String LOOKUPCOURSEGROUPS = "SELECT * FROM ILSGROUP T1, COURSEGROUP T2 WHERE T1.ILSGROUPID=T2.ILSGROUPID AND T2.COURSID={COURSID} AND T1.COMPANYID={COMPANYID} AND T2.COMPANYID={COMPANYID}";
+ static String LOOKUP = "SELECT * FROM ILSGROUP WHERE ILSGROUPID={ILSGROUPID} AND COMPANYID={COMPANYID}";
+ static String LOOKUPBYNAME = "SELECT * FROM ILSGROUP WHERE GROUPTYPEID={GROUPTYPEID} AND GROUPNAME={GROUPNAME} AND COMPANYID={COMPANYID}";
+ static String LOOKUPBYUSERDATA = "SELECT * FROM ILSGROUP WHERE ILSGROUP.USERDATA={USERDATA} AND COMPANYID={COMPANYID}";
static String DELETE[] = {
"DELETE FROM ILSGROUP WHERE ILSGROUPID={ILSGROUPID} AND COMPANYID={COMPANYID}",
"DELETE FROM USERGROUP WHERE ILSGROUPID={ILSGROUPID} AND COMPANYID={COMPANYID}",
@@ -28,19 +28,20 @@
"DELETE FROM MANAGERGROUP WHERE ILSGROUPID={ILSGROUPID} AND COMPANYID={COMPANYID}"
};
- static String DELETEUSERGROUPS = "DELETE FROM USERGROUP WHERE USERPRID={USERPRID} AND COMPANYID={COMPANYID} AND EXISTS (SELECT * FROM ILSGROUP T2 WHERE T2.COMPANYID=USERGROUP.COMPANYID AND T2.ILSGROUPID=USERGROUP.ILSGROUPID AND T2.GROUPTYPEID={GROUPTYPEID})";
- static String DELETEMANAGERGROUPS = "DELETE FROM MANAGERGROUP WHERE USERPRID={USERPRID} AND COMPANYID={COMPANYID}";
- static String DELETEMANAGERGROUP = "DELETE FROM MANAGERGROUP WHERE USERPRID={USERPRID} AND COMPANYID={COMPANYID} AND ILSGROUPID={ILSGROUPID}";
- static String ADDUSERGROUP = "INSERT INTO USERGROUP (COMPANYID, ILSGROUPID, USERPRID) VALUES ({COMPANYID}, {ILSGROUPID}, {USERPRID})";
- static String ADDMANAGERGROUP = "INSERT INTO MANAGERGROUP (COMPANYID, ILSGROUPID, USERPRID) VALUES ({COMPANYID}, {ILSGROUPID}, {USERPRID})";
- static String DELETECOURSEGROUPS = "DELETE FROM COURSEGROUP WHERE COURSID={COURSID} AND COMPANYID={COMPANYID} AND EXISTS (SELECT * FROM ILSGROUP T2 WHERE T2.COMPANYID=COURSEGROUP.COMPANYID AND T2.ILSGROUPID=COURSEGROUP.ILSGROUPID AND T2.GROUPTYPEID={GROUPTYPEID})";
- static String DELETEGROUPCOURSES = "DELETE FROM COURSEGROUP WHERE ILSGROUPID={ILSGROUPID} AND COMPANYID={COMPANYID}";
- static String ADDCOURSEGROUP = "INSERT INTO COURSEGROUP (COMPANYID, ILSGROUPID, COURSID) VALUES ({COMPANYID}, {ILSGROUPID}, {COURSID})";
- static String NEWGROUP = "INSERT INTO ILSGROUP (COMPANYID, GROUPNAME, GROUPDESC) VALUES ({CompanyID}, 'Title', 'Title')";
+ static String DELETEUSERGROUPS = "DELETE FROM USERGROUP WHERE USERPRID={USERPRID} AND COMPANYID={COMPANYID} AND EXISTS (SELECT * FROM ILSGROUP T2 WHERE T2.COMPANYID=USERGROUP.COMPANYID AND T2.ILSGROUPID=USERGROUP.ILSGROUPID AND T2.GROUPTYPEID={GROUPTYPEID})";
+ static String DELETEUSERGROUP = "DELETE FROM USERGROUP WHERE USERPRID={USERPRID} AND COMPANYID={COMPANYID} AND ILSGROUPID={ILSGROUPID}";
+ static String DELETEMANAGERGROUPS = "DELETE FROM MANAGERGROUP WHERE USERPRID={USERPRID} AND COMPANYID={COMPANYID}";
+ static String DELETEMANAGERGROUP = "DELETE FROM MANAGERGROUP WHERE USERPRID={USERPRID} AND COMPANYID={COMPANYID} AND ILSGROUPID={ILSGROUPID}";
+ static String ADDUSERGROUP = "INSERT INTO USERGROUP (COMPANYID, ILSGROUPID, USERPRID) VALUES ({COMPANYID}, {ILSGROUPID}, {USERPRID})";
+ static String ADDMANAGERGROUP = "INSERT INTO MANAGERGROUP (COMPANYID, ILSGROUPID, USERPRID) VALUES ({COMPANYID}, {ILSGROUPID}, {USERPRID})";
+ static String DELETECOURSEGROUPS = "DELETE FROM COURSEGROUP WHERE COURSID={COURSID} AND COMPANYID={COMPANYID} AND EXISTS (SELECT * FROM ILSGROUP T2 WHERE T2.COMPANYID=COURSEGROUP.COMPANYID AND T2.ILSGROUPID=COURSEGROUP.ILSGROUPID AND T2.GROUPTYPEID={GROUPTYPEID})";
+ static String DELETEGROUPCOURSES = "DELETE FROM COURSEGROUP WHERE ILSGROUPID={ILSGROUPID} AND COMPANYID={COMPANYID}";
+ static String ADDCOURSEGROUP = "INSERT INTO COURSEGROUP (COMPANYID, ILSGROUPID, COURSID) VALUES ({COMPANYID}, {ILSGROUPID}, {COURSID})";
+ static String NEWGROUP = "INSERT INTO ILSGROUP (COMPANYID, GROUPNAME, GROUPDESC) VALUES ({CompanyID}, 'Title', 'Title')";
- protected DataObject createDataObject() {
- return new Group();
- }
+ protected DataObject createDataObject() {
+ return new Group();
+ }
static public int deleteGroup(ILSSession session, int id) {
Group query = new Group();
@@ -53,22 +54,22 @@
return count;
}
- static public Group getGroup(ILSSession session, int id) {
- Group query = new Group();
- query.setGroupID(id);
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- Vector rows = query.getDataSet(LOOKUP);
- return (rows.size() > 0) ? (Group) rows.get(0) : null;
- }
+ static public Group getGroup(ILSSession session, int id) {
+ Group query = new Group();
+ query.setGroupID(id);
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ Vector rows = query.getDataSet(LOOKUP);
+ return (rows.size() > 0) ? (Group) rows.get(0) : null;
+ }
- static public Group getGroupByName(ILSSession session, int groupTypeID, String groupName) {
- Group query = new Group();
- query.setGroupTypeID(groupTypeID);
- query.setGroupName(groupName);
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- Vector rows = query.getDataSet(LOOKUPBYNAME);
- return (rows.size() > 0) ? (Group) rows.get(0) : null;
- }
+ static public Group getGroupByName(ILSSession session, int groupTypeID, String groupName) {
+ Group query = new Group();
+ query.setGroupTypeID(groupTypeID);
+ query.setGroupName(groupName);
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ Vector rows = query.getDataSet(LOOKUPBYNAME);
+ return (rows.size() > 0) ? (Group) rows.get(0) : null;
+ }
static public Group getGroupByUserData(ILSSession session, String userData) {
return getGroupByUserData(session, -1, userData);
@@ -99,120 +100,124 @@
return Course.getGroupCourses(getCompanyID(), getGroupID());
}
- static public Vector getUserGroups(ILSSession session, int groupTypeID, int userID) {
+ static public Vector getUserGroups(ILSSession session, int groupTypeID, int userID) {
return getUserGroups(session.getCompanyID(), groupTypeID, userID);
- }
- static public Vector getUserGroups(int companyID, int groupTypeID, int userID) {
- Group query = new Group();
- query.setValue("COMPANYID", new Integer(companyID));
- query.setValue("USERPRID", new Integer(userID));
- query.setGroupTypeID(groupTypeID);
- return query.getDataSet(LOOKUPUSERGROUPS);
- }
- static public int deleteUserGroups(ILSSession session, int groupTypeID, int userID) {
- Group query = new Group();
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- query.setValue("USERPRID", new Integer(userID));
- query.setGroupTypeID(groupTypeID);
- return query.executeSQL(DELETEUSERGROUPS);
- }
+ }
+ static public Vector getUserGroups(int companyID, int groupTypeID, int userID) {
+ Group query = new Group();
+ query.setCompanyID(new Integer(companyID));
+ query.setValue("USERPRID", new Integer(userID));
+ query.setGroupTypeID(groupTypeID);
+ return query.getDataSet(LOOKUPUSERGROUPS);
+ }
+ static public int deleteUserGroups(ILSSession session, int groupTypeID, int userID) {
+ Group query = new Group();
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ query.setValue("USERPRID", new Integer(userID));
+ query.setGroupTypeID(groupTypeID);
+ return query.executeSQL(DELETEUSERGROUPS);
+ }
- static public int addUserGroup(ILSSession session, int groupID, int userID) {
- Group query = new Group();
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- query.setValue("USERPRID", new Integer(userID));
- query.setGroupID(groupID);
- return query.executeSQL(ADDUSERGROUP);
- }
+ static public int deleteUserGroup(ILSSession session, int groupID, int userID) {
+ Group query = new Group();
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ query.setValue("USERPRID", new Integer(userID));
+ query.setGroupID(groupID);
+ return query.executeSQL(DELETEUSERGROUP);
+ }
- static public Vector getManagerGroups(ILSSession session, int groupTypeID,
- int userID) {
- Group query = new Group();
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- query.setValue("USERPRID", new Integer(userID));
- query.setGroupTypeID(groupTypeID);
- return query.getDataSet(LOOKUPMANAGERGROUPS);
- }
+ static public int addUserGroup(ILSSession session, int groupID, int userID) {
+ Group query = new Group();
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ query.setValue("USERPRID", new Integer(userID));
+ query.setGroupID(groupID);
+ return query.executeSQL(ADDUSERGROUP);
+ }
- static public int deleteManagerGroups(ILSSession session, int groupTypeID,
- int userID) {
- Group query = new Group();
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- query.setValue("USERPRID", new Integer(userID));
- query.setGroupTypeID(groupTypeID);
- return query.executeSQL(DELETEMANAGERGROUPS);
- }
+ static public Vector getManagerGroups(ILSSession session, int groupTypeID, int userID) {
+ Group query = new Group();
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ query.setValue("USERPRID", new Integer(userID));
+ query.setGroupTypeID(groupTypeID);
+ return query.getDataSet(LOOKUPMANAGERGROUPS);
+ }
- static public int addManagerGroup(ILSSession session, int groupID, int userID) {
- Group query = new Group();
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- query.setValue("USERPRID", new Integer(userID));
- query.setGroupID(groupID);
- return query.executeSQL(ADDMANAGERGROUP);
- }
+ static public int deleteManagerGroups(ILSSession session, int groupTypeID, int userID) {
+ Group query = new Group();
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ query.setValue("USERPRID", new Integer(userID));
+ query.setGroupTypeID(groupTypeID);
+ return query.executeSQL(DELETEMANAGERGROUPS);
+ }
- static public int deleteManagerGroup(ILSSession session, int groupID, int userID) {
- Group query = new Group();
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- query.setValue("USERPRID", new Integer(userID));
- query.setGroupID(groupID);
- return query.executeSQL(DELETEMANAGERGROUP);
- }
+ static public int addManagerGroup(ILSSession session, int groupID, int userID) {
+ Group query = new Group();
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ query.setValue("USERPRID", new Integer(userID));
+ query.setGroupID(groupID);
+ return query.executeSQL(ADDMANAGERGROUP);
+ }
- static public int deleteGroupCourses(ILSSession session, int groupID) {
- Group query = new Group();
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- query.setValue("ILSGROUPID", new Integer(groupID));
- return query.executeSQL(DELETEGROUPCOURSES);
- }
+ static public int deleteManagerGroup(ILSSession session, int groupID, int userID) {
+ Group query = new Group();
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ query.setValue("USERPRID", new Integer(userID));
+ query.setGroupID(groupID);
+ return query.executeSQL(DELETEMANAGERGROUP);
+ }
- static public int deleteCourseGroups(ILSSession session, int groupTypeID,
- int courseID) {
- Group query = new Group();
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- query.setValue("COURSID", new Integer(courseID));
- query.setGroupTypeID(groupTypeID);
- return query.executeSQL(DELETECOURSEGROUPS);
- }
+ static public int deleteGroupCourses(ILSSession session, int groupID) {
+ Group query = new Group();
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ query.setValue("ILSGROUPID", new Integer(groupID));
+ return query.executeSQL(DELETEGROUPCOURSES);
+ }
- static public int addCourseGroup(ILSSession session, int groupID,
- int courseID) {
- Group query = new Group();
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- query.setValue("COURSID", new Integer(courseID));
- query.setGroupID(groupID);
- return query.executeSQL(ADDCOURSEGROUP);
- }
+ static public int deleteCourseGroups(ILSSession session, int groupTypeID, int courseID) {
+ Group query = new Group();
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ query.setValue("COURSID", new Integer(courseID));
+ query.setGroupTypeID(groupTypeID);
+ return query.executeSQL(DELETECOURSEGROUPS);
+ }
- static public Vector getCourseGroups(ILSSession session, int courseID) {
- Group query = new Group();
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- query.setValue("COURSID", new Integer(courseID));
- return query.getDataSet(LOOKUPCOURSEGROUPS);
- }
+ static public int addCourseGroup(ILSSession session, int groupID, int courseID) {
+ Group query = new Group();
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ query.setValue("COURSID", new Integer(courseID));
+ query.setGroupID(groupID);
+ return query.executeSQL(ADDCOURSEGROUP);
+ }
- static public Vector getAllGroups(ILSSession session, int groupTypeID) {
- Group query = new Group();
- query.setValue("COMPANYID", new Integer(session.getCompanyID()));
- query.setGroupTypeID(groupTypeID);
- return query.getDataSet(LOOKUPALLGROUPS);
- }
+ static public Vector getCourseGroups(ILSSession session, int courseID) {
+ Group query = new Group();
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ query.setValue("COURSID", new Integer(courseID));
+ return query.getDataSet(LOOKUPCOURSEGROUPS);
+ }
- public int save(Group orig) {
- String[] keyCols = new String[] {"COMPANYID", "ILSGROUPID"};
- return save(orig, "ILSGROUP", keyCols);
- }
+ static public Vector getAllGroups(ILSSession session, int groupTypeID) {
+ Group query = new Group();
+ query.setCompanyID(new Integer(session.getCompanyID()));
+ query.setGroupTypeID(groupTypeID);
+ return query.getDataSet(LOOKUPALLGROUPS);
+ }
- public Group saveNew(ILSSession session) {
- setValue("COMPANYID", new Integer(session.getCompanyID()));
- saveNew("ILSGROUP");
- return (Group) lookupThis("ILSGROUP");
- }
+ public int save(Group orig) {
+ String[] keyCols = new String[] {"COMPANYID", "ILSGROUPID"};
+ return save(orig, "ILSGROUP", keyCols);
+ }
- public Group() {
- }
+ public Group saveNew(ILSSession session) {
+ setCompanyID(new Integer(session.getCompanyID()));
+ saveNew("ILSGROUP");
+ return (Group) lookupThis("ILSGROUP");
+ }
+ public Group() {
+ }
+
@Deprecated
public String getGroupDesc() {
return getGroupDescription();
@@ -229,44 +234,44 @@
setValue("GROUPDESC", val);
}
- public int getGroupTypeID() {
- return getIntValue("GROUPTYPEID");
- }
+ public int getGroupTypeID() {
+ return getIntValue("GROUPTYPEID");
+ }
- public void setGroupTypeID(int id) {
- setIntValue("GROUPTYPEID", id);
- }
+ public void setGroupTypeID(int id) {
+ setIntValue("GROUPTYPEID", id);
+ }
- public int getGroupID() {
- return getIntValue("ILSGROUPID");
- }
+ public int getGroupID() {
+ return getIntValue("ILSGROUPID");
+ }
- public void setGroupID(int id) {
- setIntValue("ILSGROUPID", id);
- }
+ public void setGroupID(int id) {
+ setIntValue("ILSGROUPID", id);
+ }
- public String getGroupName() {
- return getStringValue("GROUPNAME");
- }
+ public String getGroupName() {
+ return getStringValue("GROUPNAME");
+ }
- public void setGroupName(String val) {
- setValue("GROUPNAME", val);
- }
-
- @Override
+ public void setGroupName(String val) {
+ setValue("GROUPNAME", val);
+ }
+
+ @Override
public int hashCode() {
return this.getGroupID();
}
- @Override
+ @Override
public boolean equals(Object obj) {
- return (obj instanceof Group) ? (((Group)obj).getGroupID() == this.getGroupID()) : super.equals(obj);
+ return (obj instanceof Group) ? (((Group)obj).getGroupID() == this.getGroupID()) : super.equals(obj);
}
public void defaultAll() {
- setGroupName("");
- setGroupDesc("");
- setGroupTypeID(1);
- }
+ setGroupName("");
+ setGroupDesc("");
+ setGroupTypeID(1);
+ }
public String toXML() {
return toXML(DETAIL_COMPLETE);
}
Modified: branches/1.6/styles/Default_Horizontal/help/admin_userprofile.jsp
===================================================================
--- branches/1.6/styles/Default_Horizontal/help/admin_userprofile.jsp 2016-07-13 10:57:10 UTC (rev 1484)
+++ branches/1.6/styles/Default_Horizontal/help/admin_userprofile.jsp 2016-07-13 11:36:13 UTC (rev 1485)
@@ -1,3 +1,4 @@
+<%@ page import="com.resolutions.ils.Utils" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
@@ -10,78 +11,97 @@
<table width="600" border="0" cellpadding="0">
<tr>
<td valign="top" scope="col"><h1><strong>User Profile Management</strong></h1>
- <p>The User Profile management page allows you to search user profiles, view your personal Profile, Add new User Profiles, or Edit existing profiles. </p>
- <p><img src="images/user_profile_management.jpg" alt="User Profile Management" width="546" height="325" /><br />
+ <p>The User Profile Management page allows you to Search, Add, and Edit existing user profiles. </p>
+ <p><img src="images/user_profile_management.jpg" alt="User Profile Management" width="600" height="275" /><br />
</p>
<h2>Search</h2>
- <p>Search all profiles by clicking <img src="images/search2.jpg" alt="Search" width="98" height="14" /><strong>Search</strong></p>
+ <p>Search all profiles by clicking <img src="images/search_btn.jpg" alt="Search" width="98" height="14" /></p>
<p>The following fields are available to filter your search:</p>
<ul>
- <li>Workgroup</li>
- <li>Role</li>
- <li>Access Level (Administrator, Manager, or User)</li>
- <li>Employee Last Name</li>
- <li>Employee ID</li>
- <li>Status (Active or Inactive)</li>
- <li>Hire Date</li>
+ <li><strong>Workgroup(s)</strong> - Select the Workgroups you wish to filter by. To view all, leave field blank.</li>
+ <li><strong>Role(s)</strong> - Select the Roles you wish to filter by. To view all, leave field blank.</li>
+ <li><strong>Access Level</strong> – By Administrator, Manager, or User</li>
+ <li><strong>Employee (Last Name)</strong></li>
+ <li><strong>Employee ID</strong></li>
+ <li><strong>Status</strong> – Active or Inactive</li>
+ <li><strong>Hire Date</strong> – Date range for which the Hire Date field is filled</li>
</ul>
- <p>By selecting any or all of these fields, you will be able to filter your search. Selecting more than one parameter will narrow your search. Once the Search results are returned, they will be listed in the <strong>Search Results</strong> table at the bottom of the page. </p>
- <p><img src="images/user_profiles_search_results.jpg" alt="Search Results" width="590" height="282" /></p>
- <p>Click on any of the table headers to sort these results. The table headers are Last (Name), First (Name), Workgroup and Role. </p>
- <p>To review or edit a specific users’ profile, click on the checkbox next to their Last Name. From the pull-down menu, select “Edit”, then click <strong>Perform Action</strong>.</p>
- <p><img src="images/edit.jpg" alt="Edit" width="266" height="32" /></p>
- <h2>My Profile </h2>
- <p>Your <strong>User Profile</strong> contains all of the information about you in the system. You can change your password by typing in a new password in the <strong>Password</strong> and <strong>Confirm Password</strong> fields and click on <strong>Save</strong> at the bottom of the screen. You cannot change any of the grayed back information contained in the remaining fields. Contact the system administrator if the system contains information about you that is incorrect.</p>
- <p><img src="images/admin_profile.jpg" width="601" height="485" /></p>
- <h2>Add New Profile </h2>
- <p>Add a new user profile by clicking <img src="images/add_new_profile.jpg" alt="Add New Profile" width="98" height="14" /></p>
+ <p>Selecting more than one parameter will narrow your search in more detail. Once the Search is returned the <strong>Search Results</strong> will be displayed in a table at the bottom of the page.</p>
+ <p><img src="images/user_profiles_search_results.jpg" alt="Search Results" width="600" height="220" /></p>
+ <p>The column headings are: Last, First, Employee ID, Workgroup, and Role. Click on the column headings to sort the results alphabetically.</p>
+ <p>To review or edit a specific users’ profile, click on the checkbox next to their Last Name. From the pull-down menu, select “Edit”, then click <strong>Perform Action</strong>.</p>
+ <p><img src="images/edit.jpg" alt="Edit" width="245" height="25" /></p>
+ <h2>My Profile</h2>
+ <p>You may edit your user profile directly by clicking <img src="images/my_profile_btn.jpg" alt="Add New Profile" width="98" height="14" /></p>
+ <h2>Add New Profile</h2>
+ <p>Add a new user profile by clicking <img src="images/add_new_profile_btn.jpg" alt="Add New Profile" width="98" height="14" /></p>
+ <p>An empty Profile For window will open.</p>
+ <p><img src="images/admin_profile.jpg" width="600" height="550" /></p>
<p>When adding a new User Profile, the following fields are available:</p>
<ul>
- <li>Employee ID (Required) – Must be a unique alpha/numeric entry.</li>
- <li>Password (Required) – The default password is “changeme”</li>
- <li>Hire Date</li>
- <li>Termination Date</li>
- <li>Status – Active or Inactive</li>
- <li>Access Security Level (Required)</li>
- <li>Override IP Address Restriction</li>
- <li>Role (Required)</li>
- <li>Workgroup (Required)</li>
- <li>First Name (Required)</li>
- <li>Last Name (Required)</li>
- <li>Address 1</li>
- <li>Address 2</li>
- <li>City/Province</li>
- <li>State</li>
- <li>Zip</li>
- <li>Country</li>
- <li>Email</li>
- <li>Phone</li>
+ <li><strong>Employee ID </strong><font color="red";>(Required)</font> – Must be a unique alpha / numeric value</li>
+ <li><strong>Password </strong><font color="red";>(Required)</font> – The default password is “<%=Utils.getSysConfig(session).getProperty("DefaultPasswd", "changeme")%>”</li>
+ <li><strong>Confirm Password </strong><font color="red";>(Required)</font> – The default password is “<%=Utils.getSysConfig(session).getProperty("DefaultPasswd", "changeme")%>”</li>
+ <li><strong>Hire Date</strong> – Date in which the employee was hired</li>
+ <li><strong>Termination Date</strong> – Date in which the employee was terminated</li>
+ <li><strong>Status</strong> – Active or Inactive. Defaults to Active</li>
+ <li><strong>Access Security Level </strong><font color="red";>(Required)</font> – User, Manager, Administrator. Defaults to User</li>
+ <li><strong>Override ID Check At Login</strong> – When active, this profile will ignore the ID Check at Login</li>
+ <li><strong>Override IP Address Restriction</strong> – When active, this profile will ignore all Course IP Restriction settings</li>
+ <li><strong>Role(s) </strong><font color="red";>(Required)</font> - Every user profile must occupy at least one Role.</li>
+ <li><strong>Workgroup(s) </strong><font color="red";>(Required)</font> - Every user profile must occupy at least one Workgroup.</li>
+ <li><strong>First Name </strong><font color="red";>(Required)</font></li>
+ <li><strong>Middle Name</strong></li>
+ <li><strong>Last Name </strong><font color="red";>(Required)</font></li>
+ <li><strong>Suffix</strong></li>
+ <li><strong>Address 1</strong></li>
+ <li><strong>Address 2</strong></li>
+ <li><strong>City/Province</strong></li>
+ <li><strong>State</strong></li>
+ <li><strong>Zip</strong></li>
+ <li><strong>Country</strong></li>
+ <li><strong>Email</strong> – Email is required if automatic notifications are desired for this user</li>
+ <li><strong>Phone</strong></li>
</ul>
- <p><br />
- Once you have filled in the applicable fields, click <img src="images/save_but.jpg" alt="Save" width="63" height="14" /> </p>
- <p>If the new user profile has an <strong>Access Security Level</strong> of a “Manager”, then 2 additional panels will appear:</p>
+ <p>Once you have filled in the applicable fields, click <img src="images/save_btn.jpg" alt="Save" width="63" height="14" /> </p>
+ <p>If the new user profile has an <strong>Access Security Level</strong> of a “Manager”, then two additional panels will appear:</p>
<ul>
- <li>Manager Privileges</li>
- <li>Workgroups Managed </li>
+ <li>Manager Privileges</li>
+ <li>Workgroups Managed </li>
</ul>
<h2>Manager Privileges</h2>
- <p>The Manager Privileges panel allows Administrators to provide a manager access to selected administrative menu options.</p>
- <p><img src="images/manager_privileges.jpg" alt="Manager Privileges" width="590" height="244" /></p>
- <p>Select the <strong>Menu Items Authorized</strong> for the Manager by clicking on the checkboxes beside the menu item names. Then, click <img src="images/save2.jpg" alt="Save" width="66" height="26" /></p>
+ <p>The Manager Privileges panel allows you to customize a manager's profile permissions to selected administrative menu options.</p>
+ <p><img src="images/manager_privileges.jpg" alt="Manager Privileges" width="600" height="220" /></p>
+ <p>Select the <strong>Menu Items Authorized</strong> for the Manager by clicking on the checkboxes beside the menu item names. </p>
+ <p>Then, click <img src="images/save_btn2.jpg" alt="Save" width="63" height="25" />. The following permissions are availible:</p>
+ <ul>
+ <li><strong>Course Management</strong> - Enable access to Course Management</li>
+ <li><strong>Workgroup Management</strong> - Enable access to Workgroup Management</li>
+ <li><strong>Role Management</strong> - Enable access to Role Management</li>
+ <li><strong>Student Records</strong> - Enable access to Student Records & Summary Reports</li>
+ <ul><li><strong>Allow Manual Override - Course Completion</strong> - Enable manager to use the "Force Pass" button in Student Records</li></ul>
+ <li><strong>User Profile Management</strong> - Enable Access to User Profile Management</li>
+ <ul><li><strong>Search / View Profiles</strong> - Enable permissions to search and view profiles in User Profile Management</li>
+ <li><strong>Add New User</strong> - Enable permissionsto add new user profiles</li>
+ <li><strong>Add New Managers</strong> - Enable permissions to add new manager profiles</li>
+ <li><strong>Modify Exsisting Users</strong> - Enable permissions to modify exsisting user profiles</li></ul>
+ <li><strong>System Management</strong> - Enable access to System Management</li>
+ <li><strong>Utilities</strong> - Enable access to Utilities</li>
+ </ul>
<h2>Manager Privileges Presets</h2>
- <p>You can create and save your own Presets for Manager Privileges.</p>
- <p><img src="images/manage_presets.jpg" alt="Manage Presets" width="322" height="35" /><br />
- Click the<strong> Manage Presets</strong> button to create new presets or to modify or delete existing presets. </p>
- <p><img src="images/security_preset_management.jpg" alt="Security Presets" width="590" height="437" /></p>
+ <p>You can create and save your own custom Presets for Manager Privileges. Saved Manager Presets will appear in the [ Preset Permissions ] drop down.</p>
+ <p><img src="images/manage_presets.jpg" alt="Manage Presets" width="289" height="23" />
+ <p>Click the<strong> Manage Presets</strong> button to create new presets or to modify or delete existing presets.</p>
+ <p><img src="images/security_preset_management.jpg" alt="Security Presets" width="600" height="375" /></p>
<h2>To create a new Preset</h2>
- <p>Fill in the <strong>Preset Name</strong> field and select the <strong>Menu Items Authorized</strong> for the Preset by clicking on the checkboxes beside the menu item names. Then, click <img src="images/saveasnew.jpg" alt="Save as New" width="112" height="23" /></p>
- <h2>To delete a Preset<strong> </strong></h2>
- <p>Select a preset from the <strong>Existing Presets</strong> panel, and then click <img src="images/preset_delete.jpg" alt="Delete" width="74" height="24" /></p>
+ <p>Fill in the <strong>Preset Name</strong> field and select the <strong>Menu Items Authorized</strong> for the Preset by clicking on the checkboxes beside the menu item names. Then, click <img src="images/saveasnew_btn.jpg" alt="Save as New" width="99" height="22" /></p>
+ <h2>To delete a Preset</h2>
+<p>Check the box next to a preset from the <strong>Existing Presets</strong> panel, and then click <img src="images/preset_delete_btn.jpg" alt="Delete" width="71" height="25" /></p>
<h2>Workgroups Managed</h2>
- <p>Workgroups can be assigned to managers by clicking on the appropriate checkbox next to the Workgroup Name. Managers will only be able to view users in the workgroups assigned to them. For example, when searching student records, the manager will only be able to view users in workgroups assigned to them in this panel. </p>
- <p><img src="images/workgroups_managed.jpg" alt="Workgroups Managed" width="590" height="168" /></p></td>
+ <p>Managers will only be able to view users in the workgroups they manage. Workgroups can be assigned to a manager by clicking on the checkbox next to the Workgroup Name. For example, when viewing Student Records, the manager will only be able to view users in workgroups they manage, assigned via this panel. </p>
+ <p><img src="images/workgroups_managed.jpg" alt="Workgroups Managed" width="600" height="150" /></p></td>
</tr>
</table>
-<p> Then click <img src="images/save2.jpg" alt="Save" width="66" height="26" />in the Workgroups Managed box. </p>
+<p>Select the workgroups you wish the manager to manage then click <img src="images/save_btn2.jpg" alt="Save" width="63" height="25" /> in the Workgroups Managed box.</p>
</body>
</html>
Modified: branches/1.6/webapp/WEB-INF/classes/versions.properties
===================================================================
--- branches/1.6/webapp/WEB-INF/classes/versions.properties 2016-07-13 10:57:10 UTC (rev 1484)
+++ branches/1.6/webapp/WEB-INF/classes/versions.properties 2016-07-13 11:36:13 UTC (rev 1485)
@@ -1 +1 @@
-LMS=V1.80.6
+LMS=V1.80.7
Copied: branches/1.6/webapp/WEB-INF/lib/batik-all-1.7.jar (from rev 1478, trunk/webapp/WEB-INF/lib/batik-all-1.7.jar)
===================================================================
(Binary files differ)
Modified: branches/1.6/webapp/WEB-INF/lib/crosswire.jar
===================================================================
(Binary files differ)
Copied: branches/1.6/webapp/WEB-INF/lib/cssbox-4.10.jar (from rev 1475, trunk/webapp/WEB-INF/lib/cssbox-4.10.jar)
===================================================================
(Binary files differ)
Copied: branches/1.6/webapp/WEB-INF/lib/fop.jar (from rev 1477, trunk/webapp/WEB-INF/lib/fop.jar)
===================================================================
(Binary files differ)
Modified: branches/1.6/webapp/WEB-INF/lib/ils.jar
===================================================================
(Binary files differ)
Copied: branches/1.6/webapp/WEB-INF/lib/jstyleparser-1.21.jar (from rev 1476, trunk/webapp/WEB-INF/lib/jstyleparser-1.21.jar)
===================================================================
(Binary files differ)
Modified: branches/1.6/webapp/api/ccure/user/put/index.jsp
===================================================================
--- branches/1.6/webapp/api/ccure/user/put/index.jsp 2016-07-13 10:57:10 UTC (rev 1484)
+++ branches/1.6/webapp/api/ccure/user/put/index.jsp 2016-07-13 11:36:13 UTC (rev 1485)
@@ -12,11 +12,17 @@
<%@ page import="org.crosswire.xml.XMLBlock" %>
<%
+
+ // standard service header ---------------------------------------
+
+ String serviceName = "CCURE user/put";
+
Logger logger = Logger.getLogger(this.getClass());
Logger eventsLogger = Logger.getLogger("EVENTS");
+
+ response.setContentType("text/xml");
+
String errMsg = "";
- // standard service header ---------------------------------------
- response.setContentType("text/xml");
int errCode = 0;
Company company = Company.getCompany(request);
@@ -25,7 +31,7 @@
if (!apiEnabled) {
errMsg = "API not enabled in system management settings.";
out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
- eventsLogger.error("CCURE user/put:" + errMsg);
+ eventsLogger.error(serviceName +": " + errMsg);
return;
}
@@ -38,7 +44,7 @@
if (ilsSession == null) {
errMsg = "iLS sign in information is not valid.";
out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
- eventsLogger.error("CCURE user/put:" + errMsg);
+ eventsLogger.error(serviceName +": " + errMsg);
return;
}
// end standard service header -----------------------------------
Modified: branches/1.6/webapp/api/courseattempt/get/index.jsp
===================================================================
--- branches/1.6/webapp/api/courseattempt/get/index.jsp 2016-07-13 10:57:10 UTC (rev 1484)
+++ branches/1.6/webapp/api/courseattempt/get/index.jsp 2016-07-13 11:36:13 UTC (rev 1485)
@@ -3,63 +3,83 @@
contentType="text/html;charset=utf-8"
%>
<%@ page trimDirectiveWhitespaces="true" %>
-<%@ page import="org.crosswire.utils.HTTPUtils" %>
<%@ page import="com.resolutions.ils.Utils" %>
<%@ page import="com.resolutions.ils.ILSSession" %>
-<%@ page import="com.resolutions.ils.data.UserProfile" %>
<%@ page import="com.resolutions.ils.data.Company" %>
<%@ page import="com.resolutions.ils.data.CourseAttempt" %>
<%@ page import="java.util.Vector" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.TimeZone" %>
-<%@ page import="java.io.File" %>
-<%@ page import="java.net.URL" %>
-<%@ page import="java.util.Properties" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="org.apache.log4j.Logger" %>
<%
// standard service header ---------------------------------------
+ String serviceName = "courseattempt/get";
+
+ Logger logger = Logger.getLogger(this.getClass());
+ Logger eventsLogger = Logger.getLogger("EVENTS");
+
response.setContentType("text/xml");
+
+ String errMsg = "";
int errCode = 0;
Company company = Company.getCompany(request);
boolean apiEnabled = "on".equals(Utils.getSysConfig(session.getServletContext(), company.getCompanyID()).getProperty("APIEnable", "off"));
++errCode;
if (!apiEnabled) {
- out.print("<error code=\""+errCode+"\" message=\"API not enabled in system management settings.\"/>");
+ errMsg = "API not enabled in system management settings.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
return;
}
String userID = request.getParameter("ILSUSER");
- String userPw = request.getParameter("ILSPASSWD");
- ILSSession ilsSession = (userID != null && userPw != null)
- ? ILSSession.login(company.getCompanyName(), userID, userPw)
+ String userPW = request.getParameter("ILSPASSWD");
+ ILSSession ilsSession = (userID != null && userPW != null)
+ ? ILSSession.login(company.getCompanyName(), userID, userPW)
: (ILSSession)session.getAttribute("ilsSession");
++errCode;
if (ilsSession == null) {
- out.print("<error code=\""+errCode+"\" message=\"Your iLS sign in information is not valid.\"/>");
+ errMsg = "iLS sign in information is not valid.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
return;
}
+
String detail = request.getParameter("detail");
int detailLevel = org.crosswire.data.DataObject.DETAIL_COMPLETE;
if ("headeronly".equals(detail)) detailLevel = org.crosswire.data.DataObject.DETAIL_HEADERONLY;
else if ("brief".equals(detail)) detailLevel = org.crosswire.data.DataObject.DETAIL_BRIEF;
// end standard service header -----------------------------------
-
- Logger logger = Logger.getLogger(this.getClass());
- Logger eventsLogger = Logger.getLogger("EVENTS");
+
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddhhmm");
df.setTimeZone(TimeZone.getTimeZone("GMT"));
SimpleDateFormat df_out = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
df_out.setTimeZone(TimeZone.getTimeZone("GMT"));
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) {};
+ ++errCode;
String val = request.getParameter("startDateTime");
- Date startDateTime = null; try { startDateTime = df.parse(val); } catch (Exception e) {}
+ Date startDateTime = null;
+ try { if (val != null) startDateTime = df.parse(val); } catch (Exception e) {
+ out.print("<error code=\""+errCode+"\" message=\"startDateTime must be formatted as yyyyMMddhhmm\"/>");
+ return;
+ }
+ ++errCode;
+ val = request.getParameter("endDateTime");
+ Date endDateTime = null;
+ try { if (val != null) endDateTime = df.parse(val); } catch (Exception e) {
+ out.print("<error code=\""+errCode+"\" message=\"endDateTime must be formatted as yyyyMMddhhmm\"/>");
+ return;
+ }
+
Vector<CourseAttempt> cas = null;
++errCode;
@@ -68,24 +88,22 @@
CourseAttempt ca = CourseAttempt.getCourseAttempt(ilsSession, courseAttemptID);
if (ca == null) {
- out.print("<error code=\""+errCode+"\" message=\"Course Attempt ID not found.\"/>");
+ out.print("<error code=\""+errCode+"\" message=\"Course Attempt ID: "+courseAttemptID+" not found.\"/>");
return;
}
cas.add(ca);
}
- if (startDateTime != null) {
- val = request.getParameter("endDateTime");
- Date endDateTime = null;
- try { if (val != null) endDateTime = df.parse(val); } catch (Exception e) {
- out.print("<error message=\"startDateTime must be passed and formatted as yyyyMMddhhmm\"/>");
- return;
- }
-
- cas = CourseAttempt.getCourseAttempts(ilsSession, startDateTime, endDateTime);
+ else if (startDateTime != null || endDateTime != null || courseID > -1 || userProfileID > -1) {
+ cas = CourseAttempt.getCourseAttempts(ilsSession, startDateTime, endDateTime, userProfileID, courseID);
}
if (cas != null) {
- out.print("<courseAttempts count=\""+cas.size()+"\""+(startDateTime != null ? (" startDateTime=\""+df_out.format(startDateTime)+"\""):"")+">\n");
+ out.print("<courseAttempts count=\""+cas.size()+"\""
+ + (startDateTime != null ? (" startDateTime=\""+df_out.format(startDateTime)+"\""):"")
+ + (endDateTime != null ? (" endDateTime=\""+df_out.format(endDateTime)+"\""):"")
+ + (courseID > -1 ? (" courseID=\""+courseID+"\""):"")
+ + (userProfileID > -1 ? (" userProfileID=\""+userProfileID+"\""):"")
+ +">\n");
for (Object o : cas) {
out.print(((CourseAttempt)o).toXML(detailLevel));
}
@@ -103,9 +121,10 @@
<table border="1">
<tbody>
<tr><th>courseAttemptID</th><td>retrieve a specific course attempt by ID</td></tr>
-<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, inclusive (yyyyMMddhhmm), e.g., 201201240000</td></tr>
-<tr><th>endDateTime</th><td>(optional) the end of the date and time range for which to retrieve Course Attempt records, exclusive (yyyyMMddhhmm), e.g., 201201250000</td></tr>
-<tr><th>profileID</th><td>(optional) restrict results to a single user</td></tr>
+<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>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>
<tr><th>ILSPASSWD</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
Deleted: branches/1.6/webapp/api/courseattempt/put/index.jsp
===================================================================
--- trunk/webapp/api/courseattempt/put/index.jsp 2016-06-27 23:25:42 UTC (rev 1472)
+++ branches/1.6/webapp/api/courseattempt/put/index.jsp 2016-07-13 11:36:13 UTC (rev 1485)
@@ -1,214 +0,0 @@
-<%@ page language="java" contentType="text/xml;charset=utf-8" %>
-<%@ page trimDirectiveWhitespaces="true" %>
-<%@ page import="com.resolutions.ils.Utils" %>
-<%@ page import="com.resolutions.ils.ILSSession" %>
-<%@ page import="com.resolutions.ils.data.UserProfile" %>
-<%@ page import="com.resolutions.ils.data.Company" %>
-<%@ page import="com.resolutions.ils.data.CourseAttempt" %>
-<%@ page import="java.util.Date" %>
-<%@ page import="java.text.SimpleDateFormat" %>
-<%@ page import="org.apache.log4j.Logger" %>
-
-<%
- // standard service header ---------------------------------------
-
- String serviceName = "courseattempt/put";
-
- Logger logger = Logger.getLogger(this.getClass());
- Logger eventsLogger = Logger.getLogger("EVENTS");
-
- response.setContentType("text/xml");
-
- String errMsg = "";
- int errCode = 0;
- Company company = Company.getCompany(request);
-
- boolean apiEnabled = "on".equals(Utils.getSysConfig(session.getServletContext(), company.getCompanyID()).getProperty("APIEnable", "off"));
- ++errCode;
- if (!apiEnabled) {
- errMsg = "API not enabled in system management settings.";
- out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
- eventsLogger.error(serviceName +": " + errMsg);
- return;
- }
-
- String userID = request.getParameter("ILSUSER");
- String userPW = request.getParameter("ILSPASSWD");
- ILSSession ilsSession = (userID != null && userPW != null)
- ? ILSSession.login(company.getCompanyName(), userID, userPW)
- : (ILSSession)session.getAttribute("ilsSession");
- ++errCode;
- if (ilsSession == null) {
- errMsg = "iLS sign in information is not valid.";
- out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
- eventsLogger.error(serviceName +": " + errMsg);
- return;
- }
- // end standard service header -----------------------------------
-
-
- 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) {}
-
-
-// one of these must be supplied; otherwise, show usage info
-if ( courseAttemptID != -1 || (courseID != -1 && userProfileID != -1) ) {
-
- UserProfile adminUser = ilsSession.getCurrentUserProfile();
-
- SimpleDateFormat df = new SimpleDateFormat("yyyyMMddhhmm");
- CourseAttempt current = new CourseAttempt();
- current.defaultAll();
- boolean createMode = "create".equals(request.getParameter("action"));
-
- ++errCode;
- if ((adminUser.getUserProfileAccessLevel() > UserProfile.ACCESS_MANAGER) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_SEARCH_VIEW))) {
- if (!createMode) {
- CourseAttempt lookup = null;
- if (courseAttemptID != -1) {
- lookup = CourseAttempt.getCourseAttempt(ilsSession, courseAttemptID);
- if (lookup == null) {
- out.print("<error code=\""+errCode+"\" message=\"Permission denied.\"/>");
- return;
- }
- }
-
- if (lookup != null) {
- current = lookup;
- }
- else {
- if (!"update".equals(request.getParameter("action"))) createMode = true;
- else current = null;
- }
- }
- }
- else {
- ++errCode;
- out.print("<error code=\""+errCode+"\" message=\"Permission denied.\"/>");
- return;
- }
-
- ++errCode;
- if (current == null) {
- out.print("<error code=\""+errCode+"\" message=\"Course attempt not found.\"/>");
- return;
- }
- ++errCode;
- if (createMode && current.getCourseAttemptID() > 0) {
- out.print("<error code=\""+errCode+"\" message=\"Course attempt exists.\"/>");
- return;
- }
- ++errCode;
- if (current.getCourseAttemptID() > 0 && adminUser.getUserProfileAccessLevel() <= UserProfile.ACCESS_MANAGER && !adminUser.hasAccess(UserProfile.ACCESS_MODE_MENU_STUDENT_RECORDS)) {
- out.print("<error code=\""+errCode+"\" message=\"Permission denied to edit course attempt.\"/>");
- return;
- }
-
- CourseAttempt orig = (CourseAttempt)current.clone();
-
-
- if (courseID != -1) current.setCourseAttemptCourseID(courseID);
- if (userProfileID != - 1) current.setCourseAttemptUserProfileID(userProfileID);
-
- String val = request.getParameter("score");
- if (val != null && val.trim().length() > 0) current.setCourseAttemptScore(Integer.parseInt(val));
- val = request.getParameter("statusID");
- if (val != null && val.trim().length() > 0) current.setCourseAttemptStatusID(Integer.parseInt(val));
- val = request.getParameter("stage");
- if (val != null && val.trim().length() > 0) current.setCourseAttemptStage(val);
- val = request.getParameter("managerApproved");
- if (val != null && val.trim().length() > 0) current.setCourseAttemptManagerApproved(Boolean.valueOf(val));
- val = request.getParameter("expire");
- if (val != null && val.trim().length() > 0) current.setCourseAttemptExpired(val);
- val = request.getParameter("callbackStatus");
- if (val != null && val.trim().length() > 0) current.setCourseAttemptCallbackStatus(val);
-
- if (current.getCourseAttemptID() > 0 && adminUser.getUserProfileAccessLevel() <= UserProfile.ACCESS_MANAGER && !adminUser.hasAccess(UserProfile.ACCESS_MODE_STUDENTREC_PASS_OVERRIDE)) {
- out.print("<error code=\""+errCode+"\" message=\"Permission denied to force pass course attempt.\"/>");
- return;
- } else {
- val = request.getParameter("forcePass");
- if (val != null && val.trim().length() > 0) current.setCourseAttemptForcePass(val);
- }
-
-
- ++errCode;
- val = request.getParameter("startDate");
- if (val != null) {
- Date startDate = null;
- try {
- startDate = df.parse(val);
- current.setCourseAttemptStartDate(startDate);
- } catch (Exception e) {
- out.print("<error code=\""+errCode+"\" message=\"startDate must be passed and formatted as yyyyMMddhhmm\"/>");
- return;
- }
- }
-
- ++errCode;
- val = request.getParameter("completeDate");
- if (val != null) {
- Date completeDate = null;
- try {
- completeDate = df.parse(val);
- current.setCourseAttemptCompleteDate(completeDate);
- } catch (Exception e) {
- out.print("<error code=\""+errCode+"\" message=\"completeDate must be passed and formatted as yyyyMMddhhmm\"/>");
- return;
- }
- }
-
- ++errCode;
- if (current.getCourseAttemptCourseID() <= 0) {
- out.print("<error code=\""+errCode+"\" message=\"You must supply a courseID\"/>");
- return;
- }
- ++errCode;
- if (current.getCourseAttemptUserProfileID() <= 0) {
- out.print("<error code=\""+errCode+"\" message=\"You must supply a userProfileID\"/>");
- return;
- }
-
- if (orig.getCourseAttemptID() > 0) {
- current.save(orig);
- }
- else {
- current = current.saveNew(ilsSession);
- }
-%>
-<success courseAttemptID="<%=current.getCourseAttemptID()%>"/>
-<%
- return;
-
-}
-response.setContentType("text/html");
-%>
-<html>
-<style>th { text-align:left; }</style>
-<body>
-<h1>courseattempt/put</h1>
-<p>Create or modify a course attempt record</p>
-<h3>Parameters</h3>
-<table border="1">
-<tbody>
-<tr><th>courseAttemptID</th><td>The record to modify.</td></tr>
-<tr><th>action</th><td>(optional) [update|create] If not supplied, action is determined by: <ul><li>if courseAttemptID is supplied, action is update.</li><li>otherwise, action is create.</li></ul></td></tr>
-<tr><th>courseID</th><td>Course ID (required if action is create)</td></tr>
-<tr><th>userProfileID</th><td>User Profile ID (required if action is create</td></tr>
-<tr><th>score</th><td>score</td></tr>
-<tr><th>statusID</th><td>Attempt status</td></tr>
-<tr><th>stage</th><td>Attempt stage</td></tr>
-<tr><th>startDate</th><td>Start date (yyyyMMddhhmm), e.g., 201201240000</td></tr>
-<tr><th>completeDate</th><td>Completion date (yyyyMMddhhmm), e.g., 201201250000</td></tr>
-<tr><th>managerApproved</th><td>Manager approved (boolean) e.g., true</td></tr>
-<tr><th>expire</th>The reason the attempt is expired, the expriation date will be the current system time<td></td></tr>
-<tr><th>forcePass</th><td>The reason the attempt is passed, the force pass date will be the current system time</td></tr>
-<tr><th>callbackStatus</th><td>Callback status</td></tr>
-<tr><th>ILSUSER</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
-<tr><th>ILSPASSWD</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
-</tbody>
-</table>
-</body>
-</html>
-
Copied: branches/1.6/webapp/api/courseattempt/put/index.jsp (from rev 1472, trunk/webapp/api/courseattempt/put/index.jsp)
===================================================================
--- branches/1.6/webapp/api/courseattempt/put/index.jsp (rev 0)
+++ branches/1.6/webapp/api/courseattempt/put/index.jsp 2016-07-13 11:36:13 UTC (rev 1485)
@@ -0,0 +1,214 @@
+<%@ page language="java" contentType="text/xml;charset=utf-8" %>
+<%@ page trimDirectiveWhitespaces="true" %>
+<%@ page import="com.resolutions.ils.Utils" %>
+<%@ page import="com.resolutions.ils.ILSSession" %>
+<%@ page import="com.resolutions.ils.data.UserProfile" %>
+<%@ page import="com.resolutions.ils.data.Company" %>
+<%@ page import="com.resolutions.ils.data.CourseAttempt" %>
+<%@ page import="java.util.Date" %>
+<%@ page import="java.text.SimpleDateFormat" %>
+<%@ page import="org.apache.log4j.Logger" %>
+
+<%
+ // standard service header ---------------------------------------
+
+ String serviceName = "courseattempt/put";
+
+ Logger logger = Logger.getLogger(this.getClass());
+ Logger eventsLogger = Logger.getLogger("EVENTS");
+
+ response.setContentType("text/xml");
+
+ String errMsg = "";
+ int errCode = 0;
+ Company company = Company.getCompany(request);
+
+ boolean apiEnabled = "on".equals(Utils.getSysConfig(session.getServletContext(), company.getCompanyID()).getProperty("APIEnable", "off"));
+ ++errCode;
+ if (!apiEnabled) {
+ errMsg = "API not enabled in system management settings.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
+ return;
+ }
+
+ String userID = request.getParameter("ILSUSER");
+ String userPW = request.getParameter("ILSPASSWD");
+ ILSSession ilsSession = (userID != null && userPW != null)
+ ? ILSSession.login(company.getCompanyName(), userID, userPW)
+ : (ILSSession)session.getAttribute("ilsSession");
+ ++errCode;
+ if (ilsSession == null) {
+ errMsg = "iLS sign in information is not valid.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
+ return;
+ }
+ // end standard service header -----------------------------------
+
+
+ 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) {}
+
+
+// one of these must be supplied; otherwise, show usage info
+if ( courseAttemptID != -1 || (courseID != -1 && userProfileID != -1) ) {
+
+ UserProfile adminUser = ilsSession.getCurrentUserProfile();
+
+ SimpleDateFormat df = new SimpleDateFormat("yyyyMMddhhmm");
+ CourseAttempt current = new CourseAttempt();
+ current.defaultAll();
+ boolean createMode = "create".equals(request.getParameter("action"));
+
+ ++errCode;
+ if ((adminUser.getUserProfileAccessLevel() > UserProfile.ACCESS_MANAGER) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_SEARCH_VIEW))) {
+ if (!createMode) {
+ CourseAttempt lookup = null;
+ if (courseAttemptID != -1) {
+ lookup = CourseAttempt.getCourseAttempt(ilsSession, courseAttemptID);
+ if (lookup == null) {
+ out.print("<error code=\""+errCode+"\" message=\"Permission denied.\"/>");
+ return;
+ }
+ }
+
+ if (lookup != null) {
+ current = lookup;
+ }
+ else {
+ if (!"update".equals(request.getParameter("action"))) createMode = true;
+ else current = null;
+ }
+ }
+ }
+ else {
+ ++errCode;
+ out.print("<error code=\""+errCode+"\" message=\"Permission denied.\"/>");
+ return;
+ }
+
+ ++errCode;
+ if (current == null) {
+ out.print("<error code=\""+errCode+"\" message=\"Course attempt not found.\"/>");
+ return;
+ }
+ ++errCode;
+ if (createMode && current.getCourseAttemptID() > 0) {
+ out.print("<error code=\""+errCode+"\" message=\"Course attempt exists.\"/>");
+ return;
+ }
+ ++errCode;
+ if (current.getCourseAttemptID() > 0 && adminUser.getUserProfileAccessLevel() <= UserProfile.ACCESS_MANAGER && !adminUser.hasAccess(UserProfile.ACCESS_MODE_MENU_STUDENT_RECORDS)) {
+ out.print("<error code=\""+errCode+"\" message=\"Permission denied to edit course attempt.\"/>");
+ return;
+ }
+
+ CourseAttempt orig = (CourseAttempt)current.clone();
+
+
+ if (courseID != -1) current.setCourseAttemptCourseID(courseID);
+ if (userProfileID != - 1) current.setCourseAttemptUserProfileID(userProfileID);
+
+ String val = request.getParameter("score");
+ if (val != null && val.trim().length() > 0) current.setCourseAttemptScore(Integer.parseInt(val));
+ val = request.getParameter("statusID");
+ if (val != null && val.trim().length() > 0) current.setCourseAttemptStatusID(Integer.parseInt(val));
+ val = request.getParameter("stage");
+ if (val != null && val.trim().length() > 0) current.setCourseAttemptStage(val);
+ val = request.getParameter("managerApproved");
+ if (val != null && val.trim().length() > 0) current.setCourseAttemptManagerApproved(Boolean.valueOf(val));
+ val = request.getParameter("expire");
+ if (val != null && val.trim().length() > 0) current.setCourseAttemptExpired(val);
+ val = request.getParameter("callbackStatus");
+ if (val != null && val.trim().length() > 0) current.setCourseAttemptCallbackStatus(val);
+
+ if (current.getCourseAttemptID() > 0 && adminUser.getUserProfileAccessLevel() <= UserProfile.ACCESS_MANAGER && !adminUser.hasAccess(UserProfile.ACCESS_MODE_STUDENTREC_PASS_OVERRIDE)) {
+ out.print("<error code=\""+errCode+"\" message=\"Permission denied to force pass course attempt.\"/>");
+ return;
+ } else {
+ val = request.getParameter("forcePass");
+ if (val != null && val.trim().length() > 0) current.setCourseAttemptForcePass(val);
+ }
+
+
+ ++errCode;
+ val = request.getParameter("startDate");
+ if (val != null) {
+ Date startDate = null;
+ try {
+ startDate = df.parse(val);
+ current.setCourseAttemptStartDate(startDate);
+ } catch (Exception e) {
+ out.print("<error code=\""+errCode+"\" message=\"startDate must be passed and formatted as yyyyMMddhhmm\"/>");
+ return;
+ }
+ }
+
+ ++errCode;
+ val = request.getParameter("completeDate");
+ if (val != null) {
+ Date completeDate = null;
+ try {
+ completeDate = df.parse(val);
+ current.setCourseAttemptCompleteDate(completeDate);
+ } catch (Exception e) {
+ out.print("<error code=\""+errCode+"\" message=\"completeDate must be passed and formatted as yyyyMMddhhmm\"/>");
+ return;
+ }
+ }
+
+ ++errCode;
+ if (current.getCourseAttemptCourseID() <= 0) {
+ out.print("<error code=\""+errCode+"\" message=\"You must supply a courseID\"/>");
+ return;
+ }
+ ++errCode;
+ if (current.getCourseAttemptUserProfileID() <= 0) {
+ out.print("<error code=\""+errCode+"\" message=\"You must supply a userProfileID\"/>");
+ return;
+ }
+
+ if (orig.getCourseAttemptID() > 0) {
+ current.save(orig);
+ }
+ else {
+ current = current.saveNew(ilsSession);
+ }
+%>
+<success courseAttemptID="<%=current.getCourseAttemptID()%>"/>
+<%
+ return;
+
+}
+response.setContentType("text/html");
+%>
+<html>
+<style>th { text-align:left; }</style>
+<body>
+<h1>courseattempt/put</h1>
+<p>Create or modify a course attempt record</p>
+<h3>Parameters</h3>
+<table border="1">
+<tbody>
+<tr><th>courseAttemptID</th><td>The record to modify.</td></tr>
+<tr><th>action</th><td>(optional) [update|create] If not supplied, action is determined by: <ul><li>if courseAttemptID is supplied, action is update.</li><li>otherwise, action is create.</li></ul></td></tr>
+<tr><th>courseID</th><td>Course ID (required if action is create)</td></tr>
+<tr><th>userProfileID</th><td>User Profile ID (required if action is create</td></tr>
+<tr><th>score</th><td>score</td></tr>
+<tr><th>statusID</th><td>Attempt status</td></tr>
+<tr><th>stage</th><td>Attempt stage</td></tr>
+<tr><th>startDate</th><td>Start date (yyyyMMddhhmm), e.g., 201201240000</td></tr>
+<tr><th>completeDate</th><td>Completion date (yyyyMMddhhmm), e.g., 201201250000</td></tr>
+<tr><th>managerApproved</th><td>Manager approved (boolean) e.g., true</td></tr>
+<tr><th>expire</th>The reason the attempt is expired, the expriation date will be the current system time<td></td></tr>
+<tr><th>forcePass</th><td>The reason the attempt is passed, the force pass date will be the current system time</td></tr>
+<tr><th>callbackStatus</th><td>Callback status</td></tr>
+<tr><th>ILSUSER</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
+<tr><th>ILSPASSWD</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
+</tbody>
+</table>
+</body>
+</html>
+
Modified: branches/1.6/webapp/api/group/addmanager/index.jsp
===================================================================
--- branches/1.6/webapp/api/group/addmanager/index.jsp 2016-07-13 10:57:10 UTC (rev 1484)
+++ branches/1.6/webapp/api/group/addmanager/index.jsp 2016-07-13 11:36:13 UTC (rev 1485)
@@ -9,27 +9,40 @@
<%
// standard service header ---------------------------------------
+
+ String serviceName = "group/addmanager";
+
+ Logger logger = Logger.getLogger(this.getClass());
+ Logger eventsLogger = Logger.getLogger("EVENTS");
+
response.setContentType("text/xml");
+
+ String errMsg = "";
int errCode = 0;
Company company = Company.getCompany(request);
boolean apiEnabled = "on".equals(Utils.getSysConfig(session.getServletContext(), company.getCompanyID()).getProperty("APIEnable", "off"));
++errCode;
if (!apiEnabled) {
- out.print("<error code=\""+errCode+"\" message=\"API not enabled in system management settings.\"/>");
+ errMsg = "API not enabled in system management settings.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
return;
}
String userID = request.getParameter("ILSUSER");
- String userPw = request.getParameter("ILSPASSWD");
- ILSSession ilsSession = (userID != null && userPw != null)
- ? ILSSession.login(company.getCompanyName(), userID, userPw)
+ String userPW = request.getParameter("ILSPASSWD");
+ ILSSession ilsSession = (userID != null && userPW != null)
+ ? ILSSession.login(company.getCompanyName(), userID, userPW)
: (ILSSession)session.getAttribute("ilsSession");
++errCode;
if (ilsSession == null) {
- out.print("<error code=\""+errCode+"\" message=\"Your iLS sign in information is not valid.\"/>");
+ errMsg = "iLS sign in information is not valid.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
return;
}
+
// end standard service header -----------------------------------
@@ -44,13 +57,9 @@
// one of these must be supplied; otherwise, show usage info
if (groupTypeID != -1 && (groupID != -1 || groupName != null || userData != null)
&& (userProfileID != -1 || loginID != null || userProfileUserData != null)) {
- String errMsg = "";
UserProfile adminUser = ilsSession.getCurrentUserProfile();
- Logger logger = Logger.getLogger(this.getClass());
- Logger eventsLogger = Logger.getLogger("EVENTS");
-
Group current = null;
++errCode;
if ((adminUser.getUserProfileAccessLevel() > UserProfile.ACCESS_MANAGER) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_ADD_USER)) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_MODIFY_USER))) {
@@ -111,10 +120,10 @@
<h3>Parameters</h3>
<table border="1">
<tbody>
-<tr><th>groupID</th><td>The record to modify. Either this parameter, or userData can be supplied to update an existing record. This order of precedence is used. If more than one of these is supplied, the subsequent parameter is used as an update field for the record.</td></tr>
+<tr><th>groupID</th><td>Which group to update. Either this parameter, or userData can be supplied to specify the group.</td></tr>
<tr><th>userData</th><td>3rd-party supplied record identifier for group</td></tr>
-<tr><th>groupTypeID</th><td>Group Type ID. default groups {1 - ROLE; 2 - WORKGROUP}</td></tr>
-<tr><th>userProfileID</th><td>adds this user to the manager list for this group</td></tr>
+<tr><th>groupTypeID</th><td>Group Type ID. default group types {1 - ROLE; 2 - WORKGROUP}</td></tr>
+<tr><th>userProfileID</th><td>Which user to add to the manager list for the group. Either this parameter, or loginID, or userProfileUserData can be supplied to specify the user.</td></tr>
<tr><th>loginID</th><td>adds this user to the manager list for this group, specified by User Login ID</td></tr>
<tr><th>userProfileUserData</th><td>adds this user to the manager list for this group, specified by 3rd-party supplied record identifier for this user</td></tr>
<tr><th>ILSUSER</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
Deleted: branches/1.6/webapp/api/group/adduser/index.jsp
===================================================================
--- trunk/webapp/api/group/adduser/index.jsp 2016-07-13 08:54:07 UTC (rev 1481)
+++ branches/1.6/webapp/api/group/adduser/index.jsp 2016-07-13 11:36:13 UTC (rev 1485)
@@ -1,186 +0,0 @@
-<%@ page language="java" contentType="text/html;charset=utf-8" %>
-<%@ page trimDirectiveWhitespaces="true" %>
-<%@ page import="com.resolutions.ils.Utils" %>
-<%@ page import="java.util.ArrayList" %>
-<%@ page import="com.resolutions.ils.ILSSession" %>
-<%@ page import="com.resolutions.ils.data.Company" %>
-<%@ page import="com.resolutions.ils.data.Group" %>
-<%@ page import="com.resolutions.ils.data.UserProfile" %>
-<%@ page import="org.apache.log4j.Logger" %>
-
-<%
- // standard service header ---------------------------------------
-
- String serviceName = "group/adduser";
-
- Logger logger = Logger.getLogger(this.getClass());
- Logger eventsLogger = Logger.getLogger("EVENTS");
-
- response.setContentType("text/xml");
-
- String errMsg = "";
- int errCode = 0;
- Company company = Company.getCompany(request);
-
- boolean apiEnabled = "on".equals(Utils.getSysConfig(session.getServletContext(), company.getCompanyID()).getProperty("APIEnable", "off"));
- ++errCode;
- if (!apiEnabled) {
- errMsg = "API not enabled in system management settings.";
- out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
- eventsLogger.error(serviceName +": " + errMsg);
- return;
- }
-
- String userID = request.getParameter("ILSUSER");
- String userPW = request.getParameter("ILSPASSWD");
- ILSSession ilsSession = (userID != null && userPW != null)
- ? ILSSession.login(company.getCompanyName(), userID, userPW)
- : (ILSSession)session.getAttribute("ilsSession");
- ++errCode;
- if (ilsSession == null) {
- errMsg = "iLS sign in information is not valid.";
- out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
- eventsLogger.error(serviceName +": " + errMsg);
- return;
- }
-
- // end standard service header -----------------------------------
-
-
- int groupTypeID = -1; try { groupTypeID = Integer.parseInt(request.getParameter("groupTypeID")); } catch(Exception e) {}
- String[] groupID = null; try { groupID = request.getParameter("groupID").split("\\|"); } catch(Exception e) {}
- String[] userData = null; try { userData = request.getParameter("userData").split("\\|"); } catch(Exception e) {}
- String[] groupName = null; try { groupName = request.getParameter("groupName").split("\\|"); } catch(Exception e) {}
- String[] loginID = null; try { loginID = request.getParameter("loginID").split("\\|"); } catch(Exception e) {}
- String[] userProfileID = null; try { userProfileID = request.getParameter("userProfileID").split("\\|"); } catch(Exception e) {}
- String[] userProfileUserData = null; try { userProfileUserData = request.getParameter("userProfileUserData").split("\\|"); } catch(Exception e) {}
-
-// one of these must be supplied; otherwise, show usage info
-if (groupTypeID != -1 && (groupID != null || groupName != null || userData != null)
- && (userProfileID != null || loginID != null || userProfileUserData != null)) {
-
- UserProfile adminUser = ilsSession.getCurrentUserProfile();
-
- ArrayList<Group> groups = new ArrayList<Group>();
- ArrayList<UserProfile> users = new ArrayList<UserProfile>();
- String errors = "";
- ++errCode;
- if ((adminUser.getUserProfileAccessLevel() > UserProfile.ACCESS_MANAGER) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_ADD_USER)) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_MODIFY_USER))) {
- if (groupID != null) {
- for (String g : groupID) {
- int currentGroupID = -1; try { currentGroupID = Integer.parseInt(g); } catch(Exception e) {}
- Group currentGroup = Group.getGroup(ilsSession, currentGroupID);
- if (currentGroup == null) {
- errors += "<error code=\""+errCode+"\" message=\"Group with groupID " + currentGroupID + " does not exist.\"/>";
- } else {
- groups.add(currentGroup);
- }
- }
- }
- else if (userData != null) {
- for (String currentUserData : userData) {
- Group currentGroup = Group.getGroupByUserData(ilsSession, groupTypeID, currentUserData);
- if (currentGroup == null) {
- errors += "<error code=\""+errCode+"\" message=\"Group with userData " + currentUserData + " does not exist.\"/>";
- } else {
- groups.add(currentGroup);
- }
- }
- }
- if (groups.size() <= 0) {
- out.print("<error code=\""+errCode+"\" message=\"Group(s) not found.\"/>");
- return;
- }
- }
- else {
- ++errCode;
- out.print("<error code=\""+errCode+"\" message=\"Permission denied.\"/>");
- return;
- }
-
- errCode += 2;
- if (adminUser.getUserProfileAccessLevel() <= UserProfile.ACCESS_MANAGER && !adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_MODIFY_USER)) {
- out.print("<error code=\""+errCode+"\" message=\"Permission denied to edit group.\"/>");
- return;
- }
-
- ++errCode;
- if (userProfileID != null) {
- for (String u : userProfileID) {
- int currentUserProfileID = -1; try { currentUserProfileID = Integer.parseInt(u); } catch(Exception e) {}
- UserProfile currentUserProfile = UserProfile.getUserProfile(ilsSession, currentUserProfileID);
- if (currentUserProfile == null) {
- errors += "<error code=\""+errCode+"\" message=\"User with userProfileID " + currentUserProfileID + " does not exist.\"/>";
- } else {
- users.add(currentUserProfile);
- }
- }
- }
- else if (loginID != null) {
- for (String currentLoginID : loginID) {
- UserProfile currentUserProfile = UserProfile.getUserProfile(ilsSession, currentLoginID);
- if (currentUserProfile == null) {
- errors += "<error code=\""+errCode+"\" message=\"User with loginID " + currentLoginID + " does not exist.\"/>";
- } else {
- users.add(currentUserProfile);
- }
- }
- }
- else if (userProfileUserData != null) {
- for (String currentUserProfileUserData : userProfileUserData) {
- UserProfile currentUserProfile = UserProfile.getUserProfileByUserData(ilsSession, currentUserProfileUserData);
- if (currentUserProfile == null) {
- errors += "<error code=\""+errCode+"\" message=\"User with userProfileUserData " + currentUserProfileUserData + " does not exist.\"/>";
- } else {
- users.add(currentUserProfile);
- }
- }
- }
- if (users.size() <= 0) {
- out.print("<error code=\""+errCode+"\" message=\"UserProfile(s) not found.\"/>");
- return;
- }
-
- ++errCode;
-
- int updateCount = 0;
- for (Group group : groups) {
- for (UserProfile userProfile : users) {
- updateCount += group.addUserGroup(ilsSession, group.getGroupID(), userProfile.getUserProfileID());
- }
- }
-
- if (updateCount < 0) updateCount = 0;
-
-%>
-<success <%= updateCount > -1 ? (" membersUpdated=\""+updateCount+"\"") : ""%>>
-<%= errors %>
-</success>
-<%
- return;
-
-}
-response.setContentType("text/html");
-%>
-<html>
-<style>th { text-align:left; }</style>
-<body>
-<h1>group/adduser</h1>
-<p>Add user profile to a group</p>
-<p>Supports pipe delimited parameters to add multiple users to multiple groups</p>
-<h3>Parameters</h3>
-<table border="1">
-<tbody>
-<tr><th>groupID</th><td>Which group(s) to update. Either this parameter, or userData can be supplied to specify the group.</td></tr>
-<tr><th>userData</th><td>3rd-party supplied record identifier for group</td></tr>
-<tr><th>groupTypeID</th><td>Group Type ID for all groups specified. default group types {1 - ROLE; 2 - WORKGROUP}</td></tr>
-<tr><th>userProfileID</th><td>Which user(s) to add to group(s). Either this parameter, or loginID, or userProfileUserData can be supplied to specify the user.</td></tr>
-<tr><th>loginID</th><td>adds this user to this group, specified by User Login ID</td></tr>
-<tr><th>userProfileUserData</th><td>adds this user to this group, specified by 3rd-party supplied record identifier for this user</td></tr>
-<tr><th>ILSUSER</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
-<tr><th>ILSPASSWD</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
-</tbody>
-</table>
-</body>
-</html>
-
Copied: branches/1.6/webapp/api/group/adduser/index.jsp (from rev 1481, trunk/webapp/api/group/adduser/index.jsp)
===================================================================
--- branches/1.6/webapp/api/group/adduser/index.jsp (rev 0)
+++ branches/1.6/webapp/api/group/adduser/index.jsp 2016-07-13 11:36:13 UTC (rev 1485)
@@ -0,0 +1,186 @@
+<%@ page language="java" contentType="text/html;charset=utf-8" %>
+<%@ page trimDirectiveWhitespaces="true" %>
+<%@ page import="com.resolutions.ils.Utils" %>
+<%@ page import="java.util.ArrayList" %>
+<%@ page import="com.resolutions.ils.ILSSession" %>
+<%@ page import="com.resolutions.ils.data.Company" %>
+<%@ page import="com.resolutions.ils.data.Group" %>
+<%@ page import="com.resolutions.ils.data.UserProfile" %>
+<%@ page import="org.apache.log4j.Logger" %>
+
+<%
+ // standard service header ---------------------------------------
+
+ String serviceName = "group/adduser";
+
+ Logger logger = Logger.getLogger(this.getClass());
+ Logger eventsLogger = Logger.getLogger("EVENTS");
+
+ response.setContentType("text/xml");
+
+ String errMsg = "";
+ int errCode = 0;
+ Company company = Company.getCompany(request);
+
+ boolean apiEnabled = "on".equals(Utils.getSysConfig(session.getServletContext(), company.getCompanyID()).getProperty("APIEnable", "off"));
+ ++errCode;
+ if (!apiEnabled) {
+ errMsg = "API not enabled in system management settings.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
+ return;
+ }
+
+ String userID = request.getParameter("ILSUSER");
+ String userPW = request.getParameter("ILSPASSWD");
+ ILSSession ilsSession = (userID != null && userPW != null)
+ ? ILSSession.login(company.getCompanyName(), userID, userPW)
+ : (ILSSession)session.getAttribute("ilsSession");
+ ++errCode;
+ if (ilsSession == null) {
+ errMsg = "iLS sign in information is not valid.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
+ return;
+ }
+
+ // end standard service header -----------------------------------
+
+
+ int groupTypeID = -1; try { groupTypeID = Integer.parseInt(request.getParameter("groupTypeID")); } catch(Exception e) {}
+ String[] groupID = null; try { groupID = request.getParameter("groupID").split("\\|"); } catch(Exception e) {}
+ String[] userData = null; try { userData = request.getParameter("userData").split("\\|"); } catch(Exception e) {}
+ String[] groupName = null; try { groupName = request.getParameter("groupName").split("\\|"); } catch(Exception e) {}
+ String[] loginID = null; try { loginID = request.getParameter("loginID").split("\\|"); } catch(Exception e) {}
+ String[] userProfileID = null; try { userProfileID = request.getParameter("userProfileID").split("\\|"); } catch(Exception e) {}
+ String[] userProfileUserData = null; try { userProfileUserData = request.getParameter("userProfileUserData").split("\\|"); } catch(Exception e) {}
+
+// one of these must be supplied; otherwise, show usage info
+if (groupTypeID != -1 && (groupID != null || groupName != null || userData != null)
+ && (userProfileID != null || loginID != null || userProfileUserData != null)) {
+
+ UserProfile adminUser = ilsSession.getCurrentUserProfile();
+
+ ArrayList<Group> groups = new ArrayList<Group>();
+ ArrayList<UserProfile> users = new ArrayList<UserProfile>();
+ String errors = "";
+ ++errCode;
+ if ((adminUser.getUserProfileAccessLevel() > UserProfile.ACCESS_MANAGER) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_ADD_USER)) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_MODIFY_USER))) {
+ if (groupID != null) {
+ for (String g : groupID) {
+ int currentGroupID = -1; try { currentGroupID = Integer.parseInt(g); } catch(Exception e) {}
+ Group currentGroup = Group.getGroup(ilsSession, currentGroupID);
+ if (currentGroup == null) {
+ errors += "<error code=\""+errCode+"\" message=\"Group with groupID " + currentGroupID + " does not exist.\"/>";
+ } else {
+ groups.add(currentGroup);
+ }
+ }
+ }
+ else if (userData != null) {
+ for (String currentUserData : userData) {
+ Group currentGroup = Group.getGroupByUserData(ilsSession, groupTypeID, currentUserData);
+ if (currentGroup == null) {
+ errors += "<error code=\""+errCode+"\" message=\"Group with userData " + currentUserData + " does not exist.\"/>";
+ } else {
+ groups.add(currentGroup);
+ }
+ }
+ }
+ if (groups.size() <= 0) {
+ out.print("<error code=\""+errCode+"\" message=\"Group(s) not found.\"/>");
+ return;
+ }
+ }
+ else {
+ ++errCode;
+ out.print("<error code=\""+errCode+"\" message=\"Permission denied.\"/>");
+ return;
+ }
+
+ errCode += 2;
+ if (adminUser.getUserProfileAccessLevel() <= UserProfile.ACCESS_MANAGER && !adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_MODIFY_USER)) {
+ out.print("<error code=\""+errCode+"\" message=\"Permission denied to edit group.\"/>");
+ return;
+ }
+
+ ++errCode;
+ if (userProfileID != null) {
+ for (String u : userProfileID) {
+ int currentUserProfileID = -1; try { currentUserProfileID = Integer.parseInt(u); } catch(Exception e) {}
+ UserProfile currentUserProfile = UserProfile.getUserProfile(ilsSession, currentUserProfileID);
+ if (currentUserProfile == null) {
+ errors += "<error code=\""+errCode+"\" message=\"User with userProfileID " + currentUserProfileID + " does not exist.\"/>";
+ } else {
+ users.add(currentUserProfile);
+ }
+ }
+ }
+ else if (loginID != null) {
+ for (String currentLoginID : loginID) {
+ UserProfile currentUserProfile = UserProfile.getUserProfile(ilsSession, currentLoginID);
+ if (currentUserProfile == null) {
+ errors += "<error code=\""+errCode+"\" message=\"User with loginID " + currentLoginID + " does not exist.\"/>";
+ } else {
+ users.add(currentUserProfile);
+ }
+ }
+ }
+ else if (userProfileUserData != null) {
+ for (String currentUserProfileUserData : userProfileUserData) {
+ UserProfile currentUserProfile = UserProfile.getUserProfileByUserData(ilsSession, currentUserProfileUserData);
+ if (currentUserProfile == null) {
+ errors += "<error code=\""+errCode+"\" message=\"User with userProfileUserData " + currentUserProfileUserData + " does not exist.\"/>";
+ } else {
+ users.add(currentUserProfile);
+ }
+ }
+ }
+ if (users.size() <= 0) {
+ out.print("<error code=\""+errCode+"\" message=\"UserProfile(s) not found.\"/>");
+ return;
+ }
+
+ ++errCode;
+
+ int updateCount = 0;
+ for (Group group : groups) {
+ for (UserProfile userProfile : users) {
+ updateCount += group.addUserGroup(ilsSession, group.getGroupID(), userProfile.getUserProfileID());
+ }
+ }
+
+ if (updateCount < 0) updateCount = 0;
+
+%>
+<success <%= updateCount > -1 ? (" membersUpdated=\""+updateCount+"\"") : ""%>>
+<%= errors %>
+</success>
+<%
+ return;
+
+}
+response.setContentType("text/html");
+%>
+<html>
+<style>th { text-align:left; }</style>
+<body>
+<h1>group/adduser</h1>
+<p>Add user profile to a group</p>
+<p>Supports pipe delimited parameters to add multiple users to multiple groups</p>
+<h3>Parameters</h3>
+<table border="1">
+<tbody>
+<tr><th>groupID</th><td>Which group(s) to update. Either this parameter, or userData can be supplied to specify the group.</td></tr>
+<tr><th>userData</th><td>3rd-party supplied record identifier for group</td></tr>
+<tr><th>groupTypeID</th><td>Group Type ID for all groups specified. default group types {1 - ROLE; 2 - WORKGROUP}</td></tr>
+<tr><th>userProfileID</th><td>Which user(s) to add to group(s). Either this parameter, or loginID, or userProfileUserData can be supplied to specify the user.</td></tr>
+<tr><th>loginID</th><td>adds this user to this group, specified by User Login ID</td></tr>
+<tr><th>userProfileUserData</th><td>adds this user to this group, specified by 3rd-party supplied record identifier for this user</td></tr>
+<tr><th>ILSUSER</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
+<tr><th>ILSPASSWD</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
+</tbody>
+</table>
+</body>
+</html>
+
Modified: branches/1.6/webapp/api/group/removemanager/index.jsp
===================================================================
--- branches/1.6/webapp/api/group/removemanager/index.jsp 2016-07-13 10:57:10 UTC (rev 1484)
+++ branches/1.6/webapp/api/group/removemanager/index.jsp 2016-07-13 11:36:13 UTC (rev 1485)
@@ -9,27 +9,40 @@
<%
// standard service header ---------------------------------------
+
+ String serviceName = "group/removemanager";
+
+ Logger logger = Logger.getLogger(this.getClass());
+ Logger eventsLogger = Logger.getLogger("EVENTS");
+
response.setContentType("text/xml");
+
+ String errMsg = "";
int errCode = 0;
Company company = Company.getCompany(request);
boolean apiEnabled = "on".equals(Utils.getSysConfig(session.getServletContext(), company.getCompanyID()).getProperty("APIEnable", "off"));
++errCode;
if (!apiEnabled) {
- out.print("<error code=\""+errCode+"\" message=\"API not enabled in system management settings.\"/>");
+ errMsg = "API not enabled in system management settings.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
return;
}
String userID = request.getParameter("ILSUSER");
- String userPw = request.getParameter("ILSPASSWD");
- ILSSession ilsSession = (userID != null && userPw != null)
- ? ILSSession.login(company.getCompanyName(), userID, userPw)
+ String userPW = request.getParameter("ILSPASSWD");
+ ILSSession ilsSession = (userID != null && userPW != null)
+ ? ILSSession.login(company.getCompanyName(), userID, userPW)
: (ILSSession)session.getAttribute("ilsSession");
++errCode;
if (ilsSession == null) {
- out.print("<error code=\""+errCode+"\" message=\"Your iLS sign in information is not valid.\"/>");
+ errMsg = "iLS sign in information is not valid.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
return;
}
+
// end standard service header -----------------------------------
@@ -44,13 +57,9 @@
// one of these must be supplied; otherwise, show usage info
if (groupTypeID != -1 && (groupID != -1 || groupName != null || userData != null)
&& (userProfileID != -1 || loginID != null || userProfileUserData != null)) {
- String errMsg = "";
UserProfile adminUser = ilsSession.getCurrentUserProfile();
- Logger logger = Logger.getLogger(this.getClass());
- Logger eventsLogger = Logger.getLogger("EVENTS");
-
Group current = null;
++errCode;
if ((adminUser.getUserProfileAccessLevel() > UserProfile.ACCESS_MANAGER) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_ADD_USER)) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_MODIFY_USER))) {
@@ -106,16 +115,16 @@
<style>th { text-align:left; }</style>
<body>
<h1>group/removemanger</h1>
-<p>Remove user profile to manager list for a group</p>
+<p>Remove user profile from manager list for a group</p>
<h3>Parameters</h3>
<table border="1">
<tbody>
-<tr><th>groupID</th><td>The record to modify. Either this parameter, or userData can be supplied to update an existing record. This order of precedence is used. If more than one of these is supplied, the subsequent parameter is used as an update field for the record.</td></tr>
+<tr><th>groupID</th><td>Which group to update. Either this parameter, or userData can be supplied to specify the group.</td></tr>
<tr><th>userData</th><td>3rd-party supplied record identifier for group</td></tr>
-<tr><th>groupTypeID</th><td>Group Type ID. default groups {1 - ROLE; 2 - WORKGROUP}</td></tr>
-<tr><th>userProfileID</th><td>adds this user to the manager list for this group</td></tr>
-<tr><th>loginID</th><td>adds this user to the manager list for this group, specified by User Login ID</td></tr>
-<tr><th>userProfileUserData</th><td>adds this user to the manager list for this group, specified by 3rd-party supplied record identifier for this user</td></tr>
+<tr><th>groupTypeID</th><td>Group Type ID. default group types {1 - ROLE; 2 - WORKGROUP}</td></tr>
+<tr><th>userProfileID</th><td>Which user to remove from the manager list for the group. Either this parameter, or loginID, or userProfileUserData can be supplied to specify the user.</td></tr>
+<tr><th>loginID</th><td>removes this user from the manager list for this group, specified by User Login ID</td></tr>
+<tr><th>userProfileUserData</th><td>removes this user from the manager list for this group, specified by 3rd-party supplied record identifier for this user</td></tr>
<tr><th>ILSUSER</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
<tr><th>ILSPASSWD</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
</tbody>
Deleted: branches/1.6/webapp/api/group/removeuser/index.jsp
===================================================================
--- trunk/webapp/api/group/removeuser/index.jsp 2016-07-13 08:54:07 UTC (rev 1481)
+++ branches/1.6/webapp/api/group/removeuser/index.jsp 2016-07-13 11:36:13 UTC (rev 1485)
@@ -1,187 +0,0 @@
-<%@ page language="java" contentType="text/html;charset=utf-8" %>
-<%@ page trimDirectiveWhitespaces="true" %>
-<%@ page import="com.resolutions.ils.Utils" %>
-<%@ page import="java.util.ArrayList" %>
-<%@ page import="com.resolutions.ils.ILSSession" %>
-<%@ page import="com.resolutions.ils.data.Company" %>
-<%@ page import="com.resolutions.ils.data.Group" %>
-<%@ page import="com.resolutions.ils.data.UserProfile" %>
-<%@ page import="org.apache.log4j.Logger" %>
-
-<%
- // standard service header ---------------------------------------
-
- String serviceName = "group/removeuser";
-
- Logger logger = Logger.getLogger(this.getClass());
- Logger eventsLogger = Logger.getLogger("EVENTS");
-
- response.setContentType("text/xml");
-
- String errMsg = "";
- int errCode = 0;
- Company company = Company.getCompany(request);
-
- boolean apiEnabled = "on".equals(Utils.getSysConfig(session.getServletContext(), company.getCompanyID()).getProperty("APIEnable", "off"));
- ++errCode;
- if (!apiEnabled) {
- errMsg = "API not enabled in system management settings.";
- out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
- eventsLogger.error(serviceName +": " + errMsg);
- return;
- }
-
- String userID = request.getParameter("ILSUSER");
- String userPW = request.getParameter("ILSPASSWD");
- ILSSession ilsSession = (userID != null && userPW != null)
- ? ILSSession.login(company.getCompanyName(), userID, userPW)
- : (ILSSession)session.getAttribute("ilsSession");
- ++errCode;
- if (ilsSession == null) {
- errMsg = "iLS sign in information is not valid.";
- out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
- eventsLogger.error(serviceName +": " + errMsg);
- return;
- }
-
- // end standard service header -----------------------------------
-
-
- int groupTypeID = -1; try { groupTypeID = Integer.parseInt(request.getParameter("groupTypeID")); } catch(Exception e) {}
- String[] groupID = null; try { groupID = request.getParameter("groupID").split("\\|"); } catch(Exception e) {}
- String[] userData = null; try { userData = request.getParameter("userData").split("\\|"); } catch(Exception e) {}
- String[] groupName = null; try { groupName = request.getParameter("groupName").split("\\|"); } catch(Exception e) {}
- String[] loginID = null; try { loginID = request.getParameter("loginID").split("\\|"); } catch(Exception e) {}
- String[] userProfileID = null; try { userProfileID = request.getParameter("userProfileID").split("\\|"); } catch(Exception e) {}
- String[] userProfileUserData = null; try { userProfileUserData = request.getParameter("userProfileUserData").split("\\|"); } catch(Exception e) {}
-
-// one of these must be supplied; otherwise, show usage info
-if (groupTypeID != -1 && (groupID != null || groupName != null || userData != null)
- && (userProfileID != null || loginID != null || userProfileUserData != null)) {
-
- UserProfile adminUser = ilsSession.getCurrentUserProfile();
-
- ArrayList<Group> groups = new ArrayList<Group>();
- ArrayList<UserProfile> users = new ArrayList<UserProfile>();
- String errors = "";
- ++errCode;
- if ((adminUser.getUserProfileAccessLevel() > UserProfile.ACCESS_MANAGER) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_ADD_USER)) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_MODIFY_USER))) {
- if (groupID != null) {
- for (String g : groupID) {
- int currentGroupID = -1; try { currentGroupID = Integer.parseInt(g); } catch(Exception e) {}
- Group currentGroup = Group.getGroup(ilsSession, currentGroupID);
- if (currentGroup == null) {
- errors += "<error code=\""+errCode+"\" message=\"Group with groupID " + currentGroupID + " does not exist.\"/>";
- } else {
- groups.add(currentGroup);
- }
- }
- }
- else if (userData != null) {
- for (String currentUserData : userData) {
- Group currentGroup = Group.getGroupByUserData(ilsSession, groupTypeID, currentUserData);
- if (currentGroup == null) {
- errors += "<error code=\""+errCode+"\" message=\"Group with userData " + currentUserData + " does not exist.\"/>";
- } else {
- groups.add(currentGroup);
- }
- }
- }
- if (groups.size() <= 0) {
- out.print("<error code=\""+errCode+"\" message=\"Group(s) not found.\"/>");
- return;
- }
- }
- else {
- ++errCode;
- out.print("<error code=\""+errCode+"\" message=\"Permission denied.\"/>");
- return;
- }
-
- errCode += 2;
- if (adminUser.getUserProfileAccessLevel() <= UserProfile.ACCESS_MANAGER && !adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_MODIFY_USER)) {
- out.print("<error code=\""+errCode+"\" message=\"Permission denied to edit group.\"/>");
- return;
- }
-
- ++errCode;
- if (userProfileID != null) {
- for (String u : userProfileID) {
- int currentUserProfileID = -1; try { currentUserProfileID = Integer.parseInt(u); } catch(Exception e) {}
- UserProfile currentUserProfile = UserProfile.getUserProfile(ilsSession, currentUserProfileID);
- if (currentUserProfile == null) {
- errors += "<error code=\""+errCode+"\" message=\"User with userProfileID " + currentUserProfileID + " does not exist.\"/>";
- } else {
- users.add(currentUserProfile);
- }
- }
- }
- else if (loginID != null) {
- for (String currentLoginID : loginID) {
- UserProfile currentUserProfile = UserProfile.getUserProfile(ilsSession, currentLoginID);
- if (currentUserProfile == null) {
- errors += "<error code=\""+errCode+"\" message=\"User with loginID " + currentLoginID + " does not exist.\"/>";
- } else {
- users.add(currentUserProfile);
- }
- }
- }
- else if (userProfileUserData != null) {
- for (String currentUserProfileUserData : userProfileUserData) {
- UserProfile currentUserProfile = UserProfile.getUserProfileByUserData(ilsSession, currentUserProfileUserData);
- if (currentUserProfile == null) {
- errors += "<error code=\""+errCode+"\" message=\"User with userProfileUserData " + currentUserProfileUserData + " does not exist.\"/>";
- } else {
- users.add(currentUserProfile);
- }
- }
- }
- if (users.size() <= 0) {
- out.print("<error code=\""+errCode+"\" message=\"UserProfile(s) not found.\"/>");
- return;
- }
-
- ++errCode;
-
- int updateCount = 0;
- for (Group group : groups) {
- for (UserProfile userProfile : users) {
- updateCount += group.deleteUserGroup(ilsSession, group.getGroupID(), userProfile.getUserProfileID());
- }
- }
-
- if (updateCount < 0) updateCount = 0;
-
-%>
-<success <%= updateCount > -1 ? (" membersRemoved=\""+updateCount+"\"") : ""%>>
-<%= errors %>
-</success>
-<%
- return;
-
-}
-response.setContentType("text/html");
-%>
-<html>
-<style>th { text-align:left; }</style>
-<body>
-<h1>group/removeuser</h1>
-<p>Remove user profile from a group</p>
-<p>Supports pipe delimited parameters to remove multiple users from multiple groups</p>
-<h3>Parameters</h3>
-<table border="1">
-<tbody>
-<tr><th>groupID</th><td>Which group(s) to update. Either this parameter, or userData can be supplied to specify the group.</td></tr>
-<tr><th>userData</th><td>3rd-party supplied record identifier for group</td></tr>
-<tr><th>groupTypeID</th><td>Group Type ID for all groups specified. default group types {1 - ROLE; 2 - WORKGROUP}</td></tr>
-<tr><th>userProfileID</th><td>adds this user to the manager list for this group</td></tr>
-<tr><th>userProfileID</th><td>Which user(s) to remove from group(s). Either this parameter, or loginID, or userProfileUserData can be supplied to specify the user.</td></tr>
-<tr><th>loginID</th><td>removes this user from this group, specified by User Login ID</td></tr>
-<tr><th>userProfileUserData</th><td>removes this user from this group, specified by 3rd-party supplied record identifier for this user</td></tr>
-<tr><th>ILSUSER</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
-<tr><th>ILSPASSWD</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
-</tbody>
-</table>
-</body>
-</html>
-
Copied: branches/1.6/webapp/api/group/removeuser/index.jsp (from rev 1481, trunk/webapp/api/group/removeuser/index.jsp)
===================================================================
--- branches/1.6/webapp/api/group/removeuser/index.jsp (rev 0)
+++ branches/1.6/webapp/api/group/removeuser/index.jsp 2016-07-13 11:36:13 UTC (rev 1485)
@@ -0,0 +1,187 @@
+<%@ page language="java" contentType="text/html;charset=utf-8" %>
+<%@ page trimDirectiveWhitespaces="true" %>
+<%@ page import="com.resolutions.ils.Utils" %>
+<%@ page import="java.util.ArrayList" %>
+<%@ page import="com.resolutions.ils.ILSSession" %>
+<%@ page import="com.resolutions.ils.data.Company" %>
+<%@ page import="com.resolutions.ils.data.Group" %>
+<%@ page import="com.resolutions.ils.data.UserProfile" %>
+<%@ page import="org.apache.log4j.Logger" %>
+
+<%
+ // standard service header ---------------------------------------
+
+ String serviceName = "group/removeuser";
+
+ Logger logger = Logger.getLogger(this.getClass());
+ Logger eventsLogger = Logger.getLogger("EVENTS");
+
+ response.setContentType("text/xml");
+
+ String errMsg = "";
+ int errCode = 0;
+ Company company = Company.getCompany(request);
+
+ boolean apiEnabled = "on".equals(Utils.getSysConfig(session.getServletContext(), company.getCompanyID()).getProperty("APIEnable", "off"));
+ ++errCode;
+ if (!apiEnabled) {
+ errMsg = "API not enabled in system management settings.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
+ return;
+ }
+
+ String userID = request.getParameter("ILSUSER");
+ String userPW = request.getParameter("ILSPASSWD");
+ ILSSession ilsSession = (userID != null && userPW != null)
+ ? ILSSession.login(company.getCompanyName(), userID, userPW)
+ : (ILSSession)session.getAttribute("ilsSession");
+ ++errCode;
+ if (ilsSession == null) {
+ errMsg = "iLS sign in information is not valid.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
+ return;
+ }
+
+ // end standard service header -----------------------------------
+
+
+ int groupTypeID = -1; try { groupTypeID = Integer.parseInt(request.getParameter("groupTypeID")); } catch(Exception e) {}
+ String[] groupID = null; try { groupID = request.getParameter("groupID").split("\\|"); } catch(Exception e) {}
+ String[] userData = null; try { userData = request.getParameter("userData").split("\\|"); } catch(Exception e) {}
+ String[] groupName = null; try { groupName = request.getParameter("groupName").split("\\|"); } catch(Exception e) {}
+ String[] loginID = null; try { loginID = request.getParameter("loginID").split("\\|"); } catch(Exception e) {}
+ String[] userProfileID = null; try { userProfileID = request.getParameter("userProfileID").split("\\|"); } catch(Exception e) {}
+ String[] userProfileUserData = null; try { userProfileUserData = request.getParameter("userProfileUserData").split("\\|"); } catch(Exception e) {}
+
+// one of these must be supplied; otherwise, show usage info
+if (groupTypeID != -1 && (groupID != null || groupName != null || userData != null)
+ && (userProfileID != null || loginID != null || userProfileUserData != null)) {
+
+ UserProfile adminUser = ilsSession.getCurrentUserProfile();
+
+ ArrayList<Group> groups = new ArrayList<Group>();
+ ArrayList<UserProfile> users = new ArrayList<UserProfile>();
+ String errors = "";
+ ++errCode;
+ if ((adminUser.getUserProfileAccessLevel() > UserProfile.ACCESS_MANAGER) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_ADD_USER)) || (adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_MODIFY_USER))) {
+ if (groupID != null) {
+ for (String g : groupID) {
+ int currentGroupID = -1; try { currentGroupID = Integer.parseInt(g); } catch(Exception e) {}
+ Group currentGroup = Group.getGroup(ilsSession, currentGroupID);
+ if (currentGroup == null) {
+ errors += "<error code=\""+errCode+"\" message=\"Group with groupID " + currentGroupID + " does not exist.\"/>";
+ } else {
+ groups.add(currentGroup);
+ }
+ }
+ }
+ else if (userData != null) {
+ for (String currentUserData : userData) {
+ Group currentGroup = Group.getGroupByUserData(ilsSession, groupTypeID, currentUserData);
+ if (currentGroup == null) {
+ errors += "<error code=\""+errCode+"\" message=\"Group with userData " + currentUserData + " does not exist.\"/>";
+ } else {
+ groups.add(currentGroup);
+ }
+ }
+ }
+ if (groups.size() <= 0) {
+ out.print("<error code=\""+errCode+"\" message=\"Group(s) not found.\"/>");
+ return;
+ }
+ }
+ else {
+ ++errCode;
+ out.print("<error code=\""+errCode+"\" message=\"Permission denied.\"/>");
+ return;
+ }
+
+ errCode += 2;
+ if (adminUser.getUserProfileAccessLevel() <= UserProfile.ACCESS_MANAGER && !adminUser.hasAccess(UserProfile.ACCESS_MODE_USERPR_MODIFY_USER)) {
+ out.print("<error code=\""+errCode+"\" message=\"Permission denied to edit group.\"/>");
+ return;
+ }
+
+ ++errCode;
+ if (userProfileID != null) {
+ for (String u : userProfileID) {
+ int currentUserProfileID = -1; try { currentUserProfileID = Integer.parseInt(u); } catch(Exception e) {}
+ UserProfile currentUserProfile = UserProfile.getUserProfile(ilsSession, currentUserProfileID);
+ if (currentUserProfile == null) {
+ errors += "<error code=\""+errCode+"\" message=\"User with userProfileID " + currentUserProfileID + " does not exist.\"/>";
+ } else {
+ users.add(currentUserProfile);
+ }
+ }
+ }
+ else if (loginID != null) {
+ for (String currentLoginID : loginID) {
+ UserProfile currentUserProfile = UserProfile.getUserProfile(ilsSession, currentLoginID);
+ if (currentUserProfile == null) {
+ errors += "<error code=\""+errCode+"\" message=\"User with loginID " + currentLoginID + " does not exist.\"/>";
+ } else {
+ users.add(currentUserProfile);
+ }
+ }
+ }
+ else if (userProfileUserData != null) {
+ for (String currentUserProfileUserData : userProfileUserData) {
+ UserProfile currentUserProfile = UserProfile.getUserProfileByUserData(ilsSession, currentUserProfileUserData);
+ if (currentUserProfile == null) {
+ errors += "<error code=\""+errCode+"\" message=\"User with userProfileUserData " + currentUserProfileUserData + " does not exist.\"/>";
+ } else {
+ users.add(currentUserProfile);
+ }
+ }
+ }
+ if (users.size() <= 0) {
+ out.print("<error code=\""+errCode+"\" message=\"UserProfile(s) not found.\"/>");
+ return;
+ }
+
+ ++errCode;
+
+ int updateCount = 0;
+ for (Group group : groups) {
+ for (UserProfile userProfile : users) {
+ updateCount += group.deleteUserGroup(ilsSession, group.getGroupID(), userProfile.getUserProfileID());
+ }
+ }
+
+ if (updateCount < 0) updateCount = 0;
+
+%>
+<success <%= updateCount > -1 ? (" membersRemoved=\""+updateCount+"\"") : ""%>>
+<%= errors %>
+</success>
+<%
+ return;
+
+}
+response.setContentType("text/html");
+%>
+<html>
+<style>th { text-align:left; }</style>
+<body>
+<h1>group/removeuser</h1>
+<p>Remove user profile from a group</p>
+<p>Supports pipe delimited parameters to remove multiple users from multiple groups</p>
+<h3>Parameters</h3>
+<table border="1">
+<tbody>
+<tr><th>groupID</th><td>Which group(s) to update. Either this parameter, or userData can be supplied to specify the group.</td></tr>
+<tr><th>userData</th><td>3rd-party supplied record identifier for group</td></tr>
+<tr><th>groupTypeID</th><td>Group Type ID for all groups specified. default group types {1 - ROLE; 2 - WORKGROUP}</td></tr>
+<tr><th>userProfileID</th><td>adds this user to the manager list for this group</td></tr>
+<tr><th>userProfileID</th><td>Which user(s) to remove from group(s). Either this parameter, or loginID, or userProfileUserData can be supplied to specify the user.</td></tr>
+<tr><th>loginID</th><td>removes this user from this group, specified by User Login ID</td></tr>
+<tr><th>userProfileUserData</th><td>removes this user from this group, specified by 3rd-party supplied record identifier for this user</td></tr>
+<tr><th>ILSUSER</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
+<tr><th>ILSPASSWD</th><td>ILS Login Credentials. Used to validate this API request.</td></tr>
+</tbody>
+</table>
+</body>
+</html>
+
Modified: branches/1.6/webapp/api/session/login/index.jsp
===================================================================
--- branches/1.6/webapp/api/session/login/index.jsp 2016-07-13 10:57:10 UTC (rev 1484)
+++ branches/1.6/webapp/api/session/login/index.jsp 2016-07-13 11:36:13 UTC (rev 1485)
@@ -1,30 +1,51 @@
-<%@ page language="java" contentType="text/plain;charset=utf-8" %><%@ page import="com.resolutions.ils.Utils" %><%@ page import="com.resolutions.ils.ILSSession" %><%@ page import="com.resolutions.ils.data.Company" %><%@ page import="java.io.File" %><%@ page import="java.io.FileOutputStream" %><%@ page import="java.util.Properties" %><%@ page import="org.apache.log4j.Logger" %><%@ page import="java.util.UUID" %><%
- boolean apiEnabled = "on".equals(Utils.getSysConfig(session).getProperty("APIEnable", "off"));
+<%@ page language="java" contentType="text/xml;charset=utf-8" %>
+<%@ page trimDirectiveWhitespaces="true" %>
+<%@ page import="com.resolutions.ils.Utils" %>
+<%@ page import="com.resolutions.ils.ILSSession" %>
+<%@ page import="com.resolutions.ils.data.Company" %>
+<%@ page import="java.io.File" %>
+<%@ page import="java.io.FileOutputStream" %>
+<%@ page import="java.util.Properties" %>
+<%@ page import="org.apache.log4j.Logger" %>
+<%@ page import="java.util.UUID" %>
+<%
+
+ // standard service header ---------------------------------------
+
+ String serviceName = "session/login";
+
+ Logger logger = Logger.getLogger(this.getClass());
+ Logger eventsLogger = Logger.getLogger("EVENTS");
+
+ response.setContentType("text/xml");
+
+ String errMsg = "";
+ int errCode = 0;
+ Company company = Company.getCompany(request);
+
+ boolean apiEnabled = "on".equals(Utils.getSysConfig(session.getServletContext(), company.getCompanyID()).getProperty("APIEnable", "off"));
+ ++errCode;
if (!apiEnabled) {
- out.print("API not enabled in system management settings.");
+ errMsg = "API not enabled in system management settings.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
return;
}
- //-- Company logic from login.jsp -------
- // TODO: consolidate this somewhere
- String requestURL = request.getRequestURL().toString() + "?" + request.getQueryString();
- String co = com.resolutions.ils.Utils.getCompanyFromConfig(session, requestURL);
- if (co == null) co = com.resolutions.ils.Utils.getSysConfig(session).getProperty("Company", null);
- if (co == null) co = request.getParameter("co");
- if (co != null) session.setAttribute("co", co);
- co = (String) session.getAttribute("co");
- Company company = Company.getCompany((co != null) ? Integer.parseInt(co):1);
- //-----------------------
- ILSSession ilsSession = null;
- String userID = request.getParameter("ILSUSER");
- String userPW = request.getParameter("ILSPASSWD");
- ilsSession = ILSSession.login(company.getCompanyName(), userID, userPW);
- if (ilsSession == null) {
- out.print("Your iLS sign in information is not valid. Please try again.");
- return;
- }
-
- Logger logger = Logger.getLogger(this.getClass());
- Logger eventsLogger = Logger.getLogger("EVENTS");
+
+ String userID = request.getParameter("ILSUSER");
+ String userPW = request.getParameter("ILSPASSWD");
+ ILSSession ilsSession = (userID != null && userPW != null)
+ ? ILSSession.login(company.getCompanyName(), userID, userPW)
+ : (ILSSession)session.getAttribute("ilsSession");
+ ++errCode;
+ if (ilsSession == null) {
+ errMsg = "iLS sign in information is not valid.";
+ out.print("<error code=\""+errCode+"\" message=\""+errMsg+"\"/>");
+ eventsLogger.error(serviceName +": " + errMsg);
+ return;
+ }
+ // end standard service header -----------------------------------
+
Properties u = new Properties();
u.setProperty("l", userID);
u.setProperty("p", userPW);
@@ -37,4 +58,4 @@
FileOutputStream uuidFile = new FileOutputStream(uuidFileName);
u.store(uuidFile, null);
uuidFile.close();
-%><%=uuid%>
+%><success uuid="<%=uuid%>"/>
Modified: branches/1.6/webapp/api/user/put/index.jsp
===================================================================
--- branches/1.6/webapp/api/user/put/index.jsp 2016-07-13 10:57:10 UTC (rev 1484)
+++ branches/1.6/webapp/api/user/put/index.jsp 2016-07-13 11:36:13 UTC (rev 1485)
@@ -233,9 +233,9 @@
val = request.getParameter("hireDate");
++errCode;
if ((val != null) && (!val.startsWith("m"))) {
- Date v = Utils.parseDate(val, 150 * 365, 10 * 365);
+ Date v = Utils.parseDate(val, -1, -1);
if (v != null) {
- current.setUserProfileHireDate(v);
+ current.setUserProfileHireDate(v.getTime() > 0 ? v : null);
}
else {
errMsg = "Invalid Hire Date, please enter a reasonable date using the format MM/DD/YYYY";
@@ -247,9 +247,9 @@
++errCode;
val = request.getParameter("termDate");
if ((val != null) && (!val.startsWith("m"))) {
- Date v = Utils.parseDate(val, 150 * 365, 10 * 365);
+ Date v = Utils.parseDate(val, -1, -1);
if (v != null) {
- current.setUserProfileTermDate(v);
+ current.setUserProfileTermDate(v.getTime() > 0 ? v : null);
}
else {
errMsg = "Invalid Termination Date, please enter a reasonable date using the format MM/DD/YYYY";
More information about the Ils-source
mailing list