[#1025] User log in/out fixes including i18n and non standard root url
[#1025] Fix failing tests due to extra redirect etc (stupid tests)
[#1039] make sure came_from url is sane (local)
[#1039] Minor code cleanup - unused imports
[#1039] Fix for own domain
[#953] Add API tests for private dataset activities

Add tests that no activities are emitted when creating, updating or
deleting private datasets via the API.

These could be more detailed, e.g. test adding, deleting and updating
groups as well, or moving the dataset between groups or between orgs, or
testing what happens when a private dataset is made public or
vice-versa.
[#953] Move new dataset visibility to first stage

Move the visibility option (public or private) when creating a dataset
to the first stage of the dataset creation form. This fixes the issue
(#953) that an activity is emitted when creating private datasets. Since
the dataset is actually created when the first form is submitted, and
the public/private setting is not chosen until the third form, the
dataset is public at the moment when it's created and an activity is
emitted.

It seems to make a lot more sense fo the visibility option to be on the
first form next to the organization option anyway.

Fixes #953.
[#953] Allow anyone to read datasets with no org

If a dataset has no owner organization, authorize anyone to read that
dataset (regardless of whether it's public or private).
[#953] Fix display or Organization and Visibility dropdowns

Fix the logic for displaying the Organization and Visibility dropdowns
when creating or updating a dataset.

We really need frontend tests for this.

I tested these cases manually:

User is not logged in and anon_create_dataset = True: neither
Organization nor Visibility shows, either when creating or when updating
a dataset.

User is logged in, but is not a member of any organization: neither
Organization nor Visibility shows, either when creating or when updating
a dataset. Tested both when the site has no organizations and when the
site does have orgs but user is not a member of any.

User is logged in, and is a member of an organization: Both Organization
and Visibility show when creating a dataset.

When creating a private dataset, no activities appear in the activity
stream.

User is logged in, and is a member of an organization, but dataset is
not a member of any org: neither Organization nor Visibility shows when
updating a dataset.

User is logged in, and is a member of an organization, and dataset is a
member of any org: Visibility shows but Organization does not show when
updating a dataset.

User is sysadmin, site has no orgs: neither Organization nor Visibility
shows when creating or updating a dataset.

User is sysadmin, site does have orgs: both Organization and Visibility
show when creating or updating a dataset.
[#953] Don't show inactive datasets

Don't allow non-sysadmins to read inactive datasets.

This fixes a test that was failing.
[#953] Don't allow private datasets with no organization

Add a validator to prevent private datasets with no organization from
being created by package_create or package_update.

Conflicts:

	ckan/logic/schema.py
	ckan/logic/validators.py
[#953] Adds JS module for disabling visibility field on dataset creation

Essentially we get the current value of the visibility dropdown and then if no
org is selected then we disable the visibilty dropdown and set it to be public.

Conflicts:

	ckan/public/base/javascript/resource.config
[#953] Fix a broken test

This test was trying to create private datasets that don't belong to any
organization, which isn't allowed.
[#953] fix datastore tests

create an organization in setup and use it in package_create