From c4f18a59197f1d6e99d25444d7d70ad7d40a6cbb Mon Sep 17 00:00:00 2001 From: Alexander Walther Date: Sat, 10 Feb 2024 20:19:28 +0100 Subject: [PATCH 1/2] =?UTF-8?q?YCom=20Model=20Classes=20optional=20deaktiv?= =?UTF-8?q?ieren=20k=C3=B6nnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- boot.php | 4 +++- package.yml | 3 +++ plugins/auth/pages/settings.php | 24 ++++++++++++++++++++++++ plugins/group/boot.php | 4 +++- 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/boot.php b/boot.php index ffc87f27..a0a237a4 100644 --- a/boot.php +++ b/boot.php @@ -30,7 +30,9 @@ } rex_ycom::addTable(rex::getTablePrefix() . 'ycom_user'); -rex_yform_manager_dataset::setModelClass(rex::getTablePrefix() . 'ycom_user', rex_ycom_user::class); +if(rex_config::get('ycom', 'auto_model_class') === true) { + rex_yform_manager_dataset::setModelClass(rex::getTablePrefix() . 'ycom_user', rex_ycom_user::class); +} if (rex::isBackend() && ('index.php?page=content/edit' == rex_url::currentBackendPage() || 'mediapool' == rex_be_controller::getCurrentPagePart(1))) { rex_view::addJsFile($this->getAssetsUrl('ycom_backend.js')); diff --git a/package.yml b/package.yml index 4aed46cb..af26943c 100644 --- a/package.yml +++ b/package.yml @@ -26,3 +26,6 @@ requires: system_plugins: - auth - group + +default_config: + auto_model_class: "true" diff --git a/plugins/auth/pages/settings.php b/plugins/auth/pages/settings.php index c846e6a6..cd89c052 100644 --- a/plugins/auth/pages/settings.php +++ b/plugins/auth/pages/settings.php @@ -31,6 +31,7 @@ $this->setConfig('login_field', stripslashes(str_replace('"', '', rex_request('login_field', 'string')))); $this->setConfig('session_max_overall_duration', rex_request('session_max_overall_duration', 'int')); $this->setConfig('session_duration', rex_request('session_duration', 'int')); + $this->setConfig('auto_model_class', rex_request('session_duration', 'bool')); echo rex_view::success($this->i18n('ycom_auth_settings_updated')); } @@ -71,6 +72,14 @@ $sel_authcookiettl->addOption($this->i18n('ycom_days', 30), '30'); $sel_authcookiettl->addOption($this->i18n('ycom_days', 90), '90'); +$sel_auto_model_class = new rex_select(); +$sel_auto_model_class->setId('auto_model_class'); +$sel_auto_model_class->setName('auto_model_class'); +$sel_auto_model_class->setSize(1); +$sel_auto_model_class->addOption('Ja', '1'); +$sel_auto_model_class->addOption('Nein', '0'); +$sel_auto_model_class->setSelected($this->getConfig('auto_model_class')); + $content .= '
@@ -200,6 +209,7 @@ +
' . $this->i18n('ycom_auth_config_security') . ' @@ -258,6 +268,20 @@
+ +
+ ' . $this->i18n('ycom_auto_model_class') . ' +
+
+ ' . $this->i18n('ycom_auto_model_class') . ' +
+
+
+ ' . $sel_auto_model_class->get() . ' +
+
+
+
diff --git a/plugins/group/boot.php b/plugins/group/boot.php index 76cbf76f..c044cc5a 100644 --- a/plugins/group/boot.php +++ b/plugins/group/boot.php @@ -5,7 +5,9 @@ * @psalm-scope-this rex_addon */ -rex_yform_manager_dataset::setModelClass(rex::getTablePrefix() . 'ycom_group', rex_ycom_group::class); + if(rex_config::get('ycom', 'auto_model_class') === true) { + rex_yform_manager_dataset::setModelClass(rex::getTablePrefix() . 'ycom_group', rex_ycom_group::class); +} rex_ycom::addTable(rex::getTablePrefix() . 'ycom_group'); if (rex::isBackend()) { From ae7357a33a6189c799476a94464c2f387e13728e Mon Sep 17 00:00:00 2001 From: Alexander Walther Date: Sat, 10 Feb 2024 20:51:01 +0100 Subject: [PATCH 2/2] Update package.yml --- package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.yml b/package.yml index af26943c..e58766ad 100644 --- a/package.yml +++ b/package.yml @@ -28,4 +28,4 @@ system_plugins: - group default_config: - auto_model_class: "true" + auto_model_class: true