mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-08 01:35:32 +02:00
Version 16.141
This commit is contained in:
parent
f851fdc1cf
commit
5a049ed62b
|
@ -163,7 +163,9 @@ function setLocalDateTimeFormFromUTC (id,TimeUTC) {
|
|||
var d;
|
||||
var Year;
|
||||
var YearIsValid = false;
|
||||
var Hou;
|
||||
var Min;
|
||||
var Sec;
|
||||
|
||||
if (TimeUTC) {
|
||||
d = new Date();
|
||||
|
@ -177,7 +179,9 @@ function setLocalDateTimeFormFromUTC (id,TimeUTC) {
|
|||
if (YearIsValid) {
|
||||
FormMon.options[d.getMonth()].selected = true;
|
||||
FormDay.options[d.getDate()-1].selected = true;
|
||||
FormHou.options[d.getHours() ].selected = true;
|
||||
|
||||
Hou = d.getHours();
|
||||
FormHou.options[Hou].selected = true;
|
||||
|
||||
Min = d.getMinutes();
|
||||
for (var i=FormMin.options.length-1; i>=0; i--)
|
||||
|
@ -185,10 +189,13 @@ function setLocalDateTimeFormFromUTC (id,TimeUTC) {
|
|||
FormMin.options[i].selected = true;
|
||||
break;
|
||||
}
|
||||
if (FormSec)
|
||||
|
||||
if (FormSec) {
|
||||
Sec = d.getSeconds();
|
||||
FormSec.options[d.getSeconds()].selected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!YearIsValid) {
|
||||
FormYea.options[0].selected = true;
|
||||
|
@ -280,54 +287,64 @@ function adjustDateForm (id) {
|
|||
}
|
||||
|
||||
// Set a date range form to yesterday
|
||||
function setDateToYesterday () {
|
||||
function setDateToYesterday (idStart,idEnd) {
|
||||
var d = new Date();
|
||||
|
||||
d.setTime (d.getTime () - 24 * 60 * 60 * 1000); // Today - 1 day
|
||||
setDateRange(d);
|
||||
setDateRange(idStart,idEnd,d);
|
||||
}
|
||||
|
||||
// Set a date range form to today
|
||||
function setDateToToday () {
|
||||
function setDateToToday (idStart,idEnd) {
|
||||
var d = new Date();
|
||||
|
||||
setDateRange(d);
|
||||
setDateRange(idStart,idEnd,d);
|
||||
}
|
||||
|
||||
// Set a date range form to a specific day
|
||||
function setDateRange (d) {
|
||||
function setDateRange (idStart,idEnd,d) {
|
||||
var FormYea;
|
||||
var Yea = d.getFullYear();
|
||||
var Mon = d.getMonth() + 1;
|
||||
var Day = d.getDate();
|
||||
|
||||
FormYea = document.getElementById('StartYear');
|
||||
FormYea = document.getElementById(idStart+'Year');
|
||||
for (var i=0; i<FormYea.options.length; i++)
|
||||
if (FormYea.options[i].value == Yea) {
|
||||
FormYea.options[i].selected = true;
|
||||
break;
|
||||
}
|
||||
document.getElementById('StartMonth' ).options[Mon-1].selected = true;
|
||||
adjustDateForm ('Start'); // Adjust date form correcting days in the month
|
||||
document.getElementById('StartDay' ).options[Day-1].selected = true;
|
||||
document.getElementById('StartHour' ).options[0 ].selected = true;
|
||||
document.getElementById('StartMinute').options[0 ].selected = true;
|
||||
document.getElementById('StartSecond').options[0 ].selected = true;
|
||||
setUTCFromLocalDateTimeForm('Start');
|
||||
document.getElementById(idStart+'Month').options[Mon-1].selected = true;
|
||||
adjustDateForm (idStart); // Adjust date form correcting days in the month
|
||||
document.getElementById(idStart+'Day').options[Day-1].selected = true;
|
||||
setHMSTo000000(idStart);
|
||||
setUTCFromLocalDateTimeForm(idStart);
|
||||
|
||||
FormYea = document.getElementById('EndYear');
|
||||
FormYea = document.getElementById(idEnd+'Year');
|
||||
for (var i=0; i<FormYea.options.length; i++)
|
||||
if (FormYea.options[i].value == Yea) {
|
||||
FormYea.options[i].selected = true;
|
||||
break;
|
||||
}
|
||||
document.getElementById('EndMonth' ).options[Mon-1].selected = true;
|
||||
adjustDateForm ('End'); // Adjust date form correcting days in the month
|
||||
document.getElementById('EndDay' ).options[Day-1].selected = true;
|
||||
document.getElementById('EndHour' ).options[23 ].selected = true;
|
||||
document.getElementById('EndMinute').options[59 ].selected = true;
|
||||
document.getElementById('EndSecond').options[59 ].selected = true;
|
||||
setUTCFromLocalDateTimeForm('End');
|
||||
document.getElementById(idEnd+'Month').options[Mon-1].selected = true;
|
||||
adjustDateForm (idEnd); // Adjust date form correcting days in the month
|
||||
document.getElementById(idEnd+'Day').options[Day-1].selected = true;
|
||||
setHMSTo235959(idEnd);
|
||||
setUTCFromLocalDateTimeForm(idEnd);
|
||||
}
|
||||
|
||||
// Set hour, minute and second in a form to 00:00:00
|
||||
function setHMSTo000000 (id) {
|
||||
document.getElementById(id+'Hour' ).options[0].selected = true;
|
||||
document.getElementById(id+'Minute').options[0].selected = true;
|
||||
document.getElementById(id+'Second').options[0].selected = true;
|
||||
}
|
||||
|
||||
//Set hour, minute and second in a form to 23:59:59
|
||||
function setHMSTo235959 (id) {
|
||||
document.getElementById(id+'Hour' ).options[23].selected = true;
|
||||
document.getElementById(id+'Minute').options[59].selected = true;
|
||||
document.getElementById(id+'Second').options[59].selected = true;
|
||||
}
|
||||
|
||||
// Write clock in client local time updated every minute
|
|
@ -202,13 +202,14 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.140.5 (2017-02-25)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 16.141 (2017-02-26)"
|
||||
#define CSS_FILE "swad16.139.6.css"
|
||||
#define JS_FILE "swad16.140.js"
|
||||
#define JS_FILE "swad16.141.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.141 : Feb 26, 2017 Default range of dates for stats starts at HH:MM:SS=00:00:00 and ends at HH:MM:SS=23:59:59. (213053 lines)
|
||||
Version 16.140.5: Feb 25, 2017 Days in recent log changed from 8 to 15. (213008 lines)
|
||||
Version 16.140.4: Feb 24, 2017 Fixed bug in T/F test questions, reported by Nuria Torres Rosell. (213006 lines)
|
||||
Version 16.140.3: Feb 24, 2017 Changed refreshing of timeline from 30 to 10 seconds.
|
||||
|
|
44
swad_date.c
44
swad_date.c
|
@ -76,7 +76,11 @@ const char *Dat_TimeStatusClassHidden[Dat_NUM_TIME_STATUS] =
|
|||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private prototypes ****************************/
|
||||
/****************************** Internal types *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Private prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -252,7 +256,7 @@ void Dat_ConvDateToDateStr (struct Date *Date,char *DateStr)
|
|||
/*************** Show forms to enter initial and ending dates ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (void)
|
||||
void Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (bool SetHMS000000To235959)
|
||||
{
|
||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||
extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME];
|
||||
|
@ -274,15 +278,17 @@ void Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (void)
|
|||
Cfg_LOG_START_YEAR,
|
||||
Gbl.Now.Date.Year,
|
||||
Dat_FORM_SECONDS_ON,
|
||||
false);
|
||||
SetHMS000000To235959 ? Dat_HMS_TO_000000 : // Set hour, minute and second to 00:00:00
|
||||
Dat_HMS_DO_NOT_SET, // Don't set hour, minute and second to 00:00:00
|
||||
false); // Don't submit on change
|
||||
|
||||
/***** "Yesterday" and "Today" buttons *****/
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"<td rowspan=\"2\" class=\"LEFT_MIDDLE\">"
|
||||
"<input type=\"button\" name=\"Yesterday\" value=\"%s\""
|
||||
" onclick=\"setDateToYesterday();\" />"
|
||||
" onclick=\"setDateToYesterday('Start','End');\" />"
|
||||
"<input type=\"button\" name=\"Today\" value=\"%s\""
|
||||
" onclick=\"setDateToToday();\" />"
|
||||
" onclick=\"setDateToToday('Start','End');\" />"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Txt_Yesterday,
|
||||
|
@ -303,8 +309,9 @@ void Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (void)
|
|||
Cfg_LOG_START_YEAR,
|
||||
Gbl.Now.Date.Year,
|
||||
Dat_FORM_SECONDS_ON,
|
||||
false);
|
||||
|
||||
SetHMS000000To235959 ? Dat_HMS_TO_235959 : // Set hour, minute and second to 23:59:59
|
||||
Dat_HMS_DO_NOT_SET, // Don't set hour, minute and second
|
||||
false); // Don't submit on change
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>");
|
||||
}
|
||||
|
@ -347,8 +354,8 @@ void Dat_PutFormStartEndClientLocalDateTimes (time_t TimeUTC[2],
|
|||
Gbl.Now.Date.Year - 1,
|
||||
Gbl.Now.Date.Year + 1,
|
||||
FormSeconds,
|
||||
false);
|
||||
|
||||
Dat_HMS_DO_NOT_SET, // Don't set hour, minute and second
|
||||
false); // Don't submit on change
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>"
|
||||
"</table>"
|
||||
|
@ -367,6 +374,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id,
|
|||
unsigned FirstYear,
|
||||
unsigned LastYear,
|
||||
Dat_FormSeconds FormSeconds,
|
||||
Dat_SetHMS SetHMS,
|
||||
bool SubmitFormOnChange)
|
||||
{
|
||||
extern const char *Txt_MONTHS_SMALL[12];
|
||||
|
@ -503,15 +511,27 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id,
|
|||
"</table>");
|
||||
|
||||
/***** Hidden field with UTC time (seconds since 1970) used to send time *****/
|
||||
fprintf (Gbl.F.Out,"<input type=\"hidden\" id=\"%sTimeUTC\" name=\"%sTimeUTC\" value=\"%ld\" />",
|
||||
fprintf (Gbl.F.Out,"<input type=\"hidden\""
|
||||
" id=\"%sTimeUTC\" name=\"%sTimeUTC\" value=\"%ld\" />",
|
||||
Id,ParamName,(long) TimeUTC);
|
||||
|
||||
/***** Script to set selectors to local date and time from UTC time *****/
|
||||
fprintf (Gbl.F.Out,"<script type=\"text/javascript\">"
|
||||
"setLocalDateTimeFormFromUTC('%s',%ld);"
|
||||
"adjustDateForm('%s');"
|
||||
"</script>",
|
||||
"adjustDateForm('%s');",
|
||||
Id,(long) TimeUTC,Id);
|
||||
switch (SetHMS)
|
||||
{
|
||||
case Dat_HMS_TO_000000:
|
||||
fprintf (Gbl.F.Out,"setHMSTo000000('%s');",Id);
|
||||
break;
|
||||
case Dat_HMS_TO_235959:
|
||||
fprintf (Gbl.F.Out,"setHMSTo235959('%s');",Id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</script>");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
10
swad_date.h
10
swad_date.h
|
@ -92,6 +92,13 @@ typedef enum
|
|||
Dat_FORM_SECONDS_ON,
|
||||
} Dat_FormSeconds;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Dat_HMS_DO_NOT_SET = 0,
|
||||
Dat_HMS_TO_000000 = 1,
|
||||
Dat_HMS_TO_235959 = 2,
|
||||
} Dat_SetHMS;
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -107,7 +114,7 @@ void Dat_ShowClientLocalTime (void);
|
|||
struct tm *Dat_GetLocalTimeFromClock (const time_t *timep);
|
||||
void Dat_ConvDateToDateStr (struct Date *Date,char *DateStr);
|
||||
|
||||
void Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (void);
|
||||
void Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (bool SetHMS000000To235959);
|
||||
void Dat_PutFormStartEndClientLocalDateTimes (time_t TimeUTC[2],
|
||||
Dat_FormSeconds FormSeconds);
|
||||
|
||||
|
@ -117,6 +124,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id,
|
|||
unsigned FirstYear,
|
||||
unsigned LastYear,
|
||||
Dat_FormSeconds FormSeconds,
|
||||
Dat_SetHMS SetHMS,
|
||||
bool SubmitFormOnChange);
|
||||
time_t Dat_GetTimeUTCFromForm (const char *ParamName);
|
||||
|
||||
|
|
|
@ -1190,7 +1190,8 @@ static void Grp_ListGroupTypesForEdition (void)
|
|||
Gbl.Now.Date.Year,
|
||||
Gbl.Now.Date.Year + 1,
|
||||
Dat_FORM_SECONDS_ON,
|
||||
true);
|
||||
Dat_HMS_DO_NOT_SET, // Don't set hour, minute and second
|
||||
true); // Submit on change
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>"
|
||||
"</table>");
|
||||
|
@ -2133,7 +2134,8 @@ static void Grp_PutFormToCreateGroupType (void)
|
|||
Gbl.Now.Date.Year,
|
||||
Gbl.Now.Date.Year + 1,
|
||||
Dat_FORM_SECONDS_ON,
|
||||
false);
|
||||
Dat_HMS_DO_NOT_SET, // Don't set hour, minute and second
|
||||
false); // Don't submit on change
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
"</tr>"
|
||||
"</table>"
|
||||
|
|
|
@ -478,7 +478,7 @@ void Sta_AskShowCrsHits (void)
|
|||
"</tr>");
|
||||
|
||||
/***** Initial and final dates of the search *****/
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday ();
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (Gbl.Action.Act == ActReqAccCrs);
|
||||
|
||||
/***** Selection of action *****/
|
||||
Sta_WriteSelectorAction ();
|
||||
|
@ -629,7 +629,7 @@ void Sta_AskShowGblHits (void)
|
|||
Hlp_STATS_Visits_global_visits,2);
|
||||
|
||||
/***** Start and end dates for the search *****/
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday ();
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (Gbl.Action.Act == ActReqAccGbl);
|
||||
|
||||
/***** Users' roles whose accesses we want to see *****/
|
||||
fprintf (Gbl.F.Out,"<tr>"
|
||||
|
|
|
@ -1274,7 +1274,7 @@ void Tst_ShowFormAskEditTsts (void)
|
|||
Tst_ShowFormAnswerTypes (2);
|
||||
|
||||
/***** Starting and ending dates in the search *****/
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday ();
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (false);
|
||||
fprintf (Gbl.F.Out,"</table>");
|
||||
|
||||
/***** Send button *****/
|
||||
|
@ -6948,7 +6948,7 @@ void Tst_SelUsrsToSeeUsrsTestResults (void)
|
|||
"</tr>");
|
||||
|
||||
/***** Starting and ending dates in the search *****/
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday ();
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (false);
|
||||
|
||||
fprintf (Gbl.F.Out,"</table>");
|
||||
|
||||
|
@ -6992,7 +6992,7 @@ void Tst_SelDatesToSeeMyTestResults (void)
|
|||
/***** Starting and ending dates in the search *****/
|
||||
Lay_StartRoundFrameTable (NULL,Txt_Test_results,
|
||||
NULL,Hlp_ASSESSMENT_Tests_test_results,2);
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday ();
|
||||
Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (false);
|
||||
|
||||
/***** Send button and end frame *****/
|
||||
Lay_EndRoundFrameTableWithButton (Lay_CONFIRM_BUTTON,Txt_View_test_results);
|
||||
|
|
Loading…
Reference in New Issue
Block a user