From 7db7b51de2bffd037f12df56fe653f9cad1820a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Wed, 2 Jan 2019 15:10:51 +0100 Subject: [PATCH] Version 18.26 --- sql/swad.sql | 5 +- swad_action.c | 3 + swad_action.h | 9 ++- swad_banner.c | 3 +- swad_centre.c | 3 +- swad_changelog.h | 10 ++- swad_classroom.c | 180 +++++++++++++++++++++++++++++++++------------ swad_classroom.h | 9 ++- swad_country.c | 3 +- swad_course.c | 3 +- swad_database.c | 23 +++--- swad_degree.c | 3 +- swad_degree_type.c | 3 +- swad_department.c | 3 +- swad_global.c | 3 + swad_group.c | 42 ++++++----- swad_holiday.c | 3 +- swad_institution.c | 3 +- swad_link.c | 3 +- swad_mail.c | 3 +- swad_place.c | 3 +- swad_plugin.c | 3 +- swad_record.c | 6 +- swad_text.c | 128 +++++++++++++++++--------------- 24 files changed, 294 insertions(+), 163 deletions(-) diff --git a/sql/swad.sql b/sql/swad.sql index bd8a156d..3ee8e4b3 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -185,10 +185,9 @@ CREATE TABLE IF NOT EXISTS classrooms ( CtrCod INT NOT NULL, ShortName VARCHAR(511) NOT NULL, FullName VARCHAR(2047) NOT NULL, - NumStds INT NOT NULL, + MaxStudents INT NOT NULL, UNIQUE INDEX(ClaCod), - INDEX(CtrCod), - INDEX(NumStds)); + INDEX(CtrCod)); -- -- Table clicks_without_photo: stores the number of clicks that remains to each user before being required to submit his/her photo -- diff --git a/swad_action.c b/swad_action.c index 1d276afb..531ba255 100644 --- a/swad_action.c +++ b/swad_action.c @@ -272,6 +272,7 @@ Centre: NEW. ActRemCla Remove a classroom NEW. ActRenClaSho Change short name of a classroom NEW. ActRenClaFul Change full name of a classroom + NEW. ActChgClaMaxStd Change number of students in a classroom 148. ActPrnCtrCrs Show print view of the academic calendar 149. ActChgCtrCrs1stDay Change first day of week and show academic calendar @@ -1807,6 +1808,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActRemCla */{1747,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cla_RemoveClassroom ,NULL}, /* ActRenClaSho */{1748,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cla_RenameClassroomShort ,NULL}, /* ActRenClaFul */{1749,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cla_RenameClassroomFull ,NULL}, + /* ActChgClaMaxStd */{1750,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cla_ChangeMaxStudents ,NULL}, /* ActPrnCalCtr */{1632,-1,TabUnk,ActSeeCalCtr , 0, 0, 0,0x3C7, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Cal_PrintCalendar ,NULL}, /* ActChgCalCtr1stDay*/{1633,-1,TabUnk,ActSeeCalCtr , 0, 0, 0,0x3C7, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cal_ChangeFirstDayOfWeek ,Cal_DrawCalendarCtr ,NULL}, @@ -4952,6 +4954,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActRemCla, // #1747 ActRenClaSho, // #1748 ActRenClaFul, // #1749 + ActChgClaMaxStd, // #1750 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index 4f39c6c8..e7337af4 100644 --- a/swad_action.h +++ b/swad_action.h @@ -61,9 +61,9 @@ typedef enum typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -#define Act_NUM_ACTIONS (1 + 9 + 43 + 17 + 47 + 39 + 24 + 115 + 157 + 437 + 165 + 172 + 42 + 14 + 76) +#define Act_NUM_ACTIONS (1 + 9 + 43 + 17 + 47 + 40 + 24 + 115 + 157 + 437 + 165 + 172 + 42 + 14 + 76) -#define Act_MAX_ACTION_COD 1749 +#define Act_MAX_ACTION_COD 1750 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13 @@ -271,9 +271,10 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActRemCla (ActChgCalIns1stDay + 35) #define ActRenClaSho (ActChgCalIns1stDay + 36) #define ActRenClaFul (ActChgCalIns1stDay + 37) +#define ActChgClaMaxStd (ActChgCalIns1stDay + 38) -#define ActPrnCalCtr (ActChgCalIns1stDay + 38) -#define ActChgCalCtr1stDay (ActChgCalIns1stDay + 39) +#define ActPrnCalCtr (ActChgCalIns1stDay + 39) +#define ActChgCalCtr1stDay (ActChgCalIns1stDay + 40) /*****************************************************************************/ /********************************* Degree tab ********************************/ diff --git a/swad_banner.c b/swad_banner.c index e0be1bee..6d4f7724 100644 --- a/swad_banner.c +++ b/swad_banner.c @@ -668,7 +668,8 @@ static void Ban_RenameBanner (Cns_ShrtOrFullName_t ShrtOrFullName) } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (CurrentBanName,NewBanName)) // Different names { /***** If banner was in database... *****/ diff --git a/swad_centre.c b/swad_centre.c index b2ccf8fb..8b6afbfc 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -2035,7 +2035,8 @@ static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFull } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (CurrentCtrName,NewCtrName)) // Different names { /***** If degree was in database... *****/ diff --git a/swad_changelog.h b/swad_changelog.h index 38866c2d..3f2790c8 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -364,10 +364,17 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.25.3 (2018-12-30)" +#define Log_PLATFORM_VERSION "SWAD 18.26 (2019-01-02)" #define CSS_FILE "swad18.22.css" #define JS_FILE "swad17.17.1.js" /* + Version 18.26: Jan 02, 2019 New form and action to change maximum number of students in a classroom. (? lines) + 4 changes necessary in database: +DROP INDEX NumStds ON classrooms; +ALTER TABLE classrooms CHANGE COLUMN NumStds MaxStudents INT NOT NULL; +UPDATE actions SET Txt='Cambiar máx. estudiantes en grupo' WHERE ActCod='106' AND Language='es'; +UPDATE actions SET Txt='Cambiar máx. estudiantes en aula' WHERE ActCod='1750' AND Language='es'; + Version 18.25.3: Dec 30, 2018 Fixed bugs in classrooms. (238514 lines) Version 18.25.2: Dec 30, 2018 New database table for classrooms. (238525 lines) 8 changes necessary in database: @@ -378,7 +385,6 @@ INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1746','es','N','Crea INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1747','es','N','Eliminar aula'); INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1748','es','N','Cambiar nombre breve aula'); INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1749','es','N','Cambiar nombre completo aula'); -INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1750','es','N','Cambiar nº estudiantes aula'); Copy the following icon to icon public directory: sudo cp classroom.svg /var/www/html/swad/icon/ diff --git a/swad_classroom.c b/swad_classroom.c index 29f28014..65689c87 100644 --- a/swad_classroom.c +++ b/swad_classroom.c @@ -70,6 +70,8 @@ static void Cla_RenameClassroom (Cns_ShrtOrFullName_t ShrtOrFullName); static bool Cla_CheckIfClassroomNameExists (const char *FieldName,const char *Name,long ClaCod); static void Cla_UpdateClaNameDB (long ClaCod,const char *FieldName,const char *NewClaName); +static void Cla_WriteMaxStds (unsigned MaxStudents); + static void Cla_PutFormToCreateClassroom (void); static void Cla_PutHeadClassrooms (void); static void Cla_CreateClassroom (struct Classroom *Cla); @@ -102,7 +104,7 @@ void Cla_SeeClassrooms (void) Tbl_StartTableWideMargin (2); fprintf (Gbl.F.Out,""); for (Order = Cla_ORDER_BY_CLASSROOM; - Order <= Cla_ORDER_BY_NUM_STDS; + Order <= Cla_ORDER_BY_MAX_STDS; Order++) { fprintf (Gbl.F.Out,""); @@ -120,7 +122,7 @@ void Cla_SeeClassrooms (void) } fprintf (Gbl.F.Out,""); - /***** Write all classrooms and their nuber of students *****/ + /***** Write all classrooms and their maximum of students *****/ for (NumCla = 0; NumCla < Gbl.Classrooms.Num; NumCla++) @@ -130,12 +132,11 @@ void Cla_SeeClassrooms (void) "" "%s" "" - "" - "%u" - "" - "", - Gbl.Classrooms.Lst[NumCla].FullName, - Gbl.Classrooms.Lst[NumCla].NumStds); + "", + Gbl.Classrooms.Lst[NumCla].FullName); + Cla_WriteMaxStds (Gbl.Classrooms.Lst[NumCla].MaxStudents); + fprintf (Gbl.F.Out,"" + ""); } /***** End table *****/ @@ -164,10 +165,10 @@ void Cla_SeeClassrooms (void) static void Cla_GetParamClaOrder (void) { Gbl.Classrooms.SelectedOrder = (Cla_Order_t) - Par_GetParToUnsignedLong ("Order", - 0, - Cla_NUM_ORDERS - 1, - (unsigned long) Cla_ORDER_DEFAULT); + Par_GetParToUnsignedLong ("Order", + 0, + Cla_NUM_ORDERS - 1, + (unsigned long) Cla_ORDER_DEFAULT); } /*****************************************************************************/ @@ -273,15 +274,15 @@ void Cla_GetListClassrooms (void) case Cla_ORDER_BY_CLASSROOM: sprintf (OrderBySubQuery,"FullName"); break; - case Cla_ORDER_BY_NUM_STDS: - sprintf (OrderBySubQuery,"NumStds DESC,FullName"); + case Cla_ORDER_BY_MAX_STDS: + sprintf (OrderBySubQuery,"MaxStudents DESC,FullName"); break; } NumRows = DB_QuerySELECT (&mysql_res,"can not get classrooms", "SELECT ClaCod," "ShortName," "FullName," - "NumStds" + "MaxStudents" " FROM classrooms" " WHERE CtrCod=%ld" " ORDER BY %s", @@ -319,9 +320,9 @@ void Cla_GetListClassrooms (void) Str_Copy (Cla->FullName,row[2], Cla_MAX_BYTES_CLASSROOM_FULL_NAME); - /* Get number of students in this classroom (row[3]) */ - if (sscanf (row[3],"%u",&Cla->NumStds) != 1) - Cla->NumStds = 0; + /* Get maximum number of students in this classroom (row[3]) */ + if (sscanf (row[3],"%u",&Cla->MaxStudents) != 1) + Cla->MaxStudents = 0; } } else @@ -346,7 +347,7 @@ void Cla_GetDataOfClassroomByCod (struct Classroom *Cla) /***** Clear data *****/ Cla->ShrtName[0] = '\0'; Cla->FullName[0] = '\0'; - Cla->NumStds = 0; + Cla->MaxStudents = 0; /***** Check if classroom code is correct *****/ if (Cla->ClaCod < 0) @@ -369,7 +370,7 @@ void Cla_GetDataOfClassroomByCod (struct Classroom *Cla) NumRows = DB_QuerySELECT (&mysql_res,"can not get data of a classroom", "SELECT ShortName," "FullName," - "NumStds" + "MaxStudents" " FROM classrooms" " WHERE ClaCod=%ld", Cla->ClaCod); @@ -388,9 +389,9 @@ void Cla_GetDataOfClassroomByCod (struct Classroom *Cla) Str_Copy (Cla->FullName,row[1], Cla_MAX_BYTES_CLASSROOM_FULL_NAME); - /* Get number of students in this classroom (row[2]) */ - if (sscanf (row[2],"%u",&Cla->NumStds) != 1) - Cla->NumStds = 0; + /* Get maximum number of students in this classroom (row[2]) */ + if (sscanf (row[2],"%u",&Cla->MaxStudents) != 1) + Cla->MaxStudents = 0; } /***** Free structure that stores the query result *****/ @@ -436,15 +437,10 @@ static void Cla_ListClassroomsForEdition (void) /* Put icon to remove classroom */ fprintf (Gbl.F.Out,"" ""); - if (Cla->NumStds) // Classroom has students ==> deletion forbidden - Ico_PutIconRemovalNotAllowed (); - else - { - Frm_StartForm (ActRemCla); - Cla_PutParamClaCod (Cla->ClaCod); - Ico_PutIconRemove (); - Frm_EndForm (); - } + Frm_StartForm (ActRemCla); + Cla_PutParamClaCod (Cla->ClaCod); + Ico_PutIconRemove (); + Frm_EndForm (); fprintf (Gbl.F.Out,""); /* Classroom code */ @@ -477,12 +473,18 @@ static void Cla_ListClassroomsForEdition (void) Frm_EndForm (); fprintf (Gbl.F.Out,""); - /* Number of students */ - fprintf (Gbl.F.Out,"" - "%u" - "" - "", - Cla->NumStds); + /* Maximum number of students */ + fprintf (Gbl.F.Out,""); + Frm_StartForm (ActChgClaMaxStd); + Cla_PutParamClaCod (Cla->ClaCod); + fprintf (Gbl.F.Out,"MaxStudents); + fprintf (Gbl.F.Out,"\" onchange=\"document.getElementById('%s').submit();\" />", + Gbl.Form.Id); + Frm_EndForm (); + fprintf (Gbl.F.Out,"" + ""); } /***** End table *****/ @@ -612,7 +614,8 @@ static void Cla_RenameClassroom (Cns_ShrtOrFullName_t ShrtOrFullName) } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (CurrentClaName,NewClaName)) // Different names { /***** If classroom was in database... *****/ @@ -678,6 +681,81 @@ static void Cla_UpdateClaNameDB (long ClaCod,const char *FieldName,const char *N FieldName,NewClaName,ClaCod); } +/*****************************************************************************/ +/************** Change maximum number of students in a classroom *************/ +/*****************************************************************************/ + +void Cla_ChangeMaxStudents (void) + { + extern const char *Txt_The_maximum_number_of_students_has_not_changed; + extern const char *Txt_The_classroom_X_does_not_have_a_student_limit_now; + extern const char *Txt_The_maximum_number_of_students_is_now_X; + struct Classroom *Cla; + unsigned NewMaxStds; + + /***** Use current editing classroom *****/ + Cla = &Gbl.Classrooms.EditingCla; + + /***** Get parameters from form *****/ + /* Get the code of the classroom */ + if ((Cla->ClaCod = Cla_GetParamClaCod ()) == -1L) + Lay_ShowErrorAndExit ("Code of classroom is missing."); + + /* Get the new maximum number of students of the group */ + NewMaxStds = (unsigned) + Par_GetParToUnsignedLong ("MaxStudents", + 0, + Cla_MAX_STUDENTS_IN_A_CLASSROOM, + Cla_NUM_STUDENTS_NOT_LIMITED); + + /***** Get data of the classroom from database *****/ + Cla_GetDataOfClassroomByCod (Cla); + + /***** Check if the old maximum of students equals the new one + (this happens when return is pressed without changes) *****/ + if (Cla->MaxStudents == NewMaxStds) + { + /***** Message to show no changes made *****/ + Gbl.Alert.Type = Ale_INFO; + Str_Copy (Gbl.Alert.Txt,Txt_The_maximum_number_of_students_has_not_changed, + Ale_MAX_BYTES_ALERT); + } + else + { + /***** Update the table of groups changing the old maximum of students to the new *****/ + DB_QueryUPDATE ("can not update the maximum number of students" + " in a classroom", + "UPDATE classrooms SET MaxStudents=%u WHERE ClaCod=%ld", + NewMaxStds,Cla->ClaCod); + Cla->MaxStudents = NewMaxStds; + + /***** Message to show the change made *****/ + Gbl.Alert.Type = Ale_SUCCESS; + if (NewMaxStds > Grp_MAX_STUDENTS_IN_A_GROUP) + snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), + Txt_The_classroom_X_does_not_have_a_student_limit_now, + Cla->FullName); + else + snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), + Txt_The_maximum_number_of_students_is_now_X, + NewMaxStds); + } + Ale_ShowAlert (Gbl.Alert.Type,Gbl.Alert.Txt); + + /***** Show the form again *****/ + Cla_EditClassrooms (); + } + +/*****************************************************************************/ +/*********** Write the maximum number of students in a classroom *************/ +/*****************************************************************************/ + +static void Cla_WriteMaxStds (unsigned MaxStudents) + { + if (MaxStudents <= Cla_MAX_STUDENTS_IN_A_CLASSROOM) + fprintf (Gbl.F.Out,"%u",MaxStudents); + } + /*****************************************************************************/ /******************* Put a form to create a new classroom ********************/ /*****************************************************************************/ @@ -727,9 +805,12 @@ static void Cla_PutFormToCreateClassroom (void) Cla_MAX_CHARS_CLASSROOM_FULL_NAME,Cla->FullName); /***** Number of students *****/ - fprintf (Gbl.F.Out,"" - "0" - "" + fprintf (Gbl.F.Out,"" + "MaxStudents); + fprintf (Gbl.F.Out,"\" />" + "" ""); /***** End table, send button and end box *****/ @@ -748,7 +829,7 @@ static void Cla_PutHeadClassrooms (void) extern const char *Txt_Code; extern const char *Txt_Short_name; extern const char *Txt_Full_name; - extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; + extern const char *Txt_Max_BR_students; fprintf (Gbl.F.Out,"" "" @@ -768,7 +849,7 @@ static void Cla_PutHeadClassrooms (void) Txt_Code, Txt_Short_name, Txt_Full_name, - Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN]); + Txt_Max_BR_students); } /*****************************************************************************/ @@ -790,6 +871,13 @@ void Cla_RecFormNewClassroom (void) /* Get classroom full name */ Par_GetParToText ("FullName",Cla->FullName,Cla_MAX_BYTES_CLASSROOM_FULL_NAME); + /* Get maximum number of students */ + Cla->MaxStudents = (unsigned) + Par_GetParToUnsignedLong ("MaxStudents", + 0, + Cla_MAX_STUDENTS_IN_A_CLASSROOM, + Cla_NUM_STUDENTS_NOT_LIMITED); + if (Cla->ShrtName[0] && Cla->FullName[0]) // If there's a classroom name { /***** If name of classroom was in database... *****/ @@ -828,11 +916,11 @@ static void Cla_CreateClassroom (struct Classroom *Cla) /***** Create a new classroom *****/ DB_QueryINSERT ("can not create classroom", "INSERT INTO classrooms" - " (CtrCod,ShortName,FullName,NumStds)" + " (CtrCod,ShortName,FullName,MaxStudents)" " VALUES" " (%ld,'%s','%s',%u)", Gbl.CurrentCtr.Ctr.CtrCod, - Cla->ShrtName,Cla->FullName,Cla->NumStds); + Cla->ShrtName,Cla->FullName,Cla->MaxStudents); /***** Write success message *****/ snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), diff --git a/swad_classroom.h b/swad_classroom.h index fcf86c7c..ce4f50fc 100644 --- a/swad_classroom.h +++ b/swad_classroom.h @@ -39,20 +39,24 @@ #define Cla_MAX_CHARS_CLASSROOM_FULL_NAME (128 - 1) // 127 #define Cla_MAX_BYTES_CLASSROOM_FULL_NAME ((Cla_MAX_CHARS_CLASSROOM_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 +#define Cla_MAX_STUDENTS_IN_A_CLASSROOM 10000 // If max of students in a classroom is greater than this, it is considered infinite +#define Cla_NUM_STUDENTS_NOT_LIMITED INT_MAX // This number can be stored in database as an integer... + // ...and means that a classroom has no limit of students + struct Classroom { long ClaCod; long InsCod; char ShrtName[Cla_MAX_BYTES_CLASSROOM_SHRT_NAME + 1]; char FullName[Cla_MAX_BYTES_CLASSROOM_FULL_NAME + 1]; - unsigned NumStds; + unsigned MaxStudents; }; #define Cla_NUM_ORDERS 2 typedef enum { Cla_ORDER_BY_CLASSROOM = 0, - Cla_ORDER_BY_NUM_STDS = 1, + Cla_ORDER_BY_MAX_STDS = 1, } Cla_Order_t; #define Cla_ORDER_DEFAULT Cla_ORDER_BY_CLASSROOM @@ -70,6 +74,7 @@ long Cla_GetParamClaCod (void); void Cla_RemoveClassroom (void); void Cla_RenameClassroomShort (void); void Cla_RenameClassroomFull (void); +void Cla_ChangeMaxStudents (void); void Cla_RecFormNewClassroom (void); #endif diff --git a/swad_country.c b/swad_country.c index cd220387..cbd7e839 100644 --- a/swad_country.c +++ b/swad_country.c @@ -1806,7 +1806,8 @@ void Cty_RenameCountry (void) } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (Cty->Name[Language],NewCtyName)) // Different names { /***** If country was in database... *****/ diff --git a/swad_course.c b/swad_course.c index 5bb78b7c..a4e0b531 100644 --- a/swad_course.c +++ b/swad_course.c @@ -2730,7 +2730,8 @@ static void Crs_RenameCourse (struct Course *Crs,Cns_ShrtOrFullName_t ShrtOrFull } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (CurrentCrsName,NewCrsName)) // Different names { /***** If course was in database... *****/ diff --git a/swad_database.c b/swad_database.c index ced30675..1d35ed1a 100644 --- a/swad_database.c +++ b/swad_database.c @@ -467,15 +467,15 @@ mysql> DESCRIBE chat; /***** Table classrooms *****/ /* mysql> DESCRIBE classrooms; -+-----------+---------------+------+-----+---------+----------------+ -| Field | Type | Null | Key | Default | Extra | -+-----------+---------------+------+-----+---------+----------------+ -| ClaCod | int(11) | NO | PRI | NULL | auto_increment | -| CtrCod | int(11) | NO | MUL | NULL | | -| ShortName | varchar(511) | NO | | NULL | | -| FullName | varchar(2047) | NO | | NULL | | -| NumStds | int(11) | NO | MUL | NULL | | -+-----------+---------------+------+-----+---------+----------------+ ++-------------+---------------+------+-----+---------+----------------+ +| Field | Type | Null | Key | Default | Extra | ++-------------+---------------+------+-----+---------+----------------+ +| ClaCod | int(11) | NO | PRI | NULL | auto_increment | +| CtrCod | int(11) | NO | MUL | NULL | | +| ShortName | varchar(511) | NO | | NULL | | +| FullName | varchar(2047) | NO | | NULL | | +| MaxStudents | int(11) | NO | | NULL | | ++-------------+---------------+------+-----+---------+----------------+ 5 rows in set (0.00 sec) */ DB_CreateTable ("CREATE TABLE IF NOT EXISTS classrooms (" @@ -483,10 +483,9 @@ mysql> DESCRIBE classrooms; "CtrCod INT NOT NULL," "ShortName VARCHAR(511) NOT NULL," // Cla_MAX_BYTES_CLASSROOM_SHRT_NAME "FullName VARCHAR(2047) NOT NULL," // Cla_MAX_BYTES_CLASSROOM_FULL_NAME - "NumStds INT NOT NULL," + "MaxStudents INT NOT NULL," "UNIQUE INDEX(ClaCod)," - "INDEX(CtrCod)," - "INDEX(NumStds))"); + "INDEX(CtrCod))"); /***** Table clicks_without_photo *****/ /* diff --git a/swad_degree.c b/swad_degree.c index 3bbd958c..69551db1 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -1998,7 +1998,8 @@ static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFull } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (CurrentDegName,NewDegName)) // Different names { /***** If degree was in database... *****/ diff --git a/swad_degree_type.c b/swad_degree_type.c index 106aab51..bd55894e 100644 --- a/swad_degree_type.c +++ b/swad_degree_type.c @@ -963,7 +963,8 @@ void DT_RenameDegreeType (void) } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (DegTyp->DegTypName,NewNameDegTyp)) // Different names { /***** If degree type was in database... *****/ diff --git a/swad_department.c b/swad_department.c index ec8d18f8..3018a9f6 100644 --- a/swad_department.c +++ b/swad_department.c @@ -739,7 +739,8 @@ static void Dpt_RenameDepartment (Cns_ShrtOrFullName_t ShrtOrFullName) } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (CurrentDptName,NewDptName)) // Different names { /***** If degree was in database... *****/ diff --git a/swad_global.c b/swad_global.c index fbf547cd..31aec8cd 100644 --- a/swad_global.c +++ b/swad_global.c @@ -35,6 +35,7 @@ #include "swad_action.h" #include "swad_calendar.h" +#include "swad_classroom.h" #include "swad_config.h" #include "swad_constant.h" #include "swad_exam.h" @@ -234,6 +235,8 @@ void Gbl_InitializeGlobals (void) Gbl.CurrentDeg.Deg.DegCod = -1L; Gbl.CurrentDeg.Deg.ShrtName[0] = Gbl.CurrentDeg.Deg.FullName[0] = '\0'; + Gbl.Classrooms.EditingCla.MaxStudents = Cla_NUM_STUDENTS_NOT_LIMITED; + Gbl.CurrentCrs.Crs.CrsCod = -1L; Gbl.CurrentCrs.Crs.ShrtName[0] = Gbl.CurrentCrs.Crs.FullName[0] = '\0'; Gbl.CurrentCrs.Info.ShowMsgMustBeRead = 0; diff --git a/swad_group.c b/swad_group.c index f7de15c6..a59c2d30 100644 --- a/swad_group.c +++ b/swad_group.c @@ -148,7 +148,7 @@ static void Grp_PutParamRemGrp (void); static void Grp_RemoveGroupTypeCompletely (void); static void Grp_RemoveGroupCompletely (void); -static void Grp_WriteMaxStdsGrp (unsigned MaxStudents); +static void Grp_WriteMaxStds (unsigned MaxStudents); static long Grp_GetParamGrpTypCod (void); static long Grp_GetParamGrpCod (void); static void Grp_PutParamGrpTypCod (long GrpTypCod); @@ -1615,7 +1615,7 @@ static void Grp_ListGroupsForEdition (void) Grp_PutParamGrpCod (Grp->GrpCod); fprintf (Gbl.F.Out,"MaxStudents); + Grp_WriteMaxStds (Grp->MaxStudents); fprintf (Gbl.F.Out,"\" onchange=\"document.getElementById('%s').submit();\" />", Gbl.Form.Id); Frm_EndForm (); @@ -2439,7 +2439,7 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight) if (Highlight) fprintf (Gbl.F.Out," LIGHT_BLUE"); fprintf (Gbl.F.Out,"\">"); - Grp_WriteMaxStdsGrp (Grp->MaxStudents); + Grp_WriteMaxStds (Grp->MaxStudents); fprintf (Gbl.F.Out," " ""); @@ -2655,7 +2655,7 @@ static void Grp_PutFormToCreateGroup (void) fprintf (Gbl.F.Out,"" "" "" ""); @@ -4345,7 +4345,7 @@ void Grp_ChangeMandatGrpTyp (void) Grp_GetDataOfGroupTypeByCod (&Gbl.CurrentCrs.Grps.GrpTyp); /***** Check if the old type of enrolment match the new - (this happens when return is pressed without changes in the form) *****/ + (this happens when return is pressed without changes) *****/ if (Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrolment == NewMandatoryEnrolment) { AlertType = Ale_INFO; @@ -4476,9 +4476,9 @@ void Grp_ChangeOpenTimeGrpTyp (void) void Grp_ChangeMaxStdsGrp (void) { - extern const char *Txt_The_maximum_number_of_students_in_the_group_X_has_not_changed; - extern const char *Txt_The_group_X_now_has_no_limit_of_students; - extern const char *Txt_The_maximum_number_of_students_in_the_group_X_is_now_Y; + extern const char *Txt_The_maximum_number_of_students_has_not_changed; + extern const char *Txt_The_group_X_does_not_have_a_student_limit_now; + extern const char *Txt_The_maximum_number_of_students_is_now_X; struct GroupData GrpDat; unsigned NewMaxStds; Ale_AlertType_t AlertType; @@ -4495,17 +4495,17 @@ void Grp_ChangeMaxStdsGrp (void) Grp_MAX_STUDENTS_IN_A_GROUP, Grp_NUM_STUDENTS_NOT_LIMITED); - /* Get from the database the type, name, and antiguo maximum of students of the group */ + /* Get from the database the type, name, and old maximum of students of the group */ GrpDat.GrpCod = Gbl.CurrentCrs.Grps.GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); - /***** Check if the old maximum of students equals the new one (this happens when user press return without change the form) *****/ + /***** Check if the old maximum of students equals the new one + (this happens when return is pressed without changes) *****/ if (GrpDat.MaxStudents == NewMaxStds) { AlertType = Ale_INFO; - snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_maximum_number_of_students_in_the_group_X_has_not_changed, - GrpDat.GrpName); + Str_Copy (Gbl.Alert.Txt,Txt_The_maximum_number_of_students_has_not_changed, + Ale_MAX_BYTES_ALERT); } else { @@ -4519,12 +4519,12 @@ void Grp_ChangeMaxStdsGrp (void) AlertType = Ale_SUCCESS; if (NewMaxStds > Grp_MAX_STUDENTS_IN_A_GROUP) snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_group_X_now_has_no_limit_of_students, + Txt_The_group_X_does_not_have_a_student_limit_now, GrpDat.GrpName); else snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), - Txt_The_maximum_number_of_students_in_the_group_X_is_now_Y, - GrpDat.GrpName,NewMaxStds); + Txt_The_maximum_number_of_students_is_now_X, + NewMaxStds); } /***** Show the form again *****/ @@ -4534,10 +4534,10 @@ void Grp_ChangeMaxStdsGrp (void) } /*****************************************************************************/ -/************ Write the number maximum of students in a group ***************/ +/************* Write the maximum number of students in a group ***************/ /*****************************************************************************/ -static void Grp_WriteMaxStdsGrp (unsigned MaxStudents) +static void Grp_WriteMaxStds (unsigned MaxStudents) { if (MaxStudents <= Grp_MAX_STUDENTS_IN_A_GROUP) fprintf (Gbl.F.Out,"%u",MaxStudents); @@ -4592,7 +4592,8 @@ void Grp_RenameGroupType (void) } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp)) // Different names { /***** If group type was in database... *****/ @@ -4671,7 +4672,8 @@ void Grp_RenameGroup (void) } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (GrpDat.GrpName,NewNameGrp)) // Different names { /***** If group was in database... *****/ diff --git a/swad_holiday.c b/swad_holiday.c index 3a756898..ad813811 100644 --- a/swad_holiday.c +++ b/swad_holiday.c @@ -920,7 +920,8 @@ void Hld_RenameHoliday1 (void) } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (Hld->Name,NewHldName)) // Different names { /***** If degree was in database... *****/ diff --git a/swad_institution.c b/swad_institution.c index d8ce3b95..10c8845f 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -1855,7 +1855,8 @@ static void Ins_RenameInstitution (struct Instit *Ins,Cns_ShrtOrFullName_t ShrtO } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (CurrentInsName,NewInsName)) // Different names { /***** If institution was in database... *****/ diff --git a/swad_link.c b/swad_link.c index b60d9a33..90743887 100644 --- a/swad_link.c +++ b/swad_link.c @@ -590,7 +590,8 @@ static void Lnk_RenameLink (Cns_ShrtOrFullName_t ShrtOrFullName) } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (CurrentLnkName,NewLnkName)) // Different names { /***** If link was in database... *****/ diff --git a/swad_mail.c b/swad_mail.c index da0d1731..5fa3f6b0 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -649,7 +649,8 @@ static void Mai_RenameMailDomain (Cns_ShrtOrFullName_t ShrtOrFullName) } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (CurrentMaiName,NewMaiName)) // Different names { /***** If mail was in database... *****/ diff --git a/swad_place.c b/swad_place.c index acd978f3..dfc7bc2e 100644 --- a/swad_place.c +++ b/swad_place.c @@ -699,7 +699,8 @@ static void Plc_RenamePlace (Cns_ShrtOrFullName_t ShrtOrFullName) } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (CurrentPlcName,NewPlcName)) // Different names { /***** If place was in database... *****/ diff --git a/swad_plugin.c b/swad_plugin.c index 4d15c098..9fa3501c 100644 --- a/swad_plugin.c +++ b/swad_plugin.c @@ -547,7 +547,8 @@ void Plg_RenamePlugin (void) } else { - /***** Check if old and new names are the same (this happens when user press enter with no changes in the form) *****/ + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ if (strcmp (Plg->Name,NewPlgName)) // Different names { /***** If plugin was in database... *****/ diff --git a/swad_record.c b/swad_record.c index c90e9748..86bd5d17 100644 --- a/swad_record.c +++ b/swad_record.c @@ -803,7 +803,7 @@ void Rec_RenameField (void) /* Get the new group name */ Par_GetParToText ("FieldName",NewFieldName,Rec_MAX_BYTES_NAME_FIELD); - /***** Get from the database the antiguo group name *****/ + /***** Get from the database the old field name *****/ Rec_GetFieldByCod (Gbl.CurrentCrs.Records.Field.FieldCod, Gbl.CurrentCrs.Records.Field.Name, &Gbl.CurrentCrs.Records.Field.NumLines, @@ -886,7 +886,7 @@ void Rec_ChangeLinesField (void) /* Get from the database the number of lines of the field */ Rec_GetFieldByCod (Gbl.CurrentCrs.Records.Field.FieldCod,Gbl.CurrentCrs.Records.Field.Name,&Gbl.CurrentCrs.Records.Field.NumLines,&Gbl.CurrentCrs.Records.Field.Visibility); - /***** Check if the old number of rows antiguo match the new one + /***** Check if the old number of rows matches the new one (this happens when return is pressed without changes) *****/ if (Gbl.CurrentCrs.Records.Field.NumLines == NewNumLines) { @@ -941,7 +941,7 @@ void Rec_ChangeVisibilityField (void) Rec_GetFieldByCod (Gbl.CurrentCrs.Records.Field.FieldCod,Gbl.CurrentCrs.Records.Field.Name,&Gbl.CurrentCrs.Records.Field.NumLines,&Gbl.CurrentCrs.Records.Field.Visibility); /***** Check if the old visibility matches the new one - (this happens whe return is pressed without changes in the form) *****/ + (this happens when return is pressed without changes) *****/ if (Gbl.CurrentCrs.Records.Field.Visibility == NewVisibility) { snprintf (Gbl.Alert.Txt,sizeof (Gbl.Alert.Txt), diff --git a/swad_text.c b/swad_text.c index 1f9d36bd..91c95164 100644 --- a/swad_text.c +++ b/swad_text.c @@ -3917,23 +3917,23 @@ const char *Txt_CLASSROOMS_HELP_ORDER[Cla_NUM_ORDERS] = #endif , #if L==1 // ca - "Ordenar per nombre d'estudiants" + "Ordenar per nombre màxim d'estudiants" #elif L==2 // de - "Nach Anzahl der Studenten sortieren" + "Sortieren nach maximaler Schülerzahl" #elif L==3 // en - "Sort by no. of students" + "Sort by maximum number of students" #elif L==4 // es - "Ordenar por nº de estudiantes" + "Ordenar por nº máximo de estudiantes" #elif L==5 // fr - "Trier par nombre d'étudiants" + "Trier par nombre maximum d'étudiants" #elif L==6 // gn - "Ordenar por nº de estudiantes" // Okoteve traducción + "Ordenar por nº máximo de estudiantes" // Okoteve traducción #elif L==7 // it - "Ordina per numero di studenti" + "Ordina per numero massimo di studenti" #elif L==8 // pl - "Sortuj wedlug studenci" + "Sortuj wed&lsgtrok;ug maksymalnej liczby studentów" #elif L==9 // pt - "Classificar por número de estudantes" + "Ordenar pelo número máximo de estudantes" #endif }; @@ -3960,23 +3960,23 @@ const char *Txt_CLASSROOMS_ORDER[Cla_NUM_ORDERS] = #endif , #if L==1 // ca - "Estudiants" + "Màxim
d'est." #elif L==2 // de - "Studenten" + "Max.
Stud." #elif L==3 // en - "Students" + "Max.
stud." #elif L==4 // es - "Estudiantes" + "Máx.
estu." #elif L==5 // fr - "Étudiants" + "Max.
étud." #elif L==6 // gn - "Estudiantes" // Okoteve traducción + "Máx.
estu." // Okoteve traducción #elif L==7 // it - "Studenti" + "Max.
stud." #elif L==8 // pl - "Studentów" + "Max.
stud." #elif L==9 // pt - "Estudantes" + "Máx.
estu." #endif }; @@ -43654,6 +43654,27 @@ const char *Txt_The_classroom_X_already_exists = // Warning: it is very importan "A sala de clase %s já existe."; #endif +const char *Txt_The_classroom_X_does_not_have_a_student_limit_now = // Warning: it is very important to include %s in the following sentences +#if L==1 // ca + "L'aula %s ara no té cap límit d'estudiants."; +#elif L==2 // de + "Das Klassenzimmer %s hat jetzt kein Studentenlimit."; +#elif L==3 // en + "The classroom %s does not have a student limit now."; +#elif L==4 // es + "El aula %s no tiene ahora límite de estudiantes."; +#elif L==5 // fr + "La salle de classe %s n'a plus de limite d'étudiants."; +#elif L==6 // gn + "El aula %s no tiene ahora límite de estudiantes."; // Okoteve traducción +#elif L==7 // it + "L'aula %s ora non ha limite di studenti."; +#elif L==8 // pl + "Klasa %s nie ma teraz żadnych limitów uczniów."; +#elif L==9 // pt + "A sala de clase %s não tem limite de estudantes agora."; +#endif + const char *Txt_The_classroom_X_has_been_renamed_as_Y = // Warning: it is very important to include two %s in the following sentences #if L==1 // ca "L'aula %s ha passat a denominar-se %s."; @@ -44932,25 +44953,25 @@ const char *Txt_The_group_X_is_now_open = // Warning: it is very important to in "O grupo %s está agora aberto."; #endif -const char *Txt_The_group_X_now_has_no_limit_of_students = // Warning: it is very important to include %s in the following sentences +const char *Txt_The_group_X_does_not_have_a_student_limit_now = // Warning: it is very important to include %s in the following sentences #if L==1 // ca - "El grupo %s no tiene ahora límite de estudiantes."; // Necessita traduccio + "El grup %s ara no té cap límit d'estudiants."; #elif L==2 // de - "The group %s now has no limit of students."; + "Die Gruppe %s hat jetzt kein Studentenlimit."; #elif L==3 // en - "The group %s now has no limit of students."; + "The group %s does not have a student limit now."; #elif L==4 // es "El grupo %s no tiene ahora límite de estudiantes."; #elif L==5 // fr - "The group %s now has no limit of students."; + "Le groupe %s n'a plus de limite d'étudiants."; #elif L==6 // gn "El grupo %s no tiene ahora límite de estudiantes."; // Okoteve traducción #elif L==7 // it "Il gruppo %s ora non ha limite di studenti."; #elif L==8 // pl - "The group %s now has no limit of students."; // Potrzebujesz tlumaczenie + "Grupa %s nie ma teraz żadnych limitów uczniów."; #elif L==9 // pt - "The group %s now has no limit of students."; + "O grupo %s não tem limite de estudantes agora."; #endif const char *Txt_The_groups_will_automatically_open = @@ -45553,64 +45574,55 @@ const char *Txt_the_marks_of_a_student_chosen_at_random_ = " se você vir mais de um estudante, isso significa que o número de cabeça ou pé linhas não está correto"; #endif -const char *Txt_The_maximum_number_of_students_in_the_group_X_has_not_changed = // Warning: it is very important to include %s in the following sentences +const char *Txt_The_maximum_number_of_students_has_not_changed = #if L==1 // ca - "El nº máximo de estudiantes" - " del grupo %s no ha cambiado."; // Necessita traduccio + "El nombre màxim d'estudiants no ha canviat."; #elif L==2 // de - "The maximum number of students" - " in the group %s has not changed."; // Need Übersetzung + "Die maximale Anzahl von Studenten hat sich nicht geändert."; #elif L==3 // en - "The maximum number of students" - " in the group %s has not changed."; + "The maximum number of students has not changed."; #elif L==4 // es - "El nº máximo de estudiantes" - " del grupo %s no ha cambiado."; + "El nº máximo de estudiantes no ha cambiado."; #elif L==5 // fr - "The maximum number of students" - " in the group %s has not changed."; // Besoin de traduction + "Le nombre maximum d'étudiants n'a pas changé."; #elif L==6 // gn - "El nº máximo de estudiantes" - " del grupo %s no ha cambiado."; // Okoteve traducción + "El nº máximo de estudiantes no ha cambiado."; // Okoteve traducción #elif L==7 // it - "Il numero massimo di studenti" - " nel gruppo %s non è cambiato."; + "Il numero massimo di studenti non è cambiato."; #elif L==8 // pl - "The maximum number of students" - " in the group %s has not changed."; // Potrzebujesz tlumaczenie + "Maksymalna liczba studentów nie uległa zmianie."; #elif L==9 // pt - "O número máximo de estudantes" - " no grupo %s não foi alterado."; + "O número máximo de estudantes não foi alterado."; #endif -const char *Txt_The_maximum_number_of_students_in_the_group_X_is_now_Y = // Warning: it is very important to include %s and %u in the following sentences +const char *Txt_The_maximum_number_of_students_is_now_X = // Warning: it is very important to include %u in the following sentences #if L==1 // ca - "El nº máximo de estudiantes" - " del grupo %s ahora es %u."; // Necessita traduccio + "El nombre màxim d'estudiants" + " ara és %u."; #elif L==2 // de - "The maximum number of students" - " in the group %s is now %u."; // Need Übersetzung + "Die maximale Anzahl von Studenten" + " beträgt jetzt %u."; #elif L==3 // en "The maximum number of students" - " in the group %s is now %u."; + " is now %u."; #elif L==4 // es "El nº máximo de estudiantes" - " del grupo %s ahora es %u."; + " ahora es %u."; #elif L==5 // fr - "The maximum number of students" - " in the group %s is now %u."; // Besoin de traduction + "Le nombre maximum d'étudiants" + " est maintenant de %u."; #elif L==6 // gn "El nº máximo de estudiantes" - " del grupo %s ahora es %u."; // Okoteve traducción + " ahora es %u."; // Okoteve traducción #elif L==7 // it "Il numero massimo di studenti" - " nel gruppo %s è ora %u."; + " è ora %u."; #elif L==8 // pl - "The maximum number of students" - " in the group %s is now %u."; // Potrzebujesz tlumaczenie + "Maksymalna liczba studentów" + " wynosi teraz %u."; #elif L==9 // pt "O número máximo de estudantes" - " no grupo %s é agora %u."; + " é agora %u."; #endif const char *Txt_The_message_has_not_been_sent_to_any_recipient =