A building at an Islamic school in Indonesia collapsed onto praying students, injuring dozens and burying more in the rubble.