Much faster approach to retrieve project's resource paths

Part of evernote/pootle#79.

Note picked from Julen's commit in GitHub:

    I should have written this in the commit message/issue, but I'll mention
    it here for the record (better late than never): the ugly replace/concat
    functions are necessary because at the DB level Pootle doesn't have the
    notion of paths relative to TPs.

    With the conversion function, pootle_paths such as
    /<lang-code>/<project-code>/path/to/file.po become path/to/file.po.
    This way it's possible to select unique occurrences of these relative
    paths.

Pick notes: Had to fix a conflict because of some syntax changes we did
    to support PostgreSQL in 8a325b1b.

Conflicts:
	pootle/apps/pootle_project/models.py
Provide raw SQL alternative for PostgreSQL

This is the "magic" of using raw SQL.
Provide raw SQL alternative for SQLite

This is the "magic" of using raw SQL.
Cache list of project resources

Fixes evernote/pootle#79.

Pick notes: Fixed minor conflicts and added Signals separator comment.

Conflicts:
	pootle/apps/pootle_project/models.py
Remove margin from root elements
Cleanup: removed dead code

Conflicts:
	pootle/apps/pootle_statistics/models.py
Fixed use of class attribute
Adapt first drop-down elements according to the current context

Fixes evernote/pootle#81.

Pick notes: Just fixed minor conflicts because of code divergence.

Conflicts:
	pootle/core/url_helpers.py
	pootle/static/css/style.css
Redirect to cross-language page for missing resources

Pick note: Just minor conflict because of code divergence.

Conflicts:
	pootle/core/decorators.py
Check for missing resource_path property
Simplified code
Ensure project admin URLs are matched

Conflicts:
	pootle/apps/pootle_project/urls.py
Fixed stupid caching mistake

Conflicts:
	pootle/apps/pootle_project/models.py
Cleanup: make code more readable
More flexible way to customize behavior for each drop-down
No need to determine the initially-selected value

This is already done in `PTL.browser.fixDropdowns` when the `pageshow`
event fires.
Append prefix to context-specific drop-down elements

This workaround is to avoid having `<option>` elements with duplicated
`value` values, otherwise setting its value via select2/jQuery will fail.

Pick notes: Minor conflict because of change done to don't hide the
    resources dropdown in 001c0cba.

Conflicts:
	pootle/templates/core/_breadcrumbs.html
Adjust breadcrumbs visibility after initial elements have been set

Avoids seeing selections being changed after the page has been loaded.
Expression doesn't end here
Use a drop-down menu for navigation instead of tabs

Fixes evernote/pootle#76.

Pick notes: Fixed several conflicts due to cleanups we did, code divergence,
    code we kept, and code we didn't pick. This requires cleanups to
    properly show the dropdown (it is always hidden). Also recovered some
    styling for the breadcrumbs that we didn't pick in the past.

Conflicts:
	pootle/apps/pootle_project/views.py
	pootle/apps/pootle_translationproject/views.py
	pootle/static/css/style.css
	pootle/templates/editor/main.html
	pootle/templates/languages/_tabs.html
	pootle/templates/projects/_tabs.html
	pootle/templates/translation_projects/_tabs.html
	pootle/templates/translation_projects/base.html