Fix a SQL injection problem in legend UI
We'll use a statement rather than a raw string to get our datasource.
This way, we'll be able to pass our parameters cleanly.
Ovverrides getLegendTypeId in RecodedArea
It is needed in the UI. I'll have to change that someday.
Ow, and solve #329, too. It's been hard :-p
Merge pull request #334 from agueganno/quick-fix

Prevents SQL injection