diff --git a/js/swad.js b/js/swad.js
index 2930e8b1c..0bb99da3c 100644
--- a/js/swad.js
+++ b/js/swad.js
@@ -43,16 +43,22 @@ function writeLocalDateFromUTC(id,secsSince1970UTC) {
// Write a date-time in client local time
function writeLocalDateTimeFromUTC(id,secsSince1970UTC) {
var d = new Date;
- var Minutes;
- var StrMinutes;
+ var H;
+ var M;
+ var S;
+ var StrH;
+ var StrM;
+ var StrS;
d.setTime(secsSince1970UTC * 1000);
- Minutes = d.getMinutes();
- Seconds = d.getSeconds();
- StrMinutes = ((Minutes < 10) ? "0" : "") + Minutes;
- StrSeconds = ((Seconds < 10) ? "0" : "") + Seconds;
- document.getElementById(id).innerHTML = d.toLocaleDateString() + "
" +
- d.getHours() + ":" + StrMinutes + ":" + StrSeconds;
+ H = d.getHours();
+ M = d.getMinutes();
+ S = d.getSeconds();
+ StrH = ((H < 10) ? '0' : '') + H;
+ StrM = ((M < 10) ? '0' : '') + M;
+ StrS = ((S < 10) ? '0' : '') + S;
+ document.getElementById(id).innerHTML = d.toLocaleDateString() + '
' +
+ StrH + ':' + StrM + ':' + StrS;
}
// Set local date-time form fields from UTC time
@@ -65,8 +71,7 @@ function setLocalDateTimeFormFromUTC(id,secsSince1970UTC) {
Year = d.getFullYear()
for (var i=0; i Days)
DayForm.options[Days].selected = true;
- for (var i=DayForm.options.length; i<=Days ; i++) // Create new days
- {
+ for (var i=DayForm.options.length; i<=Days ; i++) { // Create new days
var x = String (i);
DayForm.options[i] = new Option(x,x);
}
@@ -137,29 +141,30 @@ function setDateTo (elem,Day,Month,Year) {
// Write clock in client local time updated every minute
function writeLocalClock() {
var d = new Date;
- var Minutes;
- var StrMinutes;
- var PrintableDate;
+ var H;
+ var M;
+ var StrH;
+ var StrM;
- setTimeout("writeLocalTime()",60000);
+ setTimeout('writeLocalTime()',60000);
d.setTime(secondsSince1970UTC * 1000);
secondsSince1970UTC += 60; // For next call
- Minutes = d.getMinutes();
- StrMinutes = ((Minutes < 10) ? "0" : "") + Minutes;
- // PrintableDate = d.toLocaleDateString() + "
" + d.getHours() + ":" + StrMinutes;
- PrintableDate = d.getHours() + ":" + StrMinutes;
- document.getElementById('hm').innerHTML = PrintableDate;
+ H = d.getHours();
+ M = d.getMinutes();
+ StrH = ((H < 10) ? '0' : '') + H;
+ StrM = ((M < 10) ? '0' : '') + M;
+ document.getElementById('hm').innerHTML = StrH + ':' + StrM;
}
function writeClockConnected() {
var BoxClock;
- var Hours;
- var Minutes;
- var Seconds;
- var StrMinutes;
- var StrSeconds;
+ var H;
+ var M;
+ var S;
+ var StrM;
+ var StrS;
var PrintableClock;
countClockConnected++;
@@ -169,27 +174,27 @@ function writeClockConnected() {
if (BoxClock) {
ListSeconds[i] += 1;
if (!countClockConnected) { // Print after 10 seconds
- Minutes = Math.floor(ListSeconds[i] / 60);
- if (Minutes >= 60) {
- Hours = Math.floor(Minutes / 60);
- Minutes %= 60;
+ M = Math.floor(ListSeconds[i] / 60);
+ if (M >= 60) {
+ H = Math.floor(M / 60);
+ M %= 60;
} else
- Hours = 0;
- Seconds = ListSeconds[i] % 60;
- if (Hours != 0) {
- StrMinutes = ((Minutes < 10) ? "0" : "") + Minutes;
- StrSeconds = ((Seconds < 10) ? "0" : "") + Seconds;
- PrintableClock = Hours + ":" + StrMinutes + "'" + StrSeconds + """;
- } else if (Minutes != 0) {
- StrSeconds = ((Seconds < 10) ? "0" : "") + Seconds;
- PrintableClock = Minutes + "'" + StrSeconds + """;
+ H = 0;
+ S = ListSeconds[i] % 60;
+ if (H != 0) {
+ StrM = ((M < 10) ? '0' : '') + M;
+ StrS = ((S < 10) ? '0' : '') + S;
+ PrintableClock = H + ':' + StrM + ''' + StrS + '"';
+ } else if (M != 0) {
+ StrS = ((S < 10) ? '0' : '') + S;
+ PrintableClock = M + ''' + StrS + '"';
} else
- PrintableClock = Seconds + """;
+ PrintableClock = S + '"';
BoxClock.innerHTML = PrintableClock;
}
}
}
- setTimeout("writeClockConnected()",1000); // refresh after 1 second
+ setTimeout('writeClockConnected()',1000); // refresh after 1 second
}
// Automatic refresh of connected users using AJAX. This function must be called from time to time
@@ -225,10 +230,10 @@ function AJAXCreateObject() {
obj = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
try {
- obj = new ActiveXObject("Msxml2.XMLHTTP");
+ obj = new ActiveXObject('Msxml2.XMLHTTP');
} catch (e) {
try {
- obj = new ActiveXObject("Microsoft.XMLHTTP");
+ obj = new ActiveXObject('Microsoft.XMLHTTP');
} catch (e) {}
}
}
@@ -277,7 +282,7 @@ function readConnUsrsData() {
}
if (delay >= 60000) // If refresh slower than 1 time each 60 seconds, do refresh; else abort
- setTimeout("refreshConnected()",delay);
+ setTimeout('refreshConnected()',delay);
}
}
}
@@ -296,7 +301,7 @@ function readLastClicksData() {
if (divLastClicks)
divLastClicks.innerHTML = htmlLastClicks; // Update global connected DIV
if (delay > 200) // If refresh slower than 1 time each 0.2 seconds, do refresh; else abort
- setTimeout("refreshLastClicks()",delay);
+ setTimeout('refreshLastClicks()',delay);
}
}
}
diff --git a/swad_assignment.h b/swad_assignment.h
index aa37afe79..f0e35f4ac 100644
--- a/swad_assignment.h
+++ b/swad_assignment.h
@@ -57,7 +57,6 @@ struct Assignment
long AsgCod;
bool Hidden;
long UsrCod;
- // struct DateTime DateTimes[Asg_NUM_DATES];
time_t TimeUTC[Asg_NUM_DATES];
bool Open;
char Title[Asg_MAX_LENGTH_ASSIGNMENT_TITLE+1];
diff --git a/swad_changelog.h b/swad_changelog.h
index 3af0550f6..294d782ec 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -108,11 +108,12 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 15.17.2 (2015/10/23)"
+#define Log_PLATFORM_VERSION "SWAD 15.17.3 (2015/10/23)"
// 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.17.3: Oct 23, 2015 Changes in JavaScript functions related to date-time. (186477 lines)
Version 15.17.2: Oct 23, 2015 Code refactoring related to forms. (186472 lines)
Version 15.17.1: Oct 23, 2015 Code refactoring related to dates and JavaScript. (186407 lines)
Version 15.17: Oct 22, 2015 Code refactoring related to dates and JavaScript.