use of org.olat.core.gui.components.link.LinkPopupSettings in project OpenOLAT by OpenOLAT.
the class BinderPageListController method initTools.
@Override
public void initTools() {
if (secCallback.canExportBinder()) {
Dropdown exportTools = new Dropdown("export.binder", "export.binder", false, getTranslator());
exportTools.setElementCssClass("o_sel_pf_export_tools");
exportTools.setIconCSS("o_icon o_icon_download");
stackPanel.addTool(exportTools, Align.left);
exportBinderAsCpLink = LinkFactory.createToolLink("export.binder.cp", translate("export.binder.cp"), this);
exportBinderAsCpLink.setIconLeftCSS("o_icon o_icon_download");
exportTools.addComponent(exportBinderAsCpLink);
printLink = LinkFactory.createToolLink("export.binder.onepage", translate("export.binder.onepage"), this);
printLink.setIconLeftCSS("o_icon o_icon_print");
printLink.setPopup(new LinkPopupSettings(950, 750, "binder"));
exportTools.addComponent(printLink);
}
if (secCallback.canAddSection()) {
newSectionLink = LinkFactory.createToolLink("new.section", translate("create.new.section"), this);
newSectionLink.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
newSectionLink.setElementCssClass("o_sel_pf_new_section");
stackPanel.addTool(newSectionLink, Align.right);
}
if (secCallback.canAddPage(null)) {
newEntryLink = LinkFactory.createToolLink("new.page", translate("create.new.page"), this);
newEntryLink.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
newEntryLink.setElementCssClass("o_sel_pf_new_entry");
newEntryLink.setVisible(model.getRowCount() > 0);
stackPanel.addTool(newEntryLink, Align.right);
}
if (secCallback.canNewAssignment()) {
newAssignmentLink = LinkFactory.createToolLink("new.assignment", translate("create.new.assignment"), this);
newAssignmentLink.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
newAssignmentLink.setElementCssClass("o_sel_pf_new_assignment");
newAssignmentLink.setVisible(model.getRowCount() > 0);
stackPanel.addTool(newAssignmentLink, Align.right);
}
}
use of org.olat.core.gui.components.link.LinkPopupSettings in project OpenOLAT by OpenOLAT.
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.core.gui.components.link.LinkPopupSettings in project OpenOLAT by OpenOLAT.
the class CourseRuntimeController method initGeneralTools.
private void initGeneralTools(ICourse course) {
boolean assessmentLock = isAssessmentLock();
CourseConfig cc = course.getCourseConfig();
if (!assessmentLock && showInfos) {
detailsLink = LinkFactory.createToolLink("courseconfig", translate("command.courseconfig"), this, "o_icon_details");
toolbarPanel.addTool(detailsLink);
}
boolean calendarIsEnabled = !assessmentLock && !isGuestOnly && calendarModule.isEnabled() && calendarModule.isEnableCourseToolCalendar() && reSecurity.canLaunch();
if (calendarIsEnabled && getUserCourseEnvironment() != null) {
calendarLink = LinkFactory.createToolLink("calendar", translate("command.calendar"), this, "o_icon_calendar");
calendarLink.setPopup(new LinkPopupSettings(950, 750, "cal"));
calendarLink.setVisible(cc.isCalendarEnabled());
toolbarPanel.addTool(calendarLink);
}
if (!assessmentLock) {
glossary = new Dropdown("glossary", "command.glossary", false, getTranslator());
glossary.setIconCSS("o_icon o_FileResource-GLOSSARY_icon");
glossary.setVisible(cc.hasGlossary());
openGlossaryLink = LinkFactory.createToolLink("command.glossary.open", translate("command.glossary.open"), this);
openGlossaryLink.setPopup(new LinkPopupSettings(950, 750, "gloss"));
glossary.addComponent(openGlossaryLink);
enableGlossaryLink = LinkFactory.createToolLink("command.glossary.on.off", translate("command.glossary.on.alt"), this);
glossary.addComponent(enableGlossaryLink);
toolbarPanel.addTool(glossary);
}
if (!assessmentLock && isLecturesLinkEnabled()) {
lecturesLink = LinkFactory.createToolLink("command.lectures", translate("command.lectures"), this, "o_icon_lecture");
toolbarPanel.addTool(lecturesLink);
}
// add group chat to toolbox
boolean chatIsEnabled = !assessmentLock && !isGuestOnly && imModule.isEnabled() && imModule.isCourseEnabled() && reSecurity.canLaunch();
if (chatIsEnabled && getUserCourseEnvironment() != null && !getUserCourseEnvironment().isCourseReadOnly()) {
chatLink = LinkFactory.createToolLink("chat", translate("command.coursechat"), this, "o_icon_chat");
chatLink.setVisible(imModule.isCourseEnabled() && cc.isChatEnabled());
toolbarPanel.addTool(chatLink);
}
// add course search to toolbox
boolean isSearchEnabled = !assessmentLock && searchModule.isSearchAllowed(roles);
if (isSearchEnabled) {
searchLink = LinkFactory.createToolLink("coursesearch", translate("command.coursesearch"), this, "o_icon_search");
searchLink.setVisible(cc.isCourseSearchEnabled());
toolbarPanel.addTool(searchLink);
}
}
use of org.olat.core.gui.components.link.LinkPopupSettings in project openolat by klemens.
the class BinderPageListController method initTools.
@Override
public void initTools() {
if (secCallback.canExportBinder()) {
Dropdown exportTools = new Dropdown("export.binder", "export.binder", false, getTranslator());
exportTools.setElementCssClass("o_sel_pf_export_tools");
exportTools.setIconCSS("o_icon o_icon_download");
stackPanel.addTool(exportTools, Align.left);
exportBinderAsCpLink = LinkFactory.createToolLink("export.binder.cp", translate("export.binder.cp"), this);
exportBinderAsCpLink.setIconLeftCSS("o_icon o_icon_download");
exportTools.addComponent(exportBinderAsCpLink);
printLink = LinkFactory.createToolLink("export.binder.onepage", translate("export.binder.onepage"), this);
printLink.setIconLeftCSS("o_icon o_icon_print");
printLink.setPopup(new LinkPopupSettings(950, 750, "binder"));
exportTools.addComponent(printLink);
}
if (secCallback.canAddSection()) {
newSectionLink = LinkFactory.createToolLink("new.section", translate("create.new.section"), this);
newSectionLink.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
newSectionLink.setElementCssClass("o_sel_pf_new_section");
stackPanel.addTool(newSectionLink, Align.right);
}
if (secCallback.canAddPage(null)) {
newEntryLink = LinkFactory.createToolLink("new.page", translate("create.new.page"), this);
newEntryLink.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
newEntryLink.setElementCssClass("o_sel_pf_new_entry");
newEntryLink.setVisible(model.getRowCount() > 0);
stackPanel.addTool(newEntryLink, Align.right);
}
if (secCallback.canNewAssignment()) {
newAssignmentLink = LinkFactory.createToolLink("new.assignment", translate("create.new.assignment"), this);
newAssignmentLink.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
newAssignmentLink.setElementCssClass("o_sel_pf_new_assignment");
newAssignmentLink.setVisible(model.getRowCount() > 0);
stackPanel.addTool(newAssignmentLink, Align.right);
}
}
use of org.olat.core.gui.components.link.LinkPopupSettings 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());
}
}
}
}
Aggregations