pH-dependent self-assembly of divalent metals with a new ligand containing polycarboxylate: syntheses, crystal structures, luminescent and magnetic properties