Backported local portlets functionality

@sunew Please review. :)