From 4fc74a80ada1fcf745b89d9f7d39bcc76539e026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 30 May 2017 21:43:05 +0200 Subject: [PATCH] Version 16.230 --- swad_action.c | 2 +- swad_centre.c | 12 +- swad_changelog.h | 3 +- swad_chat.c | 14 +-- swad_country.c | 6 +- swad_course.c | 28 ++--- swad_department.c | 4 +- swad_enrolment.c | 4 +- swad_group.c | 200 ++++++++++++++++------------- swad_group.h | 6 +- swad_indicator.c | 7 +- swad_institution.c | 12 +- swad_mark.c | 2 +- swad_text.c | 304 ++++++++++++++++++++++++++++++++++----------- swad_web_service.c | 4 +- 15 files changed, 400 insertions(+), 208 deletions(-) diff --git a/swad_action.c b/swad_action.c index 2fdd2dbf..134541cb 100644 --- a/swad_action.c +++ b/swad_action.c @@ -5186,7 +5186,7 @@ void Act_AdjustCurrentAction (void) /* If there are some group types with mandatory enrolment and groups in this course, and I don't belong to any of those groups, the the only action possible is show a form to register in groups */ - if (Grp_NumGrpTypesMandatIDontBelong ()) // To do: if this query is too slow ==> put it only when login. + if (Grp_NumGrpTypesMandatIDontBelongAsStd ()) // To do: if this query is too slow ==> put it only when login. { Gbl.Action.Act = ActReqSelGrp; Tab_SetCurrentTab (); diff --git a/swad_centre.c b/swad_centre.c index 757d6244..6d06cbd8 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -2518,8 +2518,7 @@ static void Ctr_PutHeadCentresForSeeing (bool OrderSelectable) extern const char *Txt_Place; extern const char *Txt_Degrees_ABBREVIATION; extern const char *Txt_Courses_ABBREVIATION; - extern const char *Txt_Teachers_ABBREVIATION; - extern const char *Txt_Students_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; Ctr_Order_t Order; fprintf (Gbl.F.Out,"" @@ -2567,7 +2566,8 @@ static void Ctr_PutHeadCentresForSeeing (bool OrderSelectable) Txt_Place, Txt_Degrees_ABBREVIATION, Txt_Courses_ABBREVIATION, - Txt_Teachers_ABBREVIATION,Txt_Students_ABBREVIATION); + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH], + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD]); } /*****************************************************************************/ @@ -2583,8 +2583,7 @@ static void Ctr_PutHeadCentresForEdition (void) extern const char *Txt_WWW; extern const char *Txt_Users; extern const char *Txt_Degrees_ABBREVIATION; - extern const char *Txt_Teachers_ABBREVIATION; - extern const char *Txt_Students_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_Requester; fprintf (Gbl.F.Out,"" @@ -2627,7 +2626,8 @@ static void Ctr_PutHeadCentresForEdition (void) Txt_WWW, Txt_Users, Txt_Degrees_ABBREVIATION, - Txt_Teachers_ABBREVIATION,Txt_Students_ABBREVIATION, + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH], + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD], Txt_Requester); } diff --git a/swad_changelog.h b/swad_changelog.h index 5988f3c3..7a336d99 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -231,13 +231,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.229.1 (2017-05-30)" +#define Log_PLATFORM_VERSION "SWAD 16.230 (2017-05-30)" #define CSS_FILE "swad16.226.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.230: May 30, 2017 Number of teachers and non-editing teachers in list of groups. (220953 lines) Version 16.229.1: May 30, 2017 Code refactoring in selection of groups. Fixed bug when printing list of teachers. (220762 lines) Version 16.229: May 30, 2017 Selection of groups also for listing of teachers. (220748 lines) diff --git a/swad_chat.c b/swad_chat.c index 93157c88..17c1c4d9 100644 --- a/swad_chat.c +++ b/swad_chat.c @@ -104,8 +104,7 @@ void Cht_ShowListOfAvailableChatRooms (void) extern const char *Txt_SEX_PLURAL_Abc[Usr_NUM_SEXS]; extern const char *Txt_SEX_PLURAL_abc[Usr_NUM_SEXS]; extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; - extern const char *Txt_Students_ABBREVIATION; - extern const char *Txt_Teachers_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_Degree; extern const char *Txt_Course; bool IsLastItemInLevel[1 + Cht_CHAT_MAX_LEVELS]; @@ -158,7 +157,7 @@ void Cht_ShowListOfAvailableChatRooms (void) case Rol_STD: sprintf (ThisRoomFullName,"%s (%s)", Txt_General,Txt_ROLES_PLURAL_abc[Rol_STD][Usr_SEX_ALL]); - Cht_WriteLinkToChat1 ("GBL_STD",Txt_Students_ABBREVIATION,ThisRoomFullName,1,IsLastItemInLevel); + Cht_WriteLinkToChat1 ("GBL_STD",Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD],ThisRoomFullName,1,IsLastItemInLevel); fprintf (Gbl.F.Out,"\"%s\"", @@ -170,7 +169,7 @@ void Cht_ShowListOfAvailableChatRooms (void) case Rol_TCH: sprintf (ThisRoomFullName,"%s (%s)", Txt_General,Txt_ROLES_PLURAL_abc[Rol_TCH][Usr_SEX_ALL]); - Cht_WriteLinkToChat1 ("GBL_TCH",Txt_Teachers_ABBREVIATION,ThisRoomFullName,1,IsLastItemInLevel); + Cht_WriteLinkToChat1 ("GBL_TCH",Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH],ThisRoomFullName,1,IsLastItemInLevel); fprintf (Gbl.F.Out,"\"%s\"", @@ -392,8 +391,7 @@ void Cht_OpenChatWindow (void) extern const char *Txt_SEX_PLURAL_abc[Usr_NUM_SEXS]; extern const char *Txt_General; extern const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; - extern const char *Txt_Students_ABBREVIATION; - extern const char *Txt_Teachers_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_Degree; extern const char *Txt_Course; char RoomCode[Cht_MAX_BYTES_ROOM_CODE + 1]; @@ -471,7 +469,7 @@ void Cht_OpenChatWindow (void) Str_Concat (ListRoomCodes,"|#GBL_STD", Cht_MAX_BYTES_ROOM_CODES); - sprintf (RoomShrtName,"|%s",Txt_Students_ABBREVIATION); + sprintf (RoomShrtName,"|%s",Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD]); Str_Concat (ListRoomShrtNames,RoomShrtName, Cht_MAX_BYTES_ROOM_SHRT_NAMES); @@ -488,7 +486,7 @@ void Cht_OpenChatWindow (void) Str_Concat (ListRoomCodes,"|#GBL_TCH", Cht_MAX_BYTES_ROOM_CODES); - sprintf (RoomShrtName,"|%s",Txt_Teachers_ABBREVIATION); + sprintf (RoomShrtName,"|%s",Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH]); Str_Concat (ListRoomShrtNames,RoomShrtName, Cht_MAX_BYTES_ROOM_SHRT_NAMES); diff --git a/swad_country.c b/swad_country.c index 5d8cb2e5..47805c1c 100644 --- a/swad_country.c +++ b/swad_country.c @@ -620,8 +620,7 @@ static void Cty_PutHeadCountriesForSeeing (bool OrderSelectable) extern const char *Txt_Centres_ABBREVIATION; extern const char *Txt_Degrees_ABBREVIATION; extern const char *Txt_Courses_ABBREVIATION; - extern const char *Txt_Teachers_ABBREVIATION; - extern const char *Txt_Students_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; Cty_Order_t Order; fprintf (Gbl.F.Out,"" @@ -671,7 +670,8 @@ static void Cty_PutHeadCountriesForSeeing (bool OrderSelectable) Txt_Centres_ABBREVIATION, Txt_Degrees_ABBREVIATION, Txt_Courses_ABBREVIATION, - Txt_Teachers_ABBREVIATION,Txt_Students_ABBREVIATION); + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH], + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD]); } /*****************************************************************************/ diff --git a/swad_course.c b/swad_course.c index 66b2ed11..5d753d9d 100644 --- a/swad_course.c +++ b/swad_course.c @@ -1724,8 +1724,7 @@ static void Crs_PutHeadCoursesForSeeing (void) extern const char *Txt_Institutional_BR_code; extern const char *Txt_Year_OF_A_DEGREE; extern const char *Txt_Course; - extern const char *Txt_Teachers_ABBREVIATION; - extern const char *Txt_Students_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; fprintf (Gbl.F.Out,"" "" @@ -1750,8 +1749,8 @@ static void Crs_PutHeadCoursesForSeeing (void) Txt_Institutional_BR_code, Txt_Year_OF_A_DEGREE, Txt_Course, - Txt_Teachers_ABBREVIATION, - Txt_Students_ABBREVIATION); + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH], + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD]); } /*****************************************************************************/ @@ -1766,8 +1765,7 @@ static void Crs_PutHeadCoursesForEdition (void) extern const char *Txt_Year_OF_A_DEGREE; extern const char *Txt_Short_name_of_the_course; extern const char *Txt_Full_name_of_the_course; - extern const char *Txt_Teachers_ABBREVIATION; - extern const char *Txt_Students_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_Requester; fprintf (Gbl.F.Out,"" @@ -1804,8 +1802,8 @@ static void Crs_PutHeadCoursesForEdition (void) Txt_Year_OF_A_DEGREE, Txt_Short_name_of_the_course, Txt_Full_name_of_the_course, - Txt_Teachers_ABBREVIATION, - Txt_Students_ABBREVIATION, + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH], + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD], Txt_Requester); } @@ -2963,8 +2961,7 @@ void Crs_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role) extern const char *Txt_Degree; extern const char *Txt_Year_OF_A_DEGREE; extern const char *Txt_Course; - extern const char *Txt_Teachers_ABBREVIATION; - extern const char *Txt_Students_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; char SubQuery[32]; char Query[1024]; MYSQL_RES *mysql_res; @@ -3023,8 +3020,8 @@ void Crs_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role) Txt_Degree, Txt_Year_OF_A_DEGREE, Txt_Course, - Txt_Teachers_ABBREVIATION, - Txt_Students_ABBREVIATION); + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH], + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD]); /* Write courses */ for (NumCrs = 1; @@ -3058,8 +3055,7 @@ unsigned Crs_ListCrssFound (const char *Query) extern const char *Txt_Degree; extern const char *Txt_Year_OF_A_DEGREE; extern const char *Txt_Course; - extern const char *Txt_Students_ABBREVIATION; - extern const char *Txt_Teachers_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; MYSQL_RES *mysql_res; MYSQL_ROW row; unsigned NumCrss; @@ -3100,8 +3096,8 @@ unsigned Crs_ListCrssFound (const char *Query) Txt_Degree, Txt_Year_OF_A_DEGREE, Txt_Course, - Txt_Students_ABBREVIATION, - Txt_Teachers_ABBREVIATION); + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD], + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH]); /* Write courses */ for (NumCrs = 1; diff --git a/swad_department.c b/swad_department.c index 9099c33f..b79875c6 100644 --- a/swad_department.c +++ b/swad_department.c @@ -973,7 +973,7 @@ static void Dpt_PutHeadDepartments (void) extern const char *Txt_Short_name; extern const char *Txt_Full_name; extern const char *Txt_WWW; - extern const char *Txt_Teachers_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; fprintf (Gbl.F.Out,"" "" @@ -1002,7 +1002,7 @@ static void Dpt_PutHeadDepartments (void) Txt_Short_name, Txt_Full_name, Txt_WWW, - Txt_Teachers_ABBREVIATION); + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH]); } /*****************************************************************************/ diff --git a/swad_enrolment.c b/swad_enrolment.c index f208911f..c1190279 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -2265,7 +2265,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected) extern const char *Txt_Scope; extern const char *Txt_Users; extern const char *Txt_Course; - extern const char *Txt_Teachers_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_Requester; extern const char *Txt_Role; extern const char *Txt_Date; @@ -2802,7 +2802,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected) "" "", Txt_Course, - Txt_Teachers_ABBREVIATION, + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH], Txt_Requester, Txt_Role, Txt_Date); diff --git a/swad_group.c b/swad_group.c index 31a6000a..842b00a1 100644 --- a/swad_group.c +++ b/swad_group.c @@ -104,7 +104,7 @@ static unsigned Grp_CountNumGrpsInThisCrsOfType (long GrpTypCod); static void Grp_GetDataOfGroupTypeByCod (struct GroupType *GrpTyp); static bool Grp_GetMultipleEnrolmentOfAGroupType (long GrpTypCod); static long Grp_GetTypeOfGroupOfAGroup (long GrpCod); -static unsigned Grp_CountNumStdsInNoGrpsOfType (long GrpTypCod); +static unsigned Grp_CountNumUsrsInNoGrpsOfType (Rol_Role_t Role,long GrpTypCod); static long Grp_GetFirstCodGrpStdBelongsTo (long GrpTypCod,long UsrCod); static bool Grp_GetIfGrpIsAvailable (long GrpTypCod); static void Grp_GetLstCodGrpsUsrBelongs (long CrsCod,long GrpTypCod,long UsrCod, @@ -136,7 +136,7 @@ void Grp_WriteNamesOfSelectedGrps (void) { extern const char *Txt_Group; extern const char *Txt_Groups; - extern const char *Txt_students_with_no_group; + extern const char *Txt_users_with_no_group; extern const char *Txt_and; long GrpCod; unsigned NumGrpSel; @@ -164,7 +164,7 @@ void Grp_WriteNamesOfSelectedGrps (void) Grp_GetDataOfGroupTypeByCod (&Gbl.CurrentCrs.Grps.GrpTyp); fprintf (Gbl.F.Out,"%s (%s)", Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName, - Txt_students_with_no_group); + Txt_users_with_no_group); } if (Gbl.CurrentCrs.Grps.LstGrpsSel.NumGrps >= 2) @@ -772,7 +772,7 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant) if (!((GrpTyp->LstGrps[NumGrpThisType]).Open)) ITryToRegisterInAClosedGroup = true; /* Check if the group is full */ - else if ((GrpTyp->LstGrps[NumGrpThisType]).NumStudents >= + else if ((GrpTyp->LstGrps[NumGrpThisType]).NumUsrs[Rol_STD] >= (GrpTyp->LstGrps[NumGrpThisType]).MaxStudents) ITryToRegisterInFullGroup = true; } @@ -1412,6 +1412,7 @@ static void Grp_ListGroupsForEdition (void) struct GroupType *GrpTyp; struct GroupType *GrpTypAux; struct Group *Grp; + Rol_Role_t Role; /***** Write heading *****/ Lay_StartTableWide (2); @@ -1512,6 +1513,15 @@ static void Grp_ListGroupsForEdition (void) Act_FormEnd (); fprintf (Gbl.F.Out,""); + /* Current number of users in this group */ + for (Role = Rol_TCH; + Role >= Rol_STD; + Role--) + fprintf (Gbl.F.Out,"" + "%d" + "", + Grp->NumUsrs[Role]); + /* Maximum number of students of the group (row[3]) */ fprintf (Gbl.F.Out,""); Act_FormStartAnchor (ActChgMaxStdGrp,Grp_GROUPS_SECTION_ID); @@ -1522,14 +1532,8 @@ static void Grp_ListGroupsForEdition (void) fprintf (Gbl.F.Out,"\" onchange=\"document.getElementById('%s').submit();\" />", Gbl.Form.Id); Act_FormEnd (); - fprintf (Gbl.F.Out,""); - - /* Current number of students in this group */ - fprintf (Gbl.F.Out,"" - "%d" - "" - "", - Grp->NumStudents); + fprintf (Gbl.F.Out,"" + ""); } } @@ -1546,8 +1550,9 @@ static void Grp_WriteHeadingGroups (void) extern const char *Txt_Type_BR_of_group; extern const char *Txt_Group_name; extern const char *Txt_eg_A_B; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_Max_BR_students; - extern const char *Txt_Students_ABBREVIATION; + Rol_Role_t Role; fprintf (Gbl.F.Out,"" "" @@ -1558,18 +1563,21 @@ static void Grp_WriteHeadingGroups (void) "" "" "%s
(%s)" - "" - "" - "%s" - "" - "" + "", + Txt_Type_BR_of_group, + Txt_Group_name,Txt_eg_A_B); + for (Role = Rol_TCH; + Role >= Rol_STD; + Role--) + fprintf (Gbl.F.Out,"" + "%s" + "", + Txt_ROLES_PLURAL_BRIEF_Abc[Role]); + fprintf (Gbl.F.Out,"" "%s" "" "", - Txt_Type_BR_of_group, - Txt_Group_name,Txt_eg_A_B, - Txt_Max_BR_students, - Txt_Students_ABBREVIATION); + Txt_Max_BR_students); } /*****************************************************************************/ @@ -1857,7 +1865,7 @@ static bool Grp_ListGrpsForChange (struct GroupType *GrpTyp, if (Grp->Open) // If group is open { if (IBelongToThisGroup || // I belong to group - Grp->NumStudents < Grp->MaxStudents) // Group is not full + Grp->NumUsrs[Rol_STD] < Grp->MaxStudents) // Group is not full ICanChangeMySelection = true; // I can register/unregister in this group else // I don't belong to group and it's full fprintf (Gbl.F.Out," disabled=\"disabled\""); // I can not register in this group @@ -1990,12 +1998,13 @@ static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod) static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp) { - extern const char *Txt_students_with_no_group; + extern const char *Txt_users_with_no_group; unsigned NumGrpThisType; unsigned NumGrpSel; struct ListCodGrps LstGrpsIBelong; bool IBelongToThisGroup; struct Group *Grp; + Rol_Role_t Role; /***** Write heading *****/ Grp_WriteGrpHead (GrpTyp); @@ -2071,20 +2080,24 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp) ""); /* Group name = students with no group */ - fprintf (Gbl.F.Out,"" + fprintf (Gbl.F.Out,"" "" "", - -(GrpTyp->GrpTypCod),Txt_students_with_no_group); + -(GrpTyp->GrpTypCod),Txt_users_with_no_group); /* Number of students who don't belong to any group of this type */ - fprintf (Gbl.F.Out,"" - "%u" - "", - Grp_CountNumStdsInNoGrpsOfType (GrpTyp->GrpTypCod)); + for (Role = Rol_TCH; + Role >= Rol_STD; + Role--) + fprintf (Gbl.F.Out,"" + "%u" + "", + Grp_CountNumUsrsInNoGrpsOfType (Role,GrpTyp->GrpTypCod)); - /* Last column */ + /* Last void columns for max. students and vacants */ fprintf (Gbl.F.Out,"" - ""); + "" + ""); } /*****************************************************************************/ @@ -2097,9 +2110,10 @@ static void Grp_WriteGrpHead (struct GroupType *GrpTyp) extern const char *Txt_Today; extern const char *Txt_Group; extern const char *Txt_Max_BR_students; - extern const char *Txt_Students_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_Vacants; static unsigned UniqueId = 0; + Rol_Role_t Role; /***** Name of group type *****/ fprintf (Gbl.F.Out,"" @@ -2128,20 +2142,23 @@ static void Grp_WriteGrpHead (struct GroupType *GrpTyp) "" "" "%s" - "" - "" - "%s" - "" - "" + "", + Txt_Group); + for (Role = Rol_TCH; + Role >= Rol_STD; + Role--) + fprintf (Gbl.F.Out,"" + "%s" + "", + Txt_ROLES_PLURAL_BRIEF_Abc[Role]); + fprintf (Gbl.F.Out,"" "%s" "" "" "%s" "" "", - Txt_Group, Txt_Max_BR_students, - Txt_Students_ABBREVIATION, Txt_Vacants); } @@ -2154,6 +2171,7 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight) extern const char *Txt_Group_X_open; extern const char *Txt_Group_X_closed; int Vacant; + Rol_Role_t Role; /***** Write icon to show if group is open or closed *****/ sprintf (Gbl.Title,Grp->Open ? Txt_Group_X_open : @@ -2184,6 +2202,20 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight) Grp->GrpCod, Grp->GrpName); + /***** Current number of users in this group *****/ + for (Role = Rol_TCH; + Role >= Rol_STD; + Role--) + { + fprintf (Gbl.F.Out,"" + "%d" + "", + Grp->NumUsrs[Role]); + } + /***** Max. number of students in this group *****/ fprintf (Gbl.F.Out,""); - /***** Current number of students in this group *****/ - fprintf (Gbl.F.Out,"" - "%d" - "", - Grp->NumStudents); - /***** Vacants in this group *****/ fprintf (Gbl.F.Out,""); - if (Grp->MaxStudents > Grp_MAX_STUDENTS_IN_A_GROUP) - fprintf (Gbl.F.Out,"-"); - else + if (Grp->MaxStudents <= Grp_MAX_STUDENTS_IN_A_GROUP) { - Vacant = (int) Grp->MaxStudents - (int) Grp->NumStudents; + Vacant = (int) Grp->MaxStudents - (int) Grp->NumUsrs[Rol_STD]; fprintf (Gbl.F.Out,"%u", Vacant > 0 ? (unsigned) Vacant : 0); @@ -2346,6 +2367,7 @@ static void Grp_PutFormToCreateGroup (void) extern const char *Txt_File_zones_disabled; extern const char *Txt_Create_group; unsigned NumGrpTyp; + Rol_Role_t Role; /***** Start form *****/ Lay_StartSection (Grp_NEW_GROUP_SECTION_ID); @@ -2402,19 +2424,22 @@ static void Grp_PutFormToCreateGroup (void) "", Grp_MAX_CHARS_GROUP_NAME,Gbl.CurrentCrs.Grps.GrpName); + /***** Current number of users in this group *****/ + for (Role = Rol_TCH; + Role >= Rol_STD; + Role--) + fprintf (Gbl.F.Out,"" + "0" + ""); + /***** Maximum number of students *****/ fprintf (Gbl.F.Out,"" "" - ""); - - /***** Current number of students in this group *****/ - fprintf (Gbl.F.Out,"" - "0" // It's a new group ==> 0 students - "" - ""); + "" + ""); /***** Send button and end frame *****/ Lay_EndRoundFrameTableWithButton (Lay_CREATE_BUTTON,Txt_Create_group); @@ -2600,6 +2625,7 @@ void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes) unsigned long NumRows; struct GroupType *GrpTyp; struct Group *Grp; + Rol_Role_t Role; /***** First we get the list of group types *****/ Grp_GetListGrpTypesInThisCrs (WhichGroupTypes); @@ -2640,9 +2666,14 @@ void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes) Str_Copy (Grp->GrpName,row[1], Grp_MAX_BYTES_GROUP_NAME); - /* Get max number of students of group (row[2]) and number of current students */ + /* Get max number of students of group (row[2]) */ Grp->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[2]); - Grp->NumStudents = Grp_CountNumStdsInGrp (Grp->GrpCod); + + /* Get number of current users in group */ + for (Role = Rol_TCH; + Role >= Rol_STD; + Role--) + Grp->NumUsrs[Role] = Grp_CountNumUsrsInGrp (Role,Grp->GrpCod); /* Get whether group is open ('Y') or closed ('N') (row[3]) */ Grp->Open = (row[3][0] == 'Y'); @@ -2938,10 +2969,10 @@ bool Grp_CheckIfGroupBelongsToCourse (long GrpCod,long CrsCod) } /*****************************************************************************/ -/******************** Count number of students in a group ********************/ +/********************* Count number of users in a group **********************/ /*****************************************************************************/ -unsigned Grp_CountNumStdsInGrp (long GrpCod) +unsigned Grp_CountNumUsrsInGrp (Rol_Role_t Role,long GrpCod) { char Query[512]; @@ -2954,23 +2985,23 @@ unsigned Grp_CountNumStdsInGrp (long GrpCod) " AND crs_grp_types.CrsCod=crs_usr.CrsCod" " AND crs_grp_usr.UsrCod=crs_usr.UsrCod" " AND crs_usr.Role=%u", - GrpCod,(unsigned) Rol_STD); + GrpCod,(unsigned) Role); return (unsigned) DB_QueryCOUNT (Query, - "can not get number of students in a group"); + "can not get number of users in a group"); } /*****************************************************************************/ -/** Count # of students of current course not belonging to groups of a type **/ +/*** Count # of users of current course not belonging to groups of a type ****/ /*****************************************************************************/ -static unsigned Grp_CountNumStdsInNoGrpsOfType (long GrpTypCod) +static unsigned Grp_CountNumUsrsInNoGrpsOfType (Rol_Role_t Role,long GrpTypCod) { char Query[512]; MYSQL_RES *mysql_res; MYSQL_ROW row; - unsigned NumStds; + unsigned NumUsrs; - /***** Get number of students not belonging to groups of a type from database ******/ + /***** Get number of users not belonging to groups of a type ******/ sprintf (Query,"SELECT COUNT(UsrCod) FROM crs_usr" " WHERE CrsCod=%ld AND Role=%u" " AND UsrCod NOT IN" @@ -2978,18 +3009,20 @@ static unsigned Grp_CountNumStdsInNoGrpsOfType (long GrpTypCod) " FROM crs_grp,crs_grp_usr" " WHERE crs_grp.GrpTypCod=%ld" " AND crs_grp.GrpCod=crs_grp_usr.GrpCod)", - Gbl.CurrentCrs.Crs.CrsCod,(unsigned) Rol_STD,GrpTypCod); - DB_QuerySELECT (Query,&mysql_res,"can not get the number of students not belonging to groups of a type"); + Gbl.CurrentCrs.Crs.CrsCod,(unsigned) Role,GrpTypCod); + DB_QuerySELECT (Query,&mysql_res,"can not get the number of users" + " not belonging to groups of a type"); - /***** Get the number of students (row[0]) *****/ + /***** Get the number of users (row[0]) *****/ row = mysql_fetch_row (mysql_res); - if (sscanf (row[0],"%u",&NumStds) != 1) - Lay_ShowErrorAndExit ("Error when getting the number of students not belonging to groups of a type."); + if (sscanf (row[0],"%u",&NumUsrs) != 1) + Lay_ShowErrorAndExit ("Error when getting the number of users" + " not belonging to groups of a type."); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); - return NumStds; + return NumUsrs; } /*****************************************************************************/ @@ -3053,12 +3086,13 @@ bool Grp_GetIfIBelongToGrp (long GrpCod) /**** and I don't belong to any of these groups as student *****/ /*****************************************************************************/ -unsigned Grp_NumGrpTypesMandatIDontBelong (void) +unsigned Grp_NumGrpTypesMandatIDontBelongAsStd (void) { char Query[4096]; unsigned NumGrpTypes; - /***** Get the number of types of groups with mandatory enrolment which I don't belong to, from database *****/ + /***** Get the number of types of groups with mandatory enrolment + which I don't belong to as student, from database *****/ sprintf (Query,"SELECT COUNT(DISTINCT GrpTypCod) FROM" " (SELECT crs_grp_types.GrpTypCod AS GrpTypCod," "COUNT(*) AS NumStudents," @@ -3086,7 +3120,9 @@ unsigned Grp_NumGrpTypesMandatIDontBelong (void) (unsigned) Rol_STD, Gbl.CurrentCrs.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); - NumGrpTypes = DB_QueryCOUNT (Query,"can not get the number of types of group of mandatory registration to which you don't belong to"); + NumGrpTypes = DB_QueryCOUNT (Query,"can not get the number of types of group" + " of mandatory registration" + " to which you don't belong to"); return NumGrpTypes; } @@ -3586,7 +3622,7 @@ static void Grp_AskConfirmRemGrp (void) Grp_GetDataOfGroupByCod (&GrpDat); /***** Count number of students in group *****/ - NumStds = Grp_CountNumStdsInGrp (Gbl.CurrentCrs.Grps.GrpCod); + NumStds = Grp_CountNumUsrsInGrp (Rol_STD,Gbl.CurrentCrs.Grps.GrpCod); /***** Show the form to edit group types again *****/ Grp_ReqEditGroupsInternal0 (); @@ -4149,9 +4185,7 @@ void Grp_ChangeMaxStdsGrp (void) static void Grp_WriteMaxStdsGrp (unsigned MaxStudents) { - if (MaxStudents > Grp_MAX_STUDENTS_IN_A_GROUP) - fprintf (Gbl.F.Out,"-"); - else + if (MaxStudents <= Grp_MAX_STUDENTS_IN_A_GROUP) fprintf (Gbl.F.Out,"%u",MaxStudents); } diff --git a/swad_group.h b/swad_group.h index e2910ffb..7339fe17 100644 --- a/swad_group.h +++ b/swad_group.h @@ -73,8 +73,8 @@ struct Group { long GrpCod; // Code of group char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1]; // Name of group + unsigned NumUsrs[Rol_NUM_ROLES]; // Number of users in the group unsigned MaxStudents; - unsigned NumStudents; // Number of students in the group bool Open; // Group is open? bool FileZones; // Group has file zones? bool ShowFileZone; // Show file zone of this group? @@ -165,9 +165,9 @@ unsigned long Grp_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res); void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat); bool Grp_CheckIfGroupExists (long GrpCod); bool Grp_CheckIfGroupBelongsToCourse (long GrpCod,long CrsCod); -unsigned Grp_CountNumStdsInGrp (long GrpCod); +unsigned Grp_CountNumUsrsInGrp (Rol_Role_t Role,long GrpCod); bool Grp_GetIfIBelongToGrp (long GrpCod); -unsigned Grp_NumGrpTypesMandatIDontBelong (void); +unsigned Grp_NumGrpTypesMandatIDontBelongAsStd (void); void Grp_GetLstCodGrpsWithFileZonesIBelong (struct ListCodGrps *LstGrps); void Grp_GetNamesGrpsStdBelongsTo (long GrpTypCod,long UsrCod,char *GrpNames); void Grp_RecFormNewGrpTyp (void); diff --git a/swad_indicator.c b/swad_indicator.c index a99ab4b9..8ee21d8b 100644 --- a/swad_indicator.c +++ b/swad_indicator.c @@ -677,8 +677,7 @@ static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t Indicat extern const char *Txt_Course; extern const char *Txt_Institutional_BR_code; extern const char *Txt_Web_page_of_the_course; - extern const char *Txt_Teachers_ABBREVIATION; - extern const char *Txt_Students_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_Indicators; extern const char *Txt_No_INDEX; extern const char *Txt_Syllabus_of_the_course; @@ -930,8 +929,8 @@ static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t Indicat Txt_Course, Txt_Institutional_BR_code, Txt_Web_page_of_the_course, - Txt_Teachers_ABBREVIATION, - Txt_Students_ABBREVIATION, + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH], + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD], Txt_Indicators, Txt_No_INDEX, diff --git a/swad_institution.c b/swad_institution.c index f7213df9..9e5958e6 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -828,8 +828,7 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable) { extern const char *Txt_INSTITUTIONS_HELP_ORDER[2]; extern const char *Txt_INSTITUTIONS_ORDER[2]; - extern const char *Txt_Teachers_ABBREVIATION; - extern const char *Txt_Students_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_Centres_ABBREVIATION; extern const char *Txt_Degrees_ABBREVIATION; extern const char *Txt_Courses_ABBREVIATION; @@ -885,7 +884,8 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable) Txt_Degrees_ABBREVIATION, Txt_Courses_ABBREVIATION, Txt_Departments_ABBREVIATION, - Txt_Teachers_ABBREVIATION,Txt_Students_ABBREVIATION); + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH], + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD]); } /*****************************************************************************/ @@ -2240,8 +2240,7 @@ static void Ins_PutHeadInstitutionsForEdition (void) extern const char *Txt_WWW; extern const char *Txt_Users; extern const char *Txt_Centres_ABBREVIATION; - extern const char *Txt_Teachers_ABBREVIATION; - extern const char *Txt_Students_ABBREVIATION; + extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_Requester; fprintf (Gbl.F.Out,"" @@ -2280,7 +2279,8 @@ static void Ins_PutHeadInstitutionsForEdition (void) Txt_WWW, Txt_Users, Txt_Centres_ABBREVIATION, - Txt_Teachers_ABBREVIATION,Txt_Students_ABBREVIATION, + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_TCH], + Txt_ROLES_PLURAL_BRIEF_Abc[Rol_STD], Txt_Requester); } diff --git a/swad_mark.c b/swad_mark.c index c4b71ed9..b7b357b4 100644 --- a/swad_mark.c +++ b/swad_mark.c @@ -629,7 +629,7 @@ void Mrk_ShowMyMarks (void) /* Select a random student from the course */ if (Gbl.CurrentCrs.Grps.GrpCod > 0) // Group zone { - if (Grp_CountNumStdsInGrp (Gbl.CurrentCrs.Grps.GrpCod)) + if (Grp_CountNumUsrsInGrp (Rol_STD,Gbl.CurrentCrs.Grps.GrpCod)) { Gbl.Usrs.Other.UsrDat.UsrCod = Usr_GetRamdomStdFromGrp (Gbl.CurrentCrs.Grps.GrpCod); UsrDat = &Gbl.Usrs.Other.UsrDat; diff --git a/swad_text.c b/swad_text.c index 0910bb39..8bfeaed3 100644 --- a/swad_text.c +++ b/swad_text.c @@ -17852,23 +17852,23 @@ const char *Txt_Max_levels = const char *Txt_Max_BR_students = #if L==1 - "Màxim
d'estud."; + "Màxim
d'est."; #elif L==2 "Max.
Stud."; #elif L==3 "Max.
stud."; #elif L==4 - "Máx.
estud."; + "Máx.
estu."; #elif L==5 "Max.
étud."; #elif L==6 - "Máx.
estud."; // Okoteve traducción + "Máx.
estu."; // Okoteve traducción #elif L==7 "Max.
stud."; #elif L==8 "Max.
stud."; #elif L==9 - "Máx.
estud."; + "Máx.
estu."; #endif const char *Txt_maximum = @@ -34589,7 +34589,212 @@ const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS] = #elif L==9 "Superutilizadores" #endif - } }; + } + }; + +const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES] = + { +#if L==1 // Rol_UNK + "Desc." +#elif L==2 + "Unbe." +#elif L==3 + "Unkn." +#elif L==4 + "Desc." +#elif L==5 + "Inco." +#elif L==6 + "Desc." // Okoteve traducción +#elif L==7 + "Scon." +#elif L==8 + "Niez." +#elif L==9 + "Desc." +#endif + , +#if L==1 // Rol_GST + "Conv." +#elif L==2 + "Eing." +#elif L==3 + "Gues." +#elif L==4 + "Invi." +#elif L==5 + "Invi." +#elif L==6 + "Invi." // Okoteve traducción +#elif L==7 + "Ospi." +#elif L==8 + "Zapr." +#elif L==9 + "Conv." +#endif + , +#if L==1 // Rol_USR + "Usua." +#elif L==2 + "Benu." +#elif L==3 + "Users" +#elif L==4 + "Usua." +#elif L==5 + "Util." +#elif L==6 + "Puru." +#elif L==7 + "Uten." +#elif L==8 + "Użyt." +#elif L==9 + "Util." +#endif + , +#if L==1 // Rol_STD + "Estu." +#elif L==2 + "Stud." +#elif L==3 + "Stud." +#elif L==4 + "Estu." +#elif L==5 + "Étu." +#elif L==6 + "Temi." +#elif L==7 + "Stud." +#elif L==8 + "Stud." +#elif L==9 + "Estu." +#endif + , +#if L==1 // Rol_NET + "Prof.n.e." +#elif L==2 + "N.b.Lehr." +#elif L==3 + "N.e.teac." +#elif L==4 + "Prof.n.e." +#elif L==5 + "Ense.n.é." +#elif L==6 + "Mbo'e.n.e." // Okoteve traducción +#elif L==7 + "Prof.n.e." +#elif L==8 + "Nauc.n.e." +#elif L==9 + "Prof.n.e." +#endif + , +#if L==1 // Rol_TCH + "Prof." +#elif L==2 + "Lehr." +#elif L==3 + "Teac." +#elif L==4 + "Prof." +#elif L==5 + "Ense." +#elif L==6 + "Mbo'e." +#elif L==7 + "Prof." +#elif L==8 + "Nauc." +#elif L==9 + "Prof." +#endif + , +#if L==1 // Rol_DEG_ADM + "Admi." +#elif L==2 + "Admi." +#elif L==3 + "Admi." +#elif L==4 + "Admi." +#elif L==5 + "Admi." +#elif L==6 + "Ñang." +#elif L==7 + "Ammi." +#elif L==8 + "Admi." +#elif L==9 + "Admi." +#endif + , +#if L==1 // Rol_CTR_ADM + "Admi." +#elif L==2 + "Admi." +#elif L==3 + "Admi." +#elif L==4 + "Admi." +#elif L==5 + "Admi." +#elif L==6 + "Ñang." +#elif L==7 + "Ammi." +#elif L==8 + "Admi." +#elif L==9 + "Admi." +#endif + , +#if L==1 // Rol_INS_ADM + "Admi." +#elif L==2 + "Admi." +#elif L==3 + "Admi." +#elif L==4 + "Admi." +#elif L==5 + "Admi." +#elif L==6 + "Ñang." +#elif L==7 + "Ammi." +#elif L==8 + "Admi." +#elif L==9 + "Admi." +#endif + , +#if L==1 // Rol_SYS_ADM + "Supe." +#elif L==2 + "Supe." +#elif L==3 + "Supe." +#elif L==4 + "Supe." +#elif L==5 + "Supe." +#elif L==6 + "Supe." // Okoteve traducción +#elif L==7 + "Supe." +#elif L==8 + "Supe." +#elif L==9 + "Supe." +#endif + }; + const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS] = { @@ -35402,7 +35607,8 @@ const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS] = #elif L==9 "superutilizadores" #endif - } }; + } + }; const char *Txt_Rooms_with_users = #if L==1 @@ -40166,27 +40372,6 @@ const char *Txt_Student_comment = "Comentário do estudante"; #endif -const char *Txt_Students_ABBREVIATION = // Abbreviation of "Students" -#if L==1 - "Estu."; -#elif L==2 - "Stud."; -#elif L==3 - "Stud."; -#elif L==4 - "Estu."; -#elif L==5 - "Étu."; -#elif L==6 - "Temi."; -#elif L==7 - "Stud."; -#elif L==8 - "Stud."; // Potrzebujesz tlumaczenie -#elif L==9 - "Estu."; -#endif - const char *Txt_students_ABBREVIATION = // Abbreviation of "students" #if L==1 "estu."; @@ -40352,27 +40537,6 @@ const char *Txt_X_students_who_have_accepted_and_who_have_email = // Warning: it " e que têm email (%.1f%% dos %u estudantes)"; #endif -const char *Txt_students_with_no_group = -#if L==1 - "estudiantes en ningún grupo"; // Necessita traduccio -#elif L==2 - "Studente mit nicht-Gruppe"; -#elif L==3 - "students with no group"; -#elif L==4 - "estudiantes en ningún grupo"; -#elif L==5 - "étudiants avec aucun groupe"; -#elif L==6 - "estudiantes en ningún grupo"; // Okoteve traducción -#elif L==7 - "studenti con nessun gruppo"; -#elif L==8 - "students with no group"; // Potrzebujesz tlumaczenie -#elif L==9 - "estudantes com nenhum grupo"; -#endif - const char *Txt_Surname_1 = #if L==1 "Primer cognom"; @@ -41485,27 +41649,6 @@ const char *Txt_Take_a_test = "Fazer um teste"; #endif -const char *Txt_Teachers_ABBREVIATION = // Abbreviation of "Teachers" -#if L==1 - "Prof."; -#elif L==2 - "Lehr."; -#elif L==3 - "Teac."; -#elif L==4 - "Prof."; -#elif L==5 - "Ense."; -#elif L==6 - "Prof."; // Okoteve traducción -#elif L==7 - "Prof."; -#elif L==8 - "Nauc."; -#elif L==9 - "Prof."; -#endif - const char *Txt_teachers_ABBREVIATION = // Abbreviation of "Teachers" #if L==1 "prof."; @@ -50435,6 +50578,27 @@ const char *Txt_Users_of_the_institution = "Utilizadores da institução"; #endif +const char *Txt_users_with_no_group = +#if L==1 + "usuaris en cap grup"; +#elif L==2 + "Benutzer mit nicht-Gruppe"; +#elif L==3 + "users with no group"; +#elif L==4 + "usuarios en ningún grupo"; +#elif L==5 + "utilisateurs avec aucun groupe"; +#elif L==6 + "usuarios en ningún grupo"; // Okoteve traducción +#elif L==7 + "utenti con nessun gruppo"; +#elif L==8 + "użytkowników w każdej grupie"; +#elif L==9 + "utilizadores com nenhum grupo"; +#endif + const char *Txt_usr = // Abbreviation of user (three characters + dot) #if L==1 "usr."; // Necessita traduccio @@ -50517,7 +50681,7 @@ const char *Txt_Vacants = #elif L==7 "Liberi"; #elif L==8 - "Vacants"; // Potrzebujesz tlumaczenie + "Wolne"; #elif L==9 "Desocupados"; #endif diff --git a/swad_web_service.c b/swad_web_service.c index fd6c8274..41864bbc 100644 --- a/swad_web_service.c +++ b/swad_web_service.c @@ -1821,7 +1821,7 @@ int swad__getGroups (struct soap *soap, (int) MaxStudents; /* Get number of current students */ - getGroupsOut->groupsArray.__ptr[NumRow].numStudents = (int) Grp_CountNumStdsInGrp (GrpCod); + getGroupsOut->groupsArray.__ptr[NumRow].numStudents = (int) Grp_CountNumUsrsInGrp (Rol_STD,GrpCod); /* Get whether group is open ('Y') or closed ('N') (row[5]) */ getGroupsOut->groupsArray.__ptr[NumRow].open = (row[5][0] == 'Y') ? 1 : @@ -1983,7 +1983,7 @@ int swad__sendMyGroups (struct soap *soap, (int) MaxStudents; /* Get number of current students */ - SendMyGroupsOut->groupsArray.__ptr[NumRow].numStudents = (int) Grp_CountNumStdsInGrp (GrpCod); + SendMyGroupsOut->groupsArray.__ptr[NumRow].numStudents = (int) Grp_CountNumUsrsInGrp (Rol_STD,GrpCod); /* Get whether group is open ('Y') or closed ('N') (row[5]) */ SendMyGroupsOut->groupsArray.__ptr[NumRow].open = (row[5][0] == 'Y') ? 1 :