Open-shell RPA calculations for the giant-dipole excitations of 12C