-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a admin page for configuration. (#27)
* Add application bin * Admin UI init * Add overlooked values with constants
- Loading branch information
1 parent
ca57281
commit 02ac277
Showing
7 changed files
with
253 additions
and
9 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,5 @@ | ||
fedora-endpoint-url: 'http://10.0.2.2:8080/fedora' | ||
oldfedoraUsername: fedoraAdmin | ||
oldfedorapsswd: fedoraAdmin | ||
solr-endpoint-url: 'http://10.0.2.2:8080/solr' | ||
migrate_7x_claw_solr_q: 'RELS_EXT_isMemberOfCollection_uri_ms:"info:fedora/islandora:sp_basic_image_collection" OR PID:"islandora:sp_basic_image_collection"' |
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 |
---|---|---|
|
@@ -6,3 +6,4 @@ core: 8.x | |
dependencies: | ||
- drupal:migrate | ||
- migrate_plus:migrate_plus | ||
configure: migrate_7x_claw.settings |
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 @@ | ||
migrate_7x_claw.settings: | ||
title: 'Islandora Migration Settings' | ||
description: 'Control settings for the 7x to 8x migration module.' | ||
route_name: migrate_7x_claw.settings | ||
parent: system.admin_config_islandora | ||
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,27 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Stuff is going on here. | ||
*/ | ||
|
||
/** | ||
* Get settings. | ||
*/ | ||
function get_migrate_setting() { | ||
return /Drupal::service('migrate_7x_claw.migrate_7x_claw')->getMigrate7xSetting(); | ||
} | ||
|
||
/** | ||
* Get settings. | ||
*/ | ||
function get_migrate_install() { | ||
/Drupal::configFactory() | ||
->getEditable('migrate_7x_claw.settings') | ||
->set('fedora-endpoint-url', \Drupal::config('migrate_7x_claw.settings') | ||
->set('oldfedoraUsername', \Drupal::config('migrate_7x_claw.settings') | ||
->set('oldfedorapsswd', \Drupal::config('migrate_7x_claw.settings') | ||
->set('solr-endpoint-url', \Drupal::config('migrate_7x_claw.settings') | ||
->set('migrate_7x_claw_solr_q', \Drupal::config('migrate_7x_claw.settings') | ||
->save(); | ||
} |
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,9 @@ | ||
migrate_7x_claw.settings: | ||
path: '/admin/config/islandora/migrate_7x_claw' | ||
defaults: | ||
_form: 'Drupal\migrate_7x_claw\Form\MIGRATE7XCLAWSettingsForm' | ||
_title: 'Islandora Migration Settings' | ||
requirements: | ||
_permission: 'administer site configuration' | ||
options: | ||
_admin_route: TRUE |
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,174 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Contains \Drupal\migrate_7x_claw\Form\MIGRATE7XCLAWSettingsForm. | ||
*/ | ||
|
||
namespace Drupal\migrate_7x_claw\Form; | ||
|
||
use Drupal\Core\Form\ConfigFormBase; | ||
use Drupal\Core\Form\FormStateInterface; | ||
|
||
/** | ||
* Defines a form to configure migrate_7x_claw module settings. | ||
*/ | ||
class MIGRATE7XCLAWSettingsForm extends ConfigFormBase { | ||
/** | ||
* {@interidoc} | ||
*/ | ||
public function getFormId() { | ||
return 'migrate_7x_claw_settings'; | ||
} | ||
|
||
/** | ||
* {@interitdoc} | ||
*/ | ||
protected function getEditableConfigNames() { | ||
return [ | ||
'migrate_7x_claw.settings', | ||
'migrate_plus.migration.islandora_audit_file', | ||
'migrate_plus.migration.islandora_audit_media', | ||
'migrate_plus.migration.islandora_corporate', | ||
'migrate_plus.migration.islandora_files', | ||
'migrate_plus.migration.islandora_geographic', | ||
'migrate_plus.migration.islandora_media', | ||
'migrate_plus.migration.islandora_objects', | ||
'migrate_plus.migration.islandora_person', | ||
'migrate_plus.migration.islandora_subject', | ||
]; | ||
} | ||
|
||
/** | ||
* {@interitdoc} | ||
*/ | ||
public function buildForm(array $form, FormStateInterface $form_state) { | ||
$config = $this->config('migrate_7x_claw.settings'); | ||
$form['migrate_7x_claw_fedoraConfig'] = [ | ||
'#type' => 'fieldset', | ||
'#title' => $this->t("Islandora 7's Fedora Configuration"), | ||
]; | ||
$form['migrate_7x_claw_fedoraConfig']['fedora-endpoint-url'] = [ | ||
'#type' => 'url', | ||
'#title' => $this->t("Fedora base URL"), | ||
'#default_value' => $config->get('fedora-endpoint-url'), | ||
'#required' => TRUE, | ||
]; | ||
$form['migrate_7x_claw_fedoraConfig']['oldfedoraUsername'] = [ | ||
'#type' => 'textfield', | ||
'#title' => $this->t('Fedora Username'), | ||
'#default_value' => $config->get('oldfedoraUsername'), | ||
'#required' => TRUE, | ||
]; | ||
$form['migrate_7x_claw_fedoraConfig']['oldfedorapsswd'] = [ | ||
'#type' => 'password', | ||
'#title' => $this->t("Fedora User's password."), | ||
'#suffix' => $this->t('Leave blank to use previously save password.'), | ||
'#default_value' => $config->get('oldfedorapsswd'), | ||
]; | ||
$form['migrate_7x_claw_solrConfig'] = [ | ||
'#type' => 'fieldset', | ||
'#title' => $this->t("Islandora 7's Solr Configuration"), | ||
]; | ||
$form['migrate_7x_claw_solrConfig']['solr-endpoint-url'] = [ | ||
'#type' => 'url', | ||
'#title' => $this->t("Solr base URL"), | ||
'#default_value' => $config->get('solr-endpoint-url'), | ||
'#required' => TRUE, | ||
]; | ||
$form['migrate_7x_claw_solrConfig']['migrate_7x_claw_solr_q'] = [ | ||
'#type' => 'textfield', | ||
'#title' => $this->t('Solr query'), | ||
'#default_value' => $config->get('migrate_7x_claw_solr_q'), | ||
'#size' => 160, | ||
'#maxlength' => 1240, | ||
'#required' => TRUE, | ||
]; | ||
return parent::buildForm($form, $form_state); | ||
} | ||
|
||
/** | ||
* {@interitdoc} | ||
*/ | ||
public function submitForm(array &$form, FormStateInterface $form_state) { | ||
$islandora_audit_file_config = $this->config('migrate_plus.migration.islandora_audit_file'); | ||
$islandora_audit_media_config = $this->config('migrate_plus.migration.islandora_audit_media'); | ||
$islandora_corporate_config = $this->config('migrate_plus.migration.islandora_corporate'); | ||
$islandora_files_config = $this->config('migrate_plus.migration.islandora_files'); | ||
$islandora_geographic_config = $this->config('migrate_plus.migration.islandora_geographic'); | ||
$islandora_media_config = $this->config('migrate_plus.migration.islandora_media'); | ||
$islandora_objects_config = $this->config('migrate_plus.migration.islandora_objects'); | ||
$islandora_person_config = $this->config('migrate_plus.migration.islandora_person'); | ||
$islandora_subject_config = $this->config('migrate_plus.migration.islandora_subject'); | ||
$config = $this->config('migrate_7x_claw.settings'); | ||
|
||
$config->set('fedora-endpoint-url', $form_state->getValue('fedora-endpoint-url')); | ||
$islandora_audit_file_config->set('source.fedora_base_url', $form_state->getValue('fedora-endpoint-url')); | ||
$islandora_audit_media_config->set('source.fedora_base_url', $form_state->getValue('fedora-endpoint-url')); | ||
$islandora_audit_media_config->set('source.constants.fedora_base_url', $form_state->getValue('fedora-endpoint-url')); | ||
$islandora_corporate_config->set('source.fedora_base_url', $form_state->getValue('fedora-endpoint-url')); | ||
$islandora_files_config->set('source.fedora_base_url', $form_state->getValue('fedora-endpoint-url')); | ||
$islandora_files_config->set('source.constants.fedora_base_url', $form_state->getValue('fedora-endpoint-url')); | ||
$islandora_geographic_config->set('source.fedora_base_url', $form_state->getValue('fedora-endpoint-url')); | ||
$islandora_media_config->set('source.fedora_base_url', $form_state->getValue('fedora-endpoint-url')); | ||
$islandora_objects_config->set('source.fedora_base_url', $form_state->getValue('fedora-endpoint-url')); | ||
$islandora_person_config->set('source.fedora_base_url', $form_state->getValue('fedora-endpoint-url')); | ||
$islandora_subject_config->set('source.fedora_base_url', $form_state->getValue('fedora-endpoint-url')); | ||
|
||
$config->set('oldfedoraUsername', $form_state->getValue('oldfedoraUsername')); | ||
$islandora_audit_file_config->set('source.authentication.username', $form_state->getValue('oldfedoraUsername')); | ||
$islandora_audit_media_config->set('source.authentication.username', $form_state->getValue('oldfedoraUsername')); | ||
$islandora_corporate_config->set('source.authentication.username', $form_state->getValue('oldfedoraUsername')); | ||
$islandora_files_config->set('source.authentication.username', $form_state->getValue('oldfedoraUsername')); | ||
$islandora_geographic_config->set('source.authentication.username', $form_state->getValue('oldfedoraUsername')); | ||
$islandora_media_config->set('source.authentication.username', $form_state->getValue('oldfedoraUsername')); | ||
$islandora_objects_config->set('source.authentication.username', $form_state->getValue('oldfedoraUsername')); | ||
$islandora_person_config->set('source.authentication.username', $form_state->getValue('oldfedoraUsername')); | ||
$islandora_subject_config->set('source.authentication.username', $form_state->getValue('oldfedoraUsername')); | ||
$islandora_files_config->set('process.uri.settings.authentication.username', $form_state->getValue('oldfedoraUsername')); | ||
|
||
if (!$form_state->getValue('oldfedorapsswd') == '') { | ||
$config->set('oldfedorapsswd', $form_state->getValue('oldfedorapsswd')); | ||
$islandora_audit_file_config->set('source.authentication.password', $form_state->getValue('oldfedorapsswd')); | ||
$islandora_audit_media_config->set('source.authentication.password', $form_state->getValue('oldfedorapsswd')); | ||
$islandora_corporate_config->set('source.authentication.password', $form_state->getValue('oldfedorapsswd')); | ||
$islandora_files_config->set('source.authentication.password', $form_state->getValue('oldfedorapsswd')); | ||
$islandora_geographic_config->set('source.authentication.password', $form_state->getValue('oldfedorapsswd')); | ||
$islandora_media_config->set('source.authentication.password', $form_state->getValue('oldfedorapsswd')); | ||
$islandora_objects_config->set('source.authentication.password', $form_state->getValue('oldfedorapsswd')); | ||
$islandora_person_config->set('source.authentication.password', $form_state->getValue('oldfedorapsswd')); | ||
$islandora_subject_config->set('source.authentication.password', $form_state->getValue('oldfedorapsswd')); | ||
$islandora_files_config->set('process.uri.settings.authentication.password', $form_state->getValue('oldfedorapsswd')); | ||
} | ||
|
||
$config->set('solr-endpoint-url', $form_state->getValue('solr-endpoint-url')); | ||
$islandora_audit_file_config->set('source.solr_base_url', $form_state->getValue('solr-endpoint-url')); | ||
$islandora_audit_media_config->set('source.solr_base_url', $form_state->getValue('solr-endpoint-url')); | ||
$islandora_corporate_config->set('source.solr_base_url', $form_state->getValue('solr-endpoint-url')); | ||
$islandora_files_config->set('source.solr_base_url', $form_state->getValue('solr-endpoint-url')); | ||
$islandora_geographic_config->set('source.solr_base_url', $form_state->getValue('solr-endpoint-url')); | ||
$islandora_media_config->set('source.solr_base_url', $form_state->getValue('solr-endpoint-url')); | ||
$islandora_objects_config->set('source.solr_base_url', $form_state->getValue('solr-endpoint-url')); | ||
$islandora_person_config->set('source.solr_base_url', $form_state->getValue('solr-endpoint-url')); | ||
$islandora_subject_config->set('source.solr_base_url', $form_state->getValue('solr-endpoint-url')); | ||
|
||
$config->set('migrate_7x_claw_solr_q', $form_state->getValue('migrate_7x_claw_solr_q')); | ||
$islandora_audit_file_config->set('source.q', $form_state->getValue('migrate_7x_claw_solr_q')); | ||
$islandora_files_config->set('source.q', $form_state->getValue('migrate_7x_claw_solr_q')); | ||
$islandora_media_config->set('source.q', $form_state->getValue('migrate_7x_claw_solr_q')); | ||
$islandora_objects_config->set('source.q', $form_state->getValue('migrate_7x_claw_solr_q')); | ||
|
||
$config->save(); | ||
$islandora_audit_file_config->save(); | ||
$islandora_audit_media_config->save(); | ||
$islandora_corporate_config->save(); | ||
$islandora_files_config->save(); | ||
$islandora_geographic_config->save(); | ||
$islandora_media_config->save(); | ||
$islandora_objects_config->save(); | ||
$islandora_person_config->save(); | ||
$islandora_subject_config->save(); | ||
parent::submitForm($form, $form_state); | ||
} | ||
|
||
} |