From cdbbac7f15213827739c9259b51781106f889e82 Mon Sep 17 00:00:00 2001 From: acanas Date: Fri, 27 Oct 2023 13:54:14 +0200 Subject: [PATCH] =?UTF-8?q?Version=2023.38.1:=20=20Oct=2027,=202023=20=20F?= =?UTF-8?q?ix=20issue=20related=20to=20public=20profile=20and=20record=20c?= =?UTF-8?q?ard.=20Reported=20by=20Francisco=20Javier=20Fern=C3=A1ndez=20Ba?= =?UTF-8?q?ldomero.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- swad_API.c | 8 +- swad_RSS.c | 2 +- swad_account.c | 2 +- swad_agenda.c | 2 +- swad_attendance.c | 4 +- swad_autolink.c | 2 +- swad_browser.c | 14 +- swad_center.c | 2 +- swad_changelog.h | 5 +- swad_connected.c | 4 +- swad_course.c | 2 +- swad_degree.c | 2 +- swad_duplicate.c | 4 +- swad_enrolment.c | 18 +- swad_exam_result.c | 8 +- swad_follow.c | 28 +-- swad_forum.c | 4 +- swad_group.c | 6 +- swad_institution.c | 2 +- swad_mark.c | 2 +- swad_match_result.c | 8 +- swad_message.c | 12 +- swad_notice.c | 2 +- swad_notification.c | 8 +- swad_password.c | 2 +- swad_photo.c | 6 +- swad_profile.c | 26 +-- swad_profile.h | 4 +- swad_project.c | 6 +- swad_record.c | 340 +++++++++++++++++------------------ swad_statistic.c | 4 +- swad_string.c | 2 +- swad_test_print.c | 4 +- swad_timeline_comment.c | 8 +- swad_timeline_note.c | 8 +- swad_timeline_notification.c | 2 +- swad_timeline_post.c | 2 +- swad_timeline_user.c | 2 +- swad_user.c | 26 +-- swad_user.h | 4 +- swad_zip.c | 2 +- 41 files changed, 302 insertions(+), 297 deletions(-) diff --git a/swad_API.c b/swad_API.c index 757839cd..9876bb69 100644 --- a/swad_API.c +++ b/swad_API.c @@ -1080,7 +1080,7 @@ int swad__getNewPassword (struct soap *soap, { Usr_GetUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat, // Get my data Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); if (Gbl.Usrs.Me.UsrDat.Email[0]) if (Pwd_SendNewPasswordByEmail (NewRandomPlainPassword) == 0) // Message sent successfully @@ -3244,7 +3244,7 @@ int swad__sendMessage (struct soap *soap, /* Get recipient data */ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /* This received message must be notified by email? */ NotifyByEmail = (Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod) == Usr_OTHER && @@ -4843,7 +4843,7 @@ static bool API_WriteRowFileBrowser (FILE *XML,unsigned Level, Gbl.Usrs.Other.UsrDat.UsrCod = FileMetadata.PublisherUsrCod; Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,PhotoURL); fprintf (XML,"" @@ -5030,7 +5030,7 @@ int swad__getFile (struct soap *soap, /* Get publisher's data */ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /* Copy publisher's data into output structure */ Str_Copy (getFileOut->publisherName,Gbl.Usrs.Other.UsrDat.FullName, diff --git a/swad_RSS.c b/swad_RSS.c index 8acf8fec..a8ace103 100644 --- a/swad_RSS.c +++ b/swad_RSS.c @@ -177,7 +177,7 @@ static void RSS_WriteNotices (FILE *FileRSS,struct Hie_Node *Crs) UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[2]); Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get author's data from database Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /***** Write item with notice *****/ fprintf (FileRSS,"\n"); diff --git a/swad_account.c b/swad_account.c index b96120a8..ab5d9f63 100644 --- a/swad_account.c +++ b/swad_account.c @@ -241,7 +241,7 @@ void Acc_CheckIfEmptyAccountExists (void) /* Get user's data */ Usr_GetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /***** Write row with data of empty account *****/ Acc_WriteRowEmptyAccount (NumUsr,ID,&UsrDat); diff --git a/swad_agenda.c b/swad_agenda.c index ce78b5eb..b7e2aca9 100644 --- a/swad_agenda.c +++ b/swad_agenda.c @@ -449,7 +449,7 @@ void Agd_ShowOtherAgendaAfterLogIn (void) /* If nickname is correct, user code is already got from nickname */ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, // Existing user Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /***** Reset agenda context *****/ Agd_ResetAgenda (&Agenda); diff --git a/swad_attendance.c b/swad_attendance.c index 97c0d22b..eed1d94f 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -2785,7 +2785,7 @@ static void Att_ListUsrsAttendanceTable (struct Att_Events *Events, UsrDat.UsrCod = LstSelectedUsrCods[NumUsr]; if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get from the database the data of the student Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) if (Usr_CheckIfICanViewAtt (&UsrDat)) { UsrDat.Accepted = Enr_CheckIfUsrHasAcceptedInCurrentCrs (&UsrDat); @@ -3019,7 +3019,7 @@ static void Att_ListStdsWithAttEventsDetails (struct Att_Events *Events, UsrDat.UsrCod = LstSelectedUsrCods[NumUsr]; if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get from the database the data of the student Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) if (Usr_CheckIfICanViewAtt (&UsrDat)) { UsrDat.Accepted = Enr_CheckIfUsrHasAcceptedInCurrentCrs (&UsrDat); diff --git a/swad_autolink.c b/swad_autolink.c index 4a3a92c7..f35d2947 100644 --- a/swad_autolink.c +++ b/swad_autolink.c @@ -529,7 +529,7 @@ static ALn_LinkType_t ALn_CheckNickname (char **PtrSrc,char PrevCh, Type = ALn_LINK_NICK; Usr_GetUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); } if (Type == ALn_LINK_NICK) diff --git a/swad_browser.c b/swad_browser.c index c7194285..cf507c9d 100644 --- a/swad_browser.c +++ b/swad_browser.c @@ -2798,7 +2798,7 @@ static void Brw_ShowFileBrowsersAsgWrkCrs (void) Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) if (Usr_CheckIfICanViewAsgWrk (&Gbl.Usrs.Other.UsrDat)) { Gbl.Usrs.Other.UsrDat.Accepted = @@ -4979,7 +4979,7 @@ static void Brw_WriteFileOrFolderPublisher (unsigned Level,long UsrCod) UsrDat.UsrCod = UsrCod; ShowUsr = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); } HTM_TD_Begin ("class=\"BM %s\"",The_GetColorRows ()); @@ -5428,7 +5428,7 @@ static void Brw_WriteCurrentClipboard (void) UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod; Usr_GetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); snprintf (TxtClipboardZone,sizeof (TxtClipboardZone), "%s, %s %s, %s %s", Txt_assignments_area, @@ -5443,7 +5443,7 @@ static void Brw_WriteCurrentClipboard (void) UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod; Usr_GetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); snprintf (TxtClipboardZone,sizeof (TxtClipboardZone), "%s, %s %s, %s %s", Txt_works_area, @@ -5928,7 +5928,7 @@ static void Brw_PasteClipboard (struct BrwSiz_BrowserSize *Size) UsrDat.UsrCod = Gbl.FileBrowser.Clipboard.WorksUsrCod; Usr_GetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); // Check that user exists + Usr_DONT_GET_ROLE_IN_CRS); // Check that user exists snprintf (PathOrg,sizeof (PathOrg),"%s/%ld/%s/%02u/%ld/%s", Cfg_PATH_CRS_PRIVATE,Hie[Hie_CRS].HieCod,Cfg_FOLDER_USR, (unsigned) (Gbl.FileBrowser.Clipboard.WorksUsrCod % 100), @@ -7416,7 +7416,7 @@ void Brw_ShowFileMetadata (void) PublisherUsrDat.UsrCod = FileMetadata.PublisherUsrCod; FileHasPublisher = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherUsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); } else FileHasPublisher = false; // Get user's data from database @@ -9145,7 +9145,7 @@ void Brw_GetSummaryAndContentOfFile (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], PublisherUsrDat.UsrCod = FileMetadata.PublisherUsrCod; FileHasPublisher = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherUsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); } else /* Unknown publisher */ diff --git a/swad_center.c b/swad_center.c index e2f9e102..2b5bb06d 100644 --- a/swad_center.c +++ b/swad_center.c @@ -887,7 +887,7 @@ static void Ctr_ListCentersForEdition (const struct Plc_Places *Places) UsrDat.UsrCod = Ctr->RequesterUsrCod; Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); HTM_TD_Begin ("class=\"DAT_%s INPUT_REQUESTER LT\"", The_GetSuffix ()); Usr_WriteAuthor (&UsrDat,Cns_ENABLED); diff --git a/swad_changelog.h b/swad_changelog.h index 19f26ad8..d441ec67 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -633,10 +633,13 @@ Me sale este error, no s "can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod') */ -#define Log_PLATFORM_VERSION "SWAD 23.38 (2023-10-18)" +#define Log_PLATFORM_VERSION "SWAD 23.38.1 (2023-10-27)" #define CSS_FILE "swad23.35.1.css" #define JS_FILE "swad22.49.js" /* + * URGENTE: En un juego edito una pregunta y al guardarla se estropea todo. + * Un ítem del programa está contraído. Al pulsar en editarlo, debería expandirse. + Version 23.38.1: Oct 27, 2023 Fix issue related to public profile and record card. Reported by Francisco Javier Fernández Baldomero. (335152 lines) Version 23.38: Oct 18, 2023 Matches of a game are displayed as hidden when the game is hidden. (335149 lines) Version 23.37: Oct 14, 2023 Code refactoring in HTML. (335165 lines) Version 23.36: Oct 11, 2023 Code refactoring in HTML. (335342 lines) diff --git a/swad_connected.c b/swad_connected.c index 7e386b16..f6a1ebe7 100644 --- a/swad_connected.c +++ b/swad_connected.c @@ -566,7 +566,7 @@ static void Con_WriteRowConnectedUsrOnRightColumn (Rol_Role_t Role) /***** Get user's data *****/ Usr_GetAllUsrDataFromUsrCod (&OtherUsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); UsrDat = &OtherUsrDat; break; @@ -674,7 +674,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Existing user Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /* Get course code (row[1]) */ ThisCrs = (Str_ConvertStrCodToLongCod (row[1]) == Gbl.Hierarchy.Node[Hie_CRS].HieCod); diff --git a/swad_course.c b/swad_course.c index 1f676d4b..0f1781c3 100644 --- a/swad_course.c +++ b/swad_course.c @@ -1032,7 +1032,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year) UsrDat.UsrCod = Crs->RequesterUsrCod; Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"", The_GetSuffix ()); Usr_WriteAuthor (&UsrDat,Cns_ENABLED); diff --git a/swad_degree.c b/swad_degree.c index 5687f58d..47c0a947 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -464,7 +464,7 @@ static void Deg_ListDegreesForEdition (const struct DegTyp_DegTypes *DegTypes) UsrDat.UsrCod = Deg->RequesterUsrCod; Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); HTM_TD_Begin ("class=\"LT DAT_%s INPUT_REQUESTER\"", The_GetSuffix ()); Usr_WriteAuthor (&UsrDat,Cns_ENABLED); diff --git a/swad_duplicate.c b/swad_duplicate.c index c5128f68..13f96a6e 100644 --- a/swad_duplicate.c +++ b/swad_duplicate.c @@ -151,7 +151,7 @@ void Dup_ListDuplicateUsrs (void) UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /* Get if user has accepted all his/her courses */ if (Enr_DB_GetNumCrssOfUsr (UsrDat.UsrCod) != 0) @@ -270,7 +270,7 @@ static void Dup_ListSimilarUsrs (void) UsrDat.UsrCod = DB_GetNextCode (mysql_res); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /* Get if user has accepted all his/her courses */ if (Enr_DB_GetNumCrssOfUsr (UsrDat.UsrCod) != 0) diff --git a/swad_enrolment.c b/swad_enrolment.c index 00b7aff0..698a1b9f 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -444,7 +444,7 @@ void Enr_GetNotifEnrolment (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], UsrDat.UsrCod = UsrCod; Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /* Set summary string depending on role and sex */ Str_Copy (SummaryStr,Txt_ROLES_SINGUL_Abc[Role][UsrDat.Sex], @@ -743,7 +743,7 @@ void Enr_RemoveOldUsrs (void) UsrDat.UsrCod = DB_GetNextCode (mysql_res); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { // User's data exist... Acc_CompletelyEliminateAccount (&UsrDat,Cns_QUIET); @@ -1127,7 +1127,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumCurrentUsr].UsrCod; if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { // User's data exist... if (WhatToDo.EliminateUsrs) // Eliminate user completely from the platform @@ -1654,7 +1654,7 @@ static void Enr_RegisterUsr (struct Usr_Data *UsrDat,Rol_Role_t RegRemRole, /* Get user's data */ Usr_GetAllUsrDataFromUsrCod (UsrDat, Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS); + Usr_GET_ROLE_IN_CRS); else // User does not exist in database, create it using his/her ID! { /* Reset user's data */ @@ -1912,7 +1912,7 @@ void Enr_GetNotifEnrolmentRequest (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]); Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /* Role (row[1]) */ DesiredRole = Rol_ConvertUnsignedStrToRole (row[1]); @@ -1952,7 +1952,7 @@ void Enr_AskIfRejectSignUp (void) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { // User's data exist... if (Enr_CheckIfUsrBelongsToCurrentCrs (&Gbl.Usrs.Other.UsrDat)) @@ -2012,7 +2012,7 @@ void Enr_RejectSignUp (void) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { // User's data exist... if (Enr_CheckIfUsrBelongsToCurrentCrs (&Gbl.Usrs.Other.UsrDat)) @@ -2216,7 +2216,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected) UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[2]); UsrExists = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /***** Get requested role (row[3]) *****/ DesiredRole = Rol_ConvertUnsignedStrToRole (row[3]); @@ -2566,7 +2566,7 @@ static void Enr_AskIfRegRemUsr (struct Usr_ListUsrCods *ListUsrCods,Rol_Role_t R Gbl.Usrs.Other.UsrDat.UsrCod = ListUsrCods->Lst[NumUsr]; Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS); + Usr_GET_ROLE_IN_CRS); /* Show form to edit user */ Enr_ShowFormToEditOtherUsr (); diff --git a/swad_exam_result.c b/swad_exam_result.c index 6b2fff2d..202a598c 100644 --- a/swad_exam_result.c +++ b/swad_exam_result.c @@ -361,7 +361,7 @@ static void ExaRes_ListAllResultsInSelectedExams (struct Exa_Exams *Exams) Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show sessions results *****/ @@ -428,7 +428,7 @@ static void ExaRes_ListAllResultsInExa (struct Exa_Exams *Exams) if ((Gbl.Usrs.Other.UsrDat.UsrCod = DB_GetNextCode (mysql_res)) > 0) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show sessions results *****/ @@ -500,7 +500,7 @@ static void ExaRes_ListAllResultsInSes (struct Exa_Exams *Exams,long SesCod) if ((Gbl.Usrs.Other.UsrDat.UsrCod = DB_GetNextCode (mysql_res)) > 0) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show sessions results *****/ @@ -1354,7 +1354,7 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam, /* Get data of the user who answered the exam print */ if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) Err_WrongUserExit (); if (!Usr_CheckIfICanViewTstExaMchResult (UsrDat)) Err_NoPermissionExit (); diff --git a/swad_follow.c b/swad_follow.c index c3633bd5..614536ff 100644 --- a/swad_follow.c +++ b/swad_follow.c @@ -127,7 +127,7 @@ void Fol_SuggestUsrsToFollowOnMainZone (void) /***** Contextual menu *****/ Mnu_ContextMenuBegin (); Prf_PutLinkMyPublicProfile (); // My public profile - Prf_PutLinkRequestAnotherUserProfile (); // Request another user's profile + Prf_PutLinkReqAnotherUsrProfile (); // Request another user's profile Mnu_ContextMenuEnd (); /***** Get users *****/ @@ -159,7 +159,7 @@ void Fol_SuggestUsrsToFollowOnMainZone (void) HTM_TR_Begin (NULL); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) Fol_ShowFollowedOrFollower (&UsrDat); if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) || NumUsr == NumUsrs - 1) @@ -219,7 +219,7 @@ void Fol_SuggestUsrsToFollowOnRightColumn (void) /***** Show user *****/ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) Fol_WriteRowUsrToFollowOnRightColumn (&UsrDat); } @@ -433,7 +433,7 @@ void Fol_ListFollowing (void) { if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) Fol_ListFollowingUsr (&Gbl.Usrs.Other.UsrDat); else Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission (); @@ -451,7 +451,7 @@ static void Fol_ListFollowingUsr (struct Usr_Data *UsrDat) struct Usr_Data FollowingUsrDat; /***** Show user's profile *****/ - if (Prf_ShowUserProfile (UsrDat)) + if (Prf_ShowUsrProfile (UsrDat)) { /***** Get list of following *****/ NumUsrs = Fol_DB_GetListFollowing (UsrDat->UsrCod,&mysql_res); @@ -478,7 +478,7 @@ static void Fol_ListFollowingUsr (struct Usr_Data *UsrDat) HTM_TR_Begin (NULL); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FollowingUsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) Fol_ShowFollowedOrFollower (&FollowingUsrDat); if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) || NumUsr == NumUsrs - 1) @@ -512,7 +512,7 @@ void Fol_ListFollowers (void) { if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) Fol_ListFollowersUsr (&Gbl.Usrs.Other.UsrDat); else Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission (); @@ -530,7 +530,7 @@ static void Fol_ListFollowersUsr (struct Usr_Data *UsrDat) struct Usr_Data FollowerUsrDat; /***** Show user's profile *****/ - if (Prf_ShowUserProfile (UsrDat)) + if (Prf_ShowUsrProfile (UsrDat)) { /***** Get list of followers *****/ if ((NumUsrs = Fol_DB_GetListFollowers (UsrDat->UsrCod,&mysql_res))) @@ -556,7 +556,7 @@ static void Fol_ListFollowersUsr (struct Usr_Data *UsrDat) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FollowerUsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) Fol_ShowFollowedOrFollower (&FollowerUsrDat); if ((NumUsr % Fol_NUM_COLUMNS_FOLLOW) == (Fol_NUM_COLUMNS_FOLLOW-1) || @@ -776,7 +776,7 @@ void Fol_FollowUsr2 (void) if (Ale_GetTypeOfLastAlert () == Ale_SUCCESS) { /***** Show user's profile again *****/ - if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat)) + if (!Prf_ShowUsrProfile (&Gbl.Usrs.Other.UsrDat)) /* 1) I had permission to follow the user and I've just follow him/her 2) User restricted permission, so now I can not view his/her profile 3) Now I can not view his/her profile ==> show users I follow */ @@ -812,7 +812,7 @@ void Fol_UnfollowUsr2 (void) if (Ale_GetTypeOfLastAlert () == Ale_SUCCESS) { /***** Show user's profile again *****/ - if (!Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat)) // I can not view user's profile + if (!Prf_ShowUsrProfile (&Gbl.Usrs.Other.UsrDat)) // I can not view user's profile /* 1) I followed a user when I had permission 2) User restricted permission, so now I can not view his/her profile 3) Now I can not view his/her profile ==> show users I follow */ @@ -946,7 +946,7 @@ static void Fol_GetFollowedFromSelectedUsrs (unsigned *NumFollowed, if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod) // Skip me if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) // Get from the database the data of the student + Usr_DONT_GET_ROLE_IN_CRS)) // Get from the database the data of the student if (Enr_CheckIfUsrBelongsToCurrentCrs (&UsrDat)) { /* Check if I follow this user, and update number of users */ @@ -994,7 +994,7 @@ void Fol_FollowUsrs () if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod) // Skip me if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) if (Enr_CheckIfUsrBelongsToCurrentCrs (&UsrDat)) /* If I don't follow this user ==> follow him/her */ if (!Fol_DB_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod, @@ -1043,7 +1043,7 @@ void Fol_UnfollowUsrs (void) if (Gbl.Usrs.Me.UsrDat.UsrCod != UsrDat.UsrCod) // Skip me if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) if (Enr_CheckIfUsrBelongsToCurrentCrs (&UsrDat)) /* If I follow this user ==> unfollow him/her */ if (Fol_DB_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod, diff --git a/swad_forum.c b/swad_forum.c index 9201d7ca..e1d5b2ea 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -1034,7 +1034,7 @@ static void For_ShowAForumPost (struct For_Forums *Forums, The_GetSuffix ()); Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); Usr_WriteAuthor (&UsrDat,DisabledOrEnabled); if (DisabledOrEnabled == Cns_ENABLED) /* Write number of posts from this user */ @@ -2305,7 +2305,7 @@ static void For_ListForumThrs (struct For_Forums *Forums, UsrDat.UsrCod = Thr.UsrCod[Order]; Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); HTM_TD_Begin ("class=\"LT %s_%s %s\"", Class,The_GetSuffix (),BgColor); Usr_WriteAuthor (&UsrDat,Thr.Enabled[Order]); diff --git a/swad_group.c b/swad_group.c index 4b1e2628..6d0bc106 100644 --- a/swad_group.c +++ b/swad_group.c @@ -545,13 +545,15 @@ void Grp_GetParCodsSeveralGrps (void) const char *Ptr; char LongStr[Cns_MAX_DECIMAL_DIGITS_LONG + 1]; unsigned NumGrp; - unsigned long MaxSizeLstGrpCods = ((Cns_MAX_DECIMAL_DIGITS_LONG + 1) * Gbl.Crs.Grps.NumGrps) - 1; + unsigned long MaxSizeLstGrpCods; /***** Reset number of groups selected *****/ Gbl.Crs.Grps.LstGrpsSel.NumGrps = 0; if (Gbl.Crs.Grps.NumGrps) // If course has groups { + MaxSizeLstGrpCods = ((Cns_MAX_DECIMAL_DIGITS_LONG + 1) * Gbl.Crs.Grps.NumGrps) - 1; + /***** Allocate memory for the list of group codes selected *****/ if ((ParLstCodGrps = malloc (MaxSizeLstGrpCods + 1)) == NULL) Err_NotEnoughMemoryExit (); @@ -559,6 +561,8 @@ void Grp_GetParCodsSeveralGrps (void) /***** Get parameter with list of groups to list *****/ Par_GetParMultiToText ("GrpCods",ParLstCodGrps,MaxSizeLstGrpCods); + // Ale_ShowAlert (Ale_INFO,"ParLstCodGrps = "%s"",ParLstCodGrps); + if (ParLstCodGrps[0]) { /***** Count number of groups selected from LstCodGrps *****/ diff --git a/swad_institution.c b/swad_institution.c index 61b57d75..f429f38d 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -996,7 +996,7 @@ static void Ins_ListInstitutionsForEdition (void) UsrDat.UsrCod = Ins->RequesterUsrCod; Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); Usr_WriteAuthor (&UsrDat,Cns_ENABLED); HTM_TD_End (); diff --git a/swad_mark.c b/swad_mark.c index d0be7a95..0402d0e1 100644 --- a/swad_mark.c +++ b/swad_mark.c @@ -582,7 +582,7 @@ void Mrk_ShowMyMarks (void) /***** Get list of user's IDs *****/ Usr_GetAllUsrDataFromUsrCod (UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /***** Create temporal file to store my marks (in HTML) *****/ /* If the private directory does not exist, create it */ diff --git a/swad_match_result.c b/swad_match_result.c index e4799ee9..3c9b8aaf 100644 --- a/swad_match_result.c +++ b/swad_match_result.c @@ -303,7 +303,7 @@ static void MchRes_ListAllMchResultsInSelectedGames (struct Gam_Games *Games) Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show matches results *****/ @@ -394,7 +394,7 @@ static void MchRes_ListAllMchResultsInGam (struct Gam_Games *Games) if ((Gbl.Usrs.Other.UsrDat.UsrCod = DB_GetNextCode (mysql_res)) > 0) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show matches results *****/ @@ -466,7 +466,7 @@ static void MchRes_ListAllMchResultsInMch (struct Gam_Games *Games,long MchCod) if ((Gbl.Usrs.Other.UsrDat.UsrCod = DB_GetNextCode (mysql_res)) > 0) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show matches results *****/ @@ -1106,7 +1106,7 @@ void MchRes_ShowOneMchResult (void) /* Get data of the user who answer the match */ if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (UsrDat, Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) Err_WrongUserExit (); if (!Usr_CheckIfICanViewTstExaMchResult (UsrDat)) Err_NoPermissionExit (); diff --git a/swad_message.c b/swad_message.c index e984758e..76a54451 100644 --- a/swad_message.c +++ b/swad_message.c @@ -818,7 +818,7 @@ void Msg_RecMsgFromUsr (void) Usr_GetUsrCodFromEncryptedUsrCod (&UsrDstData); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDstData, // Get recipient's data from database Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /***** Check if recipient has banned me *****/ RecipientHasBannedMe = Msg_DB_CheckIfUsrIsBanned (Gbl.Usrs.Me.UsrDat.UsrCod,UsrDstData.UsrCod); @@ -2085,7 +2085,7 @@ static void Msg_ShowASentOrReceivedMessage (struct Msg_Messages *Messages, "MSG_BG_NEW",The_GetSuffix ()); Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); Usr_WriteAuthor (&UsrDat,Cns_ENABLED); HTM_TD_End (); @@ -2521,7 +2521,7 @@ static void Msg_WriteMsgTo (struct Msg_Messages *Messages,long MsgCod) /* Get user's data */ UsrValid = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /* Put an icon to show if user has read the message */ Title = OpenByDst ? (Deleted ? Txt_MSG_Open_and_deleted : @@ -2710,7 +2710,7 @@ void Msg_BanSenderWhenShowingMsgs (void) /***** Get password, user type and user's data from database *****/ if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) Err_WrongUserExit (); /***** Insert pair (sender's code - my code) in table of banned senders if not inserted *****/ @@ -2765,7 +2765,7 @@ static void Msg_UnbanSender (void) /***** Get password, user type and user's data from database *****/ if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) Err_WrongUserExit (); /***** Remove pair (sender's code - my code) from table of banned senders *****/ @@ -2819,7 +2819,7 @@ void Msg_ListBannedUsrs (void) /* Get user's data from database */ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { HTM_TR_Begin (NULL); diff --git a/swad_notice.c b/swad_notice.c index 7579a7c7..eaf1a1c8 100644 --- a/swad_notice.c +++ b/swad_notice.c @@ -614,7 +614,7 @@ static void Not_DrawANotice (Not_Listing_t TypeNoticesListing, UsrDat.UsrCod = Notice->UsrCod; if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get author's data from database Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) Usr_WriteFirstNameBRSurnames (&UsrDat); Usr_UsrDataDestructor (&UsrDat); HTM_DIV_End (); diff --git a/swad_notification.c b/swad_notification.c index 9284b8fc..5be68fb3 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -416,7 +416,7 @@ void Ntf_ShowMyNotifications (void) UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[1]); Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /* Get institution code (row[2]) */ Hie[Hie_INS].HieCod = Str_ConvertStrCodToLongCod (row[2]); @@ -1168,7 +1168,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) if ((UsrDat.NtfEvents.CreateNotif & NotifyEventMask)) // Create notification { if ((UsrDat.NtfEvents.SendEmail & NotifyEventMask)) // Send notification by email @@ -1227,7 +1227,7 @@ void Ntf_SendPendingNotifByEMailToAllUsrs (void) /* Get user's data */ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&ToUsrDat, // Get user's data from database Usr_GET_PREFS, // User's language necessary to write email - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /* Send one email to this user */ Ntf_SendPendingNotifByEMailToOneUsr (&ToUsrDat,&NumNotif,&NumMails); @@ -1333,7 +1333,7 @@ static void Ntf_SendPendingNotifByEMailToOneUsr (const struct Usr_Data *ToUsrDat FromUsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[1]); Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&FromUsrDat, // Get origin user's data from database Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /* Get insti. code (row[2]), center code (row[3]), diff --git a/swad_password.c b/swad_password.c index b76086aa..c8dc105a 100644 --- a/swad_password.c +++ b/swad_password.c @@ -362,7 +362,7 @@ void Pwd_ChkIdLoginAndSendNewPwd (void) Gbl.Usrs.Me.UsrDat.UsrCod = ListUsrCods.Lst[NumUsr]; Usr_GetUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat, // Get my data Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); if (Gbl.Usrs.Me.UsrDat.Email[0]) switch ((ReturnCode = Pwd_SendNewPasswordByEmail (NewRandomPlainPassword))) diff --git a/swad_photo.c b/swad_photo.c index 3ed7ecc6..2b57b6d3 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -399,7 +399,7 @@ void Pho_RecOtherUsrPhotoDetFaces (void) /***** Get password, user type and user's data from database *****/ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /***** Receive photo *****/ if (!Pho_ReceivePhotoAndDetectFaces (Usr_OTHER,&Gbl.Usrs.Other.UsrDat)) @@ -512,7 +512,7 @@ void Pho_ReqRemUsrPhoto (void) /***** Get password, user type and user's data from database *****/ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { if (Pho_ICanChangeOtherUsrPhoto (&Gbl.Usrs.Other.UsrDat)) { @@ -558,7 +558,7 @@ void Pho_RemoveUsrPhoto (void) /***** Get password, user type and user's data from database *****/ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /***** Remove photo *****/ if (Pho_RemovePhoto (&Gbl.Usrs.Other.UsrDat)) diff --git a/swad_profile.c b/swad_profile.c index 5b5087a5..22f72791 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -159,7 +159,7 @@ void Prf_PutLinkMyPublicProfile (void) /***************** Put link to request another user's profile ****************/ /*****************************************************************************/ -void Prf_PutLinkRequestAnotherUserProfile (void) +void Prf_PutLinkReqAnotherUsrProfile (void) { extern const char *Txt_Another_user_s_profile; @@ -237,9 +237,9 @@ void Prf_GetUsrDatAndShowUserProfile (void) /***** Show profile and timeline *****/ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) /* Show profile */ - if (Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat)) + if (Prf_ShowUsrProfile (&Gbl.Usrs.Other.UsrDat)) { ProfileShown = true; @@ -276,12 +276,12 @@ void Prf_GetUsrDatAndShowUserProfile (void) /*****************************************************************************/ // Return false on error -bool Prf_ShowUserProfile (struct Usr_Data *UsrDat) +bool Prf_ShowUsrProfile (struct Usr_Data *UsrDat) { static void (*PutLinkToUsrProfile[Usr_NUM_ME_OR_OTHER]) (void) = { - [Usr_ME ] = Prf_PutLinkRequestAnotherUserProfile, // Request another user's profile - [Usr_OTHER] = Prf_PutLinkMyPublicProfile // My public profile + [Usr_ME ] = Prf_PutLinkReqAnotherUsrProfile, // Request another user's profile + [Usr_OTHER] = Prf_PutLinkMyPublicProfile // My public profile }; unsigned NumFollowing; unsigned NumFollowers; @@ -322,14 +322,16 @@ bool Prf_ShowUserProfile (struct Usr_Data *UsrDat) /***** Count following and followers *****/ Fol_GetNumFollow (UsrDat->UsrCod,&NumFollowing,&NumFollowers); - UsrFollowsMe = false; if (NumFollowing) UsrFollowsMe = Fol_DB_CheckUsrIsFollowerOf (UsrDat->UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod); - IFollowUsr = false; + else + UsrFollowsMe = false; if (NumFollowers) IFollowUsr = Fol_DB_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod, UsrDat->UsrCod); + else + IFollowUsr = false; /***** Show following and followers *****/ Fol_ShowFollowingAndFollowers (UsrDat, @@ -350,7 +352,7 @@ void Prf_ChangeBasicProfileVis (void) { /***** Get param with public/private photo *****/ Gbl.Usrs.Me.UsrDat.BaPrfVisibility = Pri_GetParVisibility ("VisBasPrf", - Pri_BASIC_PROFILE_ALLOWED_VIS); + Pri_BASIC_PROFILE_ALLOWED_VIS); /***** Store public/private basic profile visibility in database *****/ Set_DB_UpdateMySettingsAboutBasicProfile (); @@ -363,7 +365,7 @@ void Prf_ChangeExtendedProfileVis (void) { /***** Get param with public/private photo *****/ Gbl.Usrs.Me.UsrDat.ExPrfVisibility = Pri_GetParVisibility ("VisExtPrf", - Pri_EXTENDED_PROFILE_ALLOWED_VIS); + Pri_EXTENDED_PROFILE_ALLOWED_VIS); /***** Store public/private extended profile visibility in database *****/ Set_DB_UpdateMySettingsAboutExtendedProfile (); @@ -1204,7 +1206,7 @@ void Prf_ShowRankingFigure (MYSQL_RES **mysql_res,unsigned NumUsrs) UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]); Usr_GetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /* Get figure (row[1]) */ if (sscanf (row[1],"%ld",&Figure) != 1) @@ -1279,7 +1281,7 @@ void Prf_GetAndShowRankingClicksPerDay (void) UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]); Usr_GetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /* Get average number of clicks per day (row[1]) */ NumClicksPerDay = Str_GetDoubleFromStr (row[1]); diff --git a/swad_profile.h b/swad_profile.h index 37d22643..e06b2573 100644 --- a/swad_profile.h +++ b/swad_profile.h @@ -55,11 +55,11 @@ void Prf_SeeSocialProfiles (void); char *Prf_GetURLPublicProfile (char URL[Cns_MAX_BYTES_WWW + 1], const char *NickWithoutArr); void Prf_PutLinkMyPublicProfile (void); -void Prf_PutLinkRequestAnotherUserProfile (void); +void Prf_PutLinkReqAnotherUsrProfile (void); void Prf_ReqUserProfile (void); void Prf_GetUsrDatAndShowUserProfile (void); -bool Prf_ShowUserProfile (struct Usr_Data *UsrDat); +bool Prf_ShowUsrProfile (struct Usr_Data *UsrDat); void Prf_ChangeBasicProfileVis (void); void Prf_ChangeExtendedProfileVis (void); diff --git a/swad_project.c b/swad_project.c index d64b4adf..56ba3f6d 100644 --- a/swad_project.c +++ b/swad_project.c @@ -2098,7 +2098,7 @@ static void Prj_ShowProjectMembersWithARole (struct Prj_Projects *Projects, /* Get user's data */ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /* Begin row for this user */ HTM_TR_Begin (NULL); @@ -2701,7 +2701,7 @@ static void Prj_ShowTableAllProjectsMembersWithARole (const struct Prj_Project * /* Get user's data */ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /* Write user's name in "Surname1 Surname2, FirstName" format */ HTM_LI_Begin (NULL); @@ -2943,7 +2943,7 @@ static void Prj_AddUsrsToProject (Prj_RoleInProject_t RoleInPrj) /* Get user's data */ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /* Add user to project */ Prj_DB_AddUsrToPrj (Projects.Prj.PrjCod,RoleInPrj,Gbl.Usrs.Other.UsrDat.UsrCod); diff --git a/swad_record.c b/swad_record.c index 3c6ec55c..9497b6aa 100644 --- a/swad_record.c +++ b/swad_record.c @@ -910,7 +910,7 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView) Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get guest's data from database Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) { /* Begin container for this user */ snprintf (RecordSectionId,sizeof (RecordSectionId),"record_%u",NumUsr); @@ -959,7 +959,7 @@ void Rec_GetUsrAndShowRecOneStdCrs (void) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, // Get student's data from database Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) if (Usr_CheckIfICanViewRecordStd (&Gbl.Usrs.Other.UsrDat)) Rec_ShowRecordOneStdCrs (); } @@ -1109,7 +1109,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView, Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get student's data from database Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) if (Enr_CheckIfUsrBelongsToCurrentCrs (&UsrDat)) { /* Check if this user has accepted @@ -1180,7 +1180,7 @@ void Rec_GetUsrAndShowRecOneTchCrs (void) /***** Show the record *****/ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, // Get teacher's data from database Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) if (Usr_CheckIfICanViewRecordTch (&Gbl.Usrs.Other.UsrDat)) Rec_ShowRecordOneTchCrs (); } @@ -1330,7 +1330,7 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView) Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get teacher's data from database Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) if (Enr_CheckIfUsrBelongsToCurrentCrs (&UsrDat)) { /* Check if this user has accepted @@ -1525,7 +1525,7 @@ void Rec_UpdateAndShowOtherCrsRecord (void) Usr_GetParOtherUsrCodEncryptedAndGetListIDs (); Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS); + Usr_GET_ROLE_IN_CRS); /***** Get list of fields of records in current course *****/ Rec_GetListRecordFieldsInCurrentCrs (); @@ -1975,7 +1975,7 @@ void Rec_ShowSharedRecordUnmodifiable (struct Usr_Data *UsrDat) /***** Get password, user type and user's data from database *****/ Usr_GetAllUsrDataFromUsrCod (UsrDat, Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS); + Usr_GET_ROLE_IN_CRS); UsrDat->Accepted = Enr_CheckIfUsrHasAcceptedInCurrentCrs (UsrDat); /***** Show user's record *****/ @@ -2092,193 +2092,189 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView, sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH); Rec_Record.UsrDat = UsrDat; Rec_Record.TypeOfView = TypeOfView; - if (TypeOfView == Rec_SHA_OTHER_NEW_USR_FORM) - Box_BoxTableBegin (StrRecordWidth,NULL, - NULL,NULL, // New user ==> don't put icons - Rec_RecordHelp[TypeOfView],Box_NOT_CLOSABLE,2); - else - Box_BoxTableBegin (StrRecordWidth,NULL, - Rec_PutIconsCommands,NULL, - Rec_RecordHelp[TypeOfView],Box_NOT_CLOSABLE,2); + Box_BoxTableBegin (StrRecordWidth,NULL, + TypeOfView == Rec_SHA_OTHER_NEW_USR_FORM ? NULL : // New user ==> don't put icons + Rec_PutIconsCommands,NULL, + Rec_RecordHelp[TypeOfView],Box_NOT_CLOSABLE,2); - /***** Institution and user's photo *****/ - HTM_TR_Begin (NULL); - Rec_ShowInstitutionInHead (&Ins,PutFormLinks); - Rec_ShowPhoto (UsrDat); - HTM_TR_End (); - - /***** Full name *****/ - HTM_TR_Begin (NULL); - Rec_ShowFullName (UsrDat); - HTM_TR_End (); - - /***** User's nickname *****/ - HTM_TR_Begin (NULL); - Rec_ShowNickname (UsrDat,PutFormLinks); - HTM_TR_End (); - - /***** User's country, web and social networks *****/ - HTM_TR_Begin (NULL); - Rec_ShowCountryInHead (UsrDat,ShowData); - Rec_ShowWebsAndSocialNets (UsrDat,TypeOfView); - HTM_TR_End (); - - if (ShowIDRows || - ShowAddressRows || - ShowTeacherRows) - { + /***** Institution and user's photo *****/ HTM_TR_Begin (NULL); + Rec_ShowInstitutionInHead (&Ins,PutFormLinks); + Rec_ShowPhoto (UsrDat); + HTM_TR_End (); - HTM_TD_Begin ("colspan=\"3\""); + /***** Full name *****/ + HTM_TR_Begin (NULL); + Rec_ShowFullName (UsrDat); + HTM_TR_End (); - /***** Show email and user's IDs *****/ - if (ShowIDRows) - { - HTM_TABLE_BeginWidePadding (2); + /***** User's nickname *****/ + HTM_TR_Begin (NULL); + Rec_ShowNickname (UsrDat,PutFormLinks); + HTM_TR_End (); - /* Show email */ - Rec_ShowEmail (UsrDat); + /***** User's country, web and social networks *****/ + HTM_TR_Begin (NULL); + Rec_ShowCountryInHead (UsrDat,ShowData); + Rec_ShowWebsAndSocialNets (UsrDat,TypeOfView); + HTM_TR_End (); - /* Show user's IDs */ - Rec_ShowUsrIDs (UsrDat,Anchor); + if (ShowIDRows || + ShowAddressRows || + ShowTeacherRows) + { + HTM_TR_Begin (NULL); - HTM_TABLE_End (); - } - - /***** Begin form *****/ - switch (TypeOfView) - { - case Rec_SHA_SIGN_UP_IN_CRS_FORM: - Frm_BeginForm (ActSignUp); - break; - case Rec_SHA_MY_RECORD_FORM: - Frm_BeginForm (ActChgMyData); - break; - case Rec_SHA_OTHER_EXISTING_USR_FORM: - switch (Gbl.Action.Act) - { - case ActReqMdfStd: - NextAction = ActUpdStd; - break; - case ActReqMdfNET: - NextAction = ActUpdNET; - break; - case ActReqMdfTch: - NextAction = ActUpdTch; - break; - default: - NextAction = ActUpdOth; - break; - } - Frm_BeginForm (NextAction); - Usr_PutParUsrCodEncrypted (UsrDat->EnUsrCod); // Existing user - break; - case Rec_SHA_OTHER_NEW_USR_FORM: - switch (Gbl.Action.Act) - { - case ActReqMdfStd: - NextAction = ActCreStd; - break; - case ActReqMdfNET: - NextAction = ActCreNET; - break; - case ActReqMdfTch: - NextAction = ActCreTch; - break; - default: - NextAction = ActCreOth; - break; - } - Frm_BeginForm (NextAction); - ID_PutParOtherUsrIDPlain (); // New user - break; - default: - break; - } - - HTM_TABLE_BeginWidePadding (2); + HTM_TD_Begin ("colspan=\"3\""); + /***** Show email and user's IDs *****/ if (ShowIDRows) { - /***** Role or sex *****/ - Rec_ShowRole (UsrDat,TypeOfView); + HTM_TABLE_BeginWidePadding (2); - /***** Name *****/ - Rec_ShowSurname1 (UsrDat,ICanEdit); - Rec_ShowSurname2 (UsrDat,ICanEdit); - Rec_ShowFirstName (UsrDat,ICanEdit); + /* Show email */ + Rec_ShowEmail (UsrDat); - /***** Country *****/ - if (CountryForm) - Rec_ShowCountry (UsrDat,ICanEdit); + /* Show user's IDs */ + Rec_ShowUsrIDs (UsrDat,Anchor); + + HTM_TABLE_End (); } - /***** Address rows *****/ - if (ShowAddressRows) + /***** Begin form *****/ + switch (TypeOfView) { - /***** Date of birth *****/ - Rec_ShowDateOfBirth (UsrDat,ShowData,ICanEdit); - - /***** Phones *****/ - Rec_ShowPhone (UsrDat,ShowData,ICanEdit,0); - Rec_ShowPhone (UsrDat,ShowData,ICanEdit,1); - - /***** User's comments *****/ - Rec_ShowComments (UsrDat,ShowData,ICanEdit); - } - - /***** Teacher's rows *****/ - if (ShowTeacherRows) - Rec_ShowTeacherRows (UsrDat,&Ins,ShowData); - - HTM_TABLE_End (); - - /***** Button and end form *****/ - switch (TypeOfView) - { - case Rec_SHA_SIGN_UP_IN_CRS_FORM: - Btn_PutConfirmButton (Txt_Sign_up); - Frm_EndForm (); - break; - case Rec_SHA_MY_RECORD_FORM: - Btn_PutConfirmButton (Txt_Save_changes); - Frm_EndForm (); - break; - case Rec_SHA_OTHER_NEW_USR_FORM: - if (Gbl.Crs.Grps.NumGrps) // This course has groups? - Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod); - Btn_PutConfirmButton (Txt_Register); - Frm_EndForm (); - break; - case Rec_SHA_OTHER_EXISTING_USR_FORM: - /***** Show list of groups to register/remove me/user *****/ - if (Gbl.Crs.Grps.NumGrps) // This course has groups? - switch (MeOrOther) + case Rec_SHA_SIGN_UP_IN_CRS_FORM: + Frm_BeginForm (ActSignUp); + break; + case Rec_SHA_MY_RECORD_FORM: + Frm_BeginForm (ActChgMyData); + break; + case Rec_SHA_OTHER_EXISTING_USR_FORM: + switch (Gbl.Action.Act) { - case Usr_ME: - // Don't show groups if I don't belong to course - if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS]) - Grp_ShowLstGrpsToChgMyGrps (); + case ActReqMdfStd: + NextAction = ActUpdStd; + break; + case ActReqMdfNET: + NextAction = ActUpdNET; + break; + case ActReqMdfTch: + NextAction = ActUpdTch; break; - case Usr_OTHER: default: - Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod); + NextAction = ActUpdOth; break; } + Frm_BeginForm (NextAction); + Usr_PutParUsrCodEncrypted (UsrDat->EnUsrCod); // Existing user + break; + case Rec_SHA_OTHER_NEW_USR_FORM: + switch (Gbl.Action.Act) + { + case ActReqMdfStd: + NextAction = ActCreStd; + break; + case ActReqMdfNET: + NextAction = ActCreNET; + break; + case ActReqMdfTch: + NextAction = ActCreTch; + break; + default: + NextAction = ActCreOth; + break; + } + Frm_BeginForm (NextAction); + ID_PutParOtherUsrIDPlain (); // New user + break; + default: + break; + } - /***** Which action, register or removing? *****/ - if (Enr_PutActionsRegRemOneUsr (MeOrOther)) - Btn_PutConfirmButton (Txt_Confirm); + HTM_TABLE_BeginWidePadding (2); - Frm_EndForm (); - break; - default: - break; - } + if (ShowIDRows) + { + /***** Role or sex *****/ + Rec_ShowRole (UsrDat,TypeOfView); - HTM_TD_End (); - HTM_TR_End (); - } + /***** Name *****/ + Rec_ShowSurname1 (UsrDat,ICanEdit); + Rec_ShowSurname2 (UsrDat,ICanEdit); + Rec_ShowFirstName (UsrDat,ICanEdit); + + /***** Country *****/ + if (CountryForm) + Rec_ShowCountry (UsrDat,ICanEdit); + } + + /***** Address rows *****/ + if (ShowAddressRows) + { + /***** Date of birth *****/ + Rec_ShowDateOfBirth (UsrDat,ShowData,ICanEdit); + + /***** Phones *****/ + Rec_ShowPhone (UsrDat,ShowData,ICanEdit,0); + Rec_ShowPhone (UsrDat,ShowData,ICanEdit,1); + + /***** User's comments *****/ + Rec_ShowComments (UsrDat,ShowData,ICanEdit); + } + + /***** Teacher's rows *****/ + if (ShowTeacherRows) + Rec_ShowTeacherRows (UsrDat,&Ins,ShowData); + + HTM_TABLE_End (); + + /***** Button and end form *****/ + switch (TypeOfView) + { + case Rec_SHA_SIGN_UP_IN_CRS_FORM: + Btn_PutConfirmButton (Txt_Sign_up); + Frm_EndForm (); + break; + case Rec_SHA_MY_RECORD_FORM: + Btn_PutConfirmButton (Txt_Save_changes); + Frm_EndForm (); + break; + case Rec_SHA_OTHER_NEW_USR_FORM: + if (Gbl.Crs.Grps.NumGrps) // This course has groups? + Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod); + Btn_PutConfirmButton (Txt_Register); + Frm_EndForm (); + break; + case Rec_SHA_OTHER_EXISTING_USR_FORM: + /***** Show list of groups to register/remove me/user *****/ + if (Gbl.Crs.Grps.NumGrps) // This course has groups? + switch (MeOrOther) + { + case Usr_ME: + // Don't show groups if I don't belong to course + if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS]) + Grp_ShowLstGrpsToChgMyGrps (); + break; + case Usr_OTHER: + default: + Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod); + break; + } + + /***** Which action, register or removing? *****/ + if (Enr_PutActionsRegRemOneUsr (MeOrOther)) + Btn_PutConfirmButton (Txt_Confirm); + + Frm_EndForm (); + break; + default: + break; + } + + HTM_TD_End (); + HTM_TR_End (); + } /***** End table and box *****/ Box_BoxTableEnd (); @@ -2293,7 +2289,7 @@ static void Rec_PutIconsCommands (__attribute__((unused)) void *Args) Usr_MeOrOther_t MeOrOther = Usr_ItsMe (Rec_Record.UsrDat->UsrCod); bool ICanViewUsrProfile; bool RecipientHasBannedMe; - static const Act_Action_t NextAction[Rol_NUM_ROLES] = + static Act_Action_t NextAction[Rol_NUM_ROLES] = { [Rol_UNK ] = ActReqMdfOth, [Rol_GST ] = ActReqMdfOth, diff --git a/swad_statistic.c b/swad_statistic.c index 0b979488..05b5bc65 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -1208,7 +1208,7 @@ static void Sta_ShowDetailedAccessesList (const struct Sta_Stats *Stats, UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[1]); Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /* Get logged role */ if (sscanf (row[2],"%u",&RoleFromLog) != 1) @@ -1345,7 +1345,7 @@ static void Sta_ShowNumHitsPerUsr (Sta_CountType_t CountType, UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]); Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); HTM_TR_Begin (NULL); diff --git a/swad_string.c b/swad_string.c index d7effb53..a8ec646a 100644 --- a/swad_string.c +++ b/swad_string.c @@ -345,7 +345,7 @@ void Str_AnalyzeTxtAndStoreNotifyEventToMentionedUsrs (long PubCod,const char *T /* Get user's data */ Usr_GetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /* Create notification for the mentioned user *****/ CreateNotif = (UsrDat.NtfEvents.CreateNotif & (1 << Ntf_EVENT_TML_MENTION)); diff --git a/swad_test_print.c b/swad_test_print.c index f22bb1b6..d990c159 100644 --- a/swad_test_print.c +++ b/swad_test_print.c @@ -1788,7 +1788,7 @@ static void TstPrn_ShowUsrsPrints (__attribute__((unused)) void *Args) Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Other.UsrDat); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) if (Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) { /***** Show tests *****/ @@ -2245,7 +2245,7 @@ void TstPrn_ShowOnePrint (void) /* Get data of the user who made the test */ if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) Err_WrongUserExit (); if (!Usr_CheckIfICanViewTstExaMchResult (&Gbl.Usrs.Other.UsrDat)) Err_NoPermissionExit (); diff --git a/swad_timeline_comment.c b/swad_timeline_comment.c index 543b1a91..c345a249 100644 --- a/swad_timeline_comment.c +++ b/swad_timeline_comment.c @@ -568,7 +568,7 @@ static void TmlCom_WriteComm (const struct Tml_Timeline *Timeline, UsrDat.UsrCod = Com->UsrCod; Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /***** Left: author's photo *****/ TmlCom_ShowAuthorPhoto (&UsrDat); @@ -730,7 +730,7 @@ void TmlCom_ReceiveCommUsr (void) Usr_GetParOtherUsrCodEncryptedAndGetUsrData (); /***** Show user's profile *****/ - Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); + Prf_ShowUsrProfile (&Gbl.Usrs.Other.UsrDat); /***** Begin section *****/ HTM_SECTION_Begin (Tml_TIMELINE_SECTION_ID); @@ -835,7 +835,7 @@ void TmlCom_ReqRemComUsr (void) Usr_GetParOtherUsrCodEncryptedAndGetUsrData (); /***** Show user's profile *****/ - Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); + Prf_ShowUsrProfile (&Gbl.Usrs.Other.UsrDat); /***** Begin section *****/ HTM_SECTION_Begin (Tml_TIMELINE_SECTION_ID); @@ -944,7 +944,7 @@ void TmlCom_RemoveComUsr (void) Usr_GetParOtherUsrCodEncryptedAndGetUsrData (); /***** Show user's profile *****/ - Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); + Prf_ShowUsrProfile (&Gbl.Usrs.Other.UsrDat); /***** Begin section *****/ HTM_SECTION_Begin (Tml_TIMELINE_SECTION_ID); diff --git a/swad_timeline_note.c b/swad_timeline_note.c index e622e369..0740b533 100644 --- a/swad_timeline_note.c +++ b/swad_timeline_note.c @@ -240,7 +240,7 @@ static void TmlNot_WriteTopMessage (Tml_TopMessage_t TopMessage,long PublisherCo PublisherDat.UsrCod = PublisherCod; if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&PublisherDat, // Really we only need EncryptedUsrCod and FullName Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /***** Begin container *****/ HTM_DIV_Begin ("class=\"Tml_TOP_CONT Tml_TOP_PUBLISHER Tml_WIDTH\""); @@ -273,7 +273,7 @@ static void TmlNot_WriteNote (const struct Tml_Timeline *Timeline, UsrDat.UsrCod = Not->UsrCod; Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /***** Left top: author's photo *****/ TmlNot_ShowAuthorPhoto (&UsrDat); @@ -965,7 +965,7 @@ void TmlNot_ReqRemNoteUsr (void) Usr_GetParOtherUsrCodEncryptedAndGetUsrData (); /***** Show user's profile *****/ - Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); + Prf_ShowUsrProfile (&Gbl.Usrs.Other.UsrDat); /***** Begin section *****/ HTM_SECTION_Begin (Tml_TIMELINE_SECTION_ID); @@ -1059,7 +1059,7 @@ void TmlNot_RemoveNoteUsr (void) Usr_GetParOtherUsrCodEncryptedAndGetUsrData (); /***** Show user's profile *****/ - Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); + Prf_ShowUsrProfile (&Gbl.Usrs.Other.UsrDat); /***** Begin section *****/ HTM_SECTION_Begin (Tml_TIMELINE_SECTION_ID); diff --git a/swad_timeline_notification.c b/swad_timeline_notification.c index 6188bebd..015eb31c 100644 --- a/swad_timeline_notification.c +++ b/swad_timeline_notification.c @@ -60,7 +60,7 @@ void TmlNtf_CreateNotifToAuthor (long AuthorCod,long PubCod, UsrDat.UsrCod = AuthorCod; if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /***** This fav must be notified by email? *****/ CreateNotif = (UsrDat.NtfEvents.CreateNotif & (1 << NotifyEvent)); diff --git a/swad_timeline_post.c b/swad_timeline_post.c index aacb90a5..0ea1972d 100644 --- a/swad_timeline_post.c +++ b/swad_timeline_post.c @@ -272,7 +272,7 @@ void TmlPst_ReceivePostUsr (void) Usr_GetParOtherUsrCodEncryptedAndGetUsrData (); /***** Show user's profile *****/ - Prf_ShowUserProfile (&Gbl.Usrs.Other.UsrDat); + Prf_ShowUsrProfile (&Gbl.Usrs.Other.UsrDat); /***** Begin section *****/ HTM_SECTION_Begin (Tml_TIMELINE_SECTION_ID); diff --git a/swad_timeline_user.c b/swad_timeline_user.c index 6b4e613a..802d509d 100644 --- a/swad_timeline_user.c +++ b/swad_timeline_user.c @@ -219,7 +219,7 @@ static void TmlUsr_ListSharersOrFavers (MYSQL_RES **mysql_res, /***** Get user's data and show user's photo *****/ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { /* Begin container */ HTM_DIV_Begin ("class=\"Tml_SHARER\""); diff --git a/swad_user.c b/swad_user.c index 2a11a04b..610d677d 100644 --- a/swad_user.c +++ b/swad_user.c @@ -474,11 +474,11 @@ void Usr_GetUsrDataFromUsrCod (struct Usr_Data *UsrDat, /* Get roles */ switch (GetRoleInCurrentCrs) { - case Usr_DONT_GET_ROLE_IN_CURRENT_CRS: + case Usr_DONT_GET_ROLE_IN_CRS: UsrDat->Roles.InCurrentCrs = Rol_UNK; UsrDat->Roles.InCrss = -1; // Force roles to be got from database break; - case Usr_GET_ROLE_IN_CURRENT_CRS: + case Usr_GET_ROLE_IN_CRS: UsrDat->Roles.InCurrentCrs = Rol_GetRoleUsrInCrs (UsrDat->UsrCod, Gbl.Hierarchy.Node[Hie_CRS].HieCod); UsrDat->Roles.InCrss = -1; // Force roles to be got from database @@ -1597,7 +1597,7 @@ bool Usr_GetParOtherUsrCodEncryptedAndGetUsrData (void) /***** Check if user exists and get her/his data *****/ if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, Usr_DONT_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) // Existing user return true; @@ -1709,7 +1709,7 @@ void Usr_ChkUsrAndGetUsrData (void) Usr_GetUsrCodFromEncryptedUsrCod (&Gbl.Usrs.Me.UsrDat); if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat, Usr_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) { // User logged in Gbl.Usrs.Me.Logged = true; @@ -1881,7 +1881,7 @@ static bool Usr_ChkUsrAndGetUsrDataFromDirectLogin (void) /***** Get user's data *****/ Usr_GetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat, Usr_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS); + Usr_GET_ROLE_IN_CRS); /***** Check password *****/ /* Check user's password: @@ -1916,7 +1916,7 @@ static bool Usr_ChkUsrAndGetUsrDataFromSession (void) /* Check if user exists in database, and get his/her data */ if (!Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat, Usr_GET_PREFS, - Usr_GET_ROLE_IN_CURRENT_CRS)) + Usr_GET_ROLE_IN_CRS)) { Usr_ShowAlertUsrDoesNotExistsOrWrongPassword (); return false; @@ -3319,7 +3319,7 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs) /* Get user's data */ Usr_GetUsrDataFromUsrCod (&UsrDat, // Really only EncryptedUsrCod is needed Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS); + Usr_DONT_GET_ROLE_IN_CRS); /* Find if encrypted user's code is already in list */ if (!Usr_FindEncryptedUsrCodInListOfSelectedEncryptedUsrCods (UsrDat.EnUsrCod,&Gbl.Usrs.Selected)) // If not in list ==> add it @@ -4300,7 +4300,7 @@ void Usr_ListAllDataGsts (void) UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_GST].Lst[NumUsr].UsrCod; if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { UsrDat.Roles.InCurrentCrs = Rol_GST; // We know the user's role. // It is not necessary to retrieve @@ -4504,7 +4504,7 @@ void Usr_ListAllDataStds (void) UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumUsr].UsrCod; if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { UsrDat.Roles.InCurrentCrs = Rol_STD; // We know the user's role. // It is not necessary to retrieve @@ -4572,7 +4572,7 @@ static void Usr_ListUsrsForSelection (Rol_Role_t Role, UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod; if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { UsrDat.Roles.InCurrentCrs = Role; // We know the user's role. // It is not necessary to retrieve @@ -4711,7 +4711,7 @@ static void Usr_ListRowsAllDataTchs (Rol_Role_t Role, UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Role].Lst[NumUsr].UsrCod; if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { UsrDat.Roles.InCurrentCrs = Role; // We know the user's role. // It is not necessary to retrieve @@ -4959,7 +4959,7 @@ void Usr_ListDataAdms (void) UsrDat.UsrCod = Gbl.Usrs.LstUsrs[Rol_DEG_ADM].Lst[NumUsr].UsrCod; if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) { UsrDat.Accepted = Gbl.Usrs.LstUsrs[Rol_DEG_ADM].Lst[NumUsr].Accepted; Usr_WriteRowAdmData (++NumUsr,&UsrDat); @@ -6379,7 +6379,7 @@ void Usr_WriteAuthor1Line (long UsrCod,HidVis_HiddenOrVisible_t HiddenOrVisible) UsrDat.UsrCod = UsrCod; if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL); /***** Show photo *****/ diff --git a/swad_user.h b/swad_user.h index b299e07d..deef50af 100644 --- a/swad_user.h +++ b/swad_user.h @@ -99,8 +99,8 @@ typedef enum typedef enum { - Usr_DONT_GET_ROLE_IN_CURRENT_CRS = 0, - Usr_GET_ROLE_IN_CURRENT_CRS = 1, + Usr_DONT_GET_ROLE_IN_CRS = 0, + Usr_GET_ROLE_IN_CRS = 1, } Usr_GetRoleInCurrentCrs_t; diff --git a/swad_zip.c b/swad_zip.c index 96653542..0da7549f 100644 --- a/swad_zip.c +++ b/swad_zip.c @@ -151,7 +151,7 @@ void ZIP_CreateZIPAsgWrk (void) if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get user's data from database Usr_DONT_GET_PREFS, - Usr_DONT_GET_ROLE_IN_CURRENT_CRS)) + Usr_DONT_GET_ROLE_IN_CRS)) if (Enr_CheckIfUsrBelongsToCurrentCrs (&UsrDat)) ZIP_CreateDirCompressionUsr (&UsrDat); }