Two senior BBC editors have resigned, after criticism of a documentary screened by the flagship Panorama programme.