Faster pages sorting in O(n) database operations

I'm using an older version of the CMS with a tree of about 300 pages and the sorting functionality goes on for something like 2 minutes before completing.

The purpose of this pull request is mostly to discuss a new way of sorting pages by visiting the JSON tree that is provided as a param, assigning all the correct lft, rgt, depth and parent_id to these nodes and then just batch update all the pages to their correct marks.

This should take O(n) database operations and has reduced sorting locally from about 1:20 minutes to 28 seconds.

I do expect this solution to be considered hackish, and I do expect there to be potential concurrency problems, but I mostly want to have some feedback on this idea. 
Thanks!
Ok, sorry, that might be because I'm always updating the code in both this pull request and my own alchemy_cms 2.6 (where I can test with a real database of tree nodes). 

I'll fix that soon in a commit to handle most of the issues you mentioned. ;)