sort with templates, not js
fix old link IDs
Merge pull request #637 from nla/bulk-refactor

Bulk edit refactor - sort using freemarker, fix some link names
(I'm assuming some of the modification relates to elements whose ids have already been changed previously.)