diff --git a/js/swad16.206.js b/js/swad16.206.1.js similarity index 98% rename from js/swad16.206.js rename to js/swad16.206.1.js index ad3cf1caf..c947ec30a 100644 --- a/js/swad16.206.js +++ b/js/swad16.206.1.js @@ -44,9 +44,10 @@ var countClockConnected = 0; // Dat_FORMAT_DD_MONTH_YYYY = 1 // Dat_FORMAT_MONTH_DD_YYYY = 2 // separator is HTML code to write between date and time +// WriteHMS = 3 least significant bits for hour, minute and second function writeLocalDateHMSFromUTC (id,TimeUTC,DateFormat,Separator,StrToday, - WriteDateOnSameDay,WriteWeekDay,WriteSeconds) { + WriteDateOnSameDay,WriteWeekDay,WriteHMS) { // HMS: Hour, Minutes, Seconds var today = new Date(); var todayYea = today.getFullYear(); @@ -95,7 +96,7 @@ function writeLocalDateHMSFromUTC (id,TimeUTC,DateFormat,Separator,StrToday, if (WriteTodayStr) StrDate = StrToday; - else { + else switch (DateFormat) { case 0: // Dat_FORMAT_YYYY_MM_DD StrMon = ((Mon < 10) ? '0' : '') + Mon; @@ -112,7 +113,6 @@ function writeLocalDateHMSFromUTC (id,TimeUTC,DateFormat,Separator,StrToday, StrDate = ''; break; } - } if (WriteWeekDay) { DayOfWeek = d.getDay(); @@ -124,16 +124,25 @@ function writeLocalDateHMSFromUTC (id,TimeUTC,DateFormat,Separator,StrToday, else StrDate = ''; - /* Set time */ - Hou = d.getHours(); - Min = d.getMinutes(); - StrHou = ((Hou < 10) ? '0' : '') + Hou; - StrMin = ((Min < 10) ? ':0' : ':') + Min; + /* Set HH:MM:SS */ + StrHou = ''; + StrMin = ''; StrSec = ''; - if (WriteSeconds) { - Sec = d.getSeconds(); - if (Sec) - StrSec = ((Sec < 10) ? ':0' : ':') + Sec; + if (WriteHMS & (1<<2)) { + // Bit 2 on => Write hour + Hou = d.getHours(); + StrHou = ((Hou < 10) ? '0' : '') + Hou; + if (WriteHMS & (1<<1)) { + // Bits 2,1 on => Write minutes + Min = d.getMinutes(); + StrMin = ((Min < 10) ? ':0' : ':') + Min; + if (WriteHMS & 1) { + // Bits 2,1,0 on => Write seconds + Sec = d.getSeconds(); + if (Sec) + StrSec = ((Sec < 10) ? ':0' : ':') + Sec; + } + } } /* Write date and time */ diff --git a/swad_agenda.c b/swad_agenda.c index 99a53a16c..330730f55 100644 --- a/swad_agenda.c +++ b/swad_agenda.c @@ -752,7 +752,7 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod) "" "" "", UniqueId, @@ -767,7 +767,7 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod) fprintf (Gbl.F.Out,"" "" "", UniqueId, diff --git a/swad_assignment.c b/swad_assignment.c index dd2976b69..18b0e7549 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -381,7 +381,7 @@ static void Asg_ShowOneAssignment (long AsgCod,bool PrintView) fprintf (Gbl.F.Out,"\">" "" "", UniqueId,Asg.TimeUTC[Dat_START_TIME], @@ -400,7 +400,7 @@ static void Asg_ShowOneAssignment (long AsgCod,bool PrintView) fprintf (Gbl.F.Out,"\">" "" "", UniqueId,Asg.TimeUTC[Dat_END_TIME], diff --git a/swad_attendance.c b/swad_attendance.c index d4d99b8d9..2b035b2c5 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -394,7 +394,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt fprintf (Gbl.F.Out,"\">" "" "", UniqueId,Att->TimeUTC[Att_START_TIME], @@ -412,7 +412,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt fprintf (Gbl.F.Out,"\">" "" "", UniqueId,Att->TimeUTC[Att_END_TIME], @@ -3081,7 +3081,7 @@ static void Att_ListEventsToSelect (Att_TypeOfView_t TypeOfView) "" "" "" "" @@ -3490,7 +3490,7 @@ static void Att_ListAttEventsForAStd (unsigned NumStd,struct UsrData *UsrDat) " %s" "" "" "", diff --git a/swad_changelog.h b/swad_changelog.h index 952f6e9d7..bf4659f7d 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -232,13 +232,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.206 (2017-05-05)" +#define Log_PLATFORM_VERSION "SWAD 16.206.1 (2017-05-05)" #define CSS_FILE "swad16.205.css" -#define JS_FILE "swad16.206.js" +#define JS_FILE "swad16.206.1.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.206.1: May 05, 2017 Changes in Javascript function to write local date and time. (218524 lines) 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.3: May 04, 2017 Changes in statistics about date format. (218447 lines) diff --git a/swad_date.c b/swad_date.c index b6ab418aa..4b80de8db 100644 --- a/swad_date.c +++ b/swad_date.c @@ -164,7 +164,7 @@ void Dat_PutScriptDateFormat (Dat_Format_t Format) { fprintf (Gbl.F.Out,"", (unsigned) Format,(long) Gbl.StartExecutionTimeUTC, (unsigned) Format); diff --git a/swad_file_browser.c b/swad_file_browser.c index 1384c44bf..34d073382 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -6045,7 +6045,7 @@ static void Brw_WriteDatesAssignment (void) "ASG_LST_DATE_RED"); fprintf (Gbl.F.Out,"", UniqueId,(long) Gbl.FileBrowser.Asg.TimeUTC[Dat_START_TIME], (unsigned) Gbl.Prefs.DateFormat,Txt_Today); @@ -6066,7 +6066,7 @@ static void Brw_WriteDatesAssignment (void) "ASG_LST_DATE_RED"); fprintf (Gbl.F.Out,"", UniqueId,(long) Gbl.FileBrowser.Asg.TimeUTC[Dat_END_TIME], (unsigned) Gbl.Prefs.DateFormat,Txt_Today); @@ -6110,7 +6110,7 @@ static void Brw_WriteFileSizeAndDate (struct FileMetadata *FileMetadata) fprintf (Gbl.F.Out,"" "", UniqueId, UniqueId,(long) FileMetadata->Time, @@ -9194,7 +9194,7 @@ void Brw_ShowFileMetadata (void) "" "" "" "", diff --git a/swad_forum.c b/swad_forum.c index 45b0cce1b..cfb27fc47 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -3407,7 +3407,7 @@ static void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE], fprintf (Gbl.F.Out,"" "" "", UniqueId,Style,BgColor, diff --git a/swad_group.c b/swad_group.c index e50eba41f..fc8f599e7 100644 --- a/swad_group.c +++ b/swad_group.c @@ -2072,7 +2072,7 @@ static void Grp_WriteGrpHead (struct GroupType *GrpTyp) "" "", Txt_Opening_of_groups, UniqueId, diff --git a/swad_message.c b/swad_message.c index a37bb8f93..8a253f621 100644 --- a/swad_message.c +++ b/swad_message.c @@ -3526,7 +3526,7 @@ void Msg_WriteMsgDate (time_t TimeUTC,const char *ClassBackground) /***** Write date and time *****/ fprintf (Gbl.F.Out,"", UniqueId,(long) TimeUTC, (unsigned) Gbl.Prefs.DateFormat,Txt_Today); diff --git a/swad_notice.c b/swad_notice.c index e0e9049f4..37add334b 100644 --- a/swad_notice.c +++ b/swad_notice.c @@ -704,7 +704,7 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, } fprintf (Gbl.F.Out,"" "", UniqueId,(long) TimeUTC, diff --git a/swad_profile.c b/swad_profile.c index 35ad6dc2b..878a86643 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -456,7 +456,7 @@ void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat) Txt_days); fprintf (Gbl.F.Out,"", IdFirstClickTime,(long) UsrFigures.FirstClickTimeUTC, (unsigned) Gbl.Prefs.DateFormat,Txt_Today); diff --git a/swad_social.c b/swad_social.c index dcdf07257..273350cd7 100644 --- a/swad_social.c +++ b/swad_social.c @@ -1626,7 +1626,7 @@ static void Soc_WriteDateTime (time_t TimeUTC) // because it will be evaluated in a loop in JavaScript fprintf (Gbl.F.Out,"", IdDateTime,(long) TimeUTC, (unsigned) Gbl.Prefs.DateFormat,Txt_Today); diff --git a/swad_statistic.c b/swad_statistic.c index 0a9a8bbc0..7f998497a 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -1772,7 +1772,7 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql fprintf (Gbl.F.Out,"" "" "", UniqueId,Gbl.RowEvenOdd, diff --git a/swad_survey.c b/swad_survey.c index 3e23e7208..ff18914cf 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -463,7 +463,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst, fprintf (Gbl.F.Out,"\">" "" "", UniqueId,Svy.TimeUTC[Svy_START_TIME], @@ -481,7 +481,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst, fprintf (Gbl.F.Out,"\">" "" "", UniqueId,Svy.TimeUTC[Svy_END_TIME], diff --git a/swad_test.c b/swad_test.c index 004bd19ea..23c37006f 100644 --- a/swad_test.c +++ b/swad_test.c @@ -681,7 +681,7 @@ static bool Tst_CheckIfNextTstAllowed (void) sprintf (Gbl.Message,"%s:
." "", Txt_You_can_not_take_a_new_test_until, (long) TimeNextTestUTC, @@ -2857,7 +2857,7 @@ static void Tst_ListOneOrMoreQuestionsToEdit (unsigned long NumRows,MYSQL_RES *m " class=\"DAT_SMALL CENTER_TOP COLOR%u\">" "" "", UniqueId,Gbl.RowEvenOdd, @@ -7332,7 +7332,7 @@ static void Tst_ShowTestResults (struct UsrData *UsrDat) fprintf (Gbl.F.Out,"" "" "", UniqueId,ClassDat,Gbl.RowEvenOdd, @@ -7716,7 +7716,7 @@ void Tst_ShowOneTestResult (void) "" "" "" "",