use of org.olat.user.propertyhandlers.UserPropertyHandler in project openolat by klemens.
the class GroupController method reloadData.
public void reloadData() {
// refresh view
List<Object[]> combo = securityManager.getIdentitiesAndDateOfSecurityGroup(securityGroup);
List<GroupMemberView> views = new ArrayList<GroupMemberView>(combo.size());
Map<Long, GroupMemberView> idToViews = new HashMap<Long, GroupMemberView>();
Set<Long> loadStatus = new HashSet<Long>();
for (Object[] co : combo) {
Identity identity = (Identity) co[0];
Date addedAt = (Date) co[1];
String onlineStatus = null;
if (chatEnabled) {
if (getIdentity().equals(identity)) {
onlineStatus = "me";
} else if (sessionManager.isOnline(identity.getKey())) {
loadStatus.add(identity.getKey());
} else {
onlineStatus = Presence.unavailable.name();
}
}
GroupMemberView member = new GroupMemberView(identity, addedAt, onlineStatus);
views.add(member);
idToViews.put(identity.getKey(), member);
}
if (loadStatus.size() > 0) {
List<Long> statusToLoadList = new ArrayList<Long>(loadStatus);
Map<Long, String> statusMap = imService.getBuddyStatus(statusToLoadList);
for (Long toLoad : statusToLoadList) {
String status = statusMap.get(toLoad);
GroupMemberView member = idToViews.get(toLoad);
if (status == null) {
member.setOnlineStatus(Presence.available.name());
} else {
member.setOnlineStatus(status);
}
}
}
List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(usageIdentifyer, isAdministrativeUser);
identitiesTableModel = new IdentitiesOfGroupTableDataModel(views, getLocale(), userPropertyHandlers, isAdministrativeUser);
tableCtr.setTableDataModel(identitiesTableModel);
}
use of org.olat.user.propertyhandlers.UserPropertyHandler in project openolat by klemens.
the class GroupController method initGroupTable.
/**
* Init GroupList-table-controller for non-waitinglist (participant-list,
* owner-list).
*/
protected void initGroupTable(TableController tableController, 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");
tableController.addColumnDescriptor(cd0);
}
if (chatEnabled) {
tableController.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");
}
tableController.addColumnDescriptor(visible, cd);
if (visible) {
visibleColId++;
}
}
// in the end
if (enableTablePreferences) {
DefaultColumnDescriptor dcd = new DefaultColumnDescriptor("table.subject.addeddate", 2, COMMAND_VCARD, ureq.getLocale());
dcd.setIsPopUpWindowAction(true, "height=700, width=900, location=no, menubar=no, resizable=yes, status=no, scrollbars=yes, toolbar=no");
tableController.addColumnDescriptor(true, dcd);
tableController.setSortColumn(++visibleColId, true);
}
if (enableUserSelection) {
tableController.addColumnDescriptor(new StaticColumnDescriptor(COMMAND_SELECTUSER, "table.subject.action", myTrans.translate("action.general")));
}
if (mayModifyMembers) {
tableController.addMultiSelectAction("action.remove", COMMAND_REMOVEUSER);
tableController.setMultiSelect(true);
}
}
use of org.olat.user.propertyhandlers.UserPropertyHandler in project openolat by klemens.
the class ExtendedIdentitiesTableDataModel method getValueAt.
/**
* @see org.olat.core.gui.components.table.TableDataModel#getValueAt(int, int)
*/
@Override
public final Object getValueAt(int row, int col) {
Identity identity = getObject(row);
User user = identity.getUser();
int offSet = isAdministrativeUser ? 1 : 0;
if (col == 0 && isAdministrativeUser) {
return identity.getName();
}
if (col >= offSet && col < userPropertyHandlers.size() + offSet) {
// get user property for this column
UserPropertyHandler userPropertyHandler = userPropertyHandlers.get(col - offSet);
String value = userPropertyHandler.getUserProperty(user, getLocale());
return (value == null ? "n/a" : value);
}
if (col == userPropertyHandlers.size() + offSet) {
return identity.getLastLogin();
}
if (col == userPropertyHandlers.size() + offSet + 1) {
return user.getCreationDate();
}
return "error";
}
use of org.olat.user.propertyhandlers.UserPropertyHandler in project openolat by klemens.
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.user.propertyhandlers.UserPropertyHandler in project openolat by klemens.
the class MembersTableController method initColumns.
private SortKey initColumns(FlexiTableColumnModel columnsModel) {
int colPos = AbstractMemberListController.USER_PROPS_OFFSET;
SortKey defaultSortKey = null;
String rowAction = "vcard";
if (chatEnabled && editable) {
DefaultFlexiColumnModel chatCol = new DefaultFlexiColumnModel(Cols.online.i18n(), Cols.online.ordinal());
chatCol.setExportable(false);
columnsModel.addFlexiColumnModel(chatCol);
}
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null)
continue;
String propName = userPropertyHandler.getName();
boolean visible = userManager.isMandatoryUserProperty(MembersDisplayRunController.USER_PROPS_LIST_ID, userPropertyHandler);
String emailRowAction = rowAction;
FlexiColumnModel col;
if (UserConstants.FIRSTNAME.equals(propName) || UserConstants.LASTNAME.equals(propName) || UserConstants.EMAIL.equals(propName)) {
// when email is enabled, the action will trigger email workflow
if (UserConstants.EMAIL.equals(propName) && canEmail) {
emailRowAction = "email";
}
col = new DefaultFlexiColumnModel(userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, emailRowAction, true, propName, new StaticFlexiCellRenderer(emailRowAction, new TextFlexiCellRenderer()));
} else {
col = new DefaultFlexiColumnModel(visible, userPropertyHandler.i18nColumnDescriptorLabelKey(), colPos, true, propName);
}
columnsModel.addFlexiColumnModel(col);
colPos++;
if (defaultSortKey == null) {
defaultSortKey = new SortKey(propName, true);
}
}
if (userLastTimeVisible) {
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.firstTime.i18n(), Cols.firstTime.ordinal(), true, Cols.firstTime.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(Cols.lastTime.i18n(), Cols.lastTime.ordinal(), true, Cols.lastTime.name()));
}
return defaultSortKey;
}
Aggregations