Version 15.118.4

This commit is contained in:
Antonio Cañas Vargas 2016-01-18 14:19:36 +01:00
parent 2b42cf4b38
commit ba538c912f
3 changed files with 31 additions and 21 deletions

View File

@ -40,8 +40,12 @@ var countClockConnected = 0;
//id is the id of the HTML element in which date will be written
//TimeUTC is the date-time to write in UTC UNIX time format
function writeLocalDateFromUTC (id,TimeUTC) {
var d = new Date;
function writeLocalDateFromUTC (id,TimeUTC,StrToday) {
var today = new Date();
var todayYea = today.getFullYear();
var todayMon = today.getMonth()+1;
var todayDay = today.getDate();
var d = new Date();
var Yea;
var Mon;
var Day;
@ -54,7 +58,13 @@ function writeLocalDateFromUTC (id,TimeUTC) {
Day = d.getDate();
StrMon = ((Mon < 10) ? '0' : '') + Mon;
StrDay = ((Day < 10) ? '0' : '') + Day;
document.getElementById(id).innerHTML = Yea + '-' + StrMon + '-' + StrDay;
if (Yea == todayYea && Mon == todayMon && Day == todayDay && // Today
StrToday.length)
document.getElementById(id).innerHTML = StrToday;
else
document.getElementById(id).innerHTML = Yea + '-' + StrMon + '-' + StrDay;
}
/*************** Write a date-time in client local time **********************/
@ -64,11 +74,11 @@ function writeLocalDateFromUTC (id,TimeUTC) {
function writeLocalDateHMSFromUTC (id,TimeUTC,separator,StrToday) {
// HMS: Hour, Minutes, Seconds
var today = new (Date);
var today = new Date();
var todayYea = today.getFullYear();
var todayMon = today.getMonth()+1;
var todayDay = today.getDate();
var d = new Date;
var d = new Date();
var Yea;
var Mon;
var Day;
@ -106,11 +116,11 @@ function writeLocalDateHMSFromUTC (id,TimeUTC,separator,StrToday) {
function writeLocalDateHMFromUTC (id,TimeUTC,separator,StrToday) {
// HM: Hour, Minutes
var today = new (Date);
var today = new Date();
var todayYea = today.getFullYear();
var todayMon = today.getMonth()+1;
var todayDay = today.getDate();
var d = new Date;
var d = new Date();
var Yea;
var Mon;
var Day;
@ -155,7 +165,7 @@ function setLocalDateTimeFormFromUTC (id,TimeUTC) {
var YearIsValid = false;
if (TimeUTC) {
d = new Date;
d = new Date();
d.setTime(TimeUTC * 1000);
Year = d.getFullYear();
for (var i=0; i<FormYea.options.length && !YearIsValid; i++)
@ -184,7 +194,7 @@ function setLocalDateTimeFormFromUTC (id,TimeUTC) {
// Set UTC time from local date-time form fields
function setUTCFromLocalDateTimeForm (id) {
var d = new (Date);
var d = new Date();
// Important: set year first in order to work properly with leap years
d.setFullYear(document.getElementById(id+'Year' ).value);
@ -202,7 +212,7 @@ function setUTCFromLocalDateTimeForm (id) {
// For example, if your time zone is GMT+2, -120 will be returned
function setTZ (id) {
var FormTZ = document.getElementById(id);
var d = new (Date);
var d = new Date();
FormTZ.value = d.getTimezoneOffset();
}
@ -245,7 +255,7 @@ function adjustDateForm (id) {
// Set a date range form to yesterday
function setDateToYesterday () {
var d = new (Date);
var d = new Date();
d.setTime (d.getTime () - 24*60*60*1000); // Today - 1 day
setDateRange(d);
@ -253,7 +263,7 @@ function setDateToYesterday () {
// Set a date range form to today
function setDateToToday () {
var d = new (Date);
var d = new Date();
setDateRange(d);
}
@ -303,7 +313,7 @@ function writeLocalClock () {
setTimeout('writeLocalClock()',60000);
d = new Date;
d = new Date();
d.setTime(secondsSince1970UTC * 1000);
secondsSince1970UTC += 60; // For next call
@ -866,7 +876,7 @@ function Cal_DrawCalendar (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod,PrintView,
7, // November --> July
7 // December --> July
];
var d = new Date;
var d = new Date();
d.setTime(TimeUTC * 1000);
var CurrentMonth = d.getMonth() + 1;
var CurrentYear = d.getFullYear();
@ -915,7 +925,7 @@ function Cal_DrawCalendar (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod,PrintView,
function DrawCurrentMonth (id,FirstDayOfWeek,TimeUTC,CurrentPlcCod,
CGI,FormGoToCalendarParams,FormEventParams) {
var d = new Date;
var d = new Date();
d.setTime(TimeUTC * 1000);
var Year = d.getFullYear();
var Month = d.getMonth() + 1;

View File

@ -118,19 +118,18 @@
// TODO: Width of column for data in notifications is too short
// TODO: Increment one second after each refresh in social timeline?
// TODO: Date-time without seconds in user's public profile.
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 15.118.3 (2016-01-18)"
#define Log_PLATFORM_VERSION "SWAD 15.118.4 (2016-01-18)"
#define CSS_FILE "swad15.117.css"
#define JS_FILE "swad15.117.js"
#define JS_FILE "swad15.118.4.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 15.118.4: Jan 18, 2016 Date-time without seconds in user's public profile. (192984 lines)
Version 15.118.3: Jan 18, 2016 Fixed bug in date-time of files in file-browsers. (192975 lines)
Version 15.118.2: Jan 18, 2016 Fixed bug in social_timelines table. (192973 lines)
ALTER TABLE sessions CHANGE SessionId SessionId CHAR(43) COLLATE latin1_spanish_ci NOT NULL;

View File

@ -317,6 +317,7 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
extern const char *Txt_From_TIME;
extern const char *Txt_day;
extern const char *Txt_days;
extern const char *Txt_Today;
extern const char *Txt_Clicks;
extern const char *Txt_clicks;
extern const char *Txt_Downloads;
@ -406,9 +407,9 @@ static void Prf_ShowDetailsUserProfile (const struct UsrData *UsrDat)
(UsrFigures.NumDays == 1) ? Txt_day :
Txt_days);
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
"writeLocalDateHMSFromUTC('first_click_date',%ld,'&nbsp;');"
"writeLocalDateFromUTC('first_click_date',%ld,'%s');"
"</script>",
(long) UsrFigures.FirstClickTimeUTC);
(long) UsrFigures.FirstClickTimeUTC,Txt_Today);
}
else // First click time is unknown or user never logged
/***** Button to fetch and store first click time *****/