use of org.olat.user.HomePageConfig in project OpenOLAT by OpenOLAT.
the class VideoAdminListController method showUserInfo.
/**
* Method to open the users visiting card in a new tab. Public to call it also from the parent controller
* @param ureq
*/
public void showUserInfo(UserRequest ureq, Identity userID) {
homePageDisplayController = new HomePageDisplayController(ureq, getWindowControl(), userID, new HomePageConfig());
closeableModalController = new CloseableModalController(getWindowControl(), translate("close"), homePageDisplayController.getInitialComponent(), true, translate("video.contact"));
listenTo(closeableModalController);
closeableModalController.activate();
}
use of org.olat.user.HomePageConfig in project openolat by klemens.
the class IdentityDocument method createDocument.
/**
* Factory method to create a new IdentityDocument
* @param searchResourceContext
* @param wikiPage
* @return
*/
public static Document createDocument(SearchResourceContext searchResourceContext, Identity identity) {
UserManager userMgr = UserManager.getInstance();
User user = identity.getUser();
HomePageConfigManager homepageMgr = HomePageConfigManagerImpl.getInstance();
HomePageConfig publishConfig = homepageMgr.loadConfigFor(identity.getName());
IdentityDocument identityDocument = new IdentityDocument();
identityDocument.setTitle(identity.getName());
identityDocument.setCreatedDate(user.getCreationDate());
// loop through all user properties and collect the content string and the last modified
List<UserPropertyHandler> userPropertyHanders = userMgr.getUserPropertyHandlersFor(IdentityDocument.class.getName(), false);
StringBuilder content = new StringBuilder();
for (UserPropertyHandler userPropertyHandler : userPropertyHanders) {
String propertyName = userPropertyHandler.getName();
// only index fields the user has published!
if (publishConfig.isEnabled(propertyName)) {
String value = user.getProperty(propertyName, I18nModule.getDefaultLocale());
if (value != null) {
content.append(value).append(" ");
}
}
}
// user text
String text = publishConfig.getTextAboutMe();
if (StringHelper.containsNonWhitespace(text)) {
text = FilterFactory.getHtmlTagsFilter().filter(text);
content.append(text).append(' ');
}
// finally use the properties as the content for this identity
if (content.length() > 0) {
identityDocument.setContent(content.toString());
}
identityDocument.setResourceUrl(searchResourceContext.getResourceUrl());
identityDocument.setDocumentType(searchResourceContext.getParentContextType());
identityDocument.setCssIcon(CSSHelper.CSS_CLASS_USER);
if (log.isDebug())
log.debug(identityDocument.toString());
return identityDocument.getLuceneDocument();
}
use of org.olat.user.HomePageConfig in project openolat by klemens.
the class UserVOFactory method get.
public static UserVO get(Identity identity, Locale locale, boolean allProperties, boolean isAdmin, boolean withPortrait) {
if (locale == null) {
locale = I18nModule.getDefaultLocale();
}
UserVO userVO = new UserVO();
User user = identity.getUser();
userVO.setKey(identity.getKey());
if (identity != null) {
userVO.setLogin(identity.getName());
}
userVO.setExternalId(identity.getExternalId());
userVO.setFirstName(user.getProperty(UserConstants.FIRSTNAME, null));
userVO.setLastName(user.getProperty(UserConstants.LASTNAME, null));
userVO.setEmail(user.getProperty(UserConstants.EMAIL, null));
if (withPortrait) {
File portrait = DisplayPortraitManager.getInstance().getSmallPortrait(identity.getName());
if (portrait != null && portrait.exists()) {
try {
InputStream input = new FileInputStream(portrait);
byte[] datas = IOUtils.toByteArray(input);
FileUtils.closeSafely(input);
byte[] data64 = Base64.encodeBase64(datas);
userVO.setPortrait(new String(data64, "UTF8"));
} catch (IOException e) {
log.error("", e);
}
}
}
if (allProperties) {
UserManager um = UserManager.getInstance();
HomePageConfig hpc = isAdmin ? null : HomePageConfigManagerImpl.getInstance().loadConfigFor(identity.getName());
List<UserPropertyHandler> propertyHandlers = um.getUserPropertyHandlersFor(UserWebService.PROPERTY_HANDLER_IDENTIFIER, false);
for (UserPropertyHandler propertyHandler : propertyHandlers) {
String propName = propertyHandler.getName();
if (hpc != null && !hpc.isEnabled(propName)) {
continue;
}
if (!UserConstants.FIRSTNAME.equals(propName) && !UserConstants.LASTNAME.equals(propName) && !UserConstants.EMAIL.equals(propName)) {
String value = propertyHandler.getUserProperty(user, locale);
userVO.putProperty(propName, value);
}
}
}
return userVO;
}
use of org.olat.user.HomePageConfig in project openolat by klemens.
the class VideoAdminErrorController method showUserInfo.
/**
* Method to open the users visiting card in a new tab. Public to call it also from the parent controller
* @param ureq
*/
public void showUserInfo(UserRequest ureq, Identity userID) {
homePageDisplayController = new HomePageDisplayController(ureq, getWindowControl(), userID, new HomePageConfig());
closeableModalController = new CloseableModalController(getWindowControl(), translate("close"), homePageDisplayController.getInitialComponent(), true, translate("video.contact"));
listenTo(closeableModalController);
closeableModalController.activate();
}
use of org.olat.user.HomePageConfig in project openolat by klemens.
the class VideoAdminListController method showUserInfo.
/**
* Method to open the users visiting card in a new tab. Public to call it also from the parent controller
* @param ureq
*/
public void showUserInfo(UserRequest ureq, Identity userID) {
homePageDisplayController = new HomePageDisplayController(ureq, getWindowControl(), userID, new HomePageConfig());
closeableModalController = new CloseableModalController(getWindowControl(), translate("close"), homePageDisplayController.getInitialComponent(), true, translate("video.contact"));
listenTo(closeableModalController);
closeableModalController.activate();
}
Aggregations