mirror of https://github.com/acanas/swad-core.git
Version 20.87.1: Jun 01, 2021 Database function moved from swad_calendar to swad_setting.
This commit is contained in:
parent
535385c27f
commit
9ea5a0eeec
143
swad_calendar.c
143
swad_calendar.c
|
@ -87,10 +87,10 @@ void Cal_PutIconsToSelectFirstDayOfWeek (void)
|
|||
Box_BoxBegin (NULL,Txt_Calendar,
|
||||
Cal_PutIconsFirstDayOfWeek,NULL,
|
||||
Hlp_PROFILE_Settings_calendar,Box_NOT_CLOSABLE);
|
||||
Set_BeginSettingsHead ();
|
||||
Cal_ShowFormToSelFirstDayOfWeek (ActChg1stDay,
|
||||
NULL,NULL);
|
||||
Set_EndSettingsHead ();
|
||||
Set_BeginSettingsHead ();
|
||||
Cal_ShowFormToSelFirstDayOfWeek (ActChg1stDay,
|
||||
NULL,NULL);
|
||||
Set_EndSettingsHead ();
|
||||
Box_BoxEnd ();
|
||||
}
|
||||
|
||||
|
@ -117,26 +117,26 @@ void Cal_ShowFormToSelFirstDayOfWeek (Act_Action_t Action,
|
|||
char Icon[32 + 1];
|
||||
|
||||
Set_BeginOneSettingSelector ();
|
||||
for (FirstDayOfWeek = 0; // Monday
|
||||
FirstDayOfWeek <= 6; // Sunday
|
||||
FirstDayOfWeek++)
|
||||
if (Cal_DayIsValidAsFirstDayOfWeek[FirstDayOfWeek])
|
||||
{
|
||||
HTM_DIV_Begin ("class=\"%s\"",
|
||||
FirstDayOfWeek == Gbl.Prefs.FirstDayOfWeek ? "PREF_ON" :
|
||||
"PREF_OFF");
|
||||
Frm_BeginForm (Action);
|
||||
Par_PutHiddenParamUnsigned (NULL,"FirstDayOfWeek",FirstDayOfWeek);
|
||||
if (FuncParams) // Extra parameters depending on the action
|
||||
FuncParams (Args);
|
||||
snprintf (Icon,sizeof (Icon),"first-day-of-week-%u.png",FirstDayOfWeek);
|
||||
Ico_PutSettingIconLink (Icon,
|
||||
Str_BuildStringStr (Txt_First_day_of_the_week_X,
|
||||
Txt_DAYS_SMALL[FirstDayOfWeek]));
|
||||
Str_FreeString ();
|
||||
Frm_EndForm ();
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
for (FirstDayOfWeek = 0; // Monday
|
||||
FirstDayOfWeek <= 6; // Sunday
|
||||
FirstDayOfWeek++)
|
||||
if (Cal_DayIsValidAsFirstDayOfWeek[FirstDayOfWeek])
|
||||
{
|
||||
HTM_DIV_Begin ("class=\"%s\"",
|
||||
FirstDayOfWeek == Gbl.Prefs.FirstDayOfWeek ? "PREF_ON" :
|
||||
"PREF_OFF");
|
||||
Frm_BeginForm (Action);
|
||||
Par_PutHiddenParamUnsigned (NULL,"FirstDayOfWeek",FirstDayOfWeek);
|
||||
if (FuncParams) // Extra parameters depending on the action
|
||||
FuncParams (Args);
|
||||
snprintf (Icon,sizeof (Icon),"first-day-of-week-%u.png",FirstDayOfWeek);
|
||||
Ico_PutSettingIconLink (Icon,
|
||||
Str_BuildStringStr (Txt_First_day_of_the_week_X,
|
||||
Txt_DAYS_SMALL[FirstDayOfWeek]));
|
||||
Str_FreeString ();
|
||||
Frm_EndForm ();
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
Set_EndOneSettingSelector ();
|
||||
}
|
||||
|
||||
|
@ -151,12 +151,7 @@ void Cal_ChangeFirstDayOfWeek (void)
|
|||
|
||||
/***** Store icon first day of week database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
DB_QueryUPDATE ("can not update your setting about first day of week",
|
||||
"UPDATE usr_data"
|
||||
" SET FirstDayOfWeek=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Prefs.FirstDayOfWeek,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
Set_DB_ChangeFirstDayOfWeek (Gbl.Prefs.FirstDayOfWeek);
|
||||
|
||||
/***** Set settings from current IP *****/
|
||||
Set_SetSettingsFromIP ();
|
||||
|
@ -212,17 +207,17 @@ void Cal_DrawCurrentMonth (void)
|
|||
|
||||
/* Write script to draw the month */
|
||||
HTM_SCRIPT_Begin (NULL,NULL);
|
||||
HTM_Txt ("\tGbl_HTMLContent = '';");
|
||||
HTM_TxtF ("\tDrawCurrentMonth ('CurrentMonth',%u,%ld,%ld,'%s/%s',",
|
||||
Gbl.Prefs.FirstDayOfWeek,
|
||||
(long) Gbl.StartExecutionTimeUTC,
|
||||
Gbl.Hierarchy.Ctr.PlcCod,
|
||||
Cfg_URL_SWAD_CGI,
|
||||
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||
Frm_SetParamsForm (ParamsStr,ActSeeCal,true);
|
||||
HTM_TxtF ("'%s',",ParamsStr);
|
||||
Frm_SetParamsForm (ParamsStr,ActSeeDatCfe,true);
|
||||
HTM_TxtF ("'%s');",ParamsStr);
|
||||
HTM_Txt ("\tGbl_HTMLContent = '';");
|
||||
HTM_TxtF ("\tDrawCurrentMonth ('CurrentMonth',%u,%ld,%ld,'%s/%s',",
|
||||
Gbl.Prefs.FirstDayOfWeek,
|
||||
(long) Gbl.StartExecutionTimeUTC,
|
||||
Gbl.Hierarchy.Ctr.PlcCod,
|
||||
Cfg_URL_SWAD_CGI,
|
||||
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||
Frm_SetParamsForm (ParamsStr,ActSeeCal,true);
|
||||
HTM_TxtF ("'%s',",ParamsStr);
|
||||
Frm_SetParamsForm (ParamsStr,ActSeeDatCfe,true);
|
||||
HTM_TxtF ("'%s');",ParamsStr);
|
||||
HTM_SCRIPT_End ();
|
||||
}
|
||||
|
||||
|
@ -258,41 +253,43 @@ static void Cal_DrawCalendar (Act_Action_t ActionSeeCalendar,
|
|||
FunctionToDrawContextualIcons,Args,
|
||||
PrintView ? NULL :
|
||||
Hlp_START_Calendar,Box_NOT_CLOSABLE);
|
||||
Lay_WriteHeaderClassPhoto (PrintView,false,
|
||||
Gbl.Hierarchy.Ins.InsCod,
|
||||
Gbl.Hierarchy.Deg.DegCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Preference selector to change first day of week *****/
|
||||
if (!PrintView)
|
||||
{
|
||||
Set_BeginSettingsHead ();
|
||||
Cal_ShowFormToSelFirstDayOfWeek (ActionChangeCalendar1stDay,
|
||||
NULL,NULL);
|
||||
Set_EndSettingsHead ();
|
||||
}
|
||||
/***** Write header *****/
|
||||
Lay_WriteHeaderClassPhoto (PrintView,false,
|
||||
Gbl.Hierarchy.Ins.InsCod,
|
||||
Gbl.Hierarchy.Deg.DegCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Draw several months *****/
|
||||
/* JavaScript will write HTML here */
|
||||
HTM_DIV_Begin ("id=\"calendar\"");
|
||||
HTM_DIV_End ();
|
||||
/***** Preference selector to change first day of week *****/
|
||||
if (!PrintView)
|
||||
{
|
||||
Set_BeginSettingsHead ();
|
||||
Cal_ShowFormToSelFirstDayOfWeek (ActionChangeCalendar1stDay,
|
||||
NULL,NULL);
|
||||
Set_EndSettingsHead ();
|
||||
}
|
||||
|
||||
/* Write script to draw the month */
|
||||
HTM_SCRIPT_Begin (NULL,NULL);
|
||||
HTM_Txt ("\tGbl_HTMLContent = '';");
|
||||
HTM_TxtF ("\tCal_DrawCalendar('calendar',%u,%ld,%ld,%s,'%s/%s',",
|
||||
Gbl.Prefs.FirstDayOfWeek,
|
||||
(long) Gbl.StartExecutionTimeUTC,
|
||||
Gbl.Hierarchy.Ctr.PlcCod,
|
||||
PrintView ? "true" :
|
||||
"false",
|
||||
Cfg_URL_SWAD_CGI,
|
||||
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||
Frm_SetParamsForm (ParamsStr,ActionSeeCalendar,true);
|
||||
HTM_TxtF ("'%s',",ParamsStr);
|
||||
Frm_SetParamsForm (ParamsStr,ActSeeDatCfe,true);
|
||||
HTM_TxtF ("'%s');",ParamsStr);
|
||||
HTM_SCRIPT_End ();
|
||||
/***** Draw several months *****/
|
||||
/* JavaScript will write HTML here */
|
||||
HTM_DIV_Begin ("id=\"calendar\"");
|
||||
HTM_DIV_End ();
|
||||
|
||||
/* Write script to draw the month */
|
||||
HTM_SCRIPT_Begin (NULL,NULL);
|
||||
HTM_Txt ("\tGbl_HTMLContent = '';");
|
||||
HTM_TxtF ("\tCal_DrawCalendar('calendar',%u,%ld,%ld,%s,'%s/%s',",
|
||||
Gbl.Prefs.FirstDayOfWeek,
|
||||
(long) Gbl.StartExecutionTimeUTC,
|
||||
Gbl.Hierarchy.Ctr.PlcCod,
|
||||
PrintView ? "true" :
|
||||
"false",
|
||||
Cfg_URL_SWAD_CGI,
|
||||
Lan_STR_LANG_ID[Gbl.Prefs.Language]);
|
||||
Frm_SetParamsForm (ParamsStr,ActionSeeCalendar,true);
|
||||
HTM_TxtF ("'%s',",ParamsStr);
|
||||
Frm_SetParamsForm (ParamsStr,ActSeeDatCfe,true);
|
||||
HTM_TxtF ("'%s');",ParamsStr);
|
||||
HTM_SCRIPT_End ();
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
|
|
|
@ -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 20.87 (2021-06-01)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.87.1 (2021-06-01)"
|
||||
#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 20.87.1: Jun 01, 2021 Database function moved from swad_calendar to swad_setting. (312549 lines)
|
||||
Version 20.87: Jun 01, 2021 New module swad_building_database for database queries related to buildings. (312538 lines)
|
||||
Version 20.86.1: May 31, 2021 Queries moved to module swad_call_for_exam_database. (312420 lines)
|
||||
Version 20.86: May 31, 2021 New module swad_call_for_exam_database for database queries related to calls for exams. (312415 lines)
|
||||
|
|
|
@ -208,7 +208,7 @@ void Dat_ChangeDateFormat (void)
|
|||
|
||||
/***** Store date format in database *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
Set_DB_UpdateMySettingsAboutDateFormat ();
|
||||
Set_DB_UpdateMySettingsAboutDateFormat (Gbl.Prefs.DateFormat);
|
||||
|
||||
/***** Set settings from current IP *****/
|
||||
Set_SetSettingsFromIP ();
|
||||
|
|
|
@ -343,13 +343,27 @@ unsigned Set_GetParamSideCols (void)
|
|||
/******************** Update my settings about date format *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Set_DB_UpdateMySettingsAboutDateFormat (void)
|
||||
void Set_DB_UpdateMySettingsAboutDateFormat (Dat_Format_t DateFormat)
|
||||
{
|
||||
DB_QueryUPDATE ("can not update your setting about date format",
|
||||
"UPDATE usr_data"
|
||||
" SET DateFormat=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
(unsigned) Gbl.Prefs.DateFormat,
|
||||
(unsigned) DateFormat,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Update my settings about first day of week ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Set_DB_ChangeFirstDayOfWeek (unsigned FirstDayOfWeek)
|
||||
{
|
||||
DB_QueryUPDATE ("can not update your setting about first day of week",
|
||||
"UPDATE usr_data"
|
||||
" SET FirstDayOfWeek=%u"
|
||||
" WHERE UsrCod=%ld",
|
||||
Gbl.Prefs.FirstDayOfWeek,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "swad_date.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -48,7 +50,8 @@ void Set_RemoveOldSettingsFromIP (void);
|
|||
void Set_ChangeSideCols (void);
|
||||
unsigned Set_GetParamSideCols (void);
|
||||
|
||||
void Set_DB_UpdateMySettingsAboutDateFormat (void);
|
||||
void Set_DB_UpdateMySettingsAboutDateFormat (Dat_Format_t DateFormat);
|
||||
void Set_DB_ChangeFirstDayOfWeek (unsigned FirstDayOfWeek);
|
||||
|
||||
void Set_BeginSettingsHead (void);
|
||||
void Set_EndSettingsHead (void);
|
||||
|
|
Loading…
Reference in New Issue