diff --git a/swad_changelog.h b/swad_changelog.h index 3f6508883..9400e878d 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -233,13 +233,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.205.2 (2017-05-04)" +#define Log_PLATFORM_VERSION "SWAD 16.205.3 (2017-05-04)" #define CSS_FILE "swad16.205.css" #define JS_FILE "swad16.205.js" // 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 /* + 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.1: May 04, 2017 Removed unused code. (218440 lines) Version 16.205: May 04, 2017 Dates written depending on user's preferences. (218721 lines) diff --git a/swad_date.c b/swad_date.c index 7f473cf4f..25a2d8b3d 100644 --- a/swad_date.c +++ b/swad_date.c @@ -46,14 +46,6 @@ extern struct Globals Gbl; /***************************** Public constants ******************************/ /*****************************************************************************/ -/***** Date format *****/ -const char *Dat_Format_Str[Dat_NUM_OPTIONS_FORMAT] = - { - "yyyy-mm-dd", // Dat_FORMAT_YYYY_MM_DD - "dd mmm yyyy", // Dat_FORMAT_DD_MONTH_YYYY - "mmm dd, yyyy", // Dat_FORMAT_MONTH_DD_YYYY - }; - /*****************************************************************************/ /**************************** Private constants ******************************/ /*****************************************************************************/ @@ -130,18 +122,12 @@ void Dat_PutIconsToSelectDateFormat (void) (unsigned) Format); if (Format == Gbl.Prefs.DateFormat) fprintf (Gbl.F.Out," checked=\"checked\""); - fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />" - "" - "" - "", - Gbl.Form.Id, - (unsigned) Format); - fprintf (Gbl.F.Out,"", - (unsigned) Format,(long) Gbl.StartExecutionTimeUTC, - (unsigned) Format); + fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />", + Gbl.Form.Id); + Dat_PutSpanDateFormat (Format); + Dat_PutScriptDateFormat (Format); + fprintf (Gbl.F.Out,"" + ""); } /***** End of list and form *****/ @@ -165,6 +151,26 @@ static void Dat_PutIconsDateFormat (void) Sta_PutIconToShowFigure (); } +/*****************************************************************************/ +/******* Put script to write current date-time in a given date format ********/ +/*****************************************************************************/ + +void Dat_PutSpanDateFormat (Dat_Format_t Format) + { + fprintf (Gbl.F.Out,"", + (unsigned) Format); + } + +void Dat_PutScriptDateFormat (Dat_Format_t Format) + { + fprintf (Gbl.F.Out,"", + (unsigned) Format,(long) Gbl.StartExecutionTimeUTC, + (unsigned) Format); + } + /*****************************************************************************/ /***************************** Change date format ****************************/ /*****************************************************************************/ diff --git a/swad_date.h b/swad_date.h index 995c45bd6..8bf68bb52 100644 --- a/swad_date.h +++ b/swad_date.h @@ -114,6 +114,10 @@ typedef enum /*****************************************************************************/ void Dat_PutIconsToSelectDateFormat (void); + +void Dat_PutSpanDateFormat (Dat_Format_t Format); +void Dat_PutScriptDateFormat (Dat_Format_t Format); + void Dat_ChangeDateFormat (void); Dat_Format_t Dat_GetDateFormatFromStr (const char *Str); diff --git a/swad_statistic.c b/swad_statistic.c index 525142811..b4f5e2921 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -8840,7 +8840,6 @@ static void Sta_GetAndShowNumUsrsPerFirstDayOfWeek (void) static void Sta_GetAndShowNumUsrsPerDateFormat (void) { - extern const char *Dat_Format_Str[Dat_NUM_OPTIONS_FORMAT]; extern const char *Hlp_STATS_Figures_calendar; // TODO: Change!!!!!!!!!!!!!!!! extern const char *Txt_STAT_USE_STAT_TYPES[Sta_NUM_FIGURES]; extern const char *Txt_Format; @@ -8948,10 +8947,12 @@ static void Sta_GetAndShowNumUsrsPerDateFormat (void) for (Format = (Dat_Format_t) 0; Format <= (Dat_Format_t) (Dat_NUM_OPTIONS_FORMAT - 1); Format++) + { fprintf (Gbl.F.Out,"" - "" - "%s" - "" + ""); + Dat_PutSpanDateFormat (Format); + Dat_PutScriptDateFormat (Format); + fprintf (Gbl.F.Out,"" "" "%u" "" @@ -8959,11 +8960,11 @@ static void Sta_GetAndShowNumUsrsPerDateFormat (void) "%5.2f%%" "" "", - Dat_Format_Str[Format], NumUsrs[Format], NumUsrsTotal ? (float) NumUsrs[Format] * 100.0 / (float) NumUsrsTotal : 0); + } /***** End table *****/ Lay_EndRoundFrameTable ();