Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

## Release 4.10 - 2026-05-12

### Update

Das Updateskript muss ausgeführt werden, da es Änderungen an der Datenbank und
zusätzliche Updateschritte gibt.

### Konfiguration

Bislang sind nur wenige Optionen in der Administration editierbar. Diese wurde
bisher in `application/configs/config.xml` gespeichert. Dafür gibt es jetzt eine
Tabelle in der Datenbank. Beim Update wird der Inhalt von `config.xml` in die
Datenbank übertragen und die Datei dann (optional) gelöscht.

Die editierbaren Optionen werden nun in `application/configs/options.yml`
definiert. Generell kann die Liste lokal erweitert werden. Im Standard werden
im Laufe der Zeit mehr Optionen in der Weboberfläche verfügbar gemacht werden.

TODO Link to documentation

### RSS-Links

RSS-Links können nun ausgeblendet werden. Sie werden automatisch ausgeblendet,
Expand Down
9 changes: 9 additions & 0 deletions application/configs/options.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
searchengine.solr.parameterDefaults.rows:
type: int
section: searching
options:
min: 10

browsing.series.sortByTitle:
type: bool
section: browsing
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
"opus4/zf1-future": "1.25.*",
"jpgraph/jpgraph": "dev-master",
"opus4-repo/opus4-common": "^4.9",
"opus4-repo/framework": "^4.9",
"opus4-repo/framework": "dev-master as 4.10",
"opus4-repo/search": "^4.9",
"opus4-repo/opus4-bibtex": "^4.9",
"opus4-repo/opus4-import": "^4.9",
"opus4-repo/opus4-pdf": "^4.9",
"opus4-repo/opus4-job": "^4.9",
"opus4-repo/opus4-security": "^4.9",
"opus4-repo/opus4-sword": "^4.9",
"opus4-repo/opus4-app-common": "^4.9",
"opus4-repo/opus4-app-common": "dev-main as 4.10",
"opus4-repo/opus4-deepgreen": "^4.9",
"components/jquery": "3.4.*",
"components/jqueryui": "1.12.*",
Expand Down
2 changes: 1 addition & 1 deletion db/masterdata/022-set-opus-version.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ START TRANSACTION;
-- Set internal OPUS version (for controlling updates)

TRUNCATE TABLE `opus_version`;
INSERT INTO `opus_version` (`version`) VALUES (20);
INSERT INTO `opus_version` (`version`) VALUES (21);

COMMIT;

Expand Down
15 changes: 14 additions & 1 deletion library/Application/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
*/

use Opus\App\Common\Configuration;
use Opus\Common\Config;
use Opus\Common\Log\LogService;
use Opus\Common\Repository;
use Opus\Db\DatabaseBootstrap;
use Opus\Db2\Configuration as ConfigurationDatabase;
use Opus\Search\Plugin\Index;

/**
Expand Down Expand Up @@ -258,7 +260,7 @@ protected function _setupPageCache()
*/
protected function _initTranslation()
{
$this->bootstrap(['Configuration', 'Session', 'Logging', 'ZendCache']);
$this->bootstrap(['Configuration', 'OnlineConfiguration', 'Session', 'Logging', 'ZendCache']);
$logService = LogService::getInstance();
$logger = $logService->getLog('translation');

Expand Down Expand Up @@ -411,4 +413,15 @@ protected function _initIndexPlugin()
// TODO this is a dependency on a specific implementation (refactor to remove)
$cache::setIndexPluginClass(Index::class);
}

protected function _initOnlineConfiguration()
{
$this->bootstrap('Database');

$configuration = new ConfigurationDatabase();
$onlineConfig = $configuration->getConfig();

$config = Config::get();
$config->merge($onlineConfig);
}
}
2 changes: 1 addition & 1 deletion library/Application/Form/Element/SupportedLanguages.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function getLanguageOptions()
*/
public function setValue($value)
{
if (! is_array($value)) {
if (! is_array($value) && $value !== null) {
$values = array_map('trim', explode(',', $value));
} else {
$values = $value;
Expand Down
5 changes: 1 addition & 4 deletions modules/admin/controllers/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\App\Common\Configuration;

class Admin_ConfigController extends Application_Controller_Action
{
public function indexAction()
Expand All @@ -48,8 +46,7 @@ public function indexAction()
case Admin_Form_Configuration::RESULT_SAVE:
if ($form->isValid($data)) {
$config = new Zend_Config([], true);
$form->updateModel($config);
Configuration::save($config);
$form->updateModel($config); // TODO $config object is not needed
} else {
break;
}
Expand Down
83 changes: 58 additions & 25 deletions modules/admin/forms/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,20 @@

/**
* Form for editing selected OPUS 4 configuration options.
*
* TODO Application_Form_Abstract should be enough (not ID element needed)
*/
class Admin_Form_Configuration extends Application_Form_Model_Abstract
{
/**
* Prefix for translation keys of configuration options.
*
* TODO wird auf von Admin_Model_Option verwendet
* TODO wird auch von Admin_Model_Option verwendet
*/
public const LABEL_TRANSLATION_PREFIX = 'admin_config_';

/** @var array Configured options for form. */
private $options;

/**
* @param null|Zend_Config $config
*/
public function __construct($config = null)
public function __construct(?array $config = null)
{
if ($config !== null) {
$options = new Admin_Model_Options($config);
Expand All @@ -73,19 +68,27 @@ public function init()
$this->options = $options->getOptions();
}

foreach ($this->options as $name => $option) {
foreach ($this->options as $option) {
$section = $option->getSection();

$elementOptions = $option->getOptions();

$translator = $this->getTranslator();

if ($translator->isTranslated($option->getDescription())) {
$elementOptions['description'] = $option->getDescription();
}

if ($translator->isTranslated($option->getLabel())) {
$elementOptions['label'] = $option->getLabel();
} else {
$elementOptions['label'] = $option->getKey();
}

$element = $this->createElement(
$option->getElementType(),
$name,
array_merge(
[
'label' => $option->getLabel(),
'description' => $option->getDescription(),
],
$option->getOptions()
)
$option->getElementId(),
$elementOptions
);

$this->addElement($element);
Expand All @@ -95,6 +98,8 @@ public function init()
$this->removeElement(self::ELEMENT_MODEL_ID);

$this->setAttrib('class', 'admin_config');

$this->sortSections();
}

/**
Expand All @@ -104,9 +109,9 @@ public function init()
*/
public function populateFromModel($config)
{
foreach ($this->options as $name => $option) {
foreach ($this->options as $option) {
$value = Configuration::getValueFromConfig($config, $option->getKey());
$this->getElement($name)->setValue($value);
$this->getElement($option->getElementId())->setValue($value);
}
}

Expand All @@ -117,15 +122,18 @@ public function populateFromModel($config)
*/
public function updateModel($config)
{
foreach ($this->options as $name => $option) {
$value = $this->getElement($name)->getValue();
foreach ($this->options as $option) {
$value = $this->getElement($option->getElementId())->getValue();

// TODO move into Admin_Model_Option?
if (is_array($value)) {
$value = implode(',', $value);
}
if (strlen(trim($value)) === 0) {
$value = null;
}

Configuration::setValueInConfig($config, $option->getKey(), $value);
$option->setValue($value);
}
}

Expand All @@ -134,25 +142,50 @@ public function updateModel($config)
*
* If necessary a new display group is created.
*
* @param Zend_Form_Element $element Form element
* @param string $section Name of section
* @throws Zend_Form_Exception
*/
public function addElementToSection($element, $section)
public function addElementToSection(Zend_Form_Element $element, string $section): void
{
$group = $this->getDisplayGroup($section);

$translator = $this->getTranslator();
$sectionKey = self::LABEL_TRANSLATION_PREFIX . 'section_' . $section;

if (! $translator->isTranslated($sectionKey)) {
$sectionKey = ucfirst($section);
}

if ($group === null) {
$this->addDisplayGroup(
[$element],
$section,
[
'legend' => self::LABEL_TRANSLATION_PREFIX . 'section_' . $section,
'legend' => $sectionKey,
'decorators' => ['FormElements', 'Fieldset'],
]
);
} else {
$group->addElement($element);
}
}

public function sortSections(): void
{
$groups = $this->getDisplayGroups();

$names = array_keys($groups);
unset($names['actions']);

sort($names);

$sorted = [];

foreach ($names as $section) {
$sorted[$section] = $groups[$section];
}

$sorted['actions'] = $groups['actions'];

$this->setDisplayGroups($sorted);
}
}
27 changes: 18 additions & 9 deletions modules/admin/language/config.tmx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</tuv>
</tu>

<tu tuid="admin_config_section_searchopt">
<tu tuid="admin_config_section_searching">
<tuv xml:lang="en">
<seg>Search</seg>
</tuv>
Expand All @@ -53,25 +53,34 @@
</tuv>
</tu>

<tu tuid="admin_config_section_languages">
<tuv xml:lang="en">
<seg>Languages</seg>
</tuv>
<tuv xml:lang="de">
<seg>Sprachen</seg>
</tuv>
</tu>

<tu tuid="admin_config_supportedLanguages">
<tuv xml:lang="en">
<seg>Supported Languages</seg>
<seg>User Interface Languages</seg>
</tuv>
<tuv xml:lang="de">
<seg>Unterstützte Sprachen</seg>
<seg>Weboberfläche Sprachen</seg>
</tuv>
</tu>

<tu tuid="admin_config_supportedLanguages_description">
<tuv xml:lang="en">
<seg>Languages for the user interface. Select at least one.</seg>
<seg>Languages for the user interface. Select at least one (e.g. 'en').</seg>
</tuv>
<tuv xml:lang="de">
<seg>Sprachen für die Benutzeroberfläche. Mindestens eine auswählen.</seg>
<seg>Sprachen für die Benutzeroberfläche. Mindestens eine angeben (z.B. 'de').</seg>
</tuv>
</tu>

<tu tuid="admin_config_maxSearchResults">
<tu tuid="admin_config_searchengine.solr.parameterDefaults.rows">
<tuv xml:lang="en">
<seg>Default search results/page</seg>
</tuv>
Expand All @@ -80,7 +89,7 @@
</tuv>
</tu>

<tu tuid="admin_config_maxSearchResults_description">
<tu tuid="admin_config_searchengine.solr.parameterDefaults.rows_description">
<tuv xml:lang="en">
<seg>Number of results that should be display on a single page.</seg>
</tuv>
Expand All @@ -89,7 +98,7 @@
</tuv>
</tu>

<tu tuid="admin_config_seriesSortByTitle">
<tu tuid="admin_config_browsing.series.sortByTitle">
<tuv xml:lang="en">
<seg>Sort series by title</seg>
</tuv>
Expand All @@ -98,7 +107,7 @@
</tuv>
</tu>

<tu tuid="admin_config_seriesSortByTitle_description">
<tu tuid="admin_config_browsing.series.sortByTitle_description">
<tuv xml:lang="en">
<seg>Activates alphabetical sorting of series in browsing list and publish form.</seg>
</tuv>
Expand Down
Loading