User:Salvatore Ingala/RL2 integration

TODO list:


 * Integrate remaining changes from salvatoreingala branch to RL2 branch
 * Gadget.php
 * Hooks
 * GadgetsMainModule
 * ext.gadgets.preferences
 * Port integrated code to new backend
 * API modules
 * GadgetOptionsResourceLoaderModule (maybe)
 * Hooks
 * possibly more stuff, keep poking until the fatals go away
 * Move JSON blob in MediaWiki:Gadget-foo.preferences to an element of Gadget definition:Foo.js
 * [Roan] Review jquery.formBuilder, GadgetPrefs
 * Fix test cases for new backend