From 3fa0f27557e4eb79af7fce2e40f9ae015e429d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 23 May 2017 18:15:59 +0200 Subject: [PATCH] Version 16.221.1 --- swad_ID.c | 6 +- swad_action.c | 6 +- swad_attendance.c | 38 +++++----- swad_changelog.h | 5 +- swad_file_browser.c | 7 +- swad_global.c | 7 +- swad_global.h | 7 +- swad_message.c | 4 +- swad_notification.c | 25 ++++--- swad_record.c | 16 ++--- swad_social.c | 5 +- swad_statistic.c | 36 +++++----- swad_statistic.h | 26 +++---- swad_survey.c | 8 ++- swad_test.c | 2 +- swad_text.c | 160 ++++++++++++++++++++--------------------- swad_user.c | 168 +++++++++++++++++++++++--------------------- swad_user.h | 3 - swad_zip.c | 4 +- 19 files changed, 272 insertions(+), 261 deletions(-) diff --git a/swad_ID.c b/swad_ID.c index 0e867fd1..0fb1cce7 100644 --- a/swad_ID.c +++ b/swad_ID.c @@ -473,13 +473,13 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID, switch (Gbl.Action.Original) { case ActSeeRecSevGst: - Usr_PutHiddenParUsrCodAll (ActCnfID_Oth,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (ActCnfID_Oth,Gbl.Usrs.Select[Rol_UNK]); break; case ActSeeRecSevStd: - Usr_PutHiddenParUsrCodAll (ActCnfID_Std,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (ActCnfID_Std,Gbl.Usrs.Select[Rol_UNK]); break; case ActSeeRecSevTch: - Usr_PutHiddenParUsrCodAll (ActCnfID_Tch,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (ActCnfID_Tch,Gbl.Usrs.Select[Rol_UNK]); break; } } diff --git a/swad_action.c b/swad_action.c index 83841620..6f405ad2 100644 --- a/swad_action.c +++ b/swad_action.c @@ -1923,9 +1923,9 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActReqSeeMyTstRes */{1083,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,Tst_SetIniEndDates ,Tst_SelDatesToSeeMyTestResults ,NULL}, /* ActSeeMyTstRes */{1084,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Tst_ShowMyTestResults ,NULL}, /* ActSeeOneTstResMe */{1085,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Tst_ShowOneTestResult ,NULL}, - /* ActReqSeeUsrTstRes*/{1080,-1,TabUnk,ActReqTst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,Tst_SetIniEndDates ,Tst_SelUsrsToSeeUsrsTestResults,NULL}, - /* ActSeeUsrTstRes */{1081,-1,TabUnk,ActReqTst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Tst_ShowUsrsTestResults ,NULL}, - /* ActSeeOneTstResOth*/{1082,-1,TabUnk,ActReqTst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Tst_ShowOneTestResult ,NULL}, + /* ActReqSeeUsrTstRes*/{1080,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,Tst_SetIniEndDates ,Tst_SelUsrsToSeeUsrsTestResults,NULL}, + /* ActSeeUsrTstRes */{1081,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Tst_ShowUsrsTestResults ,NULL}, + /* ActSeeOneTstResOth*/{1082,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Tst_ShowOneTestResult ,NULL}, /* ActSeeOneSvy */{ 982,-1,TabUnk,ActSeeAllSvy ,0x3F8,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Svy_SeeOneSurvey ,NULL}, /* ActAnsSvy */{ 983,-1,TabUnk,ActSeeAllSvy ,0x3F8,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_THIS_WINDOW,NULL ,Svy_ReceiveSurveyAnswers ,NULL}, diff --git a/swad_attendance.c b/swad_attendance.c index a676d136..c339ba45 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -371,8 +371,10 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt /***** Write first row of data of this attendance event *****/ /* Forms to remove/edit this attendance event */ fprintf (Gbl.F.Out,"" - "", - Gbl.RowEvenOdd); + ""); switch (Gbl.Usrs.Me.LoggedRole) { case Rol_TCH: @@ -451,8 +453,10 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt /***** Write second row of data of this attendance event *****/ fprintf (Gbl.F.Out,"" - "", - Gbl.RowEvenOdd); + ""); /* Author of the attendance event */ Att_WriteAttEventAuthor (Att); @@ -464,8 +468,10 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to recpectful HTML Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links - fprintf (Gbl.F.Out,"", - Gbl.RowEvenOdd); + fprintf (Gbl.F.Out,""); if (Gbl.CurrentCrs.Grps.NumGrps) Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (Att); @@ -2258,8 +2264,8 @@ void Att_RegisterMeAsStdInAttEvent (void) /* Algorithm: 1. Get list of students in the groups selected: Gbl.Usrs.LstUsrs[Rol_STD] 2. Mark all students in the groups selected setting Remove=true - 3. Get list of students marked as present by me: Gbl.Usrs.Select.Std - 4. Loop over the list Gbl.Usrs.Select.Std, + 3. Get list of students marked as present by me: Gbl.Usrs.Select[Rol_STD] + 4. Loop over the list Gbl.Usrs.Select[Rol_STD], that holds the list of the students marked as present, marking the students in Gbl.Usrs.LstUsrs[Rol_STD].Lst as Remove=false 5. Delete from att_usr all the students marked as Remove=true @@ -2301,16 +2307,16 @@ void Att_RegisterStudentsInAttEvent (void) NumStd++) Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumStd].Remove = true; - /***** 3. Get list of students marked as present by me: Gbl.Usrs.Select.Std *****/ + /***** 3. Get list of students marked as present by me: Gbl.Usrs.Select[Rol_STD] *****/ Usr_GetListsSelectedUsrsCods (); /***** Initialize structure with user's data *****/ Usr_UsrDataConstructor (&UsrData); - /***** 4. Loop over the list Gbl.Usrs.Select.Std, + /***** 4. Loop over the list Gbl.Usrs.Select[Rol_STD], that holds the list of the students marked as present, marking the students in Gbl.Usrs.LstUsrs[Rol_STD].Lst as Remove=false *****/ - Ptr = Gbl.Usrs.Select.Std; + Ptr = Gbl.Usrs.Select[Rol_STD]; while (*Ptr) { Par_GetNextStrUntilSeparParamMult (&Ptr,UsrData.EncryptedUsrCod, @@ -2863,8 +2869,8 @@ static void Att_GetListSelectedUsrCods (unsigned NumStdsInList,long **LstSelecte /***** Initialize structure with user's data *****/ Usr_UsrDataConstructor (&UsrDat); - /***** Loop over the list Gbl.Usrs.Select.All getting users' codes *****/ - for (NumStd = 0, Ptr = Gbl.Usrs.Select.All; + /***** Loop over the list Gbl.Usrs.Select[Rol_UNK] getting users' codes *****/ + for (NumStd = 0, Ptr = Gbl.Usrs.Select[Rol_UNK]; NumStd < NumStdsInList && *Ptr; NumStd++) { @@ -3019,7 +3025,7 @@ static void Att_PutParamsToPrintStdsList (void) if (Gbl.AttEvents.ShowDetails) Par_PutHiddenParamChar ("ShowDetails",'Y'); Grp_PutParamsCodGrps (); - Usr_PutHiddenParUsrCodAll (ActPrnLstStdAtt,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (ActPrnLstStdAtt,Gbl.Usrs.Select[Rol_UNK]); if (Gbl.AttEvents.StrAttCodsSelected[0]) Par_PutHiddenParamString ("AttCods",Gbl.AttEvents.StrAttCodsSelected); } @@ -3036,7 +3042,7 @@ static void Att_PutButtonToShowDetails (void) Act_FormStart (Gbl.Action.Act); Par_PutHiddenParamChar ("ShowDetails",'Y'); Grp_PutParamsCodGrps (); - Usr_PutHiddenParUsrCodAll (Gbl.Action.Act,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (Gbl.Action.Act,Gbl.Usrs.Select[Rol_UNK]); if (Gbl.AttEvents.StrAttCodsSelected[0]) Par_PutHiddenParamString ("AttCods",Gbl.AttEvents.StrAttCodsSelected); Lay_PutConfirmButton (Txt_Show_more_details); @@ -3067,7 +3073,7 @@ static void Att_ListEventsToSelect (Att_TypeOfView_t TypeOfView) { Act_FormStart (Gbl.Action.Act); Grp_PutParamsCodGrps (); - Usr_PutHiddenParUsrCodAll (Gbl.Action.Act,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (Gbl.Action.Act,Gbl.Usrs.Select[Rol_UNK]); } /***** Start frame *****/ diff --git a/swad_changelog.h b/swad_changelog.h index e6de0c53..ebe0a3f4 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -233,13 +233,16 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.221 (2017-05-23)" +#define Log_PLATFORM_VERSION "SWAD 16.221.1 (2017-05-23)" #define CSS_FILE "swad16.209.3.css" #define JS_FILE "swad16.206.3.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 /* + Version 16.221.1: May 23, 2017 Fixed bugs related with new role. + Fixed bug in surveys. + Fixed bug in attendance events. (220260 lines) Version 16.221: May 23, 2017 Changes in database related with new role. Not finished. (220253 lines) 8 changes necessary in database: UPDATE announcements SET Roles = (((Roles & 0xFF0) << 1) | (Roles & 0x00F)); diff --git a/swad_file_browser.c b/swad_file_browser.c index 2dd27d9e..735a117a 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -2444,7 +2444,7 @@ void Brw_PutParamsFileBrowser (Act_Action_t NextAction, if (Brw_GetIfCrsAssigWorksFileBrowser ()) { /***** Users selected *****/ - Usr_PutHiddenParUsrCodAll (NextAction,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (NextAction,Gbl.Usrs.Select[Rol_UNK]); Usr_PutParamOtherUsrCodEncrypted (); } } @@ -3206,7 +3206,7 @@ static void Brw_ShowFileBrowsersAsgWrkCrs (void) Brw_PutIconShowFigure,Hlp_FILES_Homework_for_teachers,0); /***** List the assignments and works of the selected users *****/ - Ptr = Gbl.Usrs.Select.All; + Ptr = Gbl.Usrs.Select[Rol_UNK]; while (*Ptr) { Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EncryptedUsrCod, @@ -4719,7 +4719,8 @@ static void Brw_PutParamsFullTree (void) if (Brw_GetIfGroupFileBrowser ()) Grp_PutParamGrpCod (Gbl.CurrentCrs.Grps.GrpCod); else if (Brw_GetIfCrsAssigWorksFileBrowser ()) - Usr_PutHiddenParUsrCodAll (Brw_ActSeeAdm[Gbl.FileBrowser.Type],Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (Brw_ActSeeAdm[Gbl.FileBrowser.Type], + Gbl.Usrs.Select[Rol_UNK]); } /*****************************************************************************/ diff --git a/swad_global.c b/swad_global.c index 3ec4ab76..092abe77 100644 --- a/swad_global.c +++ b/swad_global.c @@ -191,18 +191,15 @@ void Gbl_InitializeGlobals (void) { Gbl.Usrs.LstUsrs[Role].Lst = NULL; Gbl.Usrs.LstUsrs[Role].NumUsrs = 0; + Gbl.Usrs.Select[Role] = NULL; } + Gbl.Usrs.ListOtherRecipients = NULL; Gbl.ExamAnns.NumExaAnns = 0; Gbl.ExamAnns.Lst = NULL; Gbl.ExamAnns.HighlightExaCod = -1L; Gbl.ExamAnns.HighlightDate[0] = '\0'; // No exam announcements highlighted - Gbl.Usrs.Select.All = - Gbl.Usrs.Select.Std = - Gbl.Usrs.Select.Tch = - Gbl.Usrs.ListOtherRecipients = NULL; - Gbl.Msg.Subject[0] = '\0'; Gbl.Msg.ShowOnlyUnreadMsgs = false; Gbl.Msg.ExpandedMsgCod = -1L; diff --git a/swad_global.h b/swad_global.h index e16bd1eb..fcad60ee 100644 --- a/swad_global.h +++ b/swad_global.h @@ -374,12 +374,7 @@ struct Globals unsigned NumIDToConfirm; // Used as hidden parameter to confirm a user's ID } Other; // Another user, used for example to register in / remove from a course struct ListUsrs LstUsrs[Rol_NUM_ROLES]; - struct - { - char *All; - char *Std; - char *Tch; - } Select; // Lists of ID of users from a form + char *Select[Rol_NUM_ROLES]; // Lists of ID of users from a form char *ListOtherRecipients; // List of ID or nicks of users written explicitely on a form struct { diff --git a/swad_message.c b/swad_message.c index 7bbe0a16..50f859dd 100644 --- a/swad_message.c +++ b/swad_message.c @@ -720,11 +720,11 @@ void Msg_RecMsgFromUsr (void) Image.Quality = Msg_IMAGE_SAVED_QUALITY; Img_GetImageFromForm (-1,&Image,NULL); - /***** Loop over the list Gbl.Usrs.Select.All, that holds the list of the + /***** Loop over the list Gbl.Usrs.Select[Rol_UNK], that holds the list of the recipients, creating a received message for each recipient *****/ Str_ChangeFormat (Str_FROM_FORM,Str_TO_RIGOROUS_HTML, Content,Cns_MAX_BYTES_LONG_TEXT,false); - Ptr = Gbl.Usrs.Select.All; + Ptr = Gbl.Usrs.Select[Rol_UNK]; NumRecipients = 0; while (*Ptr) { diff --git a/swad_notification.c b/swad_notification.c index 33c9eac3..79d674f8 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -73,7 +73,6 @@ const char *Ntf_WSNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] = /* Users tab */ "enrollmentStudent", // Ntf_EVENT_ENROLMENT_STD // TODO: Change to "enrolmentStudent" carefully in future versions - "enrollmentNonEditingTeacher", // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Change to "enrolmentTeacher" carefully in future versions "enrollmentTeacher", // Ntf_EVENT_ENROLMENT_TCH // TODO: Change to "enrolmentTeacher" carefully in future versions "enrollmentRequest", // Ntf_EVENT_ENROLMENT_REQUEST // TODO: Change to "enrolmentRequest" carefully in future versions @@ -91,9 +90,11 @@ const char *Ntf_WSNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] = "message", // Ntf_EVENT_MESSAGE /* Statistics tab */ - "survey", // Ntf_EVENT_SURVEY /* Profile tab */ + + "survey", // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! + "enrolmentNonEditingTeacher", // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! }; static const Act_Action_t Ntf_DefaultActions[Ntf_NUM_NOTIFY_EVENTS] = @@ -112,7 +113,6 @@ static const Act_Action_t Ntf_DefaultActions[Ntf_NUM_NOTIFY_EVENTS] = /* Users tab */ ActReqAccEnrStd, // Ntf_EVENT_ENROLMENT_STD - ActReqAccEnrNET, // Ntf_EVENT_ENROLMENT_NED_TCH ActReqAccEnrTch, // Ntf_EVENT_ENROLMENT_TCH ActSeeSignUpReq, // Ntf_EVENT_ENROLMENT_REQUEST @@ -130,9 +130,11 @@ static const Act_Action_t Ntf_DefaultActions[Ntf_NUM_NOTIFY_EVENTS] = ActExpRcvMsg, // Ntf_EVENT_MESSAGE /* Statistics tab */ - ActSeeAllSvy, // Ntf_EVENT_SURVEY TODO: Move to assessment tab (also necessary in database) !!!!!!!!! /* Profile tab */ + + ActSeeAllSvy, // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! + ActReqAccEnrNET, // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! }; /*****************************************************************************/ @@ -156,7 +158,6 @@ static const char *Ntf_ParamNotifMeAboutNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] = /* Users tab */ "NotifyNtfEventEnrolmentStudent", // Ntf_EVENT_ENROLMENT_STD - "NotifyNtfEventEnrolmentNonEditingTeacher", // Ntf_EVENT_ENROLMENT_NED_TCH "NotifyNtfEventEnrolmentTeacher", // Ntf_EVENT_ENROLMENT_TCH "NotifyNtfEventEnrolmentRequest", // Ntf_EVENT_ENROLMENT_REQUEST @@ -174,9 +175,11 @@ static const char *Ntf_ParamNotifMeAboutNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] = "NotifyNtfEventMessage", // Ntf_EVENT_MESSAGE /* Statistics tab */ - "NotifyNtfEventSurvey", // Ntf_EVENT_SURVEY /* Profile tab */ + + "NotifyNtfEventSurvey", // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! + "NotifyNtfEventEnrolmentNonEditingTeacher", // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! }; // Email me about notification events @@ -196,7 +199,6 @@ static const char *Ntf_ParamEmailMeAboutNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] = /* Users tab */ "EmailNtfEventEnrolmentStudent", // Ntf_EVENT_ENROLMENT_STD - "EmailNtfEventEnrolmentNonEditingTeacher", // Ntf_EVENT_ENROLMENT_NED_TCH "EmailNtfEventEnrolmentTeacher", // Ntf_EVENT_ENROLMENT_TCH "EmailNtfEventEnrolmentRequest", // Ntf_EVENT_ENROLMENT_REQUEST @@ -214,9 +216,11 @@ static const char *Ntf_ParamEmailMeAboutNotifyEvents[Ntf_NUM_NOTIFY_EVENTS] = "EmailNtfEventMessage", // Ntf_EVENT_MESSAGE /* Statistics tab */ - "EmailNtfEventSurvey", // Ntf_EVENT_SURVEY /* Profile tab */ + + "EmailNtfEventSurvey", // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! + "EmailNtfEventEnrolmentNonEditingTeacher", // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! }; // Icons for notification events @@ -236,7 +240,6 @@ static const char *Ntf_Icons[Ntf_NUM_NOTIFY_EVENTS] = /* Users tab */ "adduser16x16.gif", // Ntf_EVENT_ENROLMENT_STD - "adduser16x16.gif", // Ntf_EVENT_ENROLMENT_NED_TCH "adduser16x16.gif", // Ntf_EVENT_ENROLMENT_TCH "enrollmentrequest16x16.gif", // Ntf_EVENT_ENROLMENT_REQUEST @@ -254,9 +257,11 @@ static const char *Ntf_Icons[Ntf_NUM_NOTIFY_EVENTS] = "msg64x64.gif", // Ntf_EVENT_MESSAGE /* Statistics tab */ - "survey16x16.gif", // Ntf_EVENT_SURVEY /* Profile tab */ + + "survey16x16.gif", // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! + "adduser16x16.gif", // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! }; /*****************************************************************************/ diff --git a/swad_record.c b/swad_record.c index 1501b5b4..66f38c30 100644 --- a/swad_record.c +++ b/swad_record.c @@ -1023,7 +1023,7 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView) /* Link to print view */ Act_FormStart (ActPrnRecSevGst); - Usr_PutHiddenParUsrCodAll (ActPrnRecSevGst,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (ActPrnRecSevGst,Gbl.Usrs.Select[Rol_UNK]); Rec_ShowLinkToPrintPreviewOfRecords (); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -1036,7 +1036,7 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView) // ...inscription in any course /***** List the records *****/ - Ptr = Gbl.Usrs.Select.All; + Ptr = Gbl.Usrs.Select[Rol_UNK]; while (*Ptr) { Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod, @@ -1218,7 +1218,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView, /* Link to print view */ Act_FormStart (ActPrnRecSevStd); - Usr_PutHiddenParUsrCodAll (ActPrnRecSevStd,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (ActPrnRecSevStd,Gbl.Usrs.Select[Rol_UNK]); Rec_ShowLinkToPrintPreviewOfRecords (); Act_FormEnd (); fprintf (Gbl.F.Out,""); @@ -1228,7 +1228,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView, Usr_UsrDataConstructor (&UsrDat); /***** List the records *****/ - Ptr = Gbl.Usrs.Select.All; + Ptr = Gbl.Usrs.Select[Rol_UNK]; while (*Ptr) { Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod, @@ -1435,7 +1435,7 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView) /* Link to print view */ Act_FormStart (ActPrnRecSevTch); - Usr_PutHiddenParUsrCodAll (ActPrnRecSevTch,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (ActPrnRecSevTch,Gbl.Usrs.Select[Rol_UNK]); Par_PutHiddenParamChar ("ParamOfficeHours",'Y'); Par_PutHiddenParamChar ("ShowOfficeHours", ShowOfficeHours ? 'Y' : @@ -1450,7 +1450,7 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView) Usr_UsrDataConstructor (&UsrDat); /***** List the records *****/ - Ptr = Gbl.Usrs.Select.All; + Ptr = Gbl.Usrs.Select[Rol_UNK]; while (*Ptr) { Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod, @@ -1590,7 +1590,7 @@ static void Rec_PutParamsShowOfficeHoursOneTch (void) static void Rec_PutParamsShowOfficeHoursSeveralTchs (void) { - Usr_PutHiddenParUsrCodAll (ActSeeRecSevTch,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (ActSeeRecSevTch,Gbl.Usrs.Select[Rol_UNK]); Par_PutHiddenParamChar ("ParamOfficeHours",'Y'); } @@ -1770,7 +1770,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView, Act_FormStartAnchor (ActRcvRecOthUsr,Anchor); Par_PutHiddenParamLong ("OriginalActCod", Act_Actions[ActSeeRecSevStd].ActCod); // Original action, used to know where we came from - Usr_PutHiddenParUsrCodAll (ActRcvRecOthUsr,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (ActRcvRecOthUsr,Gbl.Usrs.Select[Rol_UNK]); Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); break; case Rec_CRS_PRINT_ONE_RECORD: diff --git a/swad_social.c b/swad_social.c index c6908528..cefc8c6f 100644 --- a/swad_social.c +++ b/swad_social.c @@ -304,7 +304,6 @@ void Soc_ShowTimelineGbl2 (void) /* Users tab */ Soc_TOP_MESSAGE_NONE, // Ntf_EVENT_ENROLMENT_STD - Soc_TOP_MESSAGE_NONE, // Ntf_EVENT_ENROLMENT_NED_TCH Soc_TOP_MESSAGE_NONE, // Ntf_EVENT_ENROLMENT_TCH Soc_TOP_MESSAGE_NONE, // Ntf_EVENT_ENROLMENT_REQUEST @@ -322,9 +321,11 @@ void Soc_ShowTimelineGbl2 (void) Soc_TOP_MESSAGE_NONE, // Ntf_EVENT_MESSAGE /* Statistics tab */ - Soc_TOP_MESSAGE_NONE, // Ntf_EVENT_SURVEY /* Profile tab */ + + Soc_TOP_MESSAGE_NONE, // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! + Soc_TOP_MESSAGE_NONE, // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! }; /***** Initialize social note code to -1 ==> no highlighted note *****/ diff --git a/swad_statistic.c b/swad_statistic.c index a52f0663..ad028927 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -951,8 +951,8 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse) Sta_AskShowGblHits (); /***** The following types of query will never give a valid result *****/ - if ((Gbl.Stat.Role == Sta_ALL_USRS || - Gbl.Stat.Role == Sta_UNKNOWN_USRS) && + if ((Gbl.Stat.Role == Sta_ROLE_ALL_USRS || + Gbl.Stat.Role == Sta_ROLE_UNKNOWN_USRS) && (Gbl.Stat.CountType == Sta_DISTINCT_USRS || Gbl.Stat.CountType == Sta_CLICKS_PER_USR)) { @@ -1215,11 +1215,11 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse) /* Type of users */ switch (Gbl.Stat.Role) { - case Sta_IDENTIFIED_USRS: + case Sta_ROLE_IDENTIFIED_USRS: sprintf (StrRole," AND %s.Role<>%u", LogTable,(unsigned) Rol_UNK); break; - case Sta_ALL_USRS: + case Sta_ROLE_ALL_USRS: switch (Gbl.Stat.CountType) { case Sta_TOTAL_CLICKS: @@ -1234,43 +1234,43 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse) break; } break; - case Sta_INS_ADMINS: + case Sta_ROLE_INS_ADMINS: sprintf (StrRole," AND %s.Role=%u", LogTable,(unsigned) Rol_INS_ADM); break; - case Sta_CTR_ADMINS: + case Sta_ROLE_CTR_ADMINS: sprintf (StrRole," AND %s.Role=%u", LogTable,(unsigned) Rol_CTR_ADM); break; - case Sta_DEG_ADMINS: + case Sta_ROLE_DEG_ADMINS: sprintf (StrRole," AND %s.Role=%u", LogTable,(unsigned) Rol_DEG_ADM); break; - case Sta_TEACHERS: + case Sta_ROLE_TEACHERS: sprintf (StrRole," AND %s.Role=%u", LogTable,(unsigned) Rol_TCH); break; - case Sta_NON_EDITING_TEACHERS: + case Sta_ROLE_NON_EDITING_TEACHERS: sprintf (StrRole," AND %s.Role=%u", LogTable,(unsigned) Rol_NET); break; - case Sta_STUDENTS: + case Sta_ROLE_STUDENTS: sprintf (StrRole," AND %s.Role=%u", LogTable,(unsigned) Rol_STD); break; - case Sta_VISITORS: + case Sta_ROLE_USERS: sprintf (StrRole," AND %s.Role=%u", LogTable,(unsigned) Rol_USR); break; - case Sta_GUESTS: + case Sta_ROLE_GUESTS: sprintf (StrRole," AND %s.Role=%u", LogTable,(unsigned) Rol_GST); break; - case Sta_UNKNOWN_USRS: + case Sta_ROLE_UNKNOWN_USRS: sprintf (StrRole," AND %s.Role=%u", LogTable,(unsigned) Rol_UNK); break; - case Sta_ME: + case Sta_ROLE_ME: sprintf (StrRole," AND %s.UsrCod=%ld", LogTable,Gbl.Usrs.Me.UsrDat.UsrCod); break; @@ -1304,7 +1304,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse) Sta_MAX_BYTES_QUERY_ACCESS); LengthQuery = strlen (Query); NumUsr = 0; - Ptr = Gbl.Usrs.Select.All; + Ptr = Gbl.Usrs.Select[Rol_UNK]; while (*Ptr) { Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod, @@ -1640,7 +1640,7 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql Par_PutHiddenParamLong ("FirstRow",FirstRow - Gbl.Stat.RowsPerPage); Par_PutHiddenParamLong ("LastRow" ,FirstRow - 1); Par_PutHiddenParamLong ("RowsPage",Gbl.Stat.RowsPerPage); - Usr_PutHiddenParUsrCodAll (ActSeeAccCrs,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (ActSeeAccCrs,Gbl.Usrs.Select[Rol_UNK]); } fprintf (Gbl.F.Out,""); if (FirstRow > 1) @@ -1675,7 +1675,7 @@ static void Sta_ShowDetailedAccessesList (unsigned long NumRows,MYSQL_RES *mysql Par_PutHiddenParamUnsigned ("FirstRow" ,(unsigned) (LastRow + 1)); Par_PutHiddenParamUnsigned ("LastRow" ,(unsigned) (LastRow + Gbl.Stat.RowsPerPage)); Par_PutHiddenParamUnsigned ("RowsPage" ,(unsigned) Gbl.Stat.RowsPerPage); - Usr_PutHiddenParUsrCodAll (ActSeeAccCrs,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (ActSeeAccCrs,Gbl.Usrs.Select[Rol_UNK]); } fprintf (Gbl.F.Out,""); if (LastRow < NumRows) @@ -2149,7 +2149,7 @@ static void Sta_ShowDistrAccessesPerDaysAndHour (unsigned long NumRows,MYSQL_RES Par_PutHiddenParamUnsigned ("CountType",(unsigned) Gbl.Stat.CountType); Par_PutHiddenParamUnsigned ("StatAct" ,(unsigned) Gbl.Stat.NumAction); if (Gbl.Action.Act == ActSeeAccCrs) - Usr_PutHiddenParUsrCodAll (ActSeeAccCrs,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (ActSeeAccCrs,Gbl.Usrs.Select[Rol_UNK]); else // Gbl.Action.Act == ActSeeAccGbl { Par_PutHiddenParamUnsigned ("Role",(unsigned) Gbl.Stat.Role); diff --git a/swad_statistic.h b/swad_statistic.h index 41b947a9..4b9841ac 100644 --- a/swad_statistic.h +++ b/swad_statistic.h @@ -36,20 +36,20 @@ #define Sta_NUM_ROLES_STAT 12 typedef enum { - Sta_IDENTIFIED_USRS = 0, - Sta_ALL_USRS = 1, - Sta_INS_ADMINS = 2, - Sta_CTR_ADMINS = 3, - Sta_DEG_ADMINS = 4, - Sta_TEACHERS = 5, - Sta_NON_EDITING_TEACHERS = 6, - Sta_STUDENTS = 7, - Sta_VISITORS = 8, - Sta_GUESTS = 9, - Sta_UNKNOWN_USRS = 10, - Sta_ME = 11, + Sta_ROLE_IDENTIFIED_USRS = 0, + Sta_ROLE_ALL_USRS = 1, + Sta_ROLE_INS_ADMINS = 2, + Sta_ROLE_CTR_ADMINS = 3, + Sta_ROLE_DEG_ADMINS = 4, + Sta_ROLE_TEACHERS = 5, + Sta_ROLE_NON_EDITING_TEACHERS = 6, + Sta_ROLE_STUDENTS = 7, + Sta_ROLE_USERS = 8, + Sta_ROLE_GUESTS = 9, + Sta_ROLE_UNKNOWN_USRS = 10, + Sta_ROLE_ME = 11, } Sta_Role_t; -#define Sta_ROLE_DEFAULT Sta_IDENTIFIED_USRS +#define Sta_ROLE_DEFAULT Sta_ROLE_IDENTIFIED_USRS #define Sta_NUM_ACTION_DEFAULT ActAll diff --git a/swad_survey.c b/swad_survey.c index 0e59ffa8..f3781078 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -444,8 +444,10 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst, /***** Write first row of data of this assignment *****/ /* Forms to remove/edit this assignment */ fprintf (Gbl.F.Out,"" - "", - Gbl.RowEvenOdd); + ""); if (Svy.Status.ICanEdit) Svy_PutFormsToRemEditOneSvy (Svy.SvyCod,Svy.Status.Visible); fprintf (Gbl.F.Out,""); @@ -648,7 +650,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst, if (ShowOnlyThisSvyComplete) { fprintf (Gbl.F.Out,"" - ""); + ""); Svy_ListSvyQuestions (&Svy,SvyQst); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_test.c b/swad_test.c index 77d48cad..cae19d4d 100644 --- a/swad_test.c +++ b/swad_test.c @@ -7132,7 +7132,7 @@ void Tst_ShowUsrsTestResults (void) Tst_ShowHeaderTestResults (); /***** List the assignments and works of the selected users *****/ - Ptr = Gbl.Usrs.Select.All; + Ptr = Gbl.Usrs.Select[Rol_UNK]; while (*Ptr) { Par_GetNextStrUntilSeparParamMult (&Ptr,Gbl.Usrs.Other.UsrDat.EncryptedUsrCod, diff --git a/swad_text.c b/swad_text.c index 6778cf63..a8167d8a 100644 --- a/swad_text.c +++ b/swad_text.c @@ -658,19 +658,6 @@ const char *Txt_NOTIFY_EVENTS_SINGULAR_NO_HTML[Ntf_NUM_NOTIFY_EVENTS][1 + Txt_NU "Nova inscrição como estudante", }, { - // Ntf_EVENT_ENROLMENT_NED_TCH - "", - "Nova inscripció com a professor/a no editor/a", - "New Einschreibung als nicht bearbeiteter Lehrkraft", - "New enrolment as a non-editing teacher", - "Nueva inscripción como profesor/a no editor/a", - "Nouvelle inscription en tant qu'enseignant/e non-éditeur/trice", - "Nueva inscripción como profesor/a no editor/a", // Okoteve traducción - "Nuova iscrizione come professore/ssa non-editing", - "Nowe zapisy jako nauczyciel nie edytujacy", - "Nova inscrição como professor/a não editor/a", - }, - { // Ntf_EVENT_ENROLMENT_TCH "", "Nova inscripció com a professor/a", @@ -814,7 +801,7 @@ const char *Txt_NOTIFY_EVENTS_SINGULAR_NO_HTML[Ntf_NUM_NOTIFY_EVENTS][1 + Txt_NU "Nova mensagem", }, { - // Ntf_EVENT_SURVEY + // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! "", "Nova enquesta", "Neuer Umfrage", @@ -826,6 +813,19 @@ const char *Txt_NOTIFY_EVENTS_SINGULAR_NO_HTML[Ntf_NUM_NOTIFY_EVENTS][1 + Txt_NU "Nowe badania", "Novo inquérito", }, + { + // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! + "", + "Nova inscripció com a professor/a no editor/a", + "New Einschreibung als nicht bearbeiteter Lehrkraft", + "New enrolment as a non-editing teacher", + "Nueva inscripción como profesor/a no editor/a", + "Nouvelle inscription en tant qu'enseignant/e non-éditeur/trice", + "Nueva inscripción como profesor/a no editor/a", // Okoteve traducción + "Nuova iscrizione come professore/ssa non-editing", + "Nowe zapisy jako nauczyciel nie edytujacy", + "Nova inscrição como professor/a não editor/a", + }, }; const char *Txt_NOTIFY_EVENTS_There_is_a_new_event_NO_HTML[1 + Txt_NUM_LANGUAGES] = // Warning: it is very important to include %s in the following sentences @@ -26465,26 +26465,6 @@ const char *Txt_NOTIFY_EVENTS_PLURAL[Ntf_NUM_NOTIFY_EVENTS] = "Novas inscrições como estudante" #endif , -#if L==1 // Ntf_EVENT_ENROLMENT_NED_TCH - "Novas inscripciós com a professor/a no editor/a" -#elif L==2 - "New Einschreibungen als nicht bearbeiteter Lehrkraft" -#elif L==3 - "New enrolments as a non-editing teacher" -#elif L==4 - "Nuevas inscripciones como profesor/a/a no editor/a" -#elif L==5 - "Nouvelles inscriptions en tant qu'enseignant/e non-éditeur/trice" -#elif L==6 - "Nuevas inscripciones como profesor/a no editor/a" // Okoteve traducción -#elif L==7 - "Nuova iscrizione come professore/ssa non-editing" -#elif L==8 - "Nowe zapisy jako nauczyciel nie edytujący" -#elif L==9 - "Novas inscrições como professor/a não editor/a" -#endif - , #if L==1 // Ntf_EVENT_ENROLMENT_TCH "Novas inscripciós com a professor" #elif L==2 @@ -26705,7 +26685,7 @@ const char *Txt_NOTIFY_EVENTS_PLURAL[Ntf_NUM_NOTIFY_EVENTS] = "Novas mensagens" #endif , -#if L==1 // Ntf_EVENT_SURVEY +#if L==1 // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! "Noves enquestes" #elif L==2 "Neue Umfragen" @@ -26723,6 +26703,26 @@ const char *Txt_NOTIFY_EVENTS_PLURAL[Ntf_NUM_NOTIFY_EVENTS] = "Nowe badania" #elif L==9 "Novos inquéritos" +#endif + , +#if L==1 // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! + "Novas inscripciós com a professor/a no editor/a" +#elif L==2 + "New Einschreibungen als nicht bearbeiteter Lehrkraft" +#elif L==3 + "New enrolments as a non-editing teacher" +#elif L==4 + "Nuevas inscripciones como profesor/a/a no editor/a" +#elif L==5 + "Nouvelles inscriptions en tant qu'enseignant/e non-éditeur/trice" +#elif L==6 + "Nuevas inscripciones como profesor/a no editor/a" // Okoteve traducción +#elif L==7 + "Nuova iscrizione come professore/ssa non-editing" +#elif L==8 + "Nowe zapisy jako nauczyciel nie edytujący" +#elif L==9 + "Novas inscrições como professor/a não editor/a" #endif }; @@ -26888,28 +26888,8 @@ const char *Txt_NOTIFY_EVENTS_SINGULAR[Ntf_NUM_NOTIFY_EVENTS] = "Inscrição como estudante" #endif , -#if L==1 // Ntf_EVENT_ENROLMENT_NED_TCH - "Novas inscripciós com a professor/a no editor/a" -#elif L==2 - "New Einschreibungen als nicht bearbeiteter Lehrkraft" -#elif L==3 - "New enrolments as a non-editing teacher" -#elif L==4 - "Nuevas inscripciones como profesor/a/a no editor/a" -#elif L==5 - "Nouvelles inscriptions en tant qu'enseignant/e non-éditeur/trice" -#elif L==6 - "Nuevas inscripciones como profesor/a no editor/a" // Okoteve traducción -#elif L==7 - "Nuova iscrizione come professore/ssa non-editing" -#elif L==8 - "Nowe zapisy jako nauczyciel nie edytujący" -#elif L==9 - "Novas inscrições como professor/a não editor/a" -#endif - , #if L==1 // Ntf_EVENT_ENROLMENT_TCH - "Inscripció com a professor" + "Inscripció com a professor/a" #elif L==2 "Einschreibung als Lehrkraft" #elif L==3 @@ -26921,11 +26901,11 @@ const char *Txt_NOTIFY_EVENTS_SINGULAR[Ntf_NUM_NOTIFY_EVENTS] = #elif L==6 "Inscripción como profesor/a" // Okoteve traducción #elif L==7 - "Iscrizione come professore" + "Iscrizione come professore/ssa" #elif L==8 "Zapisy jako nauczyciel" #elif L==9 - "Inscrição como professor" + "Inscrição como professor/a" #endif , #if L==1 // Ntf_EVENT_ENROLMENT_REQUEST @@ -27128,7 +27108,7 @@ const char *Txt_NOTIFY_EVENTS_SINGULAR[Ntf_NUM_NOTIFY_EVENTS] = "Mensagem" #endif , -#if L==1 // Ntf_EVENT_SURVEY +#if L==1 // Ntf_EVENT_SURVEY // TODO: Move to assessment tab (also necessary in database) !!!!!!!!! "Enquesta" #elif L==2 "Umfrage" @@ -27146,6 +27126,26 @@ const char *Txt_NOTIFY_EVENTS_SINGULAR[Ntf_NUM_NOTIFY_EVENTS] = "Badania" #elif L==9 "Inquérito" +#endif + , +#if L==1 // Ntf_EVENT_ENROLMENT_NED_TCH // TODO: Move to users tab (also necessary in database) !!!!!!!!! + "Inscripció com a professor/a no editor/a" +#elif L==2 + "Einschreibung als nicht bearbeiteter Lehrkraft" +#elif L==3 + "Enrolment as a non-editing teacher" +#elif L==4 + "Inscripción como profesor/a no editor/a" +#elif L==5 + "Inscription en tant qu'enseignant non-éditeur/trice" +#elif L==6 + "Inscripción como profesor/a no editor/a" // Okoteve traducción +#elif L==7 + "Iscrizione come professore/ssa non-editing" +#elif L==8 + "Zapisy jako nauczyciel nie edytujący" +#elif L==9 + "Inscrição como professor/a não editor/a" #endif }; @@ -31888,7 +31888,7 @@ const char *Txt_Role = #endif const char *Txt_ROLE_STATS[Sta_NUM_ROLES_STAT] = - { // Sta_IDENTIFIED_USRS + { // Sta_ROLE_IDENTIFIED_USRS #if L==1 "identificats" #elif L==2 @@ -31908,7 +31908,7 @@ const char *Txt_ROLE_STATS[Sta_NUM_ROLES_STAT] = #elif L==9 "identificados" #endif - , // Sta_ALL_USRS + , // Sta_ROLE_ALL_USRS #if L==1 "identificats o desconeguts" #elif L==2 @@ -31928,7 +31928,7 @@ const char *Txt_ROLE_STATS[Sta_NUM_ROLES_STAT] = #elif L==9 "identificados ou desconhecidos" #endif - , // Sta_INS_ADMINS + , // Sta_ROLE_INS_ADMINS #if L==1 "administradors d'institucions" #elif L==2 @@ -31948,7 +31948,7 @@ const char *Txt_ROLE_STATS[Sta_NUM_ROLES_STAT] = #elif L==9 "administradores de instituções" #endif - , // Sta_CTR_ADMINS + , // Sta_ROLE_CTR_ADMINS #if L==1 "administradors de centres" #elif L==2 @@ -31968,7 +31968,7 @@ const char *Txt_ROLE_STATS[Sta_NUM_ROLES_STAT] = #elif L==9 "administradores de centros" #endif - , // Sta_DEG_ADMINS + , // Sta_ROLE_DEG_ADMINS #if L==1 "administradors de titulacions" #elif L==2 @@ -31988,7 +31988,7 @@ const char *Txt_ROLE_STATS[Sta_NUM_ROLES_STAT] = #elif L==9 "administradores de graus" #endif - , // Sta_TEACHERS + , // Sta_ROLE_TEACHERS #if L==1 "professors" #elif L==2 @@ -32008,7 +32008,7 @@ const char *Txt_ROLE_STATS[Sta_NUM_ROLES_STAT] = #elif L==9 "professores" #endif - , // Sta_NON_EDITING_TEACHERS + , // Sta_ROLE_NON_EDITING_TEACHERS #if L==1 "professors no editors" #elif L==2 @@ -32028,7 +32028,7 @@ const char *Txt_ROLE_STATS[Sta_NUM_ROLES_STAT] = #elif L==9 "professores não editores" #endif - , // Sta_STUDENTS + , // Sta_ROLE_STUDENTS #if L==1 "estudiants" #elif L==2 @@ -32048,27 +32048,27 @@ const char *Txt_ROLE_STATS[Sta_NUM_ROLES_STAT] = #elif L==9 "estudantes" #endif - , // Sta_VISITORS + , // Sta_ROLE_USERS #if L==1 - "visitants" + "usuaris" #elif L==2 - "Besucher" + "Benutzer" #elif L==3 - "visitors" + "users" #elif L==4 - "visitantes" + "usuarios" #elif L==5 - "visiteurs" + "utilisateurs" #elif L==6 - "visitantes" // Okoteve traducción + "puruhára" #elif L==7 - "visitatori" + "utenti" #elif L==8 - "odwiedzający" + "użytkownicy" #elif L==9 - "visitantes" + "utilizadores" #endif - , // Sta_GUESTS + , // Sta_ROLE_GUESTS #if L==1 "convidats (sense assignatures)" #elif L==2 @@ -32088,7 +32088,7 @@ const char *Txt_ROLE_STATS[Sta_NUM_ROLES_STAT] = #elif L==9 "convidados (sem disciplinas)" #endif - , // Sta_UNKNOWN_USRS + , // Sta_ROLE_UNKNOWN_USRS #if L==1 "desconeguts" #elif L==2 @@ -32108,7 +32108,7 @@ const char *Txt_ROLE_STATS[Sta_NUM_ROLES_STAT] = #elif L==9 "desconhecidos" #endif - , // Sta_ME + , // Sta_ROLE_ME #if L==1 "jo" #elif L==2 diff --git a/swad_user.c b/swad_user.c index a1b167ac..8a7888bb 100644 --- a/swad_user.c +++ b/swad_user.c @@ -159,6 +159,7 @@ static void Usr_AllocateUsrsList (Rol_Role_t Role); static void Usr_PutButtonToConfirmIWantToSeeBigList (unsigned NumUsrs,const char *OnSubmit); static void Usr_ShowWarningListIsTooBig (unsigned NumUsrs); +static void Usr_AllocateListSelectedUsrCod (Rol_Role_t Role); static void Usr_AllocateListOtherRecipients (void); static void Usr_FormToSelectUsrListType (Act_Action_t NextAction,Usr_ShowUsrsType_t ListType); @@ -5208,57 +5209,91 @@ void Usr_GetListsSelectedUsrsCods (void) unsigned Length; /***** Allocate memory for the lists of users *****/ - Usr_AllocateListSelectedUsrCodAll (); - Usr_AllocateListSelectedUsrCodTch (); - Usr_AllocateListSelectedUsrCodStd (); + Usr_AllocateListSelectedUsrCod (Rol_UNK); + Usr_AllocateListSelectedUsrCod (Rol_GST); + Usr_AllocateListSelectedUsrCod (Rol_STD); + Usr_AllocateListSelectedUsrCod (Rol_NET); + Usr_AllocateListSelectedUsrCod (Rol_TCH); /***** Get selected users *****/ if (Gbl.Session.IsOpen) // If the session is open, get parameter from DB { - Ses_GetHiddenParFromDB (Gbl.Action.Act,"UsrCodAll",Gbl.Usrs.Select.All, + Ses_GetHiddenParFromDB (Gbl.Action.Act,"UsrCodAll",Gbl.Usrs.Select[Rol_UNK], Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); - Str_ChangeFormat (Str_FROM_FORM,Str_TO_TEXT,Gbl.Usrs.Select.All, + Str_ChangeFormat (Str_FROM_FORM,Str_TO_TEXT,Gbl.Usrs.Select[Rol_UNK], Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS,true); } else - Par_GetParMultiToText ("UsrCodAll",Gbl.Usrs.Select.All, + Par_GetParMultiToText ("UsrCodAll",Gbl.Usrs.Select[Rol_UNK], Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); - Par_GetParMultiToText ("UsrCodTch",Gbl.Usrs.Select.Tch, - Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); // Teachers or guests - - Par_GetParMultiToText ("UsrCodStd",Gbl.Usrs.Select.Std, + Par_GetParMultiToText ("UsrCodGst",Gbl.Usrs.Select[Rol_GST], + Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); // Guests + Par_GetParMultiToText ("UsrCodStd",Gbl.Usrs.Select[Rol_STD], Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); // Students + Par_GetParMultiToText ("UsrCodNET",Gbl.Usrs.Select[Rol_NET], + Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); // Non-editing teachers + Par_GetParMultiToText ("UsrCodTch",Gbl.Usrs.Select[Rol_TCH], + Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); // Teachers + /* sprintf (Gbl.Alert.Txt,"UsrCodAll = %s / UsrCodTch = %s / UsrCodStd = %s", - Gbl.Usrs.Select.All,Gbl.Usrs.Select.Tch,Gbl.Usrs.Select.Std); + Gbl.Usrs.Select[Rol_UNK],Gbl.Usrs.Select.Tch,Gbl.Usrs.Select.Std); Lay_ShowErrorAndExit (Gbl.Alert.Txt); */ - /***** Add teachers to the list with all selected users *****/ - if (Gbl.Usrs.Select.Tch[0]) + /***** Add guests to the list with all selected users *****/ + if (Gbl.Usrs.Select[Rol_GST][0]) { - if (Gbl.Usrs.Select.All[0]) - if ((Length = strlen (Gbl.Usrs.Select.All)) < + if (Gbl.Usrs.Select[Rol_UNK][0]) + if ((Length = strlen (Gbl.Usrs.Select[Rol_UNK])) < Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS) { - Gbl.Usrs.Select.All[Length ] = Par_SEPARATOR_PARAM_MULTIPLE; - Gbl.Usrs.Select.All[Length + 1] = '\0'; + Gbl.Usrs.Select[Rol_UNK][Length ] = Par_SEPARATOR_PARAM_MULTIPLE; + Gbl.Usrs.Select[Rol_UNK][Length + 1] = '\0'; } - Str_Concat (Gbl.Usrs.Select.All,Gbl.Usrs.Select.Tch, + Str_Concat (Gbl.Usrs.Select[Rol_UNK],Gbl.Usrs.Select[Rol_GST], Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); } /***** Add students to the list with all selected users *****/ - if (Gbl.Usrs.Select.Std[0]) + if (Gbl.Usrs.Select[Rol_STD][0]) { - if (Gbl.Usrs.Select.All[0]) - if ((Length = strlen (Gbl.Usrs.Select.All)) < + if (Gbl.Usrs.Select[Rol_UNK][0]) + if ((Length = strlen (Gbl.Usrs.Select[Rol_UNK])) < Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS) { - Gbl.Usrs.Select.All[Length ] = Par_SEPARATOR_PARAM_MULTIPLE; - Gbl.Usrs.Select.All[Length + 1] = '\0'; + Gbl.Usrs.Select[Rol_UNK][Length ] = Par_SEPARATOR_PARAM_MULTIPLE; + Gbl.Usrs.Select[Rol_UNK][Length + 1] = '\0'; } - Str_Concat (Gbl.Usrs.Select.All,Gbl.Usrs.Select.Std, + Str_Concat (Gbl.Usrs.Select[Rol_UNK],Gbl.Usrs.Select[Rol_STD], + Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); + } + + /***** Add non-editing teachers to the list with all selected users *****/ + if (Gbl.Usrs.Select[Rol_NET][0]) + { + if (Gbl.Usrs.Select[Rol_UNK][0]) + if ((Length = strlen (Gbl.Usrs.Select[Rol_UNK])) < + Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS) + { + Gbl.Usrs.Select[Rol_UNK][Length ] = Par_SEPARATOR_PARAM_MULTIPLE; + Gbl.Usrs.Select[Rol_UNK][Length + 1] = '\0'; + } + Str_Concat (Gbl.Usrs.Select[Rol_UNK],Gbl.Usrs.Select[Rol_NET], + Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); + } + + /***** Add teachers to the list with all selected users *****/ + if (Gbl.Usrs.Select[Rol_TCH][0]) + { + if (Gbl.Usrs.Select[Rol_UNK][0]) + if ((Length = strlen (Gbl.Usrs.Select[Rol_UNK])) < + Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS) + { + Gbl.Usrs.Select[Rol_UNK][Length ] = Par_SEPARATOR_PARAM_MULTIPLE; + Gbl.Usrs.Select[Rol_UNK][Length + 1] = '\0'; + } + Str_Concat (Gbl.Usrs.Select[Rol_UNK],Gbl.Usrs.Select[Rol_TCH], Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); } } @@ -5284,8 +5319,8 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs) bool Error = false; /***** Allocate memory for the lists of users's IDs *****/ - Usr_AllocateListSelectedUsrCodAll (); - LengthSelectedUsrsCods = strlen (Gbl.Usrs.Select.All); + Usr_AllocateListSelectedUsrCod (Rol_UNK); + LengthSelectedUsrsCods = strlen (Gbl.Usrs.Select[Rol_UNK]); /***** Allocate memory for the lists of recipients written explicetely *****/ Usr_AllocateListOtherRecipients (); @@ -5419,7 +5454,7 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs) if (LengthUsrCod < Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS) { /* Add user */ - Str_Copy (Gbl.Usrs.Select.All, + Str_Copy (Gbl.Usrs.Select[Rol_UNK], UsrDat.EncryptedUsrCod, Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); LengthSelectedUsrsCods = LengthUsrCod; @@ -5431,11 +5466,11 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs) Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS) { /* Add separator */ - Gbl.Usrs.Select.All[LengthSelectedUsrsCods] = Par_SEPARATOR_PARAM_MULTIPLE; + Gbl.Usrs.Select[Rol_UNK][LengthSelectedUsrsCods] = Par_SEPARATOR_PARAM_MULTIPLE; LengthSelectedUsrsCods++; /* Add user */ - Str_Copy (Gbl.Usrs.Select.All + LengthSelectedUsrsCods, + Str_Copy (Gbl.Usrs.Select[Rol_UNK] + LengthSelectedUsrsCods, UsrDat.EncryptedUsrCod, Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS); LengthSelectedUsrsCods += LengthUsrCod; @@ -5458,16 +5493,16 @@ bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs) /*****************************************************************************/ /************** Find if encrypted user's code is yet in list *****************/ /*****************************************************************************/ -// Returns true if EncryptedUsrCodToFind is in Gbl.Usrs.Select.All +// Returns true if EncryptedUsrCodToFind is in Gbl.Usrs.Select[Rol_UNK] bool Usr_FindUsrCodInListOfSelectedUsrs (const char *EncryptedUsrCodToFind) { const char *Ptr; char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]; - if (Gbl.Usrs.Select.All) + if (Gbl.Usrs.Select[Rol_UNK]) { - Ptr = Gbl.Usrs.Select.All; + Ptr = Gbl.Usrs.Select[Rol_UNK]; while (*Ptr) { Par_GetNextStrUntilSeparParamMult (&Ptr,EncryptedUsrCod, @@ -5489,8 +5524,8 @@ unsigned Usr_CountNumUsrsInListOfSelectedUsrs (void) unsigned NumUsrs = 0; struct UsrData UsrDat; - /***** Loop over the list Gbl.Usrs.Select.All to count the number of users *****/ - Ptr = Gbl.Usrs.Select.All; + /***** Loop over the list Gbl.Usrs.Select[Rol_UNK] to count the number of users *****/ + Ptr = Gbl.Usrs.Select[Rol_UNK]; while (*Ptr) { Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod, @@ -5502,69 +5537,38 @@ unsigned Usr_CountNumUsrsInListOfSelectedUsrs (void) return NumUsrs; } -/*****************************************************************************/ -/********************* Allocate memory for list of users *********************/ -/*****************************************************************************/ - -void Usr_AllocateListSelectedUsrCodAll (void) - { - if (!Gbl.Usrs.Select.All) - { - if ((Gbl.Usrs.Select.All = (char *) malloc (Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS + 1)) == NULL) - Lay_ShowErrorAndExit ("Not enough memory to store list of users."); - Gbl.Usrs.Select.All[0] = '\0'; - } - } - /*****************************************************************************/ /****************** Allocate memory for list of students *********************/ /*****************************************************************************/ +// Role = Rol_UNK here means all users -void Usr_AllocateListSelectedUsrCodStd (void) +static void Usr_AllocateListSelectedUsrCod (Rol_Role_t Role) { - if (!Gbl.Usrs.Select.Std) + if (!Gbl.Usrs.Select[Role]) { - if ((Gbl.Usrs.Select.Std = (char *) malloc (Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS + 1)) == NULL) + if ((Gbl.Usrs.Select[Role] = (char *) malloc (Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS + 1)) == NULL) Lay_ShowErrorAndExit ("Not enough memory to store list of users."); - Gbl.Usrs.Select.Std[0] = '\0'; - } - } - -/*****************************************************************************/ -/************* Allocate memory for list of teachers or guests ****************/ -/*****************************************************************************/ - -void Usr_AllocateListSelectedUsrCodTch (void) - { - if (!Gbl.Usrs.Select.Tch) - { - if ((Gbl.Usrs.Select.Tch = (char *) malloc (Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS + 1)) == NULL) - Lay_ShowErrorAndExit ("Not enough memory to store list of users."); - Gbl.Usrs.Select.Tch[0] = '\0'; + Gbl.Usrs.Select[Role][0] = '\0'; } } /*****************************************************************************/ /************ Free memory used by list of selected users' codes **************/ /*****************************************************************************/ +// Role = Rol_UNK here means all users void Usr_FreeListsSelectedUsrsCods (void) { - if (Gbl.Usrs.Select.All) - { - free ((void *) Gbl.Usrs.Select.All); - Gbl.Usrs.Select.All = NULL; - } - if (Gbl.Usrs.Select.Tch) - { - free ((void *) Gbl.Usrs.Select.Tch); - Gbl.Usrs.Select.Tch = NULL; - } - if (Gbl.Usrs.Select.Std) - { - free ((void *) Gbl.Usrs.Select.Std); - Gbl.Usrs.Select.Std = NULL; - } + Rol_Role_t Role; + + for (Role = (Rol_Role_t) 0; + Role < Rol_NUM_ROLES; + Role++) + if (Gbl.Usrs.Select[Role]) + { + free ((void *) Gbl.Usrs.Select[Role]); + Gbl.Usrs.Select[Role] = NULL; + } } /*****************************************************************************/ @@ -5684,7 +5688,7 @@ void Usr_PutExtraParamsUsrList (Act_Action_t NextAction) Att_PutParamAttCod (Gbl.AttEvents.AttCod); break; case ActReqMsgUsr: - Usr_PutHiddenParUsrCodAll (NextAction,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (NextAction,Gbl.Usrs.Select[Rol_UNK]); Msg_PutHiddenParamOtherRecipients (); Msg_PutHiddenParamsSubjectAndContent (); if (Gbl.Msg.Reply.IsReply) diff --git a/swad_user.h b/swad_user.h index 1e7a3ff1..53f39653 100644 --- a/swad_user.h +++ b/swad_user.h @@ -352,9 +352,6 @@ void Usr_GetListsSelectedUsrsCods (void); bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs); bool Usr_FindUsrCodInListOfSelectedUsrs (const char *EncryptedUsrCodToFind); unsigned Usr_CountNumUsrsInListOfSelectedUsrs (void); -void Usr_AllocateListSelectedUsrCodAll (void); -void Usr_AllocateListSelectedUsrCodStd (void); -void Usr_AllocateListSelectedUsrCodTch (void); void Usr_FreeListsSelectedUsrsCods (void); void Usr_FreeListOtherRecipients (void); diff --git a/swad_zip.c b/swad_zip.c index 9ca53c2a..40b375ae 100644 --- a/swad_zip.c +++ b/swad_zip.c @@ -129,7 +129,7 @@ void ZIP_PutLinkToCreateZIPAsgWrk (void) static void ZIP_PutLinkToCreateZIPAsgWrkParams (void) { - Usr_PutHiddenParUsrCodAll (ActAdmAsgWrkCrs,Gbl.Usrs.Select.All); + Usr_PutHiddenParUsrCodAll (ActAdmAsgWrkCrs,Gbl.Usrs.Select[Rol_UNK]); if (Gbl.FileBrowser.FullTree) Par_PutHiddenParamChar ("FullTree",'Y'); Par_PutHiddenParamChar ("CreateZIP",'Y'); @@ -175,7 +175,7 @@ void ZIP_CreateZIPAsgWrk (void) /* Create temporary directory for each selected user inside the directory used for compression */ - Ptr = Gbl.Usrs.Select.All; + Ptr = Gbl.Usrs.Select[Rol_UNK]; while (*Ptr) { Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EncryptedUsrCod,