diff --git a/web/modules/custom/buckeye_bot/buckeye_bot.info.yml b/web/modules/custom/buckeye_bot/buckeye_bot.info.yml new file mode 100644 index 0000000000000000000000000000000000000000..27c51f1937a82a1422cfc1d2714914507ca23f67 --- /dev/null +++ b/web/modules/custom/buckeye_bot/buckeye_bot.info.yml @@ -0,0 +1,5 @@ +name: "BuckeyeBot" +type: module +description: "Enable BuckeyeBot from The Ohio State University" +package: ASC Tech +core_version_requirement: ^9 || ^10 diff --git a/web/modules/custom/buckeye_bot/buckeye_bot.libraries.yml b/web/modules/custom/buckeye_bot/buckeye_bot.libraries.yml new file mode 100644 index 0000000000000000000000000000000000000000..d3f8a2316bf4cb69c3826befc206c53e5983053b --- /dev/null +++ b/web/modules/custom/buckeye_bot/buckeye_bot.libraries.yml @@ -0,0 +1,9 @@ +buckeye_bot: + version: 1.x + js: + //assets.chat.osu.edu/v1.3.2/scripts.js?all=true&offsetBottom=50px: + { + type: external, + attributes: + { type: "text/javascript", id: "buckeye-chat-script", defer: true }, + } diff --git a/web/modules/custom/buckeye_bot/buckeye_bot.links.menu.yml b/web/modules/custom/buckeye_bot/buckeye_bot.links.menu.yml new file mode 100644 index 0000000000000000000000000000000000000000..133e8f3eccd114cf0de4cc913f069387728ec051 --- /dev/null +++ b/web/modules/custom/buckeye_bot/buckeye_bot.links.menu.yml @@ -0,0 +1,5 @@ +buckeye_bot.settings: + title: "BuckeyeBot" + description: "BuckeyeBot settings" + parent: system.admin_config_system + route_name: "buckeye_bot.config" diff --git a/web/modules/custom/buckeye_bot/buckeye_bot.module b/web/modules/custom/buckeye_bot/buckeye_bot.module new file mode 100644 index 0000000000000000000000000000000000000000..681579796171d6e492bde26a63acbba4a2c8d79f --- /dev/null +++ b/web/modules/custom/buckeye_bot/buckeye_bot.module @@ -0,0 +1,16 @@ +<?php + +function buckeye_bot_preprocess_html(&$variables) +{ + $is_admin = \Drupal::service('router.admin_context')->isAdminRoute(); + + if (!$is_admin) { + $config = \Drupal::config('buckeye_bot.buckeye_bot_config'); + + $buckeye_bot_status = $config->get('buckeye_bot_status'); + + if ($buckeye_bot_status) { + $variables['#attached']['library'][] = 'buckeye_bot/buckeye_bot'; + } + } +} diff --git a/web/modules/custom/buckeye_bot/buckeye_bot.permissions.yml b/web/modules/custom/buckeye_bot/buckeye_bot.permissions.yml new file mode 100644 index 0000000000000000000000000000000000000000..c6cea8b97213226a30fbf364c81ee62df64e0b5a --- /dev/null +++ b/web/modules/custom/buckeye_bot/buckeye_bot.permissions.yml @@ -0,0 +1,3 @@ +administer buckeye bot: + title: "Administer BuckeyeBot" + description: "Gives users permissions to manage BuckeyeBot." diff --git a/web/modules/custom/buckeye_bot/buckeye_bot.routing.yml b/web/modules/custom/buckeye_bot/buckeye_bot.routing.yml new file mode 100644 index 0000000000000000000000000000000000000000..b294d637edcaafecc8c86e94fb0b1a78fa92e0f3 --- /dev/null +++ b/web/modules/custom/buckeye_bot/buckeye_bot.routing.yml @@ -0,0 +1,7 @@ +buckeye_bot.config: + path: 'admin/config/buckeye_bot' + defaults: + _form: '\Drupal\buckeye_bot\Form\BuckeyeBotConfigurationForm' + _title: 'BuckeyeBot' + requirements: + _permission: 'administer buckeye bot' \ No newline at end of file diff --git a/web/modules/custom/buckeye_bot/config/install/buckeye_bot.buckeye_bot_config.yml b/web/modules/custom/buckeye_bot/config/install/buckeye_bot.buckeye_bot_config.yml new file mode 100644 index 0000000000000000000000000000000000000000..418ad729076958d46085d85f46402dc7c52a3b77 --- /dev/null +++ b/web/modules/custom/buckeye_bot/config/install/buckeye_bot.buckeye_bot_config.yml @@ -0,0 +1 @@ +buckeye_bot_status: 0 \ No newline at end of file diff --git a/web/modules/custom/buckeye_bot/src/Form/BuckeyeBotConfigurationForm.php b/web/modules/custom/buckeye_bot/src/Form/BuckeyeBotConfigurationForm.php new file mode 100644 index 0000000000000000000000000000000000000000..dbbf119f71f97bb5c4afa6db69ee44bf44a965a0 --- /dev/null +++ b/web/modules/custom/buckeye_bot/src/Form/BuckeyeBotConfigurationForm.php @@ -0,0 +1,47 @@ +<?php + + namespace Drupal\buckeye_bot\Form; + + use Drupal\Core\Form\ConfigFormBase; + use Drupal\Core\Form\FormStateInterface; + + class BuckeyeBotConfigurationForm extends ConfigFormBase { + + protected function getEditableConfigNames() { + return ['buckeye_bot.buckeye_bot_config']; + } + + public function getFormId() { + return 'buckeye_bot_configuration_form'; + } + + public function buildForm(array $form, FormStateInterface $form_state) { + $config = $this->config('buckeye_bot.buckeye_bot_config'); + + $buckeye_bot_status = $config->get('buckeye_bot_status'); + + $form['intro'] = array( + '#markup' => $this->t('<p>Controls the display of BuckeyeBot.</p>'), + ); + + $form['buckeye_bot_status'] = array( + '#type' => 'checkbox', + '#title' => $this->t('Activate BuckeyeBot'), + '#default_value' => isset($buckeye_bot_status) ? $buckeye_bot_status : FALSE, + ); + + return parent::buildForm($form, $form_state); + } + + public function submitForm(array &$form, FormStateInterface $form_state) { + $config = $this->config('buckeye_bot.buckeye_bot_config'); + + $config->set('buckeye_bot_status', $form_state->getValue('buckeye_bot_status'))->save(); + + parent::submitForm($form, $form_state); + } + + public function validateForm(array &$form, FormStateInterface $form_state) { + parent::validateForm($form, $form_state); + } + } diff --git a/web/themes/asc_bootstrap_bux/templates/system/html.html.twig b/web/themes/asc_bootstrap_bux/templates/system/html.html.twig new file mode 100644 index 0000000000000000000000000000000000000000..5c7502b616fdb917198e55a71739c6c7eacf46ee --- /dev/null +++ b/web/themes/asc_bootstrap_bux/templates/system/html.html.twig @@ -0,0 +1,74 @@ +{# +/** + * @file + * Default theme implementation to display the basic html structure of a single + * Drupal page. + * + * Variables: + * - $css: An array of CSS files for the current page. + * - $language: (object) The language the site is being displayed in. + * $language->language contains its textual representation. + * $language->dir contains the language direction. It will either be 'ltr' or + * 'rtl'. + * - $rdf_namespaces: All the RDF namespace prefixes used in the HTML document. + * - $grddl_profile: A GRDDL profile allowing agents to extract the RDF data. + * - $head_title: A modified version of the page title, for use in the TITLE + * tag. + * - $head_title_array: (array) An associative array containing the string parts + * that were used to generate the $head_title variable, already prepared to be + * output as TITLE tag. The key/value pairs may contain one or more of the + * following, depending on conditions: + * - title: The title of the current page, if any. + * - name: The name of the site. + * - slogan: The slogan of the site, if any, and if there is no title. + * - $head: Markup for the HEAD section (including meta tags, keyword tags, and + * so on). + * - $styles: Style tags necessary to import all CSS files for the page. + * - $scripts: Script tags necessary to load the JavaScript files and settings + * for the page. + * - $page_top: Initial markup from any modules that have altered the + * page. This variable should always be output first, before all other dynamic + * content. + * - $page: The rendered page content. + * - $page_bottom: Final closing markup from any modules that have altered the + * page. This variable should always be output last, after all other dynamic + * content. + * - $classes String of classes that can be used to style contextually through + * CSS. + * + * @ingroup templates + * + * @see bootstrap_preprocess_html() + * @see template_preprocess() + * @see template_preprocess_html() + * @see template_process() + */ +#} +{% + set body_classes = [ + logged_in ? 'user-logged-in', + not root_path ? 'path-frontpage' : 'path-' ~ root_path|clean_class, + node_type ? 'page-node-type-' ~ node_type|clean_class, + db_offline ? 'db-offline', + theme.settings.navbar_position ? 'navbar-is-' ~ theme.settings.navbar_position, + theme.has_glyphicons ? 'has-glyphicons', + ] +%} +<!DOCTYPE html> +<html {{ html_attributes }}> + <head> + <head-placeholder token="{{ placeholder_token|raw }}"> + <title>{{ head_title|safe_join(' | ') }}</title> + <css-placeholder token="{{ placeholder_token|raw }}"> + <js-placeholder token="{{ placeholder_token|raw }}"> + </head> + <body{{ attributes.addClass(body_classes) }}> + <a href="#main-content" id="skip" class="visually-hidden focusable skip-link"> + {{ 'Skip to main content'|t }} + </a> + {{ page_top }} + {{ page }} + {{ page_bottom }} + <js-bottom-placeholder token="{{ placeholder_token|raw }}"> + </body> +</html>