Skip to content

Commit

Permalink
Add base theme
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-stoehr committed Feb 1, 2024
1 parent 632a1c8 commit bdb7afb
Show file tree
Hide file tree
Showing 77 changed files with 8,763 additions and 9 deletions.
5 changes: 3 additions & 2 deletions docker/apache2/conf/httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -576,9 +576,10 @@ SSLRandomSeed connect builtin

# Configuration for theme-specific resources:
AliasMatch ^/vufind/themes/([0-9a-zA-Z-_]*)/css/(.*)$ /var/www/html/themes/$1/css/$2
AliasMatch ^/vufind/themes/([0-9a-zA-Z-_]*)/fonts/(.*)$ /var/www/html/themes/$1/fonts/$2
AliasMatch ^/vufind/themes/([0-9a-zA-Z-_]*)/images/(.*)$ /var/www/html/themes/$1/images/$2
AliasMatch ^/vufind/themes/([0-9a-zA-Z-_]*)/js/(.*)$ /var/www/html/themes/$1/js/$2
<Directory ~ "^/var/www/html/themes/([0-9a-zA-Z-_]*)/(css|images|js)/">
<Directory ~ "^/var/www/html/themes/([0-9a-zA-Z-_]*)/(css|fonts|images|js)/">
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
Expand Down Expand Up @@ -655,7 +656,7 @@ Alias /vufind /var/www/html/public
# This line specifies additional code modules to load after the standard VuFind module.
# Multiple modules may be specified separated by commas. This mechanism can be used to override
# core VuFind functionality without modifying core code.
SetEnv VUFIND_LOCAL_MODULES DismaxMunge,ExtendedFeedback,RecordDriver,DependentWorks,FacetPrefix,SearchKeys,Libraries,ExtendedFacets,DAIAplus,PAIAplus,HelpTooltips,ResultFeedback,AutocompleteTerms,BelugaConfig,RVK,AvailabilityPlus
SetEnv VUFIND_LOCAL_MODULES UISettings,HeadTitle,DismaxMunge,ExtendedFeedback,RecordDriver,DependentWorks,FacetPrefix,SearchKeys,Libraries,ExtendedFacets,DAIAplus,PAIAplus,HelpTooltips,ResultFeedback,AutocompleteTerms,BelugaConfig,RVK,AvailabilityPlus

# This line overrides the detection of VuFind base directory. By default it is determined from
# the location of the index.php file, but in case it is e.g. symlinked or there is another reason
Expand Down
2 changes: 1 addition & 1 deletion local/config/vufind/httpd-vufind.conf
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Alias /vufind /var/www/vufind_9_hcu/public
# This line specifies additional code modules to load after the standard VuFind module.
# Multiple modules may be specified separated by commas. This mechanism can be used to override
# core VuFind functionality without modifying core code.
SetEnv VUFIND_LOCAL_MODULES Findex,LimitBatch,DismaxMunge,ExtendedFeedback,RecordDriver,FacetPrefix,SearchKeys,DependentWorks,Libraries,ExtendedFacets,DAIAplus,PAIAplus,Delivery,BelugaConfig,HelpTooltips,RVK,AutocompleteTerms,ResultFeedback,AvailabilityPlus
SetEnv VUFIND_LOCAL_MODULES UISettings,HeadTitle,Findex,LimitBatch,DismaxMunge,ExtendedFeedback,RecordDriver,FacetPrefix,SearchKeys,DependentWorks,Libraries,ExtendedFacets,DAIAplus,PAIAplus,Delivery,BelugaConfig,HelpTooltips,RVK,AutocompleteTerms,ResultFeedback,AvailabilityPlus

# This line overrides the detection of VuFind base directory. By default it is determined from
# the location of the index.php file, but in case it is e.g. symlinked or there is another reason
Expand Down
95 changes: 95 additions & 0 deletions module/HeadTitle/Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php
/**
* Template for code module for storing local overrides.
*
* PHP version 7
*
* Copyright (C) Villanova University 2010.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package Module
* @author Demian Katz <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development
*/
namespace HeadTitle;

use Laminas\ModuleManager\ModuleManager;
use Laminas\Mvc\MvcEvent;

/**
* Template for code module for storing local overrides.
*
* @category VuFind
* @package Module
* @author Demian Katz <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development
*/
class Module
{
/**
* Get module configuration
*
* @return array
*/
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}

/**
* Get autoloader configuration
*
* @return array
*/
public function getAutoloaderConfig()
{
return [
'Laminas\Loader\StandardAutoloader' => [
'namespaces' => [
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
],
],
];
}

/**
* Initialize the module
*
* @param ModuleManager $m Module manager
*
* @return void
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function init(ModuleManager $m)
{
}

/**
* Bootstrap the module
*
* @param MvcEvent $e Event
*
* @return void
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function onBootstrap(MvcEvent $e)
{
}
}
3 changes: 3 additions & 0 deletions module/HeadTitle/config/module.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

return [];
41 changes: 41 additions & 0 deletions module/HeadTitle/src/HeadTitle/View/Helper/Root/HeadTitle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/**
* @see https://github.com/laminas/laminas-view for the canonical source repository
* @copyright https://github.com/laminas/laminas-view/blob/master/COPYRIGHT.md
* @license https://github.com/laminas/laminas-view/blob/master/LICENSE.md New BSD License
*/

namespace HeadTitle\View\Helper\Root;

use Laminas\View\Exception;

/**
* Helper for setting and retrieving title element for HTML head.
*
* Duck-types against Laminas\I18n\Translator\TranslatorAwareInterface.
*/
class HeadTitle extends \Laminas\View\Helper\HeadTitle
{
private $headTitleConfig;

public function __construct()
{
parent::__construct();
if ($configFile = realpath(getenv('VUFIND_LOCAL_DIR') . '/config/vufind/HeadTitle.ini')) {
$this->headTitleConfig = parse_ini_file($configFile, true);
}
}

public function renderTitle()
{
return $this->getTitlePrefix().parent::renderTitle();
}

private function getTitlePrefix () {
if ($this->headTitleConfig && isset($this->headTitleConfig['title_prefix'])) {
return $this->headTitleConfig['title_prefix'];
}
return '';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
/**
* HeadTitle helper factory.
*
* PHP version 7
*
* Copyright (C) Villanova University 2021.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package View_Helpers
* @author Demian Katz <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
namespace HeadTitle\View\Helper\Root;

use Interop\Container\ContainerInterface;
use Interop\Container\Exception\ContainerException;
use Laminas\ServiceManager\Exception\ServiceNotCreatedException;
use Laminas\ServiceManager\Exception\ServiceNotFoundException;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\View\Helper\Placeholder\Container\AbstractContainer;

/**
* HeadTitle helper factory.
*
* @category VuFind
* @package View_Helpers
* @author Demian Katz <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
class HeadTitleFactory implements FactoryInterface
{
/**
* Create an object
*
* @param ContainerInterface $container Service manager
* @param string $requestedName Service being created
* @param null|array $options Extra options (optional)
*
* @return object
*
* @throws ServiceNotFoundException if unable to resolve the service.
* @throws ServiceNotCreatedException if an exception is raised when
* creating a service.
* @throws ContainerException&\Throwable if any other error occurs
*/
public function __invoke(
ContainerInterface $container,
$requestedName,
array $options = null
) {
if (!empty($options)) {
throw new \Exception('Unexpected options sent to factory.');
}
$helper = new $requestedName();
// In VuFind, we always want to set, not append, titles:
$helper->setDefaultAttachOrder(AbstractContainer::SET);
return $helper;
}
}
68 changes: 68 additions & 0 deletions module/UISettings/Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/**
* Code module for the core of the VuFind application
*
* PHP version 7
*
* Copyright (C) Villanova University 2010.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package Module
* @author Demian Katz <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org
*/
namespace UISettings;

use Laminas\Mvc\MvcEvent;

/**
* Code module for the core of the VuFind application
*
* @category VuFind
* @package Module
* @author Demian Katz <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org
*/
class Module
{
/**
* Get module configuration
*
* @return array
*/
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}

/**
* Get autoloader configuration
*
* @return array
*/
public function getAutoloaderConfig()
{
return [
'Laminas\Loader\StandardAutoloader' => [
'namespaces' => [
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
],
],
];
}
}
17 changes: 17 additions & 0 deletions module/UISettings/config/module.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
$config = [
'vufind' => [
'plugin_managers' => [
'ajaxhandler' => [
'factories' => [
'UISettings\AjaxHandler\SetUISettings' => 'UISettings\AjaxHandler\SetUISettingsFactory',
],
'aliases' => [
'setUISettings' => 'UISettings\AjaxHandler\SetUISettings',
],
],
],
],
];

return $config;
Loading

0 comments on commit bdb7afb

Please sign in to comment.