A lattice theory of polyelectrolyte adsorption