diff --git a/composer.json b/composer.json
index 04490351..f737efd6 100644
--- a/composer.json
+++ b/composer.json
@@ -79,6 +79,7 @@
"unocha/gtm_barebones": "^1.0",
"unocha/ocha_key_figures": "^2.0",
"unocha/ocha_monitoring": "^1.0",
+ "unocha/ocha_reliefweb": "dev-develop",
"unocha/ocha_search": "^1.0",
"unocha/un_date": "^2.0",
"webflo/drupal-finder": "^1.2.2"
diff --git a/composer.lock b/composer.lock
index a9fb7434..8c4770b0 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "f2af9523885580b0564f8d4520cad3ec",
+ "content-hash": "ba68dfb88cee96bdf18cfe0d0fc51992",
"packages": [
{
"name": "asm89/stack-cors",
@@ -2323,7 +2323,7 @@
"shasum": "6a66e40a4249351a89afba529910e1e5e2f667aa"
},
"require": {
- "drupal/core": "^9.1 || ^10"
+ "drupal/core": "^10"
},
"type": "drupal-module",
"extra": {
@@ -3998,7 +3998,7 @@
"shasum": "6139e7d5d5d5dd28bf51b15118c8c84d6ff91614"
},
"require": {
- "drupal/core": "^9 || ^10"
+ "drupal/core": "^10"
},
"type": "drupal-module",
"extra": {
@@ -4050,7 +4050,7 @@
"shasum": "cc7cd2f029137e99a99deb90aee83b8bbf01c0d4"
},
"require": {
- "drupal/core": "^8 || ^9 || ^10",
+ "drupal/core": "^10",
"drupal/imageapi_optimize": "*"
},
"type": "drupal-module",
@@ -4502,7 +4502,7 @@
"shasum": "fc8ea60619b6b4682bade340e13fb4565d3a7e0c"
},
"require": {
- "drupal/core": "^9.1 || ^10"
+ "drupal/core": "^10"
},
"type": "drupal-module",
"extra": {
@@ -8646,6 +8646,131 @@
},
"time": "2024-04-09T23:31:35+00:00"
},
+ {
+ "name": "opis/string",
+ "version": "2.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/opis/string.git",
+ "reference": "9ebf1a1f873f502f6859d11210b25a4bf5d141e7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/opis/string/zipball/9ebf1a1f873f502f6859d11210b25a4bf5d141e7",
+ "reference": "9ebf1a1f873f502f6859d11210b25a4bf5d141e7",
+ "shasum": ""
+ },
+ "require": {
+ "ext-iconv": "*",
+ "ext-json": "*",
+ "php": "^7.4 || ^8.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Opis\\String\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "Marius Sarca",
+ "email": "marius.sarca@gmail.com"
+ },
+ {
+ "name": "Sorin Sarca",
+ "email": "sarca_sorin@hotmail.com"
+ }
+ ],
+ "description": "Multibyte strings as objects",
+ "homepage": "https://opis.io/string",
+ "keywords": [
+ "multi-byte",
+ "opis",
+ "string",
+ "string manipulation",
+ "utf-8"
+ ],
+ "support": {
+ "issues": "https://github.com/opis/string/issues",
+ "source": "https://github.com/opis/string/tree/2.0.1"
+ },
+ "time": "2022-01-14T15:42:23+00:00"
+ },
+ {
+ "name": "opis/uri",
+ "version": "1.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/opis/uri.git",
+ "reference": "0f3ca49ab1a5e4a6681c286e0b2cc081b93a7d5a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/opis/uri/zipball/0f3ca49ab1a5e4a6681c286e0b2cc081b93a7d5a",
+ "reference": "0f3ca49ab1a5e4a6681c286e0b2cc081b93a7d5a",
+ "shasum": ""
+ },
+ "require": {
+ "opis/string": "^2.0",
+ "php": "^7.4 || ^8.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Opis\\Uri\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "Marius Sarca",
+ "email": "marius.sarca@gmail.com"
+ },
+ {
+ "name": "Sorin Sarca",
+ "email": "sarca_sorin@hotmail.com"
+ }
+ ],
+ "description": "Build, parse and validate URIs and URI-templates",
+ "homepage": "https://opis.io",
+ "keywords": [
+ "URI Template",
+ "parse url",
+ "punycode",
+ "uri",
+ "uri components",
+ "url",
+ "validate uri"
+ ],
+ "support": {
+ "issues": "https://github.com/opis/uri/issues",
+ "source": "https://github.com/opis/uri/tree/1.1.0"
+ },
+ "time": "2021-05-22T15:57:08+00:00"
+ },
{
"name": "orakili/composer-drupal-info-file-patch-helper",
"version": "1.0.1",
@@ -11064,6 +11189,40 @@
],
"time": "2024-05-24T10:39:05+00:00"
},
+ {
+ "name": "reliefweb/simple-autocomplete",
+ "version": "v1.3.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/UN-OCHA/rwint-simple-autocomplete.git",
+ "reference": "5d7b6236b3c680946a501da0c1aff1803853046f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/UN-OCHA/rwint-simple-autocomplete/zipball/5d7b6236b3c680946a501da0c1aff1803853046f",
+ "reference": "5d7b6236b3c680946a501da0c1aff1803853046f",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "drupal/coder": "8.3.*",
+ "phpunit/phpunit": "8.3.*"
+ },
+ "type": "drupal-library",
+ "notification-url": "https://packagist.org/downloads/",
+ "description": "Simple standalone autocomplete javascript library",
+ "keywords": [
+ "javascript",
+ "php",
+ "reliefweb"
+ ],
+ "support": {
+ "source": "https://github.com/UN-OCHA/rwint-simple-autocomplete/tree/v1.3.2"
+ },
+ "time": "2022-10-25T05:01:03+00:00"
+ },
{
"name": "robrichards/xmlseclibs",
"version": "3.1.1",
@@ -14788,6 +14947,85 @@
],
"time": "2024-01-29T20:11:03+00:00"
},
+ {
+ "name": "symfony/polyfill-uuid",
+ "version": "v1.30.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-uuid.git",
+ "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/2ba1f33797470debcda07fe9dce20a0003df18e9",
+ "reference": "2ba1f33797470debcda07fe9dce20a0003df18e9",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1"
+ },
+ "provide": {
+ "ext-uuid": "*"
+ },
+ "suggest": {
+ "ext-uuid": "For best performance"
+ },
+ "type": "library",
+ "extra": {
+ "thanks": {
+ "name": "symfony/polyfill",
+ "url": "https://github.com/symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "files": [
+ "bootstrap.php"
+ ],
+ "psr-4": {
+ "Symfony\\Polyfill\\Uuid\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Grégoire Pineau",
+ "email": "lyrixx@lyrixx.info"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for uuid functions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "polyfill",
+ "portable",
+ "uuid"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-uuid/tree/v1.30.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2024-05-31T15:07:36+00:00"
+ },
{
"name": "symfony/process",
"version": "v6.4.8",
@@ -15360,6 +15598,80 @@
],
"time": "2024-04-18T09:32:20+00:00"
},
+ {
+ "name": "symfony/uid",
+ "version": "v6.4.8",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/uid.git",
+ "reference": "35904eca37a84bb764c560cbfcac9f0ac2bcdbdf"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/uid/zipball/35904eca37a84bb764c560cbfcac9f0ac2bcdbdf",
+ "reference": "35904eca37a84bb764c560cbfcac9f0ac2bcdbdf",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1",
+ "symfony/polyfill-uuid": "^1.15"
+ },
+ "require-dev": {
+ "symfony/console": "^5.4|^6.0|^7.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Component\\Uid\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Grégoire Pineau",
+ "email": "lyrixx@lyrixx.info"
+ },
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Provides an object-oriented API to generate and represent UIDs",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "UID",
+ "ulid",
+ "uuid"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/uid/tree/v6.4.8"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2024-05-31T14:49:08+00:00"
+ },
{
"name": "symfony/validator",
"version": "v6.4.9",
@@ -15935,6 +16247,70 @@
},
"time": "2024-04-12T06:49:31+00:00"
},
+ {
+ "name": "unocha/json-schema",
+ "version": "v2.3.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/UN-OCHA/json-schema.git",
+ "reference": "beb68fe9cca61f6fd3115545ea2400fd7307b4a7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/UN-OCHA/json-schema/zipball/beb68fe9cca61f6fd3115545ea2400fd7307b4a7",
+ "reference": "beb68fe9cca61f6fd3115545ea2400fd7307b4a7",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "opis/string": "^2.0",
+ "opis/uri": "^1.0",
+ "php": "^7.4 || ^8.0"
+ },
+ "require-dev": {
+ "ext-bcmath": "*",
+ "ext-intl": "*",
+ "phpunit/phpunit": "^9.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Opis\\JsonSchema\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "Sorin Sarca",
+ "email": "sarca_sorin@hotmail.com"
+ },
+ {
+ "name": "Marius Sarca",
+ "email": "marius.sarca@gmail.com"
+ }
+ ],
+ "description": "Json Schema Validator for PHP",
+ "homepage": "https://opis.io/json-schema",
+ "keywords": [
+ "json",
+ "json-schema",
+ "schema",
+ "validation",
+ "validator"
+ ],
+ "support": {
+ "source": "https://github.com/UN-OCHA/json-schema/tree/v2.3.2"
+ },
+ "time": "2024-07-04T09:29:47+00:00"
+ },
{
"name": "unocha/ocha_key_figures",
"version": "2.1.10",
@@ -15994,6 +16370,50 @@
},
"time": "2024-06-03T11:11:14+00:00"
},
+ {
+ "name": "unocha/ocha_reliefweb",
+ "version": "dev-develop",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/UN-OCHA/ocha_reliefweb.git",
+ "reference": "89a8a4688cf3de6eaa42159b0c9321b335728ffe"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/UN-OCHA/ocha_reliefweb/zipball/89a8a4688cf3de6eaa42159b0c9321b335728ffe",
+ "reference": "89a8a4688cf3de6eaa42159b0c9321b335728ffe",
+ "shasum": ""
+ },
+ "require": {
+ "drupal/core": "^10",
+ "php": ">=8.2",
+ "reliefweb/simple-autocomplete": "^v1.3",
+ "symfony/uid": "^6.3",
+ "unocha/json-schema": "^2.3.2"
+ },
+ "require-dev": {
+ "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
+ "drupal/coder": "^8.3",
+ "phpcompatibility/php-compatibility": "^9.3"
+ },
+ "default-branch": true,
+ "type": "drupal-module",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "GPL-2.0-or-later"
+ ],
+ "authors": [
+ {
+ "name": "UNOCHA"
+ }
+ ],
+ "description": "OCHA ReliefWeb integration module",
+ "support": {
+ "issues": "https://github.com/UN-OCHA/ocha_reliefweb/issues",
+ "source": "https://github.com/UN-OCHA/ocha_reliefweb/tree/develop"
+ },
+ "time": "2024-07-16T15:50:40+00:00"
+ },
{
"name": "unocha/ocha_search",
"version": "v1.0.8",
@@ -17578,7 +17998,8 @@
"drupal/menu_breadcrumb": 15,
"drupal/openid_connect_windows_aad": 10,
"drupal/samples": 10,
- "drupal/viewsreference": 10
+ "drupal/viewsreference": 10,
+ "unocha/ocha_reliefweb": 20
},
"prefer-stable": true,
"prefer-lowest": false,
diff --git a/config/core.entity_form_display.reliefweb_resource.report.default.yml b/config/core.entity_form_display.reliefweb_resource.report.default.yml
new file mode 100644
index 00000000..e7e26d3e
--- /dev/null
+++ b/config/core.entity_form_display.reliefweb_resource.report.default.yml
@@ -0,0 +1,27 @@
+uuid: 20ad53d6-83e8-4fed-86fa-61e1813c9b55
+langcode: en
+status: true
+dependencies:
+ config:
+ - ocha_reliefweb.reliefweb_resource_type.report
+ module:
+ - ocha_reliefweb
+ enforced:
+ config:
+ - ocha_reliefweb.reliefweb_resource_type.report
+ module:
+ - ocha_reliefweb
+_core:
+ default_config_hash: BPMN75-UGH3ck0k3qNt0Vvpea4Zd2HIK8RAJnzyW6TE
+id: reliefweb_resource.report.default
+targetEntityType: reliefweb_resource
+bundle: report
+mode: default
+content:
+ content:
+ type: reliefweb_resource_content_report_widget
+ weight: 0
+ region: content
+ settings: { }
+ third_party_settings: { }
+hidden: { }
diff --git a/config/core.entity_view_display.reliefweb_resource.report.default.yml b/config/core.entity_view_display.reliefweb_resource.report.default.yml
new file mode 100644
index 00000000..64e4d8b7
--- /dev/null
+++ b/config/core.entity_view_display.reliefweb_resource.report.default.yml
@@ -0,0 +1,37 @@
+uuid: 99b9e86e-53c2-47e5-9b91-0ab12a53d610
+langcode: en
+status: true
+dependencies:
+ config:
+ - ocha_reliefweb.reliefweb_resource_type.report
+ module:
+ - ocha_reliefweb
+ enforced:
+ config:
+ - ocha_reliefweb.reliefweb_resource_type.report
+ module:
+ - ocha_reliefweb
+_core:
+ default_config_hash: GXN0Olf4tl_nRrIEEVb-j-yQ1XkTi4i_cdQR30gky9s
+id: reliefweb_resource.report.default
+targetEntityType: reliefweb_resource
+bundle: report
+mode: default
+content:
+ content:
+ type: reliefweb_resource_content_report_formatter
+ label: hidden
+ settings: { }
+ third_party_settings: { }
+ weight: 1
+ region: content
+ label:
+ type: string
+ label: hidden
+ settings:
+ link_to_entity: false
+ third_party_settings: { }
+ weight: 0
+ region: content
+hidden:
+ status: true
diff --git a/config/core.extension.yml b/config/core.extension.yml
index f0e0d706..6f0a9bfb 100644
--- a/config/core.extension.yml
+++ b/config/core.extension.yml
@@ -69,6 +69,7 @@ module:
ocha_datawrapper: 0
ocha_key_figures: 0
ocha_monitoring: 0
+ ocha_reliefweb: 0
ocha_search: 0
oembed_providers: 0
options: 0
diff --git a/config/editor.editor.ocha_reliefweb_editor.yml b/config/editor.editor.ocha_reliefweb_editor.yml
new file mode 100644
index 00000000..339d6b99
--- /dev/null
+++ b/config/editor.editor.ocha_reliefweb_editor.yml
@@ -0,0 +1,48 @@
+uuid: 54aa8662-b21b-453e-bf36-a4ebb1816950
+langcode: en
+status: true
+dependencies:
+ config:
+ - filter.format.ocha_reliefweb_editor
+ module:
+ - ckeditor5
+ enforced:
+ module:
+ - ocha_reliefweb
+_core:
+ default_config_hash: LNqyUvhZHO3hH53pH5_u9RBNIji-dKO5mV4srjfjb0E
+format: ocha_reliefweb_editor
+editor: ckeditor5
+settings:
+ toolbar:
+ items:
+ - bold
+ - italic
+ - heading
+ - '|'
+ - link
+ - blockQuote
+ - '|'
+ - bulletedList
+ - numberedList
+ - indent
+ - outdent
+ - '|'
+ - undo
+ - redo
+ - removeFormat
+ plugins:
+ ckeditor5_heading:
+ enabled_headings:
+ - heading2
+ - heading3
+ - heading4
+ - heading5
+ - heading6
+ ckeditor5_list:
+ properties:
+ reversed: false
+ startIndex: false
+ multiBlock: true
+image_upload:
+ status: false
diff --git a/config/filter.format.ocha_reliefweb_editor.yml b/config/filter.format.ocha_reliefweb_editor.yml
new file mode 100644
index 00000000..352785b0
--- /dev/null
+++ b/config/filter.format.ocha_reliefweb_editor.yml
@@ -0,0 +1,86 @@
+uuid: b353cd81-b5e5-4b33-a072-b4ff9dba7a06
+langcode: en
+status: true
+dependencies:
+ module:
+ - editor
+ - ocha_reliefweb
+ enforced:
+ module:
+ - ocha_reliefweb
+_core:
+ default_config_hash: 8-JapH-_gQUVJFe16QpVF-aj_ivTwjhMstOOLzaZp6M
+name: 'Ocha ReliefWeb Editor'
+format: ocha_reliefweb_editor
+weight: -10
+filters:
+ editor_file_reference:
+ id: editor_file_reference
+ provider: editor
+ status: false
+ weight: -44
+ settings: { }
+ filter_align:
+ id: filter_align
+ provider: filter
+ status: false
+ weight: -43
+ settings: { }
+ filter_autop:
+ id: filter_autop
+ provider: filter
+ status: false
+ weight: -42
+ settings: { }
+ filter_caption:
+ id: filter_caption
+ provider: filter
+ status: false
+ weight: -41
+ settings: { }
+ filter_html:
+ id: filter_html
+ provider: filter
+ status: true
+ weight: -49
+ settings:
+ allowed_html: '
- ' + filter_html_help: false + filter_html_nofollow: true + filter_html_escape: + id: filter_html_escape + provider: filter + status: false + weight: -45 + settings: { } + filter_html_image_secure: + id: filter_html_image_secure + provider: filter + status: false + weight: -36 + settings: { } + filter_htmlcorrector: + id: filter_htmlcorrector + provider: filter + status: true + weight: -47 + settings: { } + filter_image_lazy_load: + id: filter_image_lazy_load + provider: filter + status: false + weight: -35 + settings: { } + filter_url: + id: filter_url + provider: filter + status: false + weight: -40 + settings: + filter_url_length: 72 + ocha_reliefweb_external_link_filter: + id: ocha_reliefweb_external_link_filter + provider: ocha_reliefweb + status: true + weight: -46 + settings: { } diff --git a/config/ocha_reliefweb.reliefweb_resource_type.report.yml b/config/ocha_reliefweb.reliefweb_resource_type.report.yml new file mode 100644 index 00000000..0adc0783 --- /dev/null +++ b/config/ocha_reliefweb.reliefweb_resource_type.report.yml @@ -0,0 +1,15 @@ +uuid: fdaaac6c-8399-4135-8423-3df6a61848b7 +langcode: en +status: true +dependencies: + enforced: + module: + - ocha_reliefweb +settings: + disable_page_title: true + preview_warning: + value: '
This is a preview. The document is not yet published.
The URLs (document, files and images) are not publicly accessible so do not share them.
' + format: ocha_reliefweb_editor +id: report +label: Report +description: 'ReliefWeb report' diff --git a/config/ocha_reliefweb.settings.yml b/config/ocha_reliefweb.settings.yml new file mode 100644 index 00000000..d3292201 --- /dev/null +++ b/config/ocha_reliefweb.settings.yml @@ -0,0 +1,14 @@ +reliefweb_api_url: 'https://api.reliefweb.int/v1' +reliefweb_api_appname: unocha.org +reliefweb_api_cache_enabled: true +reliefweb_api_cache_lifetime: 300 +reliefweb_api_cache_namespace: 'reliefweb:api' +reliefweb_api_verify_ssl: true +reliefweb_website: 'https://reliefweb.int' +reliefweb_document_not_found_max_age: 600 +reliefweb_api_converter: 'https://reliefweb.int/search/converter/json' +reliefweb_api_use_redirects: true +reliefweb_api_post_api_schema_url: 'https://reliefweb.int/post-api-schemas/v2/' +reliefweb_api_submission_base_url: /reliefweb-submissions +reliefweb_api_submission_file_base_uri: 'public://reliefweb-submissions' +template_class_prefix: ocha-reliefweb diff --git a/config/user.role.anonymous.yml b/config/user.role.anonymous.yml index e8e00301..247cfaa5 100644 --- a/config/user.role.anonymous.yml +++ b/config/user.role.anonymous.yml @@ -5,6 +5,7 @@ dependencies: module: - contact - media + - ocha_reliefweb - system _core: default_config_hash: j5zLMOdJBqC0bMvSdth5UebkprJB8g_2FXHqhfpJzow @@ -14,5 +15,6 @@ weight: 0 is_admin: false permissions: - 'access content' + - 'access reliefweb resource update webhook' - 'access site-wide contact form' - 'view media' diff --git a/config/user.role.editor.yml b/config/user.role.editor.yml index e288ba21..e7b80c92 100644 --- a/config/user.role.editor.yml +++ b/config/user.role.editor.yml @@ -4,6 +4,7 @@ status: true dependencies: config: - filter.format.ckeditor + - filter.format.ocha_reliefweb_editor - filter.format.text_editor_simple - media.type.image - media.type.video @@ -15,6 +16,7 @@ dependencies: - node.type.resource - node.type.response - node.type.story + - ocha_reliefweb.reliefweb_resource_type.report - taxonomy.vocabulary.contacts - taxonomy.vocabulary.country - taxonomy.vocabulary.event_type @@ -31,6 +33,7 @@ dependencies: - node - ocha_datawrapper - ocha_key_figures + - ocha_reliefweb - paragraphs - path - redirect @@ -49,6 +52,8 @@ permissions: - 'access content overview' - 'access content samples' - 'access media overview' + - 'access reliefweb resource preview files' + - 'access reliefweb resource update webhook' - 'access stories entity browser pages' - 'access taxonomy overview' - 'access toolbar' @@ -65,6 +70,7 @@ permissions: - 'administer ocha presences' - 'administer redirects' - 'administer reliefweb breadcrumbs' + - 'administer reliefweb resources' - 'administer taxonomy' - 'create basic content' - 'create content translations' @@ -74,6 +80,7 @@ permissions: - 'create media' - 'create media_collection content' - 'create region content' + - 'create report content' - 'create resource content' - 'create response content' - 'create story content' @@ -85,12 +92,15 @@ permissions: - 'create terms in theme' - 'create url aliases' - 'create video media' + - 'delete any report content' + - 'delete own report content' - 'edit any basic content' - 'edit any event content' - 'edit any image media' - 'edit any leader content' - 'edit any media_collection content' - 'edit any region content' + - 'edit any report content' - 'edit any resource content' - 'edit any response content' - 'edit any story content' @@ -112,6 +122,7 @@ permissions: - 'edit own leader content' - 'edit own media_collection content' - 'edit own region content' + - 'edit own report content' - 'edit own resource content' - 'edit own response content' - 'edit own story content' @@ -158,6 +169,7 @@ permissions: - 'update content translations' - 'update media' - 'use text format ckeditor' + - 'use text format ocha_reliefweb_editor' - 'use text format text_editor_simple' - 'view all media revisions' - 'view all revisions' diff --git a/docker/Dockerfile b/docker/Dockerfile index 10935842..c7ccc722 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -44,7 +44,7 @@ LABEL info.humanitarianresponse.build.date=$BUILD_DATE \ RUN mkdir -p /etc/nginx/custom && \ # Permit nginx access to the MAPBX_SECRET env variable. - sed -i 's/env NGINX_OVERRIDE_PROTOCOL;/env NGINX_OVERRIDE_PROTOCOL;\n\n## Mapbox access token.\nenv MAPBOX_TOKEN;/' /etc/nginx/nginx.conf + sed -i 's/env NGINX_OVERRIDE_PROTOCOL;/env NGINX_OVERRIDE_PROTOCOL;\n\n## Mapbox access token.\nenv MAPBOX_TOKEN;\n\n## ReliefWeb site.\nenv RELIEFWEB_SITE;/' /etc/nginx/nginx.conf COPY --from=builder /srv/www/assets /srv/www/assets COPY --from=builder /srv/www/config /srv/www/config diff --git a/docker/etc/nginx/custom/01_attachment_redirections.conf b/docker/etc/nginx/custom/01_attachment_redirections.conf index 82e51de2..4a300fe1 100644 --- a/docker/etc/nginx/custom/01_attachment_redirections.conf +++ b/docker/etc/nginx/custom/01_attachment_redirections.conf @@ -44,10 +44,12 @@ location @reliefweb-file { ## Ensure the proxy host is in a variable, so nginx will not cache the IP ## indefinitely and cause 502 errors if the load balancer IPs change. - set $reliefweb_host "reliefweb.int"; + ## Retrieve the mapbox access token. + set_by_lua $reliefweb_site 'return os.getenv("RELIEFWEB_SITE") or "https://reliefweb.int"'; ## Pass the request to ReliefWeb. - proxy_pass https://$reliefweb_host; + proxy_ssl_server_name on; + proxy_pass $reliefweb_site; ## Override connection and buffer vars: do not attempt to buffer, just throw ## the data out right away and close the docstore connection when done. diff --git a/html/modules/custom/unocha_reliefweb/unocha_reliefweb.module b/html/modules/custom/unocha_reliefweb/unocha_reliefweb.module index 7ba6dc24..7ee87fb9 100644 --- a/html/modules/custom/unocha_reliefweb/unocha_reliefweb.module +++ b/html/modules/custom/unocha_reliefweb/unocha_reliefweb.module @@ -5,6 +5,8 @@ * Module file for the ReliefWeb integration. */ +use Drupal\Core\Form\FormStateInterface; + /** * Implements hook_theme(). */ @@ -187,3 +189,34 @@ function unocha_reliefweb_theme() { return $themes; } + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function unocha_reliefweb_form_reliefweb_resource_report_add_form_alter(array &$form, FormStateInterface $form_state, string $form_id) { + // Set OCHA as the default source. + if (isset($form['content']['widget'][0]['value']['source'])) { + if (empty($form['content']['widget'][0]['value']['source']['#default_value'])) { + $form['content']['widget'][0]['value']['source']['#default_value'] = [1503]; + } + } + + // Set Situation Report as the default content format. + if (isset($form['content']['widget'][0]['value']['format'])) { + if (empty($form['content']['widget'][0]['value']['format']['#default_value'])) { + $form['content']['widget'][0]['value']['format']['#default_value'] = 10; + } + } + + // Set English as the default language. + if (isset($form['content']['widget'][0]['value']['language'])) { + if (empty($form['content']['widget'][0]['language']['source']['#default_value'])) { + $form['content']['widget'][0]['value']['language']['#default_value'] = [267]; + } + } + + // Hide the origin field. + if (isset($form['content']['widget'][0]['value']['origin'])) { + $form['content']['widget'][0]['value']['origin']['#access'] = FALSE; + } +}