diff --git a/targets/Readme.txt b/modules/Readme.txt similarity index 100% rename from targets/Readme.txt rename to modules/Readme.txt diff --git a/targets/evergreen/css/roblib_search_evergreen.css b/modules/evergreen/css/roblib_search_evergreen.css similarity index 100% rename from targets/evergreen/css/roblib_search_evergreen.css rename to modules/evergreen/css/roblib_search_evergreen.css diff --git a/targets/evergreen/js/evergreen_results.js b/modules/evergreen/js/evergreen_results.js similarity index 100% rename from targets/evergreen/js/evergreen_results.js rename to modules/evergreen/js/evergreen_results.js diff --git a/targets/evergreen/roblib_search_evergreen.info b/modules/evergreen/roblib_search_evergreen.info similarity index 100% rename from targets/evergreen/roblib_search_evergreen.info rename to modules/evergreen/roblib_search_evergreen.info diff --git a/targets/evergreen/roblib_search_evergreen.install b/modules/evergreen/roblib_search_evergreen.install similarity index 100% rename from targets/evergreen/roblib_search_evergreen.install rename to modules/evergreen/roblib_search_evergreen.install diff --git a/targets/evergreen/roblib_search_evergreen.module b/modules/evergreen/roblib_search_evergreen.module similarity index 100% rename from targets/evergreen/roblib_search_evergreen.module rename to modules/evergreen/roblib_search_evergreen.module diff --git a/targets/evergreen/theme/roblib-search-evergreen.tpl.php b/modules/evergreen/theme/roblib-search-evergreen.tpl.php similarity index 100% rename from targets/evergreen/theme/roblib-search-evergreen.tpl.php rename to modules/evergreen/theme/roblib-search-evergreen.tpl.php diff --git a/targets/evergreen/theme/theme.inc b/modules/evergreen/theme/theme.inc similarity index 100% rename from targets/evergreen/theme/theme.inc rename to modules/evergreen/theme/theme.inc diff --git a/targets/islandscholar/css/roblib_search_islandscholar.css b/modules/islandscholar/css/roblib_search_islandscholar.css similarity index 100% rename from targets/islandscholar/css/roblib_search_islandscholar.css rename to modules/islandscholar/css/roblib_search_islandscholar.css diff --git a/targets/islandscholar/js/islandscholar_results.js b/modules/islandscholar/js/islandscholar_results.js similarity index 100% rename from targets/islandscholar/js/islandscholar_results.js rename to modules/islandscholar/js/islandscholar_results.js diff --git a/targets/islandscholar/roblib_search_islandscholar.info b/modules/islandscholar/roblib_search_islandscholar.info similarity index 100% rename from targets/islandscholar/roblib_search_islandscholar.info rename to modules/islandscholar/roblib_search_islandscholar.info diff --git a/targets/islandscholar/roblib_search_islandscholar.install b/modules/islandscholar/roblib_search_islandscholar.install similarity index 100% rename from targets/islandscholar/roblib_search_islandscholar.install rename to modules/islandscholar/roblib_search_islandscholar.install diff --git a/targets/islandscholar/roblib_search_islandscholar.module b/modules/islandscholar/roblib_search_islandscholar.module similarity index 100% rename from targets/islandscholar/roblib_search_islandscholar.module rename to modules/islandscholar/roblib_search_islandscholar.module diff --git a/targets/islandscholar/theme/roblib-search-islandscholar.tpl.php b/modules/islandscholar/theme/roblib-search-islandscholar.tpl.php similarity index 100% rename from targets/islandscholar/theme/roblib-search-islandscholar.tpl.php rename to modules/islandscholar/theme/roblib-search-islandscholar.tpl.php diff --git a/targets/islandscholar/theme/theme.inc b/modules/islandscholar/theme/theme.inc similarity index 100% rename from targets/islandscholar/theme/theme.inc rename to modules/islandscholar/theme/theme.inc diff --git a/targets/passthru_results/css/roblib_search_passthru.css b/modules/passthru_results/css/roblib_search_passthru.css similarity index 100% rename from targets/passthru_results/css/roblib_search_passthru.css rename to modules/passthru_results/css/roblib_search_passthru.css diff --git a/targets/passthru_results/js/passthru_results.js b/modules/passthru_results/js/passthru_results.js similarity index 100% rename from targets/passthru_results/js/passthru_results.js rename to modules/passthru_results/js/passthru_results.js diff --git a/targets/passthru_results/roblib_search_passthru.info b/modules/passthru_results/roblib_search_passthru.info similarity index 100% rename from targets/passthru_results/roblib_search_passthru.info rename to modules/passthru_results/roblib_search_passthru.info diff --git a/targets/passthru_results/roblib_search_passthru.install b/modules/passthru_results/roblib_search_passthru.install similarity index 100% rename from targets/passthru_results/roblib_search_passthru.install rename to modules/passthru_results/roblib_search_passthru.install diff --git a/targets/passthru_results/roblib_search_passthru.module b/modules/passthru_results/roblib_search_passthru.module similarity index 100% rename from targets/passthru_results/roblib_search_passthru.module rename to modules/passthru_results/roblib_search_passthru.module diff --git a/targets/passthru_results/theme/roblib-search-passthru.tpl.php b/modules/passthru_results/theme/roblib-search-passthru.tpl.php similarity index 100% rename from targets/passthru_results/theme/roblib-search-passthru.tpl.php rename to modules/passthru_results/theme/roblib-search-passthru.tpl.php diff --git a/targets/passthru_results/theme/theme.inc b/modules/passthru_results/theme/theme.inc similarity index 100% rename from targets/passthru_results/theme/theme.inc rename to modules/passthru_results/theme/theme.inc diff --git a/targets/eds/css/roblib_search_eds.css b/modules/roblib_search_eds/css/roblib_search_eds.css similarity index 100% rename from targets/eds/css/roblib_search_eds.css rename to modules/roblib_search_eds/css/roblib_search_eds.css diff --git a/targets/eds/js/eds_results.js b/modules/roblib_search_eds/js/eds_results.js similarity index 100% rename from targets/eds/js/eds_results.js rename to modules/roblib_search_eds/js/eds_results.js diff --git a/targets/eds/js/eds_results_article.js b/modules/roblib_search_eds/js/eds_results_article.js similarity index 100% rename from targets/eds/js/eds_results_article.js rename to modules/roblib_search_eds/js/eds_results_article.js diff --git a/modules/roblib_search_eds/roblib_search_eds.info.yml b/modules/roblib_search_eds/roblib_search_eds.info.yml new file mode 100644 index 0000000..160efee --- /dev/null +++ b/modules/roblib_search_eds/roblib_search_eds.info.yml @@ -0,0 +1,9 @@ +name: Roblib Search EDS +type: module +configure: roblib_search_eds.settings +description: Implements the Roblib Search EDS book and article results +package: Roblib Search +core_version_requirement: ^8.9 || ^9 +dependancies: + - roblib_search + - ebsco \ No newline at end of file diff --git a/targets/eds/roblib_search_eds.module b/modules/roblib_search_eds/roblib_search_eds.module similarity index 90% rename from targets/eds/roblib_search_eds.module rename to modules/roblib_search_eds/roblib_search_eds.module index 93c5c86..4cd19f2 100644 --- a/targets/eds/roblib_search_eds.module +++ b/modules/roblib_search_eds/roblib_search_eds.module @@ -60,7 +60,7 @@ function roblib_search_eds_info($type = 'Articles') { /** * Implements hook_permission(). */ -function roblib_search_eds_permission() { +/*function roblib_search_eds_permission() { return array( 'search roblib eds' => array( 'title' => t('Search the eds target'), @@ -71,36 +71,26 @@ function roblib_search_eds_permission() { 'description' => t('Administer settings for the Roblib eds search client.'), ), ); -} +}*/ + /** * Implements hook_theme(). */ -function roblib_search_eds_theme() { - // set path - $path = drupal_get_path('module', 'roblib_search_eds'); - $file = 'theme.inc'; - - return array( - // results page - 'roblib_search_eds' => array( - 'path' => $path . '/theme', - 'file' => $file, - 'template' => 'roblib-search-eds', - 'variables' => array('results' => NULL), - ), - 'roblib_search_eds_articles' => array( - 'path' => $path . '/theme', - 'file' => $file, - 'template' => 'roblib-search-eds-articles', - 'variables' => array('results' => NULL), - ), - ); +function roblib_search_eds_theme($existing, $type, $theme, $path) { + return [ + 'roblib_search_eds_books' => [ + 'variables' => ['query' => NULL], + ], + 'roblib_search_eds_articles' => [ + 'variables' => ['query' => NULL], + ], + ]; } -function roblib_search_eds_block_info() { +/*function roblib_search_eds_block_info() { $blocks['roblib_search_eds_results'] = array( // info: The name of the block. @@ -113,9 +103,9 @@ function roblib_search_eds_block_info() { 'cache' => DRUPAL_CACHE_PER_ROLE, ); return $blocks; -} +}*/ -function roblib_search_eds_block_view($delta = '') { +/*function roblib_search_eds_block_view($delta = '') { switch ($delta) { case 'roblib_search_eds_results': $block['subject'] = t('Books & Media'); @@ -129,9 +119,9 @@ function roblib_search_eds_block_view($delta = '') { } return $block; -} +}*/ -function roblib_search_eds_ajax($query) { +/*function roblib_search_eds_ajax($query) { print roblib_search_eds_get_results($query, 'Books'); exit(); } @@ -139,7 +129,7 @@ function roblib_search_eds_ajax($query) { function roblib_search_eds_articles($query) { print roblib_search_eds_get_results($query, 'Articles'); exit(); -} +}*/ /** * diff --git a/modules/roblib_search_eds/roblib_search_eds.routing.yml b/modules/roblib_search_eds/roblib_search_eds.routing.yml new file mode 100644 index 0000000..a8825c1 --- /dev/null +++ b/modules/roblib_search_eds/roblib_search_eds.routing.yml @@ -0,0 +1,8 @@ +roblib_search_eds.settings: + path: '/admin/config/system/roblib_search_eds_settings' + defaults: + _form: '\Drupal\roblib_search_eds\Form\EdsSettingsForm' + _title: 'Roblib Search EDS Settings Form' + requirements: + _permission: 'administer site configuration' + \ No newline at end of file diff --git a/targets/eds/Controller/RoblibSearchEdsController.php b/modules/roblib_search_eds/src/Controller/RoblibSearchEdsController.php similarity index 79% rename from targets/eds/Controller/RoblibSearchEdsController.php rename to modules/roblib_search_eds/src/Controller/RoblibSearchEdsController.php index 044b62f..e95a8bf 100644 --- a/targets/eds/Controller/RoblibSearchEdsController.php +++ b/modules/roblib_search_eds/src/Controller/RoblibSearchEdsController.php @@ -16,10 +16,7 @@ class RoblibSearchEdsController extends ControllerBase { * A renderable array. */ public function articleResults($query = NULL) { - return [ - '#theme' => 'roblib_search_results', - '#query' => $query, - ]; + } /** @@ -30,7 +27,7 @@ class RoblibSearchEdsController extends ControllerBase { */ public function bookResults($query = NULL) { return [ - '#theme' => 'roblib_search_results', + '#theme' => 'roblib_search_eds_books', '#query' => $query, ]; } diff --git a/modules/roblib_search_eds/src/Form/EdsSettingsForm.php b/modules/roblib_search_eds/src/Form/EdsSettingsForm.php new file mode 100644 index 0000000..f0c0b52 --- /dev/null +++ b/modules/roblib_search_eds/src/Form/EdsSettingsForm.php @@ -0,0 +1,137 @@ + 'textfield', + '#title' => t('EDS Rest endpoint'), + '#default_value' => $config->get('eds_rest_url'), + '#description' => t('The base EDS URL, for example https://eds-api.ebscohost.com/edsapi/rest'), + '#required' => TRUE, + ); + $form['eds_auth_url'] = array( + '#type' => 'textfield', + '#title' => t('EDS Auth endpoint'), + '#default_value' => $config->get('eds_auth_url'), + '#description' => t('The EDS Auth endpoint, for example https://eds-api.ebscohost.com/Authservice/rest'), + '#required' => TRUE, + ); + + $form['eds_user'] = array( + '#type' => 'textfield', + '#title' => t('EDS user'), + '#default_value' => $config->get('eds_user'), + '#description' => t('EDS user, for example username'), + '#required' => TRUE, + ); + + $form['eds_pass'] = array( + '#type' => 'textfield', + '#title' => t('EDS password'), + '#default_value' => $config->get('eds_pass'), + '#description' => t('EDS password, for example password'), + '#required' => TRUE, + ); + + $form['eds_guest'] = array( + '#type' => 'textfield', + '#title' => t('EDS Guest access'), + '#default_value' => $config->get('eds_guest'), + '#description' => t('EDS Guest access, y = guest access, n = not a guest'), + '#required' => TRUE, + ); + + $form['eds_article_profile'] = array( + '#type' => 'textfield', + '#title' => t('EDS Article profile'), + '#default_value' => $config->get('eds_article_profile'), + '#description' => t('EDS profile, for example edsapi'), + '#required' => TRUE, + ); + + $form['eds_book_profile'] = array( + '#type' => 'textfield', + '#title' => t('EDS Book profile'), + '#default_value' => $config->get('eds_book_profile'), + '#description' => t('EDS Book profile, for example apilite'), + '#required' => TRUE, + ); + + $form['eds_num_results'] = array( + '#type' => 'textfield', + '#title' => t('Number of results to return'), + '#default_value' => $config->get('eds_num_results'), + '#description' => t('The number of results to display in the Bento box, usurally 5'), + '#required' => TRUE, + ); + $form['eds_article_limiters'] = array( + '#type' => 'textarea', + '#title' => t('The limiters for Article searches'), + '#default_value' => $config->get('eds_article_limiters'), + '#description' => t('Specify the Publication Types to use as limiters for Article searches. Formatted similar to + AND (PT Article OR PT Magazines OR PT News OR PT Academic Journals OR PT Conference Materials)'), + '#required' => TRUE, + ); + $form['eds_book_limiters'] = array( + '#type' => 'textarea', + '#title' => t('The limiters for Books and Media searches'), + '#default_value' => $config->get('eds_book_limiters'), + '#description' => t('Specify the Publication Types to use as limiters for Article searches. Formatted similar to + AND (PT Book OR PT Video OR PT Audio'), + '#required' => TRUE, + ); + $form['actions']['submit'] = [ + '#type' => 'submit', + '#value' => t('Save'), + '#button_type' => 'primary', + ]; + return $form; + } + + /** + * {@inheritdoc} + */ + public function validateForm(array &$form, FormStateInterface $form_state) { + + } + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $config = \Drupal::configFactory()->getEditable('roblib_search_eds.settings'); + $config->set('eds_rest_url', $form_state->getValue('eds_rest_url'))->save(); + $config->set('eds_auth_url', $form_state->getValue('eds_auth_url'))->save(); + $config->set('eds_user', $form_state->getValue('eds_user'))->save(); + $config->set('eds_pass', $form_state->getValue('eds_pass'))->save(); + $config->set('eds_guest', $form_state->getValue('eds_guest'))->save(); + $config->set('eds_article_profile', $form_state->getValue('eds_article_profile'))->save(); + $config->set('eds_book_profile', $form_state->getValue('eds_book_profile'))->save(); + $config->set('eds_num_results', $form_state->getValue('eds_num_results'))->save(); + $config->set('eds_article_limiters', $form_state->getValue('eds_article_limiters'))->save(); + $config->set('eds_book_limiters', $form_state->getValue('eds_book_limiters'))->save(); + } + +} diff --git a/modules/roblib_search_eds/src/Plugin/Block/RoblibSearchEdsArticles.php b/modules/roblib_search_eds/src/Plugin/Block/RoblibSearchEdsArticles.php new file mode 100644 index 0000000..a3dd6dc --- /dev/null +++ b/modules/roblib_search_eds/src/Plugin/Block/RoblibSearchEdsArticles.php @@ -0,0 +1,27 @@ + 'roblib_search_eds_articles', + '#query' => $query, + ]; + } +} diff --git a/modules/roblib_search_eds/src/Plugin/Block/RoblibSearchEdsBooks.php b/modules/roblib_search_eds/src/Plugin/Block/RoblibSearchEdsBooks.php new file mode 100644 index 0000000..febfa3e --- /dev/null +++ b/modules/roblib_search_eds/src/Plugin/Block/RoblibSearchEdsBooks.php @@ -0,0 +1,27 @@ + 'roblib_search_eds_books', + '#query' => $query, + ]; + } +} diff --git a/modules/roblib_search_eds/templates/roblib-search-eds-articles.html.twig b/modules/roblib_search_eds/templates/roblib-search-eds-articles.html.twig new file mode 100644 index 0000000..b24bb89 --- /dev/null +++ b/modules/roblib_search_eds/templates/roblib-search-eds-articles.html.twig @@ -0,0 +1,12 @@ + +
+