예제 #1
0
def sets_view(request):
    assets = {
        "js": [
            {
                "path": "core_oaipmh_provider_app/admin/js/registry/sets/modals/init_select.js",
                "is_raw": False
            },
            {
                "path": "core_oaipmh_provider_app/admin/libs/fSelect/js/fSelect.js",
                "is_raw": False
            },
            AddObjectModalView.get_modal_js_path(),
            EditObjectModalView.get_modal_js_path(),
            DeleteObjectModalView.get_modal_js_path(),
        ],
        "css": [
            "core_oaipmh_provider_app/admin/libs/fSelect/css/fSelect.css",
            "core_oaipmh_provider_app/admin/css/registry/sets/add_set.css"
        ]
    }

    modals = [
        AddObjectModalView.get_modal_html_path(),
        EditObjectModalView.get_modal_html_path(),
        DeleteObjectModalView.get_modal_html_path(),
    ]

    context = {
        'sets': oai_provider_set_api.get_all(order_by_field='set_spec')
    }

    return admin_render(request, "core_oaipmh_provider_app/admin/registry/sets.html", assets=assets,
                        context=context, modals=modals)
예제 #2
0
def metadata_formats_view(request):
    assets = {
        "js": [
            AddObjectModalView.get_modal_js_path(),
            EditObjectModalView.get_modal_js_path(),
            DeleteObjectModalView.get_modal_js_path(),
        ],
        "css": [
            "core_oaipmh_provider_app/admin/css/registry/metadata_formats/page.css"
        ]
    }

    modals = [
        AddObjectModalView.get_modal_html_path(),
        EditObjectModalView.get_modal_html_path(),
        DeleteObjectModalView.get_modal_html_path(),
    ]

    order_field = 'metadata_prefix'
    default_metadata_formats = oai_metadata_format_api.get_all_default_metadata_format(order_by_field=order_field)
    metadata_formats = oai_metadata_format_api.get_all_custom_metadata_format(order_by_field=order_field)
    template_metadata_formats = _get_template_metadata_format(request, order_field=order_field)

    context = {
        'default_metadata_formats': default_metadata_formats,
        'metadata_formats': metadata_formats,
        'template_metadata_formats': template_metadata_formats
    }

    return admin_render(request, "core_oaipmh_provider_app/admin/registry/metadata_formats.html", assets=assets,
                        context=context, modals=modals)
예제 #3
0
def xsl_template_view(request, metadata_format_id):
    assets = {
        "js": [
            AddObjectModalView.get_modal_js_path(),
            EditObjectModalView.get_modal_js_path(),
            DeleteObjectModalView.get_modal_js_path(),
        ],
    }

    modals = [
        AddObjectModalView.get_modal_html_path(),
        EditObjectModalView.get_modal_html_path(),
        DeleteObjectModalView.get_modal_html_path(),
    ]

    metadata_format = oai_metadata_format_api.get_by_id(metadata_format_id)

    context = {
        "xsl_templates": _get_xsl_templates(metadata_format),
        "metadata_format": metadata_format,
    }

    return admin_render(
        request,
        "core_oaipmh_provider_app/admin/registry/xsl_template.html",
        assets=assets,
        context=context,
        modals=modals,
    )
예제 #4
0
def identity_view(request):
    assets = {
        "js": [
            {
                "path":
                "core_oaipmh_provider_app/admin/js/registry/identity/check_registry.js",
                "is_raw": False,
            },
            EditObjectModalView.get_modal_js_path(),
        ],
        "css": [
            "core_oaipmh_provider_app/admin/css/registry/identity/table_info.css"
        ],
    }

    modals = [EditObjectModalView.get_modal_html_path()]

    info = oai_settings_api.get()
    data_provider = {
        "id":
        info.id,
        "name":
        info.repository_name,
        "baseURL":
        request.build_absolute_uri(
            reverse("core_oaipmh_provider_app_server_index")),
        "protocol_version":
        settings.OAI_PROTOCOL_VERSION,
        "admins": (email for name, email in settings.OAI_ADMINS),
        "deleted":
        settings.OAI_DELETED_RECORD,
        "granularity":
        settings.OAI_GRANULARITY,
        "identifier_scheme":
        settings.OAI_SCHEME,
        "repository_identifier":
        info.repository_identifier,
        "identifier_delimiter":
        settings.OAI_DELIMITER,
        "sample_identifier":
        settings.OAI_SAMPLE_IDENTIFIER,
        "enable_harvesting":
        info.enable_harvesting,
    }

    context = {
        "data_provider": data_provider,
        "object_name": info.repository_name
    }

    return admin_render(
        request,
        "core_oaipmh_provider_app/admin/registry/identity.html",
        assets=assets,
        context=context,
        modals=modals,
    )
예제 #5
0
    def get(self, request, *args, **kwargs):
        """Configure templates, Display as list.

        Args:
            request:

        Returns:

        """
        context = {
            "object_name": "Template Configuration",
            "es_template_list": elasticsearch_template_api.get_all(),
        }

        modals = [
            DeleteObjectModalView.get_modal_html_path(),
            AddObjectModalView.get_modal_html_path(),
            EditObjectModalView.get_modal_html_path(),
        ]

        assets = {
            "js": [
                {
                    "path": "core_elasticsearch_app/js/admin/es_template.js",
                    "is_raw": False,
                },
                DeleteObjectModalView.get_modal_js_path(),
                AddObjectModalView.get_modal_js_path(),
                EditObjectModalView.get_modal_js_path(),
            ]
        }

        return admin_render(
            request,
            "core_elasticsearch_app/admin/templates/list_templates.html",
            assets=assets,
            context=context,
            modals=modals,
        )