/** * @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) { initQuotaForm(ureq, currentQuota); if (source == delQuotaButton) { boolean deleted = QuotaManager.getInstance().deleteCustomQuota(currentQuota); if (deleted) { myContent.remove(quotaForm.getInitialComponent()); myContent.contextPut("editQuota", Boolean.FALSE); showInfo("qf.deleted", currentQuota.getPath()); fireEvent(ureq, Event.CHANGED_EVENT); } else { showError("qf.cannot.del.default"); } } else if (source == cancelButton) { fireEvent(ureq, Event.CANCELLED_EVENT); } }
/** * @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! } } }