use of org.olat.core.gui.components.link.LinkPopupSettings in project openolat by klemens.
the class CourseRuntimeController method initToolsMyCourse.
private void initToolsMyCourse(ICourse course, UserCourseEnvironmentImpl uce) {
boolean assessmentLock = isAssessmentLock();
myCourse = new Dropdown("myCourse", "header.tools.mycourse", false, getTranslator());
myCourse.setElementCssClass("dropdown-menu-right");
myCourse.setIconCSS("o_icon o_icon_user");
// Personal tools on right side
CourseConfig cc = course.getCourseConfig();
if ((course.hasAssessableNodes() || cc.isCertificateEnabled()) && !isGuestOnly && !assessmentLock && uce != null) {
// link to efficiency statements should
// - not appear when not configured in course configuration
// - not appear when configured in course configuration but no assessable
// node exist
// - appear but dimmed when configured, assessable node exist but no
// assessment data exists for user
// - appear as link when configured, assessable node exist and assessment
// data exists for user
efficiencyStatementsLink = LinkFactory.createToolLink("efficiencystatement", translate("command.efficiencystatement"), this, "o_icon_certificate");
efficiencyStatementsLink.setVisible(cc.isEfficencyStatementEnabled() || cc.isCertificateEnabled());
myCourse.addComponent(efficiencyStatementsLink);
if (cc.isEfficencyStatementEnabled() || cc.isCertificateEnabled()) {
boolean certification = uce.hasEfficiencyStatementOrCertificate(false);
efficiencyStatementsLink.setVisible(certification);
}
}
if (!isGuestOnly && !assessmentLock) {
noteLink = LinkFactory.createToolLink("personalnote", translate("command.personalnote"), this, "o_icon_notes");
noteLink.setPopup(new LinkPopupSettings(750, 550, "notes"));
myCourse.addComponent(noteLink);
}
if (allowBookmark && !isGuestOnly) {
boolean marked = markManager.isMarked(getRepositoryEntry(), getIdentity(), null);
String css = marked ? Mark.MARK_CSS_ICON : Mark.MARK_ADD_CSS_ICON;
bookmarkLink = LinkFactory.createToolLink("bookmark", translate("command.bookmark"), this, css);
bookmarkLink.setTitle(translate(marked ? "details.bookmark.remove" : "details.bookmark"));
myCourse.addComponent(bookmarkLink);
}
if (uce != null) {
if (myCourse.size() > 0 && (uce.getCoachedGroups().size() > 0 || uce.getParticipatingGroups().size() > 0 || uce.getWaitingLists().size() > 0)) {
myCourse.addComponent(new Spacer(""));
}
// 2) add coached groups
if (uce.getCoachedGroups().size() > 0) {
for (BusinessGroup group : uce.getCoachedGroups()) {
Link link = LinkFactory.createToolLink(CMD_START_GROUP_PREFIX + group.getKey(), "group", StringHelper.escapeHtml(group.getName()), this);
link.setIconLeftCSS("o_icon o_icon-fw o_icon_group");
link.setUserObject(group);
link.setEnabled(!assessmentLock);
myCourse.addComponent(link);
}
}
// 3) add participating groups
if (uce.getParticipatingGroups().size() > 0) {
for (BusinessGroup group : uce.getParticipatingGroups()) {
Link link = LinkFactory.createToolLink(CMD_START_GROUP_PREFIX + group.getKey(), "group", StringHelper.escapeHtml(group.getName()), this);
link.setIconLeftCSS("o_icon o_icon-fw o_icon_group");
link.setUserObject(group);
link.setEnabled(!assessmentLock);
myCourse.addComponent(link);
}
}
// 5) add waiting-list groups
if (uce.getWaitingLists().size() > 0) {
for (BusinessGroup group : uce.getWaitingLists()) {
int pos = businessGroupService.getPositionInWaitingListFor(getIdentity(), group);
String name = StringHelper.escapeHtml(group.getName()) + " (" + pos + ")";
Link link = LinkFactory.createToolLink(CMD_START_GROUP_PREFIX + group.getKey(), "group", name, this);
link.setIconLeftCSS("o_icon o_icon-fw o_icon_group");
link.setUserObject(group);
link.setEnabled(false);
myCourse.addComponent(link);
}
}
if (repositoryService.isParticipantAllowedToLeave(getRepositoryEntry()) && !assessmentLock && !roles.isGuestOnly() && !uce.isCourseReadOnly() && isAllowedToLeave(uce)) {
leaveLink = LinkFactory.createToolLink("sign.out", "leave", translate("sign.out"), this);
leaveLink.setIconLeftCSS("o_icon o_icon-fw o_icon_sign_out");
myCourse.addComponent(new Spacer("leaving-space"));
myCourse.addComponent(leaveLink);
}
}
if (myCourse.size() > 0) {
toolbarPanel.addTool(myCourse, Align.right);
}
}
use of org.olat.core.gui.components.link.LinkPopupSettings in project openolat by klemens.
the class PageRunController method initTools.
@Override
public void initTools() {
editLink(!openInEditMode);
stackPanel.addTool(editLink, Align.left);
editMetadataLink = LinkFactory.createToolLink("edit.page.metadata", translate("edit.page.metadata"), this);
editMetadataLink.setIconLeftCSS("o_icon o_icon-lg o_icon_edit_metadata");
editMetadataLink.setVisible(secCallback.canEditPageMetadata(page, assignments));
stackPanel.addTool(editMetadataLink, Align.left);
if (secCallback.canExportBinder()) {
Dropdown exportTools = new Dropdown("export.page", "export.page", false, getTranslator());
exportTools.setElementCssClass("o_sel_pf_export_tools");
exportTools.setIconCSS("o_icon o_icon_download");
stackPanel.addTool(exportTools, Align.left);
printLink = LinkFactory.createToolLink("export.page.onepage", translate("export.page.onepage"), this);
printLink.setIconLeftCSS("o_icon o_icon_print");
printLink.setPopup(new LinkPopupSettings(950, 750, "binder"));
exportTools.addComponent(printLink);
}
moveToTrashLink = LinkFactory.createToolLink("delete.page", translate("delete.page"), this);
moveToTrashLink.setIconLeftCSS("o_icon o_icon-lg o_icon_delete_item");
moveToTrashLink.setElementCssClass("o_sel_pf_move_page_to_trash");
moveToTrashLink.setVisible(secCallback.canDeletePage(page));
stackPanel.addTool(moveToTrashLink, Align.right);
if (secCallback.canRestorePage(page)) {
restoreLink = LinkFactory.createToolLink("restore.page", translate("restore.page"), this);
restoreLink.setIconLeftCSS("o_icon o_icon-lg o_icon_restore");
stackPanel.addTool(restoreLink, Align.left);
deleteLink = LinkFactory.createToolLink("delete.def.page", translate("delete.def.page"), this);
deleteLink.setIconLeftCSS("o_icon o_icon-lg o_icon_delete_item");
deleteLink.setElementCssClass("o_sel_pf_delete_page");
stackPanel.addTool(deleteLink, Align.left);
}
}
use of org.olat.core.gui.components.link.LinkPopupSettings in project OpenOLAT by OpenOLAT.
the class CourseRuntimeController method initToolsMyCourse.
private void initToolsMyCourse(ICourse course, UserCourseEnvironmentImpl uce) {
boolean assessmentLock = isAssessmentLock();
myCourse = new Dropdown("myCourse", "header.tools.mycourse", false, getTranslator());
myCourse.setElementCssClass("dropdown-menu-right");
myCourse.setIconCSS("o_icon o_icon_user");
// Personal tools on right side
CourseConfig cc = course.getCourseConfig();
if ((course.hasAssessableNodes() || cc.isCertificateEnabled()) && !isGuestOnly && !assessmentLock && uce != null) {
// link to efficiency statements should
// - not appear when not configured in course configuration
// - not appear when configured in course configuration but no assessable
// node exist
// - appear but dimmed when configured, assessable node exist but no
// assessment data exists for user
// - appear as link when configured, assessable node exist and assessment
// data exists for user
efficiencyStatementsLink = LinkFactory.createToolLink("efficiencystatement", translate("command.efficiencystatement"), this, "o_icon_certificate");
efficiencyStatementsLink.setVisible(cc.isEfficencyStatementEnabled() || cc.isCertificateEnabled());
myCourse.addComponent(efficiencyStatementsLink);
if (cc.isEfficencyStatementEnabled() || cc.isCertificateEnabled()) {
boolean certification = uce.hasEfficiencyStatementOrCertificate(false);
efficiencyStatementsLink.setVisible(certification);
}
}
if (!isGuestOnly && !assessmentLock) {
noteLink = LinkFactory.createToolLink("personalnote", translate("command.personalnote"), this, "o_icon_notes");
noteLink.setPopup(new LinkPopupSettings(750, 550, "notes"));
myCourse.addComponent(noteLink);
}
if (allowBookmark && !isGuestOnly) {
boolean marked = markManager.isMarked(getRepositoryEntry(), getIdentity(), null);
String css = marked ? Mark.MARK_CSS_ICON : Mark.MARK_ADD_CSS_ICON;
bookmarkLink = LinkFactory.createToolLink("bookmark", translate("command.bookmark"), this, css);
bookmarkLink.setTitle(translate(marked ? "details.bookmark.remove" : "details.bookmark"));
myCourse.addComponent(bookmarkLink);
}
if (uce != null) {
if (myCourse.size() > 0 && (uce.getCoachedGroups().size() > 0 || uce.getParticipatingGroups().size() > 0 || uce.getWaitingLists().size() > 0)) {
myCourse.addComponent(new Spacer(""));
}
// 2) add coached groups
if (uce.getCoachedGroups().size() > 0) {
for (BusinessGroup group : uce.getCoachedGroups()) {
Link link = LinkFactory.createToolLink(CMD_START_GROUP_PREFIX + group.getKey(), "group", StringHelper.escapeHtml(group.getName()), this);
link.setIconLeftCSS("o_icon o_icon-fw o_icon_group");
link.setUserObject(group);
link.setEnabled(!assessmentLock);
myCourse.addComponent(link);
}
}
// 3) add participating groups
if (uce.getParticipatingGroups().size() > 0) {
for (BusinessGroup group : uce.getParticipatingGroups()) {
Link link = LinkFactory.createToolLink(CMD_START_GROUP_PREFIX + group.getKey(), "group", StringHelper.escapeHtml(group.getName()), this);
link.setIconLeftCSS("o_icon o_icon-fw o_icon_group");
link.setUserObject(group);
link.setEnabled(!assessmentLock);
myCourse.addComponent(link);
}
}
// 5) add waiting-list groups
if (uce.getWaitingLists().size() > 0) {
for (BusinessGroup group : uce.getWaitingLists()) {
int pos = businessGroupService.getPositionInWaitingListFor(getIdentity(), group);
String name = StringHelper.escapeHtml(group.getName()) + " (" + pos + ")";
Link link = LinkFactory.createToolLink(CMD_START_GROUP_PREFIX + group.getKey(), "group", name, this);
link.setIconLeftCSS("o_icon o_icon-fw o_icon_group");
link.setUserObject(group);
link.setEnabled(false);
myCourse.addComponent(link);
}
}
if (repositoryService.isParticipantAllowedToLeave(getRepositoryEntry()) && !assessmentLock && !roles.isGuestOnly() && !uce.isCourseReadOnly() && isAllowedToLeave(uce)) {
leaveLink = LinkFactory.createToolLink("sign.out", "leave", translate("sign.out"), this);
leaveLink.setIconLeftCSS("o_icon o_icon-fw o_icon_sign_out");
myCourse.addComponent(new Spacer("leaving-space"));
myCourse.addComponent(leaveLink);
}
}
if (myCourse.size() > 0) {
toolbarPanel.addTool(myCourse, Align.right);
}
}
use of org.olat.core.gui.components.link.LinkPopupSettings in project OpenOLAT by OpenOLAT.
the class TableOfContentController method initTools.
@Override
public void initTools() {
if (secCallback.canEditMetadataBinder()) {
editBinderMetadataLink = LinkFactory.createToolLink("edit.binder.metadata", translate("edit.binder.metadata"), this);
editBinderMetadataLink.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
stackPanel.addTool(editBinderMetadataLink, Align.left);
}
if (secCallback.canMoveToTrashBinder(binder)) {
moveToTrashBinderLink = LinkFactory.createToolLink("delete.binder", translate("delete.binder"), this);
moveToTrashBinderLink.setIconLeftCSS("o_icon o_icon-lg o_icon_delete_item");
stackPanel.addTool(moveToTrashBinderLink, Align.left);
}
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.canDeleteBinder(binder)) {
deleteBinderLink = LinkFactory.createToolLink("delete.binder", translate("delete.binder"), this);
deleteBinderLink.setIconLeftCSS("o_icon o_icon-lg o_icon_delete_item");
stackPanel.addTool(deleteBinderLink, Align.left);
restoreBinderLink = LinkFactory.createToolLink("restore.binder", translate("restore.binder"), this);
restoreBinderLink.setIconLeftCSS("o_icon o_icon-lg o_icon_restore");
stackPanel.addTool(restoreBinderLink, Align.left);
}
if (secCallback.canAddSection()) {
newSectionTool = LinkFactory.createToolLink("new.section", translate("create.new.section"), this);
newSectionTool.setIconLeftCSS("o_icon o_icon-lg o_icon_new_portfolio");
newSectionTool.setElementCssClass("o_sel_pf_new_section");
stackPanel.addTool(newSectionTool, 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(sectionList != null && sectionList.size() > 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(sectionList != null && sectionList.size() > 0);
stackPanel.addTool(newAssignmentLink, Align.right);
}
}
use of org.olat.core.gui.components.link.LinkPopupSettings in project OpenOLAT by OpenOLAT.
the class MembersAvatarDisplayRunController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
Comparator<Identity> idComparator = new IdentityComparator();
Collections.sort(owners, idComparator);
Collections.sort(coaches, idComparator);
Collections.sort(participants, idComparator);
Collections.sort(waiting, idComparator);
if (canEmail) {
allEmailLink = uifactory.addFormLink("email", "members.email.title", null, formLayout, Link.BUTTON);
allEmailLink.setIconLeftCSS("o_icon o_icon_mail");
}
IdentityEnvironment idEnv = ureq.getUserSession().getIdentityEnvironment();
Identity ownId = idEnv.getIdentity();
Roles roles = idEnv.getRoles();
if (editable && (roles.isOLATAdmin() || roles.isGroupManager() || owners.contains(ownId) || coaches.contains(ownId) || (canDownload && !waiting.contains(ownId)))) {
downloadLink = uifactory.addFormLink("download", "members.download", null, formLayout, Link.BUTTON);
downloadLink.setIconLeftCSS("o_icon o_icon_download");
if (formLayout instanceof FormLayoutContainer) {
printLink = LinkFactory.createButton("print", ((FormLayoutContainer) formLayout).getFormItemComponent(), this);
printLink.setIconLeftCSS("o_icon o_icon_print o_icon-lg");
printLink.setPopup(new LinkPopupSettings(700, 500, "print-members"));
((FormLayoutContainer) formLayout).getFormItemComponent().put("print", printLink);
}
}
Set<Long> duplicateCatcher = deduplicateList ? new HashSet<Long>() : null;
ownerList = initFormMemberList("owners", owners, duplicateCatcher, formLayout, canEmail);
coachList = initFormMemberList("coaches", coaches, duplicateCatcher, formLayout, canEmail);
participantList = initFormMemberList("participants", participants, duplicateCatcher, formLayout, canEmail);
waitingtList = initFormMemberList("waiting", waiting, duplicateCatcher, formLayout, canEmail);
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("showOwners", showOwners);
layoutCont.contextPut("hasOwners", new Boolean(!ownerList.isEmpty()));
layoutCont.contextPut("showCoaches", showCoaches);
layoutCont.contextPut("hasCoaches", new Boolean(!coachList.isEmpty()));
layoutCont.contextPut("showParticipants", showParticipants);
layoutCont.contextPut("hasParticipants", new Boolean(!participantList.isEmpty()));
layoutCont.contextPut("showWaiting", showWaiting);
layoutCont.contextPut("hasWaiting", new Boolean(!waitingtList.isEmpty()));
}
}
Aggregations