use of org.olat.basesecurity.IdentityShort in project openolat by klemens.
the class StandardResultController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer formLayoutCont = (FormLayoutContainer) formLayout;
formLayoutCont.contextPut("result", document);
formLayoutCont.contextPut("id", hashCode());
formLayoutCont.contextPut("formatter", Formatter.getInstance(getLocale()));
String author = document.getAuthor();
if (StringHelper.containsNonWhitespace(author)) {
List<IdentityShort> identities = BaseSecurityManager.getInstance().findShortIdentitiesByName(Collections.singleton(author));
if (identities.size() > 0) {
author = UserManager.getInstance().getUserDisplayName(identities.get(0));
}
}
formLayoutCont.contextPut("author", author);
if (StringHelper.containsNonWhitespace(document.getLicenseTypeKey())) {
LicenseType licenseType = licenseService.loadLicenseTypeByKey(document.getLicenseTypeKey());
if (!licenseService.isNoLicense(licenseType)) {
formLayoutCont.contextPut("licenseIcon", LicenseUIFactory.getCssOrDefault(licenseType));
formLayoutCont.contextPut("license", LicenseUIFactory.translate(licenseType, getLocale()));
}
}
}
String icon = document.getCssIcon();
if (!StringHelper.containsNonWhitespace(icon)) {
icon = "o_sp_icon";
}
String label = document.getTitle();
if (label != null) {
label = label.trim();
}
if (label.length() > 128) {
label = FilterFactory.getHtmlTagsFilter().filter(label);
label = Formatter.truncate(label, 128);
}
label = StringHelper.escapeHtml(label);
docLink = uifactory.addFormLink("open_doc", label, label, formLayout, Link.NONTRANSLATED);
docLink.setIconLeftCSS("o_icon o_icon-fw " + icon);
String highlightLabel = document.getHighlightTitle();
if (!StringHelper.containsNonWhitespace(highlightLabel)) {
highlightLabel = label;
}
docHighlightLink = uifactory.addFormLink("open_doc_highlight", highlightLabel, highlightLabel, formLayout, Link.NONTRANSLATED);
docHighlightLink.setIconLeftCSS("o_icon o_icon-fw " + icon);
}
use of org.olat.basesecurity.IdentityShort in project openolat by klemens.
the class RevisionListController method loadModel.
private void loadModel(VFSLeaf versionedLeaf) {
Versions versions = versionedFile.getVersions();
List<VFSRevision> revisions = new ArrayList<VFSRevision>(versions.getRevisions());
revisions.add(new CurrentRevision(versionedLeaf, versions));
Collection<String> names = new HashSet<String>();
for (VFSRevision revision : revisions) {
if (revision.getAuthor() != null) {
names.add(revision.getAuthor());
}
}
Map<String, IdentityShort> mappedIdentities = new HashMap<String, IdentityShort>();
for (IdentityShort identity : BaseSecurityManager.getInstance().findShortIdentitiesByName(names)) {
mappedIdentities.put(identity.getName(), identity);
}
revisionListTableCtr.setTableDataModel(new RevisionListDataModel(revisions, mappedIdentities, getLocale()));
}
Aggregations