Skip to content
Snippets Groups Projects
Commit 693fd8ce authored by srosse's avatar srosse
Browse files

OO-14: flush the history of the test to prevent returning in the test with the back/resume function

--HG--
branch : 80-patch
parent 93e264eb
No related branches found
No related tags found
No related merge requests found
......@@ -474,6 +474,10 @@ public abstract class DefaultController implements Controller, ControllerEventLi
protected WindowControl addToHistory(UserRequest ureq, OLATResourceable ores, StateEntry stateEntry, WindowControl wControl, boolean addToHistory) {
return BusinessControlFactory.getInstance().createBusinessWindowControl(ureq, ores, stateEntry, wControl, addToHistory);
}
protected void removeHistory(UserRequest ureq) {
BusinessControlFactory.getInstance().removeFromHistory(ureq, getWindowControl());
}
/**
*
......
......@@ -209,6 +209,11 @@ public class BusinessControlFactory {
public void addToHistory(UserRequest ureq, HistoryPoint historyPoint) {
ureq.getUserSession().addToHistory(ureq, historyPoint);
}
public void removeFromHistory(UserRequest ureq, WindowControl wControl) {
if(wControl == null || wControl.getBusinessControl() == null) return;
ureq.getUserSession().removeFromHistory(wControl.getBusinessControl());
}
public WindowControl createBusinessWindowControl(BusinessControl businessControl, WindowControl origWControl) {
WindowControl wc = new StackedBusinessWindowControl(origWControl, businessControl);
......
......@@ -353,6 +353,16 @@ public class UserSession implements HttpSessionBindingListener, GenericEventList
}
}
}
public void removeFromHistory(BusinessControl businessControl) {
String businessPath = businessControl.getAsString();
for(Iterator<HistoryPoint> it=history.iterator(); it.hasNext(); ) {
String path = it.next().getBusinessPath();
if(path.startsWith(businessPath)) {
it.remove();
}
}
}
/**
* @see javax.servlet.http.HttpSessionBindingListener#valueBound(javax.servlet.http.HttpSessionBindingEvent)
......
......@@ -515,6 +515,7 @@ public class IQRunController extends BasicController implements GenericEventList
} else {
getWindowControl().pop();
}
removeHistory(urequest);
OLATResourceable ores = OresHelper.createOLATResourceableInstance("test", -1l);
addToHistory(urequest, ores, null);
if (type.equals(AssessmentInstance.QMD_ENTRY_TYPE_ASSESS) && !assessmentStopped ) {
......
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