use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class GuiStackNiceImpl method pushModalDialog.
/**
* @param title the title of the modal dialog, can be null
* @param content the component to push as modal dialog
*/
@Override
public void pushModalDialog(Component content) {
wbo.sendCommandTo(new ScrollTopCommand());
// wrap the component into a modal foreground dialog with alpha-blended-background
final Panel guiMsgPlace = new Panel("guimsgplace_for_modaldialog");
VelocityContainer inset = new VelocityContainer("inset", VELOCITY_ROOT + "/modalDialog.html", null, null) {
@Override
public void validate(UserRequest ureq, ValidationResult vr) {
super.validate(ureq, vr);
// just before rendering, we need to tell the windowbackoffice that we are a favorite for accepting gui-messages.
// the windowbackoffice doesn't know about guimessages, it is only a container that keeps them for one render cycle
List<ZIndexWrapper> zindexed = wbo.getGuiMessages();
zindexed.add(new ZIndexWrapper(guiMsgPlace, 10));
}
};
inset.put("cont", content);
inset.put("guimsgplace", guiMsgPlace);
int zindex = 900 + (modalLayers * 100) + 5;
inset.contextPut("zindexoverlay", zindex + 1);
inset.contextPut("zindexshim", zindex);
inset.contextPut("zindexarea", zindex + 5);
inset.contextPut("zindexextwindows", zindex + 50);
modalPanel.pushContent(inset);
// the links in the panel cannot be clicked because of the alpha-blended background over it, but if user chooses own css style ->
// FIXME:fj:b panel.setEnabled(false) causes effects if there is an image component in the panel -> the component is not dispatched
// and thus renders inline and wastes the timestamp.
// Needed:solution (a) a flag (a bit of the mode indicator of the urlbuilder can be used) to indicate that a request always needs to be delivered even
// if the component or a parent is not enabled.
// alternative solution(b): wrap the imagecomponent into a controller and use a mapper
// alternative solution(c): introduce a flag to the component to say "dispatch always", even if a parent component is not enabled
//
// - solution a would be easy, but would allow for forced dispatching by manipulating the url's flag.
// for e.g. a Link button ("make me admin") that is disabled this is a security breach.
// - solution b needs some wrapping, the advantage (for images) would be that they are cached by the browser if requested more than once
// within a controller
// - solution c is a safe and easy way to allow dispatching (only in case a mediaresource is returned as a result of the dispatching) even
// if parent elements are not enabled
// proposal: fix for 5.1.0 with solution c; for 5.0.1 the uncommenting of the line below is okay.
// if (modalLayers == 0) panel.setEnabled(false);
modalLayers++;
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class QTI12AssessmentStatisticsController method initItemsOverview.
private void initItemsOverview(List<Item> items) {
List<StatisticSurveyItem> surveyItems = qtiStatisticsManager.getStatisticAnswerOptions(resourceResult.getSearchParams(), items);
int count = 0;
List<String> overviewList = new ArrayList<>();
for (StatisticSurveyItem surveyItem : surveyItems) {
Item item = surveyItem.getItem();
Series series = seriesfactory.getSeries(item, null);
if (series != null) {
// essay hasn't a series
String name = "overview_" + count++;
VelocityContainer vc = createVelocityContainer(name, "hbar_item_overview");
vc.contextPut("series", series);
vc.contextPut("question", item.getQuestion().getQuestion().renderAsHtml(mediaBaseURL));
vc.contextPut("questionType", item.getQuestion().getType());
vc.contextPut("title", item.getTitle());
mainVC.put(vc.getDispatchID(), vc);
overviewList.add(vc.getDispatchID());
}
}
mainVC.contextPut("overviewList", overviewList);
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class QTI12AssessmentStatisticsController method initDurationHistogram.
private void initDurationHistogram(StatisticAssessment stats) {
if (!BarSeries.hasNotNullDatas(stats.getDurations()))
return;
VelocityContainer durationHistogramVC = createVelocityContainer("histogram_duration");
durationHistogramVC.contextPut("datas", BarSeries.datasToString(stats.getDurations()));
mainVC.put("durationHistogram", durationHistogramVC);
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class QTI12AssessmentStatisticsController method initScoreHistogram.
private void initScoreHistogram(StatisticAssessment stats) {
VelocityContainer scoreHistogramVC = createVelocityContainer("histogram_score");
scoreHistogramVC.contextPut("datas", BarSeries.datasToString(stats.getScores()));
scoreHistogramVC.contextPut("cutValue", cutValue);
mainVC.put("scoreHistogram", scoreHistogramVC);
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class QTI12ItemStatisticsController method initItem.
protected void initItem(StatisticsItem itemStats) {
Series series = seriesfactory.getSeries(item, itemStats);
VelocityContainer vc = createVelocityContainer("hbar_item");
vc.contextPut("series", series);
mainVC.put("questionChart", vc);
mainVC.contextPut("series", series);
}
Aggregations