Skip to content
Snippets Groups Projects
Commit f3fa8c88 authored by Florian Gnägi's avatar Florian Gnägi
Browse files

OO-3304 add hover texts to QM class icons

parent 01970971
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
*/ */
package org.olat.modules.forms.ui; package org.olat.modules.forms.ui;
import org.apache.commons.lang.StringEscapeUtils;
import org.olat.core.CoreSpringFactory; import org.olat.core.CoreSpringFactory;
import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer; import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer;
import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableComponent; import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableComponent;
...@@ -49,28 +50,33 @@ public class RubricAvgRenderer implements FlexiCellRenderer { ...@@ -49,28 +50,33 @@ public class RubricAvgRenderer implements FlexiCellRenderer {
URLBuilder ubu, Translator translator) { URLBuilder ubu, Translator translator) {
if (cellValue instanceof Double) { if (cellValue instanceof Double) {
Double value = (Double) cellValue; Double value = (Double) cellValue;
render(target, value); render(target, value, translator);
} }
} }
public String render(Double avg) { public String render(Double avg, Translator translator) {
StringOutput target = new StringOutput(); StringOutput target = new StringOutput();
render(target, avg); render(target, avg, translator);
return target.toString(); return target.toString();
} }
private void render(StringOutput target, Double value) { private void render(StringOutput target, Double value, Translator translator) {
EvaluationFormManager evaluationFormManager = CoreSpringFactory.getImpl(EvaluationFormManager.class);
RubricRating rating = evaluationFormManager.getRubricRating(rubric, value);
target.append("<div class='o_rubric_avg o_nowrap "); target.append("<div class='o_rubric_avg o_nowrap ");
target.append(getRatingCssClass(rubric, value)); String ratingCss = getRatingCssClass(rating);
target.append(ratingCss, ratingCss != null);
target.append("'>"); target.append("'>");
target.append("<i class='o_icon o_icon-fw ").append(getRatingIconCssClass(rubric, value)).append("'> </i> "); if (ratingCss != null) {
target.append("<i class='o_icon o_icon-fw ").append(getRatingIconCssClass(rating)).append("' title=\"");
target.append(StringEscapeUtils.escapeHtml(getRatingIconExplanation(rating, rubric, translator))).append("\"> </i> ");
}
target.append(EvaluationFormFormatter.formatDouble(value)); target.append(EvaluationFormFormatter.formatDouble(value));
target.append("</div>"); target.append("</div>");
} }
public static String getRatingCssClass(Rubric rubric, Double value) { public static String getRatingCssClass(RubricRating rating) {
EvaluationFormManager evaluationFormManager = CoreSpringFactory.getImpl(EvaluationFormManager.class);
RubricRating rating = evaluationFormManager.getRubricRating(rubric, value);
switch (rating) { switch (rating) {
case SUFFICIENT: return "o_rubric_sufficient"; case SUFFICIENT: return "o_rubric_sufficient";
case NEUTRAL: return "o_rubric_neutral"; case NEUTRAL: return "o_rubric_neutral";
...@@ -78,10 +84,8 @@ public class RubricAvgRenderer implements FlexiCellRenderer { ...@@ -78,10 +84,8 @@ public class RubricAvgRenderer implements FlexiCellRenderer {
default: return null; default: return null;
} }
} }
public static String getRatingIconCssClass(Rubric rubric, Double value) { public static String getRatingIconCssClass(RubricRating rating) {
EvaluationFormManager evaluationFormManager = CoreSpringFactory.getImpl(EvaluationFormManager.class);
RubricRating rating = evaluationFormManager.getRubricRating(rubric, value);
switch (rating) { switch (rating) {
case SUFFICIENT: return "o_icon_rubric_sufficient"; case SUFFICIENT: return "o_icon_rubric_sufficient";
case NEUTRAL: return "o_icon_rubric_neutral"; case NEUTRAL: return "o_icon_rubric_neutral";
...@@ -90,5 +94,16 @@ public class RubricAvgRenderer implements FlexiCellRenderer { ...@@ -90,5 +94,16 @@ public class RubricAvgRenderer implements FlexiCellRenderer {
} }
} }
public static String getRatingIconExplanation(RubricRating rating, Rubric rubric, Translator translator) {
switch (rating) {
case SUFFICIENT: return translator.translate("rubric.sufficient.explanation", new String[]{rubric.getLowerBoundSufficient()+ "", rubric.getUpperBoundSufficient()+""});
case NEUTRAL: return translator.translate("rubric.neutral.explanation", new String[]{rubric.getLowerBoundNeutral()+ "", rubric.getUpperBoundNeutral()+""});
case INSUFFICIENT: return translator.translate("rubric.insufficient.explanation", new String[]{rubric.getLowerBoundInsufficient()+ "", rubric.getUpperBoundInsufficient()+""});
default: return null;
}
}
} }
...@@ -89,9 +89,11 @@ reports.table.overview=\u00dcbersicht ...@@ -89,9 +89,11 @@ reports.table.overview=\u00dcbersicht
reports.table.report=Tabellen reports.table.report=Tabellen
rubic.column.label=Spaltenbeschriftung rubic.column.label=Spaltenbeschriftung
rubric.insufficient=Ungen\u00fcgend rubric.insufficient=Ungen\u00fcgend
rubric.insufficient.explanation=Ungen\u00fcgende Beurteilung (Wert zwischen {0} und {1})
rubric.lower.bound=von rubric.lower.bound=von
rubric.name=Name rubric.name=Name
rubric.neutral=Neutral rubric.neutral=Neutral
rubric.neutral.explanation=Neutrale Beurteilung (Wert zwischen {0} und {1})
rubric.no.response.enabled.show=anzeigen rubric.no.response.enabled.show=anzeigen
rubric.no.response.enabled=Spalte "$\:no.response" rubric.no.response.enabled=Spalte "$\:no.response"
rubric.report.avg.abrev=\u00F8 rubric.report.avg.abrev=\u00F8
...@@ -117,7 +119,8 @@ rubric.scale.maxToOne=Absteigende Likert-Skala (x bis 1) ...@@ -117,7 +119,8 @@ rubric.scale.maxToOne=Absteigende Likert-Skala (x bis 1)
rubric.scale.oneToMax=Aufsteigende Likert-Skala (1 bis x) rubric.scale.oneToMax=Aufsteigende Likert-Skala (1 bis x)
rubric.scale.type=Skalentyp rubric.scale.type=Skalentyp
rubric.scale.zeroBallanced=Symmetrische Likert-Skala (-x bis x) rubric.scale.zeroBallanced=Symmetrische Likert-Skala (-x bis x)
rubric.sufficient=Gen\u00fcgend rubric.sufficient=Gut
rubric.sufficient.explanation=Gute Beurteilung (Wert zwischen {0} und {1})
rubric.upper.bound=bis rubric.upper.bound=bis
save.as.done=Speichern und abschliessen save.as.done=Speichern und abschliessen
save.intermediate=Zwischenspeichern save.intermediate=Zwischenspeichern
......
...@@ -90,9 +90,11 @@ reports.table.overview=Overview ...@@ -90,9 +90,11 @@ reports.table.overview=Overview
reports.table.report=Tables reports.table.report=Tables
rubic.column.label=Column label rubic.column.label=Column label
rubric.insufficient=Insufficient rubric.insufficient=Insufficient
rubric.insufficient.explanation=Insufficient rating (Value between {0} and {1})
rubric.lower.bound=from rubric.lower.bound=from
rubric.name=Name rubric.name=Name
rubric.neutral=Neutral rubric.neutral=Neutral
rubric.insufficient.explanation=Neutral rating (Value between {0} and {1})
rubric.no.response.enabled.show=show rubric.no.response.enabled.show=show
rubric.no.response.enabled=Column "$\:no.response" rubric.no.response.enabled=Column "$\:no.response"
rubric.report.avg.abrev=\u00F8 rubric.report.avg.abrev=\u00F8
...@@ -118,7 +120,8 @@ rubric.scale.maxToOne=Descending Likert scale (x to 1) ...@@ -118,7 +120,8 @@ rubric.scale.maxToOne=Descending Likert scale (x to 1)
rubric.scale.oneToMax=Ascending Likert scale (1 to x) rubric.scale.oneToMax=Ascending Likert scale (1 to x)
rubric.scale.type=Scale type rubric.scale.type=Scale type
rubric.scale.zeroBallanced=Ballanced Likert scale (-x to x) rubric.scale.zeroBallanced=Ballanced Likert scale (-x to x)
rubric.sufficient=Sufficient rubric.sufficient=Good
rubric.insufficient.explanation=Good rating (Value between {0} and {1})
rubric.upper.bound=to rubric.upper.bound=to
save.as.done=Save and finish save.as.done=Save and finish
save.intermediate=Quick save save.intermediate=Quick save
......
...@@ -19,12 +19,15 @@ ...@@ -19,12 +19,15 @@
*/ */
package org.olat.modules.quality.analysis.ui; package org.olat.modules.quality.analysis.ui;
import org.olat.core.CoreSpringFactory;
import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer; import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiCellRenderer;
import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableComponent; import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableComponent;
import org.olat.core.gui.render.Renderer; import org.olat.core.gui.render.Renderer;
import org.olat.core.gui.render.StringOutput; import org.olat.core.gui.render.StringOutput;
import org.olat.core.gui.render.URLBuilder; import org.olat.core.gui.render.URLBuilder;
import org.olat.core.gui.translator.Translator; import org.olat.core.gui.translator.Translator;
import org.olat.modules.forms.EvaluationFormManager;
import org.olat.modules.forms.RubricRating;
import org.olat.modules.forms.model.xml.Rubric; import org.olat.modules.forms.model.xml.Rubric;
import org.olat.modules.forms.ui.EvaluationFormFormatter; import org.olat.modules.forms.ui.EvaluationFormFormatter;
import org.olat.modules.forms.ui.RubricAvgRenderer; import org.olat.modules.forms.ui.RubricAvgRenderer;
...@@ -70,7 +73,9 @@ public class HeatMapRenderer implements FlexiCellRenderer { ...@@ -70,7 +73,9 @@ public class HeatMapRenderer implements FlexiCellRenderer {
} }
public String getColorCss(GroupedStatistic statistic) { public String getColorCss(GroupedStatistic statistic) {
String colorCss = RubricAvgRenderer.getRatingCssClass(rubric, statistic.getAvg()); EvaluationFormManager evaluationFormManager = CoreSpringFactory.getImpl(EvaluationFormManager.class);
RubricRating rating = evaluationFormManager.getRubricRating(rubric, statistic.getAvg());
String colorCss = RubricAvgRenderer.getRatingCssClass(rating);
if (colorCss == null) { if (colorCss == null) {
colorCss = "o_qual_hm_basecolor"; colorCss = "o_qual_hm_basecolor";
} }
......
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