Version19.130.2

This commit is contained in:
Antonio Cañas Vargas 2020-02-24 12:43:18 +01:00
parent 2520d5c852
commit 7225bbe670
12 changed files with 65 additions and 77 deletions

View File

@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 19.129 (2020-02-20)" #define Log_PLATFORM_VERSION "SWAD 19.130.2 (2020-02-24)"
#define CSS_FILE "swad19.118.css" #define CSS_FILE "swad19.118.css"
#define JS_FILE "swad19.91.1.js" #define JS_FILE "swad19.91.1.js"
/* /*
@ -522,9 +522,10 @@ Param
// TODO: En la lista de conectados central, poner el logo de la institución a la que pertenece el usuario // TODO: En la lista de conectados central, poner el logo de la institución a la que pertenece el usuario
// TODO: Miguel Damas: por defecto, marcar "Permitir que los profesores..." en los test (que ya esté marcado en lugar de desmarcado) // TODO: Miguel Damas: por defecto, marcar "Permitir que los profesores..." en los test (que ya esté marcado en lugar de desmarcado)
// TODO: Si el alumno ha marcado "Permitir que los profesores...", entonces pedir confirmación al pulsar el botón azul, para evitar que se envíe por error antes de tiempo // TODO: Si el alumno ha marcado "Permitir que los profesores...", entonces pedir confirmación al pulsar el botón azul, para evitar que se envíe por error antes de tiempo
// TODO: Análisis > Informe: "Informe de uso de SWAD" sale descentrado
// TODO: Fig_GetAndShowCourseProgramStats // TODO: Fig_GetAndShowCourseProgramStats
Version 19.130.2: Feb 24, 2020 Fixed bugs in usage report. (281259 lines)
Version 19.130.1: Feb 24, 2020 Fixed bugs related to database. (281259 lines)
Version 19.130: Feb 20, 2020 New module swad_program. (281273 lines) Version 19.130: Feb 20, 2020 New module swad_program. (281273 lines)
2 changes necessary in database: 2 changes necessary in database:
CREATE TABLE IF NOT EXISTS prg_grp (PrgIteCod INT NOT NULL,GrpCod INT NOT NULL,UNIQUE INDEX(PrgIteCod,GrpCod)); CREATE TABLE IF NOT EXISTS prg_grp (PrgIteCod INT NOT NULL,GrpCod INT NOT NULL,UNIQUE INDEX(PrgIteCod,GrpCod));

View File

@ -711,7 +711,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
mysql_free_result (mysql_res); DB_FreeMySQLResult (&mysql_res);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -761,7 +761,7 @@ static void Con_ComputeConnectedUsrsWithARoleCurrentCrsOneByOne (Rol_Role_t Role
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
mysql_free_result (mysql_res); DB_FreeMySQLResult (&mysql_res);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -488,7 +488,6 @@ void Enr_GetNotifEnrolment (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
Rol_Role_t Role; Rol_Role_t Role;
SummaryStr[0] = '\0'; // Return nothing on error SummaryStr[0] = '\0'; // Return nothing on error
// This function may be called inside a web service, so don't report error
/***** Get user's role in course from database *****/ /***** Get user's role in course from database *****/
if (DB_QuerySELECT (&mysql_res,"can not get user's role" if (DB_QuerySELECT (&mysql_res,"can not get user's role"
@ -2033,7 +2032,6 @@ void Enr_GetNotifEnrolmentRequest (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
Rol_Role_t DesiredRole; Rol_Role_t DesiredRole;
SummaryStr[0] = '\0'; // Return nothing on error SummaryStr[0] = '\0'; // Return nothing on error
// This function may be called inside a web service, so don't report error
/***** Get user and requested role from database *****/ /***** Get user and requested role from database *****/
if (DB_QuerySELECT (&mysql_res,"can not get enrolment request", if (DB_QuerySELECT (&mysql_res,"can not get enrolment request",

View File

@ -11724,7 +11724,6 @@ void Brw_RemoveUsrWorksInAllCrss (struct UsrData *UsrDat)
/*****************************************************************************/ /*****************************************************************************/
/******************** Get summary and content of a file **********************/ /******************** Get summary and content of a file **********************/
/*****************************************************************************/ /*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr, char **ContentStr,

View File

@ -1447,7 +1447,6 @@ void Fol_GetAndShowRankingFollowers (void)
/*****************************************************************************/ /*****************************************************************************/
/********************* Get notification of a new follower ********************/ /********************* Get notification of a new follower ********************/
/*****************************************************************************/ /*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Fol_GetNotifFollower (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], void Fol_GetNotifFollower (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr) char **ContentStr)

View File

@ -1366,53 +1366,49 @@ static void For_GetPstData (long PstCod,long *UsrCod,time_t *CreatTimeUTC,
/*****************************************************************************/ /*****************************************************************************/
/***************** Get summary and content for a forum post ******************/ /***************** Get summary and content for a forum post ******************/
/*****************************************************************************/ /*****************************************************************************/
// This function may be called inside a web service, so don't report error
void For_GetSummaryAndContentForumPst (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], void For_GetSummaryAndContentForumPst (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr, char **ContentStr,
long PstCod,bool GetContent) long PstCod,bool GetContent)
{ {
char *Query = NULL;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
size_t Length; size_t Length;
SummaryStr[0] = '\0'; // Return nothing on error SummaryStr[0] = '\0'; // Return nothing on error
/***** Get subject of message from database *****/ /***** Get post subject and content from database *****/
if (asprintf (&Query,"SELECT Subject,Content FROM forum_post" if (DB_QuerySELECT (&mysql_res,"can not get subject and content",
" WHERE PstCod=%ld",PstCod) < 0) "SELECT Subject," // row[0]
Lay_NotEnoughMemoryExit (); "Content" // row[1]
if (!mysql_query (&Gbl.mysql,Query)) " FROM forum_post"
if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL) " WHERE PstCod=%ld",PstCod) == 1)
{ {
/***** Result should have a unique row *****/ /***** Get subject and content of the post *****/
if (mysql_num_rows (mysql_res) == 1) row = mysql_fetch_row (mysql_res);
{
/***** Get subject and content of the message *****/
row = mysql_fetch_row (mysql_res);
/***** Copy subject *****/ /***** Copy subject *****/
Str_Copy (SummaryStr,row[0], Str_Copy (SummaryStr,row[0],
Ntf_MAX_BYTES_SUMMARY); Ntf_MAX_BYTES_SUMMARY);
/***** Copy content *****/ /***** Copy content *****/
if (GetContent) if (GetContent)
{ {
Length = strlen (row[1]); Length = strlen (row[1]);
if ((*ContentStr = (char *) malloc (Length + 1)) == NULL) if ((*ContentStr = (char *) malloc (Length + 1)) == NULL)
Lay_ShowErrorAndExit ("Error allocating memory for notification content."); Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
if (Length) if (Length)
Str_Copy (*ContentStr,row[1], Str_Copy (*ContentStr,row[1],
Length); Length);
else else
**ContentStr = '\0'; **ContentStr = '\0';
} }
} }
mysql_free_result (mysql_res);
} /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -348,5 +348,5 @@ void Log_GetAndShowLastClicks (void)
HTM_TABLE_End (); HTM_TABLE_End ();
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
mysql_free_result (mysql_res); DB_FreeMySQLResult (&mysql_res);
} }

View File

@ -716,7 +716,6 @@ void Mrk_GetNotifMyMarks (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char *Ptr; char *Ptr;
SummaryStr[0] = '\0'; // Return nothing on error SummaryStr[0] = '\0'; // Return nothing on error
// This function may be called inside a web service, so don't report error
/***** Initialize structure with user's data *****/ /***** Initialize structure with user's data *****/
Usr_UsrDataConstructor (&UsrDat); Usr_UsrDataConstructor (&UsrDat);

View File

@ -3099,7 +3099,6 @@ void Msg_GetNotifMessage (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
size_t Length; size_t Length;
SummaryStr[0] = '\0'; // Return nothing on error SummaryStr[0] = '\0'; // Return nothing on error
// This function may be called inside a web service, so don't report error
/***** Get subject of message from database *****/ /***** Get subject of message from database *****/
if (DB_QuerySELECT (&mysql_res,"can not get subject and content" if (DB_QuerySELECT (&mysql_res,"can not get subject and content"

View File

@ -766,7 +766,6 @@ void Not_GetSummaryAndContentNotice (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
size_t Length; size_t Length;
SummaryStr[0] = '\0'; // Return nothing on error SummaryStr[0] = '\0'; // Return nothing on error
// This function may be called inside a web service, so don't report error
/***** Get subject of message from database *****/ /***** Get subject of message from database *****/
if (DB_QuerySELECT (&mysql_res,"can not get content of notice", if (DB_QuerySELECT (&mysql_res,"can not get content of notice",

View File

@ -461,7 +461,7 @@ static void Rep_WriteHeader (const struct Rep_Report *Report)
fprintf (Gbl.F.Rep,"<h1>"); fprintf (Gbl.F.Rep,"<h1>");
fprintf (Gbl.F.Rep,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME); fprintf (Gbl.F.Rep,Txt_Report_of_use_of_PLATFORM,Cfg_PLATFORM_SHORT_NAME);
fprintf (Gbl.F.Rep,"</h1>"); fprintf (Gbl.F.Rep,"</h1>");
HTM_UL_Begin (NULL); fprintf (Gbl.F.Rep,"<ul>");
/***** User *****/ /***** User *****/
fprintf (Gbl.F.Rep,"<li>%s: <strong>%s</strong></li>", fprintf (Gbl.F.Rep,"<li>%s: <strong>%s</strong></li>",
@ -504,7 +504,7 @@ static void Rep_WriteSectionPlatform (void)
fprintf (Gbl.F.Rep,"<section>" fprintf (Gbl.F.Rep,"<section>"
"<h3>%s</h3>", "<h3>%s</h3>",
Txt_Teaching_platform); Txt_Teaching_platform);
HTM_UL_Begin (NULL); fprintf (Gbl.F.Rep,"<ul>");
/***** Platform name *****/ /***** Platform name *****/
fprintf (Gbl.F.Rep,"<li>%s: %s, %s</li>", fprintf (Gbl.F.Rep,"<li>%s: %s, %s</li>",
@ -543,7 +543,7 @@ static void Rep_WriteSectionUsrInfo (void)
fprintf (Gbl.F.Rep,"<section>" fprintf (Gbl.F.Rep,"<section>"
"<h3>%s</h3>", "<h3>%s</h3>",
Txt_Personal_information); Txt_Personal_information);
HTM_UL_Begin (NULL); fprintf (Gbl.F.Rep,"<ul>");
/***** User's name *****/ /***** User's name *****/
fprintf (Gbl.F.Rep,"<li>%s: %s</li>", fprintf (Gbl.F.Rep,"<li>%s: %s</li>",
@ -605,7 +605,7 @@ static void Rep_WriteSectionUsrFigures (const struct Rep_Report *Report)
fprintf (Gbl.F.Rep,"<section>" fprintf (Gbl.F.Rep,"<section>"
"<h3>%s</h3>", "<h3>%s</h3>",
Txt_Figures); Txt_Figures);
HTM_UL_Begin (NULL); fprintf (Gbl.F.Rep,"<ul>");
/***** Time since first click until now *****/ /***** Time since first click until now *****/
fprintf (Gbl.F.Rep,"<li>%s ",Txt_TIME_Since); fprintf (Gbl.F.Rep,"<li>%s ",Txt_TIME_Since);
@ -865,7 +865,7 @@ static void Rep_WriteSectionCurrentCourses (struct Rep_Report *Report)
if (Report->CurrentTimeUTC.StrDate[0]) if (Report->CurrentTimeUTC.StrDate[0])
fprintf (Gbl.F.Rep," (%s)",Report->CurrentTimeUTC.StrDate); fprintf (Gbl.F.Rep," (%s)",Report->CurrentTimeUTC.StrDate);
fprintf (Gbl.F.Rep,"</h3>"); fprintf (Gbl.F.Rep,"</h3>");
HTM_UL_Begin (NULL); fprintf (Gbl.F.Rep,"<ul>");
/***** Number of courses in which the user is student/teacher *****/ /***** Number of courses in which the user is student/teacher *****/
for (Role = Rol_STD; for (Role = Rol_STD;
@ -896,7 +896,7 @@ static void Rep_WriteSectionHistoricCourses (struct Rep_Report *Report)
Txt_Courses,Txt_historical_log); Txt_Courses,Txt_historical_log);
fprintf (Gbl.F.Rep,Txt_Only_courses_with_more_than_X_clicks_are_shown, fprintf (Gbl.F.Rep,Txt_Only_courses_with_more_than_X_clicks_are_shown,
Rep_MIN_CLICKS_CRS); Rep_MIN_CLICKS_CRS);
HTM_UL_Begin (NULL); fprintf (Gbl.F.Rep,"<ul>");
/********* Historic clicks of a user without course selected ***********/ /********* Historic clicks of a user without course selected ***********/
Rep_GetAndWriteMyHistoricClicsWithoutCrs (Report); Rep_GetAndWriteMyHistoricClicsWithoutCrs (Report);

View File

@ -1452,13 +1452,11 @@ static void Svy_GetSurveyTxtFromDB (long SvyCod,char Txt[Cns_MAX_BYTES_TEXT + 1]
/*****************************************************************************/ /*****************************************************************************/
/******************** Get summary and content of a survey *******************/ /******************** Get summary and content of a survey *******************/
/*****************************************************************************/ /*****************************************************************************/
// This function may be called inside a web service, so don't report error
void Svy_GetNotifSurvey (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], void Svy_GetNotifSurvey (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr, char **ContentStr,
long SvyCod,bool GetContent) long SvyCod,bool GetContent)
{ {
char Query[128];
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
size_t Length; size_t Length;
@ -1466,33 +1464,33 @@ void Svy_GetNotifSurvey (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
SummaryStr[0] = '\0'; // Return nothing on error SummaryStr[0] = '\0'; // Return nothing on error
/***** Build query *****/ /***** Build query *****/
sprintf (Query,"SELECT Title,Txt FROM surveys WHERE SvyCod=%ld", if (DB_QuerySELECT (&mysql_res,"can not get groups of a survey",
SvyCod); "SELECT Title," // row[0]
if (!mysql_query (&Gbl.mysql,Query)) "Txt" // row[1]
if ((mysql_res = mysql_store_result (&Gbl.mysql)) != NULL) " FROM surveys"
{ " WHERE SvyCod=%ld",
/***** Result should have a unique row *****/ SvyCod) == 1)
if (mysql_num_rows (mysql_res) == 1) {
{ /***** Get row *****/
/***** Get row *****/ row = mysql_fetch_row (mysql_res);
row = mysql_fetch_row (mysql_res);
/***** Get summary *****/ /***** Get summary *****/
Str_Copy (SummaryStr,row[0], Str_Copy (SummaryStr,row[0],
Ntf_MAX_BYTES_SUMMARY); Ntf_MAX_BYTES_SUMMARY);
/***** Get content *****/ /***** Get content *****/
if (GetContent) if (GetContent)
{ {
Length = strlen (row[1]); Length = strlen (row[1]);
if ((*ContentStr = (char *) malloc (Length + 1)) == NULL) if ((*ContentStr = (char *) malloc (Length + 1)) == NULL)
Lay_ShowErrorAndExit ("Error allocating memory for notification content."); Lay_ShowErrorAndExit ("Error allocating memory for notification content.");
Str_Copy (*ContentStr,row[1], Str_Copy (*ContentStr,row[1],
Length); Length);
} }
} }
mysql_free_result (mysql_res);
} /***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
} }
/*****************************************************************************/ /*****************************************************************************/