Bunch of small fixes for issues found during deployment

- Add the current directory to the path BEFORE accessing get_database
- Change saveScores to setScores
- Handle the fact that the score can be a float, so we need to convert to int
  before looking up the corresponding file name
- Add test cases for the float score case
Check in an initial, somewhat working version of the choice screen with hardcoded values

This allows me to use iframes without having to scramble to finish up other stuff
Check in working version with hardcoded values
Check in a templatized version

This required fixing some of the gamified code
Switched the tabs to the top to allow them to work properly on iOS

And switched from srcdoc, which is unsupported on android, to a data HTML
reference, base64 encoded for safety.
Finally used some CSS magic from the inspector to get the top bar to work properly

Should probably create a blog post for this
Fixes to the result template to correctly insert a URL base

The method with embedding the text as a base64 encoded string worked fine,
except for URL loading. We have a lot of relative URLs in the embedded
documents, and they were not loadable wrt the data: URL

I had initially worked around this by converting them to absolute values, but
that is not a scalable solution since it requires changing the files while
moving from dev -> production.

I now work around that by editing the included document and including a <base>
URL. I do this "the right way" by using an angular directive which decodes the
document, replaces <head> by <head><base href=""> and then generates a new
encoded value. This now works for unmodified data and game templates.
Hook up the callback to switch the default view

This is a portmanteau change, mostly focused around hooking up the default view
callback, but it has some other changes mixed in as well. A summary of the
changes follows:
- Document the reasons behind the current view selection callback (GET instead of POST)
- Implement a javascriptCallback method that can be used for such callbacks
  from our own javascript (API -> client -> choiceClient)
- Implement a generic function to store client specific state in the user profile
- Use it to store the "curr_view"
- Change the javascript to read the curr_view and use it for initialization,
  and to pass the correct query parameters to the HTTP GET call
- unit tests for the above

In addition, I pulled out the implementation of the data result into a separate
"default" client. We have discussed pulling it out as a separate client, and
this will help us get started. It will also help us invoke the method to embed
the data result into the choice screen.

Also cleaned up some of the unused functions in the javascript code. For
example, we don't really need to do anything once the iframe is loaded.
Split the storage of the results into different fields for the gamified and default cases

When I initially started tracking scores, I was lazy and stored the
carbonFootprint in the same field as the gamification score, instead of having
client specific fields. This made sense if you thought that there was one
"result" field that was populated in different ways by different clients.
Unfortunately, this model broke for the "choice" client, because we wanted to
store multiple results at the same time.

So now, I have moved the field access code into the specific clients. The
default code is in the default client. This allows the choice client to call
the gamified and default clients to do its work. This also allows us to simply
the handling of backgrond tasks, since the default background task handling is
in the default client and can be invoked just like the other clients.

I also check in a script to go through and fix the existing users. For all users
who are not in the "gamified" group, we need to move their carbon footprint
from the currentScore field to the carbon_footprint field, and delete the
currentScore and previousScore fields.
Split the storage of the results into different fields for the gamified and default cases (part 2)

The previous commit only included the new files, for some reason.
This includes all the files at the point where they passed unit testing.
Switch from jquery to ionic

- Move the displayGraph function into a new controller
- Switch to using global variables since passing values into a function doesn't seem to work in angular
Switch the gamified view to also use ionic

This now works well in both the gamified and the choice views on both iOS and
android. We still have the issue with the iPhone4 screen, but that can't be
helped.

Also includes a bunch of bonus fixes:
- stop hardcoding the scores for testing in the choice view
- comment out the alerts
- fix the icons, etc
Fixed one more location with a hardcoded email address

Good catch by Francois!
Merge pull request #30 from shankari/master

Get the choice screen to work as well