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));
}
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);
}
}
}
}
}
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);
}
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));
}
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));
}
Aggregations