MDL-42531 assign: refactor batch operations to use forms properly

Avoids a lot of ugly optional_param() use. Also fixes the
non-functional cancel buttons.