{% extends "actor_registry/base.html" %} {#- Migrate to Actor Registry, step 1: contact points. Find -> Review -> Link. See contact_migration.py for the rules. Plain forms; JavaScript only makes the long lists easier (migrate-select.js). -#} {% block subtitle %}{{ _('Migrate to Actor Registry') }}{% endblock %} {% block breadcrumb_content %}
  • {{ _('Migrate to Actor Registry') }}
  • {% endblock %} {% block primary_content_inner %} {#- Where the contact details come from: ckanext-dcat's free-text contact point, Maintainer or Author (contact_migration.contact_source). -#} {% macro source_label(item) %}{% if item.source == 'contact' %}{{ _('Contact point (free text)') }}{% elif item.source == 'maintainer' %}{{ _('Maintainer') }}{% else %}{{ _('Author') }}{% endif %}{% endmacro %} {% macro source_from(item) %}{% if item.source == 'contact' %}{{ _('from Contact point (free text)') }}{% elif item.source == 'maintainer' %}{{ _('from Maintainer') }}{% else %}{{ _('from Author') }}{% endif %}{% endmacro %} {% macro also_label(item) %}{% if item.source == 'contact' %}{{ _('Also mentioned:') }}{% else %}{{ _('Author also mentioned:') }}{% endif %}{% endmacro %} {% macro dataset_label(item) %}{{ item.title }} {% if item.organization %}· {{ item.organization }}{% endif %} {% if item.private %}{{ _('Private') }}{% endif %} · {{ source_from(item) }}: {{ item.name or '–' }}{% if item.raw_email %} <{{ item.raw_email }}>{% endif %} {% if item.also %}
    {{ also_label(item) }} {{ item.also.name or '–' }}{% if item.also.email %} <{{ item.also.email }}>{% endif %}{% endif %}{% endmacro %} {% asset 'actor_registry/migrate-select' %} {# The datasets of a group as a table (the same for a small and a large group): one box in the heading for all or none, headings that sort the rows. named: the boxes are posted as dataset_ids (a small group, works without JavaScript); not named: a large group, where JavaScript posts the ones that are left out. #} {% macro dataset_table(candidate, number, named) %}
    {% for key, label in [('title', _('Dataset')), ('org', _('Organization')), ('source', _('Source')), ('name', _('Name')), ('email', _('Email'))] %} {% endfor %} {% for item in candidate.datasets %} {% endfor %}
    {{ item.title }}{% if item.private %} {{ _('Private') }}{% endif %} {{ item.organization or '–' }} {{ source_label(item) }} {{ item.name or '–' }}{% if item.also %}
    {{ also_label(item) }} {{ item.also.name or '–' }}{% if item.also.email %} <{{ item.also.email }}>{% endif %}{% endif %}
    {{ item.raw_email or '–' }}
    {% endmacro %}

    {{ _('Migrate to Actor Registry') }}

    {{ _("Contact details are often stored as free text in CKAN's own fields, Maintainer and Author, and repeated on many datasets. Here you turn them into shared contact points and link the datasets to them. Maintainer is used first, and Author only when a dataset has no maintainer.") }} {{ _("A contact point typed as free text in ckanext-dcat's contact points field is used before both, as in ckanext-dcat's export.") }}

    {{ _('The original fields are never changed. A dataset that has a contact point is done and is no longer listed. You only see the datasets you may edit.') }}

    {% if closed %}
    {{ _('Migration closed.') }} {{ _('The old contact fields are hidden and no longer exported. Their values are still stored.') }}
    {% else %}
    {{ _('Migration in progress.') }} {{ _('The old contact fields are still shown and used in the DCAT export for datasets without a contact point.') }}
    {% endif %} {% if not data.types %}
    {{ _('None of the dataset schemas has a contact points field (contact_point_ids). Add it to your schema before you migrate.') }}
    {% else %} {% set counts = data.counts %}

    {{ _('Overview') }}

    {{ _('Datasets with contact details in free-text fields') }}{{ counts.old }}
    {{ _('of which linked to a contact point') }}{{ counts.linked }}
    {{ _('of which changed since linking') }}{% if counts.changed %}{{ counts.changed }}{% else %}0{% endif %}
    {{ _('of which skipped') }}{{ counts.skipped }}{% if counts.skipped %} · {{ _('Show') }}{% endif %}
    {{ _('of which remaining') }}{{ counts.remaining }}
    {{ _('Datasets with no contact details at all') }}{{ counts.no_contact }}{% if counts.no_contact %} · {{ _('Add contact points') }}{% endif %}
    {% if data.changed %}

    {{ _('Changed since linking') }}

    {{ _('The free-text contact details have changed on these datasets after they were linked. Decide whether the contact point should follow the change.') }}

    {% for item in data.changed %} {% set contact = item.contact_point %} {% set can_update = contact and contact.active and item.contact_point_in_dataset %}

    {{ item.title }}{% if item.organization %} · {{ item.organization }}{% endif %}

    {% for field, label in [('maintainer', _('Maintainer')), ('maintainer_email', _('Maintainer email')), ('author', _('Author')), ('author_email', _('Author email')), ('contact', _('Contact point (free text)'))] %} {% set before = item.previous[field] if item.previous else none %} {% set now = item['values'][field] %} {% if before is none or before != now %} {% endif %} {% endfor %}
    {{ _('Linked to') }}{% if contact %}{{ contact.name }}{% if contact.email %} <{{ contact.email }}>{% endif %}{% if not contact.active %} {{ _('Inactive') }}{% endif %}{% if not item.contact_point_in_dataset %} {{ _('no longer on the dataset') }}{% endif %}{% else %}–{% endif %}
    {{ label }}{% if item.previous %}{{ before or '–' }} → {% endif %}{{ now or '–' }}
    {{ h.csrf_input() }}

    {{ _('Details for an updated or new contact point, taken from the new values:') }}

    {% if can_update %}
    {% endif %}
    {% endfor %}
    {% endif %}

    {{ _('Contact details to migrate') }}

    {% if not candidates %}

    {{ _('Nothing remains to migrate.') }}

    {% endif %} {% for candidate in candidates %} {% set number = first_number + loop.index0 %} {% set default_action = 'existing' if candidate.matches else 'create' %}

    {{ candidate.suggested_name }}{% if candidate.email and candidate.email != candidate.suggested_name %} {{ candidate.email }}{% endif %}

    {% trans count=candidate.datasets|length %}{{ count }} dataset{% pluralize %}{{ count }} datasets{% endtrans %}

    {% if candidate.variants|length > 1 %}

    {{ _('Names used:') }} {% for variant, count in candidate.variants %}{{ variant }} ({{ count }}){% if not loop.last %}, {% endif %}{% endfor %}

    {% endif %} {% if candidate.invalid_emails %}

    {{ _('Not a valid email address:') }} {{ candidate.invalid_emails|join(', ') }}. {{ _('Enter a correct address, or leave the field empty.') }}

    {% endif %}
    {{ h.csrf_input() }} {% set is_large = candidate.datasets|length > large_group %}
    {{ _('Datasets') }} {% if is_large %} {# A large group: all its datasets are included; only the ones to leave out are posted. #}

    {% trans count=candidate.datasets|length %}All {{ count }} datasets are included.{% endtrans %}

    {# Without JavaScript: boxes that leave datasets out (posted as exclude_ids). With it (migrate-select.js): the same list the other way round, ticked = included, and buttons for all/none; the unticked ones are posted as exclude_ids on submit. #}
    {% trans count=candidate.datasets|length %}Show all {{ count }} datasets, and leave some out{% endtrans %}
    {% for item in candidate.datasets %}
    {% endfor %}
    {# With JavaScript: a table (one box in the header for all or none, and headings that sort the rows). Ticked = included. #} {{ dataset_table(candidate, number, false) }}

    {{ _('Tick the datasets that belong to another contact point; they stay in the list for a later round. The same email address may be used by several contact points.') }}

    {% else %} {{ dataset_table(candidate, number, true) }}

    {{ _('Clear the datasets that belong to another contact point; they stay in the list for a later round. The same email address may be used by several contact points.') }}

    {% endif %}
    {{ _('What to do with the selected datasets') }}
    {% for variant, count in candidate.variants %}

    {{ _('Prefer the name of a function, such as "GIS Support", over a person.') }}

    {# With JavaScript the button says how many datasets it will act on (migrate-select.js); without, its text is the fixed one. #}
    {% endfor %} {% if pager.item_count > pager.items_per_page %}{{ pager.pager() }}{% endif %} {% if data.skipped %}

    {{ _('Skipped') }}

    {% if show_skipped %} {% for item in data.skipped %} {% endfor %}
    {{ item.title }} {{ item.name or '–' }}{% if item.raw_email %} <{{ item.raw_email }}>{% endif %}
    {{ h.csrf_input() }}
    {% else %}

    {% trans count=data.skipped|length %}Show {{ count }} skipped dataset{% pluralize %}Show {{ count }} skipped datasets{% endtrans %}

    {% endif %}
    {% endif %} {% if close_check %}
    {% if closed %}

    {{ _('Reopen the migration') }}

    {{ _('Shows the old contact fields again and uses them in the export for datasets without a contact point.') }}

    {{ h.csrf_input() }}
    {% else %}

    {{ _('Close the migration') }}

    {{ _("Closing hides the old contact fields (Maintainer, Author and ckanext-dcat's free-text contact point) in forms and on dataset pages, for everyone including sysadmins, and stops exporting them. Nothing is deleted: the values stay stored and are kept when a dataset is saved, and you can reopen the migration at any time. It takes effect at once, without a restart.") }}

    {{ _("Hiding works for fields that use the extension's snippets for old fields: legacy_contact.html for Maintainer and Author, legacy_dcat_contact.html for ckanext-dcat's contact point (added by ckan actor-registry schema). Other fields are not affected.") }}

    {{ h.csrf_input() }} {% if close_check.needs_confirmation %}
      {% if close_check.no_contact_point %}
    • {% trans count=close_check.no_contact_point %}{{ count }} dataset will have no contact point in the export. A contact point is required in DCAT-AP.{% pluralize %}{{ count }} datasets will have no contact point in the export. A contact point is required in DCAT-AP.{% endtrans %}
    • {% endif %} {% if close_check.changed %}
    • {% trans count=close_check.changed %}{{ count }} linked dataset has unhandled changes.{% pluralize %}{{ count }} linked datasets have unhandled changes.{% endtrans %}
    • {% endif %}
    {% endif %}
    {% endif %}
    {% endif %} {% endif %} {% endblock %} {% block secondary_content %}

    {{ _('How it works') }}

    1. {{ _('Find: contact details are grouped by email address, or by name when there is no valid address.') }}
    2. {{ _('Review: create a contact point, link to an existing one, or skip. Clear datasets that belong elsewhere.') }}
    3. {{ _('Link: the selected datasets get the contact point. You can work in rounds.') }}
    {% endblock %}