forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAK-42905 Gradebook add ability to have comments for the course grade (…
…sakaiproject#10807) Co-authored-by: jkozar2 <moronzac@moronzac-hpzbook15g2>
- Loading branch information
Showing
19 changed files
with
421 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...tool/src/java/org/sakaiproject/gradebookng/tool/actions/EditCourseGradeCommentAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package org.sakaiproject.gradebookng.tool.actions; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.apache.wicket.ajax.AjaxRequestTarget; | ||
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; | ||
import org.apache.wicket.model.Model; | ||
import org.sakaiproject.gradebookng.tool.model.GbModalWindow; | ||
import org.sakaiproject.gradebookng.tool.pages.GradebookPage; | ||
import org.sakaiproject.gradebookng.tool.panels.EditCourseGradeCommentPanel; | ||
import org.sakaiproject.gradebookng.business.GradebookNgBusinessService; | ||
|
||
import java.io.Serializable; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class EditCourseGradeCommentAction extends InjectableAction implements Serializable{ | ||
private class EmptyOkResponse implements ActionResponse { | ||
public EmptyOkResponse() { | ||
} | ||
|
||
public String getStatus() { | ||
return "OK"; | ||
} | ||
|
||
public String toJson() { | ||
return "{}"; | ||
} | ||
} | ||
|
||
@Override | ||
public ActionResponse handleEvent(final JsonNode params, final AjaxRequestTarget target) { | ||
final String courseGradeId = params.get("courseGradeId").asText(); | ||
final String studentUuid = params.get("studentId").asText(); | ||
final String gradebookId = params.get("gradebookId").asText(); | ||
final Map<String, Object> model = new HashMap<>(); | ||
model.put("courseGradeId", Long.valueOf(courseGradeId)); | ||
model.put("studentUuid", studentUuid); | ||
model.put("gradebookId", Long.valueOf(gradebookId)); | ||
final GradebookPage gradebookPage = (GradebookPage) target.getPage(); | ||
final GbModalWindow window = gradebookPage.getGradeCommentWindow(); | ||
final EditCourseGradeCommentPanel panel = new EditCourseGradeCommentPanel(window.getContentId(), Model.ofMap(model), window); | ||
window.setContent(panel); | ||
window.showUnloadConfirmation(false); | ||
window.clearWindowClosedCallbacks(); | ||
window.setAssignmentToReturnFocusTo(courseGradeId); | ||
window.setStudentToReturnFocusTo(studentUuid); | ||
window.addWindowClosedCallback(new ModalWindow.WindowClosedCallback() { | ||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public void onClose(final AjaxRequestTarget target) { | ||
final String comment = panel.getComment(); | ||
target.appendJavaScript( | ||
String.format("GbGradeTable.updateCourseGradeComment('%s', '%s', '%s');", | ||
courseGradeId, | ||
studentUuid, | ||
comment == null ? "" : comment)); | ||
} | ||
}); | ||
window.show(target); | ||
return new EditCourseGradeCommentAction.EmptyOkResponse(); | ||
} | ||
|
||
public boolean hasCourseGradeComment(final String studentId, final Long courseGradeId, final Long gradebookId){ | ||
GradebookNgBusinessService businessService = new GradebookNgBusinessService(); | ||
String comment = businessService.getAssignmentGradeComment(gradebookId.toString(),courseGradeId.longValue(),studentId); | ||
if(StringUtils.isBlank(comment)){ | ||
return false; | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...g/tool/src/java/org/sakaiproject/gradebookng/tool/panels/EditCourseGradeCommentPanel.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html xmlns:wicket="http://wicket.apache.org"> | ||
<body> | ||
<wicket:panel> | ||
<form class="form-vertical" wicket:id="form"> | ||
<textarea wicket:id="comment" rows="4" class="form-control form-group"></textarea> | ||
<div class=""> | ||
<input type="submit" wicket:id="submit" wicket:message="value:button.savecomment" /> | ||
<input type="submit" wicket:id="cancel" wicket:message="value:button.cancel" /> | ||
</div> | ||
</form> | ||
</wicket:panel> | ||
</body> | ||
</html> |
Oops, something went wrong.