From 2ae53c304a504cf33a75a0a3f4a0dad97b77b701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 27 Oct 2015 19:44:31 +0100 Subject: [PATCH] Version 15.25.4 --- js/swad.js | 20 ++++++++++++-------- swad_changelog.h | 3 ++- swad_date.c | 21 +++++++++++++++++++++ swad_date.h | 2 ++ swad_layout.c | 8 ++++++-- 5 files changed, 43 insertions(+), 11 deletions(-) diff --git a/js/swad.js b/js/swad.js index 4db1c4d71..e9f35d8ea 100644 --- a/js/swad.js +++ b/js/swad.js @@ -29,7 +29,7 @@ var secondsSince1970UTC; // Global variables used in writeClockConnected() var NumUsrsCon; -var ListSeconds = new Array(); +var ListSeconds = []; var countClockConnected = 0; // Write a date in client local time @@ -254,9 +254,11 @@ function setDateTo (Yea,Mon,Day) { // Write clock in client local time updated every minute function writeLocalClock() { var d; - var H; - var M; - var StrM; + var Mon; + var Day; + var Hou; + var Min; + var StrMin; setTimeout('writeLocalClock()',60000); @@ -264,10 +266,12 @@ function writeLocalClock() { d.setTime(secondsSince1970UTC * 1000); secondsSince1970UTC += 60; // For next call - H = d.getHours(); - M = d.getMinutes(); - StrM = ((M < 10) ? '0' : '') + M; - document.getElementById('hm').innerHTML = H + ':' + StrM; + Mon = d.getMonth(); + Day = d.getDate(); + Hou = d.getHours(); + Min = d.getMinutes(); + StrMin = ((Min < 10) ? '0' : '') + Min; + document.getElementById('hm').innerHTML = Day + ' ' + Months[Mon] + ', ' + Hou + ':' + StrMin; } function writeClockConnected() { diff --git a/swad_changelog.h b/swad_changelog.h index 07958577d..327b40d72 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -108,11 +108,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.25.3 (2015/10/27)" +#define Log_PLATFORM_VERSION "SWAD 15.25.4 (2015/10/27)" // 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 15.25.4: Oct 27, 2015 Day and month are displayed in clock. (186251 lines) Version 15.25.3: Oct 27, 2015 Statistics computed using time UTC. (186225 lines) Version 15.25.2: Oct 26, 2015 Changes related to date-times. (186247 lines) Version 15.25.1: Oct 26, 2015 Warning about stats computed in server time instead of user's local time. (186263 lines) diff --git a/swad_date.c b/swad_date.c index 58917b19c..85168b826 100644 --- a/swad_date.c +++ b/swad_date.c @@ -977,3 +977,24 @@ void Dat_AssignDate (struct Date *DateDst,struct Date *DateSrc) DateDst->Day = DateSrc->Day; DateDst->Week = DateSrc->Week; } + +/*****************************************************************************/ +/****** Write script to automatically update clocks of connected users *******/ +/*****************************************************************************/ + +void Dat_WriteScriptMonths (void) + { + extern const char *Txt_MONTHS_SMALL_SHORT[12]; + unsigned NumMonth; + + fprintf (Gbl.F.Out,"var Months = ["); + for (NumMonth = 0; + NumMonth < 12; + NumMonth++) + { + if (NumMonth) + fprintf (Gbl.F.Out,","); + fprintf (Gbl.F.Out,"'%s'",Txt_MONTHS_SMALL_SHORT[NumMonth]); + } + fprintf (Gbl.F.Out,"];\n"); + } diff --git a/swad_date.h b/swad_date.h index 4c0a86bdf..5803b23fa 100644 --- a/swad_date.h +++ b/swad_date.h @@ -113,4 +113,6 @@ unsigned Dat_GetDayOfYear (struct Date *Date); void Dat_CalculateWeekOfYear (struct Date *Date); void Dat_AssignDate (struct Date *DateDst,struct Date *DateSrc); +void Dat_WriteScriptMonths (void); + #endif diff --git a/swad_layout.c b/swad_layout.c index 82f01bf8e..c47138dd2 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -535,8 +535,12 @@ static void Lay_WriteScriptInit (void) { extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES]; - fprintf (Gbl.F.Out,"