diff --git a/ckan/lib/helpers.py b/ckan/lib/helpers.py index c0f63d0c143..384f08c8581 100644 --- a/ckan/lib/helpers.py +++ b/ckan/lib/helpers.py @@ -568,6 +568,8 @@ def check_access(action, data_dict=None): context = {'model': model, 'user': c.user or c.author} + if not data_dict: + data_dict = {} try: check_access_logic(action, context, data_dict) diff --git a/ckan/model/meta.py b/ckan/model/meta.py index b8d6b42cd65..ce175d309d7 100644 --- a/ckan/model/meta.py +++ b/ckan/model/meta.py @@ -161,4 +161,6 @@ def engine_is_sqlite(): def engine_is_pg(): # Returns true iff the engine is connected to a postgresql database. - return engine.url.drivername in ['psycopg2', 'postgres'] + # According to http://docs.sqlalchemy.org/en/latest/core/engines.html#postgresql + # all Postgres driver names start with `postgresql` + return engine.url.drivername.startswith('postgresql') diff --git a/ckan/public/base/css/main.css b/ckan/public/base/css/main.css index 6d4fc938097..eaa904d3dac 100644 --- a/ckan/public/base/css/main.css +++ b/ckan/public/base/css/main.css @@ -4506,13 +4506,13 @@ ul.icons li .icon-large:before { .simple-list:after { clear: both; } -.simple-list > li { +.simple-list > li { font-size: 12px; line-height: 1.1666666666666667em; padding: 7px 25px; border-bottom: 1px dotted #cccccc; } -.simple-list > li:last-of-type { +.simple-list > li:last-of-type { border-bottom: 0; } .simple-list .ckan-icon { @@ -4669,8 +4669,6 @@ ul.icons li .icon-large:before { padding-right: 15px; } .module-grid { - margin: 0; - list-style: none; margin: 0; list-style: none; *zoom: 1; @@ -4694,7 +4692,6 @@ ul.icons li .icon-large:before { padding-left: 20px; padding-bottom: 25px; float: left; - float: left; margin-left: 20px; width: 460px; padding-top: 10px; @@ -4720,10 +4717,10 @@ ul.icons li .icon-large:before { .ckanext-datapreview { position: relative; } -.ckanext-datapreview > iframe { +.ckanext-datapreview > iframe { min-height: 400px; } -.ckanext-datapreview > img { +.ckanext-datapreview > img { max-height: 500px; max-width: 100%; overflow: hidden; @@ -4887,13 +4884,13 @@ ol.media-grid:after { .nav-simple:after { clear: both; } -.nav-simple > li { +.nav-simple > li { font-size: 12px; line-height: 1.1666666666666667em; padding: 7px 25px; border-bottom: 1px dotted #cccccc; } -.nav-simple > li:last-of-type { +.nav-simple > li:last-of-type { border-bottom: 0; } .nav-simple .ckan-icon { @@ -4915,12 +4912,10 @@ ol.media-grid:after { } .nav-item.active > a { background: url("../../../base/images/background-tag.png") no-repeat -13px center; - position: relative; display: block; font-size: 11px; line-height: 27px; color: #187794; - padding-left: 10px; padding-right: 5px; margin-right: 11px; -webkit-box-sizing: border-box; @@ -5226,8 +5221,6 @@ textarea { background-image: url("../../../base/images/sprite-ckan-icons.png"); background-repeat: no-repeat; background-position: 16px 16px; - width: 17px; - height: 17px; background-position: -51px -16px; position: absolute; display: block; @@ -5654,6 +5647,13 @@ textarea { .control-full .select2-container { width: 520px !important; } +.control-group.error .select2-container input:focus, +.control-group.error .select2-container select:focus, +.control-group.error .select2-container textarea:focus { + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} .dataset-item { border-bottom: 1px dotted #cccccc; padding-bottom: 20px; @@ -5821,8 +5821,6 @@ textarea { vertical-align: text-bottom; position: relative; top: 2px; - width: 16px; - height: 16px; background-image: url("../../../base/images/sprite-ckan-icons.png"); background-repeat: no-repeat; background-position: 16px 16px; @@ -6682,7 +6680,6 @@ li .icon-large:before { float: right; } [role=main] .secondary { - float: left; margin-left: 20px; width: 220px; margin-left: 0; @@ -7239,9 +7236,18 @@ header.masthead .debug { display: block; font-size: 30px; font-weight: 700; - line-height: 1.2; + line-height: 36px; margin-left: 0; } +.profile-info .nums dl dd .smallest { + font-size: 13px; +} +.profile-info .nums dl dd .smaller { + font-size: 16px; +} +.profile-info .nums dl dd .small { + font-size: 21px; +} .profile-info.editing .module-content { margin-top: 0; } diff --git a/ckan/public/base/less/forms.less b/ckan/public/base/less/forms.less index 445c2677ec2..5902a859f8b 100644 --- a/ckan/public/base/less/forms.less +++ b/ckan/public/base/less/forms.less @@ -686,3 +686,11 @@ textarea { // sets it on the element. width: 520px !important; } + +.control-group.error .select2-container { + input:focus, + select:focus, + textarea:focus { + .box-shadow(none); + } +} diff --git a/ckan/templates/admin/authz.html b/ckan/templates/admin/authz.html index cecb18a9f75..5b60f95cc27 100644 --- a/ckan/templates/admin/authz.html +++ b/ckan/templates/admin/authz.html @@ -14,9 +14,9 @@ {% endfor %} - {{ _('User') }} + {{ _('User') }} {% for role in roles %} - {{ role }} + {{ role }} {% endfor %} {% for user in users %} @@ -49,9 +49,9 @@ {% endfor %} - {{ _('User') }} + {{ _('User') }} {% for role in roles %} - {{ role }} + {{ role }} {% endfor %} @@ -77,9 +77,9 @@ {% endfor %} - {{ _('User Group') }} + {{ _('User Group') }} {% for role in roles %} - {{ role }} + {{ role }} {% endfor %} {% for user in users %} @@ -112,9 +112,9 @@ {% endfor %} - User Group + User Group {% for role in roles %} - {{ role }} + {{ role }} {% endfor %} diff --git a/ckan/templates/ajax_snippets/api_info.html b/ckan/templates/ajax_snippets/api_info.html index f339054e86d..20fc44281b8 100644 --- a/ckan/templates/ajax_snippets/api_info.html +++ b/ckan/templates/ajax_snippets/api_info.html @@ -39,19 +39,19 @@

- Create + Create {{ datastore_root_url }}/datastore_create - Update / Insert + Update / Insert {{ datastore_root_url }}/datastore_upsert - Query + Query {{ datastore_root_url }}/datastore_search - Query (via SQL) + Query (via SQL) {{ datastore_root_url }}/datastore_search_sql diff --git a/ckan/templates/group/read_base.html b/ckan/templates/group/read_base.html index e41cb7ebe7d..a16615b7777 100644 --- a/ckan/templates/group/read_base.html +++ b/ckan/templates/group/read_base.html @@ -26,9 +26,6 @@ {% link_for _('Activity Stream'), controller='group', action='activity', id=c.group_dict.name, icon='time' %} - - {% link_for _('Administrators'), controller='group', action='admins', id=c.group_dict.name, icon='cog' %} - {% link_for _('About'), controller='group', action='about', id=c.group_dict.name, icon='info-sign' %} diff --git a/ckan/templates/organization/members.html b/ckan/templates/organization/members.html index fd0e34b6496..175af5e7566 100644 --- a/ckan/templates/organization/members.html +++ b/ckan/templates/organization/members.html @@ -11,9 +11,9 @@

{{ _('Members') }}

- {{ _('User') }} - {{ _('Role') }} - + {{ _('User') }} + {{ _('Role') }} + diff --git a/ckan/templates/organization/read_base.html b/ckan/templates/organization/read_base.html index d0c142f015c..23dc5c71ccd 100644 --- a/ckan/templates/organization/read_base.html +++ b/ckan/templates/organization/read_base.html @@ -33,7 +33,7 @@ {% endblock %} {% block secondary_content %} - {% snippet 'snippets/organization.html', organization=c.group_dict %} + {% snippet 'snippets/organization.html', organization=c.group_dict, show_nums=true %} {% if h.user_in_org_or_group(c.group_dict.id) %} {{ h.snippet('snippets/facet_list.html', title='Visibility', name='capacity', extras={'id':c.group_dict.id}) }} diff --git a/ckan/templates/package/read_base.html b/ckan/templates/package/read_base.html index 14c90e7cbf9..9f457eae772 100644 --- a/ckan/templates/package/read_base.html +++ b/ckan/templates/package/read_base.html @@ -55,6 +55,12 @@ {% block secondary_help_content %}{% endblock %} + {% block package_organization %} + {% if pkg.organization %} + {% snippet "snippets/organization.html", organization=pkg.organization, truncate=70, show_nums=false %} + {% endif %} + {% endblock %} + {% block package_groups %} {% for group in pkg.groups %} {% snippet "snippets/group.html", group=group, truncate=70 %} diff --git a/ckan/templates/package/resource_read.html b/ckan/templates/package/resource_read.html index 0f6f5c6d849..32dbcfc0a03 100644 --- a/ckan/templates/package/resource_read.html +++ b/ckan/templates/package/resource_read.html @@ -79,13 +79,13 @@

Additional Information

- - + + {% for key, value in h.format_resource_items(res.items()) %} - + {% endfor %}
FieldValueFieldValue
{{ key }}{{ value }}
{{ key }}{{ value }}
diff --git a/ckan/templates/package/snippets/additional_info.html b/ckan/templates/package/snippets/additional_info.html index 82e1eabd7d8..64821f08f59 100644 --- a/ckan/templates/package/snippets/additional_info.html +++ b/ckan/templates/package/snippets/additional_info.html @@ -3,52 +3,52 @@

{{ _('Additional Info') }}

- - + + {% if pkg_dict.url %} - + {% endif %} {% if pkg_dict.author_email %} - + {% elif pkg_dict.author %} - + {% endif %} {% if pkg_dict.maintainer_email %} - + {% elif pkg_dict.maintainer %} - + {% endif %} {% if pkg_dict.version %} - + {% endif %} {% if h.check_access('package_update',{'id':pkg_dict.id}) %} - + {% endif %} @@ -56,7 +56,7 @@

{{ _('Additional Info') }}

{% for extra in h.sorted_extras(pkg_dict.extras) %} {% set key, value = extra %} - + {% endfor %} diff --git a/ckan/templates/snippets/organization.html b/ckan/templates/snippets/organization.html index d0fddf914bd..8bbd4a9f418 100644 --- a/ckan/templates/snippets/organization.html +++ b/ckan/templates/snippets/organization.html @@ -26,18 +26,20 @@

{{ organization.title or organization.name }}

{% link_for _('read more'), controller='organization', action='about', id=organization.name %}

{% else %} -

{{ _('There is no description for this group') }}

+

{{ _('There is no description for this organization') }}

+ {% endif %} + {% if show_nums %} +
+
+
{{ _('Members') }}
+
{{ h.SI_number_span(organization.members|length) }}
+
+
+
{{ _('Datasets') }}
+
{{ h.SI_number_span(organization.package_count) }}
+
+
{% endif %} -
-
-
{{ _('Members') }}
-
{{ h.SI_number_span(organization.members|length) }}
-
-
-
{{ _('Datasets') }}
-
{{ h.SI_number_span(organization.package_count) }}
-
-
{% endwith %} diff --git a/ckan/templates/snippets/related.html b/ckan/templates/snippets/related.html index 4a4395cc2e3..380a6276709 100644 --- a/ckan/templates/snippets/related.html +++ b/ckan/templates/snippets/related.html @@ -1,5 +1,5 @@
-

Related Add Related

+

Related

{% if item %} {% with url = h.url_for(controller='related', action='list', id=pkg_name) %} @@ -12,9 +12,11 @@

{{ item.title }}

{% endwith %} {% else %} -

No apps, ideas, news stories or images have been - related to this dataset yet, why not add one now?

-

{% link_for _('Add Item'), controller='related', action='new', id=pkg_name, icon='plus', class_='btn' %}

+

{% trans %}No apps, ideas, news stories or images have been + related to this dataset yet.{% endtrans %}

+ {% if h.check_access('related_create') %} +

{% link_for _('Add Item'), controller='related', action='new', id=pkg_name, icon='plus', class_='btn' %}

+ {% endif %} {% endif %}
diff --git a/ckan/templates/user/read.html b/ckan/templates/user/read.html index 9a272ecfa3e..c2afb1bca6c 100644 --- a/ckan/templates/user/read.html +++ b/ckan/templates/user/read.html @@ -11,7 +11,9 @@

{{ _('Datasets') }}

{% if c.is_myself %}

{{ _('You haven\'t created any datasets.') }} - {% link_for _('Create one now?'), controller='package', action='new' %}. + {% if h.check_access('package_create') %} + {% link_for _('Create one now?'), controller='package', action='new' %} + {% endif %}

{% else %}

@@ -20,4 +22,4 @@

{{ _('Datasets') }}

{% endif %} {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/ckanext/datastore/plugin.py b/ckanext/datastore/plugin.py index 412ba37f48c..cdb547a2211 100644 --- a/ckanext/datastore/plugin.py +++ b/ckanext/datastore/plugin.py @@ -68,8 +68,7 @@ def configure(self, config): self._create_alias_table() else: log.warn("We detected that CKAN is running on a read only database. " - "Permission checks and _table_metadata creation are skipped." - "Make sure that replication is properly set-up.") + "Permission checks and the creation of _table_metadata are skipped.") else: log.warn("We detected that you do not use a PostgreSQL database. " "The DataStore will NOT work and datastore tests will be skipped.")
{{ _('Field') }}{{ _('Value') }}{{ _('Field') }}{{ _('Value') }}
{{ _('Source') }}{{ _('Source') }} {{ h.link_to(pkg_dict.url, pkg_dict.url, rel='foaf:homepage', target='_blank') }}
{{ _("Author") }}{{ _("Author") }} {{ h.mail_to(email_address=pkg_dict.author_email, name=pkg_dict.author) }}
{{ _("Author") }}{{ _("Author") }} {{ pkg_dict.author }}
{{ _('Maintainer') }}{{ _('Maintainer') }} {{ h.mail_to(email_address=pkg_dict.maintainer_email, name=pkg_dict.maintainer) }}
{{ _('Maintainer') }}{{ _('Maintainer') }} {{ pkg_dict.maintainer }}
{{ _("Version") }}{{ _("Version") }} {{ pkg_dict.version }}
{{ _("State") }}{{ _("State") }} {{ pkg_dict.state }}
{{ _(key) }}{{ _(key) }} {{ value }}