Version19.219.3

This commit is contained in:
acanas 2020-05-09 18:18:04 +02:00
parent 3bc30a31fa
commit 006b49ddfd
9 changed files with 97 additions and 78 deletions

View File

@ -548,13 +548,18 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.219 (2020-05-07)"
#define Log_PLATFORM_VERSION "SWAD 19.219.3 (2020-05-09)"
#define CSS_FILE "swad19.217.css"
#define JS_FILE "swad19.193.1.js"
/*
Arreglar bug: cuando se crea un nuevo proyecto no debería salir de nuevo el formulario de creación sino el formulario que incluye la adición de usuarios al proyecto recién creado.
cuando se modifica se hace correctamente, así que se trata de hacer lo mismo cuando se crea que cuando se modifica.
Arreglar bug en rol de usuario. Reported by Francisco Ocaña Lara.
Version 19.219.3: May 09, 2020 Code refactoring in projects. (302366 lines)
Version 19.219.2: May 09, 2020 Fixed bug in roles. Reported by Francisco Ocaña Lara. (302354 lines)
1 change necessary in database:
DELETE FROM figures;
Version 19.219.1: May 09, 2020 By default, only one column is displayed in the layout, for the sake of speed. (302348 lines)
If you want to hide right column for current students and guests, do the following query in database:
UPDATE usr_data SET SideCols=0 WHERE (SideCols & 1)<>0 AND UsrCod NOT IN (SELECT UsrCod FROM crs_usr WHERE Role>3);
Version 19.219: May 09, 2020 Create exam print. (302347 lines)
2 change necessary in database:
@ -565,7 +570,7 @@ CREATE TABLE IF NOT EXISTS exa_print_questions (PrnCod INT NOT NULL,QstCod INT N
Version 19.218: May 07, 2020 Fixed bug in creation of new exam announcements, reported by Francisco Gómez Mula.
Changes in exam announcementes. (302170 lines)
Version 19.217: May 07, 2020 Generate and show questions of each set in an exam print. Not finished. (302124 lines)
Version 19.216.1: May 07, 2020 Fixed bug in edition of exam questions, reported by Antonio Cañas Martínez.
Version 19.216.1: May 07, 2020 Fixed bug in edition of exam questions. Reported by Antonio Cañas Martínez.
Changes in some texts. (301957 lines)
Version 19.216: May 07, 2020 New module exam_print to generate new exam prints. (301949 lines)
1 change necessary in database:

View File

@ -79,8 +79,6 @@
#define Cfg_ABOUT_LOGO_WIDTH 125
#define Cfg_ABOUT_LOGO_HEIGHT 40
#define Cfg_DEFAULT_COLUMNS Lay_SHOW_BOTH_COLUMNS
#define Cfg_TIME_TO_SEND_PENDING_NOTIF ((time_t) (30UL * 60UL)) // After these seconds after first pending notification, all the pending notifications are sent by email
#define Cfg_GOOGLE_ANALYTICS ""
@ -118,8 +116,6 @@
#define Cfg_ABOUT_LOGO_WIDTH 32
#define Cfg_ABOUT_LOGO_HEIGHT 32
#define Cfg_DEFAULT_COLUMNS Lay_SHOW_BOTH_COLUMNS
#define Cfg_TIME_TO_SEND_PENDING_NOTIF ((time_t) (30UL * 60UL)) // After these seconds after first pending notification, all the pending notifications are sent by email
/* Google Analytics without cookies.
@ -178,9 +174,7 @@
#define Cfg_ABOUT_LOGO_WIDTH 100
#define Cfg_ABOUT_LOGO_HEIGHT 32
#define Cfg_DEFAULT_COLUMNS Lay_SHOW_BOTH_COLUMNS
#define Cfg_TIME_TO_SEND_PENDING_NOTIF ((time_t) (60UL * 60UL)) // After these seconds after first pending notification, all the pending notifications are sent by email
#define Cfg_TIME_TO_SEND_PENDING_NOTIF ((time_t) (30UL * 60UL)) // After these seconds after first pending notification, all the pending notifications are sent by email
#define Cfg_GOOGLE_ANALYTICS ""
@ -235,8 +229,6 @@
#define Cfg_ABOUT_LOGO_WIDTH 32
#define Cfg_ABOUT_LOGO_HEIGHT 32
#define Cfg_DEFAULT_COLUMNS Lay_SHOW_BOTH_COLUMNS
#define Cfg_TIME_TO_SEND_PENDING_NOTIF ((time_t) (30UL * 60UL)) // After these seconds after first pending notification, all the pending notifications are sent by email
#define Cfg_GOOGLE_ANALYTICS ""
@ -267,6 +259,9 @@
/* Courses */
#define Cfg_MIN_NUM_COURSES_TO_CONFIRM_SHOW_BIG_LIST 500 // If the number of courses in a list is greater than this, ask me for confirmation before showing the list
/* Layout */
#define Cfg_DEFAULT_COLUMNS Lay_HIDE_BOTH_COLUMNS
/*****************************************************************************/
/*********************** Directories, folder and files ***********************/
/*****************************************************************************/

View File

@ -80,22 +80,23 @@ typedef enum
FigCch_NUM_STDS_IN_CRSS = 32, // Number of students in courses
FigCch_NUM_NETS_IN_CRSS = 33, // Number of non-editing teachers in courses
FigCch_NUM_TCHS_IN_CRSS = 34, // Number of teachers in courses
FigCch_NUM_USRS_IN_CRSS = 35, // Number of users in courses
FigCch_NUM_GSTS = 36, // Number of guests (users not belonging to any course)
FigCch_NUM_ALLT_IN_CRSS = 35, // Number of non-editing teachers or teachers in courses
FigCch_NUM_USRS_IN_CRSS = 36, // Number of users in courses
FigCch_NUM_GSTS = 37, // Number of guests (users not belonging to any course)
//--------------------------------------------------------------------------
FigCch_NUM_CRSS_PER_USR = 37, // Number of courses per user
FigCch_NUM_CRSS_PER_STD = 38, // Number of courses per student
FigCch_NUM_CRSS_PER_NET = 39, // Number of courses per non-editing teacher
FigCch_NUM_CRSS_PER_TCH = 40, // Number of courses per teacher
FigCch_NUM_CRSS_PER_USR = 38, // Number of courses per user
FigCch_NUM_CRSS_PER_STD = 39, // Number of courses per student
FigCch_NUM_CRSS_PER_NET = 40, // Number of courses per non-editing teacher
FigCch_NUM_CRSS_PER_TCH = 41, // Number of courses per teacher
//--------------------------------------------------------------------------
FigCch_NUM_USRS_PER_CRS = 41, // Number of users per course
FigCch_NUM_STDS_PER_CRS = 42, // Number of students per course
FigCch_NUM_NETS_PER_CRS = 43, // Number of non-editing teachers per course
FigCch_NUM_TCHS_PER_CRS = 44, // Number of teachers per course
FigCch_NUM_USRS_PER_CRS = 42, // Number of users per course
FigCch_NUM_STDS_PER_CRS = 43, // Number of students per course
FigCch_NUM_NETS_PER_CRS = 44, // Number of non-editing teachers per course
FigCch_NUM_TCHS_PER_CRS = 45, // Number of teachers per course
//--------------------------------------------------------------------------
FigCch_NUM_USRS_BELONG_CTY = 45, // Number of users who claim to belong to country
FigCch_NUM_USRS_BELONG_INS = 46, // Number of users who claim to belong to institution
FigCch_NUM_USRS_BELONG_CTR = 47, // Number of users who claim to belong to centre
FigCch_NUM_USRS_BELONG_CTY = 46, // Number of users who claim to belong to country
FigCch_NUM_USRS_BELONG_INS = 47, // Number of users who claim to belong to institution
FigCch_NUM_USRS_BELONG_CTR = 48, // Number of users who claim to belong to centre
} FigCch_FigureCached_t;
#define FigCch_NUM_TYPES 2

View File

@ -132,7 +132,7 @@ void Lay_WriteStartOfPage (void)
Gbl.Layout.HTMLStartWritten)
return;
/***** Compute connected users to be displayed in right columns *****/
/***** Compute connected users to be displayed in right column *****/
Con_ComputeConnectedUsrsBelongingToCurrentCrs ();
/***** Send head width the file type for the HTTP protocol *****/
@ -1484,6 +1484,15 @@ void Lay_WrongTypeOfViewExit (void)
Lay_ShowErrorAndExit ("Wrong type of view.");
}
/*****************************************************************************/
/************* Write error message and exit when wrong project ***************/
/*****************************************************************************/
void Lay_WrongProjectExit (void)
{
Lay_ShowErrorAndExit ("Wrong project.");
}
/*****************************************************************************/
/************** Write error message and exit when wrong exam *****************/
/*****************************************************************************/

View File

@ -73,6 +73,7 @@ void Lay_NotEnoughMemoryExit (void);
void Lay_WrongScopeExit (void);
void Lay_WrongOrderExit (void);
void Lay_WrongTypeOfViewExit (void);
void Lay_WrongProjectExit (void);
void Lay_WrongExamExit (void);
void Lay_WrongSetExit (void);
void Lay_WrongEventExit (void);

View File

@ -252,7 +252,8 @@ static void Prj_GetListProjects (struct Prj_Projects *Projects);
static void Prj_ResetProject (struct Prj_Project *Prj);
static void Prj_RequestCreatOrEditPrj (struct Prj_Projects *Projects);
static void Prj_RequestCreatOrEditPrj (struct Prj_Projects *Projects,
struct Prj_Project *Prj);
static void Prj_PutFormProject (struct Prj_Projects *Projects,
struct Prj_Project *Prj,bool ItsANewProject);
static void Prj_EditOneProjectTxtArea (const char *Id,
@ -975,7 +976,7 @@ static void Prj_ShowProjectsHead (struct Prj_Projects *Projects,
Order <= (Prj_Order_t) (Prj_NUM_ORDERS - 1);
Order++)
{
HTM_TH_Begin (1,1,"CM");
HTM_TH_Begin (1,1,"LM");
switch (ProjectView)
{
@ -2413,12 +2414,13 @@ static void Prj_FormToSelectUsrs (struct Prj_Projects *Projects,
[Prj_ROLE_TUT] = ActAddTutPrj, // Tutor
[Prj_ROLE_EVL] = ActAddEvlPrj, // Evaluator
};
struct Prj_Project Prj;
char *TxtButton;
/***** Get parameters *****/
Prj_GetParams (Projects);
if ((Projects->PrjCod = Prj_GetParamPrjCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of project is missing.");
if ((Projects->PrjCod = Prj.PrjCod = Prj_GetParamPrjCod ()) == -1L)
Lay_WrongProjectExit ();
/***** Put form to select users *****/
if (asprintf (&TxtButton,Txt_Add_USERS,
@ -2434,7 +2436,7 @@ static void Prj_FormToSelectUsrs (struct Prj_Projects *Projects,
free (TxtButton);
/***** Put a form to create/edit project *****/
Prj_RequestCreatOrEditPrj (Projects);
Prj_RequestCreatOrEditPrj (Projects,&Prj);
}
/*****************************************************************************/
@ -2486,15 +2488,17 @@ static void Prj_AddUsrsToProject (Prj_RoleInProject_t RoleInProject)
extern const char *Txt_THE_USER_X_has_been_enroled_as_a_Y_in_the_project;
extern const char *Txt_PROJECT_ROLES_SINGUL_abc[Prj_NUM_ROLES_IN_PROJECT][Usr_NUM_SEXS];
struct Prj_Projects Projects;
struct Prj_Project Prj;
const char *Ptr;
bool ItsMe;
/***** Reset projects *****/
Prj_ResetProjects (&Projects);
/***** Get project code *****/
if ((Projects.PrjCod = Prj_GetParamPrjCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of project is missing.");
/***** Get parameters *****/
Prj_GetParams (&Projects);
if ((Projects.PrjCod = Prj.PrjCod = Prj_GetParamPrjCod ()) == -1L)
Lay_WrongProjectExit ();
/***** Add the selected users to project *****/
Ptr = Prj_MembersToAdd.List[Rol_UNK];
@ -2533,7 +2537,7 @@ static void Prj_AddUsrsToProject (Prj_RoleInProject_t RoleInProject)
Usr_FreeListsSelectedEncryptedUsrsCods (&Prj_MembersToAdd);
/***** Put form to edit project again *****/
Prj_RequestCreatOrEditPrj (&Projects);
Prj_RequestCreatOrEditPrj (&Projects,&Prj);
}
/*****************************************************************************/
@ -2593,7 +2597,7 @@ static void Prj_ReqRemUsrFromPrj (struct Prj_Projects *Projects,
/***** Get parameters *****/
Prj_GetParams (Projects);
if ((Projects->PrjCod = Prj.PrjCod = Prj_GetParamPrjCod ()) < 0)
Lay_ShowErrorAndExit ("Code of project is missing.");
Lay_WrongProjectExit ();
/***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Prj);
@ -2639,7 +2643,7 @@ static void Prj_ReqRemUsrFromPrj (struct Prj_Projects *Projects,
Prj_FreeMemProject (&Prj);
/***** Put form to edit project again *****/
Prj_RequestCreatOrEditPrj (Projects);
Prj_RequestCreatOrEditPrj (Projects,&Prj);
}
/*****************************************************************************/
@ -2678,7 +2682,7 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
/***** Get parameters *****/
Prj_GetParams (&Projects);
if ((Projects.PrjCod = Prj.PrjCod = Prj_GetParamPrjCod ()) < 0)
Lay_ShowErrorAndExit ("Code of project is missing.");
Lay_WrongProjectExit ();
/***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Prj);
@ -2718,7 +2722,7 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject)
Prj_FreeMemProject (&Prj);
/***** Put form to edit project again *****/
Prj_RequestCreatOrEditPrj (&Projects);
Prj_RequestCreatOrEditPrj (&Projects,&Prj);
}
/*****************************************************************************/
@ -3097,7 +3101,7 @@ static void Prj_GetListProjects (struct Prj_Projects *Projects)
/* Get next project code */
row = mysql_fetch_row (mysql_res);
if ((PrjCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
Lay_ShowErrorAndExit ("Error: wrong project code.");
Lay_WrongProjectExit ();
/* Filter projects depending on faultiness */
switch (Projects->Filter.Faulti)
@ -3351,7 +3355,7 @@ void Prj_ReqRemProject (void)
/***** Get parameters *****/
Prj_GetParams (&Projects);
if ((Prj.PrjCod = Prj_GetParamPrjCod ()) < 0)
Lay_ShowErrorAndExit ("Code of project is missing.");
Lay_WrongProjectExit ();
/***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Prj);
@ -3396,7 +3400,7 @@ void Prj_RemoveProject (void)
/***** Get parameters *****/
Prj_GetParams (&Projects);
if ((Prj.PrjCod = Prj_GetParamPrjCod ()) < 0)
Lay_ShowErrorAndExit ("Code of project is missing.");
Lay_WrongProjectExit ();
/***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Prj); // Inside this function, the course is checked to be the current one
@ -3461,7 +3465,7 @@ void Prj_HideProject (void)
/***** Get parameters *****/
Prj_GetParams (&Projects);
if ((Prj.PrjCod = Prj_GetParamPrjCod ()) < 0)
Lay_ShowErrorAndExit ("Code of project is missing.");
Lay_WrongProjectExit ();
/***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Prj);
@ -3500,7 +3504,7 @@ void Prj_UnhideProject (void)
/***** Get parameters *****/
Prj_GetParams (&Projects);
if ((Prj.PrjCod = Prj_GetParamPrjCod ()) < 0)
Lay_ShowErrorAndExit ("Code of project is missing.");
Lay_WrongProjectExit ();
/***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Prj);
@ -3528,61 +3532,62 @@ void Prj_UnhideProject (void)
void Prj_RequestCreatePrj (void)
{
struct Prj_Projects Projects;
struct Prj_Project Prj;
/***** Reset projects *****/
Prj_ResetProjects (&Projects);
/***** Get parameters *****/
Prj_GetParams (&Projects);
Projects.PrjCod = Prj.PrjCod = -1L; // It's a new, non existing, project
/***** Form to create project *****/
Projects.PrjCod = -1L; // It's a new, non existing, project
Prj_RequestCreatOrEditPrj (&Projects);
Prj_RequestCreatOrEditPrj (&Projects,&Prj);
}
void Prj_RequestEditPrj (void)
{
struct Prj_Projects Projects;
struct Prj_Project Prj;
/***** Reset projects *****/
Prj_ResetProjects (&Projects);
/***** Get project code *****/
if ((Projects.PrjCod = Prj_GetParamPrjCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of project is missing.");
/***** Get parameters *****/
Prj_GetParams (&Projects);
if ((Projects.PrjCod = Prj.PrjCod = Prj_GetParamPrjCod ()) <= 0)
Lay_WrongProjectExit ();
/***** Form to edit project *****/
Prj_RequestCreatOrEditPrj (&Projects);
Prj_RequestCreatOrEditPrj (&Projects,&Prj);
}
static void Prj_RequestCreatOrEditPrj (struct Prj_Projects *Projects)
static void Prj_RequestCreatOrEditPrj (struct Prj_Projects *Projects,
struct Prj_Project *Prj)
{
struct Prj_Project Prj;
bool ItsANewProject;
bool ItsANewProject = (Prj->PrjCod < 0);
/***** Allocate memory for the project *****/
Prj_AllocMemProject (&Prj);
/***** Get parameters *****/
Prj.PrjCod = Projects->PrjCod;
Prj_GetParams (Projects);
ItsANewProject = (Prj.PrjCod < 0);
Prj_AllocMemProject (Prj);
/***** Get from the database the data of the project *****/
if (ItsANewProject)
{
/* Initialize to empty project */
Prj_ResetProject (&Prj);
Prj.CreatTime = Gbl.StartExecutionTimeUTC;
Prj.ModifTime = Gbl.StartExecutionTimeUTC;
Prj.DptCod = Gbl.Usrs.Me.UsrDat.Tch.DptCod; // Default: my department
Prj_ResetProject (Prj);
Prj->CreatTime = Gbl.StartExecutionTimeUTC;
Prj->ModifTime = Gbl.StartExecutionTimeUTC;
Prj->DptCod = Gbl.Usrs.Me.UsrDat.Tch.DptCod; // Default: my department
}
else
/* Get data of the project from database */
Prj_GetDataOfProjectByCod (&Prj);
Prj_GetDataOfProjectByCod (Prj);
/***** Put form to edit project *****/
Prj_PutFormProject (Projects,&Prj,ItsANewProject);
Prj_PutFormProject (Projects,Prj,ItsANewProject);
/***** Free memory of the project *****/
Prj_FreeMemProject (&Prj);
Prj_FreeMemProject (Prj);
/***** Show projects again *****/
Prj_ShowProjects (Projects);
@ -3967,7 +3972,7 @@ void Prj_ReceiveFormProject (void)
Prj_PutFormProject (&Projects,&Prj,ItsANewProject);
/***** Show again form to edit project *****/
Prj_RequestCreatOrEditPrj (&Projects);
Prj_RequestCreatOrEditPrj (&Projects,&Prj);
}
else
Lay_NoPermissionExit ();
@ -4470,7 +4475,7 @@ void Prj_LockProjectEdition (void)
/***** Get parameters *****/
Prj_GetParams (&Projects);
if ((Prj.PrjCod = Prj_GetParamPrjCod ()) < 0)
Lay_ShowErrorAndExit ("Code of project is missing.");
Lay_WrongProjectExit ();
/***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Prj);
@ -4517,7 +4522,7 @@ void Prj_UnloProjectEdition (void)
/***** Get parameters *****/
Prj_GetParams (&Projects);
if ((Prj.PrjCod = Prj_GetParamPrjCod ()) < 0)
Lay_ShowErrorAndExit ("Code of project is missing.");
Lay_WrongProjectExit ();
/***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Prj);

View File

@ -1191,12 +1191,12 @@ static void Rep_WriteRowCrsData (long CrsCod,Rol_Role_t Role,
/***** Write number of teachers / students in course *****/
if (WriteNumUsrs)
fprintf (Gbl.F.Rep," (%u %s / %u %s)",
Usr_GetNumUsrsInCrss (Hie_CRS,Crs.CrsCod,
1 << Rol_NET |
1 << Rol_TCH),
Usr_GetCachedNumUsrsInCrss (Hie_CRS,Crs.CrsCod,
1 << Rol_NET |
1 << Rol_TCH),
Txt_teachers_ABBREVIATION,
Usr_GetNumUsrsInCrss (Hie_CRS,Crs.CrsCod,
1 << Rol_STD),
Usr_GetCachedNumUsrsInCrss (Hie_CRS,Crs.CrsCod,
1 << Rol_STD),
Txt_students_ABBREVIATION);
}
else

View File

@ -47,7 +47,7 @@ typedef enum
The_THEME_PINK = 5,
The_THEME_UNKNOWN = 6,
} The_Theme_t;
#define The_THEME_DEFAULT The_THEME_PURPLE
#define The_THEME_DEFAULT The_THEME_PINK
/*****************************************************************************/
/***************************** Public prototypes *****************************/

View File

@ -9493,9 +9493,12 @@ static FigCch_FigureCached_t Usr_GetFigureNumUsrsInCrss (unsigned Roles)
return FigCch_NUM_NETS_IN_CRSS;
case 1 << Rol_TCH: // Teachers
return FigCch_NUM_TCHS_IN_CRSS;
case 1 << Rol_NET |
1 << Rol_TCH: // Any teacher in courses
return FigCch_NUM_ALLT_IN_CRSS;
case 1 << Rol_STD |
1 << Rol_NET |
1 << Rol_TCH: // Any users in courses
1 << Rol_TCH: // Any user in courses
return FigCch_NUM_USRS_IN_CRSS;
default:
Rol_WrongRoleExit ();