Skip to content

Commit

Permalink
Added section column and dropdown list
Browse files Browse the repository at this point in the history
  • Loading branch information
steveswinsburg committed Jan 11, 2015
1 parent 2744993 commit ef1a970
Show file tree
Hide file tree
Showing 19 changed files with 282 additions and 81 deletions.
67 changes: 37 additions & 30 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,64 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<name>GradebookNG</name>
<description>The Next Generation Gradebook for the Sakai CLE</description>

<groupId>org.sakaiproject.gradebookng</groupId>
<artifactId>gradebookng</artifactId>
<version>1.0-SNAPSHOT</version>

<packaging>pom</packaging>

<parent>
<groupId>org.sakaiproject</groupId>
<artifactId>master</artifactId>
<version>11-SNAPSHOT</version>
<relativePath>../master/pom.xml</relativePath>
</parent>

<groupId>org.sakaiproject</groupId>
<artifactId>master</artifactId>
<version>11-SNAPSHOT</version>
<relativePath>../master/pom.xml</relativePath>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencyManagement>
<dependencies>

<!-- additional third party dependencies -->
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket</artifactId>
<version>6.16.0</version>
<type>pom</type>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-spring</artifactId>
<version>6.16.0</version>
</dependency>
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-inmethod-grid</artifactId>
<version>6.16.0</version>
</dependency>
<dependency>
<groupId>de.agilecoders.wicket</groupId>
<artifactId>wicket-bootstrap-core</artifactId>
<version>0.9.7</version>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-inmethod-grid</artifactId>
<version>6.16.0</version>
</dependency>
<dependency>
<groupId>de.agilecoders.wicket</groupId>
<artifactId>wicket-bootstrap-core</artifactId>
<version>0.9.7</version>
</dependency>
<dependency>
<groupId>de.agilecoders.wicket</groupId>
<artifactId>wicket-bootstrap-extensions</artifactId>
<version>0.9.7</version>
</dependency>

</dependencies>
</dependencyManagement>


<modules>
<module>tool</module>
</modules>
</project>
<modules>
<module>tool</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.zeroturnaround</groupId>
<artifactId>jrebel-maven-plugin</artifactId>
<version>1.1.5</version>
<executions>
<execution>
<id>generate-rebel-xml</id>
<phase>process-resources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
50 changes: 20 additions & 30 deletions tool/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,32 @@
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="src" path="src/resources" including="*.properties" excluding="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="var" path="M2_REPO/javax/inject/javax.inject/1/javax.inject-1.jar" sourcepath="M2_REPO/javax/inject/javax.inject/1/javax.inject-1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar" sourcepath="M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/inject/javax.inject/1/javax.inject-1.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-core/6.16.0/wicket-core-6.16.0.jar" sourcepath="M2_REPO/org/apache/wicket/wicket-core/6.16.0/wicket-core-6.16.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-util/6.17.0/wicket-util-6.17.0.jar" sourcepath="M2_REPO/org/apache/wicket/wicket-util/6.17.0/wicket-util-6.17.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-request/6.17.0/wicket-request-6.17.0.jar" sourcepath="M2_REPO/org/apache/wicket/wicket-request/6.17.0/wicket-request-6.17.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-spring/6.16.0/wicket-spring-6.16.0.jar" sourcepath="M2_REPO/org/apache/wicket/wicket-spring/6.16.0/wicket-spring-6.16.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-ioc/6.16.0/wicket-ioc-6.16.0.jar" sourcepath="M2_REPO/org/apache/wicket/wicket-ioc/6.16.0/wicket-ioc-6.16.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/cglib/cglib/2.2.2/cglib-2.2.2.jar" sourcepath="M2_REPO/cglib/cglib/2.2.2/cglib-2.2.2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-core/6.16.0/wicket-core-6.16.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-util/6.17.0/wicket-util-6.17.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-request/6.17.0/wicket-request-6.17.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-spring/6.16.0/wicket-spring-6.16.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-ioc/6.16.0/wicket-ioc-6.16.0.jar"/>
<classpathentry kind="var" path="M2_REPO/cglib/cglib/2.2.2/cglib-2.2.2.jar"/>
<classpathentry kind="var" path="M2_REPO/asm/asm/3.3.1/asm-3.3.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.7.5/slf4j-log4j12-1.7.5.jar" sourcepath="M2_REPO/org/slf4j/slf4j-log4j12/1.7.5/slf4j-log4j12-1.7.5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16.jar" sourcepath="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/projectlombok/lombok/1.12.4/lombok-1.12.4.jar" sourcepath="M2_REPO/org/projectlombok/lombok/1.12.4/lombok-1.12.4-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.7.5/slf4j-log4j12-1.7.5.jar"/>
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16.jar"/>
<classpathentry kind="var" path="M2_REPO/org/projectlombok/lombok/1.12.4/lombok-1.12.4.jar"/>
<classpathentry kind="var" path="M2_REPO/org/sakaiproject/kernel/sakai-kernel-api/11-SNAPSHOT/sakai-kernel-api-11-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/sakaiproject/kernel/sakai-component-manager/11-SNAPSHOT/sakai-component-manager-11-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/sakaiproject/kernel/sakai-kernel-util/11-SNAPSHOT/sakai-kernel-util-11-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/wicketstuff/wicketstuff-inmethod-grid/6.16.0/wicketstuff-inmethod-grid-6.16.0.jar" sourcepath="M2_REPO/org/wicketstuff/wicketstuff-inmethod-grid/6.16.0/wicketstuff-inmethod-grid-6.16.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-datetime/6.16.0/wicket-datetime-6.16.0.jar" sourcepath="M2_REPO/org/apache/wicket/wicket-datetime/6.16.0/wicket-datetime-6.16.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/wicketstuff/wicketstuff-inmethod-grid/6.16.0/wicketstuff-inmethod-grid-6.16.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-datetime/6.16.0/wicket-datetime-6.16.0.jar"/>
<classpathentry kind="var" path="M2_REPO/joda-time/joda-time/2.3/joda-time-2.3.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-extensions/6.16.0/wicket-extensions-6.16.0.jar" sourcepath="M2_REPO/org/apache/wicket/wicket-extensions/6.16.0/wicket-extensions-6.16.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/wicket/wicket-extensions/6.16.0/wicket-extensions-6.16.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/sakaiproject/edu-services/gradebook/gradebook-service-api/11-SNAPSHOT/gradebook-service-api-11-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/sakaiproject/edu-services/gradebook/gradebook-service-hibernate/11-SNAPSHOT/gradebook-service-hibernate-11-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.6/commons-lang-2.6.jar" sourcepath="M2_REPO/commons-lang/commons-lang/2.6/commons-lang-2.6-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.2/commons-logging-1.2.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.2/commons-logging-1.2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/sakaiproject/edu-services/course-management/coursemanagement-api/11-SNAPSHOT/coursemanagement-api-11-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.6/commons-lang-2.6.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.2/commons-logging-1.2.jar"/>
<classpathentry kind="var" path="M2_REPO/de/agilecoders/wicket/wicket-bootstrap-core/0.9.7/wicket-bootstrap-core-0.9.7.jar"/>
<classpathentry kind="var" path="M2_REPO/de/agilecoders/wicket/jquery-selectors/0.1.3/jquery-selectors-0.1.3.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/guava/guava/14.0.1/guava-14.0.1.jar"/>
Expand All @@ -44,17 +45,6 @@
<classpathentry kind="var" path="M2_REPO/org/webjars/modernizr/2.7.1/modernizr-2.7.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/de/agilecoders/maven/maven-parent-config/0.3.5/maven-parent-config-0.3.5.jar"/>
<classpathentry kind="var" path="M2_REPO/de/agilecoders/wicket/wicket-bootstrap-extensions/0.9.7/wicket-bootstrap-extensions-0.9.7.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/javascript/closure-compiler/v20130603/closure-compiler-v20130603.jar"/>
<classpathentry kind="var" path="M2_REPO/args4j/args4j/2.0.16/args4j-2.0.16.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/protobuf/protobuf-java/2.4.1/protobuf-java-2.4.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/json/json/20090211/json-20090211.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar"/>
<classpathentry kind="var" path="M2_REPO/org/webjars/jquerypp/1.0.1/jquerypp-1.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/webjars/jquery-ui/1.10.4/jquery-ui-1.10.4.jar"/>
<classpathentry kind="var" path="M2_REPO/org/webjars/typeaheadjs/0.10.4/typeaheadjs-0.10.4.jar"/>
<classpathentry kind="var" path="M2_REPO/org/webjars/x-editable-bootstrap/1.5.1/x-editable-bootstrap-1.5.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/webjars/spin-js/2.0.0/spin-js-2.0.0.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/4.11/junit-4.11.jar" sourcepath="M2_REPO/junit/junit/4.11/junit-4.11-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" sourcepath="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/4.11/junit-4.11.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
</classpath>
12 changes: 12 additions & 0 deletions tool/.project
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@
<comment>The Next Generation Gradebook for the Sakai CLE. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
<buildCommand>
<name>org.zeroturnaround.eclipse.rebelXmlBuilder</name>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.zeroturnaround.eclipse.jrebelNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>
4 changes: 4 additions & 0 deletions tool/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
encoding//src/java=UTF-8
encoding//src/resources=UTF-8
encoding/<project>=UTF-8
1 change: 1 addition & 0 deletions tool/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7
4 changes: 4 additions & 0 deletions tool/.settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
4 changes: 4 additions & 0 deletions tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
<groupId>org.sakaiproject.edu-services.gradebook</groupId>
<artifactId>gradebook-service-hibernate</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.edu-services.course-management</groupId>
<artifactId>coursemanagement-api</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ protected void init() {
//getApplicationSettings().setPageExpiredErrorPage(FirstPage.class);
//getApplicationSettings().setAccessDeniedPage(FirstPage.class);

/* this is mucking up the exception handling in Sakai and thorinw to a portalless page. Fix it.
getRequestCycleListeners().add(new IRequestCycleListener() {
//public void onBeginRequest() {
Expand Down Expand Up @@ -89,6 +90,7 @@ public void onRequestHandlerScheduled(RequestCycle arg0, IRequestHandler arg1) {
public void onUrlMapped(RequestCycle arg0,IRequestHandler arg1, Url arg2) {
}
});
*/

// bootstrap
//BootstrapSettings settings = new BootstrapSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ link.importexport.tooltip = Import / Export
link.permissions = Permissions
link.permissions.tooltip = Permissions

label.avg=Avg:
label.avg=Avg:

column.header.section = Section
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@
import lombok.extern.apachecommons.CommonsLog;

import org.apache.commons.lang.StringUtils;
import org.sakaiproject.coursemanagement.api.CourseManagementService;
import org.sakaiproject.coursemanagement.api.Enrollment;
import org.sakaiproject.coursemanagement.api.EnrollmentSet;
import org.sakaiproject.coursemanagement.api.Section;
import org.sakaiproject.coursemanagement.api.exception.IdNotFoundException;
import org.sakaiproject.entity.api.ResourceProperties;
import org.sakaiproject.entity.api.ResourcePropertiesEdit;
import org.sakaiproject.exception.IdUnusedException;
import org.sakaiproject.exception.PermissionException;
import org.sakaiproject.gradebookng.business.dto.GradebookUserPreferences;
import org.sakaiproject.gradebookng.tool.model.GradeInfo;
import org.sakaiproject.gradebookng.tool.model.StudentGrades;
import org.sakaiproject.gradebookng.tool.model.StudentGradeInfo;
import org.sakaiproject.service.gradebook.shared.AssessmentNotFoundException;
import org.sakaiproject.service.gradebook.shared.Assignment;
import org.sakaiproject.service.gradebook.shared.GradeDefinition;
Expand Down Expand Up @@ -56,6 +61,9 @@ public class GradebookNgBusinessService {
@Setter
private GradebookService gradebookService;

@Setter
private CourseManagementService courseManagementService;


/**
* Get a list of users in the current site that can have grades
Expand Down Expand Up @@ -184,7 +192,7 @@ public boolean saveGrade(final Long assignmentId, final String studentUuid, fina
* In the future this can be expanded to be given a list of students so we can do scrolling
* @return
*/
public List<StudentGrades> buildGradeMatrix() {
public List<StudentGradeInfo> buildGradeMatrix() {

List<User> students = this.getGradeableUsers();
List<Assignment> assignments = this.getGradebookAssignments();
Expand All @@ -194,28 +202,34 @@ public List<StudentGrades> buildGradeMatrix() {
//NOTES:
//a reorder of columns can happen client side and be saved as then any refresh is going to refetch the data and it will have the new order applied

List<StudentGrades> rval = new ArrayList<StudentGrades>();
List<StudentGradeInfo> rval = new ArrayList<StudentGradeInfo>();

Gradebook gradebook = this.getGradebook();
if(gradebook == null) {
return null;
}

//TODO this could be optimised to iterate the assignments instead, and pass the list of users and use getGradesForStudentsForItem,
//however the logic needs to be reqorked so we can capture the user info
//however the logic needs to be reworked so we can capture the user info
//currently storing the full grade definition too, this may be unnecessary
//NOT a high priority unless performance issue deems it to be

for(User student: students) {

StudentGrades sg = new StudentGrades(student);
StudentGradeInfo sg = new StudentGradeInfo(student);

//add the assignment grades
for(Assignment assignment: assignments) {
GradeDefinition gradeDefinition = gradebookService.getGradeDefinitionForStudentForItem(gradebook.getUid(), assignment.getId(), student.getId());
sg.addGrade(assignment.getId(), new GradeInfo(gradeDefinition));
}

//add the course grade
sg.setCourseGrade(courseGrades.get(student.getId()));

//add the section info
//this.courseManagementService.getSe

rval.add(sg);

}
Expand Down Expand Up @@ -274,6 +288,51 @@ public void saveUserPrefs (GradebookUserPreferences prefs) {

}

/**
* Get a list of sections
*
* @return
*/
public List<Section> getSiteSections() {
String siteId = this.getCurrentSiteId();

try {
Set<Section> sections = courseManagementService.getSections(siteId);
return new ArrayList<Section>(sections);
} catch (IdNotFoundException e) {
//if not a course site or no sections
return Collections.emptyList();
}


}

/**
* Get a list of section memberships for the users in the site
* @return
*/
public List<String> getSectionMemberships() {

List<Section> sections = getSiteSections();
for(Section s: sections) {
EnrollmentSet enrollmentSet = s.getEnrollmentSet();

Set<Enrollment> enrollments = courseManagementService.getEnrollments(enrollmentSet.getEid());
for(Enrollment e: enrollments) {

//need to create a DTO for this

//a user can be in multiple sections, need a list of sections per user

//s.getTitle(); section title
//e.getUserId(); user uuid
}
}

return null;

}


/**
* Helper to get siteid
Expand Down
Loading

0 comments on commit ef1a970

Please sign in to comment.