Skip to content
Snippets Groups Projects
Commit 5fce03dd authored by srosse's avatar srosse
Browse files

OO-570: hardened the method and implement the solution without knowing that the user is an invitee

parent a91c4c23
No related branches found
No related tags found
No related merge requests found
......@@ -135,18 +135,12 @@ public class BaseFullWebappController extends BasicController implements Generic
private Panel initialPanel;
private DTabs myDTabsImpl;
private static Integer MAX_TAB;
private boolean invitee = false;
public BaseFullWebappController(UserRequest ureq, WindowControl ouisc_wControl,
BaseFullWebappControllerParts baseFullWebappControllerParts) {
// only-use-in-super-call, since we define our own
super(ureq, null);
if(ureq.getUserSession() != null && ureq.getUserSession().getRoles() != null) {
invitee = ureq.getUserSession().getRoles().isInvitee();
}
this.baseFullWebappControllerParts = baseFullWebappControllerParts;
guiMessage = new GUIMessage();
......@@ -772,33 +766,33 @@ public class BaseFullWebappController extends BasicController implements Generic
}
private void popTheTabState(UserRequest ureq) {
if(siteAndTabs.isEmpty()) {
if(siteAndTabs.isEmpty() && sites != null) {
SiteInstance home = sites.get(0);
BornSiteInstance bs = siteToBornSite.get(home);
doActivateSite(home, bs.getGuiStackHandle());
}
TabState state = siteAndTabs.remove(siteAndTabs.size() - 1);
if(state.getSite() != null) {
// latest selected static tab
// activate previous chosen static site -> this site has already been
// constructed and is thus in the cache
SiteInstance si = state.getSite();
BornSiteInstance bs = siteToBornSite.get(si);
// bs != null since clicked previously
GuiStack gsh = bs.getGuiStackHandle();
doActivateSite(si, gsh);
if(siteToBusinessPath.containsValue(si)) {
ureq.getUserSession().addToHistory(ureq, siteToBusinessPath.get(si));
}
} else if (state.getDtab() != null && !state.getDtab().getController().isDisposed()) {
DTab tab = state.getDtab();
doActivateDTab(tab);
if(dtabToBusinessPath.containsKey(tab)) {
ureq.getUserSession().addToHistory(ureq, dtabToBusinessPath.get(tab));
} else if(!siteAndTabs.isEmpty()) {
TabState state = siteAndTabs.remove(siteAndTabs.size() - 1);
if(state.getSite() != null) {
// latest selected static tab
// activate previous chosen static site -> this site has already been
// constructed and is thus in the cache
SiteInstance si = state.getSite();
BornSiteInstance bs = siteToBornSite.get(si);
// bs != null since clicked previously
GuiStack gsh = bs.getGuiStackHandle();
doActivateSite(si, gsh);
if(siteToBusinessPath.containsValue(si)) {
ureq.getUserSession().addToHistory(ureq, siteToBusinessPath.get(si));
}
} else if (state.getDtab() != null && !state.getDtab().getController().isDisposed()) {
DTab tab = state.getDtab();
doActivateDTab(tab);
if(dtabToBusinessPath.containsKey(tab)) {
ureq.getUserSession().addToHistory(ureq, dtabToBusinessPath.get(tab));
}
} else {
popTheTabState(ureq);
}
} else {
popTheTabState(ureq);
}
}
......@@ -1051,7 +1045,8 @@ public class BaseFullWebappController extends BasicController implements Generic
* @return
*/
public boolean isCanCloseDTab(DTab dtab) {
return !invitee && !(sites == null || sites.isEmpty());
//can close
return (sites != null && !sites.isEmpty()) || (dtabs != null && dtabs.size() > 1);
}
private void setCurrent(SiteInstance site, DTab tab) {
......
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