Here is a start, only quickly threw it together, E key rotates one way, R another. The rotation part really needs to be done with quaternions and it will work a lot better with entities that have the origin point in the centre.
Been there, done that, got all the T-Shirts!