Fix for displayMode="REPLACE"

Showing a page from outcome with displayMode="REPLACE" did not activate the corresponding dialog, causing all sorts of problems if it wasn't the current one. This enormous patch fixes this.