How to reproduce
- Create a course
- Add a course specific layout (Course menu -> Options)
- Add a CP with some pages to the course that are rendered different using the course layout
- In run, open CP
=> OK, styles are applied
- while the CP is opened, click the CP root node again
=> NOK, styles are not applied anymore
This is pretty tricky. I debugged everything and it boils down to the fact that the CP controller is normally not disposed at all. I don't know it this is accidental or if this needs to be the case to make the integrated CP menu to the main menu work.
The problem now is, that when the CP node is clicked while beeing in the CP, the CP controller is actually disposed. When creating the new CP controller, the course custom css is added to the mapper again, but not to the one actually used. This is because MappingServiceImpl.register() does only hold one mapper for one same key and the CP dispose code will remove the mapper from the registry. It the gets mixed up.
When I make sure the CP controller is properly disposed whenever another node is clicked, the problem goes away, see patch. However, I can not foresee the consequences for SCORM or wiki, the patch needs review before we apply it.
IFrameDisplayController line 167ff
BasicController.registerCacheableMapper() line 227ff
MappingServiceImpl.register() line 108ff