It has charging line too. Even it shuts down when mains is on. The transformer either you buy, or make yourself. But be careful about correct and one after one windings while making transformer.
C4=0.1uF or 104
B17=6V-4AH SLA-SMF battery
For any more clarification, comment below with your questions.