I think the issue initially is they didn't want people to leave since they thought they might get the problem resolved quickly, and thus be able to leave port. Once the staff realized the emergency generator couldn't be fixed anytime soon they let people go back ashore.
Most small ports such as that in St. Maarten don't have the electrical capacity dockside to provide power for a large ship such as Carnival Dream. Cruise ships can use shore power but it is frankly a pain to set up (trust me, I had to help do it when in the Navy), plus return to ship's power. The only reason to do it is if you lose all ship's power - which never happened on the Dream. Staying on the ship's diesels is both easier and more cost effective. Plus the ships are required to be able to leave the dock fairly quickly for safety reasons. The Dream always had primary electrical distribution, it was just the emergency generator that failed during routine testing. Apparently it must have shorted something out that caused a small problem with elevators and toilets briefly, but it was not anything like the initial media rants made it out to be.
I am moving this thread to the Carnival board.