Package org.olat.core.util.prefs

Examples of org.olat.core.util.prefs.Preferences


    myContent.put("prefs", prefsCtr.getInitialComponent());
   
    // check if ajax mode is enabled by default for all users
    boolean ajaxOnGlobally = Settings.isAjaxGloballyOn();
    // check if user has turned on ajax mode
    Preferences prefs = PreferencesFactory.getInstance().getPreferencesFor(changeableIdentity, false);
    Boolean ajaxOnB = (Boolean) prefs.get(WindowManager.class, "ajax-beta-on");
    boolean ajaxOnByPrefs;
    if (ajaxOnB == null) {
      // indicate that the user settings is overwritten if no pref saved yet
      ajaxOnByPrefs = ajaxOnGlobally;
    } else {
      ajaxOnByPrefs = ajaxOnB.booleanValue();
    }

    ajaxForm = new AjaxForm("ajaxform", translator, ajaxOnByPrefs, ajaxOnGlobally);
    ajaxForm.addListener(this);
    myContent.put("ajaxform", ajaxForm);
   
    // load accessibility form
    Boolean web2aEnabled = (Boolean) prefs.get(WindowManager.class, "web2a-beta-on");
    accessibilityForm = new AccessibilityForm("accessibilityform", translator, (web2aEnabled == null ? Boolean.FALSE : web2aEnabled));
    accessibilityForm.addListener(this);
    myContent.put("accessibilityform", accessibilityForm);
   
    if (ureq.getUserSession().getRoles().isOLATAdmin()) {
View Full Code Here


      if (event.getCommand().equals("exeBack")) {
        fireEvent(ureq, Event.CANCELLED_EVENT);
      }
    } else if (source == ajaxForm) {
      if (event == Form.EVNT_VALIDATION_OK) {
        Preferences prefs = ureq.getUserSession().getGuiPreferences();
        prefs.putAndSave(WindowManager.class, "ajax-beta-on", Boolean.valueOf(ajaxForm.isAjaxOn()));
        getWindowControl().setInfo(translator.translate("preferences.successful"));
        // update user session
        ureq.getUserSession().getSessionInfo().setWebModeFromUreq(ureq);
        //
      }
    } else if (source == accessibilityForm) {
      Preferences prefs = ureq.getUserSession().getGuiPreferences();
      ureq.getUserSession().getGuiPreferences();
      boolean useWeb2a = accessibilityForm.isWeb2aModeOn();
      prefs.putAndSave(WindowManager.class, "web2a-beta-on", useWeb2a);
      if (useWeb2a) {
        getWindowControl().getWindowBackOffice().getWindowManager().setAjaxEnabled(false);
        getWindowControl().getWindowBackOffice().getWindowManager().setForScreenReader(true);
      } else {
        getWindowControl().getWindowBackOffice().getWindowManager().setForScreenReader(false);         
View Full Code Here

    Component toolComp = (toolC == null ? null : toolC.getInitialComponent());

    if (glossaryMarkerCtr != null) {
      listenTo(glossaryMarkerCtr);
      // enable / disable glossary highlighting according to user prefs
      Preferences prefs = ureq.getUserSession().getGuiPreferences();
      Boolean state = (Boolean) prefs.get(CourseGlossaryToolLinkController.class, CourseGlossaryFactory.createGuiPrefsKey(course));

      //Glossary always on for guests. OLAT-4241
      if(ureq.getUserSession().getRoles().isGuestOnly()){
        state = Boolean.TRUE;
      }
View Full Code Here

    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 {
View Full Code Here

   */
  @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");
View Full Code Here

      } else throw new AssertException("ForumViewController doesn't support this view-mode.");
    }
  }

  private void saveThreadViewModePrefs(UserRequest ureq, String viewMode){
    Preferences prefs = ureq.getUserSession().getGuiPreferences();
    prefs.putAndSave(this.getClass(), GUI_PREFS_VIEWMODE_KEY, viewMode);
  }
View Full Code Here

 
 
  // TODO:RH:forum: move this to upgrade code or to manager, to migrate settings, or kill
  // them all???
  public String getThreadViewMode(UserRequest ureq){
    Preferences prefs = ureq.getUserSession().getGuiPreferences();   
    // migrate old settings, keep appropriate to new possibilities
    Boolean threadview = (Boolean) prefs.get(ForumController.class, ForumController.GUI_PREFS_THREADVIEW_KEY);
    if (threadview != null) {
      // remove old pref
      prefs.putAndSave(ForumController.class, ForumController.GUI_PREFS_THREADVIEW_KEY, null);
      if (threadview) {
        prefs.putAndSave(this.getClass(), GUI_PREFS_VIEWMODE_KEY, VIEWMODE_FLAT);
        return VIEWMODE_FLAT;
      } else {
        prefs.putAndSave(this.getClass(), GUI_PREFS_VIEWMODE_KEY, VIEWMODE_MESSAGE);
        return VIEWMODE_MESSAGE;
      }
    }   
    return (String) prefs.get(this.getClass(), GUI_PREFS_VIEWMODE_KEY, VIEWMODE_THREAD);
  }
View Full Code Here

   * Set AJAX / Web 2.0 based on User GUI-Preferences and configuration.
   * If the "ajax feature" checkbox in the user settings is enabled, turn on ajax (do not care about which browser)
   * @param ureq
   */
  private static void setAjaxModeFor(UserRequest ureq) {
    Preferences prefs = ureq.getUserSession().getGuiPreferences();
    Boolean ajaxOn = (Boolean) ureq.getUserSession().getGuiPreferences().get(WindowManager.class, "ajax-beta-on");
    Boolean web2aEnabled = (Boolean) prefs.get(WindowManager.class, "web2a-beta-on");
    // first check for web2a mode, then for ajax mode
    if (web2aEnabled != null && web2aEnabled.booleanValue()) {
      Windows.getWindows(ureq).getWindowManager().setForScreenReader(true);     
    } else {
      //if user does not have an gui preference it will be only enabled if globally on and browser is capable
View Full Code Here

 
  /**
   * @see org.olat.calendar.CalendarManager#findKalendarConfigForIdentity(org.olat.calendar.model.Kalendar, org.olat.core.gui.UserRequest)
   */
  public KalendarConfig findKalendarConfigForIdentity(Kalendar kalendar, UserRequest ureq) {
    Preferences guiPreferences = ureq.getUserSession().getGuiPreferences();
    return (KalendarConfig)guiPreferences.get(KalendarConfig.class, kalendar.getCalendarID());
  }
View Full Code Here

  /**
   * @see org.olat.calendar.CalendarManager#saveKalendarConfigForIdentity(org.olat.calendar.model.KalendarConfig, org.olat.calendar.model.Kalendar, org.olat.core.gui.UserRequest)
   */
  public void saveKalendarConfigForIdentity(KalendarConfig config, Kalendar kalendar, UserRequest ureq) {
    Preferences guiPreferences = ureq.getUserSession().getGuiPreferences();
    guiPreferences.putAndSave(KalendarConfig.class, kalendar.getCalendarID(), config);
  }
View Full Code Here

TOP

Related Classes of org.olat.core.util.prefs.Preferences

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.