diff --git a/ckan/controllers/group.py b/ckan/controllers/group.py index c40979bbabb..5a1dcdb7aa8 100644 --- a/ckan/controllers/group.py +++ b/ckan/controllers/group.py @@ -439,7 +439,8 @@ def history(self, id): context = {'model': model, 'session': model.Session, 'user': c.user or c.author, - 'schema': self._form_to_db_schema()} + 'schema': self._form_to_db_schema(), + 'extras_as_string': True} data_dict = {'id': id} try: c.group_dict = get_action('group_show')(context, data_dict) diff --git a/ckan/lib/cli.py b/ckan/lib/cli.py index f91de5b5484..8a37040e1a1 100644 --- a/ckan/lib/cli.py +++ b/ckan/lib/cli.py @@ -13,6 +13,35 @@ # i.e. do the imports in methods, after _load_config is called. # Otherwise loggers get disabled. + +def parse_db_config(config_key='sqlalchemy.url'): + ''' Takes a config key for a database connection url and parses it into + a dictionary. Expects a url like: + + 'postgres://tester:pass@localhost/ckantest3' + ''' + from pylons import config + url = config[config_key] + regex = [ + '^\s*(?P\w*)', + '://', + '(?P[^:]*)', + ':?', + '(?P[^@]*)', + '@', + '(?P[^/:]*)', + ':?', + '(?P[^/]*)', + '/', + '(?P[\w.-]*)' + ] + db_details_match = re.match(''.join(regex), url) + if not db_details_match: + raise Exception('Could not extract db details from url: %r' % url) + db_details = db_details_match.groupdict() + return db_details + + class MockTranslator(object): def gettext(self, value): return value @@ -134,14 +163,7 @@ def command(self): sys.exit(1) def _get_db_config(self): - from pylons import config - url = config['sqlalchemy.url'] - # e.g. 'postgres://tester:pass@localhost/ckantest3' - db_details_match = re.match('^\s*(?P\w*)://(?P[^:]*):?(?P[^@]*)@(?P[^/:]*):?(?P[^/]*)/(?P[\w.-]*)', url) - if not db_details_match: - raise Exception('Could not extract db details from url: %r' % url) - db_details = db_details_match.groupdict() - return db_details + return parse_db_config() def _get_postgres_cmd(self, command): self.db_details = self._get_db_config() diff --git a/ckan/public/base/javascript/resource.config b/ckan/public/base/javascript/resource.config index 66ede7154dd..93a85551a81 100644 --- a/ckan/public/base/javascript/resource.config +++ b/ckan/public/base/javascript/resource.config @@ -46,3 +46,5 @@ main = modules/custom-fields.js modules/related-item.js modules/data-viewer.js + modules/resource-form.js + modules/resource-upload-field.js diff --git a/ckan/public/base/less/ckan.less b/ckan/public/base/less/ckan.less index 4ca1f3c3ba1..16f182b9f81 100644 --- a/ckan/public/base/less/ckan.less +++ b/ckan/public/base/less/ckan.less @@ -94,4 +94,42 @@ iframe { margin-bottom: 16px; } +.m-top { + margin-top: @gutterSmallX; +} +.m-left { + margin-left: @gutterSmallX; +} +.m-right { + margin-right: @gutterSmallX; +} +.m-bottom { + margin-bottom: @gutterSmallX; +} +.no-margin { + margin: 0; +} +.reduced-margin { + margin: 3px 5px; +} + +.p-top { + padding-top: @gutterSmallX; +} +.p-left { + padding-left: @gutterSmallX; +} +.p-right { + padding-right: @gutterSmallX; +} +.p-bottom { + padding-bottom: @gutterSmallX; +} +.no-padding { + padding: 0; +} +.reduced-padding { + padding: 3px 5px; +} + @import "iehacks.less"; diff --git a/ckan/public/base/less/forms.less b/ckan/public/base/less/forms.less index 04f72e68cfe..688d98add68 100644 --- a/ckan/public/base/less/forms.less +++ b/ckan/public/base/less/forms.less @@ -40,6 +40,9 @@ input[type=checkbox] { top: 7px; padding: 0; margin: 0; + &.checkbox-onown { + top: 0; + } } select { diff --git a/ckan/public/base/vendor/resource.config b/ckan/public/base/vendor/resource.config index f64cc874218..ca333d3908b 100644 --- a/ckan/public/base/vendor/resource.config +++ b/ckan/public/base/vendor/resource.config @@ -23,6 +23,7 @@ block_html5_shim = [depends] vendor = jquery.js +fileupload = jquery.js [groups] @@ -38,3 +39,9 @@ vendor = bootstrap/js/bootstrap-tab.js bootstrap/js/bootstrap-button.js font-awesome/css/font-awesome-ie7.css + + +fileupload = + jquery.ui.widget.js + jquery-fileupload/jquery.iframe-transport.js + jquery-fileupload/jquery.fileupload.js diff --git a/ckan/templates/admin/authz.html b/ckan/templates/admin/authz.html index 6348e8e0d46..cecb18a9f75 100644 --- a/ckan/templates/admin/authz.html +++ b/ckan/templates/admin/authz.html @@ -6,9 +6,15 @@ {% endblock %} {% macro authz_form_table(id, roles, users, user_role_dict) %} - +
+ + + {% for role in roles %} + + {% endfor %} + - + {% for role in roles %} {% endfor %} @@ -20,15 +26,11 @@ {% for role in roles %} {% endfor %} @@ -39,21 +41,27 @@ {% macro authz_add_table(roles) %} -
User {{ _('User') }} {{ role }} - + {% if user_role_dict[(user,role)] %} - + {% else %} - + {% endif %}
+
+ + + {% for role in roles %} + + {% endfor %} + - + {% for role in roles %} {% endfor %} - {% for role in roles %} {% endfor %} @@ -61,9 +69,15 @@ {% endmacro %} {% macro authz_form_group_table(id, roles, users, user_role_dict) %} -
User{{ _('User') }} {{ role }}
- + + - +
+
+ + + {% for role in roles %} + + {% endfor %} + - + {% for role in roles %} {% endfor %} @@ -75,15 +89,11 @@ {% for role in roles %} {% endfor %} @@ -94,7 +104,13 @@ {% macro authz_add_group_table(roles) %} -
User Group{{ _('User Group') }} {{ role }} - + {% if user_role_dict[(user,role)] %} - + {% else %} - + {% endif %}
+
+ + + {% for role in roles %} + + {% endfor %} + {% for role in roles %} @@ -102,13 +118,13 @@ {% endfor %} - {% for role in roles %} {% endfor %} @@ -118,20 +134,19 @@ {% block primary %}
-

{{ _('Administration - Authorization') }}

-

Update Existing Roles

+ {% snippet 'admin/snippets/header.html', action=c.action %} + +

{{ _('Update Existing Roles') }}

{{ authz_form_table('theform', c.roles, c.users, c.user_role_dict) }} - +
-

Add Roles for Any User

+

{{ _('Add Roles for Any User') }}

{{ authz_add_table(c.roles) }} - +
diff --git a/ckan/templates/admin/config.html b/ckan/templates/admin/config.html index aee2fc37197..fa1bd6d366b 100644 --- a/ckan/templates/admin/config.html +++ b/ckan/templates/admin/config.html @@ -7,7 +7,7 @@ {% block primary %}
-

{{ _('Configuration Settings') }}

+ {% snippet 'admin/snippets/header.html', action=c.action %}
{{ autoform.generate(form_items, data, errors) }} diff --git a/ckan/templates/admin/index.html b/ckan/templates/admin/index.html index ce6ed54ce16..578c570bd9e 100644 --- a/ckan/templates/admin/index.html +++ b/ckan/templates/admin/index.html @@ -8,8 +8,7 @@ {% block primary %}
-

{{ _('Current Sysadmins') }}

-

{% set url=h.url_for(controller='admin', action='authz') %}{% trans %}You can change sysadmins on the authorization page.{% endtrans %}

+ {% snippet 'admin/snippets/header.html', action=c.action %}
    {% for user in c.sysadmins %}
  • diff --git a/ckan/templates/admin/snippets/header.html b/ckan/templates/admin/snippets/header.html new file mode 100644 index 00000000000..dfac402b7c0 --- /dev/null +++ b/ckan/templates/admin/snippets/header.html @@ -0,0 +1,13 @@ +

    {{ _('Administration') }}

    + + diff --git a/ckan/templates/base.html b/ckan/templates/base.html index 537bc07d4b9..fd064b12f39 100644 --- a/ckan/templates/base.html +++ b/ckan/templates/base.html @@ -106,6 +106,8 @@ {# The scripts block allows you to add additonal scripts to the page. Use the super() function to load the default scripts before/after your own. + NOTE: Scripts should be loaded by the {% resource %} tag except + in very special circumstances DO NOT USE THIS METHOD FOR ADDING SCRIPTS. Example: diff --git a/ckan/templates/package/new_resource.html b/ckan/templates/package/new_resource.html index faa93ee9ea7..52a114e39a9 100644 --- a/ckan/templates/package/new_resource.html +++ b/ckan/templates/package/new_resource.html @@ -23,11 +23,7 @@

    {{ _('What {% block scripts %} {{ super() }} - - - - - + {% resource 'vendor/fileupload' %} {% endblock %} {% block breadcrumb_content %} diff --git a/ckan/templates/package/resource_read.html b/ckan/templates/package/resource_read.html index b2e67fc0a9c..f1a41059b95 100644 --- a/ckan/templates/package/resource_read.html +++ b/ckan/templates/package/resource_read.html @@ -115,3 +115,4 @@

    Resource I {% snippet "snippets/social.html" %} {% endblock %} {% endblock %} + diff --git a/ckan/templates/snippets/recline-extra-footer.html b/ckan/templates/snippets/recline-extra-footer.html deleted file mode 100644 index 88a44ecdc6a..00000000000 --- a/ckan/templates/snippets/recline-extra-footer.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - diff --git a/ckan/templates/snippets/recline-extra-header.html b/ckan/templates/snippets/recline-extra-header.html deleted file mode 100644 index 0bd8333a666..00000000000 --- a/ckan/templates/snippets/recline-extra-header.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - diff --git a/ckan/templates_legacy/snippets/internal-tracking.html b/ckan/templates_legacy/snippets/internal-tracking.html index 1239850854f..6979935caa4 100644 --- a/ckan/templates_legacy/snippets/internal-tracking.html +++ b/ckan/templates_legacy/snippets/internal-tracking.html @@ -3,6 +3,7 @@ xmlns:i18n="http://genshi.edgewall.org/i18n" xmlns:py="http://genshi.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude" + py:strip="True" >

User Group
- + + - +