diff --git a/icon/first-day-of-week-0-64x64.png b/icon/first-day-of-week-0-64x64.png new file mode 100644 index 000000000..b1805c9ec Binary files /dev/null and b/icon/first-day-of-week-0-64x64.png differ diff --git a/icon/first-day-of-week-6-64x64.png b/icon/first-day-of-week-6-64x64.png new file mode 100644 index 000000000..3d657be6f Binary files /dev/null and b/icon/first-day-of-week-6-64x64.png differ diff --git a/js/swad.js b/js/swad.js index b407f2028..43877c4b2 100644 --- a/js/swad.js +++ b/js/swad.js @@ -619,7 +619,7 @@ function disableDetailedClicks() { /************************ Draw an academic calendar **************************/ /*****************************************************************************/ -function Cal_DrawCalendar (id,Sunday,TimeUTC,CurrentPlcCod,PrintView, +function Cal_DrawCalendar (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod,PrintView, CGI,FormGoToCalendarParams,FormEventParams) { var StartingMonth = [ // Calendar starts one row before current month 9, // January --> September @@ -662,7 +662,7 @@ function Cal_DrawCalendar (id,Sunday,TimeUTC,CurrentPlcCod,PrintView, MonthId = id + '_month_' + MonthIdNum; Gbl_HTMLContent += ''; - DrawMonth (MonthId,Sunday,Year,Month,CurrentMonth,CurrentDay, + DrawMonth (MonthId,FirstDayOfWeek,Year,Month,CurrentMonth,CurrentDay, CurrentPlcCod,true,PrintView,CGI, FormGoToCalendarParams,FormEventParams); Gbl_HTMLContent += ''; @@ -682,7 +682,7 @@ function Cal_DrawCalendar (id,Sunday,TimeUTC,CurrentPlcCod,PrintView, /***************************** Draw current month ****************************/ /*****************************************************************************/ -function DrawCurrentMonth (id,Sunday,TimeUTC,CurrentPlcCod, +function DrawCurrentMonth (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod, CGI,FormGoToCalendarParams,FormEventParams) { var d = new Date; d.setTime(TimeUTC * 1000); @@ -690,7 +690,7 @@ function DrawCurrentMonth (id,Sunday,TimeUTC,CurrentPlcCod, var Month = d.getMonth() + 1; var CurrentDay = d.getDate(); - DrawMonth (id,Sunday,Year,Month,Month,CurrentDay, + DrawMonth (id,FirstDayOfWeek,Year,Month,Month,CurrentDay, CurrentPlcCod,false,false, CGI,FormGoToCalendarParams,FormEventParams); document.getElementById(id).innerHTML = Gbl_HTMLContent; @@ -699,10 +699,10 @@ function DrawCurrentMonth (id,Sunday,TimeUTC,CurrentPlcCod, /*****************************************************************************/ /******************************* Draw a month ********************************/ /*****************************************************************************/ -// Sunday == 0 ==> Sunday is the first day of the week -// Sunday == 6 ==> Sunday is the last day of the week +// FirstDayOfWeek == 0 (monday) <==> Sunday is the last day of the week +// FirstDayOfWeek == 6 (sunday) <==> Sunday is the first day of the week -function DrawMonth (id,Sunday,YearToDraw,MonthToDraw,CurrentMonth,CurrentDay, +function DrawMonth (id,FirstDayOfWeek,YearToDraw,MonthToDraw,CurrentMonth,CurrentDay, CurrentPlcCod,DrawingCalendar,PrintView, CGI,FormGoToCalendarParams,FormEventParams) { var NumDaysMonth = [ @@ -750,7 +750,7 @@ function DrawMonth (id,Sunday,YearToDraw,MonthToDraw,CurrentMonth,CurrentDay, If it's 0 then write 1 box of the previous month. If it's 1 then write 0 boxes of the previous month. */ - if ((DayOfWeek = (GetDayOfWeekMondayFirst (Yea,Mon,1) + Sunday + 1) % 7) == 0) + if ((DayOfWeek = (GetDayOfWeekMondayFirst (Yea,Mon,1) - FirstDayOfWeek) % 7) == 0) Day = 1; else { if (Mon <= 1) { @@ -787,10 +787,10 @@ function DrawMonth (id,Sunday,YearToDraw,MonthToDraw,CurrentMonth,CurrentDay, Gbl_HTMLContent += '' + ''; for (DayOfWeek = 0; DayOfWeek < 7; DayOfWeek++) Gbl_HTMLContent += ''; Gbl_HTMLContent += ''; @@ -840,7 +840,7 @@ function DrawMonth (id,Sunday,YearToDraw,MonthToDraw,CurrentMonth,CurrentDay, } /* Day being drawn is sunday? */ - if (DayOfWeek == Sunday) // All the sundays are holidays + if (DayOfWeek == 6 - FirstDayOfWeek) // All the sundays are holidays ClassForDay = (Mon == MonthToDraw) ? 'DAY_HLD' : 'DAY_HLD_LIGHT'; diff --git a/swad_calendar.c b/swad_calendar.c index a54a16588..7b44132be 100644 --- a/swad_calendar.c +++ b/swad_calendar.c @@ -149,7 +149,6 @@ void Cal_DrawCurrentMonth (void) { extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES]; char Params[256+256+Ses_LENGTH_SESSION_ID+256]; - unsigned Sunday = 6; /***** Get list of holidays *****/ if (!Gbl.Hlds.LstIsRead) @@ -170,7 +169,7 @@ void Cal_DrawCurrentMonth (void) fprintf (Gbl.F.Out,"
' + - DAYS_CAPS[(DayOfWeek + 6 - Sunday) % 7] + + DAYS_CAPS[(DayOfWeek + FirstDayOfWeek) % 7] + '