From b170478abcb479f82a24dbf5157218170644f7f3 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Wed, 30 Sep 2026 10:33:56 +0200 Subject: [PATCH] fontsize watcher in appconfig verschoben fontsize config umbenannt fontsize in die lvverwaltung hinzugefuegt --- .../controllers/api/frontend/v1/lv/Config.php | 40 +++++++++++++++++-- .../api/frontend/v1/stv/Config.php | 6 +-- public/js/components/AppConfig.js | 20 +++++++++- .../js/components/Stv/Studentenverwaltung.js | 16 -------- system/dbupdate_3.4.php | 2 +- system/dbupdate_3.4/68744_StV_settings.php | 16 -------- .../83591_lvverwaltung_zoom_faktor.php | 21 ++++++++++ 7 files changed, 80 insertions(+), 41 deletions(-) delete mode 100644 system/dbupdate_3.4/68744_StV_settings.php create mode 100644 system/dbupdate_3.4/83591_lvverwaltung_zoom_faktor.php diff --git a/application/controllers/api/frontend/v1/lv/Config.php b/application/controllers/api/frontend/v1/lv/Config.php index 4f39c6b8b..3c4019eb8 100644 --- a/application/controllers/api/frontend/v1/lv/Config.php +++ b/application/controllers/api/frontend/v1/lv/Config.php @@ -19,12 +19,12 @@ class Config extends FHCAPI_Controller $this->_setAuthUID(); $this->loadPhrases([ - 'lehre' + 'lehre', + 'stv' ]); $this->_ci->load->library('VariableLib', ['uid' => $this->_uid]); $this->_ci->load->library('PermissionLib'); - } @@ -55,15 +55,47 @@ class Config extends FHCAPI_Controller "value" => $ignore_reservierung, ]; + $result = $this->VariableModel->getVariables(getAuthUID(), ['font_size']); + $data = $this->getDataOrTerminateWithError($result); + $config['font_size'] = [ + "type" => "select", + "label" => $this->p->t('stv', 'settings_fontsize'), + "value" => $data['font_size'] ?? "fs_normal", + "options" => [ + "fs_xx-small" => $this->p->t('stv', 'settings_fontsize_xx-small'), + "fs_x-small" => $this->p->t('stv', 'settings_fontsize_x-small'), + "fs_small" => $this->p->t('stv', 'settings_fontsize_small'), + "fs_normal" => $this->p->t('stv', 'settings_fontsize_normal'), + "fs_big" => $this->p->t('stv', 'settings_fontsize_big'), + "fs_huge" => $this->p->t('stv', 'settings_fontsize_huge') + ] + ]; + $this->terminateWithSuccess($config); } public function set() { + $this->load->model('system/Variable_model', 'VariableModel'); + $this->load->library('form_validation'); + + $this->form_validation->set_rules( + 'font_size', + $this->p->t('stv', 'settings_fontsize'), + 'required|in_list[fs_xx-small,fs_x-small,fs_small,fs_normal,fs_big,fs_huge]' + ); + + if (!$this->form_validation->run()) + $this->terminateWithValidationErrors($this->form_validation->error_array()); + + $this->VariableModel->setVariable( + getAuthUID(), + 'font_size', + $this->input->post('font_size') + ); + if (!($this->permissionlib->isBerechtigt('basis/tempus')) && !($this->permissionlib->isBerechtigt('lv-plan'))) $this->terminateWithSuccess([]); - $this->load->model('system/Variable_model', 'VariableModel'); - foreach (['ignore_kollision','ignore_zeitsperre','ignore_reservierung'] as $variable) { if ($this->_ci->input->post($variable) !== null) diff --git a/application/controllers/api/frontend/v1/stv/Config.php b/application/controllers/api/frontend/v1/stv/Config.php index cc6c04430..0b859e06d 100644 --- a/application/controllers/api/frontend/v1/stv/Config.php +++ b/application/controllers/api/frontend/v1/stv/Config.php @@ -80,12 +80,12 @@ class Config extends FHCAPI_Controller ]; #font_size - $result = $this->VariableModel->getVariables(getAuthUID(), ['stv_font_size']); + $result = $this->VariableModel->getVariables(getAuthUID(), ['font_size']); $data = $this->getDataOrTerminateWithError($result); $config['font_size'] = [ "type" => "select", "label" => $this->p->t('stv', 'settings_fontsize'), - "value" => $data['stv_font_size'] ?? "fs_normal", + "value" => $data['font_size'] ?? "fs_normal", "options" => [ "fs_xx-small" => $this->p->t('stv', 'settings_fontsize_xx-small'), "fs_x-small" => $this->p->t('stv', 'settings_fontsize_x-small'), @@ -136,7 +136,7 @@ class Config extends FHCAPI_Controller ); $this->VariableModel->setVariable( getAuthUID(), - 'stv_font_size', + 'font_size', $this->input->post('font_size') ); diff --git a/public/js/components/AppConfig.js b/public/js/components/AppConfig.js index b6b6aaeac..df8e14a1d 100644 --- a/public/js/components/AppConfig.js +++ b/public/js/components/AppConfig.js @@ -66,10 +66,28 @@ export default { }) .catch(this.$fhcAlert.handleSystemErrors); } - } + }, + 'modelValue.font_size'(fontSize) { + this.applyFontSize(fontSize); + }, }, methods: { + applyFontSize(fontSize) { + const options = this.setup.font_size?.options; + + if (!fontSize || !options) + return; + + Object.keys(options).forEach(cn => document.documentElement.classList.remove(cn)); + document.documentElement.classList.add(fontSize); + + document.querySelectorAll('.tabulator').forEach(el => { + const tabulators = Tabulator.findTable(el); + if (tabulators) + tabulators[0].searchRows().forEach(row => row.normalizeHeight()); + }); + }, update() { this.$refs.form .call(this.endpoints.set(this.tempValues)) diff --git a/public/js/components/Stv/Studentenverwaltung.js b/public/js/components/Stv/Studentenverwaltung.js index b9ee54526..da3ec5244 100644 --- a/public/js/components/Stv/Studentenverwaltung.js +++ b/public/js/components/Stv/Studentenverwaltung.js @@ -295,22 +295,6 @@ export default { this.$refs.stvList.updateUrl(n || []); } }, - 'appconfig.font_size'() { - // add to html class - const classList = Object.keys(this.$refs.config.setup.font_size.options); - classList.forEach(cn => document.documentElement.classList.remove(cn)); - document.documentElement.classList.add(this.appconfig.font_size); - // recalc Tabulator heights - if (this.$el) { - const tabulatorEls = this.$el.querySelectorAll('.tabulator'); - for (const el of tabulatorEls) { - const tabulators = Tabulator.findTable(el); - if (tabulators) { - tabulators[0].searchRows().forEach(row => row.normalizeHeight()); - } - } - } - }, sidebarCollapsed(newVal) { if(newVal) this.$refs.hSplit.collapseLeft() else this.$refs.hSplit.showBoth() diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index 0392937ec..f621912cc 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -87,7 +87,6 @@ require_once('dbupdate_3.4/62063_lv_evaluierung.php'); require_once('dbupdate_3.4/67490_studstatus_suche_abort_controller_haengt.php'); require_once('dbupdate_3.4/61164_abgabetool_quality_gates.php'); require_once('dbupdate_3.4/69065_Projektarbeiten_Firmen_verwalten.php'); -require_once('dbupdate_3.4/68744_StV_settings.php'); require_once('dbupdate_3.4/62889_reihungstest_ueberwachung_mit_constructor.php'); require_once('dbupdate_3.4/71399_dashboard_update_widget_paths.php'); require_once('dbupdate_3.4/71645_studvw_messagetab_ladezeit.php'); @@ -103,6 +102,7 @@ require_once('dbupdate_3.4/76160_lvv_favorites.php'); require_once('dbupdate_3.4/77080_tabulator_presets_table.php'); require_once('dbupdate_3.4/78292_gehaltsanpassungtyp.php'); require_once('dbupdate_3.4/54225_reihungstest_ablauf_fuer_quereinsteiger.php'); +require_once('dbupdate_3.4/83591_lvverwaltung_zoom_faktor.php'); // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen diff --git a/system/dbupdate_3.4/68744_StV_settings.php b/system/dbupdate_3.4/68744_StV_settings.php deleted file mode 100644 index 73b105ce0..000000000 --- a/system/dbupdate_3.4/68744_StV_settings.php +++ /dev/null @@ -1,16 +0,0 @@ -db_query("SELECT 1 FROM public.tbl_variablenname WHERE name = 'stv_font_size';")) -{ - if ($db->db_num_rows($result) == 0) - { - $qry = "INSERT INTO public.tbl_variablenname(name, defaultwert) VALUES('stv_font_size', null);"; - - if (!$db->db_query($qry)) - echo 'public.tbl_variablenname '.$db->db_last_error().'
'; - else - echo 'public.tbl_variablenname: Added name "stv_font_size"
'; - } -} diff --git a/system/dbupdate_3.4/83591_lvverwaltung_zoom_faktor.php b/system/dbupdate_3.4/83591_lvverwaltung_zoom_faktor.php new file mode 100644 index 000000000..ba6aa2f40 --- /dev/null +++ b/system/dbupdate_3.4/83591_lvverwaltung_zoom_faktor.php @@ -0,0 +1,21 @@ +db_query("SELECT 1 FROM public.tbl_variablenname WHERE name = 'font_size';")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = "INSERT INTO public.tbl_variablenname(name, defaultwert) VALUES('font_size', null); + UPDATE public.tbl_variable SET name = 'font_size' WHERE name = 'stv_font_size'; + DELETE FROM public.tbl_variablenname WHERE name = 'stv_font_size'; +"; + + if (!$db->db_query($qry)) + echo 'public.tbl_variablenname '.$db->db_last_error().'
'; + else + echo 'public.tbl_variablenname: Added name "font_size"
'; + echo 'public.tbl_variable: Updated name "stv_font_size" to "font_size"
'; + echo 'public.tbl_variablenname: Deleted name "stv_font_size"
'; + } +}