From 3cb1af22de5a699d122ee91426db1076ae5ac558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Fri, 4 Jan 2019 12:53:40 +0100 Subject: [PATCH] Version 18.27.5 --- swad_changelog.h | 3 +- swad_classroom.c | 64 ++++++++++++------- swad_classroom.h | 12 +++- swad_global.h | 1 + swad_group.c | 49 ++++++++++++-- swad_text.c | 163 ++++++++++++++++++++++++++--------------------- 6 files changed, 191 insertions(+), 101 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index a8396c234..04483edd0 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -364,10 +364,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.27.4 (2019-01-04)" +#define Log_PLATFORM_VERSION "SWAD 18.27.5 (2019-01-04)" #define CSS_FILE "swad18.22.css" #define JS_FILE "swad17.17.1.js" /* + Version 18.27.5: Jan 04, 2019 Selection of classroom in form to create group. (238964 lines) Version 18.27.4: Jan 04, 2019 New field in groups table to select a classroom. (238881 lines) 1 change necessary in database: ALTER TABLE crs_grp ADD COLUMN ClaCod INT NOT NULL DEFAULT -1 AFTER GrpName,ADD INDEX (ClaCod); diff --git a/swad_classroom.c b/swad_classroom.c index 991cb4118..74d7a59e0 100644 --- a/swad_classroom.c +++ b/swad_classroom.c @@ -97,7 +97,7 @@ void Cla_SeeClassrooms (void) Cla_GetParamClaOrder (); /***** Get list of classrooms *****/ - Cla_GetListClassrooms (); + Cla_GetListClassrooms (Cla_ALL_DATA); /***** Table head *****/ Box_StartBox (NULL,Txt_Classrooms,Cla_PutIconsListingClassrooms, @@ -229,7 +229,7 @@ void Cla_EditClassrooms (void) extern const char *Txt_Classrooms; /***** Get list of classrooms *****/ - Cla_GetListClassrooms (); + Cla_GetListClassrooms (Cla_ALL_DATA); /***** Start box *****/ Box_StartBox (NULL,Txt_Classrooms,Cla_PutIconsEditingClassrooms, @@ -278,7 +278,7 @@ void Cla_PutIconToViewClassrooms (void) /************************** List all the classrooms **************************/ /*****************************************************************************/ -void Cla_GetListClassrooms (void) +void Cla_GetListClassrooms (Cla_WhichData_t WhichData) { static const char *OrderBySubQuery[Cla_NUM_ORDERS] = { @@ -294,17 +294,32 @@ void Cla_GetListClassrooms (void) struct Classroom *Cla; /***** Get classrooms from database *****/ - NumRows = DB_QuerySELECT (&mysql_res,"can not get classrooms", - "SELECT ClaCod," - "ShortName," - "FullName," - "Capacity," - "Location" - " FROM classrooms" - " WHERE CtrCod=%ld" - " ORDER BY %s", - Gbl.CurrentCtr.Ctr.CtrCod, - OrderBySubQuery[Gbl.Classrooms.SelectedOrder]); + switch (WhichData) + { + case Cla_ALL_DATA: + NumRows = DB_QuerySELECT (&mysql_res,"can not get classrooms", + "SELECT ClaCod," + "ShortName," + "FullName," + "Capacity," + "Location" + " FROM classrooms" + " WHERE CtrCod=%ld" + " ORDER BY %s", + Gbl.CurrentCtr.Ctr.CtrCod, + OrderBySubQuery[Gbl.Classrooms.SelectedOrder]); + break; + case Cla_ONLY_SHRT_NAME: + default: + NumRows = DB_QuerySELECT (&mysql_res,"can not get classrooms", + "SELECT ClaCod," + "ShortName" + " FROM classrooms" + " WHERE CtrCod=%ld" + " ORDER BY ShortName", + Gbl.CurrentCtr.Ctr.CtrCod); + break; + } /***** Count number of rows in result *****/ if (NumRows) // Classrooms found... @@ -333,17 +348,20 @@ void Cla_GetListClassrooms (void) Str_Copy (Cla->ShrtName,row[1], Cla_MAX_BYTES_SHRT_NAME); - /* Get the full name of the classroom (row[2]) */ - Str_Copy (Cla->FullName,row[2], - Cla_MAX_BYTES_FULL_NAME); + if (WhichData == Cla_ALL_DATA) + { + /* Get the full name of the classroom (row[2]) */ + Str_Copy (Cla->FullName,row[2], + Cla_MAX_BYTES_FULL_NAME); - /* Get seating capacity in this classroom (row[3]) */ - if (sscanf (row[3],"%u",&Cla->Capacity) != 1) - Cla->Capacity = Cla_UNLIMITED_CAPACITY; + /* Get seating capacity in this classroom (row[3]) */ + if (sscanf (row[3],"%u",&Cla->Capacity) != 1) + Cla->Capacity = Cla_UNLIMITED_CAPACITY; - /* Get the full name of the classroom (row[4]) */ - Str_Copy (Cla->Location,row[4], - Cla_MAX_BYTES_LOCATION); + /* Get the full name of the classroom (row[4]) */ + Str_Copy (Cla->Location,row[4], + Cla_MAX_BYTES_LOCATION); + } } } else diff --git a/swad_classroom.h b/swad_classroom.h index 8856a725f..88a22f3f1 100644 --- a/swad_classroom.h +++ b/swad_classroom.h @@ -66,6 +66,13 @@ typedef enum } Cla_Order_t; #define Cla_ORDER_DEFAULT Cla_ORDER_BY_LOCATION +/***** Get all data or only short name *****/ +typedef enum + { + Cla_ALL_DATA, + Cla_ONLY_SHRT_NAME, + } Cla_WhichData_t; + /*****************************************************************************/ /***************************** Public prototypes *****************************/ /*****************************************************************************/ @@ -73,8 +80,11 @@ typedef enum void Cla_SeeClassrooms (void); void Cla_EditClassrooms (void); void Cla_PutIconToViewClassrooms (void); -void Cla_GetListClassrooms (void); +void Cla_GetListClassrooms (Cla_WhichData_t WhichData); void Cla_FreeListClassrooms (void); + +void Cla_GetListClassroomsInThisCtr (void); + void Cla_GetDataOfClassroomByCod (struct Classroom *Cla); long Cla_GetParamClaCod (void); diff --git a/swad_global.h b/swad_global.h index 18c617086..be952ca90 100644 --- a/swad_global.h +++ b/swad_global.h @@ -475,6 +475,7 @@ struct Globals struct GroupType GrpTyp; long GrpCod; // Group to be edited, removed... char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1]; + long ClaCod; unsigned MaxStudents; bool Open; bool FileZones; diff --git a/swad_group.c b/swad_group.c index 33187c9cd..eff9459c9 100644 --- a/swad_group.c +++ b/swad_group.c @@ -232,6 +232,9 @@ static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,cons /***** Get list of groups types and groups in this course *****/ Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ALL_GROUP_TYPES); + /***** Get list of classrooms in this centre *****/ + Cla_GetListClassrooms (Cla_ONLY_SHRT_NAME); + /***** Show optional alert *****/ if (MessageGroupTypes) if (MessageGroupTypes[0]) @@ -261,6 +264,9 @@ static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups,const ch /***** End groups section *****/ Lay_EndSection (); + /***** Free list of classrooms in this centre *****/ + Cla_FreeListClassrooms (); + /***** Free list of groups types and groups in this course *****/ Grp_FreeListGrpTypesAndGrps (); } @@ -1572,7 +1578,7 @@ static void Grp_ListGroupsForEdition (void) fprintf (Gbl.F.Out,""); Frm_StartFormAnchor (ActChgGrpTyp,Grp_GROUPS_SECTION_ID); Grp_PutParamGrpCod (Grp->GrpCod); - fprintf (Gbl.F.Out,"", Grp_MAX_CHARS_GROUP_NAME,Grp->GrpName,Gbl.Form.Id); Frm_EndForm (); @@ -1637,6 +1643,7 @@ 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_Classroom; extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_Max_BR_students; Rol_Role_t Role; @@ -1650,9 +1657,13 @@ static void Grp_WriteHeadingGroups (void) "" "" "%s
(%s)" + "" + "" + "%s" "", Txt_Type_BR_of_group, - Txt_Group_name,Txt_eg_A_B); + Txt_Group_name,Txt_eg_A_B, + Txt_Classroom); for (Role = Rol_TCH; Role >= Rol_STD; Role--) @@ -2583,8 +2594,10 @@ static void Grp_PutFormToCreateGroup (void) extern const char *Txt_New_group; extern const char *Txt_Group_closed; extern const char *Txt_File_zones_disabled; + extern const char *Txt_Another_classroom; extern const char *Txt_Create_group; unsigned NumGrpTyp; + unsigned NumCla; Rol_Role_t Role; /***** Start form *****/ @@ -2620,7 +2633,7 @@ static void Grp_PutFormToCreateGroup (void) /***** Group type *****/ fprintf (Gbl.F.Out,"" - ""); for (NumGrpTyp = 0; NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num; NumGrpTyp++) @@ -2638,11 +2651,37 @@ static void Grp_PutFormToCreateGroup (void) /***** Group name *****/ fprintf (Gbl.F.Out,"" "" "", Grp_MAX_CHARS_GROUP_NAME,Gbl.CurrentCrs.Grps.GrpName); + /***** Classroom *****/ + fprintf (Gbl.F.Out,"" + "" + ""); + /***** Current number of users in this group *****/ for (Role = Rol_TCH; Role >= Rol_STD; diff --git a/swad_text.c b/swad_text.c index b58b8019e..ac86a7aac 100644 --- a/swad_text.c +++ b/swad_text.c @@ -1642,6 +1642,27 @@ const char *Txt_Another_centre = "Outro centro"; #endif +const char *Txt_Another_classroom = +#if L==1 // ca + "Una altra aula"; +#elif L==2 // de + "Eine weitere Klassenzimmer"; +#elif L==3 // en + "Another classroom"; +#elif L==4 // es + "Otra aula"; +#elif L==5 // fr + "Un autre salle de classe"; +#elif L==6 // gn + "Otra aula"; // Okoteve traducción +#elif L==7 // it + "Un'altra aula"; +#elif L==8 // pl + "Kolejna klasa"; +#elif L==9 // pt + "Outra sala de aula"; +#endif + const char *Txt_Another_country = #if L==1 // ca "Un altre país"; @@ -1705,6 +1726,48 @@ const char *Txt_Another_ID = "Outro nº de identif."; #endif +const char *Txt_Another_institution = +#if L==1 // ca + "Una altra institució"; +#elif L==2 // de + "Eine weitere Hochschule"; +#elif L==3 // en + "Another institution"; +#elif L==4 // es + "Otra institución"; +#elif L==5 // fr + "Un autre établissement"; +#elif L==6 // gn + "Otra institución"; // Okoteve traducción +#elif L==7 // it + "Un'altra istituzione"; +#elif L==8 // pl + "Kolejna instytucja"; +#elif L==9 // pt + "Outra instituição"; +#endif + +const char *Txt_Another_place = +#if L==1 // ca + "Un altre lloc"; +#elif L==2 // de + "Ein weiterer Standort"; +#elif L==3 // en + "Another place"; +#elif L==4 // es + "Otro lugar"; +#elif L==5 // fr + "Un autre emplacement"; +#elif L==6 // gn + "Otro lugar"; // Okoteve traducción +#elif L==7 // it + "Un'altra localit`"; +#elif L==8 // pl + "Innym miejscem"; +#elif L==9 // pt + "Outra localização"; +#endif + const char *Txt_Another_user_s_profile = #if L==1 // ca "Perfil d'un altre usuari"; @@ -1831,48 +1894,6 @@ const char *Txt_Announcement_removed = "Anúncio removido."; #endif -const char *Txt_Another_institution = -#if L==1 // ca - "Una altra institució"; -#elif L==2 // de - "Eine weitere Hochschule"; -#elif L==3 // en - "Another institution"; -#elif L==4 // es - "Otra institución"; -#elif L==5 // fr - "Un autre établissement"; -#elif L==6 // gn - "Otra institución"; // Okoteve traducción -#elif L==7 // it - "Un'altra istituzione"; -#elif L==8 // pl - "Kolejna instytucja"; -#elif L==9 // pt - "Outra instituição"; -#endif - -const char *Txt_Another_place = -#if L==1 // ca - "Un altre lloc"; -#elif L==2 // de - "Ein weiterer Standort"; -#elif L==3 // en - "Another place"; -#elif L==4 // es - "Otro lugar"; -#elif L==5 // fr - "Un autre emplacement"; -#elif L==6 // gn - "Otro lugar"; // Okoteve traducción -#elif L==7 // it - "Un'altra localit`"; -#elif L==8 // pl - "Innym miejscem"; -#elif L==9 // pt - "Outra localização"; -#endif - const char *Txt_Answer_survey = #if L==1 // ca "Respondre enquesta"; @@ -5403,7 +5424,7 @@ const char *Txt_Create_another_centre = #elif L==7 // it "Crea un altro centro"; #elif L==8 // pl - "Tworzenie inny centrum"; + "Utwórz inny centrum"; #elif L==9 // pt "Criar outro centro"; #endif @@ -5424,7 +5445,7 @@ const char *Txt_Create_another_course = #elif L==7 // it "Crea un altro corso"; #elif L==8 // pl - "Tworzenie inny kursu"; + "Utwórz inny kursu"; #elif L==9 // pt "Criar outra disciplina"; #endif @@ -5445,7 +5466,7 @@ const char *Txt_Create_another_degree = #elif L==7 // it "Crea una altra laurea"; #elif L==8 // pl - "Tworzenie inny stopnia"; + "Utwórz inny stopnia"; #elif L==9 // pt "Criar outro grau"; #endif @@ -5466,7 +5487,7 @@ const char *Txt_Create_another_institution = #elif L==7 // it "Crea una altra istituzione"; #elif L==8 // pl - "Tworzenie inny instytucji"; + "Utwórz inny instytucji"; #elif L==9 // pt "Criar outra institução"; #endif @@ -5487,7 +5508,7 @@ const char *Txt_Create_another_type_of_degree = #elif L==7 // it "Crea un altro tipo di laurea"; #elif L==8 // pl - "Tworzenie inny typu stopnia"; + "Utwórz inny typu stopnia"; #elif L==9 // pt "Criar outro tipo de grau"; #endif @@ -5550,7 +5571,7 @@ const char *Txt_Create_centre = #elif L==7 // it "Crea centro"; #elif L==8 // pl - "Tworzenie centrum"; + "Utwórz centrum"; #elif L==9 // pt "Criar centro"; #endif @@ -5571,7 +5592,7 @@ const char *Txt_Create_classroom = #elif L==7 // it "Crea aula"; #elif L==8 // pl - "Tworzenie klasa"; + "Utwórz klasa"; #elif L==9 // pt "Criar sala de aula"; #endif @@ -5592,7 +5613,7 @@ const char *Txt_Create_country = #elif L==7 // it "Crea paese"; #elif L==8 // pl - "Tworzenie kraju"; + "Utwórz kraju"; #elif L==9 // pt "Criar país"; #endif @@ -5613,7 +5634,7 @@ const char *Txt_Create_course = #elif L==7 // it "Crea corso"; #elif L==8 // pl - "Tworzenie kursu"; + "Utwórz kursu"; #elif L==9 // pt "Criar disciplina"; #endif @@ -5634,7 +5655,7 @@ const char *Txt_Create_degree = #elif L==7 // it "Crea laurea"; #elif L==8 // pl - "Tworzenie stopnia"; + "Utwórz stopnia"; #elif L==9 // pt "Criar grau"; #endif @@ -5655,7 +5676,7 @@ const char *Txt_Create_department = #elif L==7 // it "Crea dipartimento"; #elif L==8 // pl - "Tworzenie działu"; + "Utwórz działu"; #elif L==9 // pt "Criar departamento"; #endif @@ -5676,7 +5697,7 @@ const char *Txt_Create_email_domain = #elif L==7 // it "Crea campo mail"; #elif L==8 // pl - "Tworzenie domeny mail"; + "Utwórz domeny mail"; #elif L==9 // pt "Criar domínio de email"; #endif @@ -5697,7 +5718,7 @@ const char *Txt_Create_email_message = #elif L==7 // it "Crea messaggio email"; #elif L==8 // pl - "Tworzenie wiadomosci email"; + "Utwórz wiadomosci email"; #elif L==9 // pt "Criar uma mensagem de email"; #endif @@ -5760,14 +5781,14 @@ const char *Txt_Create_game = #elif L==7 // it "Crea gioco"; #elif L==8 // pl - "Tworzenie gra"; + "Utwórz gra"; #elif L==9 // pt "Criar jogo"; #endif const char *Txt_Create_group = #if L==1 // ca - "Crear grupo"; // Necessita traduccio + "Crear grup"; #elif L==2 // de "Gruppe erstellen"; #elif L==3 // en @@ -5781,7 +5802,7 @@ const char *Txt_Create_group = #elif L==7 // it "Crea gruppo"; #elif L==8 // pl - "Create group"; // Potrzebujesz tlumaczenie + "Utwórz grupę"; #elif L==9 // pt "Criar grupo"; #endif @@ -5802,7 +5823,7 @@ const char *Txt_Create_holiday = #elif L==7 // it "Crea festività"; #elif L==8 // pl - "Tworzenie wakacje"; + "Utwórz wakacje"; #elif L==9 // pt "Criar féria"; #endif @@ -5823,7 +5844,7 @@ const char *Txt_Create_institution = #elif L==7 // it "Crea istituzione"; #elif L==8 // pl - "Tworzenie instytucji"; + "Utwórz instytucji"; #elif L==9 // pt "Criar institução"; #endif @@ -5865,7 +5886,7 @@ const char *Txt_Create_notice = #elif L==7 // it "Crea avviso"; #elif L==8 // pl - "Stwórz powiadomienie"; + "Utwórz powiadomienie"; #elif L==9 // pt "Criar aviso"; #endif @@ -5886,7 +5907,7 @@ const char *Txt_Create_BR_notification = #elif L==7 // it "Crea
notifica"; #elif L==8 // pl - "Tworzenie
powiadomienie"; + "Utwórz
powiadomienie"; #elif L==9 // pt "Criar
notificação"; #endif @@ -5928,7 +5949,7 @@ const char *Txt_Create_place = #elif L==7 // it "Crea localit`"; #elif L==8 // pl - "Tworzenie miejsce"; + "Utwórz miejsce"; #elif L==9 // pt "Criar localização"; #endif @@ -5949,7 +5970,7 @@ const char *Txt_Create_plugin = #elif L==7 // it "Crea plugin"; #elif L==8 // pl - "Tworzenie plugin"; + "Utwórz plugin"; #elif L==9 // pt "Criar plugin"; #endif @@ -5970,7 +5991,7 @@ const char *Txt_Create_project = #elif L==7 // it "Crea progetto"; #elif L==8 // pl - "Tworzenie projekt"; + "Utwórz projekt"; #elif L==9 // pt "Criar projeto"; #endif @@ -5991,7 +6012,7 @@ const char *Txt_Create_question = #elif L==7 // it "Crea domanda"; #elif L==8 // pl - "Tworzenie pytanie"; + "Utwórz pytanie"; #elif L==9 // pt "Criar questão"; #endif @@ -6033,7 +6054,7 @@ const char *Txt_Create_survey = #elif L==7 // it "Crea sondaggio"; #elif L==8 // pl - "Tworzenie ankiety"; + "Utwórz ankiety"; #elif L==9 // pt "Criar inquérito"; #endif @@ -6054,7 +6075,7 @@ const char *Txt_Create_type_of_degree = #elif L==7 // it "Crea tipo di laurea"; #elif L==8 // pl - "Tworzenie typu stopnia"; + "Utwórz typu stopnia"; #elif L==9 // pt "Criar tipo de grau"; #endif @@ -6075,7 +6096,7 @@ const char *Txt_Create_type_of_group = #elif L==7 // it "Crea tipo di gruppo"; #elif L==8 // pl - "Tworzenie typu grupy"; + "Utwórz typu grupy"; #elif L==9 // pt "Criar tipo de grupo"; #endif @@ -6096,7 +6117,7 @@ const char *Txt_Create_ZIP_file = #elif L==7 // it "Crea file ZIP"; #elif L==8 // pl - "Tworzenie pliku ZIP"; + "Utwórz pliku ZIP"; #elif L==9 // pt "Criar arquivo ZIP"; #endif @@ -6621,7 +6642,7 @@ const char *Txt_Creating_database_tables_if_they_do_not_exist = #elif L==7 // it "Creazione tabelle della base di dati se non esistono…"; #elif L==8 // pl - "Tworzenie tabel bazy danych, jesli ich nie ma …"; + "Utwórz tabel bazy danych, jesli ich nie ma …"; #elif L==9 // pt "Criando tabelas da base de dados, se elas não existirem…"; #endif