use of org.olat.core.commons.persistence.SortKey in project OpenOLAT by OpenOLAT.
the class TeacherLecturesTableController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
if (withRepositoryEntry) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.externalRef, "open.course"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.entry, "open.course"));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.date, new DateFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.startTime, new TimeFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.endTime, new TimeFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.lectureBlock));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.location));
if (withTeachers) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.teachers));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.status, new LectureBlockStatusCellRenderer(getTranslator())));
DefaultFlexiColumnModel detailsCol = new DefaultFlexiColumnModel(TeachCols.details.i18nHeaderKey(), TeachCols.details.ordinal(), "details", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("table.header.details"), "details"), null));
// set sort key even though we do not sort - added as css classes to column headers for styling
detailsCol.setSortKey(TeachCols.details.name());
columnsModel.addFlexiColumnModel(detailsCol);
DefaultFlexiColumnModel toolsCol = new DefaultFlexiColumnModel(TeachCols.tools);
toolsCol.setSortable(false);
columnsModel.addFlexiColumnModel(toolsCol);
tableModel = new TeacherOverviewDataModel(columnsModel, getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
FlexiTableSortOptions sortOptions = new FlexiTableSortOptions();
sortOptions.setDefaultOrderBy(new SortKey(TeachCols.date.name(), sortAsc));
tableEl.setSortSettings(sortOptions);
tableEl.setCustomizeColumns(false);
tableEl.setNumOfRowsEnabled(false);
tableEl.setEmtpyTableMessageKey(emptyI18nKey);
tableEl.setAndLoadPersistedPreferences(ureq, "lecture-teacher-overview-".concat(id));
}
use of org.olat.core.commons.persistence.SortKey in project OpenOLAT by OpenOLAT.
the class LectureListRepositoryController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (!lectureManagementManaged) {
addLectureButton = uifactory.addFormLink("add.lecture", formLayout, Link.BUTTON);
addLectureButton.setIconLeftCSS("o_icon o_icon_add");
addLectureButton.setElementCssClass("o_sel_repo_add_lecture");
deleteLecturesButton = uifactory.addFormLink("delete", formLayout, Link.BUTTON);
}
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, BlockCols.id));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.title));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.location));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.date, new DateFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.startTime, new TimeFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.endTime, new TimeFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(BlockCols.teachers));
if (lectureManagementManaged) {
// edit check it
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("details", translate("details"), "edit"));
} else {
DefaultFlexiColumnModel editColumn = new DefaultFlexiColumnModel("table.header.edit", -1, "edit", new StaticFlexiCellRenderer("", "edit", "o_icon o_icon-lg o_icon_edit", translate("edit"), null));
editColumn.setExportable(false);
editColumn.setAlwaysVisible(true);
columnsModel.addFlexiColumnModel(editColumn);
DefaultFlexiColumnModel toolsColumn = new DefaultFlexiColumnModel(BlockCols.tools);
toolsColumn.setExportable(false);
toolsColumn.setAlwaysVisible(true);
columnsModel.addFlexiColumnModel(toolsColumn);
}
tableModel = new LectureListRepositoryDataModel(columnsModel, getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
tableEl.setExportEnabled(true);
tableEl.setMultiSelect(true);
tableEl.setSelectAllEnable(true);
tableEl.setEmtpyTableMessageKey("empty.table.lectures.blocks.admin");
FlexiTableSortOptions options = new FlexiTableSortOptions();
options.setDefaultOrderBy(new SortKey(BlockCols.date.name(), false));
tableEl.setSortSettings(options);
tableEl.setAndLoadPersistedPreferences(ureq, "repo-lecture-block-list");
}
use of org.olat.core.commons.persistence.SortKey in project openolat by klemens.
the class TeacherLecturesTableController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
if (withRepositoryEntry) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.externalRef, "open.course"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.entry, "open.course"));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.date, new DateFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.startTime, new TimeFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.endTime, new TimeFlexiCellRenderer(getLocale())));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.lectureBlock));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.location));
if (withTeachers) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.teachers));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(TeachCols.status, new LectureBlockStatusCellRenderer(getTranslator())));
DefaultFlexiColumnModel detailsCol = new DefaultFlexiColumnModel(TeachCols.details.i18nHeaderKey(), TeachCols.details.ordinal(), "details", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("table.header.details"), "details"), null));
// set sort key even though we do not sort - added as css classes to column headers for styling
detailsCol.setSortKey(TeachCols.details.name());
columnsModel.addFlexiColumnModel(detailsCol);
DefaultFlexiColumnModel toolsCol = new DefaultFlexiColumnModel(TeachCols.tools);
toolsCol.setSortable(false);
columnsModel.addFlexiColumnModel(toolsCol);
tableModel = new TeacherOverviewDataModel(columnsModel, getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
FlexiTableSortOptions sortOptions = new FlexiTableSortOptions();
sortOptions.setDefaultOrderBy(new SortKey(TeachCols.date.name(), sortAsc));
tableEl.setSortSettings(sortOptions);
tableEl.setCustomizeColumns(false);
tableEl.setNumOfRowsEnabled(false);
tableEl.setEmtpyTableMessageKey(emptyI18nKey);
tableEl.setAndLoadPersistedPreferences(ureq, "lecture-teacher-overview-".concat(id));
}
use of org.olat.core.commons.persistence.SortKey in project openolat by klemens.
the class TeacherRollCallController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
StringBuilder sb = new StringBuilder();
List<Identity> teachers = lectureService.getTeachers(lectureBlock);
for (Identity teacher : teachers) {
if (sb.length() > 0)
sb.append(", ");
sb.append(StringHelper.escapeHtml(userManager.getUserDisplayName(teacher)));
}
Formatter formatter = Formatter.getInstance(getLocale());
String date = formatter.formatDate(lectureBlock.getStartDate());
String startTime = formatter.formatTimeShort(lectureBlock.getStartDate());
String endTime = formatter.formatTimeShort(lectureBlock.getEndDate());
String[] args = new String[] { // {0}
lectureBlock.getTitle(), // {1}
sb.toString(), // {2}
date, // {3}
startTime, // {4}
endTime };
layoutCont.contextPut("date", date);
layoutCont.contextPut("startTime", startTime);
layoutCont.contextPut("endTime", endTime);
layoutCont.contextPut("dateAndTime", translate("lecture.block.dateAndTime", args));
layoutCont.contextPut("teachers", sb.toString());
layoutCont.contextPut("lectureBlockTitle", StringHelper.escapeHtml(lectureBlock.getTitle()));
layoutCont.contextPut("lectureBlockExternalId", StringHelper.escapeHtml(lectureBlock.getExternalId()));
StringBuilder description = Formatter.stripTabsAndReturns(Formatter.formatURLsAsLinks(lectureBlock.getDescription()));
layoutCont.contextPut("lectureBlockDescription", StringHelper.xssScan(description));
StringBuilder preparation = Formatter.stripTabsAndReturns(Formatter.formatURLsAsLinks(lectureBlock.getPreparation()));
layoutCont.contextPut("lectureBlockPreparation", StringHelper.xssScan(preparation));
layoutCont.contextPut("lectureBlockLocation", StringHelper.escapeHtml(lectureBlock.getLocation()));
layoutCont.contextPut("lectureBlock", lectureBlock);
layoutCont.contextPut("lectureBlockOptional", !lectureBlock.isCompulsory());
layoutCont.setFormTitle(translate("lecture.block", args));
layoutCont.setFormDescription(StringHelper.escapeJavaScript(lectureBlock.getDescription()));
}
// table
FlexiTableSortOptions options = new FlexiTableSortOptions();
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
if (isAdministrativeUser) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RollCols.username));
options.setDefaultOrderBy(new SortKey(RollCols.username.sortKey(), true));
}
int colPos = USER_PROPS_OFFSET;
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null)
continue;
String propName = userPropertyHandler.getName();
boolean visible = userManager.isMandatoryUserProperty(USER_PROPS_ID, userPropertyHandler);
FlexiColumnModel col = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName);
columnsModel.addFlexiColumnModel(col);
colPos++;
if (!options.hasDefaultOrderBy()) {
options.setDefaultOrderBy(new SortKey(propName, true));
} else if (UserConstants.LASTNAME.equals(propName)) {
options.setDefaultOrderBy(new SortKey(propName, true));
}
}
if (lectureBlock.isCompulsory()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RollCols.status));
for (int i = 0; i < numOfLectures; i++) {
DefaultFlexiColumnModel col = new DefaultFlexiColumnModel("table.header.lecture." + (i + 1), i + CHECKBOX_OFFSET, true, "lecture." + (i + 1));
col.setAlwaysVisible(true);
columnsModel.addFlexiColumnModel(col);
}
// all button
DefaultFlexiColumnModel allCol = new DefaultFlexiColumnModel("all", RollCols.all.ordinal(), "all", new BooleanCellRenderer(new StaticFlexiCellRenderer(translate("all"), "all", null, null, translate("all.desc")), null));
allCol.setAlwaysVisible(true);
columnsModel.addFlexiColumnModel(allCol);
if (secCallback.canViewAuthorizedAbsences() || secCallback.canEditAuthorizedAbsences()) {
DefaultFlexiColumnModel authorizedCol = new DefaultFlexiColumnModel(RollCols.authorizedAbsence);
authorizedCol.setAlwaysVisible(true);
columnsModel.addFlexiColumnModel(authorizedCol);
}
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RollCols.comment));
tableModel = new TeacherRollCallDataModel(columnsModel, secCallback, getLocale());
tableEl = uifactory.addTableElement(getWindowControl(), "table", tableModel, 20, false, getTranslator(), formLayout);
tableEl.setCustomizeColumns(true);
tableEl.setSortSettings(options);
tableEl.setAndLoadPersistedPreferences(ureq, "teacher-roll-call");
// buttons
uifactory.addFormCancelButton("cancel", formLayout, ureq, getWindowControl());
quickSaveButton = uifactory.addFormSubmitButton("save", "save.temporary", formLayout);
quickSaveButton.setElementCssClass("o_sel_lecture_quick_save");
closeLectureBlocksButton = uifactory.addFormLink("close.lecture.blocks", formLayout, Link.BUTTON);
closeLectureBlocksButton.setElementCssClass("o_sel_lecture_close");
if (lectureModule.isStatusCancelledEnabled()) {
cancelLectureBlockButton = uifactory.addFormLink("cancel.lecture.blocks", formLayout, Link.BUTTON);
}
reopenButton = uifactory.addFormLink("reopen.lecture.blocks", formLayout, Link.BUTTON);
reopenButton.setElementCssClass("o_sel_lecture_reopen");
updateUI();
}
use of org.olat.core.commons.persistence.SortKey in project openolat by klemens.
the class AbstractItemListController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("quickview", "<i class='o_icon o_icon_quickview'> </i>", "quick-view"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.mark.i18nKey(), Cols.mark.ordinal(), true, OrderBy.marks.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(true, Cols.editable.i18nKey(), Cols.editable.ordinal(), false, null, FlexiColumnModel.ALIGNMENT_LEFT, new BooleanCellRenderer(new CSSIconFlexiCellRenderer(CSS_ICON_READWRITE), new CSSIconFlexiCellRenderer(CSS_ICON_READONLY))));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.key.i18nKey(), Cols.key.ordinal(), true, OrderBy.key.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.identifier.i18nKey(), Cols.identifier.ordinal(), true, OrderBy.identifier.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.title.i18nKey(), Cols.title.ordinal(), true, OrderBy.title.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.topic.i18nKey(), Cols.topic.ordinal(), true, OrderBy.topic.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.creationDate.i18nKey(), Cols.creationDate.ordinal(), true, OrderBy.creationDate.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.lastModified.i18nKey(), Cols.lastModified.ordinal(), true, OrderBy.lastModified.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.keywords.i18nKey(), Cols.keywords.ordinal(), true, OrderBy.keywords.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.coverage.i18nKey(), Cols.coverage.ordinal(), true, OrderBy.coverage.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.additionalInfos.i18nKey(), Cols.additionalInfos.ordinal(), true, OrderBy.additionalInformations.name()));
if (getSecurityCallback().canUseTaxonomy()) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.taxnonomyLevel.i18nKey(), Cols.taxnonomyLevel.ordinal(), true, OrderBy.taxonomyLevel.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.taxnonomyPath.i18nKey(), Cols.taxnonomyPath.ordinal(), true, OrderBy.taxonomyPath.name()));
}
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.difficulty.i18nKey(), Cols.difficulty.ordinal(), true, OrderBy.difficulty.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.stdevDifficulty.i18nKey(), Cols.stdevDifficulty.ordinal(), true, OrderBy.stdevDifficulty.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.differentiation.i18nKey(), Cols.differentiation.ordinal(), true, OrderBy.differentiation.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.numOfAnswerAlternatives.i18nKey(), Cols.numOfAnswerAlternatives.ordinal(), true, OrderBy.numOfAnswerAlternatives.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.usage.i18nKey(), Cols.usage.ordinal(), true, OrderBy.usage.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.type.i18nKey(), Cols.type.ordinal(), true, OrderBy.itemType.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.format.i18nKey(), Cols.format.ordinal(), true, OrderBy.format.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.rating.i18nKey(), Cols.rating.ordinal(), true, OrderBy.rating.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.numberOfRatings.i18nKey(), Cols.numberOfRatings.ordinal(), true, OrderBy.numberOfRatings.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, Cols.itemVersion.i18nKey(), Cols.itemVersion.ordinal(), true, OrderBy.itemVersion.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.status.i18nKey(), Cols.status.ordinal(), true, OrderBy.status.name(), new QuestionStatusCellRenderer()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.statusLastModified.i18nKey(), Cols.statusLastModified.ordinal(), true, OrderBy.statusLastModified.name()));
if (licenseModule.isEnabled(licenseHandler)) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(false, false, Cols.license.i18nKey(), Cols.license.ordinal(), "license", false, null, FlexiColumnModel.ALIGNMENT_LEFT, new StaticFlexiCellRenderer("license", new LicenseRenderer(getLocale()))));
}
initActionColumns(columnsModel);
model = new QuestionItemDataModel(columnsModel, this, getTranslator());
itemsTable = uifactory.addTableElement(getWindowControl(), "items", model, 50, false, getTranslator(), formLayout);
itemsTable.setWrapperSelector("qitems");
itemsTable.setSelectAllEnable(true);
itemsTable.setMultiSelect(true);
itemsTable.setSearchEnabled(true);
itemsTable.setSortSettings(new FlexiTableSortOptions(true));
itemsTable.setExtendedSearch(extendedSearchCtrl);
itemsTable.setColumnIndexForDragAndDropLabel(Cols.title.ordinal());
itemsTable.setAndLoadPersistedPreferences(ureq, "qpool-list-" + prefsKey);
listenTo(extendedSearchCtrl);
VelocityContainer detailsVC = createVelocityContainer("item_list_details");
itemsTable.setDetailsRenderer(detailsVC, this);
FlexiTableSortOptions sortOptions = new FlexiTableSortOptions();
sortOptions.setDefaultOrderBy(new SortKey(OrderBy.title.name(), true));
itemsTable.setSortSettings(sortOptions);
initButtons(ureq, formLayout);
itemsTable.reloadData();
}
Aggregations