From 611e835614ad1fe5a215b8364f5ff971f75d1234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Wed, 21 Oct 2015 19:53:35 +0200 Subject: [PATCH] Version 15.15.1 --- js/swad.js | 42 +++++++++++++----------------------------- swad_calendar.c | 2 +- swad_changelog.h | 3 ++- swad_connected.c | 6 +++--- swad_date.c | 24 +++++++++++++++++++++++- swad_layout.c | 13 +++---------- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/js/swad.js b/js/swad.js index 7af35fefd..cf0a760b1 100644 --- a/js/swad.js +++ b/js/swad.js @@ -24,41 +24,25 @@ // Global variable used in refreshConnected() var ActionAJAX; -// Global variables used in writeClock() -var IsToday; -var StrToday; -var Hour; -var Minute; +// Global variables used in writeLocalTime() +var secondsSince1970UTC; // Global variables used in writeClockConnected() var NumUsrsCon; var ListSeconds = new Array(); var countClockConnected = 0; -// Write a clock updated every minute -// IsToday, StrToday, Hour and Minute are global variables initialized before call this function -function writeClock() { - var StrHour = Hour; - var StrMinute = Minute; - var MidnightExceeded = false; - var PrintableClock; - if (Minute < 10) - StrMinute = "0" + StrMinute; - if (++Minute == 60) { - Minute = 0; - if (++Hour == 24) { - Hour = 0; - MidnightExceeded = true; - } - } - if (IsToday) - PrintableClock = StrToday + ", " + StrHour + ":" + StrMinute; - else - PrintableClock = StrHour + ":" + StrMinute; - if (MidnightExceeded) - IsToday = false; // For next call - document.getElementById('hm').innerHTML = PrintableClock; - setTimeout("writeClock()",60000); +// Write local date-time updated every minute +function writeLocalTime() { + var d = new Date; + var PrintableDate; + + d.setTime(secondsSince1970UTC * 1000); + PrintableDate = d.toLocaleDateString() + "
" + d.getHours() + ":" + d.getMinutes(); + document.getElementById('hm').innerHTML = PrintableDate; + + secondsSince1970UTC += 60; // For next call + setTimeout("writeLocalTime()",60000); } function writeClockConnected() { diff --git a/swad_calendar.c b/swad_calendar.c index c658e95c7..e0ccdfd5a 100644 --- a/swad_calendar.c +++ b/swad_calendar.c @@ -142,7 +142,7 @@ void Cal_DrawCalendar (void) /***** Draw several months *****/ fprintf (Gbl.F.Out,"" "" - ""); + "
"); for (Row = 0; Row < 4; Row++) diff --git a/swad_changelog.h b/swad_changelog.h index 5b3558ff1..6219b2d9a 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -107,11 +107,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 15.15 (2015/10/19)" +#define Log_PLATFORM_VERSION "SWAD 15.15.1 (2015/10/21)" // 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.15.1: Oct 21, 2015 Top-left date-time is now displayed in local time. (186249 lines) Version 15.15: Oct 19, 2015 Statistic figure about institutions can be displayed as a class photo or as a list. (186251 lines) Version 15.14.2: Oct 16, 2015 Minor changes in layout. (186166 lines) Version 15.14.1: Oct 16, 2015 Fixed minor bug in edition of degrees. (186170 lines) diff --git a/swad_connected.c b/swad_connected.c index 74d85ccc6..ae7a77988 100644 --- a/swad_connected.c +++ b/swad_connected.c @@ -207,11 +207,11 @@ void Con_GetAndShowLastClicks (void) fprintf (Gbl.F.Out,"
" "" "" "" "" "
" + " style=\"width:85px;\">" "%s" // Click "" + " style=\"width:70px;\">" "%s" // Hour "" "" + " style=\"width:150px;\">" "%s" // Institution " +function localize(t) +{ + var d=new Date(t+" UTC"); + document.write(d.toString()); +} + +*/ + fprintf (Gbl.F.Out,"
" + "
", + The_ClassCurrentTime[Gbl.Prefs.Theme]); + } /*****************************************************************************/ /***************** Compute local time, adjusting day of week *****************/ diff --git a/swad_layout.c b/swad_layout.c index 220890bd0..8846dd94b 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -533,22 +533,15 @@ static void Lay_WriteScripts (void) static void Lay_WriteScriptInit (void) { - extern const char *Txt_MONTHS_SMALL_SHORT[12]; extern const char *Txt_STR_LANG_ID[Txt_NUM_LANGUAGES]; fprintf (Gbl.F.Out,"