diff --git a/application/Module.php b/application/Module.php index d836526cd..e8db94e26 100644 --- a/application/Module.php +++ b/application/Module.php @@ -22,7 +22,7 @@ class Module extends AbstractModule /** * This Omeka version. */ - const VERSION = '4.2.0-alpha'; + const VERSION = '4.2.0-alpha.1'; /** * The vocabulary IRI used to define Omeka application data. diff --git a/application/data/migrations/20240614123811_MigrateDefaultToPrivateSetting.php b/application/data/migrations/20240614123811_MigrateDefaultToPrivateSetting.php new file mode 100644 index 000000000..7929de9db --- /dev/null +++ b/application/data/migrations/20240614123811_MigrateDefaultToPrivateSetting.php @@ -0,0 +1,32 @@ +get('Omeka\Settings')); + } + + public function __construct($settings) + { + $this->settings = $settings; + } + + public function up(Connection $conn) + { + // Migrate from the general "default_to_private" setting to granular settings. + $defaultToPrivate = (bool) $this->settings->get('default_to_private', false); + $this->settings->set('default_to_private_items', $defaultToPrivate); + $this->settings->set('default_to_private_item_sets', $defaultToPrivate); + $this->settings->set('default_to_private_sites', $defaultToPrivate); + $this->settings->set('default_to_private_site_pages', $defaultToPrivate); + $this->settings->delete('default_to_private'); + } +} diff --git a/application/src/Form/SettingForm.php b/application/src/Form/SettingForm.php index 9e7b98f45..8f262c1a3 100644 --- a/application/src/Form/SettingForm.php +++ b/application/src/Form/SettingForm.php @@ -284,19 +284,38 @@ public function init() // Editing element group - $this->add([ - 'name' => 'default_to_private', - 'type' => 'Checkbox', - 'options' => [ - 'element_group' => 'editing', - 'label' => 'Default content visibility to Private', // @translate - 'info' => 'If checked, all items, item sets and sites newly created will have their visibility set to private by default.', // @translate - ], - 'attributes' => [ - 'value' => $this->settings->get('default_to_private'), - 'id' => 'default_to_private', - ], - ]); + $defaultToPrivateElements = [ + [ + 'name' => 'default_to_private_items', + 'label' => 'Set default item visibility to private', // @translate + ], + [ + 'name' => 'default_to_private_item_sets', + 'label' => 'Set default item set visibility to private', // @translate + ], + [ + 'name' => 'default_to_private_sites', + 'label' => 'Set default site visibility to private', // @translate + ], + [ + 'name' => 'default_to_private_site_pages', + 'label' => 'Set default site page visibility to private', // @translate + ], + ]; + foreach ($defaultToPrivateElements as $defaultToPrivateElement) { + $this->add([ + 'type' => 'checkbox', + 'name' => $defaultToPrivateElement['name'], + 'options' => [ + 'element_group' => 'editing', + 'label' => $defaultToPrivateElement['label'], + ], + 'attributes' => [ + 'id' => $defaultToPrivateElement['name'], + 'value' => $this->settings->get($defaultToPrivateElement['name'], false), + ], + ]); + } $this->add([ 'name' => 'value_languages', diff --git a/application/view/omeka/admin/item-set/form.phtml b/application/view/omeka/admin/item-set/form.phtml index b3cb72f6a..d9f31199c 100644 --- a/application/view/omeka/admin/item-set/form.phtml +++ b/application/view/omeka/admin/item-set/form.phtml @@ -37,7 +37,7 @@ $form->prepare(); - isPublic() || (!isset($itemSet) && !$this->setting('default_to_private')) ): ?> + isPublic() || (!isset($itemSet) && !$this->setting('default_to_private_item_sets')) ): ?> hyperlink('', '#', [ 'class' => 'o-icon-public button', 'title' => $translate('Make private'), diff --git a/application/view/omeka/admin/item/form.phtml b/application/view/omeka/admin/item/form.phtml index c0bf05b0f..5ca207c65 100644 --- a/application/view/omeka/admin/item/form.phtml +++ b/application/view/omeka/admin/item/form.phtml @@ -46,7 +46,7 @@ $form->prepare();
- isPublic() || (!isset($item)) && !$this->setting('default_to_private')) : ?> + isPublic() || (!isset($item)) && !$this->setting('default_to_private_items')) : ?> hyperlink('', '#', [ 'class' => 'o-icon-public button', 'title' => $translate('Make private'), diff --git a/application/view/omeka/site-admin/index/add-page.phtml b/application/view/omeka/site-admin/index/add-page.phtml index 217de3e1d..ee2eb0764 100644 --- a/application/view/omeka/site-admin/index/add-page.phtml +++ b/application/view/omeka/site-admin/index/add-page.phtml @@ -6,7 +6,7 @@ $form->prepare(); pageTitle($translate('New page'), 1, $translate('Pages')); ?> form()->openTag($form); ?>
- setting('default_to_private')) : ?> + setting('default_to_private_site_pages')) : ?> hyperlink('', '#', [ 'class' => 'o-icon-private button', 'title' => $translate('Make public'), diff --git a/application/view/omeka/site-admin/index/add.phtml b/application/view/omeka/site-admin/index/add.phtml index 1d4653a86..10e49b331 100644 --- a/application/view/omeka/site-admin/index/add.phtml +++ b/application/view/omeka/site-admin/index/add.phtml @@ -14,7 +14,7 @@ $fallbackThumbnailUrl = $this->assetUrl('img/theme.jpg', 'Omeka'); form()->openTag($form); ?>
- setting('default_to_private')) : ?> + setting('default_to_private_sites')) : ?> hyperlink('', '#', [ 'class' => 'o-icon-private button', 'title' => $translate('Make public'),