diff --git a/js/swad16.98.js b/js/swad16.99.js
similarity index 98%
rename from js/swad16.98.js
rename to js/swad16.99.js
index 0cc0df4cf..0fd4b3bfc 100644
--- a/js/swad16.98.js
+++ b/js/swad16.99.js
@@ -72,7 +72,8 @@ function writeLocalDateFromUTC (id,TimeUTC,StrToday) {
// TimeUTC is the date-time to write in UTC UNIX time format
// separator is HTML code to write between date and time
-function writeLocalDateHMSFromUTC (id,TimeUTC,Separator,StrToday,OmitDateOnSameDay,OmitSeconds) {
+function writeLocalDateHMSFromUTC (id,TimeUTC,Separator,StrToday,
+ WriteDateOnSameDay,WriteWeekDay,WriteSeconds) {
// HMS: Hour, Minutes, Seconds
var today = new Date();
var todayYea = today.getFullYear();
@@ -83,6 +84,7 @@ function writeLocalDateHMSFromUTC (id,TimeUTC,Separator,StrToday,OmitDateOnSameD
var Yea;
var Mon;
var Day;
+ var DayOfWeek;
var Hou;
var Min;
var Sec;
@@ -98,14 +100,14 @@ function writeLocalDateHMSFromUTC (id,TimeUTC,Separator,StrToday,OmitDateOnSameD
Mon = d.getMonth() + 1;
Day = d.getDate();
- if (OmitDateOnSameDay)
+ if (WriteDateOnSameDay)
+ WriteDate = true;
+ else
WriteDate = (Yea != writeLocalDateHMSFromUTC.lastd.getFullYear() ||
Mon != writeLocalDateHMSFromUTC.lastd.getMonth() + 1 ||
Day != writeLocalDateHMSFromUTC.lastd.getDate())
- else
- WriteDate = true;
- writeLocalDateHMSFromUTC.lastd = d; // Remember current date for the next call
+ writeLocalDateHMSFromUTC.lastd = d; // Static variable to remember current date for the next call
/* Set date */
if (WriteDate) {
@@ -119,6 +121,14 @@ function writeLocalDateHMSFromUTC (id,TimeUTC,Separator,StrToday,OmitDateOnSameD
StrDate = StrToday;
else
StrDate = Yea.toString() + StrMon + StrDay;
+
+ if (WriteWeekDay) {
+ DayOfWeek = d.getDay();
+ DayOfWeek = (DayOfWeek == 0) ? 6 : DayOfWeek - 1;
+ StrDate = StrDate + Separator + DAYS[DayOfWeek] + Separator;
+ }
+ else
+ StrDate = StrDate + Separator;
}
else
StrDate = '';
@@ -128,19 +138,18 @@ function writeLocalDateHMSFromUTC (id,TimeUTC,Separator,StrToday,OmitDateOnSameD
Min = d.getMinutes();
StrHou = ((Hou < 10) ? '0' : '') + Hou;
StrMin = ((Min < 10) ? ':0' : ':') + Min;
- if (OmitSeconds)
- StrSec = '';
- else {
+ if (WriteSeconds) {
Sec = d.getSeconds();
if (Sec)
StrSec = ((Sec < 10) ? ':0' : ':') + Sec;
else
StrSec = '';
}
+ else
+ StrSec = '';
/* Write date and time */
- document.getElementById(id).innerHTML = StrDate + Separator +
- StrHou + StrMin + StrSec;
+ document.getElementById(id).innerHTML = StrDate + StrHou + StrMin + StrSec;
}
// Set local date-time form fields from UTC time
diff --git a/swad_agenda.c b/swad_agenda.c
index 47f1305b7..e4e7a3fe9 100644
--- a/swad_agenda.c
+++ b/swad_agenda.c
@@ -604,9 +604,10 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
/* Start date/time */
UniqueId++;
fprintf (Gbl.F.Out,"
"
- ""
+ " | "
""
" | ",
UniqueId,
@@ -617,9 +618,10 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
/* End date/time */
UniqueId++;
- fprintf (Gbl.F.Out,""
+ fprintf (Gbl.F.Out," | "
""
" | ",
UniqueId,
@@ -672,14 +674,11 @@ static void Agd_ShowOneEvent (Agd_AgendaType_t AgendaType,long AgdCod)
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
- fprintf (Gbl.F.Out,"",
- Gbl.RowEvenOdd);
-
- fprintf (Gbl.F.Out," "
- "%s"
- " "
+ fprintf (Gbl.F.Out," | "
+ " %s "
" | "
"
",
+ Gbl.RowEvenOdd,
AgdEvent.Hidden ? "DAT_LIGHT" :
"DAT",
Txt);
diff --git a/swad_assignment.c b/swad_assignment.c
index 8bf27220e..e053cc9b8 100644
--- a/swad_assignment.c
+++ b/swad_assignment.c
@@ -314,9 +314,10 @@ static void Asg_ShowOneAssignment (long AsgCod)
/* Start date/time */
UniqueId++;
fprintf (Gbl.F.Out,""
- ""
+ " | "
""
" | ",
UniqueId,
@@ -329,9 +330,10 @@ static void Asg_ShowOneAssignment (long AsgCod)
/* End date/time */
UniqueId++;
- fprintf (Gbl.F.Out,""
+ fprintf (Gbl.F.Out," | "
""
" | ",
UniqueId,
diff --git a/swad_attendance.c b/swad_attendance.c
index b415468aa..d1c8b1175 100644
--- a/swad_attendance.c
+++ b/swad_attendance.c
@@ -362,7 +362,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt
/***** Start date/time *****/
UniqueId++;
fprintf (Gbl.F.Out,"
" \
- "Hidden ? (Att->Open ? "DATE_GREEN_LIGHT" :
"DATE_RED_LIGHT") :
@@ -372,13 +372,14 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
fprintf (Gbl.F.Out,"\">"
""
" | ",
UniqueId,Att->TimeUTC[Att_START_TIME],Txt_Today);
/***** End date/time *****/
- fprintf (Gbl.F.Out,"Hidden ? (Att->Open ? "DATE_GREEN_LIGHT" :
"DATE_RED_LIGHT") :
@@ -388,7 +389,8 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt
fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd);
fprintf (Gbl.F.Out,"\">"
""
" | ",
UniqueId,Att->TimeUTC[Att_END_TIME],Txt_Today);
@@ -3107,7 +3109,8 @@ static void Att_ListEventsToSelect (Att_TypeOfView_t TypeOfView)
""
" %s"
""
" | "
""
@@ -3515,7 +3518,8 @@ static void Att_ListAttEventsForAStd (unsigned NumStd,struct UsrData *UsrDat)
" alt=\"%s\" title=\"%s\" class=\"ICO20x20\" />"
" %s"
""
" | "
"
",
diff --git a/swad_changelog.h b/swad_changelog.h
index 1ebb259c2..e71ab8584 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -185,13 +185,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 16.98 (2016-12-12)"
+#define Log_PLATFORM_VERSION "SWAD 16.99 (2016-12-12)"
#define CSS_FILE "swad16.97.css"
-#define JS_FILE "swad16.98.js"
+#define JS_FILE "swad16.99.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.99: Dec 12, 2016 Changes in script to write local date and time. (210782 lines)
Version 16.98: Dec 12, 2016 Changes in help about homework.
Changes in script to write local date and time. (210739 lines)
Version 16.97.1: Dec 12, 2016 Changes in translation about announcements of exams. (210748 lines)
diff --git a/swad_file_browser.c b/swad_file_browser.c
index 75515b69e..ceaf4c1c2 100644
--- a/swad_file_browser.c
+++ b/swad_file_browser.c
@@ -6151,7 +6151,8 @@ static void Brw_WriteDatesAssignment (void)
Gbl.FileBrowser.Asg.Open ? "ASG_LST_DATE_GREEN" :
"ASG_LST_DATE_RED");
fprintf (Gbl.F.Out,"",
UniqueId,
(long) Gbl.FileBrowser.Asg.TimeUTC[Asg_START_TIME],Txt_Today);
@@ -6171,7 +6172,8 @@ static void Brw_WriteDatesAssignment (void)
Gbl.FileBrowser.Asg.Open ? "ASG_LST_DATE_GREEN" :
"ASG_LST_DATE_RED");
fprintf (Gbl.F.Out,"",
UniqueId,
(long) Gbl.FileBrowser.Asg.TimeUTC[Asg_END_TIME],Txt_Today);
@@ -6214,7 +6216,8 @@ static void Brw_WriteFileSizeAndDate (struct FileMetadata *FileMetadata)
UniqueId++;
fprintf (Gbl.F.Out,""
"",
UniqueId,
UniqueId,(long) FileMetadata->Time,Txt_Today);
@@ -9378,7 +9381,8 @@ void Brw_ShowFileMetadata (void)
""
""
""
" | "
"",
diff --git a/swad_forum.c b/swad_forum.c
index d42c4cfb7..c438a18ec 100644
--- a/swad_forum.c
+++ b/swad_forum.c
@@ -3481,7 +3481,8 @@ void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],struct Pagination *Pagi
UniqueId++;
fprintf (Gbl.F.Out,""
""
" | ",
UniqueId,Style,BgColor,
diff --git a/swad_group.c b/swad_group.c
index 5866246ed..4d18a36ef 100644
--- a/swad_group.c
+++ b/swad_group.c
@@ -1951,7 +1951,8 @@ static void Grp_WriteGrpHead (struct GroupType *GrpTyp)
fprintf (Gbl.F.Out,"
%s: "
""
"",
Txt_Opening_of_groups,
UniqueId,
diff --git a/swad_layout.c b/swad_layout.c
index 73ba2ee22..e43b09b74 100644
--- a/swad_layout.c
+++ b/swad_layout.c
@@ -442,6 +442,7 @@ static void Lay_WriteScripts (void)
extern struct Act_Actions Act_Actions[Act_NUM_ACTIONS];
extern const char *Txt_MONTHS_CAPS[12];
extern const char *Txt_DAYS_CAPS[7];
+ extern const char *Txt_DAYS_SMALL[7];
extern const char *Txt_Exam_of_X;
unsigned Month;
unsigned DayOfWeek; /* 0, 1, 2, 3, 4, 5, 6 */
@@ -524,6 +525,17 @@ static void Lay_WriteScripts (void)
}
fprintf (Gbl.F.Out,"];\n");
+ fprintf (Gbl.F.Out," var DAYS = [");
+ for (DayOfWeek = 0;
+ DayOfWeek < 7;
+ DayOfWeek++)
+ {
+ if (DayOfWeek)
+ fprintf (Gbl.F.Out,",");
+ fprintf (Gbl.F.Out,"'%s'",Txt_DAYS_SMALL[DayOfWeek]);
+ }
+ fprintf (Gbl.F.Out,"];\n");
+
fprintf (Gbl.F.Out," var STR_EXAM = '");
fprintf (Gbl.F.Out,Txt_Exam_of_X,Gbl.CurrentCrs.Crs.FullName);
fprintf (Gbl.F.Out,"';\n");
diff --git a/swad_message.c b/swad_message.c
index 326c5a4ea..52fb5c1ff 100644
--- a/swad_message.c
+++ b/swad_message.c
@@ -3510,7 +3510,8 @@ void Msg_WriteMsgDate (time_t TimeUTC,const char *ClassBackground)
/***** Write date and time *****/
fprintf (Gbl.F.Out,"",
UniqueId,(long) TimeUTC,Txt_Today);
diff --git a/swad_notice.c b/swad_notice.c
index d4142cf42..b683786b9 100644
--- a/swad_notice.c
+++ b/swad_notice.c
@@ -711,7 +711,8 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing,
Act_FormEnd ();
}
fprintf (Gbl.F.Out,""
"",
UniqueId,(long) TimeUTC,Txt_Today);
diff --git a/swad_social.c b/swad_social.c
index 24df97200..d0a547fce 100644
--- a/swad_social.c
+++ b/swad_social.c
@@ -1449,7 +1449,8 @@ static void Soc_WriteDateTime (time_t TimeUTC)
// This must be out of the div where the output is written
// because it will be evaluated in a loop in JavaScript
fprintf (Gbl.F.Out,"",
IdDateTime,(long) TimeUTC,Txt_Today);
}
diff --git a/swad_statistic.c b/swad_statistic.c
index 416962a3f..e209a6bfe 100644
--- a/swad_statistic.c
+++ b/swad_statistic.c
@@ -1695,7 +1695,8 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql
/* Write the date-time (row[3]) */
fprintf (Gbl.F.Out,""
""
" | ",
UniqueId,Gbl.RowEvenOdd,
diff --git a/swad_survey.c b/swad_survey.c
index d0b5bbf11..0285a2d62 100644
--- a/swad_survey.c
+++ b/swad_survey.c
@@ -442,7 +442,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,
/***** Start date/time *****/
UniqueId++;
fprintf (Gbl.F.Out,""
- ""
""
" | ",
UniqueId,Svy.TimeUTC[Svy_START_TIME],Txt_Today);
/***** End date/time *****/
- fprintf (Gbl.F.Out,""
""
" | ",
UniqueId,Svy.TimeUTC[Svy_END_TIME],Txt_Today);
diff --git a/swad_test.c b/swad_test.c
index 5a1996847..f9bb63aec 100644
--- a/swad_test.c
+++ b/swad_test.c
@@ -672,7 +672,8 @@ static bool Tst_CheckIfNextTstAllowed (void)
""
""
""
"",
(long) TimeNextTestUTC,Txt_Today);
@@ -2813,7 +2814,8 @@ static void Tst_ListOneOrMoreQuestionsToEdit (unsigned long NumRows,MYSQL_RES *m
fprintf (Gbl.F.Out,""
""
" | ",
UniqueId,Gbl.RowEvenOdd,
@@ -7252,7 +7254,8 @@ static void Tst_ShowTestResults (struct UsrData *UsrDat)
UniqueId++;
fprintf (Gbl.F.Out,""
""
" | ",
UniqueId,ClassDat,Gbl.RowEvenOdd,
@@ -7637,7 +7640,8 @@ void Tst_ShowOneTestResult (void)
""
""
""
" | "
"
",