diff --git a/swad_ID.c b/swad_ID.c index bd074097..70a27912 100644 --- a/swad_ID.c +++ b/swad_ID.c @@ -480,13 +480,13 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID, Act_GetActCod (Gbl.Action.Original)); // Original action, used to know where we came from switch (Gbl.Action.Original) { - case ActSeeRecSevGst: + case ActDoActOnSevGst: Usr_PutHiddenParUsrCodAll (ActCnfID_Oth,Gbl.Usrs.Select[Rol_UNK]); break; - case ActSeeRecSevStd: + case ActDoActOnSevStd: Usr_PutHiddenParUsrCodAll (ActCnfID_Std,Gbl.Usrs.Select[Rol_UNK]); break; - case ActSeeRecSevTch: + case ActDoActOnSevTch: Usr_PutHiddenParUsrCodAll (ActCnfID_Tch,Gbl.Usrs.Select[Rol_UNK]); break; } @@ -1057,15 +1057,15 @@ void ID_ConfirmOtherUsrID (void) /***** Show one or multiple records *****/ switch (Gbl.Action.Original) { - case ActSeeRecSevGst: + case ActDoActOnSevGst: /* Show multiple records of guests again (including the updated one) */ Rec_ListRecordsGstsShow (); break; - case ActSeeRecSevStd: + case ActDoActOnSevStd: /* Show multiple records of students again (including the updated one) */ Rec_ListRecordsStdsShow (); break; - case ActSeeRecSevTch: + case ActDoActOnSevTch: /* Show multiple records of teachers again (including the updated one) */ Rec_ListRecordsTchsShow (); break; diff --git a/swad_action.c b/swad_action.c index 308acfd3..37174ea5 100644 --- a/swad_action.c +++ b/swad_action.c @@ -1140,9 +1140,9 @@ Users: 957. ActSeeRecOneStd Show record of one selected student 958. ActSeeRecOneTch Show record of one selected teacher - 959. ActSeeRecSevGst Show records of several selected guests - 960. ActSeeRecSevStd Show records of several selected students - 961. ActSeeRecSevTch Show records of several selected teachers + 959. ActDoActOnSevGst Do action on several selected guests + 960. ActDoActOnSevStd Do action on several selected students + 961. ActDoActOnSevTch Do action on several selected teachers 962. ActPrnRecSevGst Show records of several selected guests ready to be printed 963. ActPrnRecSevStd Show records of several selected students ready to be printed 964. ActPrnRecSevTch Show records of several selected teachers ready to be printed @@ -2671,9 +2671,9 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActSeeRecOneStd */{1174,-1,TabUnk,ActLstStd ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rec_GetUsrAndShowRecOneStdCrs ,NULL}, /* ActSeeRecOneTch */{1175,-1,TabUnk,ActLstTch ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rec_GetUsrAndShowRecOneTchCrs ,NULL}, - /* ActSeeRecSevGst */{1187,-1,TabUnk,ActLstOth ,0x200,0x200,0x200,0x200,0x200,0x200,0x200,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rec_ListRecordsGstsShow ,NULL}, - /* ActSeeRecSevStd */{ 89,-1,TabUnk,ActLstStd ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rec_ListRecordsStdsShow ,NULL}, - /* ActSeeRecSevTch */{ 22,-1,TabUnk,ActLstTch ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Rec_ListRecordsTchsShow ,NULL}, + /* ActDoActOnSevGst */{1187,-1,TabUnk,ActLstOth ,0x200,0x200,0x200,0x200,0x200,0x200,0x200,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_DoActionOnSeveralStds ,NULL}, + /* ActDoActOnSevStd */{ 89,-1,TabUnk,ActLstStd ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_DoActionOnSeveralStds ,NULL}, + /* ActDoActOnSevTch */{ 22,-1,TabUnk,ActLstTch ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_DoActionOnSeveralStds ,NULL}, /* ActPrnRecSevGst */{1188,-1,TabUnk,ActLstOth ,0x200,0x200,0x200,0x200,0x200,0x200,0x200,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Rec_ListRecordsGstsPrint ,NULL}, /* ActPrnRecSevStd */{ 111,-1,TabUnk,ActLstStd ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Rec_ListRecordsStdsPrint ,NULL}, /* ActPrnRecSevTch */{ 127,-1,TabUnk,ActLstTch ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Rec_ListRecordsTchsPrint ,NULL}, @@ -3151,7 +3151,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un -1, // #19 (obsolete action) ActSeeSylPra, // #20 -1, // #21 (obsolete action) - ActSeeRecSevTch, // #22 + ActDoActOnSevTch, // #22 ActAdmBrf, // #23 -1, // #24 (obsolete action) ActSeeCrsTT, // #25 @@ -3218,7 +3218,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un -1, // #86 (obsolete action) ActRemAllStdCrs, // #87 ActReqRemAllStdCrs, // #88 - ActSeeRecSevStd, // #89 + ActDoActOnSevStd, // #89 ActDelSntMsg, // #90 ActEdiExaAnn, // #91 -1, // #92 (obsolete action) @@ -4316,7 +4316,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un -1, // #1184 (obsolete action) -1, // #1185 (obsolete action) ActLstOth, // #1186 - ActSeeRecSevGst, // #1187 + ActDoActOnSevGst, // #1187 ActPrnRecSevGst, // #1188 ActLstGstAll, // #1189 ActPrnGstPho, // #1190 diff --git a/swad_action.h b/swad_action.h index be26df57..21a7a37b 100644 --- a/swad_action.h +++ b/swad_action.h @@ -1160,9 +1160,9 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActSeeRecOneStd (ActRemOldBrf + 36) #define ActSeeRecOneTch (ActRemOldBrf + 37) -#define ActSeeRecSevGst (ActRemOldBrf + 38) -#define ActSeeRecSevStd (ActRemOldBrf + 39) -#define ActSeeRecSevTch (ActRemOldBrf + 40) +#define ActDoActOnSevGst (ActRemOldBrf + 38) +#define ActDoActOnSevStd (ActRemOldBrf + 39) +#define ActDoActOnSevTch (ActRemOldBrf + 40) #define ActPrnRecSevGst (ActRemOldBrf + 41) #define ActPrnRecSevStd (ActRemOldBrf + 42) #define ActPrnRecSevTch (ActRemOldBrf + 43) diff --git a/swad_attendance.c b/swad_attendance.c index b048f72d..1ffd8f95 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -2853,7 +2853,7 @@ static void Usr_ListOrPrintStdsAttendanceCrs (Att_TypeOfView_t TypeOfView) { extern const char *Hlp_USERS_Attendance_attendance_list; extern const char *Txt_Attendance; - extern const char *Txt_You_must_select_one_ore_more_students; + extern const char *Txt_You_must_select_one_ore_more_users; unsigned NumStdsInList; long *LstSelectedUsrCods; unsigned NumAttEvent; @@ -2922,7 +2922,7 @@ static void Usr_ListOrPrintStdsAttendanceCrs (Att_TypeOfView_t TypeOfView) } else // No students selected { - Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_one_ore_more_students); + Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_one_ore_more_users); Usr_ReqListStdsAttendanceCrs (); // ...show again the form } diff --git a/swad_changelog.h b/swad_changelog.h index 50a2ea7d..248edf33 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -428,6 +428,8 @@ Lo de mutear anuncios, en principio prefiero hacer una opci // TODO: Los usuarios que no tienes permiso para ver su perfil público, se debería mostrar algo, una mínima ficha sin tinmeline o algo así +// TODO: Al pulsar sobre una convocatoria de examen / aviso --> ir a la sección de esa convocatoria/aviso en lugar de mostrarlo repetido y destacado arriba + // TODO: "Se podría poner un botón para seguir a todos los relacionados contigo en las asignaturas, en lugar de tener que agregarlos uno a uno" Suggested by José María girao Miras. /*****************************************************************************/ @@ -449,10 +451,16 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.70 (2019-03-10)" +#define Log_PLATFORM_VERSION "SWAD 18.71 (2019-03-11)" #define CSS_FILE "swad18.68.3.css" #define JS_FILE "swad18.64.js" /* + Version 18.71: Mar 11, 2019 Listing of users now allow to do several actions. Not finished. (238920 lines) + 3 changes necessary in database: +UPDATE actions SET Txt='Realizar acción con varios profesores' WHERE ActCod='22' AND Language='es'; +UPDATE actions SET Txt='Realizar acción con varios estudiantes' WHERE ActCod='89' AND Language='es'; +UPDATE actions SET Txt='Realizar acción con varios invitados' WHERE ActCod='1187' AND Language='es'; + Version 18.70: Mar 10, 2019 Code refactoring in one user administration. (238819 lines) Version 18.69.2: Mar 10, 2019 Changes related to alerts. (238842 lines) Version 18.69.1: Mar 09, 2019 Changes in forms to register/remove users. (238805 lines) diff --git a/swad_enrolment.c b/swad_enrolment.c index 03115c48..de2e85ab 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -1665,8 +1665,7 @@ static void Enr_PutActionRepUsrAsDup (bool *OptionChecked) extern const char *Txt_Report_possible_duplicate_user; Enr_StartRegRemOneUsrAction (Enr_REPORT_USR_AS_POSSIBLE_DUPLICATE,OptionChecked); - fprintf (Gbl.F.Out,"%s", - Txt_Report_possible_duplicate_user); + fprintf (Gbl.F.Out,"%s",Txt_Report_possible_duplicate_user); Enr_EndRegRemOneUsrAction (); } diff --git a/swad_record.c b/swad_record.c index 82c08f24..394f9228 100644 --- a/swad_record.c +++ b/swad_record.c @@ -953,18 +953,24 @@ void Rec_PutLinkToEditRecordFields (void) void Rec_ListRecordsGstsShow (void) { - Gbl.Action.Original = ActSeeRecSevGst; // Used to know where to go when confirming ID + Gbl.Action.Original = ActDoActOnSevGst; // Used to know where to go when confirming ID Rec_ListRecordsGsts (Rec_SHA_RECORD_LIST); } void Rec_ListRecordsGstsPrint (void) { + /***** Get list of selected users *****/ + Usr_GetListsSelectedUsrsCods (); + + /***** List records ready to be printed *****/ Rec_ListRecordsGsts (Rec_SHA_RECORD_PRINT); + + /***** Free memory used by list of selected users' codes *****/ + Usr_FreeListsSelectedUsrsCods (); } static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView) { - extern const char *Txt_You_must_select_one_ore_more_users; unsigned NumUsr = 0; const char *Ptr; struct UsrData UsrDat; @@ -977,17 +983,6 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView) if (TypeOfView == Rec_SHA_RECORD_PRINT) Rec_GetParamRecordsPerPage (); - /***** Get list of selected users *****/ - Usr_GetListsSelectedUsrsCods (); - - /* Check the number of students to show */ - if (!Usr_CountNumUsrsInListOfSelectedUsrs ()) // If no students selected... - { // ...write warning notice - Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_one_ore_more_users); - Usr_SeeGuests (); // ...show again the form - return; - } - if (TypeOfView == Rec_SHA_RECORD_LIST) // Listing several records { fprintf (Gbl.F.Out,"
"); @@ -1045,9 +1040,6 @@ static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView) } /***** Free memory used for user's data *****/ Usr_UsrDataDestructor (&UsrDat); - - /***** Free memory used by list of selected users' codes *****/ - Usr_FreeListsSelectedUsrsCods (); } /*****************************************************************************/ @@ -1146,7 +1138,7 @@ static void Rec_ShowRecordOneStdCrs (void) void Rec_ListRecordsStdsShow (void) { - Gbl.Action.Original = ActSeeRecSevStd; // Used to know where to go when confirming ID... + Gbl.Action.Original = ActDoActOnSevStd; // Used to know where to go when confirming ID... // ...or changing course record Rec_ListRecordsStds (Rec_SHA_RECORD_LIST, Rec_CRS_LIST_SEVERAL_RECORDS); @@ -1154,14 +1146,20 @@ void Rec_ListRecordsStdsShow (void) void Rec_ListRecordsStdsPrint (void) { + /***** Get list of selected users *****/ + Usr_GetListsSelectedUsrsCods (); + + /***** List records ready to be printed *****/ Rec_ListRecordsStds (Rec_SHA_RECORD_PRINT, Rec_CRS_PRINT_SEVERAL_RECORDS); + + /***** Free memory used by list of selected users' codes *****/ + Usr_FreeListsSelectedUsrsCods (); } static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView, Rec_CourseRecordViewType_t CrsTypeOfView) { - extern const char *Txt_You_must_select_one_ore_more_students; unsigned NumUsr = 0; const char *Ptr; struct UsrData UsrDat; @@ -1175,17 +1173,6 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView, if (ShaTypeOfView == Rec_SHA_RECORD_PRINT) Rec_GetParamRecordsPerPage (); - /***** Get list of selected students *****/ - Usr_GetListsSelectedUsrsCods (); - - /* Check the number of students to show */ - if (!Usr_CountNumUsrsInListOfSelectedUsrs ()) // If no students selected... - { // ...write warning notice - Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_one_ore_more_students); - Usr_SeeStudents (); // ...show again the form - return; - } - /***** Get list of fields of records in current course *****/ Rec_GetListRecordFieldsInCurrentCrs (); @@ -1272,9 +1259,6 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView, /***** Free list of fields of records *****/ Rec_FreeListFields (); - - /***** Free memory used by list of selected users' codes *****/ - Usr_FreeListsSelectedUsrsCods (); } /*****************************************************************************/ @@ -1364,19 +1348,25 @@ static void Rec_ShowRecordOneTchCrs (void) void Rec_ListRecordsTchsShow (void) { - Gbl.Action.Original = ActSeeRecSevTch; // Used to know where to go when confirming ID + Gbl.Action.Original = ActDoActOnSevTch; // Used to know where to go when confirming ID Rec_ListRecordsTchs (Rec_SHA_RECORD_LIST); } void Rec_ListRecordsTchsPrint (void) { + /***** Get list of selected users *****/ + Usr_GetListsSelectedUsrsCods (); + + /***** List records ready to be printed *****/ Rec_ListRecordsTchs (Rec_SHA_RECORD_PRINT); + + /***** Free memory used by list of selected users' codes *****/ + Usr_FreeListsSelectedUsrsCods (); } static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView) { extern const char *Hlp_USERS_Teachers_timetable; - extern const char *Txt_You_must_select_one_ore_more_teachers; extern const char *Txt_TIMETABLE_TYPES[TT_NUM_TIMETABLE_TYPES]; unsigned NumUsr = 0; const char *Ptr; @@ -1400,18 +1390,7 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView) if (Gbl.Action.Act == ActPrnRecSevTch) Rec_GetParamRecordsPerPage (); - /***** Get list of selected teachers *****/ - Usr_GetListsSelectedUsrsCods (); - - /* Check the number of teachers to show */ - if (!Usr_CountNumUsrsInListOfSelectedUsrs ()) // If no teachers selected... - { // ...write warning notice - Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_one_ore_more_teachers); - Usr_SeeTeachers (); // ...show again the form - return; - } - - if (Gbl.Action.Act == ActSeeRecSevTch) + if (Gbl.Action.Act == ActDoActOnSevTch) { /***** Show contextual menu *****/ fprintf (Gbl.F.Out,"
"); @@ -1492,9 +1471,6 @@ static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView) /***** Free memory used for user's data *****/ Usr_UsrDataDestructor (&UsrDat); - - /***** Free memory used by list of selected users' codes *****/ - Usr_FreeListsSelectedUsrsCods (); } /*****************************************************************************/ @@ -1562,7 +1538,7 @@ static void Rec_WriteFormShowOfficeHoursSeveralTchs (bool ShowOfficeHours) { extern const char *Txt_Show_office_hours; - Lay_PutContextualCheckbox (ActSeeRecSevTch,Rec_PutParamsShowOfficeHoursSeveralTchs, + Lay_PutContextualCheckbox (ActDoActOnSevTch,Rec_PutParamsShowOfficeHoursSeveralTchs, "ShowOfficeHours", ShowOfficeHours,false, Txt_Show_office_hours, @@ -1577,7 +1553,7 @@ static void Rec_PutParamsShowOfficeHoursOneTch (void) static void Rec_PutParamsShowOfficeHoursSeveralTchs (void) { - Usr_PutHiddenParUsrCodAll (ActSeeRecSevTch,Gbl.Usrs.Select[Rol_UNK]); + Usr_PutHiddenParUsrCodAll (ActDoActOnSevTch,Gbl.Usrs.Select[Rol_UNK]); Par_PutHiddenParamChar ("ParamOfficeHours",'Y'); } @@ -1653,7 +1629,7 @@ void Rec_UpdateAndShowOtherCrsRecord (void) /***** Show one or multiple records *****/ switch (Gbl.Action.Original) { - case ActSeeRecSevStd: + case ActDoActOnSevStd: /* Show multiple records again (including the updated one) */ Rec_ListRecordsStdsShow (); break; @@ -1748,7 +1724,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView, ICanEdit = true; Frm_StartFormAnchor (ActRcvRecOthUsr,Anchor); Par_PutHiddenParamLong ("OriginalActCod", - Act_GetActCod (ActSeeRecSevStd)); // Original action, used to know where we came from + Act_GetActCod (ActDoActOnSevStd)); // Original action, used to know where we came from Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); if (TypeOfView == Rec_CRS_LIST_SEVERAL_RECORDS) Usr_PutHiddenParUsrCodAll (ActRcvRecOthUsr,Gbl.Usrs.Select[Rol_UNK]); diff --git a/swad_text.c b/swad_text.c index 058f9b61..f0d329a3 100644 --- a/swad_text.c +++ b/swad_text.c @@ -8522,7 +8522,7 @@ const char *Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_Y_Z #elif L==2 // de "Do you really want to remove the field %s" " from the records of %s" - " (this field is filled in the records of %u student(s))?"; // Need Übersetzung + " (this field is filled in the records of %u student(s))?"; // Need Übersetzung #elif L==3 // en "Do you really want to remove the field %s" " from the records of %s" @@ -38692,7 +38692,7 @@ const char *Txt_Show_questions = const char *Txt_Show_records = #if L==1 // ca - "Mostrar fichas"; // Necessita traduccio + "Mostrar fitxes"; #elif L==2 // de "Zeige Profile"; #elif L==3 // en @@ -38706,7 +38706,7 @@ const char *Txt_Show_records = #elif L==7 // it "Visualizza le schede"; #elif L==8 // pl - "Show records"; // Potrzebujesz tlumaczenie + "Pokaż rekordy"; #elif L==9 // pt "Mostrar cartões"; #endif @@ -55036,27 +55036,6 @@ const char *Txt_You_must_select_one_ore_more_recipients = "Você deve selecionar um ou mais destinatários."; #endif -const char *Txt_You_must_select_one_ore_more_students = -#if L==1 // ca - "Debe seleccionar uno o más estudiantes."; // Necessita traduccio -#elif L==2 // de - "Es muss mindestens ein Student ausgewählt werden."; -#elif L==3 // en - "You must select one or more students."; -#elif L==4 // es - "Debe seleccionar uno o más estudiantes."; -#elif L==5 // fr - "You must select one or more students."; // Besoin de traduction -#elif L==6 // gn - "Debe seleccionar uno o más estudiantes."; // Okoteve traducción -#elif L==7 // it - "Devi selezionare uno o più studenti."; -#elif L==8 // pl - "You must select one or more students."; // Potrzebujesz tlumaczenie -#elif L==9 // pt - "Você deve selecionar um ou mais estudantes."; -#endif - const char *Txt_You_must_select_one_ore_more_tags = #if L==1 // ca "Debe seleccionar uno o más descriptores."; // Necessita traduccio @@ -55078,27 +55057,6 @@ const char *Txt_You_must_select_one_ore_more_tags = "Você deve selecionar uma ou mais descritores."; #endif -const char *Txt_You_must_select_one_ore_more_teachers = -#if L==1 // ca - "Debe seleccionar uno o más profesores."; // Necessita traduccio -#elif L==2 // de - "Es muss mindestens ein Lehrer ausgewählt werden."; -#elif L==3 // en - "You must select one or more teachers."; -#elif L==4 // es - "Debe seleccionar uno o más profesores."; -#elif L==5 // fr - "You must select one or more teachers."; // Besoin de traduction -#elif L==6 // gn - "Debe seleccionar uno o más profesores."; // Okoteve traducción -#elif L==7 // it - "Devi selezionare uno o più professori."; -#elif L==8 // pl - "You must select one or more teachers."; // Potrzebujesz tlumaczenie -#elif L==9 // pt - "Você deve selecionar um ou mais professores."; -#endif - const char *Txt_You_must_select_one_ore_more_types_of_answer = #if L==1 // ca "Debe seleccionar uno o más tipos de respuesta."; // Necessita traduccio diff --git a/swad_timetable.c b/swad_timetable.c index bfdb435c..0f602893 100644 --- a/swad_timetable.c +++ b/swad_timetable.c @@ -496,7 +496,7 @@ void TT_ShowTimeTable (long UsrCod) case ActSeeMyTT: case ActPrnMyTT: case ActChgMyTT1stDay: Gbl.TimeTable.View = TT_CRS_VIEW; break; - case ActSeeRecOneTch: case ActSeeRecSevTch: + case ActSeeRecOneTch: case ActDoActOnSevTch: Gbl.TimeTable.View = TT_TUT_VIEW; break; case ActEdiCrsTT: case ActChgCrsTT: diff --git a/swad_user.c b/swad_user.c index 5c4a112f..e97d49ec 100644 --- a/swad_user.c +++ b/swad_user.c @@ -140,6 +140,14 @@ const char *Usr_UsrDatMainFieldNames[Usr_NUM_MAIN_FIELDS_DATA_USR]; #define Usr_MAX_BYTES_QUERY_GET_LIST_USRS (16 * 1024 - 1) +#define Usr_LIST_USRS_NUM_ACTIONS 3 +typedef enum + { + Usr_LIST_USRS_UNKNOWN_ACTION = 0, + Usr_SHOW_RECORDS = 1, + Usr_FOLLOW_USERS = 2, + } Usr_ListUsrsAction_t; + /*****************************************************************************/ /****************************** Internal types *******************************/ /*****************************************************************************/ @@ -236,6 +244,14 @@ static void Usr_UpdateMyPrefAboutListWithPhotosPhotoInDB (void); static void Usr_PutLinkToSeeAdmins (void); static void Usr_PutLinkToSeeGuests (void); +static bool Usr_PutActionsSeveralUsrs (Rol_Role_t Role); +static void Usr_PutActionShowRecords (bool *OptionChecked); +static void Usr_PutActionFollowUsers (bool *OptionChecked); +static void Usr_StartListUsrsAction (Usr_ListUsrsAction_t ListUsrsAction, + bool *OptionChecked); +static void Usr_EndListUsrsAction (void); + + static void Usr_PutIconsListGsts (void); static void Usr_PutIconsListStds (void); static void Usr_PutIconsListTchs (void); @@ -7528,7 +7544,7 @@ void Usr_SeeGuests (void) extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_Scope; - extern const char *Txt_Show_records; + extern const char *Txt_Continue; /***** Put contextual links *****/ fprintf (Gbl.F.Out,"
"); @@ -7598,7 +7614,7 @@ void Usr_SeeGuests (void) -1L); /* Start form */ - Frm_StartForm (ActSeeRecSevGst); + Frm_StartForm (ActDoActOnSevGst); /* Start table */ Tbl_StartTableWide (0); @@ -7608,10 +7624,11 @@ void Usr_SeeGuests (void) { case Usr_LIST_AS_CLASS_PHOTO: Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE, - Rol_GST,true); + Rol_GST, + true); // Put checkbox to select users break; case Usr_LIST_AS_LISTING: - Usr_ListMainDataGsts (true); + Usr_ListMainDataGsts (true); // Put checkbox to select users break; default: break; @@ -7620,8 +7637,10 @@ void Usr_SeeGuests (void) /* End table */ Tbl_EndTable (); - /* Send button */ - Btn_PutConfirmButton (Txt_Show_records); + /***** Which action, show records, follow...? *****/ + if (Usr_PutActionsSeveralUsrs (Rol_GST)) + /* Send button */ + Btn_PutConfirmButton (Txt_Continue); /* End form */ Frm_EndForm (); @@ -7651,8 +7670,7 @@ void Usr_SeeStudents (void) extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_Scope; - extern const char *Txt_Show_records; - bool ICanViewRecords; + extern const char *Txt_Continue; /***** Put contextual links *****/ switch (Gbl.Usrs.Me.Role.Logged) @@ -7692,9 +7710,6 @@ void Usr_SeeStudents (void) /***** Get scope *****/ Sco_SetScopesForListingStudents (); Sco_GetScope ("ScopeUsr"); - ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_CRS && - (Gbl.Usrs.Me.IBelongToCurrentCrs || - Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)); /***** Get groups to show ******/ if (Gbl.Scope.Current == Sco_SCOPE_CRS) @@ -7759,12 +7774,10 @@ void Usr_SeeStudents (void) Gbl.Scope.Current == Sco_SCOPE_CRS ? Gbl.CurrentCrs.Crs.CrsCod : -1L); + /* Start form */ - if (ICanViewRecords) - { - Frm_StartForm (ActSeeRecSevStd); - Grp_PutParamsCodGrps (); - } + Frm_StartForm (ActDoActOnSevStd); + Grp_PutParamsCodGrps (); /* Start table */ Tbl_StartTableWide (0); @@ -7773,12 +7786,12 @@ void Usr_SeeStudents (void) switch (Gbl.Usrs.Me.ListType) { case Usr_LIST_AS_CLASS_PHOTO: - Usr_DrawClassPhoto (ICanViewRecords ? Usr_CLASS_PHOTO_SEL_SEE : - Usr_CLASS_PHOTO_SEE, - Rol_STD,ICanViewRecords); + Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE, + Rol_STD, + true); // Put checkbox to select users break; case Usr_LIST_AS_LISTING: - Usr_ListMainDataStds (ICanViewRecords); + Usr_ListMainDataStds (true); // Put checkbox to select users break; default: break; @@ -7787,15 +7800,14 @@ void Usr_SeeStudents (void) /* End table */ Tbl_EndTable (); - if (ICanViewRecords) - { + /***** Which action, show records, follow...? *****/ + if (Usr_PutActionsSeveralUsrs (Rol_STD)) /* Send button */ - Btn_PutConfirmButton (Txt_Show_records); + Btn_PutConfirmButton (Txt_Continue); - /* End form */ - Frm_EndForm (); - } - } + /* End form */ + Frm_EndForm (); + } } else // Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs == 0 /***** Show warning indicating no students found *****/ @@ -7824,8 +7836,7 @@ void Usr_SeeTeachers (void) extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_Scope; - extern const char *Txt_Show_records; - bool ICanViewRecords; + extern const char *Txt_Continue; unsigned NumUsrs; /***** Put contextual links *****/ @@ -7871,7 +7882,6 @@ void Usr_SeeTeachers (void) 1 << Sco_SCOPE_CRS; Gbl.Scope.Default = Sco_SCOPE_CRS; Sco_GetScope ("ScopeUsr"); - ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_CRS); /***** Get groups to show ******/ if (Gbl.Scope.Current == Sco_SCOPE_CRS) @@ -7932,8 +7942,7 @@ void Usr_SeeTeachers (void) -1L); /* Start form */ - if (ICanViewRecords) - Frm_StartForm (ActSeeRecSevTch); + Frm_StartForm (ActDoActOnSevTch); /* Start table */ Tbl_StartTableWide (0); @@ -7943,20 +7952,22 @@ void Usr_SeeTeachers (void) { case Usr_LIST_AS_CLASS_PHOTO: /* List teachers and non-editing teachers */ - Usr_DrawClassPhoto (ICanViewRecords ? Usr_CLASS_PHOTO_SEL_SEE : - Usr_CLASS_PHOTO_SEE, - Rol_TCH,ICanViewRecords); - Usr_DrawClassPhoto (ICanViewRecords ? Usr_CLASS_PHOTO_SEL_SEE : - Usr_CLASS_PHOTO_SEE, - Rol_NET,ICanViewRecords); + Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE, + Rol_TCH, + true); // Put checkbox to select users + Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE, + Rol_NET, + true); // Put checkbox to select users break; case Usr_LIST_AS_LISTING: /* Initialize field names */ Usr_SetUsrDatMainFieldNames (); /* List teachers and non-editing teachers */ - Usr_ListMainDataTchs (Rol_TCH,ICanViewRecords); - Usr_ListMainDataTchs (Rol_NET,ICanViewRecords); + Usr_ListMainDataTchs (Rol_TCH, + true); // Put checkbox to select users + Usr_ListMainDataTchs (Rol_NET, + true); // Put checkbox to select users break; default: break; @@ -7965,14 +7976,13 @@ void Usr_SeeTeachers (void) /* End table */ Tbl_EndTable (); - if (ICanViewRecords) - { + /***** Which action, show records, follow...? *****/ + if (Usr_PutActionsSeveralUsrs (Rol_TCH)) /* Send button */ - Btn_PutConfirmButton (Txt_Show_records); + Btn_PutConfirmButton (Txt_Continue); - /* End form */ - Frm_EndForm (); - } + /* End form */ + Frm_EndForm (); } } else // NumUsrs == 0 @@ -7993,6 +8003,182 @@ void Usr_SeeTeachers (void) Grp_FreeListCodSelectedGrps (); } +/*****************************************************************************/ +/*************** Put different actions to do with several users **************/ +/*****************************************************************************/ +// Returns true if at least one action can be shown + +static bool Usr_PutActionsSeveralUsrs (Rol_Role_t Role) + { + extern const char *The_ClassFormInBox[The_NUM_THEMES]; + bool ICanViewRecords; + bool ICanFollow; + bool OptionsShown = false; + bool OptionChecked = false; + + switch (Role) + { + case Rol_GST: + ICanViewRecords = (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM); + ICanFollow = false; + break; + case Rol_STD: + ICanViewRecords = ICanFollow = + (Gbl.Scope.Current == Sco_SCOPE_CRS && + (Gbl.Usrs.Me.IBelongToCurrentCrs || + Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)); + break; + case Rol_TCH: + ICanViewRecords = ICanFollow = + (Gbl.Scope.Current == Sco_SCOPE_CRS); + break; + default: + ICanViewRecords = ICanFollow = false; + break; + } + + /***** Start list of options *****/ + fprintf (Gbl.F.Out,"
    ", + The_ClassFormInBox[Gbl.Prefs.Theme]); + + /***** View records *****/ + if (ICanViewRecords) + { // I can view users records + Usr_PutActionShowRecords (&OptionChecked); + OptionsShown = true; + } + + /***** Follow *****/ + if (ICanFollow) + { // I can follow users + Usr_PutActionFollowUsers (&OptionChecked); + OptionsShown = true; + } + + /***** End list of options *****/ + fprintf (Gbl.F.Out,"
"); + + return OptionsShown; + } + +/*****************************************************************************/ +/******************** Put action to show users' records **********************/ +/*****************************************************************************/ + +static void Usr_PutActionShowRecords (bool *OptionChecked) + { + extern const char *Txt_Show_records; + + Usr_StartListUsrsAction (Usr_SHOW_RECORDS,OptionChecked); + fprintf (Gbl.F.Out,"%s",Txt_Show_records); + Usr_EndListUsrsAction (); + } + +/*****************************************************************************/ +/*********************** Put action to follow users **************************/ +/*****************************************************************************/ + +static void Usr_PutActionFollowUsers (bool *OptionChecked) + { + extern const char *Txt_Follow; + + Usr_StartListUsrsAction (Usr_FOLLOW_USERS,OptionChecked); + fprintf (Gbl.F.Out,"%s",Txt_Follow); + Usr_EndListUsrsAction (); + } + +/*****************************************************************************/ +/************ Put start/end of action to register/remove one user ************/ +/*****************************************************************************/ + +static void Usr_StartListUsrsAction (Usr_ListUsrsAction_t ListUsrsAction, + bool *OptionChecked) + { + fprintf (Gbl.F.Out,"
  • " + "" + "" + "
  • "); + } + +/*****************************************************************************/ +/********************** Do action on several students ************************/ +/*****************************************************************************/ + +void Usr_DoActionOnSeveralStds (void) + { + extern const char *Txt_You_must_select_one_ore_more_users; + Usr_ListUsrsAction_t ListUsrsAction; + // Rol_Role_t Role; + + /***** Get parameters from form *****/ + /* Get list of selected users */ + Usr_GetListsSelectedUsrsCods (); + + /* Check the number of users */ + if (!Usr_CountNumUsrsInListOfSelectedUsrs ())// If no users selected... + { // ...write warning notice + Ale_ShowAlert (Ale_WARNING,Txt_You_must_select_one_ore_more_users); + Usr_SeeStudents (); // ...show again the form + return; + } + + /* Get the action to do */ + ListUsrsAction = (Usr_ListUsrsAction_t) + Par_GetParToUnsignedLong ("ListUsrsAction", + 0, + Usr_LIST_USRS_NUM_ACTIONS - 1, + (unsigned long) Usr_LIST_USRS_UNKNOWN_ACTION); + /* Get role */ + /* Role = (Rol_Role_t) Par_GetParToUnsignedLong ("Role", + 0, + Rol_NUM_ROLES - 1, + (unsigned long) Rol_UNK); */ + + /***** Do actions *****/ + switch (ListUsrsAction) + { + case Usr_SHOW_RECORDS: + switch (Gbl.Action.Act) + { + case ActDoActOnSevGst: + Rec_ListRecordsGstsShow (); + break; + case ActDoActOnSevStd: + Rec_ListRecordsStdsShow (); + break; + case ActDoActOnSevTch: + Rec_ListRecordsTchsShow (); + break; + } + break; + case Usr_FOLLOW_USERS: + Ale_ShowAlert (Ale_WARNING,"Not implemented."); + break; + default: + Ale_ShowAlert (Ale_ERROR,"Wrong action."); + Usr_SeeStudents (); // Show again the form + break; + } + + /***** Free memory used by list of selected users' codes *****/ + Usr_FreeListsSelectedUsrsCods (); + } + /*****************************************************************************/ /***************** Put contextual icons in list of guests ********************/ /*****************************************************************************/ @@ -8328,7 +8514,6 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType, ClassPhoto = "PHOTO21x28"; break; case Usr_CLASS_PHOTO_SEL_SEE: - case Usr_CLASS_PHOTO_SEE: ClassPhoto = "PHOTO45x60"; break; case Usr_CLASS_PHOTO_PRN: diff --git a/swad_user.h b/swad_user.h index 43e12a80..7a6899d6 100644 --- a/swad_user.h +++ b/swad_user.h @@ -101,8 +101,7 @@ typedef enum typedef enum { Usr_CLASS_PHOTO_SEL, // Only for selection of users - Usr_CLASS_PHOTO_SEL_SEE, // Selection and seeing of users - Usr_CLASS_PHOTO_SEE, // Only seeing users + Usr_CLASS_PHOTO_SEL_SEE, // Selecting and seeing users Usr_CLASS_PHOTO_PRN, // Only print users } Usr_ClassPhotoType_t; @@ -412,6 +411,9 @@ void Usr_GetMyPrefAboutListWithPhotosFromDB (void); void Usr_SeeGuests (void); void Usr_SeeStudents (void); + +void Usr_DoActionOnSeveralStds (void); + void Usr_SeeTeachers (void); void Usr_SeeGstClassPhotoPrn (void); void Usr_SeeStdClassPhotoPrn (void);