From b43d01c99f1a9fcbbb40d3dbe8cd84092654d201 Mon Sep 17 00:00:00 2001 From: acanas Date: Sun, 24 Oct 2021 20:32:09 +0200 Subject: [PATCH] #include swad_setting.h --- swad_changelog.h | 3 ++- swad_setting_database.c | 42 ++++++++++++++++++++++++++------------- swad_setting_database.h | 3 ++- swad_theme.c | 44 +++++++++++++++++++---------------------- 4 files changed, 52 insertions(+), 40 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 80c75321..235a25eb 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo. */ -#define Log_PLATFORM_VERSION "SWAD 21.41.1 (2021-10-24)" +#define Log_PLATFORM_VERSION "SWAD 21.41.2 (2021-10-24)" #define CSS_FILE "swad20.45.css" #define JS_FILE "swad20.69.1.js" /* TODO: Rename CENTRE to CENTER in help wiki. TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams + Version 21.41.2: Oct 24, 2021 Query moved to module swad_setting_database. (320777 lines) Version 21.41.1: Oct 24, 2021 Queries moved to module swad_tag_database. (320767 lines) Version 21.41: Oct 24, 2021 New module swad_tag_database for database queries related to question tags. (320721 lines) Version 21.40.1: Oct 24, 2021 Queries moved to module swad_center_database. (320621 lines) diff --git a/swad_setting_database.c b/swad_setting_database.c index e96788c9..2e221d56 100644 --- a/swad_setting_database.c +++ b/swad_setting_database.c @@ -57,20 +57,6 @@ void Set_DB_UpdateMySettingsAboutLanguage (void) Gbl.Usrs.Me.UsrDat.UsrCod); } -/*****************************************************************************/ -/************** Update layout of side colums on user data table **************/ -/*****************************************************************************/ - -void Set_DB_UpdateMySettingsAboutSideCols (void) - { - DB_QueryUPDATE ("can not update your setting about side columns", - "UPDATE usr_data" - " SET SideCols=%u" - " WHERE UsrCod=%ld", - Gbl.Prefs.SideCols, - Gbl.Usrs.Me.UsrDat.UsrCod); - } - /*****************************************************************************/ /******************** Update my settings about date format *******************/ /*****************************************************************************/ @@ -127,6 +113,34 @@ void Set_DB_UpdateMySettingsAboutMenu (Mnu_Menu_t Menu) Gbl.Usrs.Me.UsrDat.UsrCod); } +/*****************************************************************************/ +/*********************** Update my settings about theme **********************/ +/*****************************************************************************/ + +void Set_DB_UpdateMySettingsAboutTheme (const char *ThemeId) + { + DB_QueryUPDATE ("can not update your setting about theme", + "UPDATE usr_data" + " SET Theme='%s'" + " WHERE UsrCod=%ld", + ThemeId, + Gbl.Usrs.Me.UsrDat.UsrCod); + } + +/*****************************************************************************/ +/************** Update layout of side colums on user data table **************/ +/*****************************************************************************/ + +void Set_DB_UpdateMySettingsAboutSideCols (void) + { + DB_QueryUPDATE ("can not update your setting about side columns", + "UPDATE usr_data" + " SET SideCols=%u" + " WHERE UsrCod=%ld", + Gbl.Prefs.SideCols, + Gbl.Usrs.Me.UsrDat.UsrCod); + } + /*****************************************************************************/ /***************** Update my settings about photo visibility *****************/ /*****************************************************************************/ diff --git a/swad_setting_database.h b/swad_setting_database.h index 60dba843..2206b217 100644 --- a/swad_setting_database.h +++ b/swad_setting_database.h @@ -41,11 +41,12 @@ //--------------------------- Global user settings ---------------------------- void Set_DB_UpdateMySettingsAboutLanguage (void); -void Set_DB_UpdateMySettingsAboutSideCols (void); void Set_DB_UpdateMySettingsAboutDateFormat (Dat_Format_t DateFormat); void Set_DB_UpdateMySettingsAboutFirstDayOfWeek (unsigned FirstDayOfWeek); void Set_DB_UpdateMySettingsAboutIconSet (const char *IconSetId); void Set_DB_UpdateMySettingsAboutMenu (Mnu_Menu_t Menu); +void Set_DB_UpdateMySettingsAboutTheme (const char *ThemeId); +void Set_DB_UpdateMySettingsAboutSideCols (void); void Set_DB_UpdateMySettingsAboutPhoto (void); void Set_DB_UpdateMySettingsAboutBasicProfile (void); void Set_DB_UpdateMySettingsAboutExtendedProfile (void); diff --git a/swad_theme.c b/swad_theme.c index 719ff478..cd79aa7e 100644 --- a/swad_theme.c +++ b/swad_theme.c @@ -37,6 +37,7 @@ #include "swad_layout.h" #include "swad_parameter.h" #include "swad_setting.h" +#include "swad_setting_database.h" #include "swad_theme.h" /*****************************************************************************/ @@ -321,24 +322,24 @@ void The_PutIconsToSelectTheme (void) Box_BoxBegin (NULL,Txt_Theme_SKIN, The_PutIconsTheme,NULL, Hlp_PROFILE_Settings_theme,Box_NOT_CLOSABLE); - Set_BeginSettingsHead (); - Set_BeginOneSettingSelector (); - for (Theme = (The_Theme_t) 0; - Theme <= (The_Theme_t) (The_NUM_THEMES - 1); - Theme++) - { - HTM_DIV_Begin ("class=\"%s\"",Theme == Gbl.Prefs.Theme ? "PREF_ON" : - "PREF_OFF"); - Frm_BeginForm (ActChgThe); - Par_PutHiddenParamString (NULL,"Theme",The_ThemeId[Theme]); - snprintf (Icon,sizeof (Icon),"%s/%s/theme_32x20.gif", - Cfg_ICON_FOLDER_THEMES,The_ThemeId[Theme]); - Ico_PutSettingIconLink (Icon,The_ThemeNames[Theme]); - Frm_EndForm (); - HTM_DIV_End (); - } - Set_EndOneSettingSelector (); - Set_EndSettingsHead (); + Set_BeginSettingsHead (); + Set_BeginOneSettingSelector (); + for (Theme = (The_Theme_t) 0; + Theme <= (The_Theme_t) (The_NUM_THEMES - 1); + Theme++) + { + HTM_DIV_Begin ("class=\"%s\"",Theme == Gbl.Prefs.Theme ? "PREF_ON" : + "PREF_OFF"); + Frm_BeginForm (ActChgThe); + Par_PutHiddenParamString (NULL,"Theme",The_ThemeId[Theme]); + snprintf (Icon,sizeof (Icon),"%s/%s/theme_32x20.gif", + Cfg_ICON_FOLDER_THEMES,The_ThemeId[Theme]); + Ico_PutSettingIconLink (Icon,The_ThemeNames[Theme]); + Frm_EndForm (); + HTM_DIV_End (); + } + Set_EndOneSettingSelector (); + Set_EndSettingsHead (); Box_BoxEnd (); } @@ -370,12 +371,7 @@ void The_ChangeTheme (void) /***** Store theme in database *****/ if (Gbl.Usrs.Me.Logged) - DB_QueryUPDATE ("can not update your setting about theme", - "UPDATE usr_data" - " SET Theme='%s'" - " WHERE UsrCod=%ld", - The_ThemeId[Gbl.Prefs.Theme], - Gbl.Usrs.Me.UsrDat.UsrCod); + Set_DB_UpdateMySettingsAboutTheme (The_ThemeId[Gbl.Prefs.Theme]); /***** Set settings from current IP *****/ Set_SetSettingsFromIP ();