use of org.olat.core.gui.components.table.StaticColumnDescriptor in project OpenOLAT by OpenOLAT.
the class ExtendedIdentitiesTableDataModel method addColumnDescriptors.
/**
* Add all column descriptors to this table that are available in the table
* model
*
* @param tableCtr
*/
public void addColumnDescriptors(TableController tableCtr, Translator trans) {
setLocale(trans.getLocale());
if (isAdministrativeUser) {
String action = actionEnabled ? COMMAND_SELECTUSER : null;
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.identity.name", colCount++, action, getLocale()));
}
UserManager um = UserManager.getInstance();
// followed by the users fields
for (int i = 0; i < userPropertyHandlers.size(); i++) {
UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
boolean visible = um.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
String action = null;
if (actionEnabled && i < 2) {
action = COMMAND_SELECTUSER;
}
tableCtr.addColumnDescriptor(visible, userPropertyHandler.getColumnDescriptor(colCount++, action, getLocale()));
}
// in the end the last login and creation date
tableCtr.addColumnDescriptor(false, new DefaultColumnDescriptor("table.identity.lastlogin", colCount++, null, getLocale()));
// creation date at the end, enabled by default
tableCtr.addColumnDescriptor(new DefaultColumnDescriptor("table.identity.creationdate", colCount++, null, getLocale()));
if (actionEnabled) {
StaticColumnDescriptor vcd = new StaticColumnDescriptor(COMMAND_VCARD, "table.header.vcard", trans.translate("table.identity.vcard"));
vcd.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
tableCtr.addColumnDescriptor(vcd);
}
}
use of org.olat.core.gui.components.table.StaticColumnDescriptor in project OpenOLAT by OpenOLAT.
the class UserSearchController method doSearch.
private void doSearch(UserRequest ureq) {
String login = searchform.login.getValue();
// build user fields search map
Map<String, String> userPropertiesSearch = new HashMap<>();
for (UserPropertyHandler userPropertyHandler : searchform.userPropertyHandlers) {
if (userPropertyHandler == null)
continue;
FormItem ui = searchform.propFormItems.get(userPropertyHandler.getName());
String uiValue = userPropertyHandler.getStringValue(ui);
if (userPropertyHandler.getName().startsWith("genericCheckboxProperty")) {
if (!"false".equals(uiValue)) {
userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
}
} else if (StringHelper.containsNonWhitespace(uiValue)) {
userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
}
}
if (userPropertiesSearch.isEmpty()) {
userPropertiesSearch = null;
}
tableCtr = new TableController(tableConfig, ureq, getWindowControl(), myContent.getTranslator());
listenTo(tableCtr);
List<Identity> users = searchUsers(login, userPropertiesSearch, true);
int maxResults = securityModule.getUserSearchMaxResultsValue();
if (maxResults > 0 && users.size() > maxResults) {
users = users.subList(0, maxResults);
showWarning("error.search.maxResults", Integer.toString(maxResults));
}
if (!users.isEmpty()) {
tdm = new UserTableDataModel(users, getLocale(), isAdministrativeUser);
// add the data column descriptors
tdm.addColumnDescriptors(tableCtr, null);
// add the action columns
if (useMultiSelect) {
// add multiselect action
tableCtr.addMultiSelectAction(this.actionKeyChoose, ACTION_MULTISELECT_CHOOSE);
} else {
// add single column selec action
tableCtr.addColumnDescriptor(new StaticColumnDescriptor(ACTION_SINGLESELECT_CHOOSE, "table.header.action", myContent.getTranslator().translate("action.choose")));
}
tableCtr.setTableDataModel(tdm);
tableCtr.setMultiSelect(useMultiSelect);
searchPanel.pushContent(tableCtr.getInitialComponent());
myContent.contextPut("showButton", "true");
} else {
getWindowControl().setInfo(translate("error.no.user.found"));
}
}
use of org.olat.core.gui.components.table.StaticColumnDescriptor in project OpenOLAT by OpenOLAT.
the class ReadyToDeleteController method initializeTableController.
private void initializeTableController(UserRequest ureq) {
TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(translate("error.no.user.found"));
tableConfig.setShowAllLinkEnabled(false);
removeAsListenerAndDispose(tableCtr);
tableCtr = new TableController(tableConfig, ureq, getWindowControl(), this.propertyHandlerTranslator);
listenTo(tableCtr);
List<Identity> l = UserDeletionManager.getInstance().getIdentitiesInDeletionProcess(UserDeletionManager.getInstance().getDeleteEmailDuration());
tdm = new UserDeleteTableModel(l, getLocale(), isAdministrativeUser);
tdm.addColumnDescriptors(tableCtr, null, "table.identity.deleteEmail");
tableCtr.addColumnDescriptor(new StaticColumnDescriptor(ACTION_SINGLESELECT_CHOOSE, "table.header.action", translate("action.activate")));
tableCtr.addMultiSelectAction("action.ready.to.delete", ACTION_MULTISELECT_CHOOSE);
tableCtr.setMultiSelect(true);
tableCtr.setTableDataModel(tdm);
}
use of org.olat.core.gui.components.table.StaticColumnDescriptor in project OpenOLAT by OpenOLAT.
the class GroupController method initGroupTable.
/**
* Init GroupList-table-controller for non-waitinglist (participant-list,
* owner-list).
*/
protected void initGroupTable(TableController tableCtr, UserRequest ureq, boolean enableTablePreferences, boolean enableUserSelection) {
List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(usageIdentifyer, isAdministrativeUser);
if (isAdministrativeUser) {
// first the login name, but only if administrative user
DefaultColumnDescriptor cd0 = new DefaultColumnDescriptor("table.user.login", 0, COMMAND_VCARD, ureq.getLocale());
cd0.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
tableCtr.addColumnDescriptor(cd0);
}
if (chatEnabled) {
tableCtr.addColumnDescriptor(new CustomRenderColumnDescriptor("table.header.online", 1, COMMAND_IM, getLocale(), ColumnDescriptor.ALIGNMENT_LEFT, new OnlineIconRenderer()));
}
int visibleColId = 0;
// followed by the users fields
for (int i = 0; i < userPropertyHandlers.size(); i++) {
UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(i);
boolean visible = userManager.isMandatoryUserProperty(usageIdentifyer, userPropertyHandler);
ColumnDescriptor cd = userPropertyHandler.getColumnDescriptor(i + 3, COMMAND_VCARD, ureq.getLocale());
// make all user attributes clickable to open visiting card
if (cd instanceof DefaultColumnDescriptor) {
DefaultColumnDescriptor dcd = (DefaultColumnDescriptor) cd;
dcd.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
}
tableCtr.addColumnDescriptor(visible, cd);
if (visible) {
visibleColId++;
}
}
// in the end
if (enableTablePreferences) {
DefaultColumnDescriptor cd = new DefaultColumnDescriptor("table.subject.addeddate", 2, COMMAND_VCARD, ureq.getLocale());
cd.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
tableCtr.addColumnDescriptor(true, cd);
tableCtr.setSortColumn(++visibleColId, true);
}
if (enableUserSelection) {
tableCtr.addColumnDescriptor(new StaticColumnDescriptor(COMMAND_SELECTUSER, "table.subject.action", myTrans.translate("action.general")));
}
if (mayModifyMembers) {
tableCtr.addMultiSelectAction("action.remove", COMMAND_REMOVEUSER);
tableCtr.setMultiSelect(true);
}
}
use of org.olat.core.gui.components.table.StaticColumnDescriptor in project openolat by klemens.
the class ScormResultDetailsController method init.
protected void init(UserRequest ureq) {
main = createVelocityContainer("scores");
TableGuiConfiguration summaryTableConfig = new TableGuiConfiguration();
summaryTableConfig.setDownloadOffered(true);
summaryTableCtr = new TableController(summaryTableConfig, ureq, getWindowControl(), getTranslator());
summaryTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("summary.column.header.date", 0, null, ureq.getLocale()));
summaryTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("summary.column.header.duration", 1, null, ureq.getLocale()));
summaryTableCtr.addColumnDescriptor(new DefaultColumnDescriptor("summary.column.header.assesspoints", 2, null, ureq.getLocale()));
summaryTableCtr.addColumnDescriptor(new StaticColumnDescriptor("sel", "summary.column.header.details", getTranslator().translate("select")));
CourseEnvironment courseEnv = assessedUserCourseEnv.getCourseEnvironment();
String username = assessedUserCourseEnv.getIdentityEnvironment().getIdentity().getName();
// <OLATCE-289>
Map<Date, List<CmiData>> rawDatas = ScormAssessmentManager.getInstance().visitScoDatasMultiResults(username, courseEnv, node);
summaryTableCtr.setTableDataModel(new SummaryTableDataModelMultiResults(rawDatas));
// </OLATCE-289>
listenTo(summaryTableCtr);
main.put("summary", summaryTableCtr.getInitialComponent());
if (!coachCourseEnv.isCourseReadOnly()) {
resetButton = LinkFactory.createButton("reset", main, this);
main.put("resetButton", resetButton);
}
putInitialPanel(main);
}
Aggregations