76 lines
3.7 KiB
HTML
76 lines
3.7 KiB
HTML
{% ckan_extends %}
|
|
|
|
{% block package_basic_fields_org %}
|
|
|
|
{% resource 'privatedatasets/allowed_users.js' %}
|
|
|
|
{# if we have a default group then this wants remembering #}
|
|
{% if data.group_id %}
|
|
<input type="hidden" name="groups__0__id" value="{{ data.group_id }}" />
|
|
{% endif %}
|
|
|
|
{% set dataset_is_draft = data.get('state', 'draft').startswith('draft') or data.get('state', 'none') == 'none' %}
|
|
{% set dataset_has_organization = data.owner_org or data.group_id %}
|
|
{% set organizations_available = h.organizations_available('create_dataset') %}
|
|
{% set user_is_sysadmin = h.check_access('sysadmin') %}
|
|
{% set show_organizations_selector = organizations_available and (user_is_sysadmin or dataset_is_draft) %}
|
|
|
|
{% if show_organizations_selector and show_visibility_selector %}
|
|
<div>
|
|
{% endif %}
|
|
|
|
{% if show_organizations_selector %}
|
|
{% 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">
|
|
<select id="field-organizations" name="owner_org" data-module="autocomplete">
|
|
{% if h.check_config_permission('create_unowned_dataset') %}
|
|
<option value="" {% if not selected_org and data.id %} selected="selected" {% endif %}>{{ _('No organization') }}</option>
|
|
{% endif %}
|
|
{% for organization in organizations_available %}
|
|
{# get out first org from users list only if there is not an existing org #}
|
|
{% set selected_org = (existing_org and existing_org == organization.id) or (not existing_org and not data.id and organization.id == organizations_available[0].id) %}
|
|
<option value="{{ organization.id }}" {% if selected_org %} selected="selected" {% endif %}>{{ organization.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% block package_metadata_fields_visibility %}
|
|
<div class="control-group">
|
|
<label for="field-private" class="control-label">{{ _('Visibility') }}</label>
|
|
<div class="controls">
|
|
<select id="field-private" name="private" data-module="allowed-users">
|
|
{% 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 %}
|
|
|
|
{% if show_organizations_selector and show_visibility_selector %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% set users_attrs = {'data-module': 'autocomplete', 'data-module-tags': '', 'data-module-source': '/api/2/util/user/autocomplete?q=?'} %}
|
|
{{ form.input('allowed_users', label=_('Allowed Users'), id='field-allowed_users', placeholder=_('Allowed Users'), value=data.allowed_users, error=errors.custom_text, classes=['control-full'], attrs=users_attrs) }}
|
|
|
|
{{ form.input('adquire_url', label=_('Adquire URL'), id='field-adquire_url', placeholder=_('http://example.com/adquire/'), value=data.adquire_url, error=errors.custom_text, classes=['control-medium']) }}
|
|
|
|
{% 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>
|
|
<div class="controls">
|
|
<select id="field-state" name="state">
|
|
<option value="active" {% if data.get('state', 'none') == 'active' %} selected="selected" {% endif %}>{{ _('Active') }}</option>
|
|
<option value="deleted" {% if data.get('state', 'none') == 'deleted' %} selected="selected" {% endif %}>{{ _('Deleted') }}</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% endblock %}
|