Skip to content
Snippets Groups Projects
Commit c2cca4e9 authored by gnaegi's avatar gnaegi
Browse files

Merge with 0b68510a0c0daa6cace1356de1363f1fcfeadcb5

parents 38ba2267 1ae0a2d8
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,12 @@ ...@@ -21,7 +21,12 @@
*/ */
package org.olat.preferences; package org.olat.preferences;
import java.util.Iterator;
import java.util.List;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
import org.olat.core.logging.AssertException;
import org.olat.core.logging.LogDelegator;
import org.olat.core.util.prefs.Preferences; import org.olat.core.util.prefs.Preferences;
import org.olat.core.util.prefs.PreferencesStorage; import org.olat.core.util.prefs.PreferencesStorage;
import org.olat.core.util.xml.XStreamHelper; import org.olat.core.util.xml.XStreamHelper;
...@@ -35,7 +40,7 @@ import org.olat.properties.PropertyManager; ...@@ -35,7 +40,7 @@ import org.olat.properties.PropertyManager;
* *
* @author Felix Jost * @author Felix Jost
*/ */
public class DbStorage implements PreferencesStorage { public class DbStorage extends LogDelegator implements PreferencesStorage{
static final String USER_PROPERTY_KEY = "v2guipreferences"; static final String USER_PROPERTY_KEY = "v2guipreferences";
...@@ -52,8 +57,26 @@ public class DbStorage implements PreferencesStorage { ...@@ -52,8 +57,26 @@ public class DbStorage implements PreferencesStorage {
* @param identity * @param identity
* @return * @return
*/ */
private DbPrefs getPreferencesFor(Identity identity) { private DbPrefs getPreferencesFor(final Identity identity) {
Property guiProperty = PropertyManager.getInstance().findProperty(identity, null, null, null, USER_PROPERTY_KEY); Property guiProperty = null;
try {
guiProperty = PropertyManager.getInstance().findProperty(identity, null, null, null, USER_PROPERTY_KEY);
} catch (AssertException e) {
// OLAT-6429 detect and delete multiple prefs objects, keep the first one only
List<Property> guiPropertyList = PropertyManager.getInstance().findProperties(identity, null, null, null, USER_PROPERTY_KEY);
if (guiPropertyList != null && guiPropertyList.size() > 0) {
logError("Found more than 1 entry for " + USER_PROPERTY_KEY + " in o_property table for user " + identity.getName() + ". Use first of them, deleting the others!", e);
guiProperty = guiPropertyList.get(0);
Iterator<Property> iterator = guiPropertyList.iterator();
iterator.next();
while (iterator.hasNext()) {
Property property = (Property) iterator.next();
PropertyManager.getInstance().deleteProperty(property);
logInfo("Will delete old property: " + property.getTextValue());
}
}
}
if (guiProperty == null) { if (guiProperty == null) {
return createEmptyDbPrefs(identity,false); return createEmptyDbPrefs(identity,false);
} else { } else {
......
...@@ -35,6 +35,7 @@ import org.olat.core.gui.control.Event; ...@@ -35,6 +35,7 @@ import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.controller.BasicController; import org.olat.core.gui.control.controller.BasicController;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
import org.olat.core.util.UserSession;
import org.olat.core.util.prefs.Preferences; import org.olat.core.util.prefs.Preferences;
import org.olat.core.util.prefs.PreferencesFactory; import org.olat.core.util.prefs.PreferencesFactory;
...@@ -133,10 +134,15 @@ class SpecialPrefsForm extends FormBasicController { ...@@ -133,10 +134,15 @@ class SpecialPrefsForm extends FormBasicController {
private String[] keys, values; private String[] keys, values;
private boolean useAjaxCheckbox = false; private boolean useAjaxCheckbox = false;
public SpecialPrefsForm(UserRequest ureq, WindowControl wControl, Identity changeableIdentity) { public SpecialPrefsForm(final UserRequest ureq, final WindowControl wControl, final Identity changeableIdentity) {
super(ureq, wControl); super(ureq, wControl);
tobeChangedIdentity = changeableIdentity; tobeChangedIdentity = changeableIdentity;
prefs = PreferencesFactory.getInstance().getPreferencesFor(tobeChangedIdentity, false); // OLAT-6429 load GUI prefs from user session for myself and from factory for other users (as user manager)
if (ureq.getIdentity().equalsByPersistableKey(tobeChangedIdentity)) {
prefs = ureq.getUserSession().getGuiPreferences();
} else {
prefs = PreferencesFactory.getInstance().getPreferencesFor(tobeChangedIdentity, false);
}
// The ajax configuration is only for user manager (technical stuff) // The ajax configuration is only for user manager (technical stuff)
useAjaxCheckbox = ureq.getUserSession().getRoles().isUserManager(); useAjaxCheckbox = ureq.getUserSession().getRoles().isUserManager();
// initialize checkbox keys depending on useAjaxCheckbox flag // initialize checkbox keys depending on useAjaxCheckbox flag
...@@ -158,6 +164,15 @@ class SpecialPrefsForm extends FormBasicController { ...@@ -158,6 +164,15 @@ class SpecialPrefsForm extends FormBasicController {
@Override @Override
protected void formOK(UserRequest ureq) { protected void formOK(UserRequest ureq) {
// OLAT-6429 don't change another users GUI prefs when he is logged in
if (!ureq.getIdentity().equalsByPersistableKey(tobeChangedIdentity)) {
if (UserSession.getSignedOnIdentity(tobeChangedIdentity.getName()) != null) {
showError("error.user.logged.in", tobeChangedIdentity.getName());
prefsElement.reset();
return;
}
}
if (useAjaxCheckbox) { if (useAjaxCheckbox) {
prefs.putAndSave(WindowManager.class, "ajax-beta-on", prefsElement.getSelectedKeys().contains("ajax")); prefs.putAndSave(WindowManager.class, "ajax-beta-on", prefsElement.getSelectedKeys().contains("ajax"));
} }
......
...@@ -6,6 +6,7 @@ accessibility.web2aMode.label=Web 2.a Modus f\u00FCr Brailleger\u00E4te ...@@ -6,6 +6,7 @@ accessibility.web2aMode.label=Web 2.a Modus f\u00FCr Brailleger\u00E4te
action.choose=W\u00E4hlen action.choose=W\u00E4hlen
ajaxon.global.label=AJAX-Modus ist auf Systemebene eingeschaltet ajaxon.global.label=AJAX-Modus ist auf Systemebene eingeschaltet
ajaxon.label=AJAX-Modus ajaxon.label=AJAX-Modus
error.user.logged.in=Diese Änderung kann nicht vorgenommen werden da der Benutzer {0} zur Zeit eingeloggt ist. Warten Sie bis der Benutzer sich ausloggt und versuchen Sie es erneut.
change=\u00C4ndern change=\u00C4ndern
chelp.card1=Sie haben die M\u00F6glichkeit, eine pers\u00F6nliche Visitenkarte zu erstellen, die f\u00FCr alle registrierten OLAT-Benutzer einsehbar ist. chelp.card1=Sie haben die M\u00F6glichkeit, eine pers\u00F6nliche Visitenkarte zu erstellen, die f\u00FCr alle registrierten OLAT-Benutzer einsehbar ist.
chelp.card2=Mit Hilfe der Check-Boxen k\u00F6nnen Sie bestimmen, welche Eintr\u00E4ge auf Ihrer Visitenkarte erscheinen sollen. chelp.card2=Mit Hilfe der Check-Boxen k\u00F6nnen Sie bestimmen, welche Eintr\u00E4ge auf Ihrer Visitenkarte erscheinen sollen.
......
...@@ -7,6 +7,7 @@ action.choose=Select ...@@ -7,6 +7,7 @@ action.choose=Select
ajaxon.global.label=AJAX mode active on system level ajaxon.global.label=AJAX mode active on system level
ajaxon.label=AJAX mode ajaxon.label=AJAX mode
change=Modify change=Modify
error.user.logged.in=This change can not be made as the user {0} is currently logged in. Please wait until the user has logged out and try it again.
chelp.accessibility0=Accessibility chelp.accessibility0=Accessibility
chelp.accessibility1=Visually impaired persons often have trouble reconstructing all changes on their screen. chelp.accessibility1=Visually impaired persons often have trouble reconstructing all changes on their screen.
chelp.accessibility2=Therefore OLAT offers a special Web 2.a mode which particularly highlights updated elements on screen. chelp.accessibility2=Therefore OLAT offers a special Web 2.a mode which particularly highlights updated elements on screen.
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
div.b_closablewapper_handle { height: 2em; } div.b_closablewapper_handle { height: 2em; }
/* IE6 fix wrong positioning of modal overlay which breaks callout windows */
* html div.b_modal_overlay {position: absolute;}
/* min-height fix IE6 */ /* min-height fix IE6 */
* div.b_form div.b_form_general_error { height: 32px;} * div.b_form div.b_form_general_error { height: 32px;}
/* 3-pixel job bug fix for IE6 and IE7: set hasLayout=true and remove margin */ /* 3-pixel job bug fix for IE6 and IE7: set hasLayout=true and remove margin */
......
...@@ -14,11 +14,7 @@ ...@@ -14,11 +14,7 @@
* html table.b_grid_row td { border-top: 1px solid #ACAAAA; border-bottom: 1px solid #ACAAAA; } * html table.b_grid_row td { border-top: 1px solid #ACAAAA; border-bottom: 1px solid #ACAAAA; }
/* make IE render images nicely, default rendering is ugly */ /* make IE render images nicely, default rendering is ugly */
img { -ms-interpolation-mode:bicubic; } img { -ms-interpolation-mode:bicubic; }
/* IE6 fix wrong positioning of modal overlay which breaks callout windows */
* html div.b_modal_overlay {position: absolute;}
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment