diff --git a/ckanext/odsh/fanstatic/multiselect.js b/ckanext/odsh/fanstatic/multiselect.js deleted file mode 100644 index 61a410546e7622221cf5849199ac36c439eda8eb..0000000000000000000000000000000000000000 --- a/ckanext/odsh/fanstatic/multiselect.js +++ /dev/null @@ -1,16 +0,0 @@ -ckan.module('odsh_multiselect', function ($) -{ - return { - initialize: function () - { - console.log(this.options) - //ckan destroys uppercase letters ... - $(this.el[0]).multiselect({ - allSelectedText: this.options.allselectedtext, - nonSelectedText: this.options.nonselectedtext, - nSelectedText: this.options.nselectedtext, - numberDisplayed: 1 - }); - } - }; -}); \ No newline at end of file diff --git a/ckanext/odsh/fanstatic/odsh_form.js b/ckanext/odsh/fanstatic/odsh_form.js new file mode 100644 index 0000000000000000000000000000000000000000..65db0a26a295f238e356e6d5e90296a979bea79e --- /dev/null +++ b/ckanext/odsh/fanstatic/odsh_form.js @@ -0,0 +1,34 @@ +ckan.module('odsh_form', function ($) +{ + return { + initialize: function () + { + // enable multiselect for input + if (this.options.multiselect) + $(this.el[0]).multiselect({ + allSelectedText: this.options.allselectedtext, + nonSelectedText: this.options.nonselectedtext, + nSelectedText: this.options.nselectedtext, + numberDisplayed: 1 + }); + if (this.options.licensetoggle) + { + // toggle input for 'Namensgebung' depending on the selected licence + // TODO: this implementation should be more generic + var id = '#field-license'; + var toggle = function () + { + if ($(id).val().indexOf('dl-by-de/2.0') !== -1) + { + $('#field-licence-name').prop('disabled', false); + } else + { + $('#field-licence-name').prop('disabled', true); + } + } + toggle(id) + $(id).change(toggle); + } + } + }; +}); \ No newline at end of file diff --git a/ckanext/odsh/i18n/ckanext-odsh.pot b/ckanext/odsh/i18n/ckanext-odsh.pot index d9cffa0fe04f4ade7b69c48e31e1e92bad84dbbd..1885142a55a7226b363bb5704dd72d4f2b18ed22 100644 --- a/ckanext/odsh/i18n/ckanext-odsh.pot +++ b/ckanext/odsh/i18n/ckanext-odsh.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ckanext-odsh 0.0.1\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-09-15 00:23+0000\n" +"POT-Creation-Date: 2018-09-28 13:50+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -17,43 +17,151 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.3.4\n" -#: ckanext/odsh/templates/header.html:10 +#: ckanext/odsh/plugin.py:52 +msgid "Groups" +msgstr "" + +#: ckanext/odsh/templates/header.html:43 +msgid "Search Datasets" +msgstr "" + +#: ckanext/odsh/templates/header.html:46 +msgid "Search" +msgstr "" + +#: ckanext/odsh/templates/header.html:65 +msgid "Start" +msgstr "" + +#: ckanext/odsh/templates/header.html:66 msgid "Datasets" msgstr "" -#: ckanext/odsh/templates/header.html:11 +#: ckanext/odsh/templates/header.html:67 +#: ckanext/odsh/templates/snippets/package_item.html:82 msgid "Organizations" msgstr "" -#: ckanext/odsh/templates/header.html:12 -msgid "Groups" +#: ckanext/odsh/templates/header.html:68 +msgid "Info" msgstr "" -#: ckanext/odsh/templates/header.html:13 -msgid "About" +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:5 +msgid "Title" msgstr "" -#: ckanext/odsh/templates/header.html:14 -msgid "Info" +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:17 +msgid "URL" msgstr "" -#: ckanext/odsh/templates/snippets/package_item.html:31 -msgid "Private" +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:23 +msgid "Description" msgstr "" -#: ckanext/odsh/templates/snippets/package_item.html:40 -msgid "Draft" +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:33 +#: ckanext/odsh/templates/package/snippets/package_metadata_fields.html:18 +msgid "This field is required" +msgstr "" + +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:34 +#: ckanext/odsh/templates/snippets/package_item.html:83 +msgid "License" +msgstr "" + +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:93 +msgid "Organization" +msgstr "" + +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:97 +msgid "No organization" +msgstr "" + +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:113 +msgid "State" msgstr "" -#: ckanext/odsh/templates/snippets/package_item.html:42 +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:117 +msgid "Active" +msgstr "" + +#: ckanext/odsh/templates/package/snippets/package_basic_fields.html:119 +#: ckanext/odsh/templates/snippets/package_item.html:49 msgid "Deleted" msgstr "" -#: ckanext/odsh/templates/snippets/package_item.html:50 +#: ckanext/odsh/templates/package/snippets/package_metadata_fields.html:47 +msgid "Visibility" +msgstr "" + +#: ckanext/odsh/templates/package/snippets/package_metadata_fields.html:50 +#: ckanext/odsh/templates/snippets/package_item.html:37 +msgid "Private" +msgstr "" + +#: ckanext/odsh/templates/package/snippets/package_metadata_fields.html:50 +msgid "Public" +msgstr "" + +#: ckanext/odsh/templates/snippets/facet_list.html:26 +msgid "Show More {facet_type}" +msgstr "" + +#: ckanext/odsh/templates/snippets/facet_list.html:30 +msgid "Show Only Popular {facet_type}" +msgstr "" + +#: ckanext/odsh/templates/snippets/facet_list.html:34 +msgid "There are no {facet_type} that match this search" +msgstr "" + +#: ckanext/odsh/templates/snippets/language_selector.html:13 +#: ckanext/odsh/templates/snippets/search_form.html:34 +msgid "Go" +msgstr "" + +#: ckanext/odsh/templates/snippets/package_item.html:47 +msgid "Draft" +msgstr "" + +#: ckanext/odsh/templates/snippets/package_item.html:58 msgid "Popular" msgstr "" -#: ckanext/odsh/templates/snippets/package_item.html:57 +#: ckanext/odsh/templates/snippets/package_item.html:65 msgid "This dataset has no description" msgstr "" +#: ckanext/odsh/templates/snippets/search_form.html:3 +msgid "Search datasets..." +msgstr "" + +#: ckanext/odsh/templates/snippets/search_form.html:4 +msgid "Order by" +msgstr "" + +#: ckanext/odsh/templates/snippets/search_form.html:5 +msgid "Name Ascending" +msgstr "" + +#: ckanext/odsh/templates/snippets/search_form.html:5 +msgid "Name Descending" +msgstr "" + +#: ckanext/odsh/templates/snippets/search_form.html:60 +msgid "Remove" +msgstr "" + +#: ckanext/odsh/templates/snippets/search_form.html:65 +msgid "Filter Results" +msgstr "" + +#: ckanext/odsh/templates/snippets/search_form.html:72 +msgid " <p class=\"extra\">Please try another search.</p> " +msgstr "" + +#: ckanext/odsh/templates/snippets/search_form.html:78 +msgid "" +" <p id=\"search-error\"><strong>There was an error while searching.</strong> " +"Please try again.</p> " +msgstr "" + diff --git a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo index 8561a979839b1443ebeb124589e688ee641435c1..99420a5d1bf773835f32e7241ce3097dcaf1eb4b 100644 Binary files a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo and b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo differ diff --git a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po index 2e53029bf280fae9aea45214b98c464b2ba6293a..e3aa49ec38d954cef90af6c80e5a406c9e90074e 100644 --- a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po +++ b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: ckanext-odsh 0.0.1\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-09-15 00:23+0000\n" -"PO-Revision-Date: 2018-09-15 00:24+0000\n" +"POT-Creation-Date: 2018-09-28 13:50+0000\n" +"PO-Revision-Date: 2018-09-28 13:50+0000\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language: de\n" "Language-Team: de <LL@li.org>\n" @@ -19,65 +19,23 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.3.4\n" -#: ckanext/odsh/templates/header.html:10 -msgid "Datasets" -msgstr "Daten" - -#: ckanext/odsh/templates/header.html:11 -msgid "Organizations" -msgstr "Herausgeber" - -#: ckanext/odsh/templates/header.html:12 msgid "Groups" -msgstr "" - -#: ckanext/odsh/templates/header.html:13 -msgid "About" -msgstr "" - -#: ckanext/odsh/templates/header.html:14 -msgid "Info" -msgstr "Infos" - -#: ckanext/odsh/templates/snippets/package_item.html:31 -msgid "Private" -msgstr "" - -#: ckanext/odsh/templates/snippets/package_item.html:40 -msgid "Draft" -msgstr "" - -#: ckanext/odsh/templates/snippets/package_item.html:42 -msgid "Deleted" -msgstr "" - -#: ckanext/odsh/templates/snippets/package_item.html:50 -msgid "Popular" -msgstr "" - -#: ckanext/odsh/templates/snippets/package_item.html:57 -msgid "This dataset has no description" -msgstr "" - -#~ msgid "Start" -#~ msgstr "Startseite" - -#~ msgid "Search" -#~ msgstr "Suchbegriff" +msgstr "Kategorien" -#~ msgid "{number} dataset found for \"{query}\"" -#~ msgid_plural "{number} datasets found for \"{query}\"" -#~ msgstr[0] "{number} Ergebnis für \"{query}\"" -#~ msgstr[1] "{number} Ergebnisse für \"{query}\"" +msgid "Title" +msgstr "Titel" -#~ msgid "No datasets found for \"{query}\"" -#~ msgstr "Keine Ergebnisse für \"{query}\"" +msgid "Temporal end" +msgstr "Ende des Zeitraumes" -#~ msgid "{number} dataset found" -#~ msgid_plural "{number} datasets found" -#~ msgstr[0] "{number} Ergebnis" -#~ msgstr[1] "{number} Ergebnisse" +msgid "Temporal start" +msgstr "Beginn des Zeitraumes" -#~ msgid "No datasets found" -#~ msgstr "Keine Ergebnisse" +msgid "odsh_temporal_start_label" +msgstr "Beginn des Zeitraumes" + +msgid "Access constraints" +msgstr "Namensnennung" +msgid "Spatial extension" +msgstr "räumliche Ausdehnung" diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py index 8d3644f2cea4d7d52fd29d935a7fa250bb32c5da..87e0a4efa9aedf7c364c2dee0f51bc17057a754d 100644 --- a/ckanext/odsh/plugin.py +++ b/ckanext/odsh/plugin.py @@ -1,7 +1,10 @@ +import datetime,json import ckan.plugins as plugins import ckan.plugins.toolkit as toolkit from ckan.lib.plugins import DefaultTranslation +from ckan.lib.plugins import DefaultDatasetForm from ckan.common import OrderedDict +import ckan.lib.helpers as helpers _ = toolkit._ @@ -15,12 +18,41 @@ def odsh_main_groups(): return groups -class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation): +def odsh_convert_groups_string(value,context): + if not value: + return [] + if type(value) is not list: + value=[value] + groups=helpers.groups_available() + ret = [] + for v in value: + for g in groups: + if g['id']==v: + ret.append(g) + return ret + + +def odsh_now(): + return helpers.render_datetime(datetime.datetime.now(),"%Y-%m-%d") + +def odsh_group_id_selected(selected, group_id): + if type(selected) is not list: + selected=[selected] + for g in selected: + if (isinstance(g, basestring) and group_id == g) or (type(g) is dict and group_id == g['id']): + return True + + return False + + +class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm): plugins.implements(plugins.IConfigurer) plugins.implements(plugins.ITemplateHelpers) plugins.implements(plugins.IRoutes, inherit=True) plugins.implements(plugins.ITranslation) plugins.implements(plugins.IFacets) + plugins.implements(plugins.IDatasetForm) + plugins.implements(plugins.IValidators) # IConfigurer @@ -33,7 +65,9 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation): # Template helper function names should begin with the name of the # extension they belong to, to avoid clashing with functions from # other extensions. - return {'odsh_main_groups': odsh_main_groups} + return {'odsh_main_groups': odsh_main_groups, + 'odsh_now':odsh_now, + 'odsh_group_id_selected':odsh_group_id_selected} def before_map(self, map): map.connect('info_page', '/info_page', controller='ckanext.odsh.controller:OdshRouteController', action='info_page') @@ -43,4 +77,56 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation): return OrderedDict({'groups': _('Groups')}) def group_facets(self, facets_dict, group_type, package_type): - return facets_dict \ No newline at end of file + return facets_dict + + def _fields(self): + return ['title','notes'] + + def _extraFields(self): + return ['publish_date','access_constraints','temporal_start','temporal_end','spatial_extension'] + + def _update_schema(self,schema): + for field in self._extraFields(): + schema.update({ field: [ + # toolkit.get_converter('not_empty'), + toolkit.get_converter('convert_to_extras')] }) + for field in self._fields(): + schema.update({ field: [toolkit.get_converter('not_empty')] }) + # schema.update({ 'groups': [ + # # toolkit.get_converter('not_empty'), + # toolkit.get_converter('odsh_convert_groups_string')] }) + schema['resources'].update({ + 'url' : [ toolkit.get_converter('not_empty') ] + }) + + def create_package_schema(self): + schema = super(OdshPlugin, self).create_package_schema() + self._update_schema(schema) + return schema + + def update_package_schema(self): + schema = super(OdshPlugin, self).update_package_schema() + self._update_schema(schema) + return schema + + def show_package_schema(self): + schema = super(OdshPlugin, self).show_package_schema() + for field in self._extraFields(): + schema.update({ + field : [toolkit.get_converter('convert_from_extras')] + }) + return schema + + def is_fallback(self): + # Return True to register this plugin as the default handler for + # package types not handled by any other IDatasetForm plugin. + return True + + def package_types(self): + # This plugin doesn't handle any special package types, it just + # registers itself as the default (above). + return [] + + def get_validators(self): + return { 'odsh_convert_groups_string': odsh_convert_groups_string} + \ No newline at end of file diff --git a/ckanext/odsh/templates/package/new_resource.html b/ckanext/odsh/templates/package/new_resource.html new file mode 100644 index 0000000000000000000000000000000000000000..18919d586f085f32a48b35873b08e341f96ad9bc --- /dev/null +++ b/ckanext/odsh/templates/package/new_resource.html @@ -0,0 +1,25 @@ +{% extends "package/base_form_page.html" %} + +{% set logged_in = true if c.userobj else false %} + +{% block subtitle %}{{ _('Add data to the dataset') }}{% endblock %} + +{% block breadcrumb_content_selected %}{% endblock %} +{% block breadcrumb_content %} +{{ super() }} +{% if pkg %} +<li class="active"><a href="#">{{ _('Add New Resource') }}</a></li> +{% endif %} +{% endblock %} + +{% block form %}{% snippet resource_form_snippet, data=data, errors=errors, error_summary=error_summary, +include_metadata=false, pkg_name=pkg_name, stage=stage, allow_upload=g.ofs_impl and logged_in, +dataset_type=dataset_type %}{% endblock %} + +{% block secondary_content %} +{% endblock %} + +{% block scripts %} +{{ super() }} +{% resource 'vendor/fileupload' %} +{% endblock %} \ No newline at end of file diff --git a/ckanext/odsh/templates/package/new_resource_not_draft.html b/ckanext/odsh/templates/package/new_resource_not_draft.html new file mode 100644 index 0000000000000000000000000000000000000000..1a606fe6f042d54d053f88cb89ffb6021a8d1166 --- /dev/null +++ b/ckanext/odsh/templates/package/new_resource_not_draft.html @@ -0,0 +1,21 @@ +{% extends "package/resource_edit_base.html" %} + +{% block subtitle %}{{ _('Add resource') }} - {{ h.dataset_display_name(pkg) }}{% endblock %} +{% block form_title %}{{ _('Add resource') }}{% endblock %} + +{% block breadcrumb_content %} +{{ super() }} +<li class="active"><a href="#">{{ _('Add New Resource') }}</a></li> +{% endblock %} + +{% block form %} +{% snippet resource_form_snippet, data=data, errors=errors, error_summary=error_summary, include_metadata=false, +pkg_name=pkg_name, stage=stage, allow_upload=g.ofs_impl and logged_in, dataset_type=dataset_type %} +{% endblock %} + +{% block content_primary_nav %} +<li class="active"><a href="#"><i class="fa fa-pencil-square-o"></i> {{ _('New resource') }}</a></li> +{% endblock %} + +{% block secondary_content %} +{% endblock %} \ No newline at end of file diff --git a/ckanext/odsh/templates/package/snippets/package_basic_fields.html b/ckanext/odsh/templates/package/snippets/package_basic_fields.html index f50d82ef052f94046ef2e1be33fb02bdfbe5cac9..000ccf9750e45f9a1c6eefb1e47d75cad929e12a 100644 --- a/ckanext/odsh/templates/package/snippets/package_basic_fields.html +++ b/ckanext/odsh/templates/package/snippets/package_basic_fields.html @@ -1,7 +1,10 @@ {% import 'macros/form.html' as form %} +{% resource 'odsh/bootstrap-multiselect.js' %} +{% resource 'odsh/odsh_form.js' %} +<!-- field title --> {% block package_basic_fields_title %} -{{ form.input('title', id='field-title', label=_('Title'), placeholder=_('eg. A descriptive title'), value=data.title, +{{ form.input('title', id='field-title', label=_('Title'), value=data.title, error=errors.title, classes=['control-full', 'control-large'], attrs={'data-module': 'slug-preview-target'}) }} {% endblock %} @@ -12,23 +15,28 @@ error=errors.title, classes=['control-full', 'control-large'], attrs={'data-modu {% set attrs = {'data-module': 'slug-preview-slug', 'data-module-prefix': domain, 'data-module-placeholder': '<dataset>'} %} - {{ form.prepend('name', id='field-name', label=_('URL'), prepend=prefix, placeholder=_('eg. my-dataset'), + <!-- field name --> + {{ form.prepend('name', id='field-name', label=_('URL'), prepend=prefix, value=data.name, error=errors.name, attrs=attrs, is_required=true) }} {% endblock %} - {% block package_basic_fields_custom %}{% endblock %} - + <!-- field notes --> {% block package_basic_fields_description %} - {{ form.markdown('notes', id='field-notes', label=_('Description'), value=data.notes, error=errors.notes) }} + {{ form.markdown('notes', id='field-notes', label=_('Description'), value=data.notes, + error=errors.notes, is_required=true) }} {% endblock %} + <!-- field license --> {% block package_basic_fields_license %} <div class="control-group"> {% set error = errors.license_id %} - <label class="control-label" for="field-license">{{ _("License") }}</label> + <label class="control-label" for="field-license"> + <span title="{{ _("This field is required") }}" class="control-required">*</span> + {{ _("License") }} + </label> <div class="controls"> - <select id="field-license" name="license_id" data-module="autocomplete"> + <select id="field-license" name="license_id"> {% set existing_license_id = data.get('license_id') %} {% for license_id, license_desc in h.license_options(existing_license_id) %} <option value="{{ license_id }}" {% if existing_license_id==license_id %}selected="selected" {% endif @@ -36,27 +44,61 @@ error=errors.title, classes=['control-full', 'control-large'], attrs={'data-modu {% endfor %} </select> {% if error %}<span class="error-block">{{ error }}</span>{% endif %} - <span class="info-block info-inline"> - <i class="fa fa-info-circle"></i> - {% trans %} - License definitions and additional information can be found - at <a href="http://opendefinition.org/licenses/">opendefinition.org</a> - {% endtrans %} - </span> </div> </div> - {% set access_constraints_label='Namensnennung'%} + + <!-- field Namensnennung --> + {% set access_constraints_label='Text für Namensnennung'%} {{ form.input('access_constraints', id='field-licence-name', label=access_constraints_label, - value=data.get('extras').access_constraints, - error=errors.title, classes=['control-full'],type='text') }} + value=data.access_constraints, + error=errors.access_constraints, classes=['control-full'],type='text',is_required=true,attrs={'disabled':true, + 'data-module':"odsh_form", 'data-module-licensetoggle':'true' }) }} {% endblock %} + + <!-- field publish date --> + {% set publish_date_value=h.odsh_now() %} + <!-- if form_style != 'edit' && !%} --> + <!-- value=data.get('extras').publish_date, --> + {% set publish_date_label='Veröffentlichungsdatum'%} + {{ form.input('publish_date', id='field-publish-date', label=publish_date_label, + value=publish_date_value, + error=errors.publish_date, classes=['control-full'],type='date',is_required=true) }} + + <!-- field groups --> + <div class="control-group"> + {% set groups_label='Kategorien'%} + {% set multiselect_nonSelectedText='keine' %} + {% set multiselect_allSelectedText='alle' %} + {% set multiselect_nSelectedText='gewählt' %} + {% set spatial_extension_label='räumliche Ausdehnung'%} + <!-- {% set error = errors.groups %} --> + <label for="field-groups" class="control-label"> + <span title="{{ _("This field is required") }}" class="control-required">*</span> + {{ groups_label }} + </label> + <div class="controls"> + {% set existing_groups = data.get('groups') %} + <select id='field-groups' name="groups" multiple="multiple" data-module="odsh_form" data-module-multiselect='true' + data-module-nonSelectedText="{{multiselect_nonSelectedText}}" data-module-allSelectedText="{{multiselect_allSelectedText}}" + data-module-nSelectedText="{{multiselect_nSelectedText}}"> + {% for option in h.groups_available()%} + <option value={{option.id}} {% if h.odsh_group_id_selected(data.groups,option['id']) %}selected="selected" + {% endif %}> + {{ option['display_name'] }}</option> + {% endfor %} + </select> + <!-- {% if error %}<span class="error-block">{{ error}}</span>{% endif %} --> + </div> + </div> + + <!-- field tags --> {% block package_basic_fields_tags %} {% set tag_attrs = {'data-module': 'autocomplete', 'data-module-tags': '', 'data-module-source': '/api/2/util/tag/autocomplete?incomplete=?'} %} - {{ form.input('tag_string', id='field-tags', label='Schlagwörter', placeholder=_('eg. economy, mental health, - government'), value=data.tag_string, error=errors.tags, classes=['control-full'], attrs=tag_attrs) }} + {{ form.input('tag_string', id='field-tags', label='Schlagwörter', value=data.tag_string, error=errors.tags, + classes=['control-full'], attrs=tag_attrs, + is_required=true) }} {% endblock %} - {% block package_basic_fields_org %} {# if we have a default group then this wants remembering #} {% if data.group_id %} @@ -72,9 +114,6 @@ error=errors.title, classes=['control-full', 'control-large'], attrs={'data-modu dataset_is_draft)) %} {% set existing_org = data.owner_org or data.group_id %} - - - <div class="control-group"> <label for="field-organizations" class="control-label">{{ _('Organization') }}</label> <div class="controls"> @@ -94,6 +133,35 @@ error=errors.title, classes=['control-full', 'control-large'], attrs={'data-modu </div> </div> + <!-- field spatial_extension --> + {{ form.input('spatial_extension', id='field-spatial-extension', label=spatial_extension_label, + value=data.spatial_extension, + error=errors.spatial_extension, classes=['control-full'],type='text',is_required=true) }} + + <!-- field temporal_start --> + {% set temporal_start_label=_('odsh_temporal_start_label') %} + {{ form.input('temporal_start', id='field-temporal-start', label=temporal_start_label, value=data.temporal_start, + error=errors.temporal_start, classes=['control-full'],type='date',is_required=true) }} + + <!-- field temporal_end --> + {% set temporal_end_label='Ende des Zeitraumes' %} + {{ form.input('temporal_end', id='field-temporal-end', label=temporal_end_label, value=data.temporal_end, + error=errors.temporal_end, classes=['control-full'],type='date',is_required=true) }} + + <!-- field private --> + <div class="control-group"> + <label for="field-private" class="control-label">{{ _('Visibility') }}</label> + <div class="controls"> + <select id="field-private" name="private"> + {% for option in [('True', _('Private')), ('False', _('Public'))] %} + <option value="{{ option[0] }}" {% if option[0]==data.private|trim %}selected="selected" {% endif %}>{{ + option[1] }}</option> + {% endfor %} + </select> + </div> + </div> + + {% if data.id and h.check_access('package_delete', {'id': data.id}) and data.state != 'active' %} <div class="control-group"> <label for="field-state" class="control-label">{{ _('State') }}</label> diff --git a/ckanext/odsh/templates/package/snippets/package_metadata_fields.html b/ckanext/odsh/templates/package/snippets/package_metadata_fields.html index 112892ca8dfcdb191f14678ff1e954fba88eb836..ad6eebc85ab4912e17c68a8a1a5e80a8b7a69974 100644 --- a/ckanext/odsh/templates/package/snippets/package_metadata_fields.html +++ b/ckanext/odsh/templates/package/snippets/package_metadata_fields.html @@ -1,45 +1,2 @@ -{% import 'macros/form.html' as form %} -{% resource 'odsh/bootstrap-multiselect.js' %} -{% resource 'odsh/multiselect.js' %} - -{% set temporal_start_label='Beginn des Zeitraumes' %} -{% set temporal_end_label='Ende des Zeitraumes' %} -{% set multiselect_nonSelectedText='keine' %} -{% set multiselect_allSelectedText='alle' %} -{% set multiselect_nSelectedText='gewählt' %} -{% set groups_label='Kategorien'%} - {% block package_metadata_fields %} - -<div class="control-group"> - <label for="field-groups" class="control-label">{{ groups_label }}</label> - <div class="controls"> - <select id="field-groups" name="group_added" multiple="multiple" data-module="odsh_multiselect" - data-module-nonSelectedText="{{multiselect_nonSelectedText}}" data-module-allSelectedText="{{multiselect_allSelectedText}}" - data-module-nSelectedText="{{multiselect_nSelectedText}}"> - {% for option in h.groups_available()%} - <option value="{{ option['id'] }}"> {{ option['display_name'] }}</option> - {% endfor %} - </select> - </div> -</div> - - -{{ form.input('temporal_start', id='field-temporal-start', label=temporal_start_label, value=data.temporal_start, -error=errors.title, classes=['control-full'],type='date') }} -{{ form.input('temporal_end', id='field-temporal-end', label=temporal_end_label, value=data.temporal_end, -error=errors.title, classes=['control-full'],type='date') }} - -<div class="control-group"> - <label for="field-private" class="control-label">{{ _('Visibility') }}</label> - <div class="controls"> - <select id="field-private" name="private"> - {% for option in [('True', _('Private')), ('False', _('Public'))] %} - <option value="{{ option[0] }}" {% if option[0]==data.private|trim %}selected="selected" {% endif %}>{{ - option[1] }}</option> - {% endfor %} - </select> - </div> -</div> - {% endblock %} \ No newline at end of file diff --git a/licenses.json b/licenses.json new file mode 100644 index 0000000000000000000000000000000000000000..54e1227c3646920673c5b17c04096e7a3e7e3b27 --- /dev/null +++ b/licenses.json @@ -0,0 +1,30 @@ +[ + { + "domain_content": true, + "domain_data": true, + "domain_software": false, + "family": "", + "id": "http://dcat-ap.de/def/licenses/dl-by-de/2.0", + "is_generic": true, + "is_okd_compliant": true, + "is_osi_compliant": false, + "maintainer": "", + "status": "active", + "title": "Datenlizenz Deutschland Namensnennung 2.0", + "url": "https://www.govdata.de/dl-de/by-2-0" + }, + { + "domain_content": true, + "domain_data": true, + "domain_software": false, + "family": "", + "id": "http://dcat-ap.de/def/licenses/dl-zero-de/2.0", + "is_generic": true, + "is_okd_compliant": true, + "is_osi_compliant": true, + "maintainer": "", + "status": "active", + "title": "Datenlizenz Deutschland – Zero – Version 2.0", + "url": "https://www.govdata.de/dl-de/zero-2-0" + } +] \ No newline at end of file