CMS-2644 Implement createUrl methods for javascript portal.
Refactoring and improvements.