Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix untranslated settings yes/no choices (#1772) #1779

Merged
merged 1 commit into from
Mar 20, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ protected function addField($name)
{
switch ($name) {
case 'stripExtensions':
$this->form->setWidget($name, new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']));
$options = [$this->i18n->__('No'), $this->i18n->__('Yes')];
$this->form->setWidget($name, new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']));
$this->form->setValidator($name, new sfValidatorInteger(['required' => false]));

break;
Expand Down
3 changes: 2 additions & 1 deletion apps/qubit/modules/settings/actions/markdownAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ protected function addField($name)

$this->form->setDefault($name, $default);
$this->form->setValidator($name, new sfValidatorInteger(['required' => false]));
$this->form->setWidget($name, new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']));
$options = [$this->i18n->__('No'), $this->i18n->__('Yes')];
$this->form->setWidget($name, new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']));

break;
}
Expand Down
6 changes: 4 additions & 2 deletions apps/qubit/modules/settings/actions/securityAction.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ protected function addField($name)
break;

case 'require_ssl_admin':
$this->form->setWidget($name, new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']));
$options = [$this->i18n->__('No'), $this->i18n->__('Yes')];
$this->form->setWidget($name, new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']));
$this->form->setValidator($name, new sfValidatorInteger(['required' => false]));
$labelText = $this->i18n->__('Require SSL for all administrator functionality');
$this->form->getWidgetSchema()->{$name}->setLabel($labelText);

break;

case 'require_strong_passwords':
$this->form->setWidget($name, new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']));
$options = [$this->i18n->__('No'), $this->i18n->__('Yes')];
$this->form->setWidget($name, new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']));
$this->form->setValidator($name, new sfValidatorInteger(['required' => false]));
$labelText = $this->i18n->__('Require strong passwords');
$this->form->getWidgetSchema()->{$name}->setLabel($labelText);
Expand Down
19 changes: 10 additions & 9 deletions lib/form/SettingsGlobalForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,30 @@ class SettingsGlobalForm extends sfForm
public function configure()
{
$this->i18n = sfContext::getInstance()->i18n;
$options = [$this->i18n->__('No'), $this->i18n->__('Yes')];

// Build widgets
$this->setWidgets([
'version' => new sfWidgetFormInput([], ['class' => 'disabled', 'disabled' => true]),
'check_for_updates' => new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']),
'check_for_updates' => new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']),
'hits_per_page' => new sfWidgetFormInput(),
'escape_queries' => new sfWidgetFormInput(),
'sort_browser_user' => new sfWidgetFormSelectRadio(['choices' => ['alphabetic' => $this->i18n->__('title/name'), 'lastUpdated' => $this->i18n->__('date modified'), 'identifier' => $this->i18n->__('identifier'), 'referenceCode' => $this->i18n->__('reference code')]], ['class' => 'radio']),
'sort_browser_anonymous' => new sfWidgetFormSelectRadio(['choices' => ['alphabetic' => $this->i18n->__('title/name'), 'lastUpdated' => $this->i18n->__('date modified'), 'identifier' => $this->i18n->__('identifier'), 'referenceCode' => $this->i18n->__('reference code')]], ['class' => 'radio']),
'default_repository_browse_view' => new sfWidgetFormSelectRadio(['choices' => ['card' => $this->i18n->__('card'), 'table' => $this->i18n->__('table')]], ['class' => 'radio']),
'default_archival_description_browse_view' => new sfWidgetFormSelectRadio(['choices' => ['card' => $this->i18n->__('card'), 'table' => $this->i18n->__('table')]], ['class' => 'radio']),
'multi_repository' => new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']),
'enable_institutional_scoping' => new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']),
'audit_log_enabled' => new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']),
'show_tooltips' => new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']),
'multi_repository' => new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']),
'enable_institutional_scoping' => new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']),
'audit_log_enabled' => new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']),
'show_tooltips' => new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']),
'slug_basis_informationobject' => $this->getSlugBasisInformationObjectWidget(),
'permissive_slug_creation' => new sfWidgetFormSelectRadio(['choices' => [QubitSlug::SLUG_PERMISSIVE => 'yes', QubitSlug::SLUG_RESTRICTIVE => 'no']], ['class' => 'radio']),
'permissive_slug_creation' => new sfWidgetFormSelectRadio(['choices' => [QubitSlug::SLUG_PERMISSIVE => $this->i18n->__('Yes'), QubitSlug::SLUG_RESTRICTIVE => $this->i18n->__('No')]], ['class' => 'radio']),
'defaultPubStatus' => new sfWidgetFormSelectRadio(['choices' => [QubitTerm::PUBLICATION_STATUS_DRAFT_ID => $this->i18n->__('Draft'), QubitTerm::PUBLICATION_STATUS_PUBLISHED_ID => $this->i18n->__('Published')]], ['class' => 'radio']),
'draft_notification_enabled' => new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']),
'draft_notification_enabled' => new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']),
'sword_deposit_dir' => new sfWidgetFormInput(),
'google_maps_api_key' => new sfWidgetFormInput(),
'generate_reports_as_pub_user' => new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']),
'cache_xml_on_save' => new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']),
'generate_reports_as_pub_user' => new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']),
'cache_xml_on_save' => new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']),
]);

// Add labels
Expand Down
7 changes: 5 additions & 2 deletions lib/form/SettingsPermissionsCopyrightStatementForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ public function configure()
$this->widgetSchema->setNameFormat('copyrightStatement[%s]');
$this->getValidatorSchema()->setOption('allow_extra_fields', true);

$this->setWidget('copyrightStatementEnabled', new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']));
$this->i18n = sfContext::getInstance()->i18n;
$options = [$this->i18n->__('No'), $this->i18n->__('Yes')];

$this->setWidget('copyrightStatementEnabled', new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']));
$this->setValidator('copyrightStatementEnabled', new sfValidatorInteger(['required' => false]));

$default = false;
Expand All @@ -42,7 +45,7 @@ public function configure()
$this->setDefault('copyrightStatement', $setting->getValue());
}

$this->setWidget('copyrightStatementApplyGlobally', new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']));
$this->setWidget('copyrightStatementApplyGlobally', new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']));
$this->setValidator('copyrightStatementApplyGlobally', new sfValidatorInteger(['required' => false]));

$default = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ public function configure()
$this->widgetSchema->setNameFormat('preservationSystemAccessStatement[%s]');
$this->getValidatorSchema()->setOption('allow_extra_fields', true);

$this->setWidget('preservationSystemAccessStatementEnabled', new sfWidgetFormSelectRadio(['choices' => [1 => 'yes', 0 => 'no']], ['class' => 'radio']));
$this->i18n = sfContext::getInstance()->i18n;
$options = [$this->i18n->__('No'), $this->i18n->__('Yes')];

$this->setWidget('preservationSystemAccessStatementEnabled', new sfWidgetFormSelectRadio(['choices' => $options], ['class' => 'radio']));
$this->setValidator('preservationSystemAccessStatementEnabled', new sfValidatorInteger(['required' => false]));

$default = false;
Expand Down
Loading