Version 16.205.3

This commit is contained in:
Antonio Cañas Vargas 2017-05-04 23:27:51 +02:00
parent 1679b6c02b
commit 6fb8c4752c
4 changed files with 38 additions and 26 deletions

View File

@ -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)

View File

@ -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();\" />"
"<span id=\"date_format_%u\"></span>"
"</label>"
"</li>",
Gbl.Form.Id,
(unsigned) Format);
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
"writeLocalDateHMSFromUTC('date_format_%u',%ld,"
"%u,',&nbsp;',null,true,false,false);"
"</script>",
(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,"</label>"
"</li>");
}
/***** 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,"<span id=\"date_format_%u\"></span>",
(unsigned) Format);
}
void Dat_PutScriptDateFormat (Dat_Format_t Format)
{
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
"writeLocalDateHMSFromUTC('date_format_%u',%ld,"
"%u,',&nbsp;',null,true,false,false);"
"</script>",
(unsigned) Format,(long) Gbl.StartExecutionTimeUTC,
(unsigned) Format);
}
/*****************************************************************************/
/***************************** Change date format ****************************/
/*****************************************************************************/

View File

@ -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);

View File

@ -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,"<tr>"
"<td class=\"DAT_N LEFT_MIDDLE\">"
"%s"
"</td>"
"<td class=\"DAT_N LEFT_MIDDLE\">");
Dat_PutSpanDateFormat (Format);
Dat_PutScriptDateFormat (Format);
fprintf (Gbl.F.Out,"</td>"
"<td class=\"DAT RIGHT_MIDDLE\">"
"%u"
"</td>"
@ -8959,11 +8960,11 @@ static void Sta_GetAndShowNumUsrsPerDateFormat (void)
"%5.2f%%"
"</td>"
"</tr>",
Dat_Format_Str[Format],
NumUsrs[Format],
NumUsrsTotal ? (float) NumUsrs[Format] * 100.0 /
(float) NumUsrsTotal :
0);
}
/***** End table *****/
Lay_EndRoundFrameTable ();