use of org.olat.user.DisplayPortraitController in project openolat by klemens.
the class MessageListController method addMessageToCurrentMessagesAndVC.
private void addMessageToCurrentMessagesAndVC(UserRequest ureq, MessageLight m, MessageView messageView, Map<String, Mark> marks, Map<String, MarkResourceStat> stats, Map<String, Long> artefactStats, Set<Long> readSet) {
// all values belonging to a message are stored in this map
// these values can be accessed in velocity. make sure you clean up
// everything
// you create here in disposeCurrentMessages()!
String keyString = m.getKey().toString();
if (readSet == null || readSet.contains(m.getKey())) {
messageView.setNewMessage(false);
} else {
// mark now as read
markRead(m);
messageView.setNewMessage(true);
}
// add some data now
messageView.setFormattedCreationDate(formatter.formatDateAndTime(m.getCreationDate()));
messageView.setFormattedLastModified(formatter.formatDateAndTime(m.getLastModified()));
Identity creator = m.getCreator();
Identity modifier = m.getModifier();
if (modifier != null) {
messageView.setModified(true);
if (modifier.equals(creator) && StringHelper.containsNonWhitespace(m.getPseudonym())) {
messageView.setModifierPseudonym(m.getPseudonym());
} else {
messageView.setModifierFirstName(modifier.getUser().getProperty(UserConstants.FIRSTNAME, getLocale()));
messageView.setModifierLastName(modifier.getUser().getProperty(UserConstants.LASTNAME, getLocale()));
}
} else {
messageView.setModified(false);
}
boolean userIsMsgCreator = false;
// keeps the first 15 chars
if (creator != null) {
userIsMsgCreator = getIdentity().equals(creator);
if (!StringHelper.containsNonWhitespace(m.getPseudonym())) {
messageView.setCreatorFirstname(Formatter.truncate(creator.getUser().getProperty(UserConstants.FIRSTNAME, getLocale()), 18));
messageView.setCreatorLastname(Formatter.truncate(creator.getUser().getProperty(UserConstants.LASTNAME, getLocale()), 18));
}
}
// message attachments
VFSContainer msgContainer = forumManager.getMessageContainer(forum.getKey(), m.getKey());
messageView.setMessageContainer(msgContainer);
List<VFSItem> attachments = new ArrayList<VFSItem>(msgContainer.getItems(new VFSItemMetaFilter()));
messageView.setAttachments(attachments);
// number of children and modify/delete permissions
int numOfChildren = messageView.getNumOfChildren();
messageView.setAuthor(userIsMsgCreator);
boolean threadTop = m.getThreadtop() == null;
messageView.setThreadTop(threadTop);
boolean isThreadClosed;
if (threadTop) {
isThreadClosed = Status.getStatus(m.getStatusCode()).isClosed();
} else {
if (thread == null) {
isThreadClosed = Status.getStatus(m.getThreadtop().getStatusCode()).isClosed();
} else {
isThreadClosed = Status.getStatus(thread.getStatusCode()).isClosed();
}
}
messageView.setClosed(isThreadClosed);
if (!guestOnly && !m.isGuest() && creator != null && !StringHelper.containsNonWhitespace(m.getPseudonym())) {
// add portrait to map for later disposal and key for rendering in velocity
DisplayPortraitController portrait = new DisplayPortraitController(ureq, getWindowControl(), creator, true, true, false, true);
messageView.setPortrait(portrait);
mainVC.put("portrait_".concat(keyString), portrait.getInitialComponent());
// Add link with username that is clickable
String creatorFullName = StringHelper.escapeHtml(UserManager.getInstance().getUserDisplayName(creator));
Link visitingCardLink = LinkFactory.createCustomLink("vc_".concat(keyString), "vc", creatorFullName, Link.LINK_CUSTOM_CSS + Link.NONTRANSLATED, mainVC, this);
visitingCardLink.setUserObject(creator);
LinkPopupSettings settings = new LinkPopupSettings(800, 600, "_blank");
visitingCardLink.setPopup(settings);
}
if (!isThreadClosed) {
if ((numOfChildren == 0 && userIsMsgCreator && foCallback.mayDeleteOwnMessage()) || foCallback.mayDeleteMessageAsModerator()) {
Link deleteLink = LinkFactory.createCustomLink("dl_".concat(keyString), "dl", "msg.delete", Link.BUTTON_SMALL, mainVC, this);
deleteLink.setIconLeftCSS("o_icon o_icon-fw o_icon_delete_item");
deleteLink.setUserObject(messageView);
}
if ((numOfChildren == 0 && userIsMsgCreator && foCallback.mayEditOwnMessage()) || foCallback.mayEditMessageAsModerator()) {
Link editLink = LinkFactory.createCustomLink("ed_".concat(keyString), "ed", "msg.update", Link.BUTTON_SMALL, mainVC, this);
editLink.setIconLeftCSS("o_icon o_icon-fw o_icon_edit");
editLink.setUserObject(messageView);
}
if (foCallback.mayReplyMessage()) {
Link quoteLink = LinkFactory.createCustomLink("qt_".concat(keyString), "qt", "msg.quote", Link.BUTTON_SMALL, mainVC, this);
quoteLink.setElementCssClass("o_sel_forum_reply_quoted");
quoteLink.setIconLeftCSS("o_icon o_icon-fw o_icon_reply_with_quote");
quoteLink.setUserObject(messageView);
Link replyLink = LinkFactory.createCustomLink("rp_".concat(keyString), "rp", "msg.reply", Link.BUTTON_SMALL, mainVC, this);
replyLink.setElementCssClass("o_sel_forum_reply");
replyLink.setIconLeftCSS("o_icon o_icon-fw o_icon_reply");
replyLink.setUserObject(messageView);
}
if (foCallback.mayEditMessageAsModerator()) {
if (!threadTop) {
Link splitLink = LinkFactory.createCustomLink("split_".concat(keyString), "split", "msg.split", Link.LINK, mainVC, this);
splitLink.setIconLeftCSS("o_icon o_icon-fw o_icon_split");
splitLink.setUserObject(messageView);
Link moveLink = LinkFactory.createCustomLink("move_".concat(keyString), "move", "msg.move", Link.LINK, mainVC, this);
moveLink.setIconLeftCSS("o_icon o_icon-fw o_icon_move");
moveLink.setUserObject(messageView);
}
Link exileLink = LinkFactory.createCustomLink("exile_".concat(keyString), "exile", "msg.exile", Link.LINK, mainVC, this);
exileLink.setIconLeftCSS("o_icon o_icon-fw o_forum_status_thread_icon");
exileLink.setUserObject(messageView);
}
}
Mark currentMark = marks.get(keyString);
MarkResourceStat stat = stats.get(keyString);
if (!guestOnly) {
String businessPath = currentMark == null ? getWindowControl().getBusinessControl().getAsString() + "[Message:" + m.getKey() + "]" : currentMark.getBusinessPath();
Controller markCtrl = markingService.getMarkController(ureq, getWindowControl(), currentMark, stat, forumOres, keyString, businessPath);
mainVC.put("mark_".concat(keyString), markCtrl.getInitialComponent());
}
if (userIsMsgCreator && !StringHelper.containsNonWhitespace(m.getPseudonym())) {
OLATResourceable messageOres = OresHelper.createOLATResourceableInstance("Forum", m.getKey());
String businessPath = BusinessControlFactory.getInstance().getAsString(getWindowControl().getBusinessControl()) + "[Message:" + m.getKey() + "]";
Long artefact = artefactStats.get(businessPath);
int numOfArtefact = artefact == null ? 0 : artefact.intValue();
if (portfolioModule.isEnabled()) {
String collectorId = "eportfolio_" + keyString;
Component collectorCmp = new MediaCollectorComponent(collectorId, getWindowControl(), m, forumMediaHandler, businessPath);
mainVC.put(collectorId, collectorCmp);
} else {
Controller ePFCollCtrl = EPUIFactory.createArtefactCollectWizzardController(ureq, getWindowControl(), numOfArtefact, messageOres, businessPath);
if (ePFCollCtrl != null) {
messageView.setArtefact(ePFCollCtrl);
mainVC.put("eportfolio_" + keyString, ePFCollCtrl.getInitialComponent());
}
}
}
}
use of org.olat.user.DisplayPortraitController in project openolat by klemens.
the class HighScoreRunController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
VelocityContainer mainVC = this.flc.getFormItemComponent();
mainVC.put("loadd3js", new StatisticsComponent("d3loader"));
if (viewHistogram) {
VelocityContainer scoreHistogramVC = createVelocityContainer("histogram_score");
// transfer all scores to velocity container as base data for histogram
HighScoreRankingResults modifiedData = highScoreManager.processHistogramData(allScores, lowerBorder, upperBorder);
allScores = modifiedData.getModifiedScores();
scoreHistogramVC.contextPut("datas", BarSeries.datasToString(allScores));
// histogram marker for own position
scoreHistogramVC.contextPut("cutValue", ownIdIndices.size() > 0 ? highScoreManager.calculateHistogramCutvalue(allMembers.get(ownIdIndices.get(0)).getScore(), modifiedData.getClasswidth(), modifiedData.getMin()) : -1000);
// classwidth to correctly display the histogram
long classwidth = modifiedData.getClasswidth();
scoreHistogramVC.contextPut("step", classwidth);
// find path for ownID image to display in histogram
UserAvatarMapper mapper = new UserAvatarMapper(false);
String mapperPath = registerMapper(ureq, mapper);
String identityMapperPath = mapper.createPathFor(mapperPath, ownIdentity);
scoreHistogramVC.contextPut("mapperUrl", identityMapperPath);
mainVC.put("scoreHistogram", scoreHistogramVC);
}
if (viewPodium) {
String[] localizer = { "first", "second", "third" };
// for clarity and space reasons do not show any portraits if one position has more than 6 persons
int maxPerson = 6;
boolean showPortraits = !anonymous && allPodium.get(0).size() <= maxPerson && allPodium.get(1).size() <= maxPerson && allPodium.get(2).size() <= maxPerson;
for (int i = 0; i < localizer.length; i++) {
int sizePerPos = allPodium.get(i).size();
StringBuilder sb = new StringBuilder();
if (sizePerPos > 2) {
int reduce = 0;
// create link if podium has more than 2 entries per rank, entries can be displayed as anonymous
if (allPodium.get(i).get(0).getIdentity().equals(ownIdentity)) {
sb.append(userManager.getUserDisplayName(ownIdentity));
++reduce;
}
if (sizePerPos > 6 || anonymous) {
mainVC.contextPut("further" + (i + 1), (sizePerPos - reduce) + " " + (reduce == 1 ? translate("highscore.further") : translate("highscore.total")));
} else {
links[i] = LinkFactory.createLink(null, "link" + (i + 1), "cmd", (sizePerPos - reduce) + " " + (reduce == 1 ? translate("highscore.further") : translate("highscore.total")), getTranslator(), mainVC, this, 16);
}
} else {
for (HighScoreTableEntry te : allPodium.get(i)) {
if (!anonymous || te.getIdentity().equals(ownIdentity)) {
sb.append(userManager.getUserDisplayName(te.getIdentity()));
sb.append("<br/>");
}
}
}
mainVC.contextPut(localizer[i], sizePerPos > 0 ? sb.toString() : translate("highscore.unavail"));
mainVC.contextPut("score" + (i + 1), sizePerPos > 0 ? allPodium.get(i).get(0).getScore() : null);
if (sizePerPos > 0 && showPortraits) {
// decide whether or not to display id portrait
mainVC.contextPut("number" + (i + 1), sizePerPos);
for (int j = 0; j < sizePerPos; j++) {
Identity currentID = allPodium.get(i).get(j).getIdentity();
boolean choosePortrait = !anonymous || ownIdentity.equals(currentID);
DisplayPortraitController portrait = new DisplayPortraitController(ureq, getWindowControl(), currentID, false, choosePortrait, !choosePortrait);
listenTo(portrait);
Component portraitComponent = portrait.getInitialComponent();
mainVC.put("portrait" + (i + 1) + "-" + (j + 1), portraitComponent);
}
} else {
// if amount of people per rank is too large, own id portrait can still be displayed
for (int j = 0; j < sizePerPos; j++) {
Identity currentID = allPodium.get(i).get(j).getIdentity();
if (ownIdentity.equals(currentID)) {
DisplayPortraitController portrait = new DisplayPortraitController(ureq, getWindowControl(), currentID, true, true, false);
listenTo(portrait);
mainVC.put("portrait" + (i + 1), portrait.getInitialComponent());
}
}
}
}
}
if (viewTable) {
FlexiTableColumnModel tableColumnModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("highscore.table.header1", HighScoreTableEntry.RANK));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("highscore.table.header2", HighScoreTableEntry.SCORE));
tableColumnModel.addFlexiColumnModel(new DefaultFlexiColumnModel("highscore.table.header3", HighScoreTableEntry.NAME));
// trim to tableSize
if (tableSize < allMembers.size()) {
allMembers.subList(tableSize, allMembers.size()).clear();
}
tableDataModel = new FlexiTableDataModelImpl<HighScoreTableEntry>(new HighScoreFlexiTableModel(allMembers, anonymous, translate("highscore.anonymous"), ownIdentity), tableColumnModel);
FlexiTableElement topTenTable = uifactory.addTableElement(getWindowControl(), "table", tableDataModel, getTranslator(), formLayout);
topTenTable.setNumOfRowsEnabled(false);
topTenTable.setCustomizeColumns(false);
topTenTable.setCssDelegate(new MarkedMemberCssDelegate(false));
// establish a 2nd table if ownID position is greater than first table's size setting
if (!ownIdMembers.isEmpty()) {
tableDataModel2 = new FlexiTableDataModelImpl<HighScoreTableEntry>(new HighScoreFlexiTableModel(ownIdMembers, anonymous, translate("highscore.anonymous"), ownIdentity), tableColumnModel);
FlexiTableElement tableElement = uifactory.addTableElement(getWindowControl(), "table2", tableDataModel2, getTranslator(), formLayout);
tableElement.setNumOfRowsEnabled(false);
tableElement.setCustomizeColumns(false);
tableElement.setCssDelegate(new MarkedMemberCssDelegate(true));
}
}
if (viewPosition && ownIdIndices.size() > 0) {
int amountWorse = allScores.length - ownIdIndices.get(0) - 1;
if (amountWorse > 0) {
mainVC.contextPut("relposition", translate("highscore.position.inrelation", new String[] { String.valueOf(amountWorse) }));
}
int ownRank = highscoreDataModel.getOwnTableEntry().getRank();
mainVC.contextPut("position", translate("highscore.position.yourposition", new String[] { String.valueOf(ownRank) }));
}
}
use of org.olat.user.DisplayPortraitController in project openolat by klemens.
the class UserAdminController method exposeUserDataToVC.
/**
* Add some user data to velocity container including the users portrait
* @param ureq
* @param identity
*/
private void exposeUserDataToVC(UserRequest ureq, Identity identity) {
removeAsListenerAndDispose(portraitCtr);
portraitCtr = new DisplayPortraitController(ureq, getWindowControl(), identity, true, true);
myContent.put("portrait", portraitCtr.getInitialComponent());
removeAsListenerAndDispose(userShortDescrCtr);
userShortDescrCtr = new UserShortDescription(ureq, getWindowControl(), identity);
myContent.put("userShortDescription", userShortDescrCtr.getInitialComponent());
}
use of org.olat.user.DisplayPortraitController in project OpenOLAT by OpenOLAT.
the class MessageEditController method initForm.
/**
* @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer,
* org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
*/
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
formLayout.setElementCssClass("o_sel_forum_message_form");
titleEl = uifactory.addTextElement("msgTitle", "msg.title", 100, message.getTitle(), formLayout);
titleEl.setElementCssClass("o_sel_forum_message_title");
titleEl.setMandatory(true);
titleEl.setNotEmptyCheck("error.field.not.empty");
bodyEl = uifactory.addRichTextElementForStringData("msgBody", "msg.body", message.getBody(), 15, -1, true, null, null, formLayout, ureq.getUserSession(), getWindowControl());
bodyEl.setMandatory(true);
bodyEl.setNotEmptyCheck("error.field.not.empty");
bodyEl.setMaxLength(MAX_BODY_LENGTH);
bodyEl.setNotLongerThanCheck(MAX_BODY_LENGTH, "input.toolong");
bodyEl.getEditorConfiguration().enableCharCount();
setEditPermissions(message);
// list existing attachments. init attachment layout now, to place it in
// right position
createOrUpdateAttachmentListLayout(formLayout);
// provide upload field
if (foCallback.mayEditMessageAsModerator() || ((userIsMsgCreator) && (msgHasChildren == false))) {
fileUpload = uifactory.addFileElement(getWindowControl(), "msg.upload", formLayout);
fileUpload.addActionListener(FormEvent.ONCHANGE);
fileUpload.setMaxUploadSizeKB((int) FolderConfig.getLimitULKB(), "attachments.too.big", new String[] { ((Long) (FolderConfig.getLimitULKB() / 1024)).toString() });
}
if (foCallback.mayUsePseudonym() || guestOnly) {
String[] enablePseudonymValues = new String[] { translate("use.pseudonym.label") };
usePseudonymEl = uifactory.addCheckboxesHorizontal("use.pseudonym", formLayout, enableKeys, enablePseudonymValues);
if (StringHelper.containsNonWhitespace(message.getPseudonym()) || guestOnly || foCallback.pseudonymAsDefault()) {
usePseudonymEl.select(enableKeys[0], true);
}
pseudonymEl = uifactory.addTextElement("pseudonym", "pseudonym", 128, message.getPseudonym(), formLayout);
pseudonymEl.setElementCssClass("o_sel_forum_message_alias");
passwordEl = uifactory.addPasswordElement("password", "password", 128, "", formLayout);
passwordEl.setElementCssClass("o_sel_forum_message_alias_pass");
passwordEl.setPlaceholderKey("password.placeholder", null);
passwordEl.setAutocomplete("new-password");
if (guestOnly) {
usePseudonymEl.setVisible(false);
pseudonymEl.setLabel("use.pseudonym", null);
pseudonymEl.setMandatory(true);
proposedPseudonym = (String) ureq.getUserSession().getEntry("FOPseudo" + forum.getKey());
if (StringHelper.containsNonWhitespace(proposedPseudonym)) {
pseudonymEl.setValue(proposedPseudonym);
String proposedPassword = (String) ureq.getUserSession().getEntry("FOPseudo-" + proposedPseudonym);
if (StringHelper.containsNonWhitespace(proposedPassword)) {
passwordEl.setValue(proposedPassword);
}
}
} else if (userIsMsgCreator) {
pseudonymEl.setLabel(null, null);
usePseudonymEl.addActionListener(FormEvent.ONCHANGE);
proposedPseudonym = fm.getPseudonym(forum, getIdentity());
if (StringHelper.containsNonWhitespace(proposedPseudonym)) {
pseudonymEl.setValue(proposedPseudonym);
usePseudonymEl.select(enableKeys[0], true);
String proposedPassword = (String) ureq.getUserSession().getEntry("FOPseudo-" + proposedPseudonym);
if (StringHelper.containsNonWhitespace(proposedPassword)) {
passwordEl.setValue(proposedPassword);
}
}
usePseudonymEl.setMandatory(usePseudonymEl.isAtLeastSelected(1));
pseudonymEl.setVisible(usePseudonymEl.isAtLeastSelected(1));
passwordEl.setVisible(usePseudonymEl.isAtLeastSelected(1));
} else {
usePseudonymEl.setVisible(false);
pseudonymEl.setLabel("use.pseudonym", null);
pseudonymEl.setEnabled(false);
passwordEl.setVisible(false);
}
}
// save and cancel buttons
FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonLayout);
uifactory.addFormSubmitButton("msg.save", buttonLayout);
uifactory.addFormCancelButton("msg.cancel", buttonLayout, ureq, getWindowControl());
// show message replying to, if in reply modus
if (editMode == EditMode.reply) {
String previewPage = Util.getPackageVelocityRoot(this.getClass()) + "/msg-preview.html";
FormLayoutContainer replyMsgLayout = FormLayoutContainer.createCustomFormLayout("replyMsg", getTranslator(), previewPage);
uifactory.addSpacerElement("spacer1", formLayout, false);
formLayout.add(replyMsgLayout);
replyMsgLayout.setLabel("label.replytomsg", new String[] { StringHelper.escapeHtml(parentMessage.getTitle()) });
replyMsgLayout.contextPut("messageBody", parentMessage.getBody());
replyMsgLayout.contextPut("message", parentMessage);
replyMsgLayout.contextPut("guestOnly", new Boolean(guestOnly));
Identity creator = parentMessage.getCreator();
if (creator != null) {
replyMsgLayout.contextPut("identity", creator);
portraitCtr = new DisplayPortraitController(ureq, getWindowControl(), creator, true, true);
replyMsgLayout.put("portrait", portraitCtr.getInitialComponent());
}
}
}
use of org.olat.user.DisplayPortraitController in project OpenOLAT by OpenOLAT.
the class AccessRightsEditController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
if (member != null && formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
Controller portraitCtr = new DisplayPortraitController(ureq, getWindowControl(), member, true, true);
layoutCont.getFormItemComponent().put("portrait", portraitCtr.getInitialComponent());
listenTo(portraitCtr);
Controller userShortDescrCtr = new UserShortDescription(ureq, getWindowControl(), member);
layoutCont.getFormItemComponent().put("userShortDescription", userShortDescrCtr.getInitialComponent());
listenTo(userShortDescrCtr);
}
selectAll = uifactory.addFormLink("form.checkall", "form.checkall", null, formLayout, Link.LINK);
selectAll.setIconLeftCSS("o_icon o_icon-sm o_icon_check_on");
deselectAll = uifactory.addFormLink("form.uncheckall", "form.uncheckall", null, formLayout, Link.LINK);
deselectAll.setIconLeftCSS("o_icon o_icon-sm o_icon_check_off");
// binder
MultipleSelectionElement coachEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
coachEl.addActionListener(FormEvent.ONCHANGE);
coachEl.setVisible(grading);
MultipleSelectionElement reviewerEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
reviewerEl.addActionListener(FormEvent.ONCHANGE);
binderRow = new BinderAccessRightsRow(coachEl, reviewerEl, binder);
coachEl.setUserObject(binderRow);
reviewerEl.setUserObject(binderRow);
// sections
List<Section> sections = portfolioService.getSections(binder);
Map<Long, SectionAccessRightsRow> sectionMap = new HashMap<>();
for (Section section : sections) {
MultipleSelectionElement sectionCoachEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
sectionCoachEl.addActionListener(FormEvent.ONCHANGE);
sectionCoachEl.setVisible(grading);
MultipleSelectionElement sectionReviewerEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
sectionReviewerEl.addActionListener(FormEvent.ONCHANGE);
SectionAccessRightsRow sectionRow = new SectionAccessRightsRow(sectionCoachEl, sectionReviewerEl, section, binderRow);
binderRow.getSections().add(sectionRow);
sectionMap.put(section.getKey(), sectionRow);
sectionCoachEl.setUserObject(sectionRow);
sectionReviewerEl.setUserObject(sectionRow);
}
// pages
List<Page> pages = portfolioService.getPages(binder, null);
for (Page page : pages) {
Section section = page.getSection();
SectionAccessRightsRow sectionRow = sectionMap.get(section.getKey());
MultipleSelectionElement pageCoachEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
pageCoachEl.addActionListener(FormEvent.ONCHANGE);
pageCoachEl.setVisible(grading);
MultipleSelectionElement pageReviewerEl = uifactory.addCheckboxesHorizontal("access-" + (counter++), null, formLayout, theKeys, theValues);
pageReviewerEl.addActionListener(FormEvent.ONCHANGE);
PortfolioElementAccessRightsRow pageRow = new PortfolioElementAccessRightsRow(pageCoachEl, pageReviewerEl, page, sectionRow);
sectionRow.getPages().add(pageRow);
pageCoachEl.setUserObject(pageRow);
pageReviewerEl.setUserObject(pageRow);
}
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("binderRow", binderRow);
layoutCont.contextPut("grading", new Boolean(grading));
}
if (hasButtons) {
FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonsCont);
buttonsCont.setRootForm(mainForm);
formLayout.add("buttons", buttonsCont);
uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
removeLink = uifactory.addFormLink("remove", buttonsCont, Link.BUTTON);
if (canEdit) {
uifactory.addFormSubmitButton("save", buttonsCont);
}
}
}
Aggregations