Using wide-field $BVR_cI$ imaging for a sample of 16 intermediate redshift ($0.17 < z < 0.55$) galaxy clusters from the Canadian Network for Observational Cosmology (CNOC1) Survey, we investigate the dependence of cluster galaxy populations and their evolution on environment. Galaxy photometric redshifts are estimated using an empirical photometric redshift technique and galaxy groups are identified using a modified friends-of-friends algorithm in photometric redshift space.We utilize the red galaxy fraction (fred) to infer the evolutionary status of galaxies in clusters, using both individual galaxies and galaxies in groups. We apply the local galaxy density, sig5, derived using the fifth nearest-neighbor distance, as a measure of local environment, and the cluster-centric radius, rCL, as a proxy for global cluster environment. Our cluster sample exhibits a Butcher-Oemler effect in both luminosity-selected and stellar-mass-selected samples. We find that fred depends strongly on sig5 and rCL, and the Butcher-Oemler effect is observed in all sig5 and rCL bins. However, when the cluster galaxies are separated into rCL bins, or into group and non-group subsamples, the dependence on local galaxy density becomes much weaker. This suggests that the properties of the dark matter halo in which the galaxy resides have a dominant effect on its galaxy population and evolutionary history. We find that our data are consistent with the scenario that cluster galaxies situated in successively richer groups (i.e., more massive dark matter halos) reach a high fred value at earlier redshifts. Associated with this, we observe a clear signature of `pre-processing, in which ... <and more>