Initial plugin port of patch against 1.4 core.

Tested against redmine 2.6, but should work for older versions.