use of org.olat.core.util.prefs.Preferences in project OpenOLAT by OpenOLAT.
the class ShareLinkController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
UserSession usess = ureq.getUserSession();
if (source == shareLinkVC && "setLandingPage".equals(event.getCommand()) && usess != null && usess.isAuthenticated()) {
HistoryPoint p = usess.getLastHistoryPoint();
if (p != null && StringHelper.containsNonWhitespace(p.getBusinessPath())) {
List<ContextEntry> ces = p.getEntries();
String landingPage = BusinessControlFactory.getInstance().getAsURIString(ces, true);
int start = landingPage.indexOf("/url/");
if (start != -1) {
// start with / after /url
landingPage = landingPage.substring(start + 4);
}
// update user prefs
Preferences prefs = usess.getGuiPreferences();
prefs.put(WindowManager.class, "landing-page", landingPage);
prefs.save();
getWindowControl().getWindowBackOffice().sendCommandTo(new JSCommand("showInfoBox(\"" + translate("info.header") + "\",\"" + translate("landingpage.set.message") + "\");"));
}
}
}
use of org.olat.core.util.prefs.Preferences in project OpenOLAT by OpenOLAT.
the class IQRunController method isPanelOpen.
private boolean isPanelOpen(UserRequest ureq, String panelId, boolean def) {
Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
Boolean showConfig = (Boolean) guiPrefs.get(IQRunController.class, getOpenPanelId(panelId));
return showConfig == null ? def : showConfig.booleanValue();
}
use of org.olat.core.util.prefs.Preferences in project OpenOLAT by OpenOLAT.
the class QTI21AssessmentRunController method isPanelOpen.
private boolean isPanelOpen(UserRequest ureq, String panelId, boolean def) {
Preferences guiPrefs = ureq.getUserSession().getGuiPreferences();
Boolean showConfig = (Boolean) guiPrefs.get(QTI21AssessmentRunController.class, getOpenPanelId(panelId));
return showConfig == null ? def : showConfig.booleanValue();
}
use of org.olat.core.util.prefs.Preferences in project OpenOLAT by OpenOLAT.
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));
}
use of org.olat.core.util.prefs.Preferences in project OpenOLAT by OpenOLAT.
the class UserToolsMenuController method loadPersonalTools.
private void loadPersonalTools(UserRequest ureq) {
List<String> linksName = new ArrayList<>();
List<String> configLinksName = new ArrayList<>();
List<String> searchLinksName = new ArrayList<>();
List<String> systemLinksName = new ArrayList<>();
Preferences prefs = ureq.getUserSession().getGuiPreferences();
String selectedTools = userToolsModule.getUserTools(prefs);
if (!StringHelper.containsNonWhitespace(selectedTools)) {
selectedTools = userToolsModule.getDefaultPresetOfUserTools();
}
Set<String> selectedToolSet = new HashSet<>();
if (StringHelper.containsNonWhitespace(selectedTools)) {
String[] selectedToolArr = selectedTools.split(",");
for (String selectedTool : selectedToolArr) {
selectedToolSet.add(UserToolsModule.stripToolKey(selectedTool));
}
}
List<UserToolExtension> toolExtensions = userToolsModule.getUserToolExtensions(ureq);
for (UserToolExtension toolExtension : toolExtensions) {
// check for sites
UserTool tool = toolExtension.createUserTool(ureq, getWindowControl(), getLocale());
if (tool != null) {
UserToolCategory category = toolExtension.getUserToolCategory();
boolean shortCutOnly = toolExtension.isShortCutOnly();
if (!shortCutOnly && !selectedToolSet.contains(toolExtension.getUniqueExtensionID())) {
Component link = tool.getMenuComponent(ureq, menuVC);
String linkName = link.getComponentName();
switch(category) {
case search:
searchLinksName.add(linkName);
break;
case personal:
linksName.add(linkName);
break;
case config:
configLinksName.add(linkName);
break;
case system:
systemLinksName.add(linkName);
break;
}
disposableTools.add(tool);
}
}
}
menuVC.contextPut("personalTools", linksName);
menuVC.contextPut("configs", configLinksName);
menuVC.contextPut("systems", systemLinksName);
menuVC.contextPut("searchs", searchLinksName);
menuVC.contextPut("locked", Boolean.FALSE);
}
Aggregations