use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class ObjectivesHelper method createLearningObjectivesComponent.
// fxdiff FXOLAT-116: SCORM improvements
public static Component createLearningObjectivesComponent(String learningObjectives, Locale locale) {
Translator trans = Util.createPackageTranslator(ObjectivesHelper.class, locale);
VelocityContainer vc = new VelocityContainer("learningObjs", VELOCITY_ROOT + "/objectives.html", trans, null);
vc.contextPut("learningObjectives", learningObjectives);
return vc;
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class BusinessGroupMainRunController method getNoAccessMessage.
private Component getNoAccessMessage(UserRequest ureq, BusinessGroup group) {
VelocityContainer vc = createVelocityContainer("access_denied");
vc.contextPut("name", group.getName());
columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), null, vc, "grouprun");
// cleanup on dispose
listenTo(columnLayoutCtr);
return columnLayoutCtr.getInitialComponent();
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class FlexiTableClassicRenderer method renderRow.
@Override
protected void renderRow(Renderer renderer, StringOutput target, FlexiTableComponent ftC, String rowIdPrefix, int row, URLBuilder ubu, Translator translator, RenderResult renderResult) {
FlexiTableElementImpl ftE = ftC.getFlexiTableElement();
FlexiTableColumnModel columnsModel = ftE.getTableDataModel().getTableColumnModel();
int numOfCols = columnsModel.getColumnCount();
Form theForm = ftE.getRootForm();
// use alternating css class
int numOfColumns = 0;
target.append("<tr id='").append(rowIdPrefix).append(row).append("'");
if (ftE.getCssDelegate() != null) {
String cssClass = ftE.getCssDelegate().getRowCssClass(FlexiTableRendererType.classic, row);
if (StringHelper.containsNonWhitespace(cssClass)) {
target.append(" class='").append(cssClass).append("'");
}
}
target.append(">");
if (ftE.isMultiSelect()) {
target.append("<td>").append("<input type='checkbox' name='tb_ms' value='").append(rowIdPrefix).append(row).append("'").append(" onclick=\"javascript:").append(FormJSHelper.getXHRFnCallFor(theForm, ftC.getFormDispatchId(), 1, false, false, false, new NameValuePair("chkbox", Integer.toString(row)))).append(";\"");
if (ftE.isMultiSelectedIndex(row)) {
target.append(" checked='checked'");
}
boolean selectable = ftE.getTableDataModel().isSelectable(row);
if (!selectable) {
target.append(" disabled='disabled'");
}
target.append("/></td>");
}
for (int j = 0; j < numOfCols; j++) {
FlexiColumnModel fcm = columnsModel.getColumnModel(j);
if (ftE.isColumnModelVisible(fcm)) {
renderCell(renderer, target, ftC, fcm, row, ubu, translator, renderResult);
numOfColumns++;
}
}
target.append("</tr>");
if (ftE.isDetailsExpended(row)) {
target.append("<tr id='").append(rowIdPrefix).append(row).append("_details' class='o_table_row_details'>");
VelocityContainer container = ftE.getDetailsRenderer();
Object rowObject = ftE.getTableDataModel().getObject(row);
container.contextPut("row", rowObject);
FlexiTableComponentDelegate cmpDelegate = ftE.getComponentDelegate();
if (cmpDelegate != null) {
Iterable<Component> cmps = cmpDelegate.getComponents(row, rowObject);
if (cmps != null) {
for (Component cmp : cmps) {
container.put(cmp.getComponentName(), cmp);
}
}
}
if (ftE.isMultiSelect()) {
target.append("<td></td>");
}
target.append("<td colspan='").append(numOfColumns).append("'>");
container.getHTMLRendererSingleton().render(renderer, target, container, ubu, translator, renderResult, null);
container.contextRemove("row");
target.append("</td></tr>");
}
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class GTAParticipantController method setSolutions.
private void setSolutions(UserRequest ureq, Task assignedTask) {
DueDate availableDate = getSolutionDueDate(assignedTask);
boolean visible = availableDate == null || (availableDate.getDueDate() != null && availableDate.getDueDate().compareTo(new Date()) <= 0);
if (visible) {
File documentsDir = gtaManager.getSolutionsDirectory(courseEnv, gtaNode);
VFSContainer documentsContainer = gtaManager.getSolutionsContainer(courseEnv, gtaNode);
if ((availableDate != null && !availableDate.isRelative() && gtaNode.getModuleConfiguration().getBooleanSafe(GTACourseNode.GTASK_SAMPLE_SOLUTION_VISIBLE_ALL, false)) || TaskHelper.hasDocuments(documentsDir)) {
solutionsCtrl = new DirectoryController(ureq, getWindowControl(), documentsDir, documentsContainer, "run.solutions.description", "bulk.solutions", "solutions");
listenTo(solutionsCtrl);
mainVC.put("solutions", solutionsCtrl.getInitialComponent());
}
} else {
VelocityContainer waitVC = createVelocityContainer("wait_for_solutions");
mainVC.put("solutions", waitVC);
}
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class GuiDemoFlexiFormMainController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component,
* org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest ureq, Component source, Event event) {
// there are only events of type link from the demos navigation
if (source instanceof Link) {
Link sl = (Link) source;
// userobject tells which demo to activate
String uob = (String) sl.getUserObject();
if (uob != null) {
ControllerCreator cc = demos.get(uob);
// update source
VelocityContainer sourceVC = createVelocityContainer(uob);
ShrinkController sc = new ShrinkController(false, sourceVC, "toggle source");
sourceP.setContent(sc.getInitialComponent());
// cleanup former democontroller
if (demoController != null)
demoController.dispose();
contentP.popContent();
// create new demo controller
demoController = cc.createController(ureq, getWindowControl());
contentP.pushContent(demoController.getInitialComponent());
}
}
}
Aggregations