use of org.olat.core.util.prefs.Preferences in project openolat by klemens.
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 klemens.
the class ToggleBoxController method reload.
public void reload(UserRequest ureq) {
Preferences prefs = ureq.getUserSession().getGuiPreferences();
toggleStatus = (Boolean) prefs.get(this.getClass(), key, defaultToggleStatus);
mainVC.put("cmpToToggle", componentToToggle);
updateUI();
}
use of org.olat.core.util.prefs.Preferences in project openolat by klemens.
the class EditLectureBlockController method updateLocationsPrefs.
private void updateLocationsPrefs(UserRequest ureq) {
String location = lectureBlock.getLocation();
if (StringHelper.containsNonWhitespace(location)) {
List<LocationHistory> newLocations = new ArrayList<>(locations);
LocationHistory newLocation = new LocationHistory(location, new Date());
if (locations.contains(newLocation)) {
int index = locations.indexOf(newLocation);
locations.get(index).setLastUsed(new Date());
} else {
newLocations.add(newLocation);
Collections.sort(newLocations, new LocationDateComparator());
if (newLocations.size() > 10) {
// pack it in a new list for XStream
newLocations = new ArrayList<>(newLocations.subList(0, 10));
}
}
Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
if (guiPrefs != null) {
guiPrefs.putAndSave(LectureBlock.class, getLocationsPrefsId(), newLocations);
}
}
}
use of org.olat.core.util.prefs.Preferences in project openolat by klemens.
the class AbstractTeacherOverviewController method isAllTeachersSwitch.
private boolean isAllTeachersSwitch(UserRequest ureq, boolean def) {
Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
Boolean showConfig = (Boolean) guiPrefs.get(AbstractTeacherOverviewController.class, switchPrefsId);
return showConfig == null ? def : showConfig.booleanValue();
}
use of org.olat.core.util.prefs.Preferences in project openolat by klemens.
the class AbstractTeacherOverviewController method saveAllTeachersSwitch.
private void saveAllTeachersSwitch(UserRequest ureq, boolean newValue) {
Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
if (guiPrefs != null) {
guiPrefs.putAndSave(AbstractTeacherOverviewController.class, switchPrefsId, new Boolean(newValue));
}
if (newValue) {
allTeachersSwitch.setIconLeftCSS("o_icon o_icon-lg o_icon_toggle_on");
allTeachersSwitch.setTooltip(translate("all.teachers.switch.tooltip.on"));
} else {
allTeachersSwitch.setIconLeftCSS("o_icon o_icon-lg o_icon_toggle_off");
allTeachersSwitch.setTooltip(translate("all.teachers.switch.tooltip.off"));
}
allTeachersSwitch.setUserObject(newValue);
}
Aggregations