Rewrite of category icon onclick handler.

NOTE: This is not testable right now since something's broken in
      inserting images from the media db.