-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #565 from usdoj/release-8.0.0
Release 8.0.0
- Loading branch information
Showing
13 changed files
with
983 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
uuid: f11bde99-324e-4c66-a593-b12dfb0c9b02 | ||
langcode: en | ||
status: true | ||
dependencies: | ||
config: | ||
- filter.format.rich_text_wizard | ||
module: | ||
- ckeditor | ||
_core: | ||
default_config_hash: 0bVELtfx9sXhjZ6s6W-dJo8SW-IR9jiEIEylzm-2Cro | ||
format: rich_text_wizard | ||
editor: ckeditor | ||
settings: | ||
toolbar: | ||
rows: | ||
- | ||
- | ||
name: Formatting | ||
items: | ||
- Bold | ||
- Italic | ||
- Strike | ||
- Superscript | ||
- Subscript | ||
- '-' | ||
- RemoveFormat | ||
- | ||
name: Linking | ||
items: | ||
- DrupalLink | ||
- DrupalUnlink | ||
- | ||
name: Lists | ||
items: | ||
- BulletedList | ||
- NumberedList | ||
- | ||
name: Media | ||
items: | ||
- Blockquote | ||
- Table | ||
- HorizontalRule | ||
- media_browser | ||
- | ||
name: 'Block Formatting' | ||
items: | ||
- Styles | ||
- Format | ||
- | ||
name: Tools | ||
items: | ||
- ShowBlocks | ||
- Source | ||
plugins: | ||
stylescombo: | ||
styles: "a|Default link style\r\na.square|Square link style" | ||
image_upload: | ||
status: true | ||
scheme: public | ||
directory: inline-images | ||
max_size: '' | ||
max_dimensions: | ||
width: null | ||
height: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
uuid: 7d470070-584c-4edb-8708-27439c63b444 | ||
langcode: en | ||
status: true | ||
dependencies: | ||
module: | ||
- editor | ||
- entity_embed | ||
- media | ||
_core: | ||
default_config_hash: xNqrUFmyyyy8JFxTT_Zd1CLPZ3fyIR8wqQkEfPrYj9o | ||
name: 'Rich Text (Wizard)' | ||
format: rich_text_wizard | ||
weight: 1 | ||
filters: | ||
filter_align: | ||
id: filter_align | ||
provider: filter | ||
status: true | ||
weight: -49 | ||
settings: { } | ||
filter_caption: | ||
id: filter_caption | ||
provider: filter | ||
status: true | ||
weight: -48 | ||
settings: { } | ||
filter_htmlcorrector: | ||
id: filter_htmlcorrector | ||
provider: filter | ||
status: true | ||
weight: -46 | ||
settings: { } | ||
editor_file_reference: | ||
id: editor_file_reference | ||
provider: editor | ||
status: true | ||
weight: -45 | ||
settings: { } | ||
entity_embed: | ||
id: entity_embed | ||
provider: entity_embed | ||
status: true | ||
weight: -47 | ||
settings: { } | ||
filter_html: | ||
id: filter_html | ||
provider: filter | ||
status: true | ||
weight: -50 | ||
settings: | ||
allowed_html: '<em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <s> <sup> <sub> <img src alt data-entity-type data-entity-uuid data-align data-caption> <table> <caption> <tbody> <thead> <tfoot> <th> <td> <tr> <hr> <p> <br> <h1> <pre> <a href hreflang class> <drupal-entity data-* data-entity-type data-entity-uuid data-entity-embed-display data-entity-embed-display-settings data-align data-caption data-embed-button data-langcode alt title>' | ||
filter_html_help: true | ||
filter_html_nofollow: false | ||
filter_autop: | ||
id: filter_autop | ||
provider: filter | ||
status: false | ||
weight: -43 | ||
settings: { } | ||
filter_html_escape: | ||
id: filter_html_escape | ||
provider: filter | ||
status: false | ||
weight: -44 | ||
settings: { } | ||
filter_html_image_secure: | ||
id: filter_html_image_secure | ||
provider: filter | ||
status: false | ||
weight: -41 | ||
settings: { } | ||
filter_url: | ||
id: filter_url | ||
provider: filter | ||
status: false | ||
weight: -42 | ||
settings: | ||
filter_url_length: 72 | ||
media_embed: | ||
id: media_embed | ||
provider: media | ||
status: false | ||
weight: -40 | ||
settings: | ||
default_view_mode: default | ||
allowed_view_modes: { } | ||
allowed_media_types: { } |
Large diffs are not rendered by default.
Oops, something went wrong.
70 changes: 70 additions & 0 deletions
70
docroot/modules/custom/foia_wizard/config/install/foia_wizard.settings.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
intro_slide: | ||
value: "<h1>Hello,</h1>\r\n\r\n<p>The government hosts a vast amount of information, with records spread across many different agencies, and even across different offices within agencies.</p>\r\n\r\n<p>To help you figure out which federal agency might have the information you seek, we've developed this tool. If you're looking for non-federal records, such as from your local police department, we suggest contact the appropriate state or local authorities.</p>\r\n\r\n<p>We recommend giving yourself at least 5 minutes to explore this tool</p>\r\n" | ||
format: rich_text | ||
query_slide_1: | ||
value: "<h1>Let's dive in...</h1>\r\n\r\n<p>What information are you looking for?</p>\r\n" | ||
format: rich_text | ||
query_slide_2: | ||
value: "<p>Please enter one to two sentences describing what you're searching for, including relevant keywords.</p>\r\n" | ||
format: rich_text | ||
messages: | ||
m1: | ||
value: "<p>Message 1</p>\r\n" | ||
format: rich_text | ||
m2: | ||
value: "<p>Message 2</p>\r\n" | ||
format: rich_text | ||
m3: | ||
value: "<p>Message 3</p>\r\n" | ||
format: rich_text | ||
m4: | ||
value: "<p>Message 4</p>\r\n" | ||
format: rich_text | ||
m5: | ||
value: "<p>Message 5</p>\r\n" | ||
format: rich_text | ||
m6: | ||
value: "<p>Message 6</p>\r\n" | ||
format: rich_text | ||
m7: | ||
value: "<p>Message 7</p>\r\n" | ||
format: rich_text | ||
m8: | ||
value: "<p>Message 8</p>\r\n" | ||
format: rich_text | ||
m9: | ||
value: "<p>Message 9</p>\r\n" | ||
format: rich_text | ||
m10: | ||
value: "<p>Message 10</p>\r\n" | ||
format: rich_text | ||
m11: | ||
value: "<p>Message 11</p>\r\n" | ||
format: rich_text | ||
m12: | ||
value: "<p>Message 12</p>\r\n" | ||
format: rich_text | ||
m13: | ||
value: "<p>Message 13</p>\r\n" | ||
format: rich_text | ||
m14: | ||
value: "<p>Message 14</p>\r\n" | ||
format: rich_text | ||
m15: | ||
value: "<p>Message 15</p>\r\n" | ||
format: rich_text | ||
m16: | ||
value: "<p>Message 16</p>\r\n" | ||
format: rich_text | ||
m17: | ||
value: "<p>Message 17</p>\r\n" | ||
format: rich_text | ||
m18: | ||
value: "<p>Message 18</p>\r\n" | ||
format: rich_text | ||
m19: | ||
value: "<p>Message 19</p>\r\n" | ||
format: rich_text | ||
m20: | ||
value: "<p>Message 20</p>\r\n" | ||
format: rich_text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: FOIA Request Wizard | ||
type: module | ||
description: Configurations for the FOIA Request Wizard tool. | ||
package: FOIA | ||
core: 8.x | ||
core_version_requirement: ^8 || ^9 | ||
dependencies: | ||
- drupal:rest |
6 changes: 6 additions & 0 deletions
6
docroot/modules/custom/foia_wizard/foia_wizard.links.menu.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
foia_wizard.settings_form: | ||
title: FOIA Request Wizard | ||
description: Configure FOIA Request Wizard. | ||
parent: system.admin_config_system | ||
route_name: foia_wizard.settings_form | ||
weight: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Primary module hooks for FOIA Request Wizard module. | ||
* | ||
* @DCG | ||
* This file is no longer required in Drupal 8. | ||
* @see https://www.drupal.org/node/2217931 | ||
*/ | ||
|
||
define('FOIA_WIZARD_MCOUNT', 60); |
4 changes: 4 additions & 0 deletions
4
docroot/modules/custom/foia_wizard/foia_wizard.permissions.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
administer foia_wizard configuration: | ||
title: 'Administer foia_wizard configuration' | ||
description: 'Allow configuration of the FOIA Wizard tool.' | ||
restrict access: true |
15 changes: 15 additions & 0 deletions
15
docroot/modules/custom/foia_wizard/foia_wizard.routing.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
foia_wizard.settings_form: | ||
path: '/admin/config/system/foia-wizard' | ||
defaults: | ||
_title: 'FOIA Request Wizard settings' | ||
_form: 'Drupal\foia_wizard\Form\SettingsForm' | ||
requirements: | ||
_permission: 'administer foia_wizard configuration' | ||
|
||
foia_wizard.api: | ||
path: '/api/foia_wizard' | ||
defaults: | ||
_controller: '\Drupal\foia_wizard\Controller\FoiaWizardController::wizard' | ||
_format: 'json' | ||
requirements: | ||
_permission: 'access content' |
109 changes: 109 additions & 0 deletions
109
docroot/modules/custom/foia_wizard/src/Controller/FoiaWizardController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?php | ||
|
||
namespace Drupal\foia_wizard\Controller; | ||
|
||
use Drupal\Core\Cache\CacheableJsonResponse; | ||
use Drupal\Core\Config\ConfigFactoryInterface; | ||
use Drupal\Core\Controller\ControllerBase; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
use Symfony\Component\HttpFoundation\RequestStack; | ||
|
||
/** | ||
* Returns responses for FOIA Request Wizard routes. | ||
*/ | ||
class FoiaWizardController extends ControllerBase { | ||
|
||
/** | ||
* The number of seconds in a day, for use with the cache max age. | ||
*/ | ||
const SECONDS_IN_A_DAY = 60 * 60 * 24; | ||
|
||
/** | ||
* The config factory. | ||
* | ||
* @var \Drupal\Core\Config\ConfigFactoryInterface | ||
*/ | ||
protected $configFactory; | ||
|
||
/** | ||
* The request stack. | ||
* | ||
* @var \Symfony\Component\HttpFoundation\RequestStack | ||
*/ | ||
protected $requestStack; | ||
|
||
/** | ||
* FoiaWizardController constructor. | ||
* | ||
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory | ||
* The config factory. | ||
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack | ||
* The request stack. | ||
*/ | ||
public function __construct(ConfigFactoryInterface $config_factory, RequestStack $request_stack) { | ||
$this->configFactory = $config_factory; | ||
$this->requestStack = $request_stack; | ||
} | ||
|
||
/** | ||
* Cached response for report years array. | ||
* | ||
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container | ||
* Standard Drupal Container Interface. | ||
* | ||
* @return \Drupal\Core\Controller\ControllerBase|void | ||
* Returns a cached response. | ||
*/ | ||
public static function create(ContainerInterface $container) { | ||
return new static( | ||
$container->get('config.factory'), | ||
$container->get('request_stack') | ||
); | ||
} | ||
|
||
/** | ||
* Builds the response. | ||
*/ | ||
public function wizard() { | ||
|
||
// Get the config. | ||
$config = $this->configFactory->get('foia_wizard.settings'); | ||
|
||
$messages = []; | ||
|
||
// Add rich text fields for messages. | ||
for ($i = 1; $i <= FOIA_WIZARD_MCOUNT; $i++) { | ||
$messages['m' . $i] = $config->get('messages')['m' . $i]['value']; | ||
} | ||
|
||
$triggers = file_get_contents(dirname(dirname(__DIR__)) . '/trigger-phrases.json'); | ||
$triggers = json_decode($triggers); | ||
|
||
$data = [ | ||
'trigger_phrases' => $triggers, | ||
'language' => [ | ||
'en' => [ | ||
'intro_slide' => $config->get('intro_slide.value'), | ||
'query_slide_1' => $config->get('query_slide_1.value'), | ||
'query_slide_2' => $config->get('query_slide_2.value'), | ||
'messages' => $messages, | ||
], | ||
], | ||
]; | ||
|
||
$valid_origins = [ | ||
'https://www.foia.gov', | ||
'https://main-bvxea6i-oafzps2pqxjxw.us-2.platformsh.site', | ||
]; | ||
|
||
$origin = $this->requestStack->getCurrentRequest()->headers->get('Origin', ''); | ||
|
||
$headers = in_array($origin, $valid_origins) | ||
? ['Access-Control-Allow-Origin' => $origin] | ||
: []; | ||
|
||
// Return JSON response. | ||
return CacheableJsonResponse::create($data)->setMaxAge(self::SECONDS_IN_A_DAY); | ||
} | ||
|
||
} |
Oops, something went wrong.