/** * @see org.olat.login.auth.AuthenticationController#init(org.olat.core.gui.UserRequest, * org.olat.core.gui.control.WindowControl) */ public OLATAuthenticationController(UserRequest ureq, WindowControl winControl) { // use fallback translator to registration module super( ureq, winControl, Util.createPackageTranslator(RegistrationManager.class, ureq.getLocale())); loginComp = createVelocityContainer("olat_log", "olatlogin"); if (userModule.isAnyPasswordChangeAllowed()) { pwLink = LinkFactory.createLink("_olat_login_change_pwd", "menu.pw", loginComp, this); pwLink.setElementCssClass("o_login_pwd"); } if (registrationModule.isSelfRegistrationEnabled() && registrationModule.isSelfRegistrationLoginEnabled()) { registerLink = LinkFactory.createLink("_olat_login_register", "menu.register", loginComp, this); registerLink.setElementCssClass("o_login_register"); registerLink.setTitle("menu.register.alt"); } // prepare login form loginForm = new OLATAuthentcationForm(ureq, winControl, "olat_login", getTranslator()); listenTo(loginForm); loginComp.put("loginForm", loginForm.getInitialComponent()); // Check if form is triggered by external loginworkflow that has been failed if (ureq.getParameterSet().contains(PARAM_LOGINERROR)) { showError(translate("login.error", WebappHelper.getMailConfig("mailReplyTo"))); } putInitialPanel(loginComp); }
public CourseGlossaryToolLinkController( WindowControl wControl, UserRequest ureq, ICourse course, Translator translator, boolean allowGlossaryEditing, CourseEnvironment courseEnvironment, GlossaryMarkupItemController glossMarkupItmCtr) { super(ureq, wControl, translator); setBasePackage(RunMainController.class); this.allowGlossaryEditing = allowGlossaryEditing; courseEnvir = courseEnvironment; guiPrefsKey = CourseGlossaryFactory.createGuiPrefsKey(course); mainVC = createVelocityContainer("glossaryToolLink"); Preferences prefs = ureq.getUserSession().getGuiPreferences(); Boolean state = (Boolean) prefs.get(CourseGlossaryToolLinkController.class, guiPrefsKey); if (state == null || !state.booleanValue()) { onCommand = LinkFactory.createLink("command.glossary.on", mainVC, this); onCommand.setTitle("command.glossary.on.alt"); onCommand.setCustomEnabledLinkCSS("b_toolbox_toggle"); } else { offCommand = LinkFactory.createLink("command.glossary.off", mainVC, this); offCommand.setTitle("command.glossary.off.alt"); offCommand.setCustomEnabledLinkCSS("b_toolbox_toggle"); } // keep reference to textMarkerContainerCtr for later enabling/disabling this.glossMarkupItmCtr = glossMarkupItmCtr; putInitialPanel(mainVC); }
/** * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, * org.olat.core.gui.components.Component, org.olat.core.gui.control.Event) */ @Override public void event(final UserRequest ureq, final Component source, final Event event) { if (source == myEntriesLink) { searchCtr.doSearchByOwnerLimitType(ureq.getIdentity(), limitTypes); mainVC.contextPut("subtitle", translate("referencableSearch." + CMD_MY_ENTRIES)); myEntriesLink.setCustomEnabledLinkCSS("b_selected"); allEntriesLink.removeCSS(); searchEntriesLink.removeCSS(); } if (source == allEntriesLink) { searchCtr.doSearchForReferencableResourcesLimitType( ureq.getIdentity(), limitTypes, ureq.getUserSession().getRoles()); mainVC.contextPut("subtitle", translate("referencableSearch." + CMD_ALL_ENTRIES)); allEntriesLink.setCustomEnabledLinkCSS("b_selected"); myEntriesLink.removeCSS(); searchEntriesLink.removeCSS(); } if (source == searchEntriesLink) { mainVC.contextPut("subtitle", translate("referencableSearch." + CMD_SEARCH_ENTRIES)); // start with search view searchCtr.displaySearchForm(); mainVC.contextPut("subtitle", translate("referencableSearch." + CMD_SEARCH)); searchEntriesLink.setCustomEnabledLinkCSS("b_selected"); myEntriesLink.removeCSS(); allEntriesLink.removeCSS(); } if (source == createRessourceButton) { removeAsListenerAndDispose(addController); addController = new RepositoryAddController(ureq, getWindowControl(), getAction(ACTION_CREATE)); listenTo(addController); removeAsListenerAndDispose(cmc); cmc = new CloseableModalController( getWindowControl(), translate("close"), addController.getInitialComponent()); listenTo(cmc); cmc.activate(); } if (source == importRessourceButton) { removeAsListenerAndDispose(addController); addController = new RepositoryAddController(ureq, getWindowControl(), getAction(ACTION_IMPORT)); listenTo(addController); removeAsListenerAndDispose(cmc); cmc = new CloseableModalController( getWindowControl(), translate("close"), addController.getInitialComponent()); listenTo(cmc); cmc.activate(); } }
private void checkChats(UserRequest ureq) { List<?> allChats = null; if (ureq != null) { allChats = ureq.getUserSession().getChats(); } if (allChats == null || allChats.size() == 0) { startButton.setEnabled(true); myContent.contextPut("hasChatWindowOpen", false); } else { startButton.setEnabled(false); myContent.contextPut("hasChatWindowOpen", true); } }
public GuiDemoTooltipsController(UserRequest ureq, WindowControl wControl) { super(ureq, wControl); Link button = LinkFactory.createButton("button", content, this); button.setTooltip("tooltip.content"); Link linkT = LinkFactory.createLink("linkT", content, this); linkT.setTooltip("tooltip.content"); Link link1 = LinkFactory.createLink("link1", content, this); link1.setTooltip("tooltip.content"); Link link2 = LinkFactory.createLink("link2", content, this); link2.setTooltip("tooltip.content"); // link with component content /** * works when passing a custom html id like id="blalala" and then fetching the content from this * id with getElementById("id").innerHTML but with the component the component is not invisible * and gets renderer somewhere and somehow not */ LinkFactory.createLink("link3", content, this); content.put("tooltipContent", tooltipContent); link4 = LinkFactory.createLink("link4", tooltipContent, this); // add source view control Controller sourceview = new SourceViewController(ureq, wControl, this.getClass(), content); content.put("sourceview", sourceview.getInitialComponent()); putInitialPanel(content); }
@Override protected void initRuntimeTools(Dropdown toolsDropdown) { if (reSecurity.isEntryAdmin()) { membersLink = LinkFactory.createToolLink( "members", translate("details.members"), this, "o_sel_repo_members"); membersLink.setIconLeftCSS("o_icon o_icon-fw o_icon_membersmanagement"); toolsDropdown.addComponent(membersLink); } if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach()) { assessmentLink = LinkFactory.createToolLink( "assessment", translate("command.openassessment"), this, "o_icon_assessment_tool"); assessmentLink.setElementCssClass("o_sel_course_assessment_tool"); toolsDropdown.addComponent(assessmentLink); } if (reSecurity.isEntryAdmin()) { RepositoryEntry re = getRepositoryEntry(); ordersLink = LinkFactory.createToolLink( "bookings", translate("details.orders"), this, "o_sel_repo_booking"); ordersLink.setIconLeftCSS("o_icon o_icon-fw o_icon_booking"); boolean booking = acService.isResourceAccessControled(re.getOlatResource(), null); ordersLink.setEnabled(booking); toolsDropdown.addComponent(ordersLink); } }
/** * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, * org.olat.core.gui.components.Component, org.olat.core.gui.control.Event) */ @Override public void event(UserRequest ureq, Component source, Event event) { if (source == link4) { getWindowControl().setInfo("You clicked a link rendered in a tooltip!"); link4.setDirty(true); } }
private void init(UserRequest ureq) { startButton = LinkFactory.createButton("start", myContent, this); startButton.setElementCssClass("o_sel_start_qti12_test"); startButton.setPrimary(true); startButton.setVisible(!userCourseEnv.isCourseReadOnly()); // fetch disclaimer file String sDisclaimer = (String) modConfig.get(IQEditController.CONFIG_KEY_DISCLAIMER); if (sDisclaimer != null) { VFSContainer baseContainer = userCourseEnv.getCourseEnvironment().getCourseFolderContainer(); int lastSlash = sDisclaimer.lastIndexOf('/'); if (lastSlash != -1) { baseContainer = (VFSContainer) baseContainer.resolve(sDisclaimer.substring(0, lastSlash)); sDisclaimer = sDisclaimer.substring(lastSlash); // first check if disclaimer exists on filesystem if (baseContainer == null || baseContainer.resolve(sDisclaimer) == null) { showWarning("disclaimer.file.invalid", sDisclaimer); } else { // screenreader do not like iframes, display inline iFrameCtr = new IFrameDisplayController(ureq, getWindowControl(), baseContainer); listenTo(iFrameCtr); // dispose automatically myContent.put("disc", iFrameCtr.getInitialComponent()); iFrameCtr.setCurrentURI(sDisclaimer); myContent.contextPut("hasDisc", Boolean.TRUE); } } } // push title and learning objectives, only visible on intro page myContent.contextPut("menuTitle", courseNode.getShortTitle()); myContent.contextPut("displayTitle", courseNode.getLongTitle()); // Adding learning objectives String learningObj = courseNode.getLearningObjectives(); if (learningObj != null) { Component learningObjectives = ObjectivesHelper.createLearningObjectivesComponent(learningObj, ureq); myContent.put("learningObjectives", learningObjectives); myContent.contextPut("hasObjectives", learningObj); // dummy value, just an exists operator } if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) { checkChats(ureq); singleUserEventCenter.registerFor( this, getIdentity(), InstantMessagingService.TOWER_EVENT_ORES); } }
public GoToMeetingController( UserRequest ureq, WindowControl wControl, GoToMeeting meeting, boolean administrator, boolean moderator, boolean readOnly) { super(ureq, wControl); this.readOnly = readOnly; this.moderator = moderator; this.administrator = administrator; mainVC = createVelocityContainer("meeting"); mainVC.contextPut("title", meeting.getName()); mainVC.contextPut("description", meeting.getDescription()); if (administrator || moderator) { startLink = LinkFactory.createButtonLarge("training.start", mainVC, this); startLink.setTarget("_blank"); } registerLink = LinkFactory.createButtonLarge("training.register", mainVC, this); confirmLink = LinkFactory.createButtonLarge("training.confirm", mainVC, this); confirmLink.setTarget("_blank"); joinLink = LinkFactory.createButtonLarge("training.join", mainVC, this); joinLink.setTarget("_blank"); openRecordingsLink = LinkFactory.createButton("recordings", mainVC, this); GoToError error = new GoToError(); this.meeting = meetingMgr.getMeeting(meeting, error); this.registrant = meetingMgr.getRegistrant(meeting, getIdentity()); if (error.hasError() && error.getError() != null) { mainVC.contextPut("errorMessage", translate(error.getError().i18nKey())); } List<GoToRecordingsG2T> recordings = meetingMgr.getRecordings(meeting, error); openRecordingsLink.setVisible(recordings != null && recordings.size() > 0); Date start = meeting.getStartDate(); Date end = meeting.getEndDate(); Formatter formatter = Formatter.getInstance(getLocale()); mainVC.contextPut("start", formatter.formatDateAndTime(start)); mainVC.contextPut("end", formatter.formatDateAndTime(end)); putInitialPanel(mainVC); updateButtons(); }
public MoveCopySubtreeController( UserRequest ureq, WindowControl wControl, OLATResourceable ores, CourseEditorTreeNode moveCopyFrom, boolean copy) { super(ureq, wControl); this.ores = ores; this.moveCopyFrom = moveCopyFrom; this.copy = copy; ICourse course = CourseFactory.getCourseEditSession(ores.getResourceableId()); addLoggingResourceable(LoggingResourceable.wrap(course)); addLoggingResourceable(LoggingResourceable.wrap(moveCopyFrom.getCourseNode())); insertTree = new MenuTree(null, "copy_node_selection", this); insertTree.enableInsertTool(true); insertModel = new InsertTreeModel(course.getEditorTreeModel().getRootNode(), moveCopyFrom); insertTree.setTreeModel(insertModel); VelocityContainer mainVC = createVelocityContainer("moveCopyNode"); selectButton = LinkFactory.createButton("insertAtSelectedTreepos", mainVC, this); selectButton.setCustomEnabledLinkCSS("btn btn-primary"); selectButton.setCustomDisabledLinkCSS("btn btn-default"); selectButton.setEnabled(false); cancelButton = LinkFactory.createButton("cancel", mainVC, this); int numOfNodes = TreeHelper.totalNodeCount(insertModel.getRootNode()); if (numOfNodes > CourseModule.getCourseNodeLimit()) { String msg = getTranslator() .translate( "warning.containsXXXormore.nodes", new String[] { String.valueOf(numOfNodes), String.valueOf(CourseModule.getCourseNodeLimit() + 1) }); Controller tmp = MessageUIFactory.createWarnMessage(ureq, wControl, null, msg); listenTo(tmp); mainVC.put("nodelimitexceededwarning", tmp.getInitialComponent()); } mainVC.put("selection", insertTree); putInitialPanel(mainVC); }
@Override protected void initEditionTools(Dropdown settingsDropdown) { super.initEditionTools(settingsDropdown); if (reSecurity.isEntryAdmin()) { settingsLink = LinkFactory.createToolLink("metaDataConfig", translate("tab.video.settings"), this); settingsLink.setIconLeftCSS("o_icon o_icon-fw o_icon_quota o_icon_settings"); settingsDropdown.addComponent(4, settingsLink); changeVideoLink = LinkFactory.createToolLink("changeVideo", translate("tab.video.exchange"), this); changeVideoLink.setIconLeftCSS("o_icon o_icon_refresh o_icon-fw"); settingsDropdown.addComponent(3, changeVideoLink); settingsDropdown.addComponent(new Spacer("metadata-poster")); } }
/** * Constructor * * @param ureq * @param component */ public NotificationsPortletRunController( WindowControl wControl, UserRequest ureq, Translator trans, String portletName, int defaultMaxEntries) { super(wControl, ureq, trans, portletName, defaultMaxEntries); sortingTermsList.add(SortingCriteria.TYPE_SORTING); sortingTermsList.add(SortingCriteria.ALPHABETICAL_SORTING); sortingTermsList.add(SortingCriteria.DATE_SORTING); this.notificationsVC = this.createVelocityContainer("notificationsPortlet"); showAllLink = LinkFactory.createLink("notificationsPortlet.showAll", notificationsVC, this); showAllLink.setIconRightCSS("o_icon o_icon_start"); TableGuiConfiguration tableConfig = new TableGuiConfiguration(); tableConfig.setTableEmptyMessage(trans.translate("notificationsPortlet.nonotifications")); tableConfig.setDisplayTableHeader(false); tableConfig.setCustomCssClass("o_portlet_table"); tableConfig.setDisplayRowCount(false); tableConfig.setPageingEnabled(false); tableConfig.setDownloadOffered(false); // disable the default sorting for this table tableConfig.setSortingEnabled(false); tableCtr = new TableController(tableConfig, ureq, getWindowControl(), trans); listenTo(tableCtr); // dummy header key, won't be used since setDisplayTableHeader is set to false tableCtr.addColumnDescriptor( new DefaultColumnDescriptor( "notificationsPortlet.bgname", 0, CMD_LAUNCH, trans.getLocale())); tableCtr.addColumnDescriptor( new DefaultColumnDescriptor( "notificationsPortlet.type", 1, null, trans.getLocale(), ColumnDescriptor.ALIGNMENT_RIGHT)); this.sortingCriteria = getPersistentSortingConfiguration(ureq); man = NotificationsManager.getInstance(); // default use the interval compareDate = man.getCompareDateFromInterval(man.getUserIntervalOrDefault(ureq.getIdentity())); reloadModel(sortingCriteria); this.notificationsVC.put("table", tableCtr.getInitialComponent()); // notify us whenever we will be shown on screen shortly, so that we can reload the model if we // received a subscription changed event in the meantime ComponentUtil.registerForValidateEvents(notificationsVC, this); putInitialPanel(notificationsVC); man.registerAsListener(this, ureq.getIdentity()); }
@Override protected void initSettingsTools(Dropdown settingsDropdown) { super.initSettingsTools(settingsDropdown); if (reSecurity.isEntryAdmin()) { settingsDropdown.addComponent(new Spacer("")); deliveryOptionsLink = LinkFactory.createToolLink("layout", translate("tab.layout"), this, "o_sel_repo_layout"); deliveryOptionsLink.setIconLeftCSS("o_icon o_icon-fw o_icon_options"); settingsDropdown.addComponent(deliveryOptionsLink); } }
@Override public void event(UserRequest ureq, Component source, Event event) { if (source == cancelButton) { fireEvent(ureq, Event.CANCELLED_EVENT); } else if (source == selectButton) { TreePosition tp = insertTree.getInsertionPosition(); if (tp != null) { doInsert(ureq, tp); } } else if (event instanceof InsertEvent) { boolean canSelect = insertTree.getInsertionPoint() != null; selectButton.setEnabled(canSelect); } }
private void init(UserRequest ureq) { String artFulltextContent = ePFMgr.getArtefactFullTextContent(artefact); if (!readOnlyMode) { // prepare an edit link String fulltext = FilterFactory.getHtmlTagAndDescapingFilter().filter(artFulltextContent); fulltext = StringHelper.xssScan(fulltext); fulltext = Formatter.truncate(fulltext, 50); editBtn = LinkFactory.createCustomLink( "text.edit.link", "edit", fulltext, Link.NONTRANSLATED, vC, this); editBtn.setIconRightCSS("o_icon o_icon_inline_editable"); } else { // register a mapper to deliver uploaded media files final VFSContainer artefactFolder = ePFMgr.getArtefactContainer(artefact); String mapperBase = registerMapper(ureq, new VFSContainerMapper(artefactFolder)); Filter urlFilter = FilterFactory.getBaseURLToMediaRelativeURLFilter(mapperBase); String wrappedText = urlFilter.filter(artFulltextContent); vC.contextPut("text", wrappedText); } }
private void updateButtons() { if (readOnly) { startLink.setVisible(false); registerLink.setVisible(false); confirmLink.setVisible(false); joinLink.setVisible(false); } else { Date start = meeting.getStartDate(); Date end = meeting.getEndDate(); Date now = new Date(); boolean canStart = (start.compareTo(now) <= 0 && end.compareTo(now) > 0); Calendar cal = Calendar.getInstance(); cal.setTime(start); cal.add(Calendar.MINUTE, -60); Date startMinusOne = cal.getTime(); boolean canCoachStart = (startMinusOne.compareTo(now) <= 0 && end.compareTo(now) > 0); boolean ended = (end.compareTo(now) <= 0); if (administrator || moderator) { if (canCoachStart) { startLink.setVisible(true); registerLink.setVisible(false); } else if (ended) { startLink.setVisible(false); registerLink.setVisible(false); } else if (registrant == null) { startLink.setVisible(false); registerLink.setVisible(true); } else { startLink.setVisible(false); registerLink.setVisible(false); } confirmLink.setVisible(false); joinLink.setVisible(false); } else if (ended) { registerLink.setVisible(false); confirmLink.setVisible(false); joinLink.setVisible(false); } else if (canStart) { if (registrant == null) { registerLink.setVisible(false); confirmLink.setVisible(false); joinLink.setVisible(true); } else { registerLink.setVisible(false); confirmLink.setVisible(false); joinLink.setVisible(true); } } else { if (registrant == null) { registerLink.setVisible(true); confirmLink.setVisible(false); joinLink.setVisible(false); } else { registerLink.setVisible(false); confirmLink.setVisible(true); joinLink.setVisible(false); } } } mainVC.setDirty(true); }
/** * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, * org.olat.core.gui.components.Component, org.olat.core.gui.control.Event) */ public void event(UserRequest ureq, Component source, Event event) { if (source == startButton && startButton.isEnabled() && startButton.isVisible()) { long courseResId = userCourseEnv.getCourseEnvironment().getCourseResourceableId().longValue(); String courseNodeIdent = courseNode.getIdent(); removeAsListenerAndDispose(displayController); OLATResourceable ores = OresHelper.createOLATResourceableTypeWithoutCheck("test"); ThreadLocalUserActivityLogger.addLoggingResourceInfo( LoggingResourceable.wrapBusinessPath(ores)); WindowControl bwControl = addToHistory(ureq, ores, null); Controller returnController = iqManager.createIQDisplayController( modConfig, secCallback, ureq, bwControl, courseResId, courseNodeIdent, this); /* * either returnController is a MessageController or it is a IQDisplayController * this should not serve as pattern to be copy&pasted. * FIXME:2008-11-21:pb INTRODUCED because of read/write QTI Lock solution for scalability II, 6.1.x Release */ if (returnController instanceof IQDisplayController) { displayController = (IQDisplayController) returnController; listenTo(displayController); if (displayController.isClosed()) { // do nothing } else if (displayController.isReady()) { // in case displayController was unable to initialize, a message was set by // displayController // this is the case if no more attempts or security check was unsuccessfull displayContainerController = new LayoutMain3ColsController(ureq, getWindowControl(), displayController); listenTo(displayContainerController); // autodispose // need to wrap a course restart controller again, because IQDisplay // runs on top of GUIStack ICourse course = CourseFactory.loadCourse(courseResId); RepositoryEntry courseRepositoryEntry = course.getCourseEnvironment().getCourseGroupManager().getCourseEntry(); Panel empty = new Panel("empty"); // empty panel set as "menu" and "tool" Controller courseCloser = new DisposedCourseRestartController(ureq, getWindowControl(), courseRepositoryEntry); Controller disposedRestartController = new LayoutMain3ColsController( ureq, getWindowControl(), empty, courseCloser.getInitialComponent(), "disposed course whily in iqRun" + courseResId); displayContainerController.setDisposedMessageController(disposedRestartController); final boolean fullWindow = modConfig.getBooleanSafe(IQEditController.CONFIG_FULLWINDOW, true); if (fullWindow) { displayContainerController.setAsFullscreen(ureq); } displayContainerController.activate(); if (modConfig .get(IQEditController.CONFIG_KEY_TYPE) .equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS)) { assessmentStopped = false; singleUserEventCenter.registerFor(this, getIdentity(), assessmentInstanceOres); singleUserEventCenter.fireEventToListenersOf( new AssessmentEvent(AssessmentEvent.TYPE.STARTED, ureq.getUserSession()), assessmentEventOres); } } // endif isReady } else { // -> qti file was locked -> show info message // user must click again on course node to activate mainPanel.pushContent(returnController.getInitialComponent()); } } else if (source == showResultsButton) { AssessmentManager am = userCourseEnv.getCourseEnvironment().getAssessmentManager(); Long assessmentID = am.getAssessmentID(courseNode, ureq.getIdentity()); if (assessmentID == null) { // fallback solution: if the assessmentID is not available via AssessmentManager than try to // get it via IQManager long callingResId = userCourseEnv.getCourseEnvironment().getCourseResourceableId().longValue(); String callingResDetail = courseNode.getIdent(); assessmentID = iqManager.getLastAssessmentID(ureq.getIdentity(), callingResId, callingResDetail); } if (assessmentID != null && !assessmentID.equals("")) { Document doc = iqManager.getResultsReportingFromFile(ureq.getIdentity(), type, assessmentID); // StringBuilder resultsHTML = // LocalizedXSLTransformer.getInstance(ureq.getLocale()).renderResults(doc); String summaryConfig = (String) modConfig.get(IQEditController.CONFIG_KEY_SUMMARY); int summaryType = AssessmentInstance.getSummaryType(summaryConfig); String resultsHTML = iqManager.transformResultsReporting(doc, ureq.getLocale(), summaryType); myContent.contextPut("displayreporting", resultsHTML); myContent.contextPut("resreporting", resultsHTML); myContent.contextPut("showResults", Boolean.TRUE); } } else if (source == hideResultsButton) { myContent.contextPut("showResults", Boolean.FALSE); } }
/** * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, * org.olat.core.gui.components.Component, org.olat.core.gui.control.Event) */ @Override public void event(UserRequest ureq, Component source, Event event) { if (source == onCommand) { // toggle on Preferences prefs = ureq.getUserSession().getGuiPreferences(); prefs.put(CourseGlossaryToolLinkController.class, guiPrefsKey, Boolean.TRUE); prefs.save(); // update gui mainVC.remove(onCommand); offCommand = LinkFactory.createLink("command.glossary.off", mainVC, this); offCommand.setTitle("command.glossary.off.alt"); offCommand.setCustomEnabledLinkCSS("b_toolbox_toggle"); // notify textmarker controller glossMarkupItmCtr.setTextMarkingEnabled(true); fireEvent(ureq, new Event("glossaryOn")); } else if (source == offCommand) { // toggle off Preferences prefs = ureq.getUserSession().getGuiPreferences(); prefs.put(CourseGlossaryToolLinkController.class, guiPrefsKey, Boolean.FALSE); prefs.save(); // update gui mainVC.remove(offCommand); onCommand = LinkFactory.createLink("command.glossary.on", mainVC, this); onCommand.setTitle("command.glossary.on.alt"); onCommand.setCustomEnabledLinkCSS("b_toolbox_toggle"); // notify textmarker controller glossMarkupItmCtr.setTextMarkingEnabled(false); fireEvent(ureq, new Event("glossaryOff")); } else if (source == mainVC && event.getCommand().equals("command.glossary")) { // start glossary in window final CourseConfig cc = courseEnvir.getCourseConfig(); // do not cache cc, not save // if glossary had been opened from LR as Tab before, warn user: DTabs dts = Windows.getWindows(ureq).getWindow(ureq).getDTabs(); RepositoryEntry repoEntry = RepositoryManager.getInstance() .lookupRepositoryEntryBySoftkey(cc.getGlossarySoftKey(), false); DTab dt = dts.getDTab(repoEntry.getOlatResource()); if (dt != null) { List<ContextEntry> entries = BusinessControlFactory.getInstance() .createCEListFromResourceType(allowGlossaryEditing ? "true" : "false"); dts.activate(ureq, dt, entries); } else { ControllerCreator ctrlCreator = new ControllerCreator() { public Controller createController(UserRequest lureq, WindowControl lwControl) { GlossaryMainController glossaryController = CourseGlossaryFactory.createCourseGlossaryMainRunController( lwControl, lureq, cc, allowGlossaryEditing); listenTo(glossaryController); if (glossaryController == null) { // happens in the unlikely event of a user who is in a course and // now // tries to access the glossary String text = translate("error.noglossary"); return MessageUIFactory.createInfoMessage(lureq, lwControl, null, text); } else { // use a one-column main layout LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController( lureq, lwControl, null, null, glossaryController.getInitialComponent(), null); // dispose glossary on layout dispose layoutCtr.addDisposableChildController(glossaryController); return layoutCtr; } } }; ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, ctrlCreator); // open in new browser window openInNewBrowserWindow(ureq, layoutCtrlr); return; // immediate return after opening new browser window! } } }
private void setLinks() { importLink = LinkFactory.createCustomLink( "cptreecontroller.importlink", "cptreecontroller.importlink", null, Link.NONTRANSLATED, contentVC, this); importLink.setCustomEnabledLinkCSS("o_cpeditor_import"); importLink.setTooltip(translate("cptreecontroller.importlink_title"), false); importLink.setTitle(translate("cptreecontroller.importlink_title")); newLink = LinkFactory.createCustomLink( "cptreecontroller.newlink", "cptreecontroller.newlink", null, Link.NONTRANSLATED, contentVC, this); newLink.setCustomEnabledLinkCSS("o_cpeditor_new"); newLink.setTooltip(translate("cptreecontroller.newlink_title"), false); newLink.setTitle(translate("cptreecontroller.newlink_title")); copyLink = LinkFactory.createCustomLink( "cptreecontroller.copylink", "cptreecontroller.copylink", null, Link.NONTRANSLATED, contentVC, this); copyLink.setTooltip(translate("cptreecontroller.copylink_title"), false); copyLink.setTitle(translate("cptreecontroller.copylink_title")); copyLink.setCustomEnabledLinkCSS("o_cpeditor_copy"); deleteLink = LinkFactory.createCustomLink( "cptreecontroller.deletelink", "cptreecontroller.deletelink", null, Link.NONTRANSLATED, contentVC, this); deleteLink.setTooltip(translate("cptreecontroller.deletelink_title"), false); deleteLink.setTitle(translate("cptreecontroller.deletelink_title")); deleteLink.setCustomEnabledLinkCSS("o_cpeditor_delete"); }