[Ils-source] r1592 - in trunk: src/com/resolutions/ils/data webapp
scribe at crosswire.org
scribe at crosswire.org
Wed Jul 18 13:52:16 MST 2018
Author: scribe
Date: 2018-07-18 13:52:16 -0700 (Wed, 18 Jul 2018)
New Revision: 1592
Modified:
trunk/src/com/resolutions/ils/data/Course.java
trunk/webapp/admin_curricnew.jsp
trunk/webapp/employee.jsp
Log:
Added option to lock curriculum course taking order
Modified: trunk/src/com/resolutions/ils/data/Course.java
===================================================================
--- trunk/src/com/resolutions/ils/data/Course.java 2018-07-18 20:31:53 UTC (rev 1591)
+++ trunk/src/com/resolutions/ils/data/Course.java 2018-07-18 20:52:16 UTC (rev 1592)
@@ -361,6 +361,10 @@
return ("T".equals(getValue("COURSISCURRICCERT")));
}
+ public boolean isCourseCurriculumLockedCourseOrder() {
+ return ("T".equals(getValue("COURSISCURRICLCKCRSORD")));
+ }
+
public boolean isCourseAllowCurriculumPartRetake() {
return ("T".equals(getValue("COURSISALLOWCURRPARTRETAKE")));
}
@@ -434,6 +438,10 @@
setValue("COURSISCURRICULUM", (isCurriculum) ? "T" : "F");
}
+ public void setCourseCurriculumLockedCourseOrder(boolean val) {
+ setValue("COURSISCURRICLCKCRSORD", (val) ? "T" : "F");
+ }
+
public void setCourseCurriculumCertificate(boolean val) {
setValue("COURSISCURRICCERT", (val) ? "T" : "F");
}
Modified: trunk/webapp/admin_curricnew.jsp
===================================================================
--- trunk/webapp/admin_curricnew.jsp 2018-07-18 20:31:53 UTC (rev 1591)
+++ trunk/webapp/admin_curricnew.jsp 2018-07-18 20:52:16 UTC (rev 1592)
@@ -97,6 +97,9 @@
try {
current.setCourseAllowCurriculumPartRetake("true".equals(request.getParameter("curricPartRetake")));
} catch (Exception e) { logger.error(e); }
+try {
+ current.setCourseCurriculumLockedCourseOrder("true".equals(request.getParameter("curricLockOrder")));
+} catch (Exception e) { logger.error(e); }
if ((current.getCourseNum() == null) || (current.getCourseNum().length() < 1))
validError = "You must supply a Curriculum Number";
@@ -230,6 +233,10 @@
<td class="formHeadings">Enable Curriculum Partial Retake :</td>
<td><input type="checkbox" <%=(current.isCourseAllowCurriculumPartRetake())?"checked=\"checked\"":""%> name="curricPartRetake" value="true" /></td>
</tr>
+ <tr>
+ <td class="formHeadings">Lock Course Completion Order :</td>
+ <td><input type="checkbox" <%=(current.isCourseCurriculumLockedCourseOrder())?"checked=\"checked\"":""%> name="curricLockOrder" value="true" /></td>
+ </tr>
<tr>
<td> </td>
<td colspan="2"> </td>
Modified: trunk/webapp/employee.jsp
===================================================================
--- trunk/webapp/employee.jsp 2018-07-18 20:31:53 UTC (rev 1591)
+++ trunk/webapp/employee.jsp 2018-07-18 20:52:16 UTC (rev 1592)
@@ -126,8 +126,9 @@
int score = 0;
int courseCount = 0;
for (int j = 0; j < curCourses.size(); j++) {
+ Course dep = (c.isCourseCurriculumLockedCourseOrder() && j > 0) ? curCourses.get(j-1) : null;
HashMap values = new HashMap();
- processCourseRow(session, ilsSession, user, (Course)curCourses.get(j), inCurriculum, values, true);
+ processCourseRow(session, ilsSession, user, (Course)curCourses.get(j), inCurriculum, values, true, dep);
timeframe += (Integer)values.get("timeframe");
Date d = (Date)values.get("startdate");
startdate = (d != null && (startdate == 0 || startdate > d.getTime())) ? d.getTime() : startdate;
@@ -195,8 +196,9 @@
</tr>
<%
for (int j = 0; j < curCourses.size(); j++) {
+ Course dep = (c.isCourseCurriculumLockedCourseOrder() && j > 0) ? curCourses.get(j-1) : null;
HashMap values = new HashMap();
- String rowText = processCourseRow(session, ilsSession, user, (Course)curCourses.get(j), inCurriculum, values, c.isCourseCurriculumCertificate());
+ String rowText = processCourseRow(session, ilsSession, user, (Course)curCourses.get(j), inCurriculum, values, c.isCourseCurriculumCertificate(), dep);
out.print(rowText);
}
%>
@@ -325,11 +327,11 @@
<td> <%=timeFrame%> </td>
<td> <%=startDate%> </td>
<td> <%=endDate %> </td>
- <td><a href="#" onClick="launchCourse('<%=cc.getCourseID()%>',true,'<%=cc.getCourseFrameFeatures(session.getServletContext())%>')">
+ <td style=\"text-align:center;\"><a href="#" onClick="launchCourse('<%=cc.getCourseID()%>',true,'<%=cc.getCourseFrameFeatures(session.getServletContext())%>')">
<%
if (sButton != null) {
%>
- <img src="<%=sButton%>" width="72" height="24" border="0" alt=""/>
+ <img src="<%=sButton%>" height="24" border="0" alt=""/>
<%
} else {
%>
@@ -434,12 +436,12 @@
<span class="courseName"> <%=cc.getCourseName()%></span></a></td>
<td><%=cc.getCourseDesc()%></td>
<td><%=df.format(cc.getCoursePostDate())%></td>
- <td>
+ <td style=\"text-align:center;\">
<a href="#" onClick="launchCourse('<%=cc.getCourseID()%>',true,'<%=cc.getCourseFrameFeatures(session.getServletContext())%>')">
<%
if (sButton != null) {
%>
- <img src="<%=sButton%>" width="72" height="24" border="0" alt=""/>
+ <img src="<%=sButton%>" height="24" border="0" alt=""/>
<%
} else {
%>
@@ -518,10 +520,15 @@
<%!
-public static String processCourseRow(HttpSession session, ILSSession ilsSession, UserProfile user, Course cc, List<Integer> inCurriculum, HashMap values, boolean supressCerts) {
+public static String processCourseRow(HttpSession session, ILSSession ilsSession, UserProfile user, Course cc, List<Integer> inCurriculum, HashMap values, boolean supressCerts, Course dependency) {
boolean retake = false;
StringBuffer out = new StringBuffer();
- List<CourseAttempt> cas = CourseAttempt.getUserCourseAttempts(ilsSession, user.getUserProfileID(), cc.getCourseID(), false);
+ boolean locked = false;
+ List<CourseAttempt> cas = (dependency != null) ? CourseAttempt.getUserCourseAttempts(ilsSession, user.getUserProfileID(), dependency.getCourseID(), false) : null;
+ if (cas == null || cas.size() == 0) locked = (dependency != null);
+ else locked = cas.get(0).getCourseAttemptStatusID() != CourseAttempt.STATUS_PASSED;
+System.out.println("course: " + cc.getCourseName() + "; dependency: " + (dependency != null ? dependency.getCourseName() : "null"));
+ cas = CourseAttempt.getUserCourseAttempts(ilsSession, user.getUserProfileID(), cc.getCourseID(), false);
CourseAttempt ca = null;
if (cas.size() == 0) {
// see if a past attempt exists
@@ -541,7 +548,7 @@
tDate = ca.getCourseAttemptCompleteDate();
values.put("enddate", tDate);
String endDate = (tDate != null) ? df.format(tDate) : "";
- String sButton = (retake) ? "images/retake_btn.gif" : "images/start_btn.gif";
+ String sButton = (locked) ? "images/locked.png" : (retake) ? "images/retake_btn.gif" : "images/start_btn.gif";
String score = "";
String btnText = "";
boolean finished = false;
@@ -549,7 +556,7 @@
switch (ca.getCourseAttemptStatusID()) {
case CourseAttempt.STATUS_IN_PROGRESS:
score = "<span class='inProgress'>In Progress</span>";
- sButton = "images/continue_but.jpg";
+ if (!locked) sButton = "images/continue_btn.jpg";
break;
case CourseAttempt.STATUS_PASSED:
values.put("score", ca.getCourseAttemptScore());
@@ -581,14 +588,15 @@
out.append("<td> " + timeFrame + " </td>");
out.append("<td> " + startDate + " </td>");
out.append("<td> " + endDate + " </td>");
- out.append("<td>");
- out.append(" <a href=\"#\" onClick=\"launchCourse('" + cc.getCourseID() + "',true,'" + cc.getCourseFrameFeatures(session.getServletContext()) + "')\">");
+ out.append("<td style=\"text-align:center;\">");
+ if (!locked) out.append(" <a href=\"#\" onClick=\"launchCourse('" + cc.getCourseID() + "',true,'" + cc.getCourseFrameFeatures(session.getServletContext()) + "')\">");
if (sButton != null) {
- out.append("<img src=\"" + sButton + "\" width=\"72\" height=\"24\" border=\"0\" alt=\"\"/>");
+ out.append("<img src=\"" + sButton + "\" height=\"24\" border=\"0\" alt=\"\"/>");
} else {
out.append(btnText);
}
- out.append("</a></td>");
+ if (!locked) out.append("</a></td>");
+ out.append("</td>");
out.append("<td class=\"centered\">");
if (finished && !supressCerts) {
String generator = cc.getCourseCertificateGenerator();
More information about the Ils-source
mailing list