diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..4d4343b4206217046fcdc6b5838219a1ac147a24 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright (c) 2006 University of Nebraska-Lincoln + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.txt b/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..0db4bbe6eeb6c7a9dfe4be31ed49fecbed713880 --- /dev/null +++ b/README.txt @@ -0,0 +1,22 @@ +Course Migration Blackboard Module + +This is a Blackboard module designed to display a list of courses that an +instructor can choose from to request migration to the replacement server. + +Project Directory Structure + +The project is set up to build using Ant. The primary build +configuration is in the "build.xml" file. + +/ project root +/lib Java libraries needed for build or run-time +/src Source files for any unique Java classes used in this project +/web JSP, HTML, CSS, JavaScript or other web files or templates +/conf App configuration files such as web.xml +/config Taglibs directory used by Bb building block +/build Dynamically created data generated by Ant build targets. + +Important build targets: + +webapp Builds the webapp directory structure in /build/webapp. +war Creates a deployable WAR file. diff --git a/build.properties b/build.properties new file mode 100644 index 0000000000000000000000000000000000000000..cdeabe0b9162304d249f64feb277489b50ab182d --- /dev/null +++ b/build.properties @@ -0,0 +1,12 @@ +bb-platform.jar= +bb-taglibs.jar= +tomcat_common_lib.dir= +tomcat_server_lib.dir= +commons-logging-api.jar= +jstl.jar= +standard.jar= + +#starting block parameters for testing -- only needed for deploytotest target +testuser= +testpasswd= +testhost= diff --git a/build.xml b/build.xml new file mode 100644 index 0000000000000000000000000000000000000000..c6eed10cec8e1149a190b2c58d43779e1950be5f --- /dev/null +++ b/build.xml @@ -0,0 +1,114 @@ +<project name="crs_migrate_bb" default="war" basedir="."> + + <!-- Set some project variables and parameters --> + <!-- build.properties for local config customizations --> + <property file="build.properties" /> + <property name="warname" value="crs_migrate_bb.war" /> + <property name="src.dir" value="src" /> + <property name="conf.dir" value="conf" /> + <property name="build.dir" value="build" /> + <property name="webapp.dir" value="${build.dir}/webapp" /> + <property name="classes.dir" value="${webapp.dir}/WEB-INF/classes" /> + <property name="lib.dir" value="lib" /> + <property name="web_root.dir" value="web" /> + <property name="taglib.dir" value="config" /> + + <path id="classes-build-classpath"> + <pathelement location="${lib.dir}" /> + <pathelement location="${bb-platform.jar}" /> + <pathelement location="${bb-taglibs.jar}" /> + <pathelement location="${jstl.jar}" /> + <pathelement location="${standard.jar}" /> + <pathelement location="${commons-logging-api.jar}" /> + <fileset dir="${tomcat_common_lib.dir}"> + <include name="*.jar" /> + </fileset> + <fileset dir="${tomcat_server_lib.dir}"> + <include name="*.jar" /> + </fileset> + </path> + + <path id="jsp-build-classpath"> + <path refid="classes-build-classpath" /> + <pathelement location="${classes.dir}" /> + </path> + + + <!-- Remove all compiled and built components --> + <target name="clean"> + <delete dir="${classes.dir}" /> + <delete dir="${build.dir}" /> + </target> + + <target name="build_prep"> + <mkdir dir="${build.dir}" /> + <mkdir dir="${webapp.dir}" /> + </target> + + <!-- Compile local Java source files into class files. --> + <target name="compile_java_classes" depends="build_prep"> + <mkdir dir="${classes.dir}" /> + <javac srcdir="${src.dir}" destdir="${classes.dir}" /> + </target> + + <!-- define jasper (tomcat jsp compiler) task since the built-in jspc task doesn't work --> + <taskdef classname="org.apache.jasper.JspC" name="jasper2"> + <classpath refid="jsp-build-classpath" /> + </taskdef> + + <!-- compile JSP to syntax check --> + <target name="compile_jsp" depends="webapp"> + <mkdir dir="${build.dir}/jasper_java" /> + <mkdir dir="${build.dir}/jasper_classes" /> + + <jasper2 verbose="9" outputDir="${build.dir}/jasper_java" uriroot="${webapp.dir}"/> + + <!-- build the generated servlet code --> + <javac srcdir="${build.dir}/jasper_java" destdir="${build.dir}/jasper_classes"> + <classpath refid="jsp-build-classpath" /> + </javac> + </target> + + <!-- Create the webapp directory structure in the build directory --> + <target name="webapp" depends="compile_java_classes"> + <!-- copy config --> + <copy todir="${webapp.dir}/WEB-INF" file="${conf.dir}/web.xml" /> + <copy todir="${webapp.dir}/WEB-INF" file="${conf.dir}/bb-manifest.xml" /> + <copy todir="${webapp.dir}/META-INF" file="${conf.dir}/MANIFEST.MF" /> + <!-- copy web content --> + <copy todir="${webapp.dir}"> + <fileset dir="${web_root.dir}" /> + </copy> + <!-- copy libs --> + <copy todir="${webapp.dir}/WEB-INF/lib"> + <fileset dir="${lib.dir}" /> + </copy> + <copy todir="${webapp.dir}/WEB-INF/config"> + <fileset dir="${taglib.dir}" /> + </copy> + + </target> + + <!-- Build the WAR file for deployment to server --> + <target name="war" depends="compile_java_classes"> + <war destfile="${build.dir}/${warname}" webxml="${conf.dir}/web.xml" manifest="${conf.dir}/MANIFEST.MF"> + <!-- copy docroot --> + <fileset dir="${web_root.dir}" /> + <!-- copy classes --> + <classes dir="${classes.dir}" /> + <!-- copy libs --> + <lib dir="${lib.dir}" /> + <!-- insert the Blackboard manifest --> + <webinf file="${conf.dir}/bb-manifest.xml" /> + <!-- include the confg directory (taglibs) --> + <webinf dir="." includes="config/" /> + </war> + </target> + + <!-- deploy to test servers (requires the starting block building block) --> + <target name="deploytotest" depends="war"> + <scp file="${build.dir}/${warname}" todir="${testuser}:${testpasswd}@${testhost}:/tmp/" /> + <get src="http://${testhost}/webapps/bb-starting-block-bb_bb60/execute/install?fileName=/tmp/${warname}&clean=true&available=true" dest="${build.dir}/deploytotest_response" /> + </target> + +</project> diff --git a/conf/MANIFEST.MF b/conf/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..2f4b56835b31b2d541d1edbb0aee718d72852d0e --- /dev/null +++ b/conf/MANIFEST.MF @@ -0,0 +1 @@ +Manifest-Version: 1.0 diff --git a/conf/bb-manifest.xml b/conf/bb-manifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..5ffcd05347bab516837be33dd49a88574d5c6fc4 --- /dev/null +++ b/conf/bb-manifest.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<manifest> + <plugin> + <name value="Courses to Migrate Module"/> + <handle value="crs_migrate_bb"/> + <description value="Displays a list of courses the user is Instructing and allows them to designate the ones to be migrated to the new server."/> + <version value="0.1"/> + + <requires> + <bbversion value="8.0.0"/> + </requires> + + <vendor> + <id value="unl"/> + <name value="University of Nebraska-Lincoln"/> + <url value="http://www.unl.edu/" /> + <description value="UNL" /> + </vendor> + + <module-defs> + <module-type ext-ref="course_migrate" title="Courses to Migrate" uicreatable="false"> + <jsp-dir>module</jsp-dir> + <jsp> + <view>view.jsp</view> + </jsp> + </module-type> + + <module type="course_migrate" isadmin="false" useraddable="false" isdeletable="false" isdetachable="false" title="Courses to Migrate"> + <description>Displays a list of courses the user is instructing so that they may designate the ones that should be migrated to the new server.</description> + <ExtraInfo /> + </module> + </module-defs> + + <permissions> + <permission type="attribute" name="user.authinfo" actions="get"/> + <permission type="runtime" name="db.connection.*"/> + </permissions> + + </plugin> +</manifest> diff --git a/conf/web.xml b/conf/web.xml new file mode 100644 index 0000000000000000000000000000000000000000..25ec78649f0689ec385c9d2caa2bc98fca38290a --- /dev/null +++ b/conf/web.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app version="2.5" + xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee + http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> + + <display-name>AppDisplayName</display-name> + <jsp-config> + + + </jsp-config> + +</web-app> diff --git a/web/module/view.jsp b/web/module/view.jsp new file mode 100644 index 0000000000000000000000000000000000000000..54e5449a7052e287db6862d824af20ed663420ca --- /dev/null +++ b/web/module/view.jsp @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" %> + +<%@ page import="java.io.PrintWriter" %> +<%@ page import="java.sql.Connection" %> + +<%@ page import="blackboard.base.BbList" %> +<%@ page import="blackboard.data.course.Course" %> +<%@ page import="blackboard.data.course.CourseMembership" %> +<%@ page import="blackboard.db.ConnectionManager" %> +<%@ page import= "blackboard.platform.session.*" %> +<%@ page import="blackboard.persist.course.CourseDbLoader" %> + +<%@ taglib uri="/bbUI" prefix="bbUI" %> +<%@ taglib uri="/bbData" prefix="bbData"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + +<bbData:context id="ctx"> +<% +BbList.Iterator coursesInstructingIterator = null; + +ConnectionManager connectionManager = ConnectionManager.getDefaultInstance(); +Connection dbConnection = connectionManager.getConnection(); +try{ + CourseDbLoader cLoader = (CourseDbLoader) CourseDbLoader.Default.getInstance(); + BbList coursesInstructing = cLoader.loadByUserIdAndCourseMembershipRole(ctx.getUser().getId(), CourseMembership.Role.INSTRUCTOR, dbConnection); + coursesInstructingIterator = coursesInstructing.getFilteringIterator(); +} +catch(Exception e){ + e.printStackTrace(new PrintWriter(out)); +} + +dbConnection.close(); + +//pageContext.setAttribute("courses", coursesInstructingIterator); +%> +<p>Specify the courses that should be migrated to the new Blackboard server. Migrations will be scheduled to occur overnight. Once a course has been migrated, it will no longer appear in this list.</p> +<form> +<%-- + <ul> + <c:forEach var="courses" items="${courses}"> + <li>${course.courseId} ${course.title}</li> + </c:forEach> + </ul> +--%> + <ul> + <% + while(coursesInstructingIterator.hasNext()){ + Course course = (Course) coursesInstructingIterator.next(); + %> + <li><input type="checkbox" id="migrate_<%= course.getCourseId() %>" value="migrate_<%= course.getCourseId() %>"><label for=""><%= course.getCourseId() %> <%= course.getTitle() %></label></li> + <% + } + %> + </ul> + <input type="submit" value="Mark Selected Courses for Migration"> +</form> +</bbData:context>