Skip to content
Snippets Groups Projects
Commit 46380a69 authored by srosse's avatar srosse
Browse files

OO-176: make the portfolio assessment/results looks like the others assessment course nodes

parent 8913e558
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,6 @@ import org.olat.core.gui.UserRequest; ...@@ -29,7 +29,6 @@ import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.form.flexible.FormItem; import org.olat.core.gui.components.form.flexible.FormItem;
import org.olat.core.gui.components.form.flexible.FormItemContainer; import org.olat.core.gui.components.form.flexible.FormItemContainer;
import org.olat.core.gui.components.form.flexible.elements.FormLink; import org.olat.core.gui.components.form.flexible.elements.FormLink;
import org.olat.core.gui.components.form.flexible.elements.SpacerElement;
import org.olat.core.gui.components.form.flexible.elements.StaticTextElement; import org.olat.core.gui.components.form.flexible.elements.StaticTextElement;
import org.olat.core.gui.components.form.flexible.impl.FormBasicController; import org.olat.core.gui.components.form.flexible.impl.FormBasicController;
import org.olat.core.gui.components.form.flexible.impl.FormEvent; import org.olat.core.gui.components.form.flexible.impl.FormEvent;
...@@ -37,7 +36,6 @@ import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer; ...@@ -37,7 +36,6 @@ import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer;
import org.olat.core.gui.components.link.Link; import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.control.Controller; import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.WindowControl;
import org.olat.core.id.IdentityEnvironment;
import org.olat.core.id.OLATResourceable; import org.olat.core.id.OLATResourceable;
import org.olat.core.id.context.BusinessControl; import org.olat.core.id.context.BusinessControl;
import org.olat.core.id.context.BusinessControlFactory; import org.olat.core.id.context.BusinessControlFactory;
...@@ -46,6 +44,7 @@ import org.olat.core.util.Formatter; ...@@ -46,6 +44,7 @@ import org.olat.core.util.Formatter;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.core.util.resource.OresHelper; import org.olat.core.util.resource.OresHelper;
import org.olat.course.CourseModule; import org.olat.course.CourseModule;
import org.olat.course.assessment.AssessmentHelper;
import org.olat.course.assessment.AssessmentManager; import org.olat.course.assessment.AssessmentManager;
import org.olat.course.nodes.PortfolioCourseNode; import org.olat.course.nodes.PortfolioCourseNode;
import org.olat.course.nodes.portfolio.PortfolioCourseNodeConfiguration.DeadlineType; import org.olat.course.nodes.portfolio.PortfolioCourseNodeConfiguration.DeadlineType;
...@@ -84,6 +83,8 @@ public class PortfolioCourseNodeRunController extends FormBasicController { ...@@ -84,6 +83,8 @@ public class PortfolioCourseNodeRunController extends FormBasicController {
private FormLink newMapLink; private FormLink newMapLink;
private FormLink selectMapLink; private FormLink selectMapLink;
private StaticTextElement newMapMsgEl; private StaticTextElement newMapMsgEl;
private FormLayoutContainer infosContainer;
private FormLayoutContainer assessmentInfosContainer;
private Formatter formatter; private Formatter formatter;
...@@ -93,7 +94,7 @@ public class PortfolioCourseNodeRunController extends FormBasicController { ...@@ -93,7 +94,7 @@ public class PortfolioCourseNodeRunController extends FormBasicController {
public PortfolioCourseNodeRunController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv, public PortfolioCourseNodeRunController(UserRequest ureq, WindowControl wControl, UserCourseEnvironment userCourseEnv,
NodeEvaluation ne, PortfolioCourseNode courseNode) { NodeEvaluation ne, PortfolioCourseNode courseNode) {
super(ureq, wControl); super(ureq, wControl, "run");
this.courseNode = courseNode; this.courseNode = courseNode;
this.config = courseNode.getModuleConfiguration(); this.config = courseNode.getModuleConfiguration();
...@@ -115,9 +116,19 @@ public class PortfolioCourseNodeRunController extends FormBasicController { ...@@ -115,9 +116,19 @@ public class PortfolioCourseNodeRunController extends FormBasicController {
@Override @Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
infosContainer = FormLayoutContainer.createDefaultFormLayout("infos", getTranslator());
formLayout.add(infosContainer);
String assessmentPage = velocity_root + "/assessment_infos.html";
assessmentInfosContainer = FormLayoutContainer.createCustomFormLayout("assessmentInfos", getTranslator(), assessmentPage);
assessmentInfosContainer.setVisible(false);
formLayout.add(assessmentInfosContainer);
Object text = config.get(PortfolioCourseNodeConfiguration.NODE_TEXT); Object text = config.get(PortfolioCourseNodeConfiguration.NODE_TEXT);
String explanation = (text instanceof String) ? (String)text : ""; String explanation = (text instanceof String) ? (String)text : "";
uifactory.addStaticTextElement("explanation.text", explanation, flc); if(StringHelper.containsNonWhitespace(explanation)) {
uifactory.addStaticTextElement("explanation.text", explanation, infosContainer);
}
String deadlineconfig = (String)config.get(PortfolioCourseNodeConfiguration.DEADLINE_TYPE); String deadlineconfig = (String)config.get(PortfolioCourseNodeConfiguration.DEADLINE_TYPE);
if (!DeadlineType.none.name().equals(deadlineconfig) && deadlineconfig!=null){ if (!DeadlineType.none.name().equals(deadlineconfig) && deadlineconfig!=null){
...@@ -130,7 +141,7 @@ public class PortfolioCourseNodeRunController extends FormBasicController { ...@@ -130,7 +141,7 @@ public class PortfolioCourseNodeRunController extends FormBasicController {
} else { } else {
deadLineInfo = getDeadlineRelativeInfo(); deadLineInfo = getDeadlineRelativeInfo();
} }
deadlineDateText = uifactory.addStaticTextElement("deadline", deadLineLabel, deadLineInfo, formLayout); deadlineDateText = uifactory.addStaticTextElement("deadline", deadLineLabel, deadLineInfo, infosContainer);
} }
if(template != null) { if(template != null) {
...@@ -159,19 +170,19 @@ public class PortfolioCourseNodeRunController extends FormBasicController { ...@@ -159,19 +170,19 @@ public class PortfolioCourseNodeRunController extends FormBasicController {
String title = template.getTitle(); String title = template.getTitle();
String msg = translate("map.available", new String[]{ title }); String msg = translate("map.available", new String[]{ title });
if(newMapMsgEl == null) { if(newMapMsgEl == null) {
newMapMsgEl = uifactory.addStaticTextElement("map.available", msg, flc); newMapMsgEl = uifactory.addStaticTextElement("map.available", msg, infosContainer);
} }
newMapMsgEl.setLabel(null, null); newMapMsgEl.setLabel(null, null);
FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator()); FormLayoutContainer buttonGroupLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
buttonGroupLayout.setRootForm(mainForm); buttonGroupLayout.setRootForm(mainForm);
flc.add(buttonGroupLayout); infosContainer.add(buttonGroupLayout);
if(newMapLink == null) { if(newMapLink == null) {
newMapLink = uifactory.addFormLink("map.new", buttonGroupLayout, Link.BUTTON); newMapLink = uifactory.addFormLink("map.new", buttonGroupLayout, Link.BUTTON);
} }
} else { } else {
if(selectMapLink == null) { if(selectMapLink == null) {
selectMapLink = uifactory.addFormLink("select", "select.mymap", "select.mymap", flc, Link.LINK); selectMapLink = uifactory.addFormLink("select", "select.mymap", "select.mymap", infosContainer, Link.LINK);
} else { } else {
selectMapLink.setVisible(true); selectMapLink.setVisible(true);
} }
...@@ -182,33 +193,49 @@ public class PortfolioCourseNodeRunController extends FormBasicController { ...@@ -182,33 +193,49 @@ public class PortfolioCourseNodeRunController extends FormBasicController {
String copyDate = ""; String copyDate = "";
if(structuredMap.getCopyDate() != null) { if(structuredMap.getCopyDate() != null) {
copyDate = formatter.formatDateAndTime(structuredMap.getCopyDate()); copyDate = formatter.formatDateAndTime(structuredMap.getCopyDate());
uifactory.addStaticTextElement("map.copyDate", copyDate, flc); uifactory.addStaticTextElement("map.copyDate", copyDate, infosContainer);
} }
String returnDate = ""; String returnDate = "";
if(structuredMap.getReturnDate() != null) { if(structuredMap.getReturnDate() != null) {
returnDate = formatter.formatDateAndTime(structuredMap.getReturnDate()); returnDate = formatter.formatDateAndTime(structuredMap.getReturnDate());
uifactory.addStaticTextElement("map.returnDate", returnDate, flc); uifactory.addStaticTextElement("map.returnDate", returnDate, infosContainer);
SpacerElement spacer = uifactory.addSpacerElement("space", flc, false);
// show rating
// create an identenv with no roles, no attributes, no locale
IdentityEnvironment ienv = new IdentityEnvironment();
ienv.setIdentity(getIdentity());
// Fetch all score and passed and calculate score accounting for the entire course // Fetch all score and passed and calculate score accounting for the entire course
ScoreAccounting scoreAccounting = userCourseEnv.getScoreAccounting(); ScoreAccounting scoreAccounting = userCourseEnv.getScoreAccounting();
scoreAccounting.evaluateAll(); scoreAccounting.evaluateAll();
ScoreEvaluation scoreEval = scoreAccounting.evalCourseNode(courseNode); ScoreEvaluation scoreEval = scoreAccounting.evalCourseNode(courseNode);
Float score = scoreEval.getScore();
if (score != null) uifactory.addStaticTextElement("map.score", String.valueOf(score), flc); //score
Boolean passed = scoreEval.getPassed(); assessmentInfosContainer.contextPut("hasScoreField", new Boolean(courseNode.hasScoreConfigured()));
if (passed==null) uifactory.addStaticTextElement("map.not.rated.yet", "", flc); if(courseNode.hasScoreConfigured()) {
else if (passed) uifactory.addStaticTextElement("map.passed", "", flc); Float score = scoreEval.getScore();
else uifactory.addStaticTextElement("map.not.passed", "", flc); Float minScore = courseNode.getMinScoreConfiguration();
Float maxScore = courseNode.getMaxScoreConfiguration();
assessmentInfosContainer.contextPut("scoreMin", AssessmentHelper.getRoundedScore(minScore));
assessmentInfosContainer.contextPut("scoreMax", AssessmentHelper.getRoundedScore(maxScore));
assessmentInfosContainer.contextPut("score", AssessmentHelper.getRoundedScore(score));
}
//passed
assessmentInfosContainer.contextPut("hasPassedField", new Boolean(courseNode.hasPassedConfigured()));
if(courseNode.hasPassedConfigured()) {
Boolean passed = scoreEval.getPassed();
assessmentInfosContainer.contextPut("passed", passed);
assessmentInfosContainer.contextPut("hasPassedValue", new Boolean(passed != null));
Float cutValue = courseNode.getCutValueConfiguration();
assessmentInfosContainer.contextPut("passedCutValue", AssessmentHelper.getRoundedScore(cutValue));
}
// get comment // get comment
AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager(); AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager();
String comment = am.getNodeComment(courseNode, getIdentity()); String comment = am.getNodeComment(courseNode, getIdentity());
if (comment != null) uifactory.addStaticTextElement("map.comment", comment, flc); assessmentInfosContainer.contextPut("hasCommentField", new Boolean(comment != null));
if (comment != null) {
assessmentInfosContainer.contextPut("comment", comment);
}
assessmentInfosContainer.setVisible(true);
} else {
assessmentInfosContainer.setVisible(false);
} }
// show absolute deadline when task is taken. nothing if taken map still has a deadline configured. // show absolute deadline when task is taken. nothing if taken map still has a deadline configured.
if (deadlineDateText != null && structuredMap.getDeadLine() != null) { if (deadlineDateText != null && structuredMap.getDeadLine() != null) {
......
<div class="o_course_run_scoreinfo">
#if ($hasScoreField)
<h4>$r.translate("score.title")</h4>
<table>
<tbody>
<tr>
<td>
$r.translate("score.min"):
</td>
<td>
$scoreMin
</td>
</tr>
<tr>
<td>
$r.translate("score.max"):
</td>
<td>
$scoreMax
</td>
</tr>
<tr>
<td>
$r.translate("score.yourscore"):
</td>
<td>
#if($score)
$score
#else
<div class="o_course_run_scoreinfo_noinfo">$r.translate("score.noscore")</div>
#end
</td>
</tr>
</tbody>
</table>
#end
#if ($hasPassedField)
<h4>$r.translate("passed.title")</h4>
<table>
<tbody>
#if ($passedCutValue)
<tr>
<td>
$r.translate("passed.cut"):
</td>
<td>
$passedCutValue
</td>
</tr>
#end
<tr>
<td>
$r.translate("passed.yourpassed"):
</td>
<td>
#if($hasPassedValue && $passed == true)
<span class="o_passed">$r.translate("map.passed")</span>
#elseif($hasPassedValue && $passed == false)
<span class="o_notpassed">$r.translate("map.not.passed")</span>
#else
<div class="o_course_run_scoreinfo_noinfo">$r.translate("map.not.rated.yet")</div>
#end
</td>
</tr>
</tbody>
</table>
#end
#if ($hasCommentField)
<h4>$r.translate("map.comment")</h4>
#if ($comment)
$comment
#else
<div class="o_course_run_scoreinfo_noinfo">$r.translate("comment.nocomment")</div>
#end
#end
</div>
\ No newline at end of file
$r.render("infos")
$r.render("assessmentInfos")
\ No newline at end of file
...@@ -60,4 +60,12 @@ chelp.ced_portfolio_task.deadline3=Um f ...@@ -60,4 +60,12 @@ chelp.ced_portfolio_task.deadline3=Um f
chelp.ced_portfolio_task.message1=Mitteilung an Benutzer chelp.ced_portfolio_task.message1=Mitteilung an Benutzer
chelp.ced_portfolio_task.message2=Geben Sie hier einen Text ein, der allen Kursteilnehmern angezeigt wird, wenn sie den Kursbaustein anklicken. chelp.ced_portfolio_task.message2=Geben Sie hier einen Text ein, der allen Kursteilnehmern angezeigt wird, wenn sie den Kursbaustein anklicken.
no.map=Dieser Benutzer hat noch keine Portfolioaufgabe abgeholt. no.map=Dieser Benutzer hat noch keine Portfolioaufgabe abgeholt.
pane.tab.accessibility=Zugang pane.tab.accessibility=Zugang
\ No newline at end of file score.title=$org.olat.course.nodes.ms\:score.title
score.min=$org.olat.course.nodes.ms\:score.min
score.max=$org.olat.course.nodes.ms\:score.max
score.yourscore=$org.olat.course.nodes.ms\:score.yourscore
score.noscore=$org.olat.course.nodes.ms\:score.noscore
passed.cut=$org.olat.course.nodes.ms\:passed.cut
passed.title=$org.olat.course.nodes.ms\:passed.title
passed.yourpassed=$org.olat.course.nodes.ms\:passed.yourpassed
\ No newline at end of file
...@@ -54,6 +54,14 @@ pane.tab.portfolio_config=Learning content ...@@ -54,6 +54,14 @@ pane.tab.portfolio_config=Learning content
pane.tab.portfolio_config.explanation=Configure portfolio task pane.tab.portfolio_config.explanation=Configure portfolio task
pane.tab.portfolio_config.title=Select or create portfolio template pane.tab.portfolio_config.title=Select or create portfolio template
pane.tab.portfolio_scoring=Assessment pane.tab.portfolio_scoring=Assessment
score.title=$org.olat.course.nodes.ms\:score.title
score.min=$org.olat.course.nodes.ms\:score.min
score.max=$org.olat.course.nodes.ms\:score.max
score.yourscore=$org.olat.course.nodes.ms\:score.yourscore
score.noscore=$org.olat.course.nodes.ms\:score.noscore
passed.cut=$org.olat.course.nodes.ms\:passed.cut
passed.title=$org.olat.course.nodes.ms\:passed.title
passed.yourpassed=$org.olat.course.nodes.ms\:passed.yourpassed
select.map=Replace portfolio template select.map=Replace portfolio template
select.map2=Select portfolio template select.map2=Select portfolio template
select.mymap=Portfolio task collected select.mymap=Portfolio task collected
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment