Refactor: create a link manager to manage socket.io connection

Now all views will refer to the link manager instead of the socket, and
call higher level functions. This will enable the link manager to translate
commands into the correct protocol over the socket.io link as well as share
state information.

Also: bug fix for dates, and automated dropdown generation of all dates
in the loco edit template. Preliminary work for Controller PID settings
adjustment. Preliminary work for loco maintenance log.
Implement removeListener on link manager.

So that entities like the loco controller don't get multiple
subscriptions to the same event.