use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.
the class DefaultController method dispatchEvent.
/**
* @see org.olat.core.gui.control.ControllerEventListener#dispatchEvent(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
public void dispatchEvent(final UserRequest ureq, final Controller source, final Event event) {
if (!disposed) {
getUserActivityLogger().frameworkSetBusinessPathFromWindowControl(getWindowControl());
ThreadLocalUserActivityLoggerInstaller.runWithUserActivityLogger(new Runnable() {
public void run() {
event(ureq, source, event);
}
}, getUserActivityLogger());
} else {
// show message
if (disposedMessageController != null && wrapperPanel != null) {
wrapperPanel.setContent(disposedMessageController.getInitialComponent());
} else if (wrapperPanel != null) {
if (locale == null) {
locale = ureq.getLocale();
}
// place disposed message
Translator pT = Util.createPackageTranslator(DefaultController.class, locale);
Component dispMsgVC = new VelocityContainer(DEFAULTDISPOSED_PAGE, DefaultController.class, DEFAULTDISPOSED_PAGE, pT, null);
wrapperPanel.pushContent(dispMsgVC);
}
}
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.
the class EdubaseRunController method createOverviewComponent.
private Component createOverviewComponent(ModuleConfiguration modulConfiguration) {
VelocityContainer container;
if (modulConfiguration.getBooleanSafe(EdubaseCourseNode.CONFIG_DESCRIPTION_ENABLED)) {
container = createVelocityContainer(OVERVIEW_DESCRIPTION_ENABLED);
} else {
container = createVelocityContainer(OVERVIEW_DESCRIPTION_DISABLED);
}
bookSections = modulConfiguration.getList(EdubaseCourseNode.CONFIG_BOOK_SECTIONS, BookSection.class).stream().sorted(new PositionComparator()).collect(Collectors.toList());
container.contextPut("bookSections", bookSections);
for (BookSection bookSection : bookSections) {
Link nodeLink = LinkFactory.createLink("startReader_" + bookSection.getPosition(), container, this);
nodeLink.setCustomDisplayText(getTranslator().translate("open.document"));
nodeLink.setIconRightCSS("o_icon o_icon_start");
nodeLink.setUserObject(bookSection);
}
EdubaseViewHelper edubaseViewHelper = new EdubaseViewHelper(getTranslator());
container.contextPut("helper", edubaseViewHelper);
container.contextPut("run", EVENT_RUN);
return container;
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.
the class EdubasePeekViewController method createPeekviewComponent.
private Component createPeekviewComponent(ModuleConfiguration modulConfiguration) {
VelocityContainer container = createVelocityContainer(PEEKVIEW_CONTAINER);
;
// BookSections
List<BookSection> bookSections = modulConfiguration.getList(EdubaseCourseNode.CONFIG_BOOK_SECTIONS, BookSection.class).stream().sorted(new PositionComparator()).limit(NUMBER_BOOK_SECTION_DESC_DISABLED).collect(Collectors.toList());
container.contextPut("bookSections", bookSections);
// Add a link to show all BookSections (go to node)
Link allItemsLink = LinkFactory.createLink("peekview.allItemsLink", container, this);
allItemsLink.setIconRightCSS("o_icon o_icon_start");
allItemsLink.setCustomEnabledLinkCSS("pull-right");
return container;
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.
the class PortfolioCourseNodeRunController method initForm.
@Override
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);
VelocityContainer mainVC = ((FormLayoutContainer) formLayout).getFormItemComponent();
if (courseNode.getModuleConfiguration().getBooleanSafe(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD, false)) {
HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), userCourseEnv, courseNode, this.mainForm);
if (highScoreCtr.isViewHighscore()) {
Component highScoreComponent = highScoreCtr.getInitialComponent();
mainVC.put("highScore", highScoreComponent);
}
}
Object text = config.get(PortfolioCourseNodeConfiguration.NODE_TEXT);
String explanation = (text instanceof String) ? (String) text : "";
if (StringHelper.containsNonWhitespace(explanation)) {
uifactory.addStaticTextElement("explanation.text", explanation, infosContainer);
}
String deadlineconfig = (String) config.get(PortfolioCourseNodeConfiguration.DEADLINE_TYPE);
if (!DeadlineType.none.name().equals(deadlineconfig) && deadlineconfig != null) {
// show deadline-config
String deadLineLabel = "map.deadline." + deadlineconfig + ".label";
String deadLineInfo = "";
if (deadlineconfig.equals(DeadlineType.absolut.name())) {
Formatter f = Formatter.getInstance(getLocale());
deadLineInfo = f.formatDate((Date) config.get(PortfolioCourseNodeConfiguration.DEADLINE_DATE));
} else {
deadLineInfo = getDeadlineRelativeInfo();
}
deadlineDateText = uifactory.addStaticTextElement("deadline", deadLineLabel, deadLineInfo, infosContainer);
}
if (templateMap != null || templateBinder != null) {
updateUI(ureq);
}
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.
the class BusinessGroupMainRunController method getOnWaitingListMessage.
private Component getOnWaitingListMessage(UserRequest ureq, BusinessGroup group) {
VelocityContainer vc = createVelocityContainer("waiting");
vc.contextPut("name", group.getName());
columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), null, vc, "grouprun");
// cleanup on dispose
listenTo(columnLayoutCtr);
return columnLayoutCtr.getInitialComponent();
}
Aggregations