Skip to content
Snippets Groups Projects
Commit 1b299b9e authored by srosse's avatar srosse
Browse files

OO-3581: save the show/hide status of the timeline in the GUI

preferences of the user
parent 87389af0
No related branches found
No related tags found
No related merge requests found
...@@ -194,7 +194,13 @@ implements Activateable2, TooledController, FlexiTableComponentDelegate { ...@@ -194,7 +194,13 @@ implements Activateable2, TooledController, FlexiTableComponentDelegate {
timelineSwitchOffButton = uifactory.addFormLink("timeline.switch.off", formLayout, Link.BUTTON_SMALL); timelineSwitchOffButton = uifactory.addFormLink("timeline.switch.off", formLayout, Link.BUTTON_SMALL);
timelineSwitchOffButton.setIconLeftCSS("o_icon o_icon-sm o_icon_toggle_off"); timelineSwitchOffButton.setIconLeftCSS("o_icon o_icon-sm o_icon_toggle_off");
timelineSwitchOffButton.setElementCssClass("o_sel_timeline_off"); timelineSwitchOffButton.setElementCssClass("o_sel_timeline_off");
doSwitchTimelineOn();
Object prefs = ureq.getUserSession().getGuiPreferences().get(this.getClass(), getTimelineSwitchPreferencesName(), "on");
if("on".equals(prefs)) {
doSwitchTimelineOn(ureq, false);
} else {
doSwitchTimelineOff(ureq, false);
}
} else { } else {
flc.contextPut("timelineSwitch", Boolean.FALSE); flc.contextPut("timelineSwitch", Boolean.FALSE);
} }
...@@ -627,9 +633,9 @@ implements Activateable2, TooledController, FlexiTableComponentDelegate { ...@@ -627,9 +633,9 @@ implements Activateable2, TooledController, FlexiTableComponentDelegate {
} }
} }
} else if(timelineSwitchOnButton == source) { } else if(timelineSwitchOnButton == source) {
doSwitchTimelineOff(); doSwitchTimelineOff(ureq, true);
} else if(timelineSwitchOffButton == source) { } else if(timelineSwitchOffButton == source) {
doSwitchTimelineOn(); doSwitchTimelineOn(ureq, true);
} else if(source instanceof FormLink) { } else if(source instanceof FormLink) {
FormLink link = (FormLink)source; FormLink link = (FormLink)source;
String cmd = link.getCmd(); String cmd = link.getCmd();
...@@ -726,18 +732,26 @@ implements Activateable2, TooledController, FlexiTableComponentDelegate { ...@@ -726,18 +732,26 @@ implements Activateable2, TooledController, FlexiTableComponentDelegate {
fireEvent(ureq, Event.CHANGED_EVENT); fireEvent(ureq, Event.CHANGED_EVENT);
} }
private void doSwitchTimelineOn() { private void doSwitchTimelineOn(UserRequest ureq, boolean savePreferences) {
timelineSwitchOnButton.setVisible(true); timelineSwitchOnButton.setVisible(true);
timelineSwitchOffButton.setVisible(false); timelineSwitchOffButton.setVisible(false);
flc.contextPut("timelineSwitch", Boolean.TRUE); flc.contextPut("timelineSwitch", Boolean.TRUE);
if(savePreferences) {
ureq.getUserSession().getGuiPreferences().put(this.getClass(), getTimelineSwitchPreferencesName(), "on");
}
} }
private void doSwitchTimelineOff() { private void doSwitchTimelineOff(UserRequest ureq, boolean savePreferences) {
timelineSwitchOnButton.setVisible(false); timelineSwitchOnButton.setVisible(false);
timelineSwitchOffButton.setVisible(true); timelineSwitchOffButton.setVisible(true);
flc.contextPut("timelineSwitch", Boolean.FALSE); flc.contextPut("timelineSwitch", Boolean.FALSE);
if(savePreferences) {
ureq.getUserSession().getGuiPreferences().put(this.getClass(), getTimelineSwitchPreferencesName(), "off");
}
} }
protected abstract String getTimelineSwitchPreferencesName();
protected Assignment doStartAssignment(UserRequest ureq, PortfolioElementRow row) { protected Assignment doStartAssignment(UserRequest ureq, PortfolioElementRow row) {
return doStartAssignment(ureq, row.getAssignment().getKey()); return doStartAssignment(ureq, row.getAssignment().getKey());
} }
......
...@@ -126,6 +126,11 @@ public class BinderPageListController extends AbstractPageListController { ...@@ -126,6 +126,11 @@ public class BinderPageListController extends AbstractPageListController {
initialPanel.setCssClass("o_edit_mode"); initialPanel.setCssClass("o_edit_mode");
} }
} }
@Override
protected String getTimelineSwitchPreferencesName() {
return "binder-timeline-switch-" + binder.getKey();
}
private String getGuiPrefsKey(OLATResourceable binderOres) { private String getGuiPrefsKey(OLATResourceable binderOres) {
return new StringBuilder() return new StringBuilder()
......
...@@ -83,6 +83,11 @@ public class DeletedPageListController extends AbstractPageListController { ...@@ -83,6 +83,11 @@ public class DeletedPageListController extends AbstractPageListController {
tableEl.setSelectAllEnable(tableEl.getRendererType() == FlexiTableRendererType.classic); tableEl.setSelectAllEnable(tableEl.getRendererType() == FlexiTableRendererType.classic);
} }
@Override
protected String getTimelineSwitchPreferencesName() {
return "del-timeline-switch";
}
@Override @Override
protected void loadModel(UserRequest ureq, String searchString) { protected void loadModel(UserRequest ureq, String searchString) {
Map<Long,Long> numberOfCommentsMap = portfolioService.getNumberOfCommentsOnOwnedPage(getIdentity()); Map<Long,Long> numberOfCommentsMap = portfolioService.getNumberOfCommentsOnOwnedPage(getIdentity());
......
...@@ -81,6 +81,11 @@ public class MyPageListController extends AbstractPageListController { ...@@ -81,6 +81,11 @@ public class MyPageListController extends AbstractPageListController {
newEntryLink.setElementCssClass("o_sel_pf_new_entry"); newEntryLink.setElementCssClass("o_sel_pf_new_entry");
stackPanel.addTool(newEntryLink, Align.right); stackPanel.addTool(newEntryLink, Align.right);
} }
@Override
protected String getTimelineSwitchPreferencesName() {
return "entries-timeline-switch";
}
@Override @Override
protected void loadModel(UserRequest ureq, String searchString) { protected void loadModel(UserRequest ureq, String searchString) {
......
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