mirror of https://github.com/acanas/swad-core.git
Version 16.15.3
This commit is contained in:
parent
80881e24a2
commit
1192325851
|
@ -11640,6 +11640,6 @@ SELECT SQL_NO_CACHE YEAR(CONVERT_TZ(ClickTime,@@session.time_zone,'Europe/Berlin
|
||||||
|
|
||||||
----- SWAD 16.15 (2016/10/06) -----
|
----- SWAD 16.15 (2016/10/06) -----
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS usr_report (RepCod INT NOT NULL AUTO_INCREMENT,UsrCod INT NOT NULL,ReportTime DATETIME NOT NULL,UniqueDirL CHAR(2) NOT NULL,UniqueDirR CHAR(41) NOT NULL,Filename VARCHAR(255) NOT NULL,Permalink VARCHAR(255) NOT NULL,UNIQUE INDEX(RepCod),INDEX(UsrCod));
|
CREATE TABLE IF NOT EXISTS usr_report (RepCod INT NOT NULL AUTO_INCREMENT,UsrCod INT NOT NULL,ReportTimeUTC DATETIME NOT NULL,UniqueDirL CHAR(2) NOT NULL,UniqueDirR CHAR(41) NOT NULL,Filename VARCHAR(255) NOT NULL,Permalink VARCHAR(255) NOT NULL,UNIQUE INDEX(RepCod),INDEX(UsrCod));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -146,13 +146,18 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 16.15.1 (2016-10-06)"
|
#define Log_PLATFORM_VERSION "SWAD 16.15.3 (2016-10-06)"
|
||||||
#define CSS_FILE "swad15.229.css"
|
#define CSS_FILE "swad15.229.css"
|
||||||
#define JS_FILE "swad15.238.1.js"
|
#define JS_FILE "swad15.238.1.js"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// 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
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 16.15.3: Oct 06, 2016 Do not write date when requesting a user's usage report. (205965 lines)
|
||||||
|
Version 16.15.2: Oct 06, 2016 Code refactoring in user's usage report. (205966 lines)
|
||||||
|
1 change necessary in database:
|
||||||
|
CREATE TABLE IF NOT EXISTS usr_report (RepCod INT NOT NULL AUTO_INCREMENT,UsrCod INT NOT NULL,ReportTimeUTC DATETIME NOT NULL,UniqueDirL CHAR(2) NOT NULL,UniqueDirR CHAR(41) NOT NULL,Filename VARCHAR(255) NOT NULL,Permalink VARCHAR(255) NOT NULL,UNIQUE INDEX(RepCod),INDEX(UsrCod));
|
||||||
|
|
||||||
Version 16.15.1: Oct 06, 2016 User's usage reports are stored into database. (205950 lines)
|
Version 16.15.1: Oct 06, 2016 User's usage reports are stored into database. (205950 lines)
|
||||||
Version 16.15: Oct 06, 2016 New database table to store user's usage reports. (205896 lines)
|
Version 16.15: Oct 06, 2016 New database table to store user's usage reports. (205896 lines)
|
||||||
Version 16.14: Oct 06, 2016 By default, teachers see (do not edit) documents. Now they must click on small edit icon to edit. (205875 lines)
|
Version 16.14: Oct 06, 2016 By default, teachers see (do not edit) documents. Now they must click on small edit icon to edit. (205875 lines)
|
||||||
|
|
|
@ -2785,17 +2785,17 @@ mysql> DESCRIBE usr_nicknames;
|
||||||
/***** Table usr_report *****/
|
/***** Table usr_report *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE usr_report;
|
mysql> DESCRIBE usr_report;
|
||||||
+------------+--------------+------+-----+---------+----------------+
|
+---------------+--------------+------+-----+---------+----------------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+------------+--------------+------+-----+---------+----------------+
|
+---------------+--------------+------+-----+---------+----------------+
|
||||||
| RepCod | int(11) | NO | PRI | NULL | auto_increment |
|
| RepCod | int(11) | NO | PRI | NULL | auto_increment |
|
||||||
| UsrCod | int(11) | NO | MUL | NULL | |
|
| UsrCod | int(11) | NO | MUL | NULL | |
|
||||||
| ReportTime | datetime | NO | | NULL | |
|
| ReportTimeUTC | datetime | NO | | NULL | |
|
||||||
| UniqueDirL | char(2) | NO | | NULL | |
|
| UniqueDirL | char(2) | NO | | NULL | |
|
||||||
| UniqueDirR | char(41) | NO | | NULL | |
|
| UniqueDirR | char(41) | NO | | NULL | |
|
||||||
| Filename | varchar(255) | NO | | NULL | |
|
| Filename | varchar(255) | NO | | NULL | |
|
||||||
| Permalink | varchar(255) | NO | | NULL | |
|
| Permalink | varchar(255) | NO | | NULL | |
|
||||||
+------------+--------------+------+-----+---------+----------------+
|
+---------------+--------------+------+-----+---------+----------------+
|
||||||
7 rows in set (0,00 sec)
|
7 rows in set (0,00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_report ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS usr_report ("
|
||||||
|
|
|
@ -91,11 +91,13 @@ static void Rep_PutLinkToMyUsageReport (struct CurrentTimeUTC *CurrentTimeUTC,
|
||||||
const char *Permalink);
|
const char *Permalink);
|
||||||
static void Req_TitleReport (struct CurrentTimeUTC *CurrentTimeUTC);
|
static void Req_TitleReport (struct CurrentTimeUTC *CurrentTimeUTC);
|
||||||
|
|
||||||
static void Rep_GetCurrentDateTimeUTC (struct CurrentTimeUTC *CurrentTimeUTC);
|
static void Rep_GetCurrentDateTimeUTC (struct tm *tm_CurrentTime,
|
||||||
|
struct CurrentTimeUTC *CurrentTimeUTC);
|
||||||
|
|
||||||
static void Rep_CreateNewReportFile (const struct CurrentTimeUTC *CurrentTimeUTC,
|
static void Rep_CreateNewReportFile (const struct CurrentTimeUTC *CurrentTimeUTC,
|
||||||
char *FilenameReport,char *Permalink);
|
char *FilenameReport,char *Permalink);
|
||||||
static void Rep_CreateNewReportEntryIntoDB (const char *FilenameReport,
|
static void Rep_CreateNewReportEntryIntoDB (const struct tm *tm_CurrentTime,
|
||||||
|
const char *FilenameReport,
|
||||||
const char *Permalink);
|
const char *Permalink);
|
||||||
static void Rep_WriteHeader (const struct CurrentTimeUTC *CurrentTimeUTC,
|
static void Rep_WriteHeader (const struct CurrentTimeUTC *CurrentTimeUTC,
|
||||||
const char *Permalink);
|
const char *Permalink);
|
||||||
|
@ -143,10 +145,6 @@ void Rep_ReqMyUsageReport (void)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Report_of_use_of_PLATFORM;
|
extern const char *Txt_Report_of_use_of_PLATFORM;
|
||||||
extern const char *Txt_Generate_report;
|
extern const char *Txt_Generate_report;
|
||||||
struct CurrentTimeUTC CurrentTimeUTC;
|
|
||||||
|
|
||||||
/***** Get current date-time *****/
|
|
||||||
Rep_GetCurrentDateTimeUTC (&CurrentTimeUTC);
|
|
||||||
|
|
||||||
/***** Form to show my usage report *****/
|
/***** Form to show my usage report *****/
|
||||||
Act_FormStart (ActSeeMyUsgRep);
|
Act_FormStart (ActSeeMyUsgRep);
|
||||||
|
@ -156,7 +154,7 @@ void Rep_ReqMyUsageReport (void)
|
||||||
Lay_StartRoundFrame (NULL,Gbl.Title,NULL);
|
Lay_StartRoundFrame (NULL,Gbl.Title,NULL);
|
||||||
|
|
||||||
/***** Header *****/
|
/***** Header *****/
|
||||||
Req_TitleReport (&CurrentTimeUTC);
|
Req_TitleReport (NULL); // NULL means do not write date
|
||||||
|
|
||||||
/***** Send button and end frame *****/
|
/***** Send button and end frame *****/
|
||||||
Lay_EndRoundFrameWithButton (Lay_CONFIRM_BUTTON,Txt_Generate_report);
|
Lay_EndRoundFrameWithButton (Lay_CONFIRM_BUTTON,Txt_Generate_report);
|
||||||
|
@ -191,19 +189,20 @@ static void Rep_CreateMyUsageReport (struct CurrentTimeUTC *CurrentTimeUTC,
|
||||||
char *Permalink)
|
char *Permalink)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Report_of_use_of_PLATFORM;
|
extern const char *Txt_Report_of_use_of_PLATFORM;
|
||||||
|
struct tm tm_CurrentTime;
|
||||||
struct UsrFigures UsrFigures;
|
struct UsrFigures UsrFigures;
|
||||||
struct tm tm_FirstClickTime;
|
struct tm tm_FirstClickTime;
|
||||||
bool GetUsrFiguresAgain;
|
bool GetUsrFiguresAgain;
|
||||||
unsigned long MaxHitsPerYear;
|
unsigned long MaxHitsPerYear;
|
||||||
|
|
||||||
/***** Get current date-time *****/
|
/***** Get current date-time *****/
|
||||||
Rep_GetCurrentDateTimeUTC (CurrentTimeUTC);
|
Rep_GetCurrentDateTimeUTC (&tm_CurrentTime,CurrentTimeUTC);
|
||||||
|
|
||||||
/***** Create a new report file *****/
|
/***** Create a new report file *****/
|
||||||
Rep_CreateNewReportFile (CurrentTimeUTC,FilenameReport,Permalink);
|
Rep_CreateNewReportFile (CurrentTimeUTC,FilenameReport,Permalink);
|
||||||
|
|
||||||
/***** Store report entry into database *****/
|
/***** Store report entry into database *****/
|
||||||
Rep_CreateNewReportEntryIntoDB (FilenameReport,Permalink);
|
Rep_CreateNewReportEntryIntoDB (&tm_CurrentTime,FilenameReport,Permalink);
|
||||||
|
|
||||||
/***** Start file *****/
|
/***** Start file *****/
|
||||||
Lay_StartHTMLFile (Gbl.F.Rep,FilenameReport);
|
Lay_StartHTMLFile (Gbl.F.Rep,FilenameReport);
|
||||||
|
@ -289,6 +288,7 @@ static void Rep_PutLinkToMyUsageReport (struct CurrentTimeUTC *CurrentTimeUTC,
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************* Write title of user's usage report ********************/
|
/********************* Write title of user's usage report ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
// CurrentTimeUTC == NULL ==> do not write date
|
||||||
|
|
||||||
static void Req_TitleReport (struct CurrentTimeUTC *CurrentTimeUTC)
|
static void Req_TitleReport (struct CurrentTimeUTC *CurrentTimeUTC)
|
||||||
{
|
{
|
||||||
|
@ -302,13 +302,13 @@ static void Req_TitleReport (struct CurrentTimeUTC *CurrentTimeUTC)
|
||||||
Txt_User[Gbl.Usrs.Me.UsrDat.Sex],
|
Txt_User[Gbl.Usrs.Me.UsrDat.Sex],
|
||||||
Gbl.Usrs.Me.UsrDat.FullName);
|
Gbl.Usrs.Me.UsrDat.FullName);
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<br />");
|
|
||||||
|
|
||||||
/***** Report date *****/
|
/***** Report date *****/
|
||||||
fprintf (Gbl.F.Out,"%s: <span class=\"DAT_N\">%s %s UTC</span>",
|
if (CurrentTimeUTC)
|
||||||
Txt_Date,
|
fprintf (Gbl.F.Out,"<br />"
|
||||||
CurrentTimeUTC->StrDate,
|
"%s: <span class=\"DAT_N\">%s %s UTC</span>",
|
||||||
CurrentTimeUTC->StrTime);
|
Txt_Date,
|
||||||
|
CurrentTimeUTC->StrDate,
|
||||||
|
CurrentTimeUTC->StrTime);
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
@ -317,10 +317,10 @@ static void Req_TitleReport (struct CurrentTimeUTC *CurrentTimeUTC)
|
||||||
/********************* Get current date and time in UTC **********************/
|
/********************* Get current date and time in UTC **********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Rep_GetCurrentDateTimeUTC (struct CurrentTimeUTC *CurrentTimeUTC)
|
static void Rep_GetCurrentDateTimeUTC (struct tm *tm_CurrentTime,
|
||||||
|
struct CurrentTimeUTC *CurrentTimeUTC)
|
||||||
{
|
{
|
||||||
time_t CurrentTime;
|
time_t CurrentTime;
|
||||||
struct tm tm_CurrentTime;
|
|
||||||
|
|
||||||
/***** Initialize to empty strings *****/
|
/***** Initialize to empty strings *****/
|
||||||
CurrentTimeUTC->StrDate[0] = '\0';
|
CurrentTimeUTC->StrDate[0] = '\0';
|
||||||
|
@ -328,25 +328,25 @@ static void Rep_GetCurrentDateTimeUTC (struct CurrentTimeUTC *CurrentTimeUTC)
|
||||||
|
|
||||||
/***** Get current time UTC *****/
|
/***** Get current time UTC *****/
|
||||||
time (&CurrentTime);
|
time (&CurrentTime);
|
||||||
if ((gmtime_r (&CurrentTime,&tm_CurrentTime)) != NULL)
|
if ((gmtime_r (&CurrentTime,tm_CurrentTime)) != NULL)
|
||||||
{
|
{
|
||||||
/* Date and time as strings */
|
/* Date and time as strings */
|
||||||
sprintf (CurrentTimeUTC->StrDate,"%04d-%02d-%02d",
|
sprintf (CurrentTimeUTC->StrDate,"%04d-%02d-%02d",
|
||||||
1900 + tm_CurrentTime.tm_year, // year
|
1900 + tm_CurrentTime->tm_year, // year
|
||||||
1 + tm_CurrentTime.tm_mon, // month
|
1 + tm_CurrentTime->tm_mon, // month
|
||||||
tm_CurrentTime.tm_mday); // day of the month
|
tm_CurrentTime->tm_mday); // day of the month
|
||||||
sprintf (CurrentTimeUTC->StrTime,"%02d:%02d:%02d",
|
sprintf (CurrentTimeUTC->StrTime,"%02d:%02d:%02d",
|
||||||
tm_CurrentTime.tm_hour, // hours
|
tm_CurrentTime->tm_hour, // hours
|
||||||
tm_CurrentTime.tm_min, // minutes
|
tm_CurrentTime->tm_min, // minutes
|
||||||
tm_CurrentTime.tm_sec); // seconds
|
tm_CurrentTime->tm_sec); // seconds
|
||||||
|
|
||||||
/* Date and time as unsigned */
|
/* Date and time as unsigned */
|
||||||
CurrentTimeUTC->Date = (1900 + tm_CurrentTime.tm_year) * 10000 +
|
CurrentTimeUTC->Date = (1900 + tm_CurrentTime->tm_year) * 10000 +
|
||||||
(1 + tm_CurrentTime.tm_mon) * 100 +
|
(1 + tm_CurrentTime->tm_mon) * 100 +
|
||||||
tm_CurrentTime.tm_mday;
|
tm_CurrentTime->tm_mday;
|
||||||
CurrentTimeUTC->Time = tm_CurrentTime.tm_hour * 10000 +
|
CurrentTimeUTC->Time = tm_CurrentTime->tm_hour * 10000 +
|
||||||
tm_CurrentTime.tm_min * 100 +
|
tm_CurrentTime->tm_min * 100 +
|
||||||
tm_CurrentTime.tm_sec;
|
tm_CurrentTime->tm_sec;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,17 +404,26 @@ static void Rep_CreateNewReportFile (const struct CurrentTimeUTC *CurrentTimeUTC
|
||||||
/************** Insert a new user's usage report into database ***************/
|
/************** Insert a new user's usage report into database ***************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Rep_CreateNewReportEntryIntoDB (const char *FilenameReport,
|
static void Rep_CreateNewReportEntryIntoDB (const struct tm *tm_CurrentTime,
|
||||||
|
const char *FilenameReport,
|
||||||
const char *Permalink)
|
const char *Permalink)
|
||||||
{
|
{
|
||||||
char Query[1024+PATH_MAX*2];
|
char Query[1024+PATH_MAX*2];
|
||||||
|
|
||||||
/***** Insert a new user's usage report into database *****/
|
/***** Insert a new user's usage report into database *****/
|
||||||
sprintf (Query,"INSERT INTO usr_report"
|
sprintf (Query,"INSERT INTO usr_report"
|
||||||
" (UsrCod,ReportTimeUTC,UniqueDirL,UniqueDirR,Filename,Permalink)"
|
" (UsrCod,ReportTimeUTC,"
|
||||||
|
"UniqueDirL,UniqueDirR,Filename,Permalink)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" ('%ld',UTC_TIMESTAMP(),'%c%c','%s','%s','%s')",
|
" ('%ld','%04d-%02d-%02d %02d:%02d:%02d',"
|
||||||
|
"'%c%c','%s','%s','%s')",
|
||||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||||
|
1900 + tm_CurrentTime->tm_year, // year
|
||||||
|
1 + tm_CurrentTime->tm_mon, // month
|
||||||
|
tm_CurrentTime->tm_mday, // day of the month
|
||||||
|
tm_CurrentTime->tm_hour, // hours
|
||||||
|
tm_CurrentTime->tm_min, // minutes
|
||||||
|
tm_CurrentTime->tm_sec, // seconds
|
||||||
Gbl.UniqueNameEncrypted[0], // 2 leftmost chars from a unique 43 chars base64url codified from a unique SHA-256 string
|
Gbl.UniqueNameEncrypted[0], // 2 leftmost chars from a unique 43 chars base64url codified from a unique SHA-256 string
|
||||||
Gbl.UniqueNameEncrypted[1],
|
Gbl.UniqueNameEncrypted[1],
|
||||||
&Gbl.UniqueNameEncrypted[2], // 41 rightmost chars from a unique 43 chars base64url codified from a unique SHA-256 string
|
&Gbl.UniqueNameEncrypted[2], // 41 rightmost chars from a unique 43 chars base64url codified from a unique SHA-256 string
|
||||||
|
|
Loading…
Reference in New Issue