Version19.69.1

This commit is contained in:
Antonio Cañas Vargas 2019-11-15 10:48:20 +01:00
parent 15a58fd5c6
commit 23ef5cb1bd
5 changed files with 40 additions and 29 deletions

View File

@ -488,13 +488,14 @@ 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.69 (2019-11-15)" #define Log_PLATFORM_VERSION "SWAD 19.69.1 (2019-11-15)"
#define CSS_FILE "swad19.47.css" #define CSS_FILE "swad19.47.css"
#define JS_FILE "swad19.65.js" #define JS_FILE "swad19.65.js"
/* /*
// TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.) // TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.)
// TODO: Impedir la creación y edición de proyectos si no son editables. // TODO: Impedir la creación y edición de proyectos si no son editables.
Version 19.69.1: Nov 15, 2019 Fixed bugs in lists of users and hidden parameters. (246760 lines)
Version 19.69: Nov 15, 2019 Code refactoring related with lists of users and hidden parameters. (246752 lines) Version 19.69: Nov 15, 2019 Code refactoring related with lists of users and hidden parameters. (246752 lines)
Version 19.68.2: Nov 14, 2019 Code refactoring in users and attendance. (246625 lines) Version 19.68.2: Nov 14, 2019 Code refactoring in users and attendance. (246625 lines)
Version 19.68.1: Nov 14, 2019 Code refactoring in match results. Version 19.68.1: Nov 14, 2019 Code refactoring in match results.

View File

@ -2276,7 +2276,8 @@ static void Prj_ReqAddUsrs (Prj_RoleInProject_t RoleInProject)
}; };
char TxtButton[Lay_MAX_BYTES_TITLE + 1]; char TxtButton[Lay_MAX_BYTES_TITLE + 1];
/***** Get project code *****/ /***** Get parameters *****/
Prj_GetParams ();
if ((Gbl.Prjs.PrjCod = Prj_GetParamPrjCod ()) == -1L) if ((Gbl.Prjs.PrjCod = Prj_GetParamPrjCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of project is missing."); Lay_ShowErrorAndExit ("Code of project is missing.");
@ -2351,7 +2352,7 @@ static void Prj_AddUsrsToProject (Prj_RoleInProject_t RoleInProject)
Lay_ShowErrorAndExit ("Code of project is missing."); Lay_ShowErrorAndExit ("Code of project is missing.");
/***** Add the selected users to project *****/ /***** Add the selected users to project *****/
Ptr = Gbl.Usrs.Selected.List[Rol_UNK]; Ptr = Prj_MembersToAdd.List[Rol_UNK];
while (*Ptr) while (*Ptr)
{ {
/* Get next user */ /* Get next user */
@ -2383,6 +2384,9 @@ static void Prj_AddUsrsToProject (Prj_RoleInProject_t RoleInProject)
} }
} }
/***** Free memory used by lists of selected encrypted users' codes *****/
Usr_FreeListsSelectedEncryptedUsrsCods (&Prj_MembersToAdd);
/***** Put form to edit project again *****/ /***** Put form to edit project again *****/
Prj_RequestCreatOrEditPrj (PrjCod); Prj_RequestCreatOrEditPrj (PrjCod);
} }

View File

@ -2618,14 +2618,15 @@ static void TL_WriteCommentsInNote (const struct TL_Note *SocNot)
/***** Link to toggle on/off comments *****/ /***** Link to toggle on/off comments *****/
HTM_DIV_Begin ("id=\"con_%s\" class=\"TL_EXPAND_COM TL_RIGHT_WIDTH\"" HTM_DIV_Begin ("id=\"con_%s\" class=\"TL_EXPAND_COM TL_RIGHT_WIDTH\""
" style=\"display:none;\">", // Initially hidden " style=\"display:none;\"", // Initially hidden
IdComments); IdComments);
TL_PutIconToToggleComments (IdComments,"angle-down.svg", TL_PutIconToToggleComments (IdComments,"angle-down.svg",
Txt_See_only_the_latest_COMMENTS); Txt_See_only_the_latest_COMMENTS);
HTM_DIV_End (); HTM_DIV_End ();
/***** First list with comments initially hidden *****/ /***** First list with comments initially hidden *****/
HTM_UL_Begin ("id=\"com_%s\" class=\"LIST_LEFT\" style=\"display:none;\"", // Initially hidden HTM_UL_Begin ("id=\"com_%s\" class=\"LIST_LEFT\""
" style=\"display:none;\"", // Initially hidden
IdComments); IdComments);
for (NumCom = 0; for (NumCom = 0;
NumCom < NumCommentsInitiallyHidden; NumCom < NumCommentsInitiallyHidden;

View File

@ -209,7 +209,7 @@ static void Usr_PutParamsConfirmIWantToSeeBigList (void);
static void Usr_BuildParamName (char **ParamName, static void Usr_BuildParamName (char **ParamName,
const char *ParamRoot, const char *ParamRoot,
struct SelectedUsrs *SelectedUsrs); const char *ParamSuffix);
static void Usr_AllocateListSelectedEncryptedUsrCods (struct SelectedUsrs *SelectedUsrs, static void Usr_AllocateListSelectedEncryptedUsrCods (struct SelectedUsrs *SelectedUsrs,
Rol_Role_t Role); Rol_Role_t Role);
@ -5722,7 +5722,7 @@ void Usr_PutHiddenParSelectedUsrsCods (struct SelectedUsrs *SelectedUsrs)
/* Build name of the parameter. /* Build name of the parameter.
Sometimes a unique action needs several distinct lists of users, Sometimes a unique action needs several distinct lists of users,
so, it's necessary to use distinct names for the parameters. */ so, it's necessary to use distinct names for the parameters. */
Usr_BuildParamName (&ParamName,Usr_ParamUsrCod[Rol_UNK],SelectedUsrs); Usr_BuildParamName (&ParamName,Usr_ParamUsrCod[Rol_UNK],SelectedUsrs->ParamSuffix);
/* Put the parameter *****/ /* Put the parameter *****/
if (Gbl.Session.IsOpen) if (Gbl.Session.IsOpen)
@ -5750,7 +5750,7 @@ void Usr_GetListsSelectedEncryptedUsrsCods (struct SelectedUsrs *SelectedUsrs)
/***** Build name of the parameter. /***** Build name of the parameter.
Sometimes a unique action needs several distinct lists of users, Sometimes a unique action needs several distinct lists of users,
so, it's necessary to use distinct names for the parameters. *****/ so, it's necessary to use distinct names for the parameters. *****/
Usr_BuildParamName (&ParamName,Usr_ParamUsrCod[Rol_UNK],SelectedUsrs); Usr_BuildParamName (&ParamName,Usr_ParamUsrCod[Rol_UNK],SelectedUsrs->ParamSuffix);
/***** Get possible list of all selected users *****/ /***** Get possible list of all selected users *****/
Usr_AllocateListSelectedEncryptedUsrCods (SelectedUsrs,Rol_UNK); Usr_AllocateListSelectedEncryptedUsrCods (SelectedUsrs,Rol_UNK);
@ -5765,17 +5765,26 @@ void Usr_GetListsSelectedEncryptedUsrsCods (struct SelectedUsrs *SelectedUsrs)
Par_GetParMultiToText (ParamName,SelectedUsrs->List[Rol_UNK], Par_GetParMultiToText (ParamName,SelectedUsrs->List[Rol_UNK],
Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS);
/***** Free allocated memory for parameter name *****/
free (ParamName);
/***** Get list of selected users for each possible role *****/ /***** Get list of selected users for each possible role *****/
for (Role = Rol_TCH; // From the highest possible role of selected users... for (Role = Rol_TCH; // From the highest possible role of selected users...
Role >= Rol_GST; // ...downto the lowest possible role of selected users Role >= Rol_GST; // ...downto the lowest possible role of selected users
Role--) Role--)
if (Usr_ParamUsrCod[Role]) if (Usr_ParamUsrCod[Role])
{ {
/* Build name of the parameter */
Usr_BuildParamName (&ParamName,Usr_ParamUsrCod[Role],SelectedUsrs->ParamSuffix);
/* Get parameter with selected users with this role */ /* Get parameter with selected users with this role */
Usr_AllocateListSelectedEncryptedUsrCods (SelectedUsrs,Role); Usr_AllocateListSelectedEncryptedUsrCods (SelectedUsrs,Role);
Par_GetParMultiToText (Usr_ParamUsrCod[Role],SelectedUsrs->List[Role], Par_GetParMultiToText (ParamName,SelectedUsrs->List[Role],
Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS);
/* Free allocated memory for parameter name */
free (ParamName);
/* Add selected users with this role /* Add selected users with this role
to the list with all selected users */ to the list with all selected users */
if (SelectedUsrs->List[Role][0]) if (SelectedUsrs->List[Role][0])
@ -5792,9 +5801,6 @@ void Usr_GetListsSelectedEncryptedUsrsCods (struct SelectedUsrs *SelectedUsrs)
} }
} }
/***** Free allocated memory for parameter name *****/
free (ParamName);
/***** List is filled *****/ /***** List is filled *****/
SelectedUsrs->Filled = true; SelectedUsrs->Filled = true;
} }
@ -5802,14 +5808,14 @@ void Usr_GetListsSelectedEncryptedUsrsCods (struct SelectedUsrs *SelectedUsrs)
static void Usr_BuildParamName (char **ParamName, static void Usr_BuildParamName (char **ParamName,
const char *ParamRoot, const char *ParamRoot,
struct SelectedUsrs *SelectedUsrs) const char *ParamSuffix)
{ {
/* Build name of the parameter. /* Build name of the parameter.
Sometimes a unique action needs several distinct lists of users, Sometimes a unique action needs several distinct lists of users,
so, it's necessary to use distinct names for the parameters. */ so, it's necessary to use distinct names for the parameters. */
if (SelectedUsrs->ParamSuffix) if (ParamSuffix)
{ {
if (asprintf (ParamName,"%s%s",ParamRoot,SelectedUsrs->ParamSuffix) < 0) if (asprintf (ParamName,"%s%s",ParamRoot,ParamSuffix) < 0)
Lay_NotEnoughMemoryExit (); Lay_NotEnoughMemoryExit ();
} }
else else
@ -5952,7 +5958,7 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs)
Usr_GetUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Really only EncryptedUsrCod is needed Usr_GetUsrDataFromUsrCod (&UsrDat,Usr_DONT_GET_PREFS); // Really only EncryptedUsrCod is needed
/* Find if encrypted user's code is already in list */ /* Find if encrypted user's code is already in list */
if (!Usr_FindEncryptedUsrCodsInListOfSelectedEncryptedUsrCods (UsrDat.EncryptedUsrCod)) // If not in list ==> add it if (!Usr_FindEncryptedUsrCodsInListOfSelectedEncryptedUsrCods (UsrDat.EncryptedUsrCod,&Gbl.Usrs.Selected)) // If not in list ==> add it
{ {
LengthUsrCod = strlen (UsrDat.EncryptedUsrCod); LengthUsrCod = strlen (UsrDat.EncryptedUsrCod);
@ -6001,16 +6007,17 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs)
/*****************************************************************************/ /*****************************************************************************/
/************** Find if encrypted user's code is yet in list *****************/ /************** Find if encrypted user's code is yet in list *****************/
/*****************************************************************************/ /*****************************************************************************/
// Returns true if EncryptedUsrCodToFind is in Gbl.Usrs.Selected.List[Rol_UNK] // Returns true if EncryptedUsrCodToFind is in list
bool Usr_FindEncryptedUsrCodsInListOfSelectedEncryptedUsrCods (const char *EncryptedUsrCodToFind) bool Usr_FindEncryptedUsrCodsInListOfSelectedEncryptedUsrCods (const char *EncryptedUsrCodToFind,
struct SelectedUsrs *SelectedUsrs)
{ {
const char *Ptr; const char *Ptr;
char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]; char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1];
if (Gbl.Usrs.Selected.List[Rol_UNK]) if (SelectedUsrs->List[Rol_UNK])
{ {
Ptr = Gbl.Usrs.Selected.List[Rol_UNK]; Ptr = SelectedUsrs->List[Rol_UNK];
while (*Ptr) while (*Ptr)
{ {
Par_GetNextStrUntilSeparParamMult (&Ptr,EncryptedUsrCod, Par_GetNextStrUntilSeparParamMult (&Ptr,EncryptedUsrCod,
@ -6085,7 +6092,7 @@ static void Usr_AllocateListSelectedEncryptedUsrCods (struct SelectedUsrs *Selec
} }
/*****************************************************************************/ /*****************************************************************************/
/*********** Free memory used by lists of selected users' codes **************/ /******* Free memory used by lists of selected encrypted users' codes ********/
/*****************************************************************************/ /*****************************************************************************/
// Role = Rol_UNK here means all users // Role = Rol_UNK here means all users
@ -6411,9 +6418,6 @@ void Usr_GetSelectedUsrsAndGoToAct (struct SelectedUsrs *SelectedUsrs,
/***** Get lists of the selected users if not already got *****/ /***** Get lists of the selected users if not already got *****/
Usr_GetListsSelectedEncryptedUsrsCods (SelectedUsrs); Usr_GetListsSelectedEncryptedUsrsCods (SelectedUsrs);
Ale_ShowAlert (Ale_INFO,"DEBUG: SelectedUsrs->List[Rol_UNK] = %s;",
SelectedUsrs->List[Rol_UNK]);
Lay_ShowErrorAndExit ("DEBUG: Usr_GetSelectedUsrsAndGoToAct ()");
/***** Check number of users *****/ /***** Check number of users *****/
if (Usr_CheckIfThereAreUsrsInListOfSelectedEncryptedUsrCods (SelectedUsrs)) // If some users are selected... if (Usr_CheckIfThereAreUsrsInListOfSelectedEncryptedUsrCods (SelectedUsrs)) // If some users are selected...
@ -6474,7 +6478,7 @@ static void Usr_PutCheckboxToSelectAllUsers (Rol_Role_t Role,
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
if (Usr_NameSelUnsel[Role] && Usr_ParamUsrCod[Role]) if (Usr_NameSelUnsel[Role] && Usr_ParamUsrCod[Role])
{ {
Usr_BuildParamName (&ParamName,Usr_ParamUsrCod[Role],SelectedUsrs); Usr_BuildParamName (&ParamName,Usr_ParamUsrCod[Role],SelectedUsrs->ParamSuffix);
HTM_INPUT_CHECKBOX (Usr_NameSelUnsel[Role],false, HTM_INPUT_CHECKBOX (Usr_NameSelUnsel[Role],false,
"value=\"\" onclick=\"togglecheckChildren(this,'%s')\"", "value=\"\" onclick=\"togglecheckChildren(this,'%s')\"",
ParamName); ParamName);
@ -6548,10 +6552,10 @@ static void Usr_PutCheckboxToSelectUser (Rol_Role_t Role,
CheckboxChecked = true; CheckboxChecked = true;
else else
/* Check if user is in lists of selected users */ /* Check if user is in lists of selected users */
CheckboxChecked = Usr_FindEncryptedUsrCodsInListOfSelectedEncryptedUsrCods (EncryptedUsrCod); CheckboxChecked = Usr_FindEncryptedUsrCodsInListOfSelectedEncryptedUsrCods (EncryptedUsrCod,SelectedUsrs);
/***** Check box *****/ /***** Check box *****/
Usr_BuildParamName (&ParamName,Usr_ParamUsrCod[Role],SelectedUsrs); Usr_BuildParamName (&ParamName,Usr_ParamUsrCod[Role],SelectedUsrs->ParamSuffix);
HTM_INPUT_CHECKBOX (ParamName,false, HTM_INPUT_CHECKBOX (ParamName,false,
"value=\"%s\"%s onclick=\"checkParent(this,'%s')\"", "value=\"%s\"%s onclick=\"checkParent(this,'%s')\"",
EncryptedUsrCod, EncryptedUsrCod,

View File

@ -443,7 +443,8 @@ void Usr_GetListsSelectedEncryptedUsrsCods (struct SelectedUsrs *SelectedUsrs);
bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs); bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs);
bool Usr_FindEncryptedUsrCodsInListOfSelectedEncryptedUsrCods (const char *EncryptedUsrCodToFind); bool Usr_FindEncryptedUsrCodsInListOfSelectedEncryptedUsrCods (const char *EncryptedUsrCodToFind,
struct SelectedUsrs *SelectedUsrs);
bool Usr_CheckIfThereAreUsrsInListOfSelectedEncryptedUsrCods (struct SelectedUsrs *SelectedUsrs); bool Usr_CheckIfThereAreUsrsInListOfSelectedEncryptedUsrCods (struct SelectedUsrs *SelectedUsrs);
unsigned Usr_CountNumUsrsInListOfSelectedEncryptedUsrCods (struct SelectedUsrs *SelectedUsrs); unsigned Usr_CountNumUsrsInListOfSelectedEncryptedUsrCods (struct SelectedUsrs *SelectedUsrs);
void Usr_FreeListsSelectedEncryptedUsrsCods (struct SelectedUsrs *SelectedUsrs); void Usr_FreeListsSelectedEncryptedUsrsCods (struct SelectedUsrs *SelectedUsrs);