Version 16.206

This commit is contained in:
Antonio Cañas Vargas 2017-05-05 02:03:28 +02:00
parent 8eada9b77e
commit d10ff995bc
8 changed files with 69 additions and 39 deletions

View File

@ -103,10 +103,10 @@ function writeLocalDateHMSFromUTC (id,TimeUTC,DateFormat,Separator,StrToday,
StrDate = Yea.toString() + '-' + StrMon + '-' + StrDay; StrDate = Yea.toString() + '-' + StrMon + '-' + StrDay;
break; break;
case 1: // Dat_FORMAT_DD_MONTH_YYYY case 1: // Dat_FORMAT_DD_MONTH_YYYY
StrDate = Day.toString() + ' ' + MonthsShort[Mon - 1] + ' ' + Yea.toString(); StrDate = Day.toString() + ' ' + MonthsShort[Mon - 1] + ' ' + Yea.toString();
break; break;
case 2: // Dat_FORMAT_MONTH_DD_YYYY case 2: // Dat_FORMAT_MONTH_DD_YYYY
StrDate = MonthsShort[Mon - 1] + ' ' + Day.toString() + ', ' + Yea.toString(); StrDate = MonthsShort[Mon - 1] + ' ' + Day.toString() + ', ' + Yea.toString();
break; break;
default: default:
StrDate = ''; StrDate = '';

View File

@ -217,7 +217,6 @@
// TODO: Change numbers of notifications in program and database to match order in tabs // TODO: Change numbers of notifications in program and database to match order in tabs
// TODO: Sugerencias de Sandra Daniela Tazzioli Barroso realizadas el 2 de mayo de 2017: // TODO: Sugerencias de Sandra Daniela Tazzioli Barroso realizadas el 2 de mayo de 2017:
// 1. Poder ver fechas en formato (día-mes-año).
// 2. Mejor ayuda sobre cómo pasar de Excel al formato HTML necesario para las calificaciones. // 2. Mejor ayuda sobre cómo pasar de Excel al formato HTML necesario para las calificaciones.
// 3. Puede ser interesante que un administrador pueda cambiar el DNI de un usuario. // 3. Puede ser interesante que un administrador pueda cambiar el DNI de un usuario.
// 4. Comprobar que las direcciones de correo de cada uno de los estudiantes aparecen en Bcc: (copia oculta) en cualquier gestor de correo. // 4. Comprobar que las direcciones de correo de cada uno de los estudiantes aparecen en Bcc: (copia oculta) en cualquier gestor de correo.
@ -233,13 +232,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.205.4 (2017-05-05)" #define Log_PLATFORM_VERSION "SWAD 16.206 (2017-05-05)"
#define CSS_FILE "swad16.205.css" #define CSS_FILE "swad16.205.css"
#define JS_FILE "swad16.205.js" #define JS_FILE "swad16.206.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/* /*
Version 16.206: May 05, 2017 Date format applied to dates written directly instead of using Javascript. (218514 lines)
Version 16.205.4: May 05, 2017 Help about date format. (218487 lines) Version 16.205.4: May 05, 2017 Help about date format. (218487 lines)
Version 16.205.3: May 04, 2017 Changes in statistics about date format. (218447 lines) Version 16.205.3: May 04, 2017 Changes in statistics about date format. (218447 lines)
Version 16.205.2: May 04, 2017 Changes in form to select date format. (218439 lines) Version 16.205.2: May 04, 2017 Changes in form to select date format. (218439 lines)

View File

@ -42,8 +42,8 @@
// 123456789012345 // 123456789012345
#define Cns_MAX_BYTES_IP Cns_MAX_CHARS_IP // 15 #define Cns_MAX_BYTES_IP Cns_MAX_CHARS_IP // 15
#define Cns_MAX_CHARS_DATE (4 + 1 + 2 + 1 + 2) #define Cns_MAX_CHARS_DATE (16 - 1) // 15
#define Cns_MAX_BYTES_DATE Cns_MAX_CHARS_DATE #define Cns_MAX_BYTES_DATE ((Cns_MAX_CHARS_DATE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 255
#define Cns_MAX_CHARS_EMAIL_ADDRESS (256 - 1) // 255 #define Cns_MAX_CHARS_EMAIL_ADDRESS (256 - 1) // 255
#define Cns_MAX_BYTES_EMAIL_ADDRESS Cns_MAX_CHARS_EMAIL_ADDRESS // 255 #define Cns_MAX_BYTES_EMAIL_ADDRESS Cns_MAX_CHARS_EMAIL_ADDRESS // 255

View File

@ -380,15 +380,36 @@ struct tm *Dat_GetLocalTimeFromClock (const time_t *timep)
/********* Convert a struct with Day, Month and Year to a date string ********/ /********* Convert a struct with Day, Month and Year to a date string ********/
/*****************************************************************************/ /*****************************************************************************/
void Dat_ConvDateToDateStr (struct Date *Date,char *DateStr) void Dat_ConvDateToDateStr (struct Date *Date,char StrDate[Cns_MAX_BYTES_DATE + 1])
{ {
extern const char *Txt_MONTHS_SMALL_SHORT[12];
if (Date->Day == 0 || if (Date->Day == 0 ||
Date->Month == 0 || Date->Month == 0 ||
Date->Year == 0) Date->Year == 0)
DateStr[0] = '\0'; StrDate[0] = '\0';
else else
sprintf (DateStr,"%04u-%02u-%02u", switch (Gbl.Prefs.DateFormat)
Date->Year,Date->Month,Date->Day); {
case Dat_FORMAT_YYYY_MM_DD:
sprintf (StrDate,"%04u-%02u-%02u",
Date->Year,
Date->Month,
Date->Day);
break;
case Dat_FORMAT_DD_MONTH_YYYY:
sprintf (StrDate,"%u %s %04u",
Date->Day,
Txt_MONTHS_SMALL_SHORT[Date->Month - 1],
Date->Year);
break;
case Dat_FORMAT_MONTH_DD_YYYY:
sprintf (StrDate,"%s %u, %04u",
Txt_MONTHS_SMALL_SHORT[Date->Month - 1],
Date->Day,
Date->Year);
break;
}
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -31,6 +31,8 @@
#include <stdio.h> // For FILE * #include <stdio.h> // For FILE *
#include <time.h> #include <time.h>
#include "swad_constant.h"
/*****************************************************************************/ /*****************************************************************************/
/***************************** Public constants ******************************/ /***************************** Public constants ******************************/
/*****************************************************************************/ /*****************************************************************************/
@ -130,7 +132,7 @@ bool Dat_GetDateFromYYYYMMDD (struct Date *Date,const char *YYYYMMDDString);
void Dat_ShowClientLocalTime (void); void Dat_ShowClientLocalTime (void);
struct tm *Dat_GetLocalTimeFromClock (const time_t *timep); struct tm *Dat_GetLocalTimeFromClock (const time_t *timep);
void Dat_ConvDateToDateStr (struct Date *Date,char *DateStr); void Dat_ConvDateToDateStr (struct Date *Date,char StrDate[Cns_MAX_BYTES_DATE + 1]);
void Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (bool SetHMS000000To235959); void Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (bool SetHMS000000To235959);
void Dat_PutFormStartEndClientLocalDateTimes (time_t TimeUTC[2], void Dat_PutFormStartEndClientLocalDateTimes (time_t TimeUTC[2],

View File

@ -1026,7 +1026,9 @@ static void Exa_ShowExamAnnouncement (Exa_TypeViewExamAnnouncement_t TypeViewExa
const char *StyleNormal = "CONV"; const char *StyleNormal = "CONV";
struct Instit Ins; struct Instit Ins;
char StrExamDate[Cns_MAX_BYTES_DATE + 1]; char StrExamDate[Cns_MAX_BYTES_DATE + 1];
unsigned Year,Hour,Minute; unsigned Year;
unsigned Hour;
unsigned Minute;
const char *ClassExaAnnouncement[Exa_NUM_VIEWS][Exa_NUM_STATUS] = const char *ClassExaAnnouncement[Exa_NUM_VIEWS][Exa_NUM_STATUS] =
{ {
{ // Exa_NORMAL_VIEW { // Exa_NORMAL_VIEW
@ -1211,7 +1213,7 @@ static void Exa_ShowExamAnnouncement (Exa_TypeViewExamAnnouncement_t TypeViewExa
{ {
fprintf (Gbl.F.Out,"<td class=\"LEFT_BOTTOM\">"); fprintf (Gbl.F.Out,"<td class=\"LEFT_BOTTOM\">");
Dat_WriteFormDate (Gbl.ExamAnns.ExaDat.ExamDate.Year < Gbl.Now.Date.Year ? Gbl.ExamAnns.ExaDat.ExamDate.Year : Dat_WriteFormDate (Gbl.ExamAnns.ExaDat.ExamDate.Year < Gbl.Now.Date.Year ? Gbl.ExamAnns.ExaDat.ExamDate.Year :
Gbl.Now.Date.Year, Gbl.Now.Date.Year,
Gbl.Now.Date.Year + 1,"Exam", Gbl.Now.Date.Year + 1,"Exam",
&(Gbl.ExamAnns.ExaDat.ExamDate), &(Gbl.ExamAnns.ExaDat.ExamDate),
false,false); false,false);
@ -1596,6 +1598,7 @@ void Exa_GetSummaryAndContentExamAnnouncement (char SummaryStr[Ntf_MAX_BYTES_SUM
{ {
extern const char *Txt_hours_ABBREVIATION; extern const char *Txt_hours_ABBREVIATION;
char CrsNameAndDate[Hie_MAX_BYTES_FULL_NAME + (2 + Cns_MAX_BYTES_DATE + 6) + 1]; char CrsNameAndDate[Hie_MAX_BYTES_FULL_NAME + (2 + Cns_MAX_BYTES_DATE + 6) + 1];
char StrExamDate[Cns_MAX_BYTES_DATE + 1];
/***** Initializations *****/ /***** Initializations *****/
Gbl.ExamAnns.ExaDat.ExaCod = ExaCod; Gbl.ExamAnns.ExaDat.ExaCod = ExaCod;
@ -1613,11 +1616,10 @@ void Exa_GetSummaryAndContentExamAnnouncement (char SummaryStr[Ntf_MAX_BYTES_SUM
/***** Summary *****/ /***** Summary *****/
/* Name of the course and date of exam */ /* Name of the course and date of exam */
sprintf (CrsNameAndDate,"%s, %04u-%02u-%02u %2u:%02u", Dat_ConvDateToDateStr (&Gbl.ExamAnns.ExaDat.ExamDate,StrExamDate);
sprintf (CrsNameAndDate,"%s, %s, %2u:%02u",
Gbl.ExamAnns.ExaDat.CrsFullName, Gbl.ExamAnns.ExaDat.CrsFullName,
Gbl.ExamAnns.ExaDat.ExamDate.Year, StrExamDate,
Gbl.ExamAnns.ExaDat.ExamDate.Month,
Gbl.ExamAnns.ExaDat.ExamDate.Day,
Gbl.ExamAnns.ExaDat.StartTime.Hour, Gbl.ExamAnns.ExaDat.StartTime.Hour,
Gbl.ExamAnns.ExaDat.StartTime.Minute); Gbl.ExamAnns.ExaDat.StartTime.Minute);
Str_Copy (SummaryStr,CrsNameAndDate, Str_Copy (SummaryStr,CrsNameAndDate,

View File

@ -88,6 +88,7 @@ void Hld_SeeHolidays (void)
extern const char *Txt_New_holiday; extern const char *Txt_New_holiday;
Hld_Order_t Order; Hld_Order_t Order;
unsigned NumHld; unsigned NumHld;
char StrDate[Cns_MAX_BYTES_DATE + 1];
if (Gbl.CurrentIns.Ins.InsCod > 0) if (Gbl.CurrentIns.Ins.InsCod > 0)
{ {
@ -145,12 +146,11 @@ void Hld_SeeHolidays (void)
"</td>", "</td>",
Gbl.Hlds.Lst[NumHld].PlcCod <= 0 ? Txt_All_places : Gbl.Hlds.Lst[NumHld].PlcCod <= 0 ? Txt_All_places :
Gbl.Hlds.Lst[NumHld].PlaceFullName); Gbl.Hlds.Lst[NumHld].PlaceFullName);
Dat_ConvDateToDateStr (&Gbl.Hlds.Lst[NumHld].StartDate,StrDate);
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE\">"
"&nbsp;%04u-%02u-%02u" "&nbsp;%s"
"</td>", "</td>",
Gbl.Hlds.Lst[NumHld].StartDate.Year, StrDate);
Gbl.Hlds.Lst[NumHld].StartDate.Month,
Gbl.Hlds.Lst[NumHld].StartDate.Day);
fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"DAT LEFT_MIDDLE\">"
"&nbsp;"); "&nbsp;");
switch (Gbl.Hlds.Lst[NumHld].HldTyp) switch (Gbl.Hlds.Lst[NumHld].HldTyp)
@ -158,10 +158,8 @@ void Hld_SeeHolidays (void)
case Hld_HOLIDAY: case Hld_HOLIDAY:
break; break;
case Hld_NON_SCHOOL_PERIOD: case Hld_NON_SCHOOL_PERIOD:
fprintf (Gbl.F.Out,"%04u-%02u-%02u", Dat_ConvDateToDateStr (&Gbl.Hlds.Lst[NumHld].EndDate,StrDate);
Gbl.Hlds.Lst[NumHld].EndDate.Year, fprintf (Gbl.F.Out,"%s",StrDate);
Gbl.Hlds.Lst[NumHld].EndDate.Month,
Gbl.Hlds.Lst[NumHld].EndDate.Day);
break; break;
} }
fprintf (Gbl.F.Out,"</td>" fprintf (Gbl.F.Out,"</td>"
@ -792,7 +790,7 @@ static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
struct Date NewDate; struct Date NewDate;
struct Date *PtrDate = NULL; // Initialized to avoid warning struct Date *PtrDate = NULL; // Initialized to avoid warning
const char *StrStartOrEndDate = NULL; // Initialized to avoid warning const char *StrStartOrEndDate = NULL; // Initialized to avoid warning
char StrDate[11]; char StrDate[Cns_MAX_BYTES_DATE + 1];
Hld = &Gbl.Hlds.EditingHld; Hld = &Gbl.Hlds.EditingHld;
@ -848,8 +846,7 @@ static void Hld_ChangeDate (Hld_StartOrEndDate_t StartOrEndDate)
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
Gbl.AlertType = Lay_SUCCESS; Gbl.AlertType = Lay_SUCCESS;
sprintf (StrDate,"%04u-%02u-%02u", Dat_ConvDateToDateStr (&NewDate,StrDate);
NewDate.Year,NewDate.Month,NewDate.Day); // Change format depending on location
sprintf (Gbl.Message,Txt_The_date_of_the_holiday_X_has_changed_to_Y, sprintf (Gbl.Message,Txt_The_date_of_the_holiday_X_has_changed_to_Y,
Hld->Name,StrDate); Hld->Name,StrDate);
} }

View File

@ -1981,6 +1981,7 @@ static void Sta_ShowNumHitsPerDays (unsigned long NumRows,
int NumDayWeek; int NumDayWeek;
struct Sta_Hits Hits; struct Sta_Hits Hits;
MYSQL_ROW row; MYSQL_ROW row;
char StrDate[Cns_MAX_BYTES_DATE + 1];
/***** Initialize LastDate *****/ /***** Initialize LastDate *****/
Dat_AssignDate (&LastDate,&Gbl.DateRange.DateEnd.Date); Dat_AssignDate (&LastDate,&Gbl.DateRange.DateEnd.Date);
@ -2030,13 +2031,14 @@ static void Sta_ShowNumHitsPerDays (unsigned long NumRows,
NumDayWeek = Dat_GetDayOfWeek (Date.Year,Date.Month,Date.Day); NumDayWeek = Dat_GetDayOfWeek (Date.Year,Date.Month,Date.Day);
/* Write the date */ /* Write the date */
Dat_ConvDateToDateStr (&Date,StrDate);
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s LEFT_TOP\">" "<td class=\"%s LEFT_TOP\">"
"%04u-%02u-%02u&nbsp;" "%s&nbsp;"
"</td>", "</td>",
NumDayWeek == 6 ? "LOG_R" : NumDayWeek == 6 ? "LOG_R" :
"LOG", "LOG",
Date.Year,Date.Month,Date.Day); StrDate);
/* Write the day of the week */ /* Write the day of the week */
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">" fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">"
@ -2045,6 +2047,7 @@ static void Sta_ShowNumHitsPerDays (unsigned long NumRows,
NumDayWeek == 6 ? "LOG_R" : NumDayWeek == 6 ? "LOG_R" :
"LOG", "LOG",
Txt_DAYS_SMALL[NumDayWeek]); Txt_DAYS_SMALL[NumDayWeek]);
/* Draw bar proportional to number of pages generated */ /* Draw bar proportional to number of pages generated */
Sta_DrawBarNumHits (NumDayWeek == 6 ? 'r' : Sta_DrawBarNumHits (NumDayWeek == 6 ? 'r' :
'c', 'c',
@ -2068,13 +2071,14 @@ static void Sta_ShowNumHitsPerDays (unsigned long NumRows,
NumDayWeek = Dat_GetDayOfWeek (Date.Year,Date.Month,Date.Day); NumDayWeek = Dat_GetDayOfWeek (Date.Year,Date.Month,Date.Day);
/* Write the date */ /* Write the date */
Dat_ConvDateToDateStr (&Date,StrDate);
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_TOP\">" "<td class=\"%s RIGHT_TOP\">"
"%04u-%02u-%02u&nbsp;" "%s&nbsp;"
"</td>", "</td>",
NumDayWeek == 6 ? "LOG_R" : NumDayWeek == 6 ? "LOG_R" :
"LOG", "LOG",
Date.Year,Date.Month,Date.Day); StrDate);
/* Write the day of the week */ /* Write the day of the week */
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">" fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">"
@ -2126,6 +2130,7 @@ static void Sta_ShowDistrAccessesPerDaysAndHour (unsigned long NumRows,MYSQL_RES
float NumAccPerHour[24]; float NumAccPerHour[24];
float NumAccPerHourZero[24]; float NumAccPerHourZero[24];
MYSQL_ROW row; MYSQL_ROW row;
char StrDate[Cns_MAX_BYTES_DATE + 1];
/***** Get selected color type *****/ /***** Get selected color type *****/
SelectedColorType = Sta_GetStatColorType (); SelectedColorType = Sta_GetStatColorType ();
@ -2254,13 +2259,14 @@ static void Sta_ShowDistrAccessesPerDaysAndHour (unsigned long NumRows,MYSQL_RES
NumDayWeek = Dat_GetDayOfWeek (Date.Year,Date.Month,Date.Day); NumDayWeek = Dat_GetDayOfWeek (Date.Year,Date.Month,Date.Day);
/* Write the date */ /* Write the date */
Dat_ConvDateToDateStr (&Date,StrDate);
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s LEFT_TOP\">" "<td class=\"%s LEFT_TOP\">"
"%04u-%02u-%02u&nbsp;" "%s&nbsp;"
"</td>", "</td>",
NumDayWeek == 6 ? "LOG_R" : NumDayWeek == 6 ? "LOG_R" :
"LOG", "LOG",
Date.Year,Date.Month,Date.Day); StrDate);
/* Write the day of the week */ /* Write the day of the week */
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">" fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">"
@ -2304,13 +2310,14 @@ static void Sta_ShowDistrAccessesPerDaysAndHour (unsigned long NumRows,MYSQL_RES
NumDayWeek = Dat_GetDayOfWeek (Date.Year,Date.Month,Date.Day); NumDayWeek = Dat_GetDayOfWeek (Date.Year,Date.Month,Date.Day);
/* Write the date */ /* Write the date */
Dat_ConvDateToDateStr (&Date,StrDate);
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_TOP\">" "<td class=\"%s RIGHT_TOP\">"
"%04u-%02u-%02u&nbsp;" "%s&nbsp;"
"</td>", "</td>",
NumDayWeek == 6 ? "LOG_R" : NumDayWeek == 6 ? "LOG_R" :
"LOG", "LOG",
Date.Year,Date.Month,Date.Day); StrDate);
/* Write the day of the week */ /* Write the day of the week */
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">" fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">"
@ -2342,13 +2349,14 @@ static void Sta_ShowDistrAccessesPerDaysAndHour (unsigned long NumRows,MYSQL_RES
NumDayWeek = Dat_GetDayOfWeek (Date.Year,Date.Month,Date.Day); NumDayWeek = Dat_GetDayOfWeek (Date.Year,Date.Month,Date.Day);
/* Write the date */ /* Write the date */
Dat_ConvDateToDateStr (&Date,StrDate);
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_TOP\">" "<td class=\"%s RIGHT_TOP\">"
"%04u-%02u-%02u&nbsp;" "%s&nbsp;"
"</td>", "</td>",
NumDayWeek == 6 ? "LOG_R" : NumDayWeek == 6 ? "LOG_R" :
"LOG", "LOG",
Date.Year,Date.Month,Date.Day); StrDate);
/* Write the day of the week */ /* Write the day of the week */
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">" fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">"