learningequality/ka-lite — pull request #528 by bcipolli (2013-08-23 02:03:25+00:00)
Title: HTH: Allow users to import progress data from Khan Academy

[This is a retargeting of #489--hopefully we won't have to do that too frequently any longer!]

This branch is dependent on #139, and addresses #253, partially #447. To view code differences at this moment, please sese https://github.com/bcipolli/ka-lite/compare/mplayer_launcher...khanloadv2

Background:
KA Lite is being used in situations where users have begun learning on KA, and want to continue offline using KA Lite. In order to do so, we would need to download their data from KA and import into KA Lite.

Issues:
* KA has an API for getting these data, but it requires a (private) API key. In addition, KA's API is famously (at least around here) unstable.

Changes:
* Implemented all user data retrieval from KA on the central server.
* Created a hand-shake / callback procedure between the distributed and central server for getting the data, then POSTing back to the distributed server to save.
* Created a student "dashboard", where students can see their current progress and have access to controls (such as "download from KA Lite"

Testing:
* This requires setting up a test central and distributed server.
* **THIS WILL NOT WORK UNLESS you add two values to your local_settings.py file on your test CENTRAL server** (KHAN_API_CONSUMER_KEY and KHAN_API_CONSUMER_SECRET).
`KHAN_API_CONSUMER_KEY = "vrwxbbWvh7PwTkzk";
KHAN_API_CONSUMER_SECRET = "xLxMgDKEj5EMdThf"`

Notes:
* This version does everything synchronously in the browser, which can take a bit of time. A future iteration could look at finishing the import in a background request, with an AJAX listener trying to detect an update.
* When #411 is merged, the button can be displayed when online only.

Some screen shots of the user experience:

Dashboard, with no data:
![screen shot 2013-08-15 at 10 46 49 am](https://f.cloud.github.com/assets/4072455/970603/d54713de-05d9-11e3-8bf1-50663d93a029.png)
After clicking the button:
![screen shot 2013-08-15 at 10 47 36 am](https://f.cloud.github.com/assets/4072455/970604/d5488d68-05d9-11e3-9276-e60f5eec9ccb.png)
After clicking "google":
![screen shot 2013-08-15 at 10 47 42 am](https://f.cloud.github.com/assets/4072455/970608/d6208916-05d9-11e3-81d9-c09cf4e21afa.png)
After clicking "grant" and waiting ~20-30 seconds:
![screen shot 2013-08-15 at 10 52 57 am](https://f.cloud.github.com/assets/4072455/970606/d564843c-05d9-11e3-8242-e174ab579f2c.png)
If there's ever an error (forced, for demo purposes):
![screen shot 2013-08-15 at 10 48 02 am](https://f.cloud.github.com/assets/4072455/970607/d5641e02-05d9-11e3-97ac-d6d15339af1c.png)