Skip to content
Snippets Groups Projects
Commit f5dc8a3f authored by strentini's avatar strentini
Browse files

non-jira : fix not-saved guipreferences bug. add "don't ask again" checkbox...

non-jira :   fix not-saved guipreferences bug.  add "don't ask again" checkbox to resumeController, fix wording in useradmin-> delete userproperties yesNo popup
parent 0d788897
No related branches found
No related tags found
No related merge requests found
Showing with 60 additions and 10 deletions
...@@ -27,6 +27,7 @@ import org.olat.core.gui.WindowManager; ...@@ -27,6 +27,7 @@ import org.olat.core.gui.WindowManager;
import org.olat.core.gui.components.form.flexible.FormItem; import org.olat.core.gui.components.form.flexible.FormItem;
import org.olat.core.gui.components.form.flexible.FormItemContainer; import org.olat.core.gui.components.form.flexible.FormItemContainer;
import org.olat.core.gui.components.form.flexible.elements.FormLink; import org.olat.core.gui.components.form.flexible.elements.FormLink;
import org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement;
import org.olat.core.gui.components.form.flexible.impl.FormBasicController; import org.olat.core.gui.components.form.flexible.impl.FormBasicController;
import org.olat.core.gui.components.form.flexible.impl.FormEvent; import org.olat.core.gui.components.form.flexible.impl.FormEvent;
import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer; import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer;
...@@ -60,6 +61,9 @@ public class ResumeController extends FormBasicController implements SupportsAft ...@@ -60,6 +61,9 @@ public class ResumeController extends FormBasicController implements SupportsAft
//the cancel button ("Nein") //the cancel button ("Nein")
private FormLink bttNo; private FormLink bttNo;
private String[] askagain_keys = new String[]{"askagain_k"};
private MultipleSelectionElement askagainCheckbox;
public ResumeController(UserRequest ureq, WindowControl wControl) { public ResumeController(UserRequest ureq, WindowControl wControl) {
super(ureq, wControl); super(ureq, wControl);
initForm(ureq); initForm(ureq);
...@@ -67,6 +71,8 @@ public class ResumeController extends FormBasicController implements SupportsAft ...@@ -67,6 +71,8 @@ public class ResumeController extends FormBasicController implements SupportsAft
@Override @Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
askagainCheckbox = uifactory.addCheckboxesHorizontal("askagain",null, formLayout, askagain_keys, new String[]{translate("askagain.label")}, null);
// Button layout // Button layout
FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator()); FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator());
formLayout.add(buttonLayout); formLayout.add(buttonLayout);
...@@ -141,6 +147,13 @@ public class ResumeController extends FormBasicController implements SupportsAft ...@@ -141,6 +147,13 @@ public class ResumeController extends FormBasicController implements SupportsAft
@Override @Override
protected void formOK(UserRequest ureq) { protected void formOK(UserRequest ureq) {
// check if checkbox (dont askagain) is checked
if(askagainCheckbox.isSelected(0)){
Preferences prefs = ureq.getUserSession().getGuiPreferences();
prefs.put(WindowManager.class, "resume-prefs","auto");
prefs.save();
}
fireEvent (ureq, Event.DONE_EVENT); fireEvent (ureq, Event.DONE_EVENT);
HistoryPoint historyEntry = HistoryManager.getInstance().readHistoryPoint(ureq.getIdentity()); HistoryPoint historyEntry = HistoryManager.getInstance().readHistoryPoint(ureq.getIdentity());
...@@ -158,6 +171,12 @@ public class ResumeController extends FormBasicController implements SupportsAft ...@@ -158,6 +171,12 @@ public class ResumeController extends FormBasicController implements SupportsAft
@Override @Override
protected void formCancelled(UserRequest ureq) { protected void formCancelled(UserRequest ureq) {
// check if checkbox (dont askagain) is checked
if(askagainCheckbox.isSelected(0)){
Preferences prefs = ureq.getUserSession().getGuiPreferences();
prefs.put(WindowManager.class, "resume-prefs","none");
prefs.save();
}
fireEvent (ureq, Event.CANCELLED_EVENT); fireEvent (ureq, Event.CANCELLED_EVENT);
} }
} }
#Mon Mar 02 09:54:03 CET 2009 #Mon Mar 02 09:54:03 CET 2009
resume=Wollen Sie Ihre letzte Sitzung wiederherstellen? resume=Wollen Sie Ihre letzte Sitzung wiederherstellen?
resume.button=Ja resume.button=Ja
resume.button.cancel=Nein resume.button.cancel=Nein
\ No newline at end of file askagain.label=Nicht mehr nachfragen
\ No newline at end of file
...@@ -2,3 +2,4 @@ ...@@ -2,3 +2,4 @@
resume=Do you want to resume your last session? resume=Do you want to resume your last session?
resume.button=Yes resume.button=Yes
resume.button.cancel=No resume.button.cancel=No
askagain.label=Do not ask again
\ No newline at end of file
...@@ -31,6 +31,7 @@ package org.olat.core.util.prefs.db; ...@@ -31,6 +31,7 @@ package org.olat.core.util.prefs.db;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry;
import org.olat.core.CoreSpringFactory; import org.olat.core.CoreSpringFactory;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
...@@ -132,4 +133,13 @@ public class DbPrefs implements Preferences { ...@@ -132,4 +133,13 @@ public class DbPrefs implements Preferences {
return null; return null;
} }
public String toString(){
StringBuilder sb = new StringBuilder();
sb.append("total of stored kv-pairs: ").append(prefstore.size());
for (Entry<String,Object> entry : prefstore.entrySet()) {
sb.append("----").append(entry.getKey()).append("=").append(entry.getValue());
}
return sb.toString();
}
} }
...@@ -31,6 +31,7 @@ package org.olat.core.util.prefs.db; ...@@ -31,6 +31,7 @@ package org.olat.core.util.prefs.db;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.olat.core.commons.persistence.DBFactory;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
import org.olat.core.logging.LogDelegator; import org.olat.core.logging.LogDelegator;
import org.olat.core.util.prefs.Preferences; import org.olat.core.util.prefs.Preferences;
...@@ -66,9 +67,13 @@ public class DbStorage extends LogDelegator implements PreferencesStorage{ ...@@ -66,9 +67,13 @@ public class DbStorage extends LogDelegator implements PreferencesStorage{
public void updatePreferencesFor(Preferences prefs, Identity identity) { public void updatePreferencesFor(Preferences prefs, Identity identity) {
String props = xstream.toXML(prefs); String props = xstream.toXML(prefs);
Property property = getPreferencesProperty(identity); Property property = getPreferencesProperty(identity);
if(property == null) { if (property == null) {
PropertyManager.getInstance().createPropertyInstance(identity, null, null, null, DbStorage.USER_PROPERTY_KEY, null, null, null, props); property = PropertyManager.getInstance().createPropertyInstance(identity, null, null, null, DbStorage.USER_PROPERTY_KEY, null, null,
} else { null, props);
// also save the properties to db, here (strentini)
// fixes the "non-present gui preferences" for new users, or where guiproperties were manually deleted
DBFactory.getInstance().saveObject(property);
}else{
property.setTextValue(props); property.setTextValue(props);
PropertyManager.getInstance().updateProperty(property); PropertyManager.getInstance().updateProperty(property);
} }
......
...@@ -161,7 +161,8 @@ class SpecialPrefsForm extends FormBasicController { ...@@ -161,7 +161,8 @@ class SpecialPrefsForm extends FormBasicController {
public SpecialPrefsForm(final UserRequest ureq, final WindowControl wControl, final Identity changeableIdentity) { public SpecialPrefsForm(final UserRequest ureq, final WindowControl wControl, final Identity changeableIdentity) {
super(ureq, wControl); super(ureq, wControl);
tobeChangedIdentity = changeableIdentity; tobeChangedIdentity = changeableIdentity;
// OLAT-6429 load GUI prefs from user session for myself and from factory for other users (as user manager)
// OLAT-6429 load GUI prefs from user session for myself, load it from factory for other users (as user manager)
if (ureq.getIdentity().equalsByPersistableKey(tobeChangedIdentity)) { if (ureq.getIdentity().equalsByPersistableKey(tobeChangedIdentity)) {
prefs = ureq.getUserSession().getGuiPreferences(); prefs = ureq.getUserSession().getGuiPreferences();
} else { } else {
...@@ -208,7 +209,8 @@ class SpecialPrefsForm extends FormBasicController { ...@@ -208,7 +209,8 @@ class SpecialPrefsForm extends FormBasicController {
if (useAjaxCheckbox) { if (useAjaxCheckbox) {
prefs.put(WindowManager.class, "ajax-beta-on", prefsElement.getSelectedKeys().contains("ajax")); prefs.put(WindowManager.class, "ajax-beta-on", prefsElement.getSelectedKeys().contains("ajax"));
} }
prefs.putAndSave(WindowManager.class, "web2a-beta-on", prefsElement.getSelectedKeys().contains("web2a")); prefs.put(WindowManager.class, "web2a-beta-on", prefsElement.getSelectedKeys().contains("web2a"));
//fxdiff BAKS-7 Resume function //fxdiff BAKS-7 Resume function
if(resumeElement != null) { if(resumeElement != null) {
prefs.put(WindowManager.class, "resume-prefs", resumeElement.getSelectedKey()); prefs.put(WindowManager.class, "resume-prefs", resumeElement.getSelectedKey());
...@@ -219,6 +221,8 @@ class SpecialPrefsForm extends FormBasicController { ...@@ -219,6 +221,8 @@ class SpecialPrefsForm extends FormBasicController {
if (ureq.getIdentity().equalsByPersistableKey(tobeChangedIdentity)) { if (ureq.getIdentity().equalsByPersistableKey(tobeChangedIdentity)) {
showInfo("preferences.successful"); showInfo("preferences.successful");
} }
// finally, save preferences
prefs.save(); prefs.save();
} }
......
...@@ -61,6 +61,11 @@ public class UserPropertiesController extends BasicController { ...@@ -61,6 +61,11 @@ public class UserPropertiesController extends BasicController {
private PropTableDataModel tdm; private PropTableDataModel tdm;
private TableController tableCtr; private TableController tableCtr;
/*
* the identity that is displayed (not the user/admin, that views the properties)
*/
private Identity displayedIdentity;
/** /**
* Administer properties of a user. * Administer properties of a user.
...@@ -68,10 +73,11 @@ public class UserPropertiesController extends BasicController { ...@@ -68,10 +73,11 @@ public class UserPropertiesController extends BasicController {
* @param wControl * @param wControl
* @param identity * @param identity
*/ */
public UserPropertiesController(UserRequest ureq, WindowControl wControl, Identity identity) { public UserPropertiesController(UserRequest ureq, WindowControl wControl, Identity displayedIdentity) {
super(ureq, wControl); super(ureq, wControl);
PropertyManager pm = PropertyManager.getInstance(); PropertyManager pm = PropertyManager.getInstance();
List l = pm.listProperties(identity, null, null, null, null); this.displayedIdentity = displayedIdentity;
List l = pm.listProperties(displayedIdentity, null, null, null, null);
TableGuiConfiguration tableConfig = new TableGuiConfiguration(); TableGuiConfiguration tableConfig = new TableGuiConfiguration();
tableConfig.setTableEmptyMessage(getTranslator().translate("error.no.props.found")); tableConfig.setTableEmptyMessage(getTranslator().translate("error.no.props.found"));
tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator()); tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
...@@ -118,7 +124,7 @@ public class UserPropertiesController extends BasicController { ...@@ -118,7 +124,7 @@ public class UserPropertiesController extends BasicController {
else if (actionid.equals("delete")) { else if (actionid.equals("delete")) {
int rowid = te.getRowId(); int rowid = te.getRowId();
foundProp = (Property) tdm.getObject(rowid); foundProp = (Property) tdm.getObject(rowid);
activateYesNoDialog(ureq, "really", "do you really", null); activateYesNoDialog(ureq, translate("propdelete.yesno.title"),translate("propdelete.yesno.text",new String[]{foundProp.getName(),displayedIdentity.getName()}), null);
} }
} }
} }
......
...@@ -95,7 +95,9 @@ error.no.props.found=Es wurden keine Properties f\u00FCr diesen Benutzer gefunde ...@@ -95,7 +95,9 @@ error.no.props.found=Es wurden keine Properties f\u00FCr diesen Benutzer gefunde
error.password.characters=Das Passwort muss mindestens 4 Zeichen haben. Verwenden Sie dabei sowohl Ziffern als auch Buchstaben. error.password.characters=Das Passwort muss mindestens 4 Zeichen haben. Verwenden Sie dabei sowohl Ziffern als auch Buchstaben.
error.password.empty=Geben Sie Ihr bisheriges Passwort an error.password.empty=Geben Sie Ihr bisheriges Passwort an
error.password.noauth=Ihr bisheriges Passwort ist nicht korrekt error.password.noauth=Ihr bisheriges Passwort ist nicht korrekt
error.password.nomatch=Die beiden neuen Passw\u00F6rter stimmen nicht \u00FCberein. error.password.nomatch=Die beiden neuen Passw\u00F6rter stimmen nicht \u00FCberein.
propdelete.yesno.title=Sind Sie sicher?
propdelete.yesno.text=Wollen Sie das Property '{0}' des Benutzers '{1}'wirklich löschen?
form.address=Adresse form.address=Adresse
form.charset=Zeichensatz f\u00FCr Download form.charset=Zeichensatz f\u00FCr Download
form.description=Geben Sie im untenstehenden Formular Ihre pers\u00F6nlichen Daten an. Mit Hilfe der Check-Boxen k\u00F6nnen Sie bestimmen, welche Eintr\u00E4ge auf Ihrer Visitenkarte erscheinen sollen. form.description=Geben Sie im untenstehenden Formular Ihre pers\u00F6nlichen Daten an. Mit Hilfe der Check-Boxen k\u00F6nnen Sie bestimmen, welche Eintr\u00E4ge auf Ihrer Visitenkarte erscheinen sollen.
......
...@@ -112,6 +112,8 @@ error.password.characters=Your password must contain at least 4 characters and i ...@@ -112,6 +112,8 @@ error.password.characters=Your password must contain at least 4 characters and i
error.password.empty=Please indicate your previous password error.password.empty=Please indicate your previous password
error.password.noauth=Your previous password is inaccurate error.password.noauth=Your previous password is inaccurate
error.password.nomatch=The two new passwords do not match. error.password.nomatch=The two new passwords do not match.
propdelete.yesno.title=Are you sure?
propdelete.yesno.text=Do you really want to delete the property '{0}' of user '{1}'?
form.address=Address form.address=Address
form.charset=Character set used in download form.charset=Character set used in download
form.description=Please indicate your personal data in the form below. By means of check boxes you can determine the entries that should appear on your visiting card. form.description=Please indicate your personal data in the form below. By means of check boxes you can determine the entries that should appear on your visiting card.
......
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