-
Notifications
You must be signed in to change notification settings - Fork 0
/
invenio.cfg
5766 lines (5598 loc) · 215 KB
/
invenio.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""
InvenioRDM settings for Knowledge Commons Works project.
This file was automatically generated by 'invenio-cli init'.
For the full list of settings and their values, see
https://inveniordm.docs.cern.ch/reference/configuration/.
"""
from datetime import datetime, timedelta
import idutils
from invenio_i18n import lazy_gettext as _
from invenio_oauthclient.views.client import auto_redirect_login
from invenio_app_rdm.config import (
NOTIFICATIONS_BACKENDS,
NOTIFICATIONS_BUILDERS,
)
from invenio_rdm_records.config import (
RDM_RECORDS_IDENTIFIERS_SCHEMES,
RDM_RECORDS_PERSONORG_SCHEMES,
always_valid,
)
from invenio_rdm_records.contrib.imprint import (
IMPRINT_CUSTOM_FIELDS,
# IMPRINT_CUSTOM_FIELDS_UI,
IMPRINT_NAMESPACE,
)
from invenio_rdm_records.contrib.journal import (
JOURNAL_CUSTOM_FIELDS,
JOURNAL_NAMESPACE,
)
from invenio_rdm_records.contrib.thesis import (
THESIS_CUSTOM_FIELDS,
THESIS_CUSTOM_FIELDS_UI,
THESIS_NAMESPACE,
)
from invenio_rdm_records.contrib.meeting import (
MEETING_CUSTOM_FIELDS,
# MEETING_CUSTOM_FIELDS_UI,
MEETING_NAMESPACE,
)
from invenio_rdm_records.contrib.codemeta import (
CODEMETA_CUSTOM_FIELDS,
CODEMETA_NAMESPACE,
# CODEMETA_FACETS,
# CODEMETA_CUSTOM_FIELDS_UI,
)
from invenio_rdm_records.resources.stats.event_builders import (
build_record_unique_id,
)
from invenio_rdm_records.services.pids import providers
from invenio_rdm_records.services.stats import (
permissions_policy_lookup_factory,
)
from invenio_rdm_records.services import facets
from invenio_records_resources.services.custom_fields import TextCF
from invenio_saml.handlers import acs_handler_factory
from invenio_stats.contrib.event_builders import build_file_unique_id
from invenio_stats.processors import EventsIndexer, anonymize_user, flag_robots
from invenio_stats.queries import TermsQuery
from kcworks.api_helpers import (
format_commons_search_payload,
format_commons_search_collection_payload,
record_commons_search_recid,
record_commons_search_collection_recid,
record_publish_url_factory,
choose_record_publish_method,
)
# from invenio_stats.tasks import StatsAggregationTask, StatsEventTask
from kcworks.metadata_fields.kcr_metadata_fields import (
KCR_CUSTOM_FIELDS,
KCR_ADMIN_INFO_SECTION_UI,
KCR_COURSE_SECTION_UI,
KCR_IMPRINT_SECTION_EXTRAS_UI,
KCR_MEETING_SECTION_EXTRAS_UI,
KCR_THESIS_SECTION_EXTRAS_UI,
KCR_JOURNAL_SECTION_EXTRAS_UI,
KCR_CONTENT_WARNING_FIELD_UI,
KCR_PROJECT_SECTION_UI,
KCR_NAMESPACE,
)
from kcworks.metadata_fields.kcr_volumes_fields import (
KCR_VOLUMES_FIELDS,
KCR_VOLUMES_FIELDS_UI,
)
from kcworks.metadata_fields.kcr_media_field import (
KCR_MEDIA_FIELD,
KCR_MEDIA_SECTION_UI,
)
from kcworks.metadata_fields.kcr_notes_fields import (
KCR_NOTES_FIELDS,
KCR_NOTES_SECTION_UI,
)
from kcworks.metadata_fields.kcr_user_tags_fields import (
KCR_USER_TAGS_FIELDS,
KCR_USER_TAGS_SECTION_UI,
)
from kcworks.metadata_fields.hclegacy_metadata_fields import ( # noqa: E501
HCLEGACY_NAMESPACE,
HCLEGACY_CUSTOM_FIELDS,
HCLEGACY_INFO_SECTION_UI,
)
from kcworks.metadata_fields.hclegacy_groups_for_deposit import ( # noqa: E501
HCLEGACY_GROUPS_FOR_DEPOSIT_FIELD,
)
from kcworks.metadata_fields.kcr_ai_field import (
KCR_AI_USAGE_FIELDS,
KCR_AI_USAGE_FIELDS_UI,
)
from kcworks.metadata_fields.imprint_fields import (
KCR_IMPRINT_CUSTOM_FIELDS_UI,
)
from kcworks.metadata_fields.journal_fields import (
KCR_JOURNAL_CUSTOM_FIELDS_UI,
)
from kcworks.metadata_fields.meeting_fields import (
KCR_MEETING_CUSTOM_FIELDS_UI,
)
from kcworks.metadata_fields.codemeta_fields import (
KCR_CODEMETA_CUSTOM_FIELDS_UI,
)
from kcworks.metadata_fields.kcr_series_field import (
KCR_SERIES_FIELDS,
KCR_SERIES_FIELDS_UI,
)
from kcworks.services.accounts.saml import (
knowledgeCommons_account_setup,
knowledgeCommons_account_info,
)
from kcworks.services.notifications.builders import (
CustomCommunityInvitationAcceptNotificationBuilder,
CustomCommunityInvitationCancelNotificationBuilder,
CustomCommunityInvitationDeclineNotificationBuilder,
CustomCommunityInvitationExpireNotificationBuilder,
CustomCommunityInvitationSubmittedNotificationBuilder,
CustomCommunityInclusionAcceptNotificationBuilder,
CustomCommunityInclusionCancelNotificationBuilder,
CustomCommunityInclusionDeclineNotificationBuilder,
CustomCommunityInclusionExpireNotificationBuilder,
CustomCommunityInclusionSubmittedNotificationBuilder,
CustomCommentRequestEventCreateNotificationBuilder,
FirstRecordCreatedNotificationBuilder,
FirstRecordPublishedNotificationBuilder,
)
from kcworks.services.notifications.backends import (
EmailNotificationBackend,
InternalNotificationBackend,
)
from invenio_record_importer_kcworks.services.stats.aggregations import (
StatAggregatorOverridable,
)
from marshmallow import Schema, fields
import os
from pathlib import Path
SITE_UI_URL = os.getenv("INVENIO_SITE_UI_URL", "https://localhost:5000")
SITE_API_URL = os.getenv("INVENIO_SITE_API_URL", "https://localhost:5000/api")
# def _(x): # needed to avoid start time failure with lazy strings
# return x
# Custom fields for deposit metadata
RDM_NAMESPACES = {
**JOURNAL_NAMESPACE,
**IMPRINT_NAMESPACE,
**THESIS_NAMESPACE,
**MEETING_NAMESPACE,
**CODEMETA_NAMESPACE,
**KCR_NAMESPACE,
**HCLEGACY_NAMESPACE,
}
RDM_CUSTOM_FIELDS = [
*JOURNAL_CUSTOM_FIELDS,
*MEETING_CUSTOM_FIELDS,
*IMPRINT_CUSTOM_FIELDS,
*THESIS_CUSTOM_FIELDS,
*CODEMETA_CUSTOM_FIELDS,
*KCR_CUSTOM_FIELDS,
*KCR_VOLUMES_FIELDS,
*KCR_MEDIA_FIELD,
*KCR_NOTES_FIELDS,
*KCR_USER_TAGS_FIELDS,
*HCLEGACY_CUSTOM_FIELDS,
*HCLEGACY_GROUPS_FOR_DEPOSIT_FIELD,
*KCR_AI_USAGE_FIELDS,
*KCR_SERIES_FIELDS,
]
RDM_CUSTOM_FIELDS_UI = [
THESIS_CUSTOM_FIELDS_UI,
{
"section": _("KCR thesis information"),
"hidden": False,
"fields": [
*KCR_THESIS_SECTION_EXTRAS_UI,
],
},
KCR_JOURNAL_CUSTOM_FIELDS_UI,
{
"section": _("KCR journal information"),
"hidden": False,
"fields": [
*KCR_JOURNAL_SECTION_EXTRAS_UI,
],
},
KCR_IMPRINT_CUSTOM_FIELDS_UI,
KCR_SERIES_FIELDS_UI,
{
"section": _("KCR Book information"),
"hidden": False,
"fields": [*KCR_IMPRINT_SECTION_EXTRAS_UI, *KCR_VOLUMES_FIELDS_UI],
},
KCR_MEETING_CUSTOM_FIELDS_UI,
{
"section": _("KCR Conference information"),
"fields": [*KCR_MEETING_SECTION_EXTRAS_UI],
},
{
"section": _("Content warning"),
"fields": [KCR_CONTENT_WARNING_FIELD_UI],
},
KCR_ADMIN_INFO_SECTION_UI,
KCR_MEDIA_SECTION_UI,
KCR_NOTES_SECTION_UI,
KCR_PROJECT_SECTION_UI,
KCR_USER_TAGS_SECTION_UI,
KCR_CODEMETA_CUSTOM_FIELDS_UI,
KCR_AI_USAGE_FIELDS_UI,
HCLEGACY_INFO_SECTION_UI,
KCR_COURSE_SECTION_UI,
]
THEME_SHOW_FRONTPAGE_INTRO_SECTION = False
THEME_SITENAME = "KCWorks"
THEME_TWITTERHANDLE = ""
"""Twitter handle."""
# Flask-SQLAlchemy
# ================
# See https://flask-sqlalchemy.palletsprojects.com/en/2.x/config/
SQLALCHEMY_DATABASE_URI = os.getenv(
"INVENIO_SQLALCHEMY_DATABASE_URI",
"postgresql+psycopg2://kcworks:kcworks@db/kcworks",
)
# Knowledge Commons Links
# ======================
COMMONS_API_REQUEST_PROTOCOL = os.getenv(
"INVENIO_COMMONS_API_REQUEST_PROTOCOL", "http"
)
KC_WORDPRESS_DOMAIN = os.getenv(
"INVENIO_KC_WORDPRESS_DOMAIN", "hcommons-dev.org"
)
KC_HELP_URL = f"https://support.{KC_WORDPRESS_DOMAIN}"
KC_WORKS_HELP_URL = f"{KC_HELP_URL}/kcworks/"
KC_FAQ_URL = f"{KC_HELP_URL}/faqs/#kcworks-faq"
KC_PROFILES_URL_BASE = f"https://{KC_WORDPRESS_DOMAIN}/members/"
KC_REGISTER_URL = f"https://{KC_WORDPRESS_DOMAIN}/membership/"
KC_SEARCH_URL_DOCS = os.getenv(
"INVENIO_KC_SEARCH_URL_DOCS",
f"{COMMONS_API_REQUEST_PROTOCOL}://search."
f"{KC_WORDPRESS_DOMAIN}/v1/documents"
)
FRONTPAGE_GUIDE_LINKS = [
(
_("Discover"),
f"{KC_HELP_URL}/what-is-kcworks/",
"search",
),
(
_("Publish"),
f"{KC_HELP_URL}/how-do-i-upload-to-kcworks/",
"bullhorn",
),
(
_("Collect"),
f"{KC_HELP_URL}/what-is-a-collection/",
"copy outline",
),
(
_("Collaborate"),
f"{KC_HELP_URL}/guides/groups/",
"group",
),
]
# Invenio-S3
# ==========
S3_REGION_NAME = "us-east-1"
S3_ENDPOINT_URL = os.getenv("INVENIO_S3_ENDPOINT_URL", "")
# "hcommons-dev-invenio.s3.amazonaws.com",
RATELIMIT_AUTHENTICATED_USER = "50000 per hour;1000 per minute"
RATELIMIT_GUEST_USER = "10000 per hour;200 per minute"
RATELIMIT_ENABLED = (
True if os.getenv("INVENIO_RATELIMIT_ENABLED") == "True" else False
)
# Deposit form file quota
FILES_REST_DEFAULT_QUOTA_SIZE = (10**10) * 50 # 500 GB
APP_RDM_DEPOSIT_FORM_QUOTA = {
"maxFiles": 100,
"maxStorage": (10**10) * 50, # 500 GB
}
# Flask
# =====
# See https://flask.palletsprojects.com/en/1.1.x/config/
# Define the value of the cache control header `max-age` returned by the
# server when serving public files. Files will be cached by the browser
# for the provided number of seconds.
# See flask documentation for more information:
# https://flask.palletsprojects.com/en/2.1.x/config/#SEND_FILE_MAX_AGE_DEFAULT
SEND_FILE_MAX_AGE_DEFAULT = 300
# SECURITY WARNING: keep the secret key used in production secret!
# Do not commit it to a source code repository.
# ** Stored in .env **
# SECRET_KEY = "CHANGE_ME"
# Since HAProxy and Nginx route all requests no matter the host header
# provided, the allowed hosts variable is set to localhost. In production it
# should be set to the correct host and it is strongly recommended to only
# route correct hosts to the application.
APP_ALLOWED_HOSTS = os.getenv(
"KCWORKS_ALLOWED_HOSTS",
"localhost,127.0.0.1",
# [
# "0.0.0.0",
# "localhost",
# "127.0.0.1",
# "10.98.11.159", # staging
# "10.98.11.40", # old?
# "192.168.0.16", # Ian's dev machine internal
# "host.docker.internal",
# "search-invenio-staging-public-awhkkfpwnonipcmpncr6ywgtii.us-east-1.es.amazonaws.com",
# "44.213.25.141", # os at aws
# "3.220.148.227", # os at aws
# "invenio-dev.hcommons-staging.org",
# "18.210.54.2", # SSL load balancer
# "search-kcworks-prod-search-public-455oceeitszcrekmaadbjgh3gi."
# "us-east-1.es.amazonaws.com", # prod
# "works.hcommons.org" # prod
# ],
).split(",")
#
# Invenio-Search
# --------------
SEARCH_DOMAIN = os.getenv("INVENIO_SEARCH_DOMAIN", "search:9200")
# "search-invenio-staging-public-awhkkfpwnonipcmpncr6ywgtii.us-east-1.es.amazonaws.com",
SEARCH_INDEX_PREFIX = "kcworks-"
# SEARCH_HOSTS = [{"host": os.environ["SEARCH_HOST_DOMAIN"], "port": 9200}]
# SEARCH_HOST_DOMAIN = os.environ["SEARCH_HOST_DOMAIN"]
# SEARCH_CLIENT_PASSWORD = os.environ["SEARCH_CLIENT_PASSWORD"]
# SEARCH_CLIENT_CONFIG = {
# "hosts": [{"host": SEARCH_HOST_DOMAIN, "port": 9200}],
# "http_compress": True,
# "http_auth": ('kcworks', SEARCH_CLIENT_PASSWORD),
# "use_ssl": False,
# "verify_certs": False,
# "ssl_assert_hostname": False,
# "ssl_show_warn": False,
# }
# Invenio-App
# ===========
# See https://invenio-app.readthedocs.io/en/latest/configuration.html
# APP_RDM_ROUTES = {
# "index": "/",
# "robots": "/robots.txt",
# "help_search": "/help/search",
# "help_statistics": "/help/statistics",
# "record_search": "/search",
# "record_detail": "/records/<pid_value>",
# "record_export": "/records/<pid_value>/export/<export_format>",
# "record_file_preview": "/records/<pid_value>/preview/<path:filename>",
# "record_file_download": "/records/<pid_value>/files/<path:filename>",
# "record_from_pid": "/<any({schemes}):pid_scheme>/<path:pid_value>",
# "record_latest": "/records/<pid_value>/latest",
# "dashboard_home": "/me",
# "deposit_create": "/uploads/new",
# "deposit_edit": "/uploads/<pid_value>",
# }
APP_DEFAULT_SECURE_HEADERS = {
"content_security_policy": {
"default-src": [
"'self'",
"'unsafe-inline'", # for inline scripts and styles
"fonts.googleapis.com",
"https://khan.github.io/tota11y/dist/tota11y.min.js",
"blob:", # for pdf preview
S3_ENDPOINT_URL.replace("https://", ""),
SEARCH_DOMAIN.replace("https://", ""),
KC_WORDPRESS_DOMAIN,
f"*.{KC_WORDPRESS_DOMAIN}",
*APP_ALLOWED_HOSTS,
"https://s3.amazonaws.com/knowledge-commons-works/",
"https://www.google-analytics.com/g/",
],
"img-src": [
"'self'",
"data:", # for images
"blob:",
S3_ENDPOINT_URL.replace("https://", ""),
SEARCH_DOMAIN.replace("https://", ""),
KC_WORDPRESS_DOMAIN,
f"*.{KC_WORDPRESS_DOMAIN}",
*APP_ALLOWED_HOSTS,
"https://s3.amazonaws.com/knowledge-commons-works/",
],
"script-src-elem": [
"'self'",
KC_WORDPRESS_DOMAIN,
f"*.{KC_WORDPRESS_DOMAIN}",
*APP_ALLOWED_HOSTS,
"www.googletagmanager.com", # for google analytics tag
"'unsafe-inline'", # for inline scripts
],
"font-src": ["'self'", "data:", "fonts.gstatic.com"], # for fonts
},
"content_security_policy_report_only": False,
"content_security_policy_report_uri": None,
"force_file_save": False,
"force_https": False, # was True by default, but behind load balancer
"force_https_permanent": False,
"frame_options": "sameorigin",
"frame_options_allow_from": None,
"session_cookie_http_only": True,
"session_cookie_secure": True,
# FIXME: change for production? but behind load balancer
"strict_transport_security": False, # TODO: was True by default
"strict_transport_security_include_subdomains": (
False
), # TODO: was True by default
# 'strict_transport_security_max_age': 31556926, # One year in seconds
# 'strict_transport_security_preload': False,
}
# Flask-Babel
# ===========
# See https://python-babel.github.io/flask-babel/#configuration
# Default locale (language)
BABEL_DEFAULT_LOCALE = "en"
# Default time zone
BABEL_DEFAULT_TIMEZONE = "America/Detroit"
# Invenio-I18N
# ============
# See https://invenio-i18n.readthedocs.io/en/latest/configuration.html
# Other supported languages (do not include BABEL_DEFAULT_LOCALE in list).
I18N_LANGUAGES = [
# ('de', _('German')),
# ('tr', _('Turkish')),
]
# Invenio-Theme
# =============
# See https://invenio-theme.readthedocs.io/en/latest/configuration.html
# Google analytics
THEME_TRACKINGCODE_TEMPLATE = "invenio_theme/trackingcode.html"
# Frontpage title
THEME_FRONTPAGE_TITLE = "Knowledge Commons Works"
THEME_FRONTPAGE_SUBTITLE = "discover, publish, collect, collaborate"
THEME_SHORT_TITLE = "KC Works"
# Header logo
THEME_LOGO = "images/kc_works_logos/SVG/KC_Works_logo_Logo.svg"
THEME_HERO_LOGO = "images/kc_works_logos/SVG/kc_works_logo_wordmark.svg"
THEME_SEARCHBAR = False
# Search configuration
RDM_FACETS = {
"is_published": {
"facet": facets.is_published,
"ui": {
"field": "is_published",
},
},
"resource_type": {
"facet": facets.resource_type,
"ui": {
"field": "resource_type.type",
"childAgg": {
"field": "resource_type.subtype",
},
},
},
"file_type": {
"facet": facets.filetype,
"ui": {
"field": "files.types",
},
},
"language": {
"facet": facets.language,
"ui": {
"field": "languages",
},
},
"access_status": {
"facet": facets.access_status,
"ui": {
"field": "access.status",
},
},
"subject_nested": {
"facet": facets.subject_nested,
"ui": {
"field": "subjects.scheme",
"childAgg": {
"field": "subjects.subject",
},
},
},
"subject": {
"facet": facets.subject,
"ui": {
"field": "subjects.subject",
},
},
}
RDM_SORT_OPTIONS = {
"bestmatch": dict(
title=_("Best match"),
fields=["_score"], # search defaults to desc on `_score` field
),
"newest": dict(
title=_("Newest"),
fields=["-created"],
),
"oldest": dict(
title=_("Oldest"),
fields=["created"],
),
"published-desc": dict(
title=_("Most recently published"),
fields=["-metadata.publication_date"],
),
"published-asc": dict(
title=_("Earliest published"),
fields=["metadata.publication_date"],
),
"version": dict(
title=_("Version"),
fields=["-versions.index"],
),
"updated-desc": dict(
title=_("Recently updated"),
fields=["-updated"],
),
"updated-asc": dict(
title=_("Least recently updated"),
fields=["updated"],
),
"mostviewed": dict(
title=_("Most viewed"), fields=["-stats.all_versions.unique_views"]
),
"mostdownloaded": dict(
title=_("Most downloaded"), fields=["-stats.all_versions.unique_downloads"]
),
}
RDM_SEARCH = {
"facets": ["resource_type", "language", "file_type", "access_status"],
"sort": [
"bestmatch",
"newest",
"oldest",
"published-desc",
"published-asc",
"version",
"mostviewed",
"mostdownloaded",
],
}
RDM_SEARCH_USER_COMMUNITIES = {
"facets": ["visibility", "type"],
"sort": ["bestmatch", "newest", "oldest"],
"sort_default": "bestmatch",
"sort_default_no_query": "newest",
}
"""User communities search configuration (i.e list of user communities)
This affects the community search modal in the detail page.
"""
COMMUNITIES_SEARCH = {
"facets": ["type", "visibility"],
"sort": ["bestmatch", "newest", "oldest"],
"sort_default": "bestmatch",
"sort_default_no_query": "newest",
}
"""Community search configuration (i.e list of communities)
This affects the community search modal in the upload form.
"""
# Invenio-App-RDM
# ===============
# See https://invenio-app-rdm.readthedocs.io/en/latest/configuration.html
# Instance's theme entrypoint file. Path relative to the ``assets/`` folder.
INSTANCE_THEME_FILE = "./less/theme.less"
APP_RDM_RECORD_LANDING_PAGE_TEMPLATE = (
"invenio_modular_detail_page/detail.html"
)
KC_FOOTER_LINKS = [
(
"_blank",
[
[_("Help & FAQ"), f"{KC_HELP_URL}"],
[
_("Terms of use"),
f"https://sustaining.{KC_WORDPRESS_DOMAIN}/policies/terms/",
],
[_("Privacy policy"), f"https://about.{KC_WORDPRESS_DOMAIN}/privacy-statement/"],
[
_("Guidelines for use"),
f"https://{KC_WORDPRESS_DOMAIN}/guidelines/",
],
[_("Mesh Research"), "https://meshresearch.net"],
],
("eight", "four", "four"),
),
(
"_blank",
[
[_("Knowledge Commons"), f"https://{KC_WORDPRESS_DOMAIN}/"],
[
_("LinkedIn"),
"https://www.linkedin.com/company/knowledge-commons",
"linkedin",
],
[
_("hcommons.social"),
"https://hcommons.social",
"mastodon",
],
[
_("Newsletter"),
(
"https://hcommons.us9.list-manage.com/subscribe"
"?u=db7b80b27372be53e3cc37dfb&id=ab124b16b0"
),
"bullhorn",
],
[
_("Supporters"),
(
f"https://about.{KC_WORDPRESS_DOMAIN}/about-us"
f"/funding/"
),
],
],
("eight", "four", "four"),
),
(
"_blank",
[
[_("Michigan State University"), "https://msu.edu", "MSU.svg"],
[
_("National Science Foundation"),
"https://nsf.gov",
"USNSF_Logo_Lockup_stacked_RGB_reversed.svg",
],
[
_("National Endowment for the Humanities"),
"https://neh.gov",
"NEH-Preferred-Seal-Transparent.svg",
],
],
("sixteen", "eight", "eight"),
),
]
# top-level objects are sections in sidebar
MODULAR_DETAIL_PAGE_SIDEBAR_SECTIONS_RIGHT = [
{"section": _("Manage")},
{
"section": _("Download"),
"component_name": "SidebarDownloadSection",
"props": [
"defaultPreviewFile",
"downloadFileUrl",
"files",
"fileTabIndex",
"hasFiles",
"isPreview",
"permissions",
"previewFileUrl",
"record",
"sectionIndex",
"setActivePreviewFile",
"setActiveTab",
"tabbedSections",
"totalFileSize",
],
"show": "computer large-monitor widescreen only",
},
{
"section": _("Collections"),
"component_name": "CommunitiesBanner",
"props": [
"additionalCommunities",
"canManageRecord",
"community",
"isPreviewSubmissionRequest",
"permissions",
"record",
"recordCommunityEndpoint",
"recordCommunitySearchConfig",
"recordUserCommunitySearchConfig",
"searchConfig",
"userCommunitiesMemberships",
],
"show": "computer large-monitor widescreen only",
},
{
"section": _("Content Warning"),
"component_name": "ContentWarning",
"props": ["record"],
},
{
"section": _("AI Use"),
"component_name": "AIUsageAlert",
"props": ["record"],
},
{
"section": _("Versions"),
"component_name": "VersionsDropdownSection",
"props": ["isPreview", "record"],
"show_heading": False,
},
{
"section": _("Keywords & Subjects"),
"component_name": "SidebarSubjectsSection",
"props": ["record"],
"show": "computer large-monitor widescreen only",
},
{
"section": _("Cite this"),
"component_name": "CitationSection",
"props": ["record", "citationStyles", "citationStyleDefault"],
"show": "computer large-monitor widescreen only",
},
{
"section": _("Details"),
"component_name": "SidebarDetailsSection",
"props": [
"customFieldsUi",
"doiBadgeUrl",
"identifierSchemes",
"landingUrls",
"record",
],
"subsections": [
# {"section": "Resource type"},
{"section": "Published in"},
{"section": "Imprint"},
{"section": "Awarding university"},
{"section": "Conference"},
{"section": "Conference organization"},
{"section": "Publisher"},
{"section": "Publication date"},
{"section": "Languages"},
{"section": "Formats"},
{"section": "Sizes"},
{"section": "Duration"},
{"section": "DOI"},
],
"show_heading": False,
"show": "computer large-monitor widescreen only",
},
{
"section": _("Licenses"),
"component_name": "SidebarRightsSection",
"props": ["rights"],
"show": "tablet computer only",
},
{
"section": _("Export"),
"component_name": "SidebarExportSection",
"props": [
"community",
"isPreview",
"recordExporters",
"record",
],
"show": "computer large-monitor widescreen only",
},
{
"section": _("Share"),
"component_name": "SidebarSharingSection",
"props": [
"community",
"record",
"isPreview",
"isPreviewSubmissionRequest",
],
"show": "computer large-monitor widescreen only",
},
]
MODULAR_DETAIL_PAGE_SIDEBAR_SECTIONS_LEFT = []
# top-level objects are tabs in main detail page column
MODULAR_DETAIL_PAGE_MAIN_SECTIONS = [
{
"section": _("Title"),
"component_name": "RecordTitle",
"props": ["title", "isPreviewSubmissionRequest"],
},
{
"section": _("Creators and Contributors"),
"component_name": "CreatibutorsShortList",
"props": [
"creators",
"contributors",
"iconsRor",
"iconsOrcid",
"iconsGnd",
"iconsKcUsername",
"iconsIsni",
"landingUrls",
"isPreviewSubmissionRequest",
],
},
{
"section": "Tabs",
"component_name": "DetailMainTabs",
"subsections": [
{
"section": _("Content"),
"component_name": "DetailMainTab",
"subsections": [
{
"section": _("Descriptions"),
"component_name": "Descriptions",
"props": [
"description",
"additionalDescriptions",
"hasFiles",
"permissions",
],
},
{
"section": _("Preview"),
"component_name": "FilePreviewWrapper",
"props": [
"activePreviewFile",
"defaultPreviewFile",
"files",
"isPreview",
"hasFiles",
"hasPreviewableFiles",
"permissions",
"previewableExtensions",
"previewFile",
"previewFileUrl",
"record",
"setActivePreviewFile",
"totalFileSize",
],
},
],
"tab": True,
"props": [],
},
{
"section": _("Details"),
"component_name": "DetailMainTab",
"subsections": [
{
"section": _("Publication"),
"component_name": "PublishingDetails",
"props": [
"customFieldsUi",
"doiBadgeUrl",
"hasFiles",
"iconsKcUsername",
"iconsIsni",
"iconsGnd",
"iconsOrcid",
"iconsRor",
"identifierSchemes",
"landingUrls",
"localizedStats",
"record",
"showDecimalSizes",
],
"subsections": [
{
"section": _("Contributors"),
"subsections": [
{"section": "Contributors"},
],
"show": "mobile only",
},
{
"section": _("Publication"),
"subsections": [
{"section": "URLs"},
{"section": "Version"},
{"section": "Edition"},
{"section": "Additional titles"},
{"section": "Course title"},
{"section": "Chapter label"},
{"section": "Development status"},
{"section": "Source code repository"},
{"section": "Published in"},
{"section": "Imprint"},
{"section": "Publisher"},
{"section": "Degree"},
{"section": "Awarding university"},
{"section": "Department"},
{"section": "Conference"},
{"section": "Conference organization"},
{"section": "Languages"},
{"section": "Publication date"},
{"section": "Additional dates"},
{"section": "Media and materials"},
{"section": "Formats"},
{"section": "Sizes"},
{"section": "Series"},
{"section": "Volumes"},
],
},
{
"section": _("Technical specifications"),
"subsections": [
{"section": "Operating systems supported"},
{"section": "Frameworks or runtimes"},
{"section": "Programming languages"},
],
},
{
"section": _("Project details"),
"subsections": [
{"section": "Project title"},
{
"section": (
"Project or publication website"
)
},
{"section": "Sponsoring institution"},
],
},
{
"section": _("Additional titles"),
"subsections": [
{"section": "Additional titles"},
],
},
{
"section": _("Funding"),
"subsections": [{"section": "Funding"}],
},
{
"section": _("Identifiers"),
"subsections": [
{"section": "DOI"},
{"section": "Alternate identifiers"},
],
},
{
"section": _("Related"),
"subsections": [
{"section": "Related identifiers"},
],
},
{
"section": _("References"),