Search in sources :

Example 21 with Preferences

use of org.olat.core.util.prefs.Preferences in project OpenOLAT by OpenOLAT.

the class QTI21AssessmentRunController method saveOpenPanel.

private void saveOpenPanel(UserRequest ureq, String panelId, boolean newValue) {
    Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
    if (guiPrefs != null) {
        guiPrefs.putAndSave(QTI21AssessmentRunController.class, getOpenPanelId(panelId), Boolean.valueOf(newValue));
    }
    mainVC.contextPut("in-" + panelId, Boolean.valueOf(newValue));
}
Also used : Preferences(org.olat.core.util.prefs.Preferences)

Example 22 with Preferences

use of org.olat.core.util.prefs.Preferences in project OpenOLAT by OpenOLAT.

the class VideoDisplayController method updateGUIPreferences.

/**
 * Update the users preferred resolution in the GUI prefs from the given video URL
 * @param ureq
 * @param src
 */
private void updateGUIPreferences(UserRequest ureq, String src) {
    if (src != null) {
        int start = src.lastIndexOf("/");
        if (start != -1) {
            String video = src.substring(start + 1);
            int end = video.indexOf("video");
            if (end > 0) {
                // dont's save master videos
                String resolution = video.substring(0, end);
                try {
                    int res = Integer.parseInt(resolution.trim());
                    if (userPreferredResolution == null || userPreferredResolution.intValue() != res) {
                        // update GUI prefs, reload first
                        Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
                        userPreferredResolution = (Integer) guiPrefs.get(VideoDisplayController.class, GUIPREF_KEY_PREFERRED_RESOLUTION);
                        guiPrefs.putAndSave(VideoDisplayController.class, GUIPREF_KEY_PREFERRED_RESOLUTION, Integer.valueOf(res));
                    }
                } catch (NumberFormatException e) {
                    // ignore, do nothing
                    logDebug("Error parsing the users preferred resolution from url::" + src, null);
                }
            }
        }
    }
}
Also used : Preferences(org.olat.core.util.prefs.Preferences)

Example 23 with Preferences

use of org.olat.core.util.prefs.Preferences in project OpenOLAT by OpenOLAT.

the class CourseRuntimeController method toggleGlossary.

private void toggleGlossary(UserRequest ureq) {
    // enable / disable glossary highlighting according to user prefs
    Preferences prefs = ureq.getUserSession().getGuiPreferences();
    String guiPrefsKey = CourseGlossaryFactory.createGuiPrefsKey(getOlatResourceable());
    Boolean state = (Boolean) prefs.get(CourseGlossaryToolLinkController.class, guiPrefsKey);
    Boolean newState = state == null ? Boolean.TRUE : new Boolean(!state.booleanValue());
    setGlossaryLinkTitle(ureq, newState);
    prefs.putAndSave(CourseGlossaryToolLinkController.class, guiPrefsKey, newState);
}
Also used : CourseGlossaryToolLinkController(org.olat.course.run.glossary.CourseGlossaryToolLinkController) Preferences(org.olat.core.util.prefs.Preferences) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean)

Example 24 with Preferences

use of org.olat.core.util.prefs.Preferences in project openolat by klemens.

the class AbstractPortletRunController method saveManuallySortedItems.

/**
 * Stores the manually sorted items.
 * @param ureq
 * @param sortedItems
 */
protected void saveManuallySortedItems(UserRequest ureq, List<PortletEntry<T>> sortedItems) {
    Preferences guiPreferences = ureq.getUserSession().getGuiPreferences();
    // store manual sorting type
    SortingCriteria manualSortingCriteria = new SortingCriteria();
    guiPreferences.putAndSave(Map.class, getPreferenceKey(SORTING_CRITERIA_PREF), manualSortingCriteria.getPersistable());
    // store the sorted items
    guiPreferences.putAndSave(Map.class, getPreferenceKey(SORTED_ITEMS_PREF), getSortedItemsMap(sortedItems));
}
Also used : Preferences(org.olat.core.util.prefs.Preferences)

Example 25 with Preferences

use of org.olat.core.util.prefs.Preferences in project openolat by klemens.

the class PortfolioCourseNodeRunController method saveOpenPanel.

private void saveOpenPanel(UserRequest ureq, String panelId, boolean newValue) {
    Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
    if (guiPrefs != null) {
        guiPrefs.putAndSave(PortfolioCourseNodeRunController.class, getOpenPanelId(panelId), new Boolean(newValue));
    }
    flc.getFormItemComponent().contextPut("in-" + panelId, new Boolean(newValue));
}
Also used : Preferences(org.olat.core.util.prefs.Preferences)

Aggregations

Preferences (org.olat.core.util.prefs.Preferences)92 ArrayList (java.util.ArrayList)12 I18nModule (org.olat.core.util.i18n.I18nModule)8 WindowManager (org.olat.core.gui.WindowManager)6 ContextEntry (org.olat.core.id.context.ContextEntry)6 UserSession (org.olat.core.util.UserSession)6 HashSet (java.util.HashSet)4 Locale (java.util.Locale)4 Map (java.util.Map)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 UserTool (org.olat.admin.user.tools.UserTool)4 UserToolExtension (org.olat.admin.user.tools.UserToolExtension)4 Component (org.olat.core.gui.components.Component)4 FlexiTableSort (org.olat.core.gui.components.form.flexible.elements.FlexiTableSort)4 ProgressBar (org.olat.core.gui.components.progressbar.ProgressBar)4 HistoryPoint (org.olat.core.id.context.HistoryPoint)4 I18nItem (org.olat.core.util.i18n.I18nItem)4 LocationHistory (org.olat.modules.lecture.model.LocationHistory)4 Date (java.util.Date)2 List (java.util.List)2