diff --git a/invenio.cfg b/invenio.cfg index 769cd6a..3d0f5a0 100644 --- a/invenio.cfg +++ b/invenio.cfg @@ -13,6 +13,29 @@ from invenio_i18n import lazy_gettext as _ def _(x): # needed to avoid start time failure with lazy strings return x +# LOM Extension Override +# ===================== +# This code controls whether educational resources are available in the instance. +# It's placed here (not in the package) so each instance can easily enable/disable +# this feature by just changing the config and rebuilding. + +import invenio_records_lom.ext +from invenio_records_lom.ext import InvenioRecordsLOM + +OVERRIDE_SHOW_EDUCATIONAL_RESOURCES = False +"""Set to True to enable educational resources, False to disable them.""" + +class InvenioOverrideLOM(InvenioRecordsLOM): + """Extension that only loads if educational resources are enabled.""" + + def __init__(self, app=None) -> None: + """Only initialize if educational resources are enabled.""" + if app and OVERRIDE_SHOW_EDUCATIONAL_RESOURCES: + super().__init__(app) + +# Replace the original LOM extension with our version +invenio_records_lom.ext.InvenioRecordsLOM = InvenioOverrideLOM + # Flask # ===== # See https://flask.palletsprojects.com/en/1.1.x/config/ @@ -242,7 +265,6 @@ THEME_SHOW_FRONTPAGE_INTRO_SECTION = False # Invenio-Override # -------------- - # # # LOGO # #INVENIO_OVERRIDE_LOGO=images/MUG.svg # OVERRIDE_LOGO = "images/MUG.svg" diff --git a/themes/MUG/invenio.cfg b/themes/MUG/invenio.cfg index 13b32ff..5d86776 100644 --- a/themes/MUG/invenio.cfg +++ b/themes/MUG/invenio.cfg @@ -285,9 +285,6 @@ OVERRIDE_RESOURCE_OVERVIEW = True OVERRIDE_SHOW_PUBLICATIONS_SEARCH = True """Enable or disable the publication global search feature.""" -OVERRIDE_SHOW_EDUCATIONAL_RESOURCES = False -"""Enable or disable the educational resources global search feature.""" - GLOBAL_SEARCH_SCHEMAS = { "rdm": { "schema": "rdm", @@ -300,6 +297,29 @@ GLOBAL_SEARCH_SCHEMAS = { } """Mapping of original schemas for global search.""" +# LOM Extension Override +# ===================== +# This code controls whether educational resources are available in the instance. +# It's placed here (not in the package) so each instance can easily enable/disable +# this feature by just changing the config and rebuilding. + +import invenio_records_lom.ext +from invenio_records_lom.ext import InvenioRecordsLOM + +OVERRIDE_SHOW_EDUCATIONAL_RESOURCES = False +"""Set to True to enable educational resources, False to disable them.""" + +class InvenioOverrideLOM(InvenioRecordsLOM): + """Extension that only loads if educational resources are enabled.""" + + def __init__(self, app=None) -> None: + """Only initialize if educational resources are enabled.""" + if app and OVERRIDE_SHOW_EDUCATIONAL_RESOURCES: + super().__init__(app) + +# Replace the original LOM extension with our version +invenio_records_lom.ext.InvenioRecordsLOM = InvenioOverrideLOM + # ============================================================================ # Invenio-OAuthclient # Keycloak configurations @@ -324,3 +344,5 @@ OAUTHCLIENT_REMOTE_APPS = {"keycloak": _keycloak_helper.remote_app} ## SET THE CREDENTIALS via .env # INVENIO_KEYCLOAK_APP_CREDENTIALS={'consumer_key':'','consumer_secret': ''} + + diff --git a/uv.lock b/uv.lock index 194c10d..e365105 100644 --- a/uv.lock +++ b/uv.lock @@ -1,4 +1,5 @@ version = 1 +revision = 1 requires-python = ">=3.12" [[package]] @@ -340,7 +341,7 @@ name = "click" version = "8.1.8" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "platform_system == 'Windows'" }, + { name = "colorama", marker = "sys_platform == 'win32'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/b9/2e/0090cbf739cee7d23781ad4b89a9894a41538e4fcf4c31dcdd705b78eb8b/click-8.1.8.tar.gz", hash = "sha256:ed53c9d8990d83c2a27deae68e4ee337473f6330c040a31d4225c9574d16096a", size = 226593 } wheels = [ @@ -1211,10 +1212,10 @@ sdist = { url = "https://files.pythonhosted.org/packages/cd/55/09840b5789d7bda97 [[package]] name = "instance" -version = "0.0.0" source = { virtual = "." } dependencies = [ { name = "invenio-app-rdm", extra = ["opensearch2"] }, + { name = "invenio-assets" }, { name = "invenio-logging" }, { name = "invenio-override" }, { name = "uwsgi" }, @@ -1225,6 +1226,7 @@ dependencies = [ [package.metadata] requires-dist = [ { name = "invenio-app-rdm", extras = ["opensearch2"], specifier = "~=12.0.0" }, + { name = "invenio-assets", specifier = ">=3.1.0,<3.2.0" }, { name = "invenio-logging", extras = ["sentry-sdk"], specifier = "~=2.0" }, { name = "invenio-override", git = "https://github.com/sharedRDM/invenio-override?branch=main" }, { name = "uwsgi", specifier = ">=2.0" }, @@ -1767,7 +1769,7 @@ wheels = [ [[package]] name = "invenio-override" version = "0.0.4" -source = { git = "https://github.com/sharedRDM/invenio-override?branch=main#c1757f85ce7a8b1582a49e0cd16c65a59a93b832" } +source = { git = "https://github.com/sharedRDM/invenio-override?branch=main#8a43a69377de421209e14014e2d2bf268588debc" } dependencies = [ { name = "invenio-app-rdm", extra = ["opensearch2"] }, { name = "invenio-assets" }, @@ -2663,7 +2665,7 @@ version = "1.6.1" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "click" }, - { name = "colorama", marker = "platform_system == 'Windows'" }, + { name = "colorama", marker = "sys_platform == 'win32'" }, { name = "ghp-import" }, { name = "jinja2" }, { name = "markdown" }, @@ -3746,7 +3748,7 @@ name = "tqdm" version = "4.67.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "platform_system == 'Windows'" }, + { name = "colorama", marker = "sys_platform == 'win32'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/a8/4b/29b4ef32e036bb34e4ab51796dd745cdba7ed47ad142a9f4a1eb8e0c744d/tqdm-4.67.1.tar.gz", hash = "sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2", size = 169737 } wheels = [ @@ -3875,7 +3877,7 @@ name = "tzlocal" version = "5.3.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "tzdata", marker = "platform_system == 'Windows'" }, + { name = "tzdata", marker = "sys_platform == 'win32'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/8b/2e/c14812d3d4d9cd1773c6be938f89e5735a1f11a9f184ac3639b93cef35d5/tzlocal-5.3.1.tar.gz", hash = "sha256:cceffc7edecefea1f595541dbd6e990cb1ea3d19bf01b2809f362a03dd7921fd", size = 30761 } wheels = [