From 182d70b00e56c9f9e310299bbc62fc36e0f904aa Mon Sep 17 00:00:00 2001 From: acanas Date: Thu, 30 Dec 2021 21:08:57 +0100 Subject: [PATCH] Version 21.78.2: Dec 30, 2021 Working on design of dark theme. --- css/{swad21.77.1.css => swad21.78.2.css} | 144 +++++++++++++---------- js/{swad21.67.4.js => swad21.78.2.js} | 52 ++++---- swad_calendar.c | 12 +- swad_changelog.h | 7 +- swad_date.c | 16 +++ 5 files changed, 138 insertions(+), 93 deletions(-) rename css/{swad21.77.1.css => swad21.78.2.css} (97%) rename js/{swad21.67.4.js => swad21.78.2.js} (98%) diff --git a/css/swad21.77.1.css b/css/swad21.78.2.css similarity index 97% rename from css/swad21.77.1.css rename to css/swad21.78.2.css index 9d6da40c4..a8a122190 100644 --- a/css/swad21.77.1.css +++ b/css/swad21.78.2.css @@ -1478,83 +1478,103 @@ a:hover img.CENTER_PHOTO_SHOW } .MONTH { - color:#4d88a1; font-size:9pt; white-space:nowrap; text-transform:uppercase; } -.DAY_WRK_HEAD - { - color:#4d88a1; - font-size:9pt; - text-align:center; - } -.DAY_NO_WRK_HEAD - { - color:red; - font-size:9pt; - text-align:center; - } -.DAY_WRK - { - color:#202020; - font-size:9pt; - text-align:center; - } -.DAY_NO_WORK - { - color:#c04080; - font-size:9pt; - text-align:center; - } -.DAY_HLD - { - color:red; - font-size:9pt; - text-align:center; - } -.DAY_WRK_LIGHT - { - color:#e0e0e0; - font-size:9pt; - text-align:center; - } -.DAY_NO_WORK_LIGHT - { - color:#ffe0ff; - font-size:9pt; - text-align:center; - } -.DAY_HLD_LIGHT - { - color:#ffe0e0; - font-size:9pt; - text-align:center; - } + +.DAY_WRK_HEAD_WHITE {color:#4d88a1;} +.DAY_WRK_HEAD_GREY {color:#4d88a1;} +.DAY_WRK_HEAD_PURPLE {color:#4d88a1;} +.DAY_WRK_HEAD_BLUE {color:#4d88a1;} +.DAY_WRK_HEAD_YELLOW {color:#4d88a1;} +.DAY_WRK_HEAD_PINK {color:#4d88a1;} +.DAY_WRK_HEAD_DARK {color:#8cbcce;} + +.DAY_NO_WRK_HEAD_WHITE {color:red;} +.DAY_NO_WRK_HEAD_GREY {color:red;} +.DAY_NO_WRK_HEAD_PURPLE {color:red;} +.DAY_NO_WRK_HEAD_BLUE {color:red;} +.DAY_NO_WRK_HEAD_YELLOW {color:red;} +.DAY_NO_WRK_HEAD_PINK {color:red;} +.DAY_NO_WRK_HEAD_DARK {color:#ff8080;} + +.DAY_WRK_WHITE {color:#202020;} +.DAY_WRK_GREY {color:#202020;} +.DAY_WRK_PURPLE {color:#202020;} +.DAY_WRK_BLUE {color:#202020;} +.DAY_WRK_YELLOW {color:#202020;} +.DAY_WRK_PINK {color:#202020;} +.DAY_WRK_DARK {color:white;} + +.DAY_NO_WORK_WHITE {color:#c04080;} +.DAY_NO_WORK_GREY {color:#c04080;} +.DAY_NO_WORK_PURPLE {color:#c04080;} +.DAY_NO_WORK_BLUE {color:#c04080;} +.DAY_NO_WORK_YELLOW {color:#c04080;} +.DAY_NO_WORK_PINK {color:#c04080;} +.DAY_NO_WORK_DARK {color:#e0a0c0;} + +.DAY_HLD_WHITE {color:red;} +.DAY_HLD_GREY {color:red;} +.DAY_HLD_PURPLE {color:red;} +.DAY_HLD_BLUE {color:red;} +.DAY_HLD_YELLOW {color:red;} +.DAY_HLD_PINK {color:red;} +.DAY_HLD_DARK {color:#ff8080;} + +.DAY_WRK_LIGHT_WHITE {color:#e0e0e0;} +.DAY_WRK_LIGHT_GREY {color:#e0e0e0;} +.DAY_WRK_LIGHT_PURPLE {color:#e0e0e0;} +.DAY_WRK_LIGHT_BLUE {color:#e0e0e0;} +.DAY_WRK_LIGHT_YELLOW {color:#e0e0e0;} +.DAY_WRK_LIGHT_PINK {color:#e0e0e0;} +.DAY_WRK_LIGHT_DARK {color:#606060;} + +.DAY_NO_WORK_LIGHT_WHITE {color:#ffe0ff;} +.DAY_NO_WORK_LIGHT_GREY {color:#ffe0ff;} +.DAY_NO_WORK_LIGHT_PURPLE {color:#ffe0ff;} +.DAY_NO_WORK_LIGHT_BLUE {color:#ffe0ff;} +.DAY_NO_WORK_LIGHT_YELLOW {color:#ffe0ff;} +.DAY_NO_WORK_LIGHT_PINK {color:#ffe0ff;} +.DAY_NO_WORK_LIGHT_DARK {color:#807080;} + +.DAY_HLD_LIGHT_WHITE {color:#ffe0e0;} +.DAY_HLD_LIGHT_GREY {color:#ffe0e0;} +.DAY_HLD_LIGHT_PURPLE {color:#ffe0e0;} +.DAY_HLD_LIGHT_BLUE {color:#ffe0e0;} +.DAY_HLD_LIGHT_YELLOW {color:#ffe0e0;} +.DAY_HLD_LIGHT_PINK {color:#ffe0e0;} +.DAY_HLD_LIGHT_DARK {color:#807070;} + .DAY { border:solid 1px; border-color:transparent; + font-size:9pt; text-align:center; } .TODAY { border:solid 1px; border-color:#50b800; + font-size:9pt; text-align:center; } .DAY_EVENT { border:solid 1px; - border-color:white; - background-color:#fff080; + border-color:rgba(255,255,255,0.5); + background-color:rgba(255,240,128,0.5); + font-size:9pt; text-align:center; } .TODAY_EVENT { border:solid 1px; border-color:#50b800; - background-color:#fff080; + background-color:rgba(255,240,128,0.5); + font-size:9pt; text-align:center; } @@ -1995,7 +2015,7 @@ a:hover img.CENTER_PHOTO_SHOW .FRAME_BLUE {background-color:white;} .FRAME_YELLOW {background-color:white;} .FRAME_PINK {background-color:white;} -.FRAME_DARK {background-color:#484848;} +.FRAME_DARK {background-color:#444444;} .FRAME_SHADOW { @@ -2373,7 +2393,7 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;} .COLOR0_BLUE {background-color:#f4f2ea;} .COLOR0_YELLOW {background-color:#f4f2ea;} .COLOR0_PINK {background-color:#f4f2ea;} -.COLOR0_DARK {background-color:#444444;} +.COLOR0_DARK {background-color:#404040;} .COLOR1_WHITE {background-color:#fbfaf7;} .COLOR1_GREY {background-color:#fbfaf7;} @@ -2381,7 +2401,7 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;} .COLOR1_BLUE {background-color:#fbfaf7;} .COLOR1_YELLOW {background-color:#fbfaf7;} .COLOR1_PINK {background-color:#fbfaf7;} -.COLOR1_DARK {background-color:#4c4c4c;} +.COLOR1_DARK {background-color:#484848;} .LIGHT_GREEN {background-color:#C0FF40;} @@ -2714,13 +2734,13 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;} .CLASSPHOTO_DARK {color:#d0d0d0;} /************************** Left column menu *********************************/ -.INS_LNK_WHITE, .MFU_WHITE {color:#4d88a1;} -.INS_LNK_GREY, .MFU_GREY {color:#4d88a1;} -.INS_LNK_PURPLE, .MFU_PURPLE {color:#4d88a1;} -.INS_LNK_BLUE, .MFU_BLUE {color:#4d88a1;} -.INS_LNK_YELLOW, .MFU_YELLOW {color:#4d88a1;} -.INS_LNK_PINK, .MFU_PINK {color:#4d88a1;} -.INS_LNK_DARK, .MFU_DARK {color:#8cbcce;} +.INS_LNK_WHITE, .MFU_WHITE, .MONTH_WHITE {color:#4d88a1;} +.INS_LNK_GREY, .MFU_GREY, .MONTH_GREY {color:#4d88a1;} +.INS_LNK_PURPLE, .MFU_PURPLE, .MONTH_PURPLE {color:#4d88a1;} +.INS_LNK_BLUE, .MFU_BLUE, .MONTH_BLUE {color:#4d88a1;} +.INS_LNK_YELLOW, .MFU_YELLOW, .MONTH_YELLOW {color:#4d88a1;} +.INS_LNK_PINK, .MFU_PINK, .MONTH_PINK {color:#4d88a1;} +.INS_LNK_DARK, .MFU_DARK, .MONTH_DARK {color:#8cbcce;} /*****************************************************************************/ .MSJ_AVISO {color:#632921; font-size:12pt;} diff --git a/js/swad21.67.4.js b/js/swad21.78.2.js similarity index 98% rename from js/swad21.67.4.js rename to js/swad21.78.2.js index e005aa948..2b56b5c40 100644 --- a/js/swad21.67.4.js +++ b/js/swad21.78.2.js @@ -1729,8 +1729,9 @@ function disableDetailedClicks () { /************************* Draw an academic calendar *************************/ /*****************************************************************************/ -function Cal_DrawCalendar (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod,PrintView, - CGI,FormGoToCalendarParams,FormEventParams) { +function Cal_DrawCalendar (id,FirstDayOfWeek, + TimeUTC,CurrentPlcCod,PrintView,Theme, + CGI,FormGoToCalendarParams,FormEventParams) { var StartingMonth = [ // Calendar starts one row before current month 10, // January --> October 10, // February --> October @@ -1772,9 +1773,11 @@ function Cal_DrawCalendar (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod,PrintView, MonthId = id + '_month_' + MonthIdNum; Gbl_HTMLContent += ''; - DrawMonth (MonthId,FirstDayOfWeek,Year,Month,CurrentMonth,CurrentDay, - CurrentPlcCod,true,PrintView,CGI, - FormGoToCalendarParams,FormEventParams); + DrawMonth (MonthId,FirstDayOfWeek, + Year,Month, + CurrentMonth,CurrentDay, + CurrentPlcCod,true,PrintView,Theme, + CGI,FormGoToCalendarParams,FormEventParams); Gbl_HTMLContent += ''; if (++Month == 13) { Month = 1; @@ -1792,7 +1795,7 @@ function Cal_DrawCalendar (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod,PrintView, /***************************** Draw current month ****************************/ /*****************************************************************************/ -function DrawCurrentMonth (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod, +function DrawCurrentMonth (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod,Theme, CGI,FormGoToCalendarParams,FormEventParams) { var d = new Date(); d.setTime(TimeUTC * 1000); @@ -1800,8 +1803,10 @@ function DrawCurrentMonth (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod, var Month = d.getMonth() + 1; var CurrentDay = d.getDate(); - DrawMonth (id,FirstDayOfWeek,Year,Month,Month,CurrentDay, - CurrentPlcCod,false,false, + DrawMonth (id,FirstDayOfWeek, + Year,Month, + Month,CurrentDay, + CurrentPlcCod,false,false,Theme, CGI,FormGoToCalendarParams,FormEventParams); document.getElementById(id).innerHTML = Gbl_HTMLContent; } @@ -1812,8 +1817,10 @@ function DrawCurrentMonth (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod, // FirstDayOfWeek == 0 ==> Weeks from Monday to Sunday // FirstDayOfWeek == 6 ==> Weeks from Sunday to Saturday -function DrawMonth (id,FirstDayOfWeek,YearToDraw,MonthToDraw,CurrentMonth,CurrentDay, - CurrentPlcCod,DrawingCalendar,PrintView, +function DrawMonth (id,FirstDayOfWeek, + YearToDraw,MonthToDraw, + CurrentMonth,CurrentDay, + CurrentPlcCod,DrawingCalendar,PrintView,Theme, CGI,FormGoToCalendarParams,FormEventParams) { var Hld_HOLIDAY = 0; var Hld_NON_SCHOOL_PERIOD = 1; @@ -1866,13 +1873,14 @@ function DrawMonth (id,FirstDayOfWeek,YearToDraw,MonthToDraw,CurrentMonth,Curren /***** Month name *****/ if (DrawingCalendar) - Gbl_HTMLContent += '
'; + Gbl_HTMLContent += '
'; else { FormId = id + '_show_calendar'; Gbl_HTMLContent += '
' + FormGoToCalendarParams + '
' + - ''; } Gbl_HTMLContent += Months[MonthToDraw - 1] + ' ' + YearToDraw; @@ -1885,8 +1893,8 @@ function DrawMonth (id,FirstDayOfWeek,YearToDraw,MonthToDraw,CurrentMonth,Curren Gbl_HTMLContent += '' + ''; for (DayOfWeek = 0; DayOfWeek < 7; DayOfWeek++) Gbl_HTMLContent += ''; @@ -1903,8 +1911,8 @@ function DrawMonth (id,FirstDayOfWeek,YearToDraw,MonthToDraw,CurrentMonth,Curren DayOfWeek < 7; DayOfWeek++) { /***** Set class for day being drawn *****/ - ClassForDay = ((Mon == MonthToDraw) ? 'DAY_WRK' : - 'DAY_WRK_LIGHT'); + ClassForDay = ((Mon == MonthToDraw) ? 'DAY_WRK_' + Colors[Theme] : + 'DAY_WRK_LIGHT_' + Colors[Theme]); TextForDay = ''; /* Check if day is a holiday or a school day */ @@ -1921,16 +1929,16 @@ function DrawMonth (id,FirstDayOfWeek,YearToDraw,MonthToDraw,CurrentMonth,Curren switch (Hlds[NumHld].HldTyp) { case Hld_HOLIDAY: if (Hlds[NumHld].StartDate == YYYYMMDD) { // If start date == date being drawn - ClassForDay = ((Mon == MonthToDraw) ? 'DAY_HLD' : - 'DAY_HLD_LIGHT'); + ClassForDay = ((Mon == MonthToDraw) ? 'DAY_HLD_' + Colors[Theme] : + 'DAY_HLD_LIGHT_' + Colors[Theme]); TextForDay = Hlds[NumHld].Name; ContinueSearching = false; } break; case Hld_NON_SCHOOL_PERIOD: if (Hlds[NumHld].EndDate >= YYYYMMDD) { // If start date <= date being drawn <= end date - ClassForDay = ((Mon == MonthToDraw) ? 'DAY_NO_WORK' : - 'DAY_NO_WORK_LIGHT'); + ClassForDay = ((Mon == MonthToDraw) ? 'DAY_NO_WORK_' + Colors[Theme] : + 'DAY_NO_WORK_LIGHT_' + Colors[Theme]); TextForDay = Hlds[NumHld].Name; } break; @@ -1939,8 +1947,8 @@ function DrawMonth (id,FirstDayOfWeek,YearToDraw,MonthToDraw,CurrentMonth,Curren /* Day being drawn is sunday? */ if (DayOfWeek == 6 - FirstDayOfWeek) // All the sundays are holidays - ClassForDay = (Mon == MonthToDraw) ? 'DAY_HLD' : - 'DAY_HLD_LIGHT'; + ClassForDay = (Mon == MonthToDraw) ? 'DAY_HLD_' + Colors[Theme] : + 'DAY_HLD_LIGHT_' + Colors[Theme]; /* Date being drawn is today? */ IsToday = (Yea == YearToDraw && diff --git a/swad_calendar.c b/swad_calendar.c index a5fbcf19e..1daf56668 100644 --- a/swad_calendar.c +++ b/swad_calendar.c @@ -217,12 +217,12 @@ 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',", + HTM_TxtF ("\tDrawCurrentMonth ('CurrentMonth',%u,%ld,%ld,%u,'%s/%s',", Gbl.Prefs.FirstDayOfWeek, (long) Gbl.StartExecutionTimeUTC, Gbl.Hierarchy.Ctr.PlcCod, - Cfg_URL_SWAD_CGI, - Lan_STR_LANG_ID[Gbl.Prefs.Language]); + Gbl.Prefs.Theme, + 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); @@ -286,14 +286,14 @@ static void Cal_DrawCalendar (Act_Action_t ActionSeeCalendar, /* 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',", + HTM_TxtF ("\tCal_DrawCalendar('calendar',%u,%ld,%ld,%s,%u,'%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]); + Gbl.Prefs.Theme, + 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); diff --git a/swad_changelog.h b/swad_changelog.h index 4fde026ca..321770cd7 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -602,10 +602,11 @@ 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.78.1 (2021-12-30)" -#define CSS_FILE "swad21.77.1.css" -#define JS_FILE "swad21.67.4.js" +#define Log_PLATFORM_VERSION "SWAD 21.78.2 (2021-12-30)" +#define CSS_FILE "swad21.78.2.css" +#define JS_FILE "swad21.78.2.js" /* + Version 21.78.2: Dec 30, 2021 Working on design of dark theme. (322393 lines) Version 21.78.1: Dec 30, 2021 Working on design of dark theme. (322358 lines) Version 21.78: Dec 30, 2021 Changing Str_BuildString for asprintf. (322358 lines) Version 21.77.3: Dec 29, 2021 Changing Str_BuildString for asprintf. (322287 lines) diff --git a/swad_date.c b/swad_date.c index 853b0d5b2..821ca60f0 100644 --- a/swad_date.c +++ b/swad_date.c @@ -1630,10 +1630,13 @@ void Dat_AssignDate (struct Dat_Date *DateDst,struct Dat_Date *DateSrc) void Dat_WriteScriptMonths (void) { + extern const char *The_Colors[The_NUM_THEMES]; extern const char *Txt_MONTHS_SMALL[12]; extern const char *Txt_MONTHS_SMALL_SHORT[12]; unsigned NumMonth; + The_Theme_t Theme; + /***** Month names (full) *****/ HTM_Txt ("\tvar Months = ["); for (NumMonth = 0; NumMonth < 12; @@ -1645,6 +1648,7 @@ void Dat_WriteScriptMonths (void) } HTM_Txt ("];\n"); + /***** Month names (short) *****/ HTM_Txt ("\tvar MonthsShort = ["); for (NumMonth = 0; NumMonth < 12; @@ -1655,6 +1659,18 @@ void Dat_WriteScriptMonths (void) HTM_TxtF ("'%s'",Txt_MONTHS_SMALL_SHORT[NumMonth]); } HTM_Txt ("];\n"); + + /***** Colors for each theme *****/ + HTM_Txt ("\tvar Colors = ["); + for (Theme = (The_Theme_t) 0; + Theme <= (The_Theme_t) (The_NUM_THEMES - 1); + Theme++) + { + if (Theme) + HTM_Comma (); + HTM_TxtF ("'%s'",The_Colors[Theme]); + } + HTM_Txt ("];\n"); } /*****************************************************************************/
' + DAYS_CAPS[(DayOfWeek + FirstDayOfWeek) % 7] + '