diff --git a/Makefile b/Makefile index c2468a09..a071f961 100644 --- a/Makefile +++ b/Makefile @@ -30,8 +30,8 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \ swad_announcement.o swad_API.o swad_assignment.o swad_attendance.o \ swad_banner.o swad_box.o swad_button.o \ swad_calendar.o swad_centre.o swad_centre_config.o swad_chat.o \ - swad_classroom.o swad_config.o swad_connected.o swad_cookie.o \ - swad_country.o swad_country_config.o swad_course.o \ + swad_config.o swad_connected.o swad_cookie.o swad_country.o \ + swad_country_config.o swad_course.o \ swad_course_config.o swad_cryptography.o \ swad_database.o swad_date.o swad_degree.o swad_degree_config.o \ swad_degree_type.o swad_department.o swad_duplicate.o \ @@ -53,7 +53,7 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \ swad_place.o swad_plugin.o swad_privacy.o swad_profile.o \ swad_program.o swad_project.o \ swad_QR.o \ - swad_record.o swad_report.o swad_role.o swad_RSS.o \ + swad_record.o swad_report.o swad_role.o swad_room.o swad_RSS.o \ swad_scope.o swad_search.o swad_session.o swad_setting.o \ swad_statistic.o swad_string.o swad_survey.o swad_syllabus.o \ swad_system_config.o \ diff --git a/sql/cambios.sql b/sql/cambios.sql index ec2a86bb..e340ad19 100644 --- a/sql/cambios.sql +++ b/sql/cambios.sql @@ -13304,7 +13304,7 @@ ALTER TABLE log TRUNCATE PARTITION p2014; - +------------------------------------ // Cambios realizados el 14 de abril de 2020 @@ -13321,5 +13321,14 @@ SELECT ExaCod,CrsCod FROM tst_exams WHERE ExaCod IN (138946,149939,153732,155072 SELECT * FROM tst_exams WHERE ExaCod IN (138946,149939,153732,155072,158845,160028,163616,163617,165036,176633,177040,177140,177221,180469,182532,189061,189169,189179,189207,189245,189273,200335,200336,200337,203975,205562,206021,207224,215085,218272,218294,218300,218317,218665,218851,218869,218880,218955,219045,219074,219082,219086,219089,219092,219095,219097,219104,219107,219189,252548,252549,252550,259574,259825); +----------------------------------------- + +SELECT my_courses.CrsCod,COUNT(*) AS N FROM (SELECT UsrCod,CrsCod,Role FROM crs_usr WHERE UsrCod=1346 AND Role=5) AS my_courses LEFT JOIN log ON (my_courses.UsrCod=log.UsrCod AND my_courses.CrsCod=log.CrsCod AND my_courses.Role=log.Role) GROUP BY my_courses.CrsCod ORDER BY N DESC,my_courses.CrsCod DESC; + +SELECT my_courses.CrsCod,COUNT(*) AS N FROM (SELECT CrsCod,UsrCod,Role FROM crs_usr WHERE UsrCod=1346 AND Role=5) AS my_courses LEFT JOIN log ON (my_courses.CrsCod=log.CrsCod AND my_courses.UsrCod=log.UsrCod AND my_courses.Role=log.Role) GROUP BY my_courses.CrsCod ORDER BY N DESC,my_courses.CrsCod DESC; + +SELECT my_courses.CrsCod,COUNT(*) AS N FROM (SELECT CrsCod FROM crs_usr WHERE UsrCod=1346 AND Role=5) AS my_courses LEFT JOIN log ON (my_courses.CrsCod=log.CrsCod) WHERE log.UsrCod=1346 AND log.Role=5 GROUP BY my_courses.CrsCod ORDER BY N DESC,my_courses.CrsCod DESC; + + \ No newline at end of file diff --git a/sql/swad.sql b/sql/swad.sql index c00c8716..2d88ac85 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -181,18 +181,6 @@ CREATE TABLE IF NOT EXISTS chat ( NumUsrs INT NOT NULL, UNIQUE INDEX(RoomCode)); -- --- Table classrooms: stores the classrooms associated to each centre --- -CREATE TABLE IF NOT EXISTS classrooms ( - ClaCod INT NOT NULL AUTO_INCREMENT, - CtrCod INT NOT NULL, - ShortName VARCHAR(511) NOT NULL, - FullName VARCHAR(2047) NOT NULL, - Capacity INT NOT NULL, - Location VARCHAR(2047) NOT NULL, - UNIQUE INDEX(ClaCod), - INDEX(CtrCod)); --- -- Table clicks_without_photo: stores the number of clicks that remains to each user before being required to submit his/her photo -- CREATE TABLE IF NOT EXISTS clicks_without_photo ( @@ -283,13 +271,13 @@ CREATE TABLE IF NOT EXISTS crs_grp ( GrpCod INT NOT NULL AUTO_INCREMENT, GrpTypCod INT NOT NULL, GrpName VARCHAR(2047) NOT NULL, - ClaCod INT NOT NULL DEFAULT -1, + RooCod INT NOT NULL DEFAULT -1, MaxStudents INT NOT NULL, Open ENUM('N','Y') NOT NULL DEFAULT 'N', FileZones ENUM('N','Y') NOT NULL DEFAULT 'N', UNIQUE INDEX(GrpCod), INDEX(GrpTypCod), - INDEX(ClaCod)); + INDEX(RooCod)); -- -- Table crs_grp_types: stores the types of groups in courses -- @@ -1131,6 +1119,18 @@ CREATE TABLE IF NOT EXISTS projects ( INDEX(CrsCod,ModifTime), INDEX(CrsCod,DptCod)); -- +-- Table rooms: stores the classrooms associated to each centre +-- +CREATE TABLE IF NOT EXISTS rooms ( + RooCod INT NOT NULL AUTO_INCREMENT, + CtrCod INT NOT NULL, + ShortName VARCHAR(511) NOT NULL, + FullName VARCHAR(2047) NOT NULL, + Capacity INT NOT NULL, + Location VARCHAR(2047) NOT NULL, + UNIQUE INDEX(RooCod), + INDEX(CtrCod)); +-- -- Table sessions: stores the information of open sessions -- CREATE TABLE IF NOT EXISTS sessions ( diff --git a/swad_API.c b/swad_API.c index 08dfb4e2..2efa7bd4 100644 --- a/swad_API.c +++ b/swad_API.c @@ -103,8 +103,10 @@ cp -f /home/acanas/swad/swad/swad /var/www/cgi-bin/ #include "swad_account.h" #include "swad_API.h" +#include "swad_attendance.h" #include "swad_database.h" #include "swad_file_browser.h" +#include "swad_forum.h" #include "swad_global.h" #include "swad_hierarchy.h" #include "swad_ID.h" diff --git a/swad_account.c b/swad_account.c index bdee3bd6..8989f352 100644 --- a/swad_account.c +++ b/swad_account.c @@ -28,7 +28,9 @@ #include // For string functions #include "swad_account.h" +#include "swad_agenda.h" #include "swad_announcement.h" +#include "swad_attendance.h" #include "swad_box.h" #include "swad_calendar.h" #include "swad_database.h" @@ -36,14 +38,17 @@ #include "swad_enrolment.h" #include "swad_follow.h" #include "swad_form.h" +#include "swad_forum.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_ID.h" #include "swad_language.h" +#include "swad_message.h" #include "swad_nickname.h" #include "swad_notification.h" #include "swad_parameter.h" #include "swad_profile.h" +#include "swad_project.h" #include "swad_report.h" #include "swad_test_exam.h" #include "swad_timeline.h" diff --git a/swad_action.c b/swad_action.c index fa8d6518..691c3aa9 100644 --- a/swad_action.c +++ b/swad_action.c @@ -28,6 +28,7 @@ #include "swad_action.h" #include "swad_agenda.h" #include "swad_announcement.h" +#include "swad_attendance.h" #include "swad_banner.h" #include "swad_calendar.h" #include "swad_centre_config.h" @@ -42,23 +43,28 @@ #include "swad_date.h" #include "swad_degree_config.h" #include "swad_degree_type.h" +#include "swad_department.h" #include "swad_duplicate.h" #include "swad_exam.h" #include "swad_enrolment.h" #include "swad_figure.h" #include "swad_follow.h" +#include "swad_forum.h" #include "swad_game.h" #include "swad_global.h" +#include "swad_holiday.h" #include "swad_ID.h" #include "swad_indicator.h" #include "swad_institution_config.h" #include "swad_language.h" +#include "swad_link.h" #include "swad_log.h" #include "swad_mail.h" #include "swad_maintenance.h" #include "swad_mark.h" #include "swad_match.h" #include "swad_match_result.h" +#include "swad_message.h" #include "swad_MFU.h" #include "swad_network.h" #include "swad_nickname.h" @@ -67,6 +73,7 @@ #include "swad_parameter.h" #include "swad_password.h" #include "swad_photo.h" +#include "swad_place.h" #include "swad_privacy.h" #include "swad_profile.h" #include "swad_program.h" @@ -76,10 +83,12 @@ #include "swad_role.h" #include "swad_search.h" #include "swad_setting.h" +#include "swad_survey.h" #include "swad_system_config.h" #include "swad_tab.h" #include "swad_test_import.h" #include "swad_timeline.h" +#include "swad_timetable.h" #include "swad_zip.h" /*****************************************************************************/ @@ -306,7 +315,7 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = // Actions in menu: [ActSeeCtrInf ] = {1151, 0,TabCtr,ActSeeCtrInf , 0, 0, 0,0x3C7, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,CtrCfg_ShowConfiguration ,"info" }, [ActSeeDeg ] = {1011, 1,TabCtr,ActSeeDeg , 0, 0, 0,0x3C7, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_ShowDegsOfCurrentCtr ,"graduation-cap" }, - [ActSeeCla ] = {1744, 2,TabCtr,ActSeeCla , 0, 0, 0,0x3C7, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cla_SeeClassrooms ,"classroom" }, + [ActSeeRoo ] = {1744, 2,TabCtr,ActSeeRoo , 0, 0, 0,0x3C7, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Roo_SeeRooms ,"classroom" }, // Actions not in menu: [ActPrnCtrInf ] = {1152,-1,TabUnk,ActSeeCtrInf , 0, 0, 0,0x3C7, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,CtrCfg_PrintConfiguration ,NULL}, @@ -341,13 +350,13 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = [ActChgDegWWW ] = { 554,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_ChangeDegWWW ,Deg_ContEditAfterChgDeg ,NULL}, [ActChgDegSta ] = {1207,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x380, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_ChangeDegStatus ,Deg_ContEditAfterChgDeg ,NULL}, - [ActEdiCla ] = {1745,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cla_EditClassrooms ,NULL}, - [ActNewCla ] = {1746,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cla_RecFormNewClassroom ,Cla_ContEditAfterChgCla ,NULL}, - [ActRemCla ] = {1747,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cla_RemoveClassroom ,Cla_ContEditAfterChgCla ,NULL}, - [ActRenClaSho ] = {1748,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cla_RenameClassroomShort ,Cla_ContEditAfterChgCla ,NULL}, - [ActRenClaFul ] = {1749,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cla_RenameClassroomFull ,Cla_ContEditAfterChgCla ,NULL}, - [ActChgClaMaxStd ] = {1750,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cla_ChangeCapacity ,Cla_ContEditAfterChgCla ,NULL}, - [ActRenClaLoc ] = {1751,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cla_ChangeClassroomLocation ,Cla_ContEditAfterChgCla ,NULL}, + [ActEdiRoo ] = {1745,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Roo_EditRooms ,NULL}, + [ActNewRoo ] = {1746,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_RecFormNewRoom ,Roo_ContEditAfterChgRoom ,NULL}, + [ActRemRoo ] = {1747,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_RemoveRoom ,Roo_ContEditAfterChgRoom ,NULL}, + [ActRenRooSho ] = {1748,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_RenameRoomShort ,Roo_ContEditAfterChgRoom ,NULL}, + [ActRenRooFul ] = {1749,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_RenameRoomFull ,Roo_ContEditAfterChgRoom ,NULL}, + [ActChgRooMaxUsr ] = {1750,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_ChangeCapacity ,Roo_ContEditAfterChgRoom ,NULL}, + [ActRenRooLoc ] = {1751,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_ChangeRoomLocation ,Roo_ContEditAfterChgRoom ,NULL}, // TabDeg ****************************************************************** // Actions in menu: @@ -1241,7 +1250,7 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = [ActDisFilZonGrp ] = { 496,-1,TabUnk,ActReqSelGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Grp_DisableFileZonesGrp ,NULL}, [ActChgGrpTyp ] = { 167,-1,TabUnk,ActReqSelGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Grp_ChangeGroupType ,NULL}, [ActRenGrp ] = { 121,-1,TabUnk,ActReqSelGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Grp_RenameGroup ,NULL}, - [ActChgGrpCla ] = {1752,-1,TabUnk,ActReqSelGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Grp_ChangeGroupClassroom ,NULL}, + [ActChgGrpRoo ] = {1752,-1,TabUnk,ActReqSelGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Grp_ChangeGroupRoom ,NULL}, [ActChgMaxStdGrp ] = { 106,-1,TabUnk,ActReqSelGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Grp_ChangeMaxStdsGrp ,NULL}, [ActLstGst ] = { 587,-1,TabUnk,ActLstOth ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_SeeGuests ,NULL}, @@ -3472,15 +3481,15 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActChgNicOth, // #1741 ActChgNicStd, // #1742 ActChgNicTch, // #1743 - ActSeeCla, // #1744 - ActEdiCla, // #1745 - ActNewCla, // #1746 - ActRemCla, // #1747 - ActRenClaSho, // #1748 - ActRenClaFul, // #1749 - ActChgClaMaxStd, // #1750 - ActRenClaLoc, // #1751 - ActChgGrpCla, // #1752 + ActSeeRoo, // #1744 + ActEdiRoo, // #1745 + ActNewRoo, // #1746 + ActRemRoo, // #1747 + ActRenRooSho, // #1748 + ActRenRooFul, // #1749 + ActChgRooMaxUsr, // #1750 + ActRenRooLoc, // #1751 + ActChgGrpRoo, // #1752 ActDoActOnSevGst, // #1753 ActDoActOnSevStd, // #1754 ActDoActOnSevTch, // #1755 diff --git a/swad_action.h b/swad_action.h index 464b6514..61bc153e 100644 --- a/swad_action.h +++ b/swad_action.h @@ -293,7 +293,7 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to // Actions in menu #define ActSeeCtrInf (ActRenHld + 1) #define ActSeeDeg (ActRenHld + 2) -#define ActSeeCla (ActRenHld + 3) +#define ActSeeRoo (ActRenHld + 3) // Secondary actions #define ActPrnCtrInf (ActRenHld + 4) @@ -328,40 +328,40 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActChgDegWWW (ActRenHld + 31) #define ActChgDegSta (ActRenHld + 32) -#define ActEdiCla (ActRenHld + 33) -#define ActNewCla (ActRenHld + 34) -#define ActRemCla (ActRenHld + 35) -#define ActRenClaSho (ActRenHld + 36) -#define ActRenClaFul (ActRenHld + 37) -#define ActChgClaMaxStd (ActRenHld + 38) -#define ActRenClaLoc (ActRenHld + 39) +#define ActEdiRoo (ActRenHld + 33) +#define ActNewRoo (ActRenHld + 34) +#define ActRemRoo (ActRenHld + 35) +#define ActRenRooSho (ActRenHld + 36) +#define ActRenRooFul (ActRenHld + 37) +#define ActChgRooMaxUsr (ActRenHld + 38) +#define ActRenRooLoc (ActRenHld + 39) /*****************************************************************************/ /********************************* Degree tab ********************************/ /*****************************************************************************/ // Actions in menu -#define ActSeeDegInf (ActRenClaLoc + 1) -#define ActSeeCrs (ActRenClaLoc + 2) +#define ActSeeDegInf (ActRenRooLoc + 1) +#define ActSeeCrs (ActRenRooLoc + 2) // Secondary actions -#define ActPrnDegInf (ActRenClaLoc + 3) -#define ActChgDegCtrCfg (ActRenClaLoc + 4) -#define ActRenDegShoCfg (ActRenClaLoc + 5) -#define ActRenDegFulCfg (ActRenClaLoc + 6) -#define ActChgDegWWWCfg (ActRenClaLoc + 7) -#define ActReqDegLog (ActRenClaLoc + 8) -#define ActRecDegLog (ActRenClaLoc + 9) -#define ActRemDegLog (ActRenClaLoc + 10) +#define ActPrnDegInf (ActRenRooLoc + 3) +#define ActChgDegCtrCfg (ActRenRooLoc + 4) +#define ActRenDegShoCfg (ActRenRooLoc + 5) +#define ActRenDegFulCfg (ActRenRooLoc + 6) +#define ActChgDegWWWCfg (ActRenRooLoc + 7) +#define ActReqDegLog (ActRenRooLoc + 8) +#define ActRecDegLog (ActRenRooLoc + 9) +#define ActRemDegLog (ActRenRooLoc + 10) -#define ActEdiCrs (ActRenClaLoc + 11) -#define ActReqCrs (ActRenClaLoc + 12) -#define ActNewCrs (ActRenClaLoc + 13) -#define ActRemCrs (ActRenClaLoc + 14) -#define ActChgInsCrsCod (ActRenClaLoc + 15) -#define ActChgCrsYea (ActRenClaLoc + 16) -#define ActRenCrsSho (ActRenClaLoc + 17) -#define ActRenCrsFul (ActRenClaLoc + 18) -#define ActChgCrsSta (ActRenClaLoc + 19) +#define ActEdiCrs (ActRenRooLoc + 11) +#define ActReqCrs (ActRenRooLoc + 12) +#define ActNewCrs (ActRenRooLoc + 13) +#define ActRemCrs (ActRenRooLoc + 14) +#define ActChgInsCrsCod (ActRenRooLoc + 15) +#define ActChgCrsYea (ActRenRooLoc + 16) +#define ActRenCrsSho (ActRenRooLoc + 17) +#define ActRenCrsFul (ActRenRooLoc + 18) +#define ActChgCrsSta (ActRenRooLoc + 19) /*****************************************************************************/ /******************************** Course tab *********************************/ @@ -1210,7 +1210,7 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActDisFilZonGrp (ActRemOldBrf + 24) #define ActChgGrpTyp (ActRemOldBrf + 25) #define ActRenGrp (ActRemOldBrf + 26) -#define ActChgGrpCla (ActRemOldBrf + 27) +#define ActChgGrpRoo (ActRemOldBrf + 27) #define ActChgMaxStdGrp (ActRemOldBrf + 28) #define ActLstGst (ActRemOldBrf + 29) diff --git a/swad_attendance.c b/swad_attendance.c index e6ffb7c1..a2cdc906 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -1559,10 +1559,10 @@ static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct Att_Event *Ev NumGrps = (unsigned) DB_QuerySELECT (&mysql_res,"can not get groups of an attendance event", "SELECT crs_grp_types.GrpTypName," "crs_grp.GrpName," - "classrooms.ShortName" + "rooms.ShortName" " FROM (att_grp,crs_grp,crs_grp_types)" - " LEFT JOIN classrooms" - " ON crs_grp.ClaCod=classrooms.ClaCod" + " LEFT JOIN rooms" + " ON crs_grp.RooCod=rooms.RooCod" " WHERE att_grp.AttCod=%ld" " AND att_grp.GrpCod=crs_grp.GrpCod" " AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod" @@ -1589,7 +1589,7 @@ static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct Att_Event *Ev /* Write group type name (row[0]) and group name (row[1]) */ HTM_TxtF ("%s %s",row[0],row[1]); - /* Write the name of the classroom (row[2]) */ + /* Write the name of the room (row[2]) */ if (row[2]) // May be NULL because of LEFT JOIN if (row[2][0]) HTM_TxtF (" (%s)",row[2]); diff --git a/swad_banner.c b/swad_banner.c index 079cba81..d2990f7b 100644 --- a/swad_banner.c +++ b/swad_banner.c @@ -37,9 +37,9 @@ #include "swad_global.h" #include "swad_HTML.h" #include "swad_language.h" +#include "swad_link.h" #include "swad_parameter.h" #include "swad_photo.h" -// struct Ban_Banners Ban_Banners; /*****************************************************************************/ /************** External global variables from others modules ****************/ diff --git a/swad_calendar.c b/swad_calendar.c index a0a56e5d..ea341d1a 100644 --- a/swad_calendar.c +++ b/swad_calendar.c @@ -31,8 +31,10 @@ #include "swad_calendar.h" #include "swad_database.h" #include "swad_exam.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" +#include "swad_holiday.h" #include "swad_HTML.h" #include "swad_parameter.h" #include "swad_setting.h" diff --git a/swad_centre.c b/swad_centre.c index 4a6da5ce..b5f7dcd3 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -33,10 +33,15 @@ #include "swad_centre.h" #include "swad_centre_config.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" +#include "swad_forum.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_logo.h" +#include "swad_message.h" +#include "swad_place.h" +#include "swad_survey.h" /*****************************************************************************/ /************** External global variables from others modules ****************/ @@ -1252,8 +1257,8 @@ void Ctr_RemoveCentre (void) /***** Remove information related to files in centre *****/ Brw_RemoveCtrFilesFromDB (Ctr_EditingCtr->CtrCod); - /***** Remove all classrooms in centre *****/ - Cla_RemoveAllClassroomsInCtr (Ctr_EditingCtr->CtrCod); + /***** Remove all rooms in centre *****/ + Roo_RemoveAllRoomsInCtr (Ctr_EditingCtr->CtrCod); /***** Remove directories of the centre *****/ snprintf (PathCtr,sizeof (PathCtr), diff --git a/swad_centre_config.c b/swad_centre_config.c index 36f4246c..110697f0 100644 --- a/swad_centre_config.c +++ b/swad_centre_config.c @@ -41,6 +41,7 @@ #include "swad_hierarchy_config.h" #include "swad_HTML.h" #include "swad_logo.h" +#include "swad_place.h" /*****************************************************************************/ /************** External global variables from others modules ****************/ diff --git a/swad_changelog.h b/swad_changelog.h index 5b2244e5..2e500a1f 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.184 (2020-04-14)" +#define Log_PLATFORM_VERSION "SWAD 19.185 (2020-04-14)" #define CSS_FILE "swad19.146.css" #define JS_FILE "swad19.172.1.js" /* @@ -548,6 +548,16 @@ Funci // TODO: Oresti Baños: cambiar ojos por candados en descriptores para prohibir/permitir y dejar los ojos para poder elegir descriptores // TODO: Integrar pull requests con traducciones del alemán del usuario eruedin en GitHub + Version 19.185: Apr 14, 2020 Module swad_classroom is renamed as swad_room. + Improvement in querying the database in the usage report. (285813 lines) + 5 changes necessary in database: +RENAME TABLE classrooms TO rooms; +ALTER TABLE rooms CHANGE COLUMN ClaCod RooCod INT NOT NULL AUTO_INCREMENT; +ALTER TABLE rooms DROP INDEX ClaCod,ADD UNIQUE INDEX(RooCod); + +ALTER TABLE crs_grp CHANGE COLUMN ClaCod RooCod INT NOT NULL DEFAULT -1; +ALTER TABLE crs_grp DROP INDEX ClaCod,ADD INDEX(RooCod); + Version 19.184: Apr 14, 2020 Code refactoring in classrooms. (285706 lines) Version 19.183.2: Apr 14, 2020 Fixed bug in test exams. (285684 lines) Version 19.183.1: Apr 14, 2020 Fixed bug in forums, reported by Javier Fernández Baldomero. (285677 lines) diff --git a/swad_classroom.c b/swad_classroom.c deleted file mode 100644 index 7494354e..00000000 --- a/swad_classroom.c +++ /dev/null @@ -1,1087 +0,0 @@ -// swad_classroom.c: classrooms, laboratories or other classrooms where classes are taught - -/* - SWAD (Shared Workspace At a Distance), - is a web platform developed at the University of Granada (Spain), - and used to support university teaching. - - This file is part of SWAD core. - Copyright (C) 1999-2020 Antonio Cañas Vargas - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -/*****************************************************************************/ -/********************************** Headers **********************************/ -/*****************************************************************************/ - -#include // For calloc, free -#include // For NULL -#include // For string functions - -#include "swad_box.h" -#include "swad_classroom.h" -#include "swad_database.h" -#include "swad_form.h" -#include "swad_global.h" -#include "swad_HTML.h" - -/*****************************************************************************/ -/************** External global variables from others modules ****************/ -/*****************************************************************************/ - -extern struct Globals Gbl; - -/*****************************************************************************/ -/***************************** Private constants *****************************/ -/*****************************************************************************/ - -/*****************************************************************************/ -/******************************* Private types *******************************/ -/*****************************************************************************/ - -/*****************************************************************************/ -/***************************** Private variables *****************************/ -/*****************************************************************************/ - -static struct Cla_Classroom *Cla_EditingCla = NULL; // Static variable to keep the classroom being edited - -/*****************************************************************************/ -/***************************** Private prototypes ****************************/ -/*****************************************************************************/ - -static Cla_Order_t Cla_GetParamClaOrder (void); -static bool Cla_CheckIfICanCreateClassrooms (void); -static void Cla_PutIconsListingClassrooms (__attribute__((unused)) void *Args); -static void Cla_PutIconToEditClassrooms (void); -static void Cla_PutIconsEditingClassrooms (__attribute__((unused)) void *Args); - -static void Cla_EditClassroomsInternal (void); - -static void Cla_ListClassroomsForEdition (const struct Cla_Classrooms *Classrooms); -static void Cla_PutParamClaCod (long ClaCod); - -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_WriteCapacity (char Str[Cns_MAX_DECIMAL_DIGITS_UINT + 1],unsigned Capacity); - -static void Cla_PutFormToCreateClassroom (void); -static void Cla_PutHeadClassrooms (void); -static void Cla_CreateClassroom (struct Cla_Classroom *Cla); - -static void Cla_EditingClassroomConstructor (void); -static void Cla_EditingClassroomDestructor (void); - -/*****************************************************************************/ -/************************* Reset classrooms context **************************/ -/*****************************************************************************/ - -void Cla_ResetClassrooms (struct Cla_Classrooms *Classrooms) - { - Classrooms->Num = 0; // Number of classrooms - Classrooms->Lst = NULL; // List of classrooms - Classrooms->SelectedOrder = Cla_ORDER_DEFAULT; - } - -/*****************************************************************************/ -/************************* List all the classrooms ***************************/ -/*****************************************************************************/ - -void Cla_SeeClassrooms (void) - { - extern const char *Hlp_CENTRE_Classrooms; - extern const char *Txt_Classrooms; - extern const char *Txt_CLASSROOMS_HELP_ORDER[Cla_NUM_ORDERS]; - extern const char *Txt_CLASSROOMS_ORDER[Cla_NUM_ORDERS]; - extern const char *Txt_New_classroom; - struct Cla_Classrooms Classrooms; - Cla_Order_t Order; - unsigned NumCla; - unsigned RowEvenOdd; - char StrCapacity[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; - - /***** Trivial check *****/ - if (Gbl.Hierarchy.Ctr.CtrCod <= 0) // No centre selected - return; - - /***** Reset classrooms context *****/ - Cla_ResetClassrooms (&Classrooms); - - /***** Get parameter with the type of order in the list of classrooms *****/ - Classrooms.SelectedOrder = Cla_GetParamClaOrder (); - - /***** Get list of classrooms *****/ - Cla_GetListClassrooms (&Classrooms,Cla_ALL_DATA); - - /***** Table head *****/ - Box_BoxBegin (NULL,Txt_Classrooms, - Cla_PutIconsListingClassrooms,NULL, - Hlp_CENTRE_Classrooms,Box_NOT_CLOSABLE); - HTM_TABLE_BeginWideMarginPadding (2); - HTM_TR_Begin (NULL); - for (Order = (Cla_Order_t) 0; - Order <= (Cla_Order_t) (Cla_NUM_ORDERS - 1); - Order++) - { - HTM_TH_Begin (1,1,"LM"); - Frm_StartForm (ActSeeCla); - Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Order); - HTM_BUTTON_SUBMIT_Begin (Txt_CLASSROOMS_HELP_ORDER[Order],"BT_LINK TIT_TBL",NULL); - if (Order == Classrooms.SelectedOrder) - HTM_U_Begin (); - HTM_Txt (Txt_CLASSROOMS_ORDER[Order]); - if (Order == Classrooms.SelectedOrder) - HTM_U_End (); - HTM_BUTTON_End (); - Frm_EndForm (); - HTM_TH_End (); - } - HTM_TR_End (); - - /***** Write list of classrooms *****/ - for (NumCla = 0, RowEvenOdd = 1; - NumCla < Classrooms.Num; - NumCla++, RowEvenOdd = 1 - RowEvenOdd) - { - HTM_TR_Begin (NULL); - - /* Short name */ - HTM_TD_Begin ("class=\"DAT LM %s\"",Gbl.ColorRows[RowEvenOdd]); - HTM_Txt (Classrooms.Lst[NumCla].ShrtName); - HTM_TD_End (); - - /* Full name */ - HTM_TD_Begin ("class=\"DAT LM %s\"",Gbl.ColorRows[RowEvenOdd]); - HTM_Txt (Classrooms.Lst[NumCla].FullName); - HTM_TD_End (); - - /* Capacity */ - HTM_TD_Begin ("class=\"DAT RM %s\"",Gbl.ColorRows[RowEvenOdd]); - Cla_WriteCapacity (StrCapacity,Classrooms.Lst[NumCla].Capacity); - HTM_Txt (StrCapacity); - HTM_TD_End (); - - /* Location */ - HTM_TD_Begin ("class=\"DAT LM %s\"",Gbl.ColorRows[RowEvenOdd]); - HTM_Txt (Classrooms.Lst[NumCla].Location); - HTM_TD_End (); - - HTM_TR_End (); - } - - /***** End table *****/ - HTM_TABLE_End (); - - /***** Button to create classroom *****/ - if (Cla_CheckIfICanCreateClassrooms ()) - { - Frm_StartForm (ActEdiCla); - Btn_PutConfirmButton (Txt_New_classroom); - Frm_EndForm (); - } - - /***** End box *****/ - Box_BoxEnd (); - - /***** Free list of classrooms *****/ - Cla_FreeListClassrooms (&Classrooms); - } - -/*****************************************************************************/ -/******** Get parameter with the type or order in list of classrooms *********/ -/*****************************************************************************/ - -static Cla_Order_t Cla_GetParamClaOrder (void) - { - return (Cla_Order_t) Par_GetParToUnsignedLong ("Order", - 0, - Cla_NUM_ORDERS - 1, - (unsigned long) Cla_ORDER_DEFAULT); - } - -/*****************************************************************************/ -/******************** Check if I can create classrooms ***********************/ -/*****************************************************************************/ - -static bool Cla_CheckIfICanCreateClassrooms (void) - { - return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM); - } - -/*****************************************************************************/ -/**************** Put contextual icons in list of classrooms *****************/ -/*****************************************************************************/ - -static void Cla_PutIconsListingClassrooms (__attribute__((unused)) void *Args) - { - /***** Put icon to edit classrooms *****/ - if (Cla_CheckIfICanCreateClassrooms ()) - Cla_PutIconToEditClassrooms (); - } - -/*****************************************************************************/ -/******************** Put a link (form) to edit classrooms *******************/ -/*****************************************************************************/ - -static void Cla_PutIconToEditClassrooms (void) - { - Ico_PutContextualIconToEdit (ActEdiCla,NULL, - NULL,NULL); - } - -/*****************************************************************************/ -/************************* Put forms to edit classrooms **********************/ -/*****************************************************************************/ - -void Cla_EditClassrooms (void) - { - /***** Classroom constructor *****/ - Cla_EditingClassroomConstructor (); - - /***** Edit classrooms *****/ - Cla_EditClassroomsInternal (); - - /***** Classroom destructor *****/ - Cla_EditingClassroomDestructor (); - } - -static void Cla_EditClassroomsInternal (void) - { - extern const char *Hlp_CENTRE_Classrooms_edit; - extern const char *Txt_Classrooms; - struct Cla_Classrooms Classrooms; - - /***** Reset classrooms context *****/ - Cla_ResetClassrooms (&Classrooms); - - /***** Get list of classrooms *****/ - Cla_GetListClassrooms (&Classrooms,Cla_ALL_DATA); - - /***** Begin box *****/ - Box_BoxBegin (NULL,Txt_Classrooms, - Cla_PutIconsEditingClassrooms,NULL, - Hlp_CENTRE_Classrooms_edit,Box_NOT_CLOSABLE); - - /***** Put a form to create a new classroom *****/ - Cla_PutFormToCreateClassroom (); - - /***** Forms to edit current classrooms *****/ - if (Classrooms.Num) - Cla_ListClassroomsForEdition (&Classrooms); - - /***** End box *****/ - Box_BoxEnd (); - - /***** Free list of classrooms *****/ - Cla_FreeListClassrooms (&Classrooms); - } - -/*****************************************************************************/ -/*************** Put contextual icons in edition of classrooms ***************/ -/*****************************************************************************/ - -static void Cla_PutIconsEditingClassrooms (__attribute__((unused)) void *Args) - { - /***** Put icon to view classrooms *****/ - Cla_PutIconToViewClassrooms (); - } - -/*****************************************************************************/ -/************************ Put icon to view classrooms ************************/ -/*****************************************************************************/ - -void Cla_PutIconToViewClassrooms (void) - { - extern const char *Txt_Classrooms; - - Lay_PutContextualLinkOnlyIcon (ActSeeCla,NULL, - NULL,NULL, - "classroom.svg", - Txt_Classrooms); - } - -/*****************************************************************************/ -/************************** List all the classrooms **************************/ -/*****************************************************************************/ - -void Cla_GetListClassrooms (struct Cla_Classrooms *Classrooms, - Cla_WhichData_t WhichData) - { - static const char *OrderBySubQuery[Cla_NUM_ORDERS] = - { - [Cla_ORDER_BY_SHRT_NAME] = "ShortName", - [Cla_ORDER_BY_FULL_NAME] = "FullName", - [Cla_ORDER_BY_CAPACITY ] = "Capacity DESC,ShortName", - [Cla_ORDER_BY_LOCATION ] = "Location,ShortName", - }; - MYSQL_RES *mysql_res; - MYSQL_ROW row; - unsigned long NumRows; - unsigned NumCla; - struct Cla_Classroom *Cla; - - /***** Get classrooms from database *****/ - 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.Hierarchy.Ctr.CtrCod, - OrderBySubQuery[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.Hierarchy.Ctr.CtrCod); - break; - } - - /***** Count number of rows in result *****/ - if (NumRows) // Classrooms found... - { - Classrooms->Num = (unsigned) NumRows; - - /***** Create list with courses in centre *****/ - if ((Classrooms->Lst = (struct Cla_Classroom *) - calloc (NumRows, - sizeof (struct Cla_Classroom))) == NULL) - Lay_NotEnoughMemoryExit (); - - /***** Get the classrooms *****/ - for (NumCla = 0; - NumCla < Classrooms->Num; - NumCla++) - { - Cla = &Classrooms->Lst[NumCla]; - - /* Get next classroom */ - row = mysql_fetch_row (mysql_res); - - /* Get classroom code (row[0]) */ - if ((Cla->ClaCod = Str_ConvertStrCodToLongCod (row[0])) < 0) - Lay_ShowErrorAndExit ("Wrong code of classroom."); - - /* Get the short name of the classroom (row[1]) */ - Str_Copy (Cla->ShrtName,row[1], - Cla_MAX_BYTES_SHRT_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 the full name of the classroom (row[4]) */ - Str_Copy (Cla->Location,row[4], - Cla_MAX_BYTES_LOCATION); - } - } - } - else - Classrooms->Num = 0; - - /***** Free structure that stores the query result *****/ - DB_FreeMySQLResult (&mysql_res); - } - -/*****************************************************************************/ -/************************** Get classroom full name **************************/ -/*****************************************************************************/ - -void Cla_GetDataOfClassroomByCod (struct Cla_Classroom *Cla) - { - MYSQL_RES *mysql_res; - MYSQL_ROW row; - unsigned long NumRows; - - /***** Clear data *****/ - Cla->ShrtName[0] = '\0'; - Cla->FullName[0] = '\0'; - Cla->Capacity = Cla_UNLIMITED_CAPACITY; - Cla->Location[0] = '\0'; - - /***** Check if classroom code is correct *****/ - if (Cla->ClaCod > 0) - { - /***** Get data of a classroom from database *****/ - NumRows = DB_QuerySELECT (&mysql_res,"can not get data of a classroom", - "SELECT ShortName," - "FullName," - "Capacity," - "Location" - " FROM classrooms" - " WHERE ClaCod=%ld", - Cla->ClaCod); - - /***** Count number of rows in result *****/ - if (NumRows) // Classroom found... - { - /* Get row */ - row = mysql_fetch_row (mysql_res); - - /* Get the short name of the classroom (row[0]) */ - Str_Copy (Cla->ShrtName,row[0], - Cla_MAX_BYTES_SHRT_NAME); - - /* Get the full name of the classroom (row[1]) */ - Str_Copy (Cla->FullName,row[1], - Cla_MAX_BYTES_FULL_NAME); - - /* Get seating capacity in this classroom (row[2]) */ - if (sscanf (row[2],"%u",&Cla->Capacity) != 1) - Cla->Capacity = Cla_UNLIMITED_CAPACITY; - - /* Get the location of the classroom (row[3]) */ - Str_Copy (Cla->Location,row[3], - Cla_MAX_BYTES_LOCATION); - } - - /***** Free structure that stores the query result *****/ - DB_FreeMySQLResult (&mysql_res); - } - } - -/*****************************************************************************/ -/************************** Free list of classrooms **************************/ -/*****************************************************************************/ - -void Cla_FreeListClassrooms (struct Cla_Classrooms *Classrooms) - { - if (Classrooms->Lst) - { - /***** Free memory used by the list of classrooms in institution *****/ - free (Classrooms->Lst); - Classrooms->Lst = NULL; - Classrooms->Num = 0; - } - } - -/*****************************************************************************/ -/************************* List all the classrooms ***************************/ -/*****************************************************************************/ - -static void Cla_ListClassroomsForEdition (const struct Cla_Classrooms *Classrooms) - { - unsigned NumCla; - struct Cla_Classroom *Cla; - char StrCapacity[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; - - /***** Write heading *****/ - HTM_TABLE_BeginWidePadding (2); - Cla_PutHeadClassrooms (); - - /***** Write all the classrooms *****/ - for (NumCla = 0; - NumCla < Classrooms->Num; - NumCla++) - { - Cla = &Classrooms->Lst[NumCla]; - - HTM_TR_Begin (NULL); - - /* Put icon to remove classroom */ - HTM_TD_Begin ("class=\"BM\""); - Frm_StartForm (ActRemCla); - Cla_PutParamClaCod (Cla->ClaCod); - Ico_PutIconRemove (); - Frm_EndForm (); - HTM_TD_End (); - - /* Classroom code */ - HTM_TD_Begin ("class=\"DAT RM\""); - HTM_Long (Cla->ClaCod); - HTM_TD_End (); - - /* Classroom short name */ - HTM_TD_Begin ("class=\"LM\""); - Frm_StartForm (ActRenClaSho); - Cla_PutParamClaCod (Cla->ClaCod); - HTM_INPUT_TEXT ("ShortName",Cla_MAX_CHARS_SHRT_NAME,Cla->ShrtName,true, - "size=\"10\" class=\"INPUT_SHORT_NAME\""); - Frm_EndForm (); - HTM_TD_End (); - - /* Classroom full name */ - HTM_TD_Begin ("class=\"LM\""); - Frm_StartForm (ActRenClaFul); - Cla_PutParamClaCod (Cla->ClaCod); - HTM_INPUT_TEXT ("FullName",Cla_MAX_CHARS_FULL_NAME,Cla->FullName,true, - "size=\"20\" class=\"INPUT_FULL_NAME\""); - Frm_EndForm (); - HTM_TD_End (); - - /* Seating capacity */ - HTM_TD_Begin ("class=\"LM\""); - Frm_StartForm (ActChgClaMaxStd); - Cla_PutParamClaCod (Cla->ClaCod); - Cla_WriteCapacity (StrCapacity,Cla->Capacity); - HTM_INPUT_TEXT ("Capacity",Cns_MAX_DECIMAL_DIGITS_UINT,StrCapacity,true, - "size=\"3\""); - Frm_EndForm (); - HTM_TD_End (); - - /* Classroom location */ - HTM_TD_Begin ("class=\"LM\""); - Frm_StartForm (ActRenClaLoc); - Cla_PutParamClaCod (Cla->ClaCod); - HTM_INPUT_TEXT ("Location",Cla_MAX_CHARS_LOCATION,Cla->Location,true, - "size=\"15\" class=\"INPUT_FULL_NAME\""); - Frm_EndForm (); - HTM_TD_End (); - - HTM_TR_End (); - } - - /***** End table *****/ - HTM_TABLE_End (); - } - -/*****************************************************************************/ -/****************** Write parameter with code of classroom *******************/ -/*****************************************************************************/ - -static void Cla_PutParamClaCod (long ClaCod) - { - Par_PutHiddenParamLong (NULL,"ClaCod",ClaCod); - } - -/*****************************************************************************/ -/******************* Get parameter with code of classroom ********************/ -/*****************************************************************************/ - -long Cla_GetParamClaCod (void) - { - /***** Get code of classroom *****/ - return Par_GetParToLong ("ClaCod"); - } - -/*****************************************************************************/ -/***************************** Remove a classroom ****************************/ -/*****************************************************************************/ - -void Cla_RemoveClassroom (void) - { - extern const char *Txt_Classroom_X_removed; - - /***** Classroom constructor *****/ - Cla_EditingClassroomConstructor (); - - /***** Get classroom code *****/ - if ((Cla_EditingCla->ClaCod = Cla_GetParamClaCod ()) == -1L) - Lay_ShowErrorAndExit ("Code of classroom is missing."); - - /***** Get data of the classroom from database *****/ - Cla_GetDataOfClassroomByCod (Cla_EditingCla); - - /***** Update groups assigned to this classroom *****/ - DB_QueryUPDATE ("can not update classroom in groups", - "UPDATE crs_grp SET ClaCod=0" // 0 means another classroom - " WHERE ClaCod=%ld", - Cla_EditingCla->ClaCod); - - /***** Remove classroom *****/ - DB_QueryDELETE ("can not remove a classroom", - "DELETE FROM classrooms WHERE ClaCod=%ld", - Cla_EditingCla->ClaCod); - - /***** Create message to show the change made *****/ - Ale_CreateAlert (Ale_SUCCESS,NULL, - Txt_Classroom_X_removed, - Cla_EditingCla->FullName); - } - -/*****************************************************************************/ -/******************** Remove all classrooms in a centre **********************/ -/*****************************************************************************/ - -void Cla_RemoveAllClassroomsInCtr (long CtrCod) - { - /***** Remove all classrooms in centre *****/ - DB_QueryDELETE ("can not remove classrooms", - "DELETE FROM classrooms" - " WHERE CtrCod=%ld", - CtrCod); - } - -/*****************************************************************************/ -/******************* Change the short name of a classroom ********************/ -/*****************************************************************************/ - -void Cla_RenameClassroomShort (void) - { - /***** Classroom constructor *****/ - Cla_EditingClassroomConstructor (); - - /***** Rename classroom *****/ - Cla_RenameClassroom (Cns_SHRT_NAME); - } - -/*****************************************************************************/ -/******************* Change the full name of a classroom *********************/ -/*****************************************************************************/ - -void Cla_RenameClassroomFull (void) - { - /***** Classroom constructor *****/ - Cla_EditingClassroomConstructor (); - - /***** Rename classroom *****/ - Cla_RenameClassroom (Cns_FULL_NAME); - } - -/*****************************************************************************/ -/********************** Change the name of a classroom ***********************/ -/*****************************************************************************/ - -static void Cla_RenameClassroom (Cns_ShrtOrFullName_t ShrtOrFullName) - { - extern const char *Txt_The_classroom_X_already_exists; - extern const char *Txt_The_classroom_X_has_been_renamed_as_Y; - extern const char *Txt_The_name_of_the_classroom_X_has_not_changed; - const char *ParamName = NULL; // Initialized to avoid warning - const char *FieldName = NULL; // Initialized to avoid warning - unsigned MaxBytes = 0; // Initialized to avoid warning - char *CurrentClaName = NULL; // Initialized to avoid warning - char NewClaName[Cla_MAX_BYTES_FULL_NAME + 1]; - - switch (ShrtOrFullName) - { - case Cns_SHRT_NAME: - ParamName = "ShortName"; - FieldName = "ShortName"; - MaxBytes = Cla_MAX_BYTES_SHRT_NAME; - CurrentClaName = Cla_EditingCla->ShrtName; - break; - case Cns_FULL_NAME: - ParamName = "FullName"; - FieldName = "FullName"; - MaxBytes = Cla_MAX_BYTES_FULL_NAME; - CurrentClaName = Cla_EditingCla->FullName; - break; - } - - /***** Get parameters from form *****/ - /* Get the code of the classroom */ - if ((Cla_EditingCla->ClaCod = Cla_GetParamClaCod ()) == -1L) - Lay_ShowErrorAndExit ("Code of classroom is missing."); - - /* Get the new name for the classroom */ - Par_GetParToText (ParamName,NewClaName,MaxBytes); - - /***** Get from the database the old names of the classroom *****/ - Cla_GetDataOfClassroomByCod (Cla_EditingCla); - - /***** Check if new name is empty *****/ - if (NewClaName[0]) - { - /***** 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... *****/ - if (Cla_CheckIfClassroomNameExists (ParamName,NewClaName,Cla_EditingCla->ClaCod)) - Ale_CreateAlert (Ale_WARNING,NULL, - Txt_The_classroom_X_already_exists, - NewClaName); - else - { - /* Update the table changing old name by new name */ - Cla_UpdateClaNameDB (Cla_EditingCla->ClaCod,FieldName,NewClaName); - - /* Write message to show the change made */ - Ale_CreateAlert (Ale_SUCCESS,NULL, - Txt_The_classroom_X_has_been_renamed_as_Y, - CurrentClaName,NewClaName); - } - } - else // The same name - Ale_CreateAlert (Ale_INFO,NULL, - Txt_The_name_of_the_classroom_X_has_not_changed, - CurrentClaName); - } - else - Ale_CreateAlertYouCanNotLeaveFieldEmpty (); - - /***** Update classroom name *****/ - Str_Copy (CurrentClaName,NewClaName, - MaxBytes); - } - -/*****************************************************************************/ -/******************** Check if the name of classroom exists ******************/ -/*****************************************************************************/ - -static bool Cla_CheckIfClassroomNameExists (const char *FieldName,const char *Name,long ClaCod) - { - /***** Get number of classrooms with a name from database *****/ - return (DB_QueryCOUNT ("can not check if the name of a classroom" - " already existed", - "SELECT COUNT(*) FROM classrooms" - " WHERE CtrCod=%ld" - " AND %s='%s' AND ClaCod<>%ld", - Gbl.Hierarchy.Ctr.CtrCod, - FieldName,Name,ClaCod) != 0); - } - -/*****************************************************************************/ -/************** Update classroom name in table of classrooms *****************/ -/*****************************************************************************/ - -static void Cla_UpdateClaNameDB (long ClaCod,const char *FieldName,const char *NewClaName) - { - /***** Update classroom changing old name by new name */ - DB_QueryUPDATE ("can not update the name of a classroom", - "UPDATE classrooms SET %s='%s' WHERE ClaCod=%ld", - FieldName,NewClaName,ClaCod); - } - -/*****************************************************************************/ -/****************** Change sitting capacity of a classroom *******************/ -/*****************************************************************************/ - -void Cla_ChangeCapacity (void) - { - extern const char *Txt_The_capacity_of_classroom_X_has_not_changed; - extern const char *Txt_The_classroom_X_does_not_have_a_limited_capacity_now; - extern const char *Txt_The_capacity_of_classroom_X_is_now_Y; - unsigned NewCapacity; - - /***** Classroom constructor *****/ - Cla_EditingClassroomConstructor (); - - /***** Get parameters from form *****/ - /* Get the code of the classroom */ - if ((Cla_EditingCla->ClaCod = Cla_GetParamClaCod ()) == -1L) - Lay_ShowErrorAndExit ("Code of classroom is missing."); - - /* Get the seating capacity of the classroom */ - NewCapacity = (unsigned) - Par_GetParToUnsignedLong ("Capacity", - 0, - Cla_MAX_CAPACITY, - Cla_UNLIMITED_CAPACITY); - - /***** Get data of the classroom from database *****/ - Cla_GetDataOfClassroomByCod (Cla_EditingCla); - - /***** Check if the old capacity equals the new one - (this happens when return is pressed without changes) *****/ - if (Cla_EditingCla->Capacity == NewCapacity) - /***** Message to show no changes made *****/ - Ale_CreateAlert (Ale_INFO,NULL, - Txt_The_capacity_of_classroom_X_has_not_changed, - Cla_EditingCla->FullName); - else - { - /***** Update the table of groups changing the old capacity to the new *****/ - DB_QueryUPDATE ("can not update the capacity of a classroom", - "UPDATE classrooms SET Capacity=%u WHERE ClaCod=%ld", - NewCapacity,Cla_EditingCla->ClaCod); - Cla_EditingCla->Capacity = NewCapacity; - - /***** Message to show the change made *****/ - if (NewCapacity > Grp_MAX_STUDENTS_IN_A_GROUP) - Ale_CreateAlert (Ale_SUCCESS,NULL, - Txt_The_classroom_X_does_not_have_a_limited_capacity_now, - Cla_EditingCla->FullName); - else - Ale_CreateAlert (Ale_SUCCESS,NULL, - Txt_The_capacity_of_classroom_X_is_now_Y, - Cla_EditingCla->FullName,NewCapacity); - } - } - -/*****************************************************************************/ -/****************** Write seating capacity of a classroom ********************/ -/*****************************************************************************/ - -static void Cla_WriteCapacity (char Str[Cns_MAX_DECIMAL_DIGITS_UINT + 1],unsigned Capacity) - { - if (Capacity <= Cla_MAX_CAPACITY) - snprintf (Str,Cns_MAX_DECIMAL_DIGITS_UINT + 1, - "%u", - Capacity); - else - Str[0] = '\0'; - } - -/*****************************************************************************/ -/******************** Change the location of a classroom *********************/ -/*****************************************************************************/ - -void Cla_ChangeClassroomLocation (void) - { - extern const char *Txt_The_location_of_the_classroom_X_has_changed_to_Y; - extern const char *Txt_The_location_of_the_classroom_X_has_not_changed; - char NewLocation[Cla_MAX_BYTES_FULL_NAME + 1]; - - /***** Classroom constructor *****/ - Cla_EditingClassroomConstructor (); - - /***** Get parameters from form *****/ - /* Get the code of the classroom */ - if ((Cla_EditingCla->ClaCod = Cla_GetParamClaCod ()) == -1L) - Lay_ShowErrorAndExit ("Code of classroom is missing."); - - /* Get the new location for the classroom */ - Par_GetParToText ("Location",NewLocation,Cla_MAX_BYTES_LOCATION); - - /***** Get from the database the old location of the classroom *****/ - Cla_GetDataOfClassroomByCod (Cla_EditingCla); - - /***** Check if old and new locations are the same - (this happens when return is pressed without changes) *****/ - if (strcmp (Cla_EditingCla->Location,NewLocation)) // Different locations - { - /* Update the table changing old name by new name */ - Cla_UpdateClaNameDB (Cla_EditingCla->ClaCod,"Location",NewLocation); - Str_Copy (Cla_EditingCla->Location,NewLocation, - Cla_MAX_BYTES_LOCATION); - - /* Write message to show the change made */ - Ale_CreateAlert (Ale_SUCCESS,NULL, - Txt_The_location_of_the_classroom_X_has_changed_to_Y, - Cla_EditingCla->FullName,NewLocation); - } - else // The same location - Ale_CreateAlert (Ale_INFO,NULL, - Txt_The_location_of_the_classroom_X_has_not_changed, - Cla_EditingCla->FullName); - } - -/*****************************************************************************/ -/******* Show alerts after changing a classroom and continue editing *********/ -/*****************************************************************************/ - -void Cla_ContEditAfterChgCla (void) - { - /***** Write message to show the change made *****/ - Ale_ShowAlerts (NULL); - - /***** Show the form again *****/ - Cla_EditClassroomsInternal (); - - /***** Classroom destructor *****/ - Cla_EditingClassroomDestructor (); - } - -/*****************************************************************************/ -/******************* Put a form to create a new classroom ********************/ -/*****************************************************************************/ - -static void Cla_PutFormToCreateClassroom (void) - { - extern const char *Txt_New_classroom; - extern const char *Txt_Create_classroom; - char StrCapacity[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; - - /***** Begin form *****/ - Frm_StartForm (ActNewCla); - - /***** Begin box and table *****/ - Box_BoxTableBegin (NULL,Txt_New_classroom, - NULL,NULL, - NULL,Box_NOT_CLOSABLE,2); - - /***** Write heading *****/ - Cla_PutHeadClassrooms (); - - HTM_TR_Begin (NULL); - - /***** Column to remove classroom, disabled here *****/ - HTM_TD_Begin ("class=\"BM\""); - HTM_TD_End (); - - /***** Classroom code *****/ - HTM_TD_Begin ("class=\"CODE\""); - HTM_TD_End (); - - /***** Classroom short name *****/ - HTM_TD_Begin ("class=\"LM\""); - HTM_INPUT_TEXT ("ShortName",Cla_MAX_CHARS_SHRT_NAME,Cla_EditingCla->ShrtName,false, - "size=\"10\" class=\"INPUT_SHORT_NAME\" required=\"required\""); - HTM_TD_End (); - - /***** Classroom full name *****/ - HTM_TD_Begin ("class=\"LM\""); - HTM_INPUT_TEXT ("FullName",Cla_MAX_CHARS_FULL_NAME,Cla_EditingCla->FullName,false, - "size=\"20\" class=\"INPUT_FULL_NAME\" required=\"required\""); - HTM_TD_End (); - - /***** Seating capacity *****/ - HTM_TD_Begin ("class=\"LM\""); - Cla_WriteCapacity (StrCapacity,Cla_EditingCla->Capacity); - HTM_INPUT_TEXT ("Capacity",Cns_MAX_DECIMAL_DIGITS_UINT,StrCapacity,false, - "size=\"3\""); - HTM_TD_End (); - - /***** Classroom location *****/ - HTM_TD_Begin ("class=\"LM\""); - HTM_INPUT_TEXT ("Location",Cla_MAX_CHARS_LOCATION,Cla_EditingCla->Location,false, - "size=\"15\" class=\"INPUT_FULL_NAME\""); - HTM_TD_End (); - - HTM_TR_End (); - - /***** End table, send button and end box *****/ - Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_classroom); - - /***** End form *****/ - Frm_EndForm (); - } - -/*****************************************************************************/ -/****************** Write header with fields of a classroom ******************/ -/*****************************************************************************/ - -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_Capacity_OF_A_CLASSROOM; - extern const char *Txt_Location; - - HTM_TR_Begin (NULL); - - HTM_TH (1,1,"BM",NULL); - HTM_TH (1,1,"RM",Txt_Code); - HTM_TH (1,1,"LM",Txt_Short_name); - HTM_TH (1,1,"LM",Txt_Full_name); - HTM_TH (1,1,"LM",Txt_Capacity_OF_A_CLASSROOM); - HTM_TH (1,1,"LM",Txt_Location); - - HTM_TR_End (); - } - -/*****************************************************************************/ -/***************** Receive form to create a new classroom ********************/ -/*****************************************************************************/ - -void Cla_RecFormNewClassroom (void) - { - extern const char *Txt_The_classroom_X_already_exists; - extern const char *Txt_Created_new_classroom_X; - extern const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_classroom; - - /***** Classroom constructor *****/ - Cla_EditingClassroomConstructor (); - - /***** Get parameters from form *****/ - /* Get classroom short name */ - Par_GetParToText ("ShortName",Cla_EditingCla->ShrtName,Cla_MAX_BYTES_SHRT_NAME); - - /* Get classroom full name */ - Par_GetParToText ("FullName",Cla_EditingCla->FullName,Cla_MAX_BYTES_FULL_NAME); - - /* Get seating capacity */ - Cla_EditingCla->Capacity = (unsigned) - Par_GetParToUnsignedLong ("Capacity", - 0, - Cla_MAX_CAPACITY, - Cla_UNLIMITED_CAPACITY); - - /* Get classroom location */ - Par_GetParToText ("Location",Cla_EditingCla->Location,Cla_MAX_BYTES_LOCATION); - - if (Cla_EditingCla->ShrtName[0] && - Cla_EditingCla->FullName[0]) // If there's a classroom name - { - /***** If name of classroom was in database... *****/ - if (Cla_CheckIfClassroomNameExists ("ShortName",Cla_EditingCla->ShrtName,-1L)) - Ale_CreateAlert (Ale_WARNING,NULL, - Txt_The_classroom_X_already_exists, - Cla_EditingCla->ShrtName); - else if (Cla_CheckIfClassroomNameExists ("FullName",Cla_EditingCla->FullName,-1L)) - Ale_CreateAlert (Ale_WARNING,NULL, - Txt_The_classroom_X_already_exists, - Cla_EditingCla->FullName); - else // Add new classroom to database - { - Cla_CreateClassroom (Cla_EditingCla); - Ale_CreateAlert (Ale_SUCCESS,NULL, - Txt_Created_new_classroom_X, - Cla_EditingCla->FullName); - } - } - else // If there is not a classroom name - Ale_CreateAlert (Ale_WARNING,NULL, - Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_classroom); - } - -/*****************************************************************************/ -/************************** Create a new classroom ***************************/ -/*****************************************************************************/ - -static void Cla_CreateClassroom (struct Cla_Classroom *Cla) - { - /***** Create a new classroom *****/ - DB_QueryINSERT ("can not create classroom", - "INSERT INTO classrooms" - " (CtrCod,ShortName,FullName,Capacity,Location)" - " VALUES" - " (%ld,'%s','%s',%u,'%s')", - Gbl.Hierarchy.Ctr.CtrCod, - Cla->ShrtName,Cla->FullName,Cla->Capacity,Cla->Location); - } - -/*****************************************************************************/ -/************************* Classroom constructor/destructor **********************/ -/*****************************************************************************/ - -static void Cla_EditingClassroomConstructor (void) - { - /***** Pointer must be NULL *****/ - if (Cla_EditingCla != NULL) - Lay_ShowErrorAndExit ("Error initializing classroom."); - - /***** Allocate memory for classroom *****/ - if ((Cla_EditingCla = (struct Cla_Classroom *) malloc (sizeof (struct Cla_Classroom))) == NULL) - Lay_ShowErrorAndExit ("Error allocating memory for classroom."); - - /***** Reset classroom *****/ - Cla_EditingCla->ClaCod = -1L; - Cla_EditingCla->InsCod = -1L; - Cla_EditingCla->ShrtName[0] = '\0'; - Cla_EditingCla->FullName[0] = '\0'; - Cla_EditingCla->Capacity = Cla_UNLIMITED_CAPACITY; - Cla_EditingCla->Location[0] = '\0'; - } - -static void Cla_EditingClassroomDestructor (void) - { - /***** Free memory used for classroom *****/ - if (Cla_EditingCla != NULL) - { - free (Cla_EditingCla); - Cla_EditingCla = NULL; - } - } diff --git a/swad_classroom.h b/swad_classroom.h deleted file mode 100644 index 4ef0fa60..00000000 --- a/swad_classroom.h +++ /dev/null @@ -1,111 +0,0 @@ -// swad_classroom.h: classrooms, laboratories or other classrooms where classes are taught - -#ifndef _SWAD_CLA -#define _SWAD_CLA -/* - SWAD (Shared Workspace At a Distance in Spanish), - is a web platform developed at the University of Granada (Spain), - and used to support university teaching. - - This file is part of SWAD core. - Copyright (C) 1999-2020 Antonio Cañas Vargas - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as - published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . -*/ -/*****************************************************************************/ -/********************************** Headers **********************************/ -/*****************************************************************************/ - -#include "swad_string.h" - -/*****************************************************************************/ -/************************** Public types and constants ***********************/ -/*****************************************************************************/ - -#define Cla_MAX_CHARS_SHRT_NAME (32 - 1) // 31 -#define Cla_MAX_BYTES_SHRT_NAME ((Cla_MAX_CHARS_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511 - -#define Cla_MAX_CHARS_FULL_NAME (128 - 1) // 127 -#define Cla_MAX_BYTES_FULL_NAME ((Cla_MAX_CHARS_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 - -#define Cla_MAX_CAPACITY 10000 // If capacity of a classroom is greater than this, it is considered infinite -#define Cla_UNLIMITED_CAPACITY INT_MAX // This number can be stored in database as an integer... - // ...and means that a classroom has no limited capacity - -#define Cla_MAX_CHARS_LOCATION (128 - 1) // 127 -#define Cla_MAX_BYTES_LOCATION ((Cla_MAX_CHARS_LOCATION + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 - -struct Cla_Classroom - { - long ClaCod; - long InsCod; - char ShrtName[Cla_MAX_BYTES_SHRT_NAME + 1]; - char FullName[Cla_MAX_BYTES_FULL_NAME + 1]; - unsigned Capacity; // Seating capacity (maximum number of people that fit in the room) - char Location[Cla_MAX_BYTES_LOCATION + 1]; // Examples: Ground floor, first floor, basement - }; - -#define Cla_NUM_ORDERS 4 -typedef enum - { - Cla_ORDER_BY_SHRT_NAME = 0, - Cla_ORDER_BY_FULL_NAME = 1, - Cla_ORDER_BY_CAPACITY = 2, - Cla_ORDER_BY_LOCATION = 3, - } 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; - -struct Cla_Classrooms - { - unsigned Num; // Number of classrooms - struct Cla_Classroom *Lst; // List of classrooms - Cla_Order_t SelectedOrder; - }; - -/*****************************************************************************/ -/***************************** Public prototypes *****************************/ -/*****************************************************************************/ - -void Cla_ResetClassrooms (struct Cla_Classrooms *Classrooms); - -void Cla_SeeClassrooms (void); -void Cla_EditClassrooms (void); -void Cla_PutIconToViewClassrooms (void); -void Cla_GetListClassrooms (struct Cla_Classrooms *Classrooms, - Cla_WhichData_t WhichData); -void Cla_FreeListClassrooms (struct Cla_Classrooms *Classrooms); - -void Cla_GetListClassroomsInThisCtr (void); - -void Cla_GetDataOfClassroomByCod (struct Cla_Classroom *Cla); -long Cla_GetParamClaCod (void); - -void Cla_RemoveClassroom (void); -void Cla_RemoveAllClassroomsInCtr (long CtrCod); -void Cla_RenameClassroomShort (void); -void Cla_RenameClassroomFull (void); -void Cla_ChangeCapacity (void); -void Cla_ChangeClassroomLocation (void); -void Cla_ContEditAfterChgCla (void); - -void Cla_RecFormNewClassroom (void); - -#endif diff --git a/swad_cookie.c b/swad_cookie.c index baff62d0..11049510 100644 --- a/swad_cookie.c +++ b/swad_cookie.c @@ -28,6 +28,7 @@ #include "swad_box.h" #include "swad_cookie.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" diff --git a/swad_country.c b/swad_country.c index ca0af9b9..f7bc6289 100644 --- a/swad_country.c +++ b/swad_country.c @@ -34,9 +34,11 @@ #include "swad_country_config.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" +#include "swad_survey.h" /*****************************************************************************/ /************** External global variables from others modules ****************/ diff --git a/swad_course.c b/swad_course.c index eda28bc5..4c348d1a 100644 --- a/swad_course.c +++ b/swad_course.c @@ -31,16 +31,23 @@ #include // For free #include // For string functions +#include "swad_attendance.h" #include "swad_course.h" #include "swad_course_config.h" #include "swad_database.h" +#include "swad_exam.h" +#include "swad_figure.h" #include "swad_form.h" +#include "swad_forum.h" #include "swad_global.h" #include "swad_help.h" #include "swad_HTML.h" #include "swad_info.h" #include "swad_logo.h" +#include "swad_message.h" +#include "swad_project.h" #include "swad_search.h" +#include "swad_survey.h" #include "swad_test_exam.h" /*****************************************************************************/ diff --git a/swad_course_config.c b/swad_course_config.c index 17dae3cb..3d3f9a01 100644 --- a/swad_course_config.c +++ b/swad_course_config.c @@ -37,6 +37,7 @@ #include "swad_global.h" #include "swad_hierarchy_config.h" #include "swad_HTML.h" +#include "swad_indicator.h" #include "swad_logo.h" #include "swad_role.h" diff --git a/swad_database.c b/swad_database.c index e153dc28..b53ae0af 100644 --- a/swad_database.c +++ b/swad_database.c @@ -471,31 +471,6 @@ mysql> DESCRIBE chat; "NumUsrs INT NOT NULL," "UNIQUE INDEX(RoomCode))"); - /***** 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 | | -| Capacity | int(11) | NO | | NULL | | -| Location | varchar(2047) | NO | | NULL | | -+-----------+---------------+------+-----+---------+----------------+ -6 rows in set (0.00 sec) -*/ - DB_CreateTable ("CREATE TABLE IF NOT EXISTS classrooms (" - "ClaCod INT NOT NULL AUTO_INCREMENT," - "CtrCod INT NOT NULL," - "ShortName VARCHAR(511) NOT NULL," // Cla_MAX_BYTES_SHRT_NAME - "FullName VARCHAR(2047) NOT NULL," // Cla_MAX_BYTES_FULL_NAME - "Capacity INT NOT NULL," - "Location VARCHAR(2047) NOT NULL," // Cla_MAX_BYTES_LOCATION - "UNIQUE INDEX(ClaCod)," - "INDEX(CtrCod))"); - /***** Table clicks_without_photo *****/ /* mysql> DESCRIBE clicks_without_photo; @@ -666,7 +641,7 @@ mysql> DESCRIBE crs_grp; | GrpCod | int(11) | NO | PRI | NULL | auto_increment | | GrpTypCod | int(11) | NO | MUL | NULL | | | GrpName | varchar(2047) | NO | | NULL | | -| ClaCod | int(11) | NO | MUL | -1 | | +| RooCod | int(11) | NO | MUL | -1 | | | MaxStudents | int(11) | NO | | NULL | | | Open | enum('N','Y') | NO | | N | | | FileZones | enum('N','Y') | NO | | N | | @@ -678,12 +653,12 @@ mysql> DESCRIBE crs_grp; "GrpTypCod INT NOT NULL," "GrpName VARCHAR(2047) NOT NULL," // Grp_MAX_BYTES_GROUP_NAME "MaxStudents INT NOT NULL," - "ClaCod INT NOT NULL DEFAULT -1," + "RooCod INT NOT NULL DEFAULT -1," "Open ENUM('N','Y') NOT NULL DEFAULT 'N'," "FileZones ENUM('N','Y') NOT NULL DEFAULT 'N'," "UNIQUE INDEX(GrpCod)," "INDEX(GrpTypCod)," - "INDEX(ClaCod))"); + "INDEX(RooCod))"); /***** Table crs_grp_types *****/ /* @@ -2353,6 +2328,31 @@ mysql> DESCRIBE projects; "INDEX(CrsCod,ModifTime)," "INDEX(CrsCod,DptCod))"); + /***** Table rooms *****/ +/* +mysql> DESCRIBE rooms; ++-----------+---------------+------+-----+---------+----------------+ +| Field | Type | Null | Key | Default | Extra | ++-----------+---------------+------+-----+---------+----------------+ +| RooCod | int(11) | NO | PRI | NULL | auto_increment | +| CtrCod | int(11) | NO | MUL | NULL | | +| ShortName | varchar(511) | NO | | NULL | | +| FullName | varchar(2047) | NO | | NULL | | +| Capacity | int(11) | NO | | NULL | | +| Location | varchar(2047) | NO | | NULL | | ++-----------+---------------+------+-----+---------+----------------+ +6 rows in set (0.00 sec) +*/ + DB_CreateTable ("CREATE TABLE IF NOT EXISTS rooms (" + "RooCod INT NOT NULL AUTO_INCREMENT," + "CtrCod INT NOT NULL," + "ShortName VARCHAR(511) NOT NULL," // Roo_MAX_BYTES_SHRT_NAME + "FullName VARCHAR(2047) NOT NULL," // Roo_MAX_BYTES_FULL_NAME + "Capacity INT NOT NULL," + "Location VARCHAR(2047) NOT NULL," // Roo_MAX_BYTES_LOCATION + "UNIQUE INDEX(RooCod)," + "INDEX(CtrCod))"); + /***** Table sessions *****/ /* mysql> DESCRIBE sessions; diff --git a/swad_date.c b/swad_date.c index e72c14a6..b7f2f15b 100644 --- a/swad_date.c +++ b/swad_date.c @@ -36,6 +36,7 @@ #include "swad_config.h" #include "swad_database.h" #include "swad_date.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" diff --git a/swad_degree.c b/swad_degree.c index f6d63aca..92ac0862 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -33,10 +33,14 @@ #include "swad_database.h" #include "swad_degree.h" #include "swad_degree_config.h" +#include "swad_figure.h" #include "swad_form.h" +#include "swad_forum.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_logo.h" +#include "swad_message.h" +#include "swad_survey.h" /*****************************************************************************/ /************** External global variables from others modules ****************/ diff --git a/swad_degree_type.c b/swad_degree_type.c index f813838b..4d04321c 100644 --- a/swad_degree_type.c +++ b/swad_degree_type.c @@ -37,6 +37,7 @@ #include "swad_database.h" #include "swad_degree.h" #include "swad_degree_type.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" diff --git a/swad_enrolment.c b/swad_enrolment.c index 17d3aa92..acd3d959 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -32,6 +32,7 @@ #include "swad_account.h" #include "swad_announcement.h" +#include "swad_attendance.h" #include "swad_box.h" #include "swad_database.h" #include "swad_duplicate.h" @@ -41,8 +42,10 @@ #include "swad_HTML.h" #include "swad_ID.h" #include "swad_match.h" +#include "swad_message.h" #include "swad_notification.h" #include "swad_parameter.h" +#include "swad_photo.h" #include "swad_role.h" #include "swad_test_exam.h" #include "swad_user.h" diff --git a/swad_figure.c b/swad_figure.c index 109f5f8e..d8752d3b 100644 --- a/swad_figure.c +++ b/swad_figure.c @@ -43,12 +43,17 @@ #include "swad_HTML.h" #include "swad_institution.h" #include "swad_logo.h" +#include "swad_message.h" #include "swad_network.h" #include "swad_notice.h" #include "swad_privacy.h" #include "swad_profile.h" #include "swad_program.h" +#include "swad_project.h" #include "swad_role.h" +#include "swad_survey.h" +#include "swad_test.h" +#include "swad_timeline.h" /*****************************************************************************/ /************** External global variables from others modules ****************/ diff --git a/swad_file_browser.c b/swad_file_browser.c index 5fa9b6f2..0eba17dc 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -41,6 +41,7 @@ #include "swad_box.h" #include "swad_config.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_file_browser.h" #include "swad_file_extension.h" #include "swad_file_MIME.h" @@ -54,6 +55,7 @@ #include "swad_parameter.h" #include "swad_photo.h" #include "swad_profile.h" +#include "swad_project.h" #include "swad_role.h" #include "swad_string.h" #include "swad_timeline.h" diff --git a/swad_follow.c b/swad_follow.c index 6aa816ed..7018ae94 100644 --- a/swad_follow.c +++ b/swad_follow.c @@ -30,11 +30,13 @@ #include "swad_box.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_follow.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_notification.h" +#include "swad_photo.h" #include "swad_privacy.h" #include "swad_profile.h" #include "swad_user.h" diff --git a/swad_forum.c b/swad_forum.c index c5e6e7ef..05a4d9f2 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -37,12 +37,14 @@ #include "swad_box.h" #include "swad_config.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_forum.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_layout.h" #include "swad_logo.h" +#include "swad_message.h" #include "swad_notification.h" #include "swad_pagination.h" #include "swad_parameter.h" diff --git a/swad_game.c b/swad_game.c index a6707dd5..7e0bbc68 100644 --- a/swad_game.c +++ b/swad_game.c @@ -34,6 +34,7 @@ #include // For string functions #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_game.h" #include "swad_global.h" diff --git a/swad_global.c b/swad_global.c index e6c64163..873f4a4e 100644 --- a/swad_global.c +++ b/swad_global.c @@ -36,18 +36,21 @@ #include "swad_action.h" #include "swad_API.h" #include "swad_calendar.h" -#include "swad_classroom.h" +#include "swad_room.h" #include "swad_config.h" #include "swad_constant.h" +#include "swad_department.h" #include "swad_exam.h" #include "swad_follow.h" #include "swad_global.h" #include "swad_icon.h" +#include "swad_link.h" #include "swad_parameter.h" #include "swad_program.h" #include "swad_project.h" #include "swad_role.h" #include "swad_setting.h" +#include "swad_statistic.h" #include "swad_theme.h" /*****************************************************************************/ @@ -255,7 +258,7 @@ void Gbl_InitializeGlobals (void) Gbl.Crs.Grps.GrpTyp.OpenTimeUTC = (time_t) 0; Gbl.Crs.Grps.GrpCod = -1L; // -1L stands for the whole course Gbl.Crs.Grps.GrpName[0] = '\0'; - Gbl.Crs.Grps.ClaCod = -1L; // -1L stands for no classroom assigned + Gbl.Crs.Grps.RooCod = -1L; // -1L stands for no room assigned Gbl.Crs.Grps.MaxStudents = Grp_NUM_STUDENTS_NOT_LIMITED; Gbl.Crs.Grps.Open = false; Gbl.Crs.Grps.LstGrpsSel.GrpCods = NULL; diff --git a/swad_global.h b/swad_global.h index dab0eb4b..97b4e5b0 100644 --- a/swad_global.h +++ b/swad_global.h @@ -33,53 +33,32 @@ #include // To access MySQL databases #include "swad_alert.h" -#include "swad_agenda.h" #include "swad_API.h" #include "swad_assignment.h" -#include "swad_attendance.h" -#include "swad_banner.h" #include "swad_box.h" #include "swad_centre.h" -#include "swad_classroom.h" #include "swad_connected.h" #include "swad_config.h" #include "swad_country.h" #include "swad_course.h" #include "swad_cryptography.h" -#include "swad_department.h" #include "swad_degree_type.h" #include "swad_enrolment.h" -#include "swad_exam.h" -#include "swad_figure.h" #include "swad_file.h" #include "swad_file_browser.h" -#include "swad_forum.h" -#include "swad_game.h" -#include "swad_holiday.h" #include "swad_icon.h" -#include "swad_indicator.h" #include "swad_institution.h" #include "swad_layout.h" -#include "swad_link.h" #include "swad_mail.h" #include "swad_mark.h" #include "swad_media.h" #include "swad_menu.h" -#include "swad_message.h" #include "swad_parameter.h" #include "swad_password.h" -#include "swad_photo.h" -#include "swad_place.h" #include "swad_plugin.h" -#include "swad_project.h" #include "swad_record.h" #include "swad_search.h" #include "swad_session.h" -#include "swad_survey.h" -#include "swad_syllabus.h" -#include "swad_test.h" -#include "swad_timeline.h" -#include "swad_timetable.h" /*****************************************************************************/ /***************************** Public constants ******************************/ @@ -448,7 +427,8 @@ struct Globals bool HiddenLevels[1 + Brw_MAX_DIR_LEVELS]; const char *TxtStyle; const char *InputStyle; - struct Asg_Assignment Asg; // Data of assignment when browsing level 1 or an assignment zone + struct Asg_Assignment Asg; // Data of assignment when browsing level 1 or an assignment zone. + // TODO: Remove from global? struct { bool CreateZIP; diff --git a/swad_group.c b/swad_group.c index 65c972a5..3833feb8 100644 --- a/swad_group.c +++ b/swad_group.c @@ -32,6 +32,7 @@ #include // For string functions #include "swad_action.h" +#include "swad_attendance.h" #include "swad_box.h" #include "swad_database.h" #include "swad_form.h" @@ -45,6 +46,7 @@ #include "swad_program.h" #include "swad_project.h" #include "swad_setting.h" +#include "swad_survey.h" /*****************************************************************************/ /*************************** Private constants *******************************/ @@ -96,7 +98,7 @@ static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups, const char *AlertTextGroups); static void Grp_EditGroupTypes (void); -static void Grp_EditGroups (const struct Cla_Classrooms *Classrooms); +static void Grp_EditGroups (const struct Roo_Rooms *Rooms); static void Grp_PutIconsEditingGroups (__attribute__((unused)) void *Args); static void Grp_PutIconToCreateNewGroup (void); @@ -116,7 +118,7 @@ static void Grp_PutIconToViewGroups (void); static void Grp_PutIconToCreateNewGroupType (void); static void Grp_WriteHeadingGroupTypes (void); -static void Grp_ListGroupsForEdition (const struct Cla_Classrooms *Classrooms); +static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms); static void Grp_WriteHeadingGroups (void); static void Grp_PutIconToEditGroups (__attribute__((unused)) void *Args); @@ -129,7 +131,7 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp, static void Grp_WriteGrpHead (struct GroupType *GrpTyp); static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight); static void Grp_PutFormToCreateGroupType (void); -static void Grp_PutFormToCreateGroup (const struct Cla_Classrooms *Classrooms); +static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms); static unsigned Grp_CountNumGrpsInThisCrsOfType (long GrpTypCod); static void Grp_GetDataOfGroupTypeByCod (struct GroupType *GrpTyp); static bool Grp_GetMultipleEnrolmentOfAGroupType (long GrpTypCod); @@ -253,28 +255,28 @@ static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes, static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups, const char *AlertTextGroups) { - struct Cla_Classrooms Classrooms; + struct Roo_Rooms Rooms; - /***** Reset classrooms context *****/ - Cla_ResetClassrooms (&Classrooms); + /***** Reset rooms context *****/ + Roo_ResetRooms (&Rooms); /***** Show optional alert *****/ if (AlertTextGroups) if (AlertTextGroups[0]) Ale_ShowAlert (AlertTypeGroups,AlertTextGroups); - /***** Get list of classrooms in this centre *****/ - Cla_GetListClassrooms (&Classrooms,Cla_ONLY_SHRT_NAME); + /***** Get list of rooms in this centre *****/ + Roo_GetListRooms (&Rooms,Roo_ONLY_SHRT_NAME); /***** Put form to edit groups *****/ if (Gbl.Crs.Grps.GrpTypes.Num) // If there are group types... - Grp_EditGroups (&Classrooms); + Grp_EditGroups (&Rooms); /***** End groups section *****/ HTM_SECTION_End (); - /***** Free list of classrooms in this centre *****/ - Cla_FreeListClassrooms (&Classrooms); + /***** Free list of rooms in this centre *****/ + Roo_FreeListRooms (&Rooms); /***** Free list of groups types and groups in this course *****/ Grp_FreeListGrpTypesAndGrps (); @@ -313,7 +315,7 @@ static void Grp_EditGroupTypes (void) /**************************** Put forms to edit groups ***********************/ /*****************************************************************************/ -static void Grp_EditGroups (const struct Cla_Classrooms *Classrooms) +static void Grp_EditGroups (const struct Roo_Rooms *Rooms) { extern const char *Hlp_USERS_Groups; extern const char *Txt_Groups; @@ -325,11 +327,11 @@ static void Grp_EditGroups (const struct Cla_Classrooms *Classrooms) Hlp_USERS_Groups,Box_NOT_CLOSABLE); /***** Put a form to create a new group *****/ - Grp_PutFormToCreateGroup (Classrooms); + Grp_PutFormToCreateGroup (Rooms); /***** Forms to edit current groups *****/ if (Gbl.Crs.Grps.GrpTypes.NumGrpsTotal) // If there are groups... - Grp_ListGroupsForEdition (Classrooms); + Grp_ListGroupsForEdition (Rooms); else // There are group types, but there aren't groups Ale_ShowAlert (Ale_INFO,Txt_No_groups_have_been_created_in_the_course_X, Gbl.Hierarchy.Crs.ShrtName); @@ -977,7 +979,7 @@ static void Grp_LockTables (void) "crs_grp WRITE," "crs_grp_usr WRITE," "crs_usr READ," - "classrooms READ"); + "rooms READ"); Gbl.DB.LockedTables = true; } @@ -1473,14 +1475,14 @@ static void Grp_WriteHeadingGroupTypes (void) /********************** List current groups for edition **********************/ /*****************************************************************************/ -static void Grp_ListGroupsForEdition (const struct Cla_Classrooms *Classrooms) +static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms) { extern const char *Txt_Group_X_open_click_to_close_it; extern const char *Txt_Group_X_closed_click_to_open_it; extern const char *Txt_File_zones_of_the_group_X_enabled_click_to_disable_them; extern const char *Txt_File_zones_of_the_group_X_disabled_click_to_enable_them; - extern const char *Txt_No_assigned_classroom; - extern const char *Txt_Another_classroom; + extern const char *Txt_No_assigned_room; + extern const char *Txt_Another_room; unsigned NumGrpTyp; unsigned NumTipGrpAux; unsigned NumGrpThisType; @@ -1580,31 +1582,31 @@ static void Grp_ListGroupsForEdition (const struct Cla_Classrooms *Classrooms) Frm_EndForm (); HTM_TD_End (); - /***** Classroom *****/ + /***** Room *****/ /* Start selector */ HTM_TD_Begin ("class=\"CM\""); - Frm_StartFormAnchor (ActChgGrpCla,Grp_GROUPS_SECTION_ID); + Frm_StartFormAnchor (ActChgGrpRoo,Grp_GROUPS_SECTION_ID); Grp_PutParamGrpCod (Grp->GrpCod); HTM_SELECT_Begin (true, - "name=\"ClaCod\" style=\"width:100px;\""); + "name=\"RooCod\" style=\"width:100px;\""); - /* Option for no assigned classroom */ + /* Option for no assigned room */ HTM_OPTION (HTM_Type_STRING,"-1", - Grp->Classroom.ClaCod < 0,false, - "%s",Txt_No_assigned_classroom); + Grp->Room.RooCod < 0,false, + "%s",Txt_No_assigned_room); - /* Option for another classroom */ + /* Option for another room */ HTM_OPTION (HTM_Type_STRING,"0", - Grp->Classroom.ClaCod == 0,false, - "%s",Txt_Another_classroom); + Grp->Room.RooCod == 0,false, + "%s",Txt_Another_room); - /* Options for classrooms */ + /* Options for rooms */ for (NumCla = 0; - NumCla < Classrooms->Num; + NumCla < Rooms->Num; NumCla++) - HTM_OPTION (HTM_Type_LONG,&Classrooms->Lst[NumCla].ClaCod, - Classrooms->Lst[NumCla].ClaCod == Grp->Classroom.ClaCod,false, - "%s",Classrooms->Lst[NumCla].ShrtName); + HTM_OPTION (HTM_Type_LONG,&Rooms->Lst[NumCla].RooCod, + Rooms->Lst[NumCla].RooCod == Grp->Room.RooCod,false, + "%s",Rooms->Lst[NumCla].ShrtName); /* End selector */ HTM_SELECT_End (); @@ -1648,7 +1650,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_Room; extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_Max_BR_students; Rol_Role_t Role; @@ -1664,7 +1666,7 @@ static void Grp_WriteHeadingGroups (void) HTM_BR (); HTM_TxtF ("(%s)",Txt_eg_A_B); HTM_TH_End (); - HTM_TH (1,1,"CM",Txt_Classroom); + HTM_TH (1,1,"CM",Txt_Room); for (Role = Rol_TCH; Role >= Rol_STD; Role--) @@ -2308,7 +2310,7 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp, HTM_LABEL_End (); HTM_TD_End (); - /* Classroom */ + /* Room */ HTM_TD_Begin ("class=\"DAT LM\""); HTM_TD_End (); @@ -2336,7 +2338,7 @@ static void Grp_WriteGrpHead (struct GroupType *GrpTyp) { extern const char *Txt_Opening_of_groups; extern const char *Txt_Group; - extern const char *Txt_Classroom; + extern const char *Txt_Room; extern const char *Txt_Max_BR_students; extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES]; extern const char *Txt_Vacants; @@ -2371,7 +2373,7 @@ static void Grp_WriteGrpHead (struct GroupType *GrpTyp) HTM_TH_Empty (2); HTM_TH (1,1,"LM",Txt_Group); - HTM_TH (1,1,"LM",Txt_Classroom); + HTM_TH (1,1,"LM",Txt_Room); for (Role = Rol_TCH; Role >= Rol_STD; Role--) @@ -2417,12 +2419,12 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight) HTM_LABEL_End (); HTM_TD_End (); - /***** Classroom *****/ + /***** Room *****/ if (Highlight) HTM_TD_Begin ("class=\"DAT LM LIGHT_BLUE\""); else HTM_TD_Begin ("class=\"DAT LM\""); - HTM_Txt (Grp->Classroom.ShrtName); + HTM_Txt (Grp->Room.ShrtName); HTM_TD_End (); /***** Current number of users in this group *****/ @@ -2574,13 +2576,13 @@ static void Grp_PutFormToCreateGroupType (void) /*********************** Put a form to create a new group ********************/ /*****************************************************************************/ -static void Grp_PutFormToCreateGroup (const struct Cla_Classrooms *Classrooms) +static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms) { extern const char *Txt_New_group; extern const char *Txt_Group_closed; extern const char *Txt_File_zones_disabled; - extern const char *Txt_No_assigned_classroom; - extern const char *Txt_Another_classroom; + extern const char *Txt_No_assigned_room; + extern const char *Txt_Another_room; extern const char *Txt_Create_group; unsigned NumGrpTyp; unsigned NumCla; @@ -2640,27 +2642,27 @@ static void Grp_PutFormToCreateGroup (const struct Cla_Classrooms *Classrooms) "size=\"20\" required=\"required\""); HTM_TD_End (); - /***** Classroom *****/ + /***** Room *****/ /* Start selector */ HTM_TD_Begin ("class=\"CM\""); HTM_SELECT_Begin (false, - "name=\"ClaCod\" style=\"width:100px;\""); + "name=\"RooCod\" style=\"width:100px;\""); - /* Option for no assigned classroom */ - HTM_OPTION (HTM_Type_STRING,"-1",Gbl.Crs.Grps.ClaCod < 0,false, - "%s",Txt_No_assigned_classroom); + /* Option for no assigned room */ + HTM_OPTION (HTM_Type_STRING,"-1",Gbl.Crs.Grps.RooCod < 0,false, + "%s",Txt_No_assigned_room); - /* Option for another classroom */ - HTM_OPTION (HTM_Type_STRING,"0",Gbl.Crs.Grps.ClaCod == 0,false, - "%s",Txt_Another_classroom); + /* Option for another room */ + HTM_OPTION (HTM_Type_STRING,"0",Gbl.Crs.Grps.RooCod == 0,false, + "%s",Txt_Another_room); - /* Options for classrooms */ + /* Options for rooms */ for (NumCla = 0; - NumCla < Classrooms->Num; + NumCla < Rooms->Num; NumCla++) - HTM_OPTION (HTM_Type_LONG,&Classrooms->Lst[NumCla].ClaCod, - Classrooms->Lst[NumCla].ClaCod == Gbl.Crs.Grps.ClaCod,false, - "%s",Classrooms->Lst[NumCla].ShrtName); + HTM_OPTION (HTM_Type_LONG,&Rooms->Lst[NumCla].RooCod, + Rooms->Lst[NumCla].RooCod == Gbl.Crs.Grps.RooCod,false, + "%s",Rooms->Lst[NumCla].ShrtName); /* End selector */ HTM_SELECT_End (); @@ -2915,15 +2917,15 @@ void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes) Str_Copy (Grp->GrpName,row[1], Grp_MAX_BYTES_GROUP_NAME); - /* Get classroom code (row[2]) */ - Grp->Classroom.ClaCod = Str_ConvertStrCodToLongCod (row[2]); + /* Get room code (row[2]) */ + Grp->Room.RooCod = Str_ConvertStrCodToLongCod (row[2]); - /* Get classroom short name (row[3]) */ + /* Get room short name (row[3]) */ if (row[3]) // May be NULL because of LEFT JOIN - Str_Copy (Grp->Classroom.ShrtName,row[3], - Cla_MAX_BYTES_SHRT_NAME); + Str_Copy (Grp->Room.ShrtName,row[3], + Roo_MAX_BYTES_SHRT_NAME); else // NULL - Grp->Classroom.ShrtName[0] = '\0'; + Grp->Room.ShrtName[0] = '\0'; /* Get number of current users in group */ for (Role = Rol_TCH; @@ -3021,18 +3023,18 @@ static unsigned Grp_CountNumGrpsInThisCrsOfType (long GrpTypCod) unsigned long Grp_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res) { /***** Get groups of a type from database *****/ - // Don't use INNER JOIN because there are groups without assigned classroom + // Don't use INNER JOIN because there are groups without assigned room return DB_QuerySELECT (mysql_res,"can not get groups of a type", "SELECT crs_grp.GrpCod," "crs_grp.GrpName," - "crs_grp.ClaCod," - "classrooms.ShortName," + "crs_grp.RooCod," + "rooms.ShortName," "crs_grp.MaxStudents," "crs_grp.Open," "crs_grp.FileZones" " FROM crs_grp" - " LEFT JOIN classrooms" - " ON crs_grp.ClaCod=classrooms.ClaCod" + " LEFT JOIN rooms" + " ON crs_grp.RooCod=rooms.RooCod" " WHERE crs_grp.GrpTypCod=%ld" " ORDER BY crs_grp.GrpName", GrpTypCod); @@ -3116,8 +3118,8 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat) GrpDat->CrsCod = -1L; GrpDat->GrpTypName[0] = '\0'; GrpDat->GrpName[0] = '\0'; - GrpDat->Classroom.ClaCod = -1L; - GrpDat->Classroom.ShrtName[0] = '\0'; + GrpDat->Room.RooCod = -1L; + GrpDat->Room.ShrtName[0] = '\0'; GrpDat->MaxStudents = 0; GrpDat->Vacant = 0; GrpDat->Open = false; @@ -3133,14 +3135,14 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat) "crs_grp_types.GrpTypName," // row[2] "crs_grp_types.Multiple," // row[3] "crs_grp.GrpName," // row[4] - "crs_grp.ClaCod," // row[5] - "classrooms.ShortName," // row[6] + "crs_grp.RooCod," // row[5] + "rooms.ShortName," // row[6] "crs_grp.MaxStudents," // row[7] "crs_grp.Open," // row[8] "crs_grp.FileZones" // row[9] " FROM (crs_grp,crs_grp_types)" - " LEFT JOIN classrooms" - " ON crs_grp.ClaCod=classrooms.ClaCod" + " LEFT JOIN rooms" + " ON crs_grp.RooCod=rooms.RooCod" " WHERE crs_grp.GrpCod=%ld" " AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod", GrpDat->GrpCod); @@ -3170,14 +3172,14 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat) Grp_MAX_BYTES_GROUP_NAME); /* Get the code of the course (row[5]) */ - GrpDat->Classroom.ClaCod = Str_ConvertStrCodToLongCod (row[5]); + GrpDat->Room.RooCod = Str_ConvertStrCodToLongCod (row[5]); - /* Get the name of the classroom (row[6]) */ + /* Get the name of the room (row[6]) */ if (row[6]) // May be NULL because of LEFT JOIN - Str_Copy (GrpDat->Classroom.ShrtName,row[6], - Cla_MAX_BYTES_SHRT_NAME); + Str_Copy (GrpDat->Room.ShrtName,row[6], + Roo_MAX_BYTES_SHRT_NAME); else // NULL - GrpDat->Classroom.ShrtName[0] = '\0'; + GrpDat->Room.ShrtName[0] = '\0'; /* Get maximum number of students (row[7]) */ GrpDat->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[7]); @@ -3783,8 +3785,8 @@ void Grp_RecFormNewGrp (void) Par_GetParToText ("GrpName",Gbl.Crs.Grps.GrpName, Grp_MAX_BYTES_GROUP_NAME); - /* Get classroom */ - Gbl.Crs.Grps.ClaCod = Cla_GetParamClaCod (); + /* Get room */ + Gbl.Crs.Grps.RooCod = Roo_GetParamRooCod (); /* Get maximum number of students */ Gbl.Crs.Grps.MaxStudents = (unsigned) @@ -3895,12 +3897,12 @@ static void Grp_CreateGroup (void) /***** Create a new group *****/ DB_QueryINSERT ("can not create group", "INSERT INTO crs_grp" - " (GrpTypCod,GrpName,ClaCod,MaxStudents,Open,FileZones)" + " (GrpTypCod,GrpName,RooCod,MaxStudents,Open,FileZones)" " VALUES" " (%ld,'%s',%ld,%u,'N','N')", Gbl.Crs.Grps.GrpTyp.GrpTypCod, Gbl.Crs.Grps.GrpName, - Gbl.Crs.Grps.ClaCod, + Gbl.Crs.Grps.RooCod, Gbl.Crs.Grps.MaxStudents); } @@ -4373,13 +4375,13 @@ void Grp_ChangeGroupType (void) } /*****************************************************************************/ -/*********************** Change the classroom of a group *********************/ +/************************* Change the room of a group ************************/ /*****************************************************************************/ -void Grp_ChangeGroupClassroom (void) +void Grp_ChangeGroupRoom (void) { - extern const char *Txt_The_classroom_assigned_to_the_group_X_has_changed; - long NewClaCod; + extern const char *Txt_The_room_assigned_to_the_group_X_has_changed; + long NewRooCod; struct GroupData GrpDat; Ale_AlertType_t AlertType; char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME]; @@ -4389,26 +4391,26 @@ void Grp_ChangeGroupClassroom (void) if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1L) Lay_ShowErrorAndExit ("Code of group is missing."); - /* Get the new classroom */ - NewClaCod = Cla_GetParamClaCod (); + /* Get the new room */ + NewRooCod = Roo_GetParamRooCod (); /* Get from the database the name of the group */ GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); - /***** Update the table of groups changing old classroom by new classroom *****/ - DB_QueryUPDATE ("can not update the classroom of a group", - "UPDATE crs_grp SET ClaCod=%ld WHERE GrpCod=%ld", - NewClaCod,Gbl.Crs.Grps.GrpCod); + /***** Update the table of groups changing old room by new room *****/ + DB_QueryUPDATE ("can not update the room of a group", + "UPDATE crs_grp SET RooCod=%ld WHERE GrpCod=%ld", + NewRooCod,Gbl.Crs.Grps.GrpCod); /* Create message to show the change made */ AlertType = Ale_SUCCESS; snprintf (AlertTxt,sizeof (AlertTxt), - Txt_The_classroom_assigned_to_the_group_X_has_changed, + Txt_The_room_assigned_to_the_group_X_has_changed, GrpDat.GrpName); /***** Show the form again *****/ - Gbl.Crs.Grps.ClaCod = NewClaCod; + Gbl.Crs.Grps.RooCod = NewRooCod; Grp_ReqEditGroupsInternal (Ale_INFO,NULL, AlertType,AlertTxt); } diff --git a/swad_group.h b/swad_group.h index 3cd29d28..ea4f4b59 100644 --- a/swad_group.h +++ b/swad_group.h @@ -27,8 +27,8 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ -#include "swad_classroom.h" #include "swad_info.h" +#include "swad_room.h" #include "swad_user.h" /*****************************************************************************/ @@ -65,9 +65,9 @@ struct GroupData char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1]; struct { - long ClaCod; // Classroom code - char ShrtName[Cla_MAX_BYTES_SHRT_NAME + 1]; // Classroom short name - } Classroom; + long RooCod; // Room code + char ShrtName[Roo_MAX_BYTES_SHRT_NAME + 1]; // Room short name + } Room; unsigned MaxStudents; int Vacant; bool Open; // Group is open? @@ -81,9 +81,9 @@ struct Group char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1]; // Name of group struct { - long ClaCod; // Classroom code - char ShrtName[Cla_MAX_BYTES_SHRT_NAME + 1]; // Classroom short name - } Classroom; + long RooCod; // Room code + char ShrtName[Roo_MAX_BYTES_SHRT_NAME + 1]; // Room short name + } Room; unsigned NumUsrs[Rol_NUM_ROLES]; // Number of users in the group unsigned MaxStudents; // Maximum number of students in the group bool Open; // Group is open? @@ -147,7 +147,7 @@ struct Grp_Groups struct GroupType GrpTyp; long GrpCod; // Group to be edited, removed... char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1]; - long ClaCod; + long RooCod; unsigned MaxStudents; bool Open; bool FileZones; @@ -217,7 +217,7 @@ void Grp_EnableFileZonesGrp (void); void Grp_DisableFileZonesGrp (void); void Grp_ChangeGroupType (void); -void Grp_ChangeGroupClassroom (void); +void Grp_ChangeGroupRoom (void); void Grp_ChangeMandatGrpTyp (void); void Grp_ChangeMultiGrpTyp (void); diff --git a/swad_help_URL.c b/swad_help_URL.c index c7b984f0..bc7ab0f6 100644 --- a/swad_help_URL.c +++ b/swad_help_URL.c @@ -627,46 +627,46 @@ const char *Hlp_CENTRE_Degrees = "CENTRE.Degrees.en"; #endif -const char *Hlp_CENTRE_Classrooms = +const char *Hlp_CENTRE_Rooms = #if L==1 - "CENTRE.Classrooms.es"; + "CENTRE.Rooms.es"; #elif L==2 - "CENTRE.Classrooms.en"; + "CENTRE.Rooms.en"; #elif L==3 - "CENTRE.Classrooms.en"; + "CENTRE.Rooms.en"; #elif L==4 - "CENTRE.Classrooms.es"; + "CENTRE.Rooms.es"; #elif L==5 - "CENTRE.Classrooms.en"; + "CENTRE.Rooms.en"; #elif L==6 - "CENTRE.Classrooms.es"; + "CENTRE.Rooms.es"; #elif L==7 - "CENTRE.Classrooms.en"; + "CENTRE.Rooms.en"; #elif L==8 - "CENTRE.Classrooms.en"; + "CENTRE.Rooms.en"; #elif L==9 - "CENTRE.Classrooms.en"; + "CENTRE.Rooms.en"; #endif -const char *Hlp_CENTRE_Classrooms_edit = +const char *Hlp_CENTRE_Rooms_edit = #if L==1 - "CENTRE.Classrooms.es#editar"; + "CENTRE.Rooms.es#editar"; #elif L==2 - "CENTRE.Classrooms.en#edit"; + "CENTRE.Rooms.en#edit"; #elif L==3 - "CENTRE.Classrooms.en#edit"; + "CENTRE.Rooms.en#edit"; #elif L==4 - "CENTRE.Classrooms.es#editar"; + "CENTRE.Rooms.es#editar"; #elif L==5 - "CENTRE.Classrooms.en#edit"; + "CENTRE.Rooms.en#edit"; #elif L==6 - "CENTRE.Classrooms.es#editar"; + "CENTRE.Rooms.es#editar"; #elif L==7 - "CENTRE.Classrooms.en#edit"; + "CENTRE.Rooms.en#edit"; #elif L==8 - "CENTRE.Classrooms.en#edit"; + "CENTRE.Rooms.en#edit"; #elif L==9 - "CENTRE.Classrooms.en#edit"; + "CENTRE.Rooms.en#edit"; #endif /***** DEGREE tab *****/ diff --git a/swad_icon.c b/swad_icon.c index fa242ecb..d5ff9119 100644 --- a/swad_icon.c +++ b/swad_icon.c @@ -30,6 +30,7 @@ #include "swad_box.h" #include "swad_config.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" diff --git a/swad_indicator.c b/swad_indicator.c index 342935f3..ab8f5f0b 100644 --- a/swad_indicator.c +++ b/swad_indicator.c @@ -31,11 +31,13 @@ #include "swad_action.h" #include "swad_box.h" #include "swad_database.h" +#include "swad_department.h" #include "swad_form.h" #include "swad_forum.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_indicator.h" +#include "swad_message.h" #include "swad_parameter.h" #include "swad_theme.h" diff --git a/swad_institution.c b/swad_institution.c index 15630b44..db503765 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -31,11 +31,17 @@ #include // For string functions #include "swad_database.h" +#include "swad_department.h" +#include "swad_figure.h" #include "swad_form.h" +#include "swad_forum.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_institution.h" #include "swad_logo.h" +#include "swad_message.h" +#include "swad_place.h" +#include "swad_survey.h" /*****************************************************************************/ /************** External global variables from others modules ****************/ diff --git a/swad_institution_config.c b/swad_institution_config.c index f801f7c5..c7008b37 100644 --- a/swad_institution_config.c +++ b/swad_institution_config.c @@ -32,6 +32,7 @@ #include // For free #include "swad_database.h" +#include "swad_department.h" #include "swad_form.h" #include "swad_global.h" #include "swad_help.h" @@ -39,6 +40,7 @@ #include "swad_HTML.h" #include "swad_institution.h" #include "swad_logo.h" +#include "swad_place.h" /*****************************************************************************/ /************** External global variables from others modules ****************/ diff --git a/swad_language.c b/swad_language.c index 7c29d099..4036795d 100644 --- a/swad_language.c +++ b/swad_language.c @@ -27,6 +27,7 @@ #include "swad_box.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" diff --git a/swad_layout.c b/swad_layout.c index c3031363..bede1c3d 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -31,6 +31,7 @@ #include "swad_action.h" #include "swad_API.h" +#include "swad_banner.h" #include "swad_box.h" #include "swad_calendar.h" #include "swad_changelog.h" @@ -44,8 +45,10 @@ #include "swad_global.h" #include "swad_help.h" #include "swad_hierarchy.h" +#include "swad_holiday.h" #include "swad_HTML.h" #include "swad_language.h" +#include "swad_link.h" #include "swad_log.h" #include "swad_logo.h" #include "swad_match.h" diff --git a/swad_link.c b/swad_link.c index 1804ad8b..8901ca5d 100644 --- a/swad_link.c +++ b/swad_link.c @@ -29,6 +29,7 @@ #include // For calloc #include // For string functions +#include "swad_banner.h" #include "swad_box.h" #include "swad_constant.h" #include "swad_database.h" diff --git a/swad_log.c b/swad_log.c index d830ffde..d534dd27 100644 --- a/swad_log.c +++ b/swad_log.c @@ -29,6 +29,7 @@ #include // For strlen #include "swad_action.h" +#include "swad_banner.h" #include "swad_config.h" #include "swad_database.h" #include "swad_global.h" diff --git a/swad_match.h b/swad_match.h index a5e739d3..89e7d000 100644 --- a/swad_match.h +++ b/swad_match.h @@ -28,6 +28,7 @@ /*****************************************************************************/ #include "swad_scope.h" +#include "swad_test.h" /*****************************************************************************/ /************************** Public types and constants ***********************/ diff --git a/swad_match_result.c b/swad_match_result.c index 776e29e9..b3118dc6 100644 --- a/swad_match_result.c +++ b/swad_match_result.c @@ -41,6 +41,7 @@ #include "swad_ID.h" #include "swad_match.h" #include "swad_match_result.h" +#include "swad_photo.h" #include "swad_test_visibility.h" #include "swad_user.h" diff --git a/swad_menu.c b/swad_menu.c index c0a6cb43..0548cddd 100644 --- a/swad_menu.c +++ b/swad_menu.c @@ -27,6 +27,7 @@ #include "swad_box.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" @@ -93,7 +94,7 @@ static const Act_Action_t Mnu_MenuActions[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_ [TabCtr] = { [ 0] = ActSeeCtrInf, [ 1] = ActSeeDeg, - [ 2] = ActSeeCla, + [ 2] = ActSeeRoo, }, [TabDeg] = { [ 0] = ActSeeDegInf, diff --git a/swad_message.c b/swad_message.c index 9122519e..91b3b109 100644 --- a/swad_message.c +++ b/swad_message.c @@ -38,6 +38,7 @@ #include "swad_config.h" #include "swad_course.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_forum.h" #include "swad_global.h" diff --git a/swad_network.c b/swad_network.c index fea5b39d..178af946 100644 --- a/swad_network.c +++ b/swad_network.c @@ -29,6 +29,7 @@ #include "swad_box.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" diff --git a/swad_notice.c b/swad_notice.c index d94e4ba4..9482b995 100644 --- a/swad_notice.c +++ b/swad_notice.c @@ -34,6 +34,7 @@ #include "swad_box.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" diff --git a/swad_notification.c b/swad_notification.c index c71883c4..4b28056b 100644 --- a/swad_notification.c +++ b/swad_notification.c @@ -38,15 +38,18 @@ #include "swad_database.h" #include "swad_enrolment.h" #include "swad_exam.h" +#include "swad_figure.h" #include "swad_follow.h" #include "swad_form.h" #include "swad_forum.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_mark.h" +#include "swad_message.h" #include "swad_notice.h" #include "swad_notification.h" #include "swad_parameter.h" +#include "swad_survey.h" #include "swad_timeline.h" /*****************************************************************************/ diff --git a/swad_pagination.c b/swad_pagination.c index f1ccc060..3fcb091a 100644 --- a/swad_pagination.c +++ b/swad_pagination.c @@ -31,16 +31,20 @@ #include // For free #include "swad_action.h" +#include "swad_agenda.h" #include "swad_attendance.h" #include "swad_database.h" #include "swad_form.h" #include "swad_forum.h" +#include "swad_game.h" #include "swad_global.h" #include "swad_HTML.h" +#include "swad_message.h" #include "swad_pagination.h" #include "swad_parameter.h" #include "swad_program.h" #include "swad_project.h" +#include "swad_survey.h" /*****************************************************************************/ /*************** External global variables from others modules ***************/ diff --git a/swad_photo.c b/swad_photo.c index 69494a1b..341abb46 100644 --- a/swad_photo.c +++ b/swad_photo.c @@ -51,6 +51,7 @@ #include "swad_photo.h" #include "swad_privacy.h" #include "swad_setting.h" +#include "swad_statistic.h" #include "swad_theme.h" #include "swad_user.h" diff --git a/swad_privacy.c b/swad_privacy.c index 2af03ebd..3acd532a 100644 --- a/swad_privacy.c +++ b/swad_privacy.c @@ -29,6 +29,7 @@ #include "swad_action.h" #include "swad_box.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" diff --git a/swad_profile.c b/swad_profile.c index 8a9cd2c4..684cbc01 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -33,15 +33,19 @@ #include "swad_box.h" #include "swad_config.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_follow.h" #include "swad_form.h" +#include "swad_forum.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_language.h" +#include "swad_message.h" #include "swad_network.h" #include "swad_nickname.h" #include "swad_notification.h" #include "swad_parameter.h" +#include "swad_photo.h" #include "swad_privacy.h" #include "swad_profile.h" #include "swad_role.h" diff --git a/swad_project.c b/swad_project.c index 60ba5153..ad789c95 100644 --- a/swad_project.c +++ b/swad_project.c @@ -34,6 +34,8 @@ #include "swad_box.h" #include "swad_database.h" +#include "swad_department.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" diff --git a/swad_record.c b/swad_record.c index b911affd..1f3dba4f 100644 --- a/swad_record.c +++ b/swad_record.c @@ -35,6 +35,7 @@ #include "swad_box.h" #include "swad_config.h" #include "swad_database.h" +#include "swad_department.h" #include "swad_enrolment.h" #include "swad_follow.h" #include "swad_form.h" @@ -42,6 +43,7 @@ #include "swad_HTML.h" #include "swad_ID.h" #include "swad_logo.h" +#include "swad_message.h" #include "swad_network.h" #include "swad_parameter.h" #include "swad_photo.h" @@ -50,6 +52,7 @@ #include "swad_record.h" #include "swad_role.h" #include "swad_setting.h" +#include "swad_timetable.h" #include "swad_user.h" /*****************************************************************************/ diff --git a/swad_report.c b/swad_report.c index 78e8f71b..e1a7eae3 100644 --- a/swad_report.c +++ b/swad_report.c @@ -1016,15 +1016,17 @@ static void Rep_GetAndWriteMyCurrentCrss (Rol_Role_t Role, /***** Get courses of a user from database *****/ NumCrss = (unsigned) DB_QuerySELECT (&mysql_res,"can not get courses of a user", - "SELECT crs_usr.CrsCod,log.CrsCod,COUNT(*) AS N" - " FROM crs_usr LEFT JOIN log ON" - " (crs_usr.CrsCod=log.CrsCod" - " AND crs_usr.UsrCod=log.UsrCod" - " AND crs_usr.Role=log.Role)" - " WHERE crs_usr.UsrCod=%ld" - " AND crs_usr.Role=%u" - " GROUP BY crs_usr.CrsCod" - " ORDER BY N DESC,log.CrsCod DESC", + "SELECT my_courses.CrsCod," // row[0] + "COUNT(*) AS N" // row[1] + " FROM" + " (SELECT CrsCod FROM crs_usr" + " WHERE UsrCod=%ld AND Role=%u) AS my_courses" // It's imperative to use a derived table to not block crs_usr! + " LEFT JOIN log" + " ON (my_courses.CrsCod=log.CrsCod)" + " WHERE log.UsrCod=%ld AND log.Role=%u" + " GROUP BY my_courses.CrsCod" + " ORDER BY N DESC,my_courses.CrsCod DESC", + Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Role, Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Role); /***** List the courses (one row per course) *****/ diff --git a/swad_room.c b/swad_room.c new file mode 100644 index 00000000..bfbf9b7b --- /dev/null +++ b/swad_room.c @@ -0,0 +1,1087 @@ +// swad_room.c: classrooms, laboratories, offices or other rooms in a centre + +/* + SWAD (Shared Workspace At a Distance), + is a web platform developed at the University of Granada (Spain), + and used to support university teaching. + + This file is part of SWAD core. + Copyright (C) 1999-2020 Antonio Cañas Vargas + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/*****************************************************************************/ +/********************************** Headers **********************************/ +/*****************************************************************************/ + +#include // For calloc, free +#include // For NULL +#include // For string functions + +#include "swad_box.h" +#include "swad_database.h" +#include "swad_form.h" +#include "swad_global.h" +#include "swad_HTML.h" +#include "swad_room.h" + +/*****************************************************************************/ +/************** External global variables from others modules ****************/ +/*****************************************************************************/ + +extern struct Globals Gbl; + +/*****************************************************************************/ +/***************************** Private constants *****************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/******************************* Private types *******************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/***************************** Private variables *****************************/ +/*****************************************************************************/ + +static struct Roo_Room *Roo_EditingRoom = NULL; // Static variable to keep the room being edited + +/*****************************************************************************/ +/***************************** Private prototypes ****************************/ +/*****************************************************************************/ + +static Roo_Order_t Roo_GetParamRoomOrder (void); +static bool Roo_CheckIfICanCreateRooms (void); +static void Roo_PutIconsListingRooms (__attribute__((unused)) void *Args); +static void Roo_PutIconToEditRooms (void); +static void Roo_PutIconsEditingRooms (__attribute__((unused)) void *Args); + +static void Roo_EditRoomsInternal (void); + +static void Roo_ListRoomsForEdition (const struct Roo_Rooms *Rooms); +static void Roo_PutParamRooCod (long RooCod); + +static void Roo_RenameRoom (Cns_ShrtOrFullName_t ShrtOrFullName); +static bool Roo_CheckIfRoomNameExists (const char *FieldName,const char *Name,long RooCod); +static void Roo_UpdateRoomNameDB (long RooCod,const char *FieldName,const char *NewRoomName); + +static void Roo_WriteCapacity (char Str[Cns_MAX_DECIMAL_DIGITS_UINT + 1],unsigned Capacity); + +static void Roo_PutFormToCreateRoom (void); +static void Roo_PutHeadRooms (void); +static void Roo_CreateRoom (struct Roo_Room *Room); + +static void Roo_EditingRoomConstructor (void); +static void Roo_EditingRoomDestructor (void); + +/*****************************************************************************/ +/**************************** Reset rooms context ****************************/ +/*****************************************************************************/ + +void Roo_ResetRooms (struct Roo_Rooms *Rooms) + { + Rooms->Num = 0; // Number of rooms + Rooms->Lst = NULL; // List of rooms + Rooms->SelectedOrder = Roo_ORDER_DEFAULT; + } + +/*****************************************************************************/ +/**************************** List all the rooms *****************************/ +/*****************************************************************************/ + +void Roo_SeeRooms (void) + { + extern const char *Hlp_CENTRE_Rooms; + extern const char *Txt_Rooms; + extern const char *Txt_ROOMS_HELP_ORDER[Roo_NUM_ORDERS]; + extern const char *Txt_ROOMS_ORDER[Roo_NUM_ORDERS]; + extern const char *Txt_New_room; + struct Roo_Rooms Rooms; + Roo_Order_t Order; + unsigned NumRoom; + unsigned RowEvenOdd; + char StrCapacity[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; + + /***** Trivial check *****/ + if (Gbl.Hierarchy.Ctr.CtrCod <= 0) // No centre selected + return; + + /***** Reset rooms context *****/ + Roo_ResetRooms (&Rooms); + + /***** Get parameter with the type of order in the list of rooms *****/ + Rooms.SelectedOrder = Roo_GetParamRoomOrder (); + + /***** Get list of rooms *****/ + Roo_GetListRooms (&Rooms,Roo_ALL_DATA); + + /***** Table head *****/ + Box_BoxBegin (NULL,Txt_Rooms, + Roo_PutIconsListingRooms,NULL, + Hlp_CENTRE_Rooms,Box_NOT_CLOSABLE); + HTM_TABLE_BeginWideMarginPadding (2); + HTM_TR_Begin (NULL); + for (Order = (Roo_Order_t) 0; + Order <= (Roo_Order_t) (Roo_NUM_ORDERS - 1); + Order++) + { + HTM_TH_Begin (1,1,"LM"); + Frm_StartForm (ActSeeRoo); + Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Order); + HTM_BUTTON_SUBMIT_Begin (Txt_ROOMS_HELP_ORDER[Order],"BT_LINK TIT_TBL",NULL); + if (Order == Rooms.SelectedOrder) + HTM_U_Begin (); + HTM_Txt (Txt_ROOMS_ORDER[Order]); + if (Order == Rooms.SelectedOrder) + HTM_U_End (); + HTM_BUTTON_End (); + Frm_EndForm (); + HTM_TH_End (); + } + HTM_TR_End (); + + /***** Write list of rooms *****/ + for (NumRoom = 0, RowEvenOdd = 1; + NumRoom < Rooms.Num; + NumRoom++, RowEvenOdd = 1 - RowEvenOdd) + { + HTM_TR_Begin (NULL); + + /* Short name */ + HTM_TD_Begin ("class=\"DAT LM %s\"",Gbl.ColorRows[RowEvenOdd]); + HTM_Txt (Rooms.Lst[NumRoom].ShrtName); + HTM_TD_End (); + + /* Full name */ + HTM_TD_Begin ("class=\"DAT LM %s\"",Gbl.ColorRows[RowEvenOdd]); + HTM_Txt (Rooms.Lst[NumRoom].FullName); + HTM_TD_End (); + + /* Capacity */ + HTM_TD_Begin ("class=\"DAT RM %s\"",Gbl.ColorRows[RowEvenOdd]); + Roo_WriteCapacity (StrCapacity,Rooms.Lst[NumRoom].Capacity); + HTM_Txt (StrCapacity); + HTM_TD_End (); + + /* Location */ + HTM_TD_Begin ("class=\"DAT LM %s\"",Gbl.ColorRows[RowEvenOdd]); + HTM_Txt (Rooms.Lst[NumRoom].Location); + HTM_TD_End (); + + HTM_TR_End (); + } + + /***** End table *****/ + HTM_TABLE_End (); + + /***** Button to create room *****/ + if (Roo_CheckIfICanCreateRooms ()) + { + Frm_StartForm (ActEdiRoo); + Btn_PutConfirmButton (Txt_New_room); + Frm_EndForm (); + } + + /***** End box *****/ + Box_BoxEnd (); + + /***** Free list of rooms *****/ + Roo_FreeListRooms (&Rooms); + } + +/*****************************************************************************/ +/*********** Get parameter with the type or order in list of rooms ***********/ +/*****************************************************************************/ + +static Roo_Order_t Roo_GetParamRoomOrder (void) + { + return (Roo_Order_t) Par_GetParToUnsignedLong ("Order", + 0, + Roo_NUM_ORDERS - 1, + (unsigned long) Roo_ORDER_DEFAULT); + } + +/*****************************************************************************/ +/*********************** Check if I can create rooms *************************/ +/*****************************************************************************/ + +static bool Roo_CheckIfICanCreateRooms (void) + { + return (bool) (Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM); + } + +/*****************************************************************************/ +/****************** Put contextual icons in list of rooms ********************/ +/*****************************************************************************/ + +static void Roo_PutIconsListingRooms (__attribute__((unused)) void *Args) + { + /***** Put icon to edit rooms *****/ + if (Roo_CheckIfICanCreateRooms ()) + Roo_PutIconToEditRooms (); + } + +/*****************************************************************************/ +/********************** Put a link (form) to edit rooms **********************/ +/*****************************************************************************/ + +static void Roo_PutIconToEditRooms (void) + { + Ico_PutContextualIconToEdit (ActEdiRoo,NULL, + NULL,NULL); + } + +/*****************************************************************************/ +/*************************** Put forms to edit rooms *************************/ +/*****************************************************************************/ + +void Roo_EditRooms (void) + { + /***** Room constructor *****/ + Roo_EditingRoomConstructor (); + + /***** Edit rooms *****/ + Roo_EditRoomsInternal (); + + /***** Room destructor *****/ + Roo_EditingRoomDestructor (); + } + +static void Roo_EditRoomsInternal (void) + { + extern const char *Hlp_CENTRE_Rooms_edit; + extern const char *Txt_Rooms; + struct Roo_Rooms Rooms; + + /***** Reset rooms context *****/ + Roo_ResetRooms (&Rooms); + + /***** Get list of rooms *****/ + Roo_GetListRooms (&Rooms,Roo_ALL_DATA); + + /***** Begin box *****/ + Box_BoxBegin (NULL,Txt_Rooms, + Roo_PutIconsEditingRooms,NULL, + Hlp_CENTRE_Rooms_edit,Box_NOT_CLOSABLE); + + /***** Put a form to create a new room *****/ + Roo_PutFormToCreateRoom (); + + /***** Forms to edit current rooms *****/ + if (Rooms.Num) + Roo_ListRoomsForEdition (&Rooms); + + /***** End box *****/ + Box_BoxEnd (); + + /***** Free list of rooms *****/ + Roo_FreeListRooms (&Rooms); + } + +/*****************************************************************************/ +/***************** Put contextual icons in edition of rooms ******************/ +/*****************************************************************************/ + +static void Roo_PutIconsEditingRooms (__attribute__((unused)) void *Args) + { + /***** Put icon to view rooms *****/ + Roo_PutIconToViewRooms (); + } + +/*****************************************************************************/ +/************************** Put icon to view rooms ***************************/ +/*****************************************************************************/ + +void Roo_PutIconToViewRooms (void) + { + extern const char *Txt_Rooms; + + Lay_PutContextualLinkOnlyIcon (ActSeeRoo,NULL, + NULL,NULL, + "classroom.svg", + Txt_Rooms); + } + +/*****************************************************************************/ +/**************************** List all the rooms *****************************/ +/*****************************************************************************/ + +void Roo_GetListRooms (struct Roo_Rooms *Rooms, + Roo_WhichData_t WhichData) + { + static const char *OrderBySubQuery[Roo_NUM_ORDERS] = + { + [Roo_ORDER_BY_SHRT_NAME] = "ShortName", + [Roo_ORDER_BY_FULL_NAME] = "FullName", + [Roo_ORDER_BY_CAPACITY ] = "Capacity DESC,ShortName", + [Roo_ORDER_BY_LOCATION ] = "Location,ShortName", + }; + MYSQL_RES *mysql_res; + MYSQL_ROW row; + unsigned long NumRows; + unsigned NumRoom; + struct Roo_Room *Room; + + /***** Get rooms from database *****/ + switch (WhichData) + { + case Roo_ALL_DATA: + NumRows = DB_QuerySELECT (&mysql_res,"can not get rooms", + "SELECT RooCod," + "ShortName," + "FullName," + "Capacity," + "Location" + " FROM rooms" + " WHERE CtrCod=%ld" + " ORDER BY %s", + Gbl.Hierarchy.Ctr.CtrCod, + OrderBySubQuery[Rooms->SelectedOrder]); + break; + case Roo_ONLY_SHRT_NAME: + default: + NumRows = DB_QuerySELECT (&mysql_res,"can not get rooms", + "SELECT RooCod," + "ShortName" + " FROM rooms" + " WHERE CtrCod=%ld" + " ORDER BY ShortName", + Gbl.Hierarchy.Ctr.CtrCod); + break; + } + + /***** Count number of rows in result *****/ + if (NumRows) // Rooms found... + { + Rooms->Num = (unsigned) NumRows; + + /***** Create list with courses in centre *****/ + if ((Rooms->Lst = (struct Roo_Room *) + calloc (NumRows, + sizeof (struct Roo_Room))) == NULL) + Lay_NotEnoughMemoryExit (); + + /***** Get the rooms *****/ + for (NumRoom = 0; + NumRoom < Rooms->Num; + NumRoom++) + { + Room = &Rooms->Lst[NumRoom]; + + /* Get next room */ + row = mysql_fetch_row (mysql_res); + + /* Get room code (row[0]) */ + if ((Room->RooCod = Str_ConvertStrCodToLongCod (row[0])) < 0) + Lay_ShowErrorAndExit ("Wrong code of room."); + + /* Get the short name of the room (row[1]) */ + Str_Copy (Room->ShrtName,row[1], + Roo_MAX_BYTES_SHRT_NAME); + + if (WhichData == Roo_ALL_DATA) + { + /* Get the full name of the room (row[2]) */ + Str_Copy (Room->FullName,row[2], + Roo_MAX_BYTES_FULL_NAME); + + /* Get seating capacity in this room (row[3]) */ + if (sscanf (row[3],"%u",&Room->Capacity) != 1) + Room->Capacity = Roo_UNLIMITED_CAPACITY; + + /* Get the full name of the room (row[4]) */ + Str_Copy (Room->Location,row[4], + Roo_MAX_BYTES_LOCATION); + } + } + } + else + Rooms->Num = 0; + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); + } + +/*****************************************************************************/ +/***************************** Get room full name ****************************/ +/*****************************************************************************/ + +void Roo_GetDataOfRoomByCod (struct Roo_Room *Room) + { + MYSQL_RES *mysql_res; + MYSQL_ROW row; + unsigned long NumRows; + + /***** Clear data *****/ + Room->ShrtName[0] = '\0'; + Room->FullName[0] = '\0'; + Room->Capacity = Roo_UNLIMITED_CAPACITY; + Room->Location[0] = '\0'; + + /***** Check if room code is correct *****/ + if (Room->RooCod > 0) + { + /***** Get data of a room from database *****/ + NumRows = DB_QuerySELECT (&mysql_res,"can not get data of a room", + "SELECT ShortName," + "FullName," + "Capacity," + "Location" + " FROM rooms" + " WHERE RooCod=%ld", + Room->RooCod); + + /***** Count number of rows in result *****/ + if (NumRows) // Room found... + { + /* Get row */ + row = mysql_fetch_row (mysql_res); + + /* Get the short name of the room (row[0]) */ + Str_Copy (Room->ShrtName,row[0], + Roo_MAX_BYTES_SHRT_NAME); + + /* Get the full name of the room (row[1]) */ + Str_Copy (Room->FullName,row[1], + Roo_MAX_BYTES_FULL_NAME); + + /* Get seating capacity in this room (row[2]) */ + if (sscanf (row[2],"%u",&Room->Capacity) != 1) + Room->Capacity = Roo_UNLIMITED_CAPACITY; + + /* Get the location of the room (row[3]) */ + Str_Copy (Room->Location,row[3], + Roo_MAX_BYTES_LOCATION); + } + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); + } + } + +/*****************************************************************************/ +/**************************** Free list of rooms *****************************/ +/*****************************************************************************/ + +void Roo_FreeListRooms (struct Roo_Rooms *Rooms) + { + if (Rooms->Lst) + { + /***** Free memory used by the list of rooms in institution *****/ + free (Rooms->Lst); + Rooms->Lst = NULL; + Rooms->Num = 0; + } + } + +/*****************************************************************************/ +/*************************** List all the rooms ******************************/ +/*****************************************************************************/ + +static void Roo_ListRoomsForEdition (const struct Roo_Rooms *Rooms) + { + unsigned NumCla; + struct Roo_Room *Room; + char StrCapacity[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; + + /***** Write heading *****/ + HTM_TABLE_BeginWidePadding (2); + Roo_PutHeadRooms (); + + /***** Write all the rooms *****/ + for (NumCla = 0; + NumCla < Rooms->Num; + NumCla++) + { + Room = &Rooms->Lst[NumCla]; + + HTM_TR_Begin (NULL); + + /* Put icon to remove room */ + HTM_TD_Begin ("class=\"BM\""); + Frm_StartForm (ActRemRoo); + Roo_PutParamRooCod (Room->RooCod); + Ico_PutIconRemove (); + Frm_EndForm (); + HTM_TD_End (); + + /* Room code */ + HTM_TD_Begin ("class=\"DAT RM\""); + HTM_Long (Room->RooCod); + HTM_TD_End (); + + /* Room short name */ + HTM_TD_Begin ("class=\"LM\""); + Frm_StartForm (ActRenRooSho); + Roo_PutParamRooCod (Room->RooCod); + HTM_INPUT_TEXT ("ShortName",Roo_MAX_CHARS_SHRT_NAME,Room->ShrtName,true, + "size=\"10\" class=\"INPUT_SHORT_NAME\""); + Frm_EndForm (); + HTM_TD_End (); + + /* Room full name */ + HTM_TD_Begin ("class=\"LM\""); + Frm_StartForm (ActRenRooFul); + Roo_PutParamRooCod (Room->RooCod); + HTM_INPUT_TEXT ("FullName",Roo_MAX_CHARS_FULL_NAME,Room->FullName,true, + "size=\"20\" class=\"INPUT_FULL_NAME\""); + Frm_EndForm (); + HTM_TD_End (); + + /* Seating capacity */ + HTM_TD_Begin ("class=\"LM\""); + Frm_StartForm (ActChgRooMaxUsr); + Roo_PutParamRooCod (Room->RooCod); + Roo_WriteCapacity (StrCapacity,Room->Capacity); + HTM_INPUT_TEXT ("Capacity",Cns_MAX_DECIMAL_DIGITS_UINT,StrCapacity,true, + "size=\"3\""); + Frm_EndForm (); + HTM_TD_End (); + + /* Room location */ + HTM_TD_Begin ("class=\"LM\""); + Frm_StartForm (ActRenRooLoc); + Roo_PutParamRooCod (Room->RooCod); + HTM_INPUT_TEXT ("Location",Roo_MAX_CHARS_LOCATION,Room->Location,true, + "size=\"15\" class=\"INPUT_FULL_NAME\""); + Frm_EndForm (); + HTM_TD_End (); + + HTM_TR_End (); + } + + /***** End table *****/ + HTM_TABLE_End (); + } + +/*****************************************************************************/ +/********************* Write parameter with code of room *********************/ +/*****************************************************************************/ + +static void Roo_PutParamRooCod (long RooCod) + { + Par_PutHiddenParamLong (NULL,"RooCod",RooCod); + } + +/*****************************************************************************/ +/********************** Get parameter with code of room **********************/ +/*****************************************************************************/ + +long Roo_GetParamRooCod (void) + { + /***** Get code of room *****/ + return Par_GetParToLong ("RooCod"); + } + +/*****************************************************************************/ +/******************************** Remove a room ******************************/ +/*****************************************************************************/ + +void Roo_RemoveRoom (void) + { + extern const char *Txt_Room_X_removed; + + /***** Room constructor *****/ + Roo_EditingRoomConstructor (); + + /***** Get room code *****/ + if ((Roo_EditingRoom->RooCod = Roo_GetParamRooCod ()) == -1L) + Lay_ShowErrorAndExit ("Code of room is missing."); + + /***** Get data of the room from database *****/ + Roo_GetDataOfRoomByCod (Roo_EditingRoom); + + /***** Update groups assigned to this room *****/ + DB_QueryUPDATE ("can not update room in groups", + "UPDATE crs_grp SET RooCod=0" // 0 means another room + " WHERE RooCod=%ld", + Roo_EditingRoom->RooCod); + + /***** Remove room *****/ + DB_QueryDELETE ("can not remove a room", + "DELETE FROM rooms WHERE RooCod=%ld", + Roo_EditingRoom->RooCod); + + /***** Create message to show the change made *****/ + Ale_CreateAlert (Ale_SUCCESS,NULL, + Txt_Room_X_removed, + Roo_EditingRoom->FullName); + } + +/*****************************************************************************/ +/********************** Remove all rooms in a centre *************************/ +/*****************************************************************************/ + +void Roo_RemoveAllRoomsInCtr (long CtrCod) + { + /***** Remove all rooms in centre *****/ + DB_QueryDELETE ("can not remove rooms", + "DELETE FROM rooms" + " WHERE CtrCod=%ld", + CtrCod); + } + +/*****************************************************************************/ +/********************** Change the short name of a room **********************/ +/*****************************************************************************/ + +void Roo_RenameRoomShort (void) + { + /***** Room constructor *****/ + Roo_EditingRoomConstructor (); + + /***** Rename room *****/ + Roo_RenameRoom (Cns_SHRT_NAME); + } + +/*****************************************************************************/ +/********************** Change the full name of a room ***********************/ +/*****************************************************************************/ + +void Roo_RenameRoomFull (void) + { + /***** Room constructor *****/ + Roo_EditingRoomConstructor (); + + /***** Rename room *****/ + Roo_RenameRoom (Cns_FULL_NAME); + } + +/*****************************************************************************/ +/************************* Change the name of a room *************************/ +/*****************************************************************************/ + +static void Roo_RenameRoom (Cns_ShrtOrFullName_t ShrtOrFullName) + { + extern const char *Txt_The_room_X_already_exists; + extern const char *Txt_The_room_X_has_been_renamed_as_Y; + extern const char *Txt_The_name_of_the_room_X_has_not_changed; + const char *ParamName = NULL; // Initialized to avoid warning + const char *FieldName = NULL; // Initialized to avoid warning + unsigned MaxBytes = 0; // Initialized to avoid warning + char *CurrentClaName = NULL; // Initialized to avoid warning + char NewClaName[Roo_MAX_BYTES_FULL_NAME + 1]; + + switch (ShrtOrFullName) + { + case Cns_SHRT_NAME: + ParamName = "ShortName"; + FieldName = "ShortName"; + MaxBytes = Roo_MAX_BYTES_SHRT_NAME; + CurrentClaName = Roo_EditingRoom->ShrtName; + break; + case Cns_FULL_NAME: + ParamName = "FullName"; + FieldName = "FullName"; + MaxBytes = Roo_MAX_BYTES_FULL_NAME; + CurrentClaName = Roo_EditingRoom->FullName; + break; + } + + /***** Get parameters from form *****/ + /* Get the code of the room */ + if ((Roo_EditingRoom->RooCod = Roo_GetParamRooCod ()) == -1L) + Lay_ShowErrorAndExit ("Code of room is missing."); + + /* Get the new name for the room */ + Par_GetParToText (ParamName,NewClaName,MaxBytes); + + /***** Get from the database the old names of the room *****/ + Roo_GetDataOfRoomByCod (Roo_EditingRoom); + + /***** Check if new name is empty *****/ + if (NewClaName[0]) + { + /***** Check if old and new names are the same + (this happens when return is pressed without changes) *****/ + if (strcmp (CurrentClaName,NewClaName)) // Different names + { + /***** If room was in database... *****/ + if (Roo_CheckIfRoomNameExists (ParamName,NewClaName,Roo_EditingRoom->RooCod)) + Ale_CreateAlert (Ale_WARNING,NULL, + Txt_The_room_X_already_exists, + NewClaName); + else + { + /* Update the table changing old name by new name */ + Roo_UpdateRoomNameDB (Roo_EditingRoom->RooCod,FieldName,NewClaName); + + /* Write message to show the change made */ + Ale_CreateAlert (Ale_SUCCESS,NULL, + Txt_The_room_X_has_been_renamed_as_Y, + CurrentClaName,NewClaName); + } + } + else // The same name + Ale_CreateAlert (Ale_INFO,NULL, + Txt_The_name_of_the_room_X_has_not_changed, + CurrentClaName); + } + else + Ale_CreateAlertYouCanNotLeaveFieldEmpty (); + + /***** Update room name *****/ + Str_Copy (CurrentClaName,NewClaName, + MaxBytes); + } + +/*****************************************************************************/ +/********************** Check if the name of room exists *********************/ +/*****************************************************************************/ + +static bool Roo_CheckIfRoomNameExists (const char *FieldName,const char *Name,long RooCod) + { + /***** Get number of rooms with a name from database *****/ + return (DB_QueryCOUNT ("can not check if the name of a room" + " already existed", + "SELECT COUNT(*) FROM rooms" + " WHERE CtrCod=%ld" + " AND %s='%s' AND RooCod<>%ld", + Gbl.Hierarchy.Ctr.CtrCod, + FieldName,Name,RooCod) != 0); + } + +/*****************************************************************************/ +/******************** Update room name in table of rooms *********************/ +/*****************************************************************************/ + +static void Roo_UpdateRoomNameDB (long RooCod,const char *FieldName,const char *NewRoomName) + { + /***** Update room changing old name by new name */ + DB_QueryUPDATE ("can not update the name of a room", + "UPDATE rooms SET %s='%s' WHERE RooCod=%ld", + FieldName,NewRoomName,RooCod); + } + +/*****************************************************************************/ +/********************* Change sitting capacity of a room *********************/ +/*****************************************************************************/ + +void Roo_ChangeCapacity (void) + { + extern const char *Txt_The_capacity_of_room_X_has_not_changed; + extern const char *Txt_The_room_X_does_not_have_a_limited_capacity_now; + extern const char *Txt_The_capacity_of_room_X_is_now_Y; + unsigned NewCapacity; + + /***** Room constructor *****/ + Roo_EditingRoomConstructor (); + + /***** Get parameters from form *****/ + /* Get the code of the room */ + if ((Roo_EditingRoom->RooCod = Roo_GetParamRooCod ()) == -1L) + Lay_ShowErrorAndExit ("Code of room is missing."); + + /* Get the seating capacity of the room */ + NewCapacity = (unsigned) + Par_GetParToUnsignedLong ("Capacity", + 0, + Roo_MAX_CAPACITY, + Roo_UNLIMITED_CAPACITY); + + /***** Get data of the room from database *****/ + Roo_GetDataOfRoomByCod (Roo_EditingRoom); + + /***** Check if the old capacity equals the new one + (this happens when return is pressed without changes) *****/ + if (Roo_EditingRoom->Capacity == NewCapacity) + /***** Message to show no changes made *****/ + Ale_CreateAlert (Ale_INFO,NULL, + Txt_The_capacity_of_room_X_has_not_changed, + Roo_EditingRoom->FullName); + else + { + /***** Update the table of groups changing the old capacity to the new *****/ + DB_QueryUPDATE ("can not update the capacity of a room", + "UPDATE rooms SET Capacity=%u WHERE RooCod=%ld", + NewCapacity,Roo_EditingRoom->RooCod); + Roo_EditingRoom->Capacity = NewCapacity; + + /***** Message to show the change made *****/ + if (NewCapacity > Grp_MAX_STUDENTS_IN_A_GROUP) + Ale_CreateAlert (Ale_SUCCESS,NULL, + Txt_The_room_X_does_not_have_a_limited_capacity_now, + Roo_EditingRoom->FullName); + else + Ale_CreateAlert (Ale_SUCCESS,NULL, + Txt_The_capacity_of_room_X_is_now_Y, + Roo_EditingRoom->FullName,NewCapacity); + } + } + +/*****************************************************************************/ +/********************* Write seating capacity of a room **********************/ +/*****************************************************************************/ + +static void Roo_WriteCapacity (char Str[Cns_MAX_DECIMAL_DIGITS_UINT + 1],unsigned Capacity) + { + if (Capacity <= Roo_MAX_CAPACITY) + snprintf (Str,Cns_MAX_DECIMAL_DIGITS_UINT + 1, + "%u", + Capacity); + else + Str[0] = '\0'; + } + +/*****************************************************************************/ +/********************** Change the location of a room ************************/ +/*****************************************************************************/ + +void Roo_ChangeRoomLocation (void) + { + extern const char *Txt_The_location_of_the_room_X_has_changed_to_Y; + extern const char *Txt_The_location_of_the_room_X_has_not_changed; + char NewLocation[Roo_MAX_BYTES_FULL_NAME + 1]; + + /***** Room constructor *****/ + Roo_EditingRoomConstructor (); + + /***** Get parameters from form *****/ + /* Get the code of the room */ + if ((Roo_EditingRoom->RooCod = Roo_GetParamRooCod ()) == -1L) + Lay_ShowErrorAndExit ("Code of room is missing."); + + /* Get the new location for the room */ + Par_GetParToText ("Location",NewLocation,Roo_MAX_BYTES_LOCATION); + + /***** Get from the database the old location of the room *****/ + Roo_GetDataOfRoomByCod (Roo_EditingRoom); + + /***** Check if old and new locations are the same + (this happens when return is pressed without changes) *****/ + if (strcmp (Roo_EditingRoom->Location,NewLocation)) // Different locations + { + /* Update the table changing old name by new name */ + Roo_UpdateRoomNameDB (Roo_EditingRoom->RooCod,"Location",NewLocation); + Str_Copy (Roo_EditingRoom->Location,NewLocation, + Roo_MAX_BYTES_LOCATION); + + /* Write message to show the change made */ + Ale_CreateAlert (Ale_SUCCESS,NULL, + Txt_The_location_of_the_room_X_has_changed_to_Y, + Roo_EditingRoom->FullName,NewLocation); + } + else // The same location + Ale_CreateAlert (Ale_INFO,NULL, + Txt_The_location_of_the_room_X_has_not_changed, + Roo_EditingRoom->FullName); + } + +/*****************************************************************************/ +/********* Show alerts after changing a room and continue editing ************/ +/*****************************************************************************/ + +void Roo_ContEditAfterChgRoom (void) + { + /***** Write message to show the change made *****/ + Ale_ShowAlerts (NULL); + + /***** Show the form again *****/ + Roo_EditRoomsInternal (); + + /***** Room destructor *****/ + Roo_EditingRoomDestructor (); + } + +/*****************************************************************************/ +/********************** Put a form to create a new room **********************/ +/*****************************************************************************/ + +static void Roo_PutFormToCreateRoom (void) + { + extern const char *Txt_New_room; + extern const char *Txt_Create_room; + char StrCapacity[Cns_MAX_DECIMAL_DIGITS_UINT + 1]; + + /***** Begin form *****/ + Frm_StartForm (ActNewRoo); + + /***** Begin box and table *****/ + Box_BoxTableBegin (NULL,Txt_New_room, + NULL,NULL, + NULL,Box_NOT_CLOSABLE,2); + + /***** Write heading *****/ + Roo_PutHeadRooms (); + + HTM_TR_Begin (NULL); + + /***** Column to remove room, disabled here *****/ + HTM_TD_Begin ("class=\"BM\""); + HTM_TD_End (); + + /***** Room code *****/ + HTM_TD_Begin ("class=\"CODE\""); + HTM_TD_End (); + + /***** Room short name *****/ + HTM_TD_Begin ("class=\"LM\""); + HTM_INPUT_TEXT ("ShortName",Roo_MAX_CHARS_SHRT_NAME,Roo_EditingRoom->ShrtName,false, + "size=\"10\" class=\"INPUT_SHORT_NAME\" required=\"required\""); + HTM_TD_End (); + + /***** Room full name *****/ + HTM_TD_Begin ("class=\"LM\""); + HTM_INPUT_TEXT ("FullName",Roo_MAX_CHARS_FULL_NAME,Roo_EditingRoom->FullName,false, + "size=\"20\" class=\"INPUT_FULL_NAME\" required=\"required\""); + HTM_TD_End (); + + /***** Seating capacity *****/ + HTM_TD_Begin ("class=\"LM\""); + Roo_WriteCapacity (StrCapacity,Roo_EditingRoom->Capacity); + HTM_INPUT_TEXT ("Capacity",Cns_MAX_DECIMAL_DIGITS_UINT,StrCapacity,false, + "size=\"3\""); + HTM_TD_End (); + + /***** Room location *****/ + HTM_TD_Begin ("class=\"LM\""); + HTM_INPUT_TEXT ("Location",Roo_MAX_CHARS_LOCATION,Roo_EditingRoom->Location,false, + "size=\"15\" class=\"INPUT_FULL_NAME\""); + HTM_TD_End (); + + HTM_TR_End (); + + /***** End table, send button and end box *****/ + Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_room); + + /***** End form *****/ + Frm_EndForm (); + } + +/*****************************************************************************/ +/******************** Write header with fields of a room *********************/ +/*****************************************************************************/ + +static void Roo_PutHeadRooms (void) + { + extern const char *Txt_Code; + extern const char *Txt_Short_name; + extern const char *Txt_Full_name; + extern const char *Txt_Capacity_OF_A_ROOM; + extern const char *Txt_Location; + + HTM_TR_Begin (NULL); + + HTM_TH (1,1,"BM",NULL); + HTM_TH (1,1,"RM",Txt_Code); + HTM_TH (1,1,"LM",Txt_Short_name); + HTM_TH (1,1,"LM",Txt_Full_name); + HTM_TH (1,1,"LM",Txt_Capacity_OF_A_ROOM); + HTM_TH (1,1,"LM",Txt_Location); + + HTM_TR_End (); + } + +/*****************************************************************************/ +/******************* Receive form to create a new room ***********************/ +/*****************************************************************************/ + +void Roo_RecFormNewRoom (void) + { + extern const char *Txt_The_room_X_already_exists; + extern const char *Txt_Created_new_room_X; + extern const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_room; + + /***** Room constructor *****/ + Roo_EditingRoomConstructor (); + + /***** Get parameters from form *****/ + /* Get room short name */ + Par_GetParToText ("ShortName",Roo_EditingRoom->ShrtName,Roo_MAX_BYTES_SHRT_NAME); + + /* Get room full name */ + Par_GetParToText ("FullName",Roo_EditingRoom->FullName,Roo_MAX_BYTES_FULL_NAME); + + /* Get seating capacity */ + Roo_EditingRoom->Capacity = (unsigned) + Par_GetParToUnsignedLong ("Capacity", + 0, + Roo_MAX_CAPACITY, + Roo_UNLIMITED_CAPACITY); + + /* Get room location */ + Par_GetParToText ("Location",Roo_EditingRoom->Location,Roo_MAX_BYTES_LOCATION); + + if (Roo_EditingRoom->ShrtName[0] && + Roo_EditingRoom->FullName[0]) // If there's a room name + { + /***** If name of room was in database... *****/ + if (Roo_CheckIfRoomNameExists ("ShortName",Roo_EditingRoom->ShrtName,-1L)) + Ale_CreateAlert (Ale_WARNING,NULL, + Txt_The_room_X_already_exists, + Roo_EditingRoom->ShrtName); + else if (Roo_CheckIfRoomNameExists ("FullName",Roo_EditingRoom->FullName,-1L)) + Ale_CreateAlert (Ale_WARNING,NULL, + Txt_The_room_X_already_exists, + Roo_EditingRoom->FullName); + else // Add new room to database + { + Roo_CreateRoom (Roo_EditingRoom); + Ale_CreateAlert (Ale_SUCCESS,NULL, + Txt_Created_new_room_X, + Roo_EditingRoom->FullName); + } + } + else // If there is not a room name + Ale_CreateAlert (Ale_WARNING,NULL, + Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_room); + } + +/*****************************************************************************/ +/**************************** Create a new room ******************************/ +/*****************************************************************************/ + +static void Roo_CreateRoom (struct Roo_Room *Room) + { + /***** Create a new room *****/ + DB_QueryINSERT ("can not create room", + "INSERT INTO rooms" + " (CtrCod,ShortName,FullName,Capacity,Location)" + " VALUES" + " (%ld,'%s','%s',%u,'%s')", + Gbl.Hierarchy.Ctr.CtrCod, + Room->ShrtName,Room->FullName,Room->Capacity,Room->Location); + } + +/*****************************************************************************/ +/************************** Room constructor/destructor **********************/ +/*****************************************************************************/ + +static void Roo_EditingRoomConstructor (void) + { + /***** Pointer must be NULL *****/ + if (Roo_EditingRoom != NULL) + Lay_ShowErrorAndExit ("Error initializing room."); + + /***** Allocate memory for room *****/ + if ((Roo_EditingRoom = (struct Roo_Room *) malloc (sizeof (struct Roo_Room))) == NULL) + Lay_ShowErrorAndExit ("Error allocating memory for room."); + + /***** Reset room *****/ + Roo_EditingRoom->RooCod = -1L; + Roo_EditingRoom->InsCod = -1L; + Roo_EditingRoom->ShrtName[0] = '\0'; + Roo_EditingRoom->FullName[0] = '\0'; + Roo_EditingRoom->Capacity = Roo_UNLIMITED_CAPACITY; + Roo_EditingRoom->Location[0] = '\0'; + } + +static void Roo_EditingRoomDestructor (void) + { + /***** Free memory used for room *****/ + if (Roo_EditingRoom != NULL) + { + free (Roo_EditingRoom); + Roo_EditingRoom = NULL; + } + } diff --git a/swad_room.h b/swad_room.h new file mode 100644 index 00000000..9b6f7e1b --- /dev/null +++ b/swad_room.h @@ -0,0 +1,111 @@ +// swad_room.h: classrooms, laboratories, offices or other rooms in a centre + +#ifndef _SWAD_ROO +#define _SWAD_ROO +/* + SWAD (Shared Workspace At a Distance in Spanish), + is a web platform developed at the University of Granada (Spain), + and used to support university teaching. + + This file is part of SWAD core. + Copyright (C) 1999-2020 Antonio Cañas Vargas + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/*****************************************************************************/ +/********************************** Headers **********************************/ +/*****************************************************************************/ + +#include "swad_string.h" + +/*****************************************************************************/ +/************************** Public types and constants ***********************/ +/*****************************************************************************/ + +#define Roo_MAX_CHARS_SHRT_NAME (32 - 1) // 31 +#define Roo_MAX_BYTES_SHRT_NAME ((Roo_MAX_CHARS_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511 + +#define Roo_MAX_CHARS_FULL_NAME (128 - 1) // 127 +#define Roo_MAX_BYTES_FULL_NAME ((Roo_MAX_CHARS_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 + +#define Roo_MAX_CAPACITY 10000 // If capacity of a room is greater than this, it is considered infinite +#define Roo_UNLIMITED_CAPACITY INT_MAX // This number can be stored in database as an integer... + // ...and means that a room has no limited capacity + +#define Roo_MAX_CHARS_LOCATION (128 - 1) // 127 +#define Roo_MAX_BYTES_LOCATION ((Roo_MAX_CHARS_LOCATION + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047 + +struct Roo_Room + { + long RooCod; + long InsCod; + char ShrtName[Roo_MAX_BYTES_SHRT_NAME + 1]; + char FullName[Roo_MAX_BYTES_FULL_NAME + 1]; + unsigned Capacity; // Seating capacity (maximum number of people that fit in the room) + char Location[Roo_MAX_BYTES_LOCATION + 1]; // Examples: Ground floor, first floor, basement + }; + +#define Roo_NUM_ORDERS 4 +typedef enum + { + Roo_ORDER_BY_SHRT_NAME = 0, + Roo_ORDER_BY_FULL_NAME = 1, + Roo_ORDER_BY_CAPACITY = 2, + Roo_ORDER_BY_LOCATION = 3, + } Roo_Order_t; +#define Roo_ORDER_DEFAULT Roo_ORDER_BY_LOCATION + +/***** Get all data or only short name *****/ +typedef enum + { + Roo_ALL_DATA, + Roo_ONLY_SHRT_NAME, + } Roo_WhichData_t; + +struct Roo_Rooms + { + unsigned Num; // Number of rooms + struct Roo_Room *Lst; // List of rooms + Roo_Order_t SelectedOrder; + }; + +/*****************************************************************************/ +/***************************** Public prototypes *****************************/ +/*****************************************************************************/ + +void Roo_ResetRooms (struct Roo_Rooms *Rooms); + +void Roo_SeeRooms (void); +void Roo_EditRooms (void); +void Roo_PutIconToViewRooms (void); +void Roo_GetListRooms (struct Roo_Rooms *Rooms, + Roo_WhichData_t WhichData); +void Roo_FreeListRooms (struct Roo_Rooms *Rooms); + +void Roo_GetListRoomsInThisCtr (void); + +void Roo_GetDataOfRoomByCod (struct Roo_Room *Roo); +long Roo_GetParamRooCod (void); + +void Roo_RemoveRoom (void); +void Roo_RemoveAllRoomsInCtr (long CtrCod); +void Roo_RenameRoomShort (void); +void Roo_RenameRoomFull (void); +void Roo_ChangeCapacity (void); +void Roo_ChangeRoomLocation (void); +void Roo_ContEditAfterChgRoom (void); + +void Roo_RecFormNewRoom (void); + +#endif diff --git a/swad_setting.c b/swad_setting.c index 31469518..5c80b8e9 100644 --- a/swad_setting.c +++ b/swad_setting.c @@ -35,6 +35,7 @@ #include "swad_cookie.h" #include "swad_database.h" #include "swad_date.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" diff --git a/swad_statistic.c b/swad_statistic.c index 8722bec1..2fed7261 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -31,6 +31,7 @@ #include // For getenv, malloc #include // For string functions +#include "swad_banner.h" #include "swad_box.h" #include "swad_database.h" #include "swad_form.h" diff --git a/swad_survey.c b/swad_survey.c index 7806f04a..fbb3ccde 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -32,8 +32,10 @@ #include // For calloc #include // For string functions +#include "swad_attendance.h" #include "swad_box.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_group.h" diff --git a/swad_syllabus.c b/swad_syllabus.c index 538627a2..5aa1020b 100644 --- a/swad_syllabus.c +++ b/swad_syllabus.c @@ -38,6 +38,7 @@ #include "swad_config.h" #include "swad_database.h" #include "swad_form.h" +#include "swad_forum.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_parameter.h" diff --git a/swad_system_config.c b/swad_system_config.c index 0959c730..9d279f2e 100644 --- a/swad_system_config.c +++ b/swad_system_config.c @@ -48,8 +48,6 @@ /************** External global variables from others modules ****************/ /*****************************************************************************/ -extern struct Globals Gbl; // All the global parameters and variables must be in this structure - /*****************************************************************************/ /***************************** Private constants *****************************/ /*****************************************************************************/ diff --git a/swad_test.c b/swad_test.c index a1f5b674..4faff143 100644 --- a/swad_test.c +++ b/swad_test.c @@ -40,6 +40,7 @@ #include "swad_action.h" #include "swad_box.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" diff --git a/swad_test_config.c b/swad_test_config.c index f480656d..aa1f8409 100644 --- a/swad_test_config.c +++ b/swad_test_config.c @@ -29,6 +29,7 @@ #include "swad_database.h" #include "swad_global.h" +#include "swad_test.h" #include "swad_test_config.h" #include "swad_test_visibility.h" diff --git a/swad_test_exam.c b/swad_test_exam.c index 5e7a1c55..522c41a1 100644 --- a/swad_test_exam.c +++ b/swad_test_exam.c @@ -38,6 +38,7 @@ #include "swad_global.h" #include "swad_HTML.h" #include "swad_ID.h" +#include "swad_photo.h" #include "swad_test.h" #include "swad_test_exam.h" #include "swad_test_visibility.h" diff --git a/swad_test_exam.h b/swad_test_exam.h index 5a805e43..11f1eaea 100644 --- a/swad_test_exam.h +++ b/swad_test_exam.h @@ -27,6 +27,7 @@ /********************************* Headers ***********************************/ /*****************************************************************************/ +#include "swad_test.h" #include "swad_user.h" /*****************************************************************************/ diff --git a/swad_test_visibility.c b/swad_test_visibility.c index ae722514..b38f841f 100644 --- a/swad_test_visibility.c +++ b/swad_test_visibility.c @@ -49,8 +49,6 @@ /************** External global variables from others modules ****************/ /*****************************************************************************/ -extern struct Globals Gbl; - /*****************************************************************************/ /************************* Private global variables **************************/ /*****************************************************************************/ diff --git a/swad_text.c b/swad_text.c index 45fa9f68..4eb9492d 100644 --- a/swad_text.c +++ b/swad_text.c @@ -59,7 +59,6 @@ #include "swad_action.h" #include "swad_assignment.h" #include "swad_centre.h" -#include "swad_classroom.h" #include "swad_config.h" #include "swad_country.h" #include "swad_course.h" @@ -83,6 +82,7 @@ #include "swad_project.h" #include "swad_record.h" #include "swad_role.h" +#include "swad_room.h" #include "swad_statistic.h" #include "swad_survey.h" #include "swad_syllabus.h" @@ -1653,25 +1653,25 @@ const char *Txt_Another_centre = "Outro centro"; #endif -const char *Txt_Another_classroom = +const char *Txt_Another_room = #if L==1 // ca - "Una altra aula"; + "Una altra sala"; #elif L==2 // de - "Eine weitere Klassenzimmer"; + "Eine weitere Raum"; #elif L==3 // en - "Another classroom"; + "Another room"; #elif L==4 // es - "Otra aula"; + "Otra sala"; #elif L==5 // fr - "Un autre salle de classe"; + "Un autre salle"; #elif L==6 // gn - "Otra aula"; // Okoteve traducción + "Otra sala"; // Okoteve traducción #elif L==7 // it "Un'altra aula"; #elif L==8 // pl "Kolejna klasa"; #elif L==9 // pt - "Outra sala de aula"; + "Outra sala"; #endif const char *Txt_Another_country = @@ -3204,7 +3204,7 @@ const char *Txt_Can_not_rename_a_folder_of_assignment = "Não é possível renomear um diretório de actividade."; #endif -const char *Txt_Capacity_OF_A_CLASSROOM = +const char *Txt_Capacity_OF_A_ROOM = #if L==1 // ca "Aforo"; #elif L==2 // de @@ -3906,243 +3906,6 @@ const char *Txt_Check_marks_in_the_file = "Verifique as notas no arquivo"; #endif -const char *Txt_Classroom = -#if L==1 // ca - "Aula"; -#elif L==2 // de - "Klassenzimmer"; -#elif L==3 // en - "Classroom"; -#elif L==4 // es - "Aula"; -#elif L==5 // fr - "Salle de classe"; -#elif L==6 // gn - "Mbo'ehakoty"; -#elif L==7 // it - "Aula"; -#elif L==8 // pl - "Klasa"; -#elif L==9 // pt - "Sala de aula"; -#endif - -const char *Txt_Classroom_X_removed = // Warning: it is very important to include %s in the following sentences -#if L==1 // ca - "Aula %s eliminada."; -#elif L==2 // de - "Klassenzimmer %s entfernt."; -#elif L==3 // en - "Classroom %s removed."; -#elif L==4 // es - "Aula %s eliminada."; -#elif L==5 // fr - "Salle de classe %s supprimée."; -#elif L==6 // gn - "Aula %s eliminada."; // Okoteve traducción -#elif L==7 // it - "Aula %s rimossa."; -#elif L==8 // pl - "Klasa %s usuniete."; -#elif L==9 // pt - "Sala de aula %s removida."; -#endif - -const char *Txt_CLASSROOMS_HELP_ORDER[Cla_NUM_ORDERS] = - { - [Cla_ORDER_BY_SHRT_NAME] = -#if L==1 // ca - "Ordenar per nom breu" -#elif L==2 // de - "Nach Kurzname sortieren" -#elif L==3 // en - "Sort by short name" -#elif L==4 // es - "Ordenar por nombre breve" -#elif L==5 // fr - "Trier par nom abrégé" -#elif L==6 // gn - "Ordenar por nombre breve" // Okoteve traducción -#elif L==7 // it - "Ordina per nome breve" -#elif L==8 // pl - "Sortuj według krótkiej nazwy" -#elif L==9 // pt - "Classificar por nome abreviado" -#endif - , - [Cla_ORDER_BY_FULL_NAME] = -#if L==1 // ca - "Ordenar per nom complet" -#elif L==2 // de - "Nach vollständiger Name sortieren" -#elif L==3 // en - "Sort by full name" -#elif L==4 // es - "Ordenar por nombre completo" -#elif L==5 // fr - "Trier par nom complet" -#elif L==6 // gn - "Ordenar por nombre completo" // Okoteve traducción -#elif L==7 // it - "Ordina per nome completo" -#elif L==8 // pl - "Sortuj według pełna nazwa" -#elif L==9 // pt - "Classificar por nome completo" -#endif - , - [Cla_ORDER_BY_CAPACITY] = -#if L==1 // ca - "Ordenar per aforo" -#elif L==2 // de - "Sortieren nach Sitzplatzkapazität" -#elif L==3 // en - "Sort by seating capacity" -#elif L==4 // es - "Ordenar por aforo" -#elif L==5 // fr - "Trier par nombre de places" -#elif L==6 // gn - "Ordenar por aforo" // Okoteve traducción -#elif L==7 // it - "Ordina per capacità di posti" -#elif L==8 // pl - "Sortuj wed&lsgtrok;ug pojemności miejsc" -#elif L==9 // pt - "Ordenar por capacidade" -#endif - , - [Cla_ORDER_BY_LOCATION] = -#if L==1 // ca - "Ordenar per ubicació" -#elif L==2 // de - "Nach Standort sortieren" -#elif L==3 // en - "Sort by location" -#elif L==4 // es - "Ordenar por ubicación" -#elif L==5 // fr - "Trier par emplacement" -#elif L==6 // gn - "Ordenar por ubicación" // Okoteve traducción -#elif L==7 // it - "Ordina per posizione" -#elif L==8 // pl - "Sortuj według lokacja" -#elif L==9 // pt - "Classificar por localização" -#endif - }; - -const char *Txt_CLASSROOMS_ORDER[Cla_NUM_ORDERS] = - { - [Cla_ORDER_BY_SHRT_NAME] = -#if L==1 // ca - "Nom breu" -#elif L==2 // de - "Kurzname" -#elif L==3 // en - "Short name" -#elif L==4 // es - "Nombre breve" -#elif L==5 // fr - "Nom abrégé" -#elif L==6 // gn - "Nombre breve" // Okoteve traducción -#elif L==7 // it - "Nome breve" -#elif L==8 // pl - "Krótkiej nazwy" -#elif L==9 // pt - "Nome abreviado" -#endif - , - [Cla_ORDER_BY_FULL_NAME] = -#if L==1 // ca - "Nom complet" -#elif L==2 // de - "Vollständiger Name" -#elif L==3 // en - "Full name" -#elif L==4 // es - "Nombre completo" -#elif L==5 // fr - "Nom complet" -#elif L==6 // gn - "Nombre completo" // Okoteve traducción -#elif L==7 // it - "Nome completo" -#elif L==8 // pl - "Pełna nazwa" -#elif L==9 // pt - "Nome completo" -#endif - , - [Cla_ORDER_BY_CAPACITY] = -#if L==1 // ca - "Aforo" -#elif L==2 // de - "Kapazität" -#elif L==3 // en - "Capacity" -#elif L==4 // es - "Aforo" -#elif L==5 // fr - "Capacité" -#elif L==6 // gn - "Aforo" // Okoteve traducción -#elif L==7 // it - "Capacità" -#elif L==8 // pl - "Pojemność" -#elif L==9 // pt - "Capacidade" -#endif - , - [Cla_ORDER_BY_LOCATION] = -#if L==1 // ca - "Ubicació" -#elif L==2 // de - "Standort" -#elif L==3 // en - "Location" -#elif L==4 // es - "Ubicación" -#elif L==5 // fr - "Emplacement" -#elif L==6 // gn - "Ñemohenda" -#elif L==7 // it - "Posizione" -#elif L==8 // pl - "Lokacja" -#elif L==9 // pt - "Localização" -#endif - }; - -const char *Txt_Classrooms = -#if L==1 // ca - "Aules"; -#elif L==2 // de - "Klassenzimmer"; -#elif L==3 // en - "Classrooms"; -#elif L==4 // es - "Aulas"; -#elif L==5 // fr - "Salles de classe"; -#elif L==6 // gn - "Mbo'ehakoty"; -#elif L==7 // it - "Aule"; -#elif L==8 // pl - "Klasy"; -#elif L==9 // pt - "Salas de aula"; -#endif - const char *Txt_Click = #if L==1 // ca "Clic"; @@ -5710,25 +5473,25 @@ const char *Txt_Create_centre = "Criar centro"; #endif -const char *Txt_Create_classroom = +const char *Txt_Create_room = #if L==1 // ca - "Crear aula"; + "Crear sala"; #elif L==2 // de - "Klassenzimmer eingeben"; + "Raum eingeben"; #elif L==3 // en - "Create classroom"; + "Create room"; #elif L==4 // es - "Crear aula"; + "Crear sala"; #elif L==5 // fr - "Créer salle de classe"; + "Créer salle"; #elif L==6 // gn - "Crear aula"; // Okoteve traducción + "Crear sala"; // Okoteve traducción #elif L==7 // it "Crea aula"; #elif L==8 // pl "Utwórz klasa"; #elif L==9 // pt - "Criar sala de aula"; + "Criar sala"; #endif const char *Txt_Create_country = @@ -6361,25 +6124,25 @@ const char *Txt_Created_new_centre_X = // Warning: it is very important to inclu "Criado novo centro %s."; #endif -const char *Txt_Created_new_classroom_X = // Warning: it is very important to include %s in the following sentences +const char *Txt_Created_new_room_X = // Warning: it is very important to include %s in the following sentences #if L==1 // ca - "Creada nova aula %s."; + "Creada nova sala %s."; #elif L==2 // de - "Neuer Klassenzimmer %s eingegeben."; + "Neuer Raum %s eingegeben."; #elif L==3 // en - "Created new classroom %s."; + "Created new room %s."; #elif L==4 // es - "Creada nueva aula %s."; + "Creada nueva sala %s."; #elif L==5 // fr - "Créé nouvelle salle de classe %s."; + "Créé nouvelle salle %s."; #elif L==6 // gn - "Creada nueva aula %s."; // Okoteve traducción + "Creada nueva sala %s."; // Okoteve traducción #elif L==7 // it "Creata nuova aula %s."; #elif L==8 // pl "Utworzono nowe klasa %s."; #elif L==9 // pt - "Criada nova sala de aula %s."; + "Criada nova sala %s."; #endif const char *Txt_Created_new_country_X = // Warning: it is very important to include %s in the following sentences @@ -19259,15 +19022,15 @@ const char *Txt_MENU_TITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = "Graus" #endif , - // 2: ActSeeCla + // 2: ActSeeRoo #if L==1 // ca - "Aules" + "Sales" #elif L==2 // de - "Klassenzimmer" + "Räume" #elif L==3 // en - "Classrooms" + "Rooms" #elif L==4 // es - "Aulas" + "Salas" #elif L==5 // fr "Salles" #elif L==6 // gn @@ -21115,25 +20878,25 @@ const char *Txt_MENU_SUBTITLE[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_PER_TAB] = "Graus" #endif , - // 2: ActSeeCla + // 2: ActSeeRoo #if L==1 // ca - "Aules, laboratoris o altres llocs on s'imparteixen classes" + "Aules, laboratoris o altres llocs" #elif L==2 // de "Klassenzimmer, Laboratorien oder andere Unterrichtsorte" #elif L==3 // en - "Classrooms, laboratories or other places where classes are taught" + "Classrooms, laboratories or other places" #elif L==4 // es - "Aulas, laboratorios u otros lugares donde se imparten clases" + "Aulas, laboratorios u otros lugares" #elif L==5 // fr - "Salles de classe, laboratoires ou autres lieux de cours" + "Salles de classe, laboratoires ou autres lieux" #elif L==6 // gn "Mbo'ehakoty" #elif L==7 // it - "Aule, laboratori o altri luoghi in cui vengono insegnate le lezioni" + "Aule, laboratori o altri luoghi" #elif L==8 // pl "Klasy, laboratoria lub inne miejsca, w których odbywają się zajęcia" #elif L==9 // pt - "Salas de aula, laboratórios ou outros locais onde as aulas são ministradas" + "Salas de aula, laboratórios ou outros locais" #endif , NULL, // 3 @@ -24337,25 +24100,25 @@ const char *Txt_New_centre = "Novo centro (faculdade, escola, faculdade, divisão, construção...)"; #endif -const char *Txt_New_classroom = +const char *Txt_New_room = #if L==1 // ca - "Nova aula"; + "Nova sala"; #elif L==2 // de - "Neue Klassenzimmer"; + "Neue Raum"; #elif L==3 // en - "New classroom"; + "New room"; #elif L==4 // es - "Nueva aula"; + "Nueva sala"; #elif L==5 // fr - "Nouvelle salle de classe"; + "Nouvelle salle"; #elif L==6 // gn - "Nueva aula"; // Okoteve traducción + "Nueva sala"; // Okoteve traducción #elif L==7 // it "Nuova aula"; #elif L==8 // pl "Nowe klasa"; #elif L==9 // pt - "Nova sala de aula"; + "Nova sala"; #endif const char *Txt_New_country = @@ -25240,25 +25003,25 @@ const char *Txt_No_announcements_of_exams_of_X = // Warning: it is very importan "Não chamadas para exame de %s."; #endif -const char *Txt_No_assigned_classroom = +const char *Txt_No_assigned_room = #if L==1 // ca - "Sense aula assignada"; + "Sense sala assignada"; #elif L==2 // de - "Kein zugewiesenes Klassenzimmer"; + "Kein zugewiesenes Raum"; #elif L==3 // en - "No assigned classroom"; + "No assigned room"; #elif L==4 // es - "Sin aula asignada"; + "Sin sala asignada"; #elif L==5 // fr - "Aucune classe assignée"; + "Aucune salle assignée"; #elif L==6 // gn - "Sin aula asignada"; // Okoteve traducción + "Sin sala asignada"; // Okoteve traducción #elif L==7 // it "Nessuna aula assegnata"; #elif L==8 // pl "Brak przydzielonej sali lekcyjnej"; #elif L==9 // pt - "Nenhuma sala de aula atribuída"; + "Nenhuma sala atribuída"; #endif const char *Txt_No_assignments = @@ -37992,17 +37755,254 @@ const char *Txt_ROLES_PLURAL_abc[Rol_NUM_ROLES][Usr_NUM_SEXS] = #endif }; +const char *Txt_Room = +#if L==1 // ca + "Sala"; +#elif L==2 // de + "Raum"; +#elif L==3 // en + "Room"; +#elif L==4 // es + "Sala"; +#elif L==5 // fr + "Salle"; +#elif L==6 // gn + "Mbo'ehakoty"; +#elif L==7 // it + "Aula"; +#elif L==8 // pl + "Klasa"; +#elif L==9 // pt + "Sala"; +#endif + +const char *Txt_Room_X_removed = // Warning: it is very important to include %s in the following sentences +#if L==1 // ca + "Sala %s eliminada."; +#elif L==2 // de + "Raum %s entfernt."; +#elif L==3 // en + "Room %s removed."; +#elif L==4 // es + "Sala %s eliminada."; +#elif L==5 // fr + "Salle %s supprimée."; +#elif L==6 // gn + "Sala %s eliminada."; // Okoteve traducción +#elif L==7 // it + "Aula %s rimossa."; +#elif L==8 // pl + "Klasa %s usuniete."; +#elif L==9 // pt + "Sala %s removida."; +#endif + +const char *Txt_ROOMS_HELP_ORDER[Roo_NUM_ORDERS] = + { + [Roo_ORDER_BY_SHRT_NAME] = +#if L==1 // ca + "Ordenar per nom breu" +#elif L==2 // de + "Nach Kurzname sortieren" +#elif L==3 // en + "Sort by short name" +#elif L==4 // es + "Ordenar por nombre breve" +#elif L==5 // fr + "Trier par nom abrégé" +#elif L==6 // gn + "Ordenar por nombre breve" // Okoteve traducción +#elif L==7 // it + "Ordina per nome breve" +#elif L==8 // pl + "Sortuj według krótkiej nazwy" +#elif L==9 // pt + "Classificar por nome abreviado" +#endif + , + [Roo_ORDER_BY_FULL_NAME] = +#if L==1 // ca + "Ordenar per nom complet" +#elif L==2 // de + "Nach vollständiger Name sortieren" +#elif L==3 // en + "Sort by full name" +#elif L==4 // es + "Ordenar por nombre completo" +#elif L==5 // fr + "Trier par nom complet" +#elif L==6 // gn + "Ordenar por nombre completo" // Okoteve traducción +#elif L==7 // it + "Ordina per nome completo" +#elif L==8 // pl + "Sortuj według pełna nazwa" +#elif L==9 // pt + "Classificar por nome completo" +#endif + , + [Roo_ORDER_BY_CAPACITY] = +#if L==1 // ca + "Ordenar per aforo" +#elif L==2 // de + "Sortieren nach Sitzplatzkapazität" +#elif L==3 // en + "Sort by seating capacity" +#elif L==4 // es + "Ordenar por aforo" +#elif L==5 // fr + "Trier par nombre de places" +#elif L==6 // gn + "Ordenar por aforo" // Okoteve traducción +#elif L==7 // it + "Ordina per capacità di posti" +#elif L==8 // pl + "Sortuj wed&lsgtrok;ug pojemności miejsc" +#elif L==9 // pt + "Ordenar por capacidade" +#endif + , + [Roo_ORDER_BY_LOCATION] = +#if L==1 // ca + "Ordenar per ubicació" +#elif L==2 // de + "Nach Standort sortieren" +#elif L==3 // en + "Sort by location" +#elif L==4 // es + "Ordenar por ubicación" +#elif L==5 // fr + "Trier par emplacement" +#elif L==6 // gn + "Ordenar por ubicación" // Okoteve traducción +#elif L==7 // it + "Ordina per posizione" +#elif L==8 // pl + "Sortuj według lokacja" +#elif L==9 // pt + "Classificar por localização" +#endif + }; + +const char *Txt_ROOMS_ORDER[Roo_NUM_ORDERS] = + { + [Roo_ORDER_BY_SHRT_NAME] = +#if L==1 // ca + "Nom breu" +#elif L==2 // de + "Kurzname" +#elif L==3 // en + "Short name" +#elif L==4 // es + "Nombre breve" +#elif L==5 // fr + "Nom abrégé" +#elif L==6 // gn + "Nombre breve" // Okoteve traducción +#elif L==7 // it + "Nome breve" +#elif L==8 // pl + "Krótkiej nazwy" +#elif L==9 // pt + "Nome abreviado" +#endif + , + [Roo_ORDER_BY_FULL_NAME] = +#if L==1 // ca + "Nom complet" +#elif L==2 // de + "Vollständiger Name" +#elif L==3 // en + "Full name" +#elif L==4 // es + "Nombre completo" +#elif L==5 // fr + "Nom complet" +#elif L==6 // gn + "Nombre completo" // Okoteve traducción +#elif L==7 // it + "Nome completo" +#elif L==8 // pl + "Pełna nazwa" +#elif L==9 // pt + "Nome completo" +#endif + , + [Roo_ORDER_BY_CAPACITY] = +#if L==1 // ca + "Aforo" +#elif L==2 // de + "Kapazität" +#elif L==3 // en + "Capacity" +#elif L==4 // es + "Aforo" +#elif L==5 // fr + "Capacité" +#elif L==6 // gn + "Aforo" // Okoteve traducción +#elif L==7 // it + "Capacità" +#elif L==8 // pl + "Pojemność" +#elif L==9 // pt + "Capacidade" +#endif + , + [Roo_ORDER_BY_LOCATION] = +#if L==1 // ca + "Ubicació" +#elif L==2 // de + "Standort" +#elif L==3 // en + "Location" +#elif L==4 // es + "Ubicación" +#elif L==5 // fr + "Emplacement" +#elif L==6 // gn + "Ñemohenda" +#elif L==7 // it + "Posizione" +#elif L==8 // pl + "Lokacja" +#elif L==9 // pt + "Localização" +#endif + }; + +const char *Txt_Rooms = +#if L==1 // ca + "Sales"; +#elif L==2 // de + "Räume"; +#elif L==3 // en + "Rooms"; +#elif L==4 // es + "Salas"; +#elif L==5 // fr + "Salles"; +#elif L==6 // gn + "Mbo'ehakoty"; +#elif L==7 // it + "Aule"; +#elif L==8 // pl + "Klasy"; +#elif L==9 // pt + "Salas"; +#endif + const char *Txt_Rooms_with_users = #if L==1 // ca - "Salas con usuarios"; // Necessita traduccio + "Sales amb usuaris"; #elif L==2 // de - "Rooms with users"; // Need Übersetzung + "Räume mit Benutzern"; #elif L==3 // en "Rooms with users"; #elif L==4 // es "Salas con usuarios"; #elif L==5 // fr - "Rooms with users"; // Besoin de traduction + "Salles avec utilisateurs"; #elif L==6 // gn "Salas con usuarios"; // Okoteve traducción #elif L==7 // it @@ -38010,7 +38010,7 @@ const char *Txt_Rooms_with_users = #elif L==8 // pl "Rooms with users"; // Potrzebujesz tlumaczenie #elif L==9 // pt - "Quartos com usuários"; + "Salas com usuários"; #endif const char *Txt_ROOT_FOLDER_EXTERNAL_NAMES[Brw_NUM_TYPES_FILE_BROWSER] = @@ -44244,46 +44244,46 @@ const char *Txt_The_banner_X_has_been_renamed_as_Y = // Warning: it is very impo "O banner %s foi renomeado como %s."; #endif -const char *Txt_The_capacity_of_classroom_X_has_not_changed = // Warning: it is very important to include %s in the following sentences +const char *Txt_The_capacity_of_room_X_has_not_changed = // Warning: it is very important to include %s in the following sentences #if L==1 // ca - "L'aforament de l'aula %s no ha canviat."; + "L'aforament de la sala %s no ha canviat."; #elif L==2 // de - "Die Kapazität des Klassenzimmers %s hat sich nicht geändert."; + "Die Kapazität des Raum %s hat sich nicht geändert."; #elif L==3 // en - "The capacity of classroom %s has not changed."; + "The capacity of room %s has not changed."; #elif L==4 // es - "El aforo del aula %s no ha cambiado."; + "El aforo de la sala %s no ha cambiado."; #elif L==5 // fr - "La capacité de la salle de classe %s n'a pas changé."; + "La capacité de la salle %s n'a pas changé."; #elif L==6 // gn - "El aforo del aula %s no ha cambiado."; // Okoteve traducción + "El aforo de la sala %s no ha cambiado."; // Okoteve traducción #elif L==7 // it "La capacità della aula %s non è cambiata."; #elif L==8 // pl "Pojemność klasy %s nie uległa zmianie."; #elif L==9 // pt - "A capacidade da sala de aula %s não mudou."; + "A capacidade da sala %s não mudou."; #endif -const char *Txt_The_capacity_of_classroom_X_is_now_Y = // Warning: it is very important to include %s and %u in the following sentences +const char *Txt_The_capacity_of_room_X_is_now_Y = // Warning: it is very important to include %s and %u in the following sentences #if L==1 // ca - "L'aforament de l'aula %s ara és %u."; + "L'aforament de la sala %s ara és %u."; #elif L==2 // de - "Die Kapazität des Klassenzimmers %s beträgt jetzt %u."; + "Die Kapazität des Raum %s beträgt jetzt %u."; #elif L==3 // en - "The capacity of classroom %s is now %u."; + "The capacity of room %s is now %u."; #elif L==4 // es - "El aforo del aula %s ahora es %u."; + "El aforo de la sala %s ahora es %u."; #elif L==5 // fr - "La capacité de la salle de classe %s est maintenant de %u."; + "La capacité de la salle %s est maintenant de %u."; #elif L==6 // gn - "El aforo del aula %s ahora es %u."; // Okoteve traducción + "El aforo de la sala %s ahora es %u."; // Okoteve traducción #elif L==7 // it "La capacità della aula %s è ora %u."; #elif L==8 // pl "Pojemność klasy %s wynosi teraz %u."; #elif L==9 // pt - "A capacidade da sala de aula %s é agora %u."; + "A capacidade da sala %s é agora %u."; #endif const char *Txt_The_centre_X_already_exists = // Warning: it is very important to include %s in the following sentences @@ -44358,88 +44358,88 @@ const char *Txt_The_centre_X_has_been_renamed_as_Y = // Warning: it is very impo "O centro %s foi renomeado como %s."; #endif -const char *Txt_The_classroom_X_already_exists = // Warning: it is very important to include %s in the following sentences +const char *Txt_The_room_X_already_exists = // Warning: it is very important to include %s in the following sentences #if L==1 // ca - "L'aula %s ja existeix."; + "La sala %s ja existeix."; #elif L==2 // de - "Das Klassenzimmer %s wurde bereits eingegeben."; + "Das Raum %s wurde bereits eingegeben."; #elif L==3 // en - "The classroom %s already exists."; + "The room %s already exists."; #elif L==4 // es - "El aula %s ya existe."; + "La sala %s ya existe."; #elif L==5 // fr - "La salle de classe %s existe déjà."; + "La salle %s existe déjà."; #elif L==6 // gn - "El aula %s ya existe."; // Okoteve traducción + "La sala %s ya existe."; // Okoteve traducción #elif L==7 // it "L'aula %s già esiste."; #elif L==8 // pl "Klasa %s już istnieje."; #elif L==9 // pt - "A sala de clase %s já existe."; + "A sala %s já existe."; #endif -const char *Txt_The_classroom_X_does_not_have_a_limited_capacity_now = // Warning: it is very important to include %s in the following sentences +const char *Txt_The_room_X_does_not_have_a_limited_capacity_now = // Warning: it is very important to include %s in the following sentences #if L==1 // ca - "L'aula %s ja no té un aforament limitat."; + "La sala %s ja no té un aforament limitat."; #elif L==2 // de - "Das Klassenzimmer %s hat jetzt keine begrenzte Kapazität."; + "Das Raum %s hat jetzt keine begrenzte Kapazität."; #elif L==3 // en - "The classroom %s does not have a limited capacity now."; + "The room %s does not have a limited capacity now."; #elif L==4 // es - "El aula %s ya no tiene un aforo limitado."; + "La sala %s ya no tiene un aforo limitado."; #elif L==5 // fr - "La salle de classe %s n'a plus de capacité limitée."; + "La salle %s n'a plus de capacité limitée."; #elif L==6 // gn - "El aula %s ya no tiene un aforo limitado."; // Okoteve traducción + "La sala %s ya no tiene un aforo limitado."; // Okoteve traducción #elif L==7 // it "L'aula %s non ha una capacità limitata ora."; #elif L==8 // pl "Klasa %s nie ma teraz ograniczonej pojemności."; #elif L==9 // pt - "A sala de clase %s não tem capacidade limitada agora."; + "A sala %s não tem capacidade limitada 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 +const char *Txt_The_room_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."; + "La sala %s ha passat a denominar-se %s."; #elif L==2 // de - "Der Standort %s wurde in %s umbenannt."; + "Das Raum %s wurde in %s umbenannt."; #elif L==3 // en - "Das Klassenzimmer %s has been renamed as %s."; + "The room %s has been renamed as %s."; #elif L==4 // es - "El aula %s ha pasado a denominarse %s."; + "La sala %s ha pasado a denominarse %s."; #elif L==5 // fr - "La salle de classe %s a été renommée en %s."; + "La salle %s a été renommée en %s."; #elif L==6 // gn - "El aula %s ha pasado a denominarse %s."; // Okoteve traducción + "La sala %s ha pasado a denominarse %s."; // Okoteve traducción #elif L==7 // it "L'aula %s è stata rinominata come %s."; #elif L==8 // pl "Klasa %s zostało przemianowane na %s."; #elif L==9 // pt - "A sala de clase %s foi renomeada como %s."; + "A sala %s foi renomeada como %s."; #endif -const char *Txt_The_classroom_assigned_to_the_group_X_has_changed = +const char *Txt_The_room_assigned_to_the_group_X_has_changed = #if L==1 // ca - "L'aula assignada al grup %s ha canviat."; + "La sala assignada al grup %s ha canviat."; #elif L==2 // de - "Das der Gruppe %s zugeordnete Klassenzimmer hat sich geändert."; + "Das der Gruppe %s zugeordnete Raum hat sich geändert."; #elif L==3 // en - "The classroom assigned to the group %s has changed."; + "The room assigned to the group %s has changed."; #elif L==4 // es - "El aula asignada al grupo %s ha cambiado."; + "La sala asignada al grupo %s ha cambiado."; #elif L==5 // fr - "La salle de classe affectée au groupe %s a changé."; + "La salle affectée au groupe %s a changé."; #elif L==6 // gn - "El aula asignada al grupo %s ha cambiado."; // Okoteve traducción + "La sala asignada al grupo %s ha cambiado."; // Okoteve traducción #elif L==7 // it "L'aula assegnata al gruppo %s è cambiata."; #elif L==8 // pl "Klasa przypisana do grupy %s uległa zmianie."; #elif L==9 // pt - "A sala de aula atribuída ao grupo %s mudou."; + "A sala atribuída ao grupo %s mudou."; #endif const char *Txt_The_comment_no_longer_exists = @@ -46302,24 +46302,24 @@ const char *Txt_The_list_of_X_users_is_too_large_to_be_displayed = // Warning: i "A lista de %u usuários é muito grande para ser exibida."; #endif -const char *Txt_The_location_of_the_classroom_X_has_changed_to_Y = // Warning: it is very important to include two %s in the following sentences +const char *Txt_The_location_of_the_room_X_has_changed_to_Y = // Warning: it is very important to include two %s in the following sentences #if L==1 // ca - "La ubicació de l'aula %s" + "La ubicació de la sala %s" " ha canviat a %s."; #elif L==2 // de - "Der Standort des Klassenzimmer %s" + "Der Standort des Raum %s" " wurde in %s geändert."; #elif L==3 // en - "The location of the classroom %s" + "The location of the room %s" " has changed to %s."; #elif L==4 // es - "La ubicación del aula %s" + "La ubicación de la sala %s" " ha cambiado a %s."; #elif L==5 // fr - "L'emplacement de la salle de classe %s" + "L'emplacement de la salle %s" " a été remplacé par %s."; #elif L==6 // gn - "La ubicación del aula %s" + "La ubicación de la sala %s" " ha cambiado a %s."; // Okoteve traducción #elif L==7 // it "La posizione della aula %s" @@ -46328,28 +46328,28 @@ const char *Txt_The_location_of_the_classroom_X_has_changed_to_Y = // Warning: i "Lokalizacja klasy %s" " zmieniła się na %s."; #elif L==9 // pt - "A localização da sala de clase %s" + "A localização da sala %s" " mudou para %s."; #endif -const char *Txt_The_location_of_the_classroom_X_has_not_changed = // Warning: it is very important to include %s in the following sentences +const char *Txt_The_location_of_the_room_X_has_not_changed = // Warning: it is very important to include %s in the following sentences #if L==1 // ca - "La ubicació de l'aula %s" + "La ubicació de la sala %s" " no ha canviat."; #elif L==2 // de - "Der Standort des Klassenzimmer %s" + "Der Standort des Raum %s" " hat sich nicht geändert."; #elif L==3 // en - "The location of the classroom %s" + "The location of the room %s" " has not changed."; #elif L==4 // es - "La ubicación del aula %s" + "La ubicación de la sala %s" " no ha cambiado."; #elif L==5 // fr - "L'emplacement de la salle de classe %s" + "L'emplacement de la salle %s" " n'a pas changé."; #elif L==6 // gn - "La ubicación del aula %s" + "La ubicación de la sala %s" " no ha cambiado."; // Okoteve traducción #elif L==7 // it "La posizione della aula %s" @@ -46358,7 +46358,7 @@ const char *Txt_The_location_of_the_classroom_X_has_not_changed = // Warning: it "Lokalizacja klasy %s" " nie uległa zmianie."; #elif L==9 // pt - "A localização da sala de clase %s" + "A localização da sala %s" " não foi alterada."; #endif @@ -46587,25 +46587,25 @@ const char *Txt_The_name_of_the_centre_X_has_not_changed = // Warning: it is ver "O nome do centro %s não foi alterado."; #endif -const char *Txt_The_name_of_the_classroom_X_has_not_changed = // Warning: it is very important to include %s in the following sentences +const char *Txt_The_name_of_the_room_X_has_not_changed = // Warning: it is very important to include %s in the following sentences #if L==1 // ca - "El nom de l'aula %s no ha canviat."; + "El nom de la sala %s no ha canviat."; #elif L==2 // de - "Der Name des Klassenzimmer %s hat sich nicht geändert."; + "Der Name des Raum %s hat sich nicht geändert."; #elif L==3 // en - "The name of the classroom %s has not changed."; + "The name of the room %s has not changed."; #elif L==4 // es - "El nombre del aula %s no ha cambiado."; + "El nombre de la sala %s no ha cambiado."; #elif L==5 // fr - "Le nom de la salle de classe %s n'a pas changé."; + "Le nom de la salle %s n'a pas changé."; #elif L==6 // gn - "El nombre del aula %s no ha cambiado."; // Okoteve traducción + "El nombre de la sala %s no ha cambiado."; // Okoteve traducción #elif L==7 // it "Il nome della aula %s non è cambiato."; #elif L==8 // pl "Nazwa klasy %s nie uległa zmianie."; #elif L==9 // pt - "O nome da sala de clase %s não foi alterado."; + "O nome da sala %s não foi alterado."; #endif const char *Txt_The_name_of_the_country_X_has_not_changed = // Warning: it is very important to include %s in the following sentences @@ -56812,25 +56812,25 @@ const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_cen " do novo centro."; #endif -const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_classroom = +const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_room = #if L==1 // ca "Heu d'especificar el nom curt i el nom complet" - " de la nova aula."; + " de la nova sala."; #elif L==2 // de "Sie m¨ssen den Kurznamen und den vollständigen Namen" - " des neuen Klassenzimmers angeben."; + " des neuen Raum angeben."; #elif L==3 // en "You must specify the short name and the full name" - " of the new classroom."; + " of the new room."; #elif L==4 // es "Debe especificar el nombre breve y el nombre completo" - " de la nueva aula."; + " de la nueva sala."; #elif L==5 // fr "Vous devez spécifier le nom abrégé et le nom complet" - " de la nouvelle salle de classe."; + " de la nouvelle salle."; #elif L==6 // gn "Debe especificar el nombre breve y el nombre completo" - " de la nueva aula."; // Okoteve traducción + " de la nueva sala."; // Okoteve traducción #elif L==7 // it "Devi specificare il nome breve e completo" " della nuova aula."; @@ -56839,7 +56839,7 @@ const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_cla " nowej klasy."; #elif L==9 // pt "Você deve especificar o nome abreviado e o nome completo" - " da nova sala de aula."; + " da nova sala."; #endif const char *Txt_You_must_specify_the_short_name_and_the_full_name_of_the_new_course = diff --git a/swad_text_action.c b/swad_text_action.c index b55400f2..a9b523ae 100644 --- a/swad_text_action.c +++ b/swad_text_action.c @@ -3569,15 +3569,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActSeeCla] = + [ActSeeRoo] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de "" // Need Übersetzung #elif L==3 // en - "List classrooms in a centre" + "List rooms in a centre" #elif L==4 // es - "" + "Listar salas de un centro" #elif L==5 // fr "" // Besoin de traduction #elif L==6 // gn @@ -4199,15 +4199,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActEdiCla] = + [ActEdiRoo] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de "" // Need Übersetzung #elif L==3 // en - "Edit classrooms" + "Edit rooms" #elif L==4 // es - "" + "Editar salas" #elif L==5 // fr "" // Besoin de traduction #elif L==6 // gn @@ -4220,15 +4220,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActNewCla] = + [ActNewRoo] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de "" // Need Übersetzung #elif L==3 // en - "Request the creation of a classroom" + "Request the creation of a room" #elif L==4 // es - "" + "Solicitar la creación de una sala" #elif L==5 // fr "" // Besoin de traduction #elif L==6 // gn @@ -4241,15 +4241,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActRemCla] = + [ActRemRoo] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de "" // Need Übersetzung #elif L==3 // en - "Remove a classroom" + "Remove a room" #elif L==4 // es - "" + "Eliminar sala" #elif L==5 // fr "" // Besoin de traduction #elif L==6 // gn @@ -4262,15 +4262,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActRenClaSho] = + [ActRenRooSho] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de "" // Need Übersetzung #elif L==3 // en - "Change short name of a classroom" + "Change short name of a room" #elif L==4 // es - "" + "Cambiar nombre breve de sala" #elif L==5 // fr "" // Besoin de traduction #elif L==6 // gn @@ -4283,15 +4283,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActRenClaFul] = + [ActRenRooFul] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de "" // Need Übersetzung #elif L==3 // en - "Change full name of a classroom" + "Change full name of a room" #elif L==4 // es - "" + "Cambiar nombre completo de sala" #elif L==5 // fr "" // Besoin de traduction #elif L==6 // gn @@ -4304,15 +4304,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActChgClaMaxStd] = + [ActChgRooMaxUsr] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de "" // Need Übersetzung #elif L==3 // en - "Change number of students in a classroom" + "Change number of usuarios in a room" #elif L==4 // es - "" + "Cambiar número de usuarios de una sala" #elif L==5 // fr "" // Besoin de traduction #elif L==6 // gn @@ -4325,15 +4325,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActRenClaLoc] = + [ActRenRooLoc] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de "" // Need Übersetzung #elif L==3 // en - "Change location of a classroom" + "Change location of a room" #elif L==4 // es - "" + "Cambiar ubicación de una sala" #elif L==5 // fr "" // Besoin de traduction #elif L==6 // gn @@ -21020,15 +21020,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActChgGrpCla] = + [ActChgGrpRoo] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de "" // Need Übersetzung #elif L==3 // en - "Change the classroom of a group" + "Change the room of a group" #elif L==4 // es - "" + "Cambiar la sala de un grupo" #elif L==5 // fr "" // Besoin de traduction #elif L==6 // gn diff --git a/swad_theme.c b/swad_theme.c index e0b95685..61e59206 100644 --- a/swad_theme.c +++ b/swad_theme.c @@ -30,6 +30,7 @@ #include "swad_box.h" #include "swad_config.h" #include "swad_database.h" +#include "swad_figure.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" diff --git a/swad_timeline.c b/swad_timeline.c index c6f8d3f3..34110fad 100644 --- a/swad_timeline.c +++ b/swad_timeline.c @@ -37,12 +37,15 @@ #include "swad_constant.h" #include "swad_database.h" #include "swad_exam.h" +#include "swad_figure.h" #include "swad_follow.h" #include "swad_form.h" +#include "swad_forum.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_layout.h" #include "swad_media.h" +#include "swad_message.h" #include "swad_notice.h" #include "swad_notification.h" #include "swad_parameter.h" diff --git a/swad_timetable.c b/swad_timetable.c index f5f0d460..9325616b 100644 --- a/swad_timetable.c +++ b/swad_timetable.c @@ -1495,7 +1495,7 @@ static void TT_TimeTableDrawCell (const struct TT_Timetable *Timetable, struct Course Crs; struct GroupType *GrpTyp; struct Group *Grp; - char *Classroom; + char *Room; /***** Compute row span and background color depending on hour type *****/ switch (IntervalType) @@ -1611,10 +1611,10 @@ static void TT_TimeTableDrawCell (const struct TT_Timetable *Timetable, HTM_Txt (GrpDat.GrpTypName); HTM_BR (); HTM_Txt (GrpDat.GrpName); - if (GrpDat.Classroom.ClaCod > 0) + if (GrpDat.Room.RooCod > 0) { HTM_BR (); - HTM_TxtF ("(%s)",GrpDat.Classroom.ShrtName); + HTM_TxtF ("(%s)",GrpDat.Room.ShrtName); } } @@ -1727,21 +1727,21 @@ static void TT_TimeTableDrawCell (const struct TT_Timetable *Timetable, NumGrp++) { Grp = &GrpTyp->LstGrps[NumGrp]; - if (Grp->Classroom.ClaCod > 0) + if (Grp->Room.RooCod > 0) { - if (asprintf (&Classroom," (%s)",Grp->Classroom.ShrtName) < 0) + if (asprintf (&Room," (%s)",Grp->Room.ShrtName) < 0) Lay_NotEnoughMemoryExit (); } else { - if (asprintf (&Classroom,"%s","") < 0) + if (asprintf (&Room,"%s","") < 0) Lay_NotEnoughMemoryExit (); } HTM_OPTION (HTM_Type_LONG,&Grp->GrpCod, GrpCod == Grp->GrpCod,false, "%s %s%s", - GrpTyp->GrpTypName,Grp->GrpName,Classroom); - free (Classroom); + GrpTyp->GrpTypName,Grp->GrpName,Room); + free (Room); } } HTM_SELECT_End (); diff --git a/swad_user.c b/swad_user.c index 1ed14a73..e36482a6 100644 --- a/swad_user.c +++ b/swad_user.c @@ -37,6 +37,7 @@ #include // For access, lstat, getpid, chdir, symlink, unlink #include "swad_account.h" +#include "swad_agenda.h" #include "swad_announcement.h" #include "swad_box.h" #include "swad_calendar.h" @@ -44,8 +45,10 @@ #include "swad_connected.h" #include "swad_course.h" #include "swad_database.h" +#include "swad_department.h" #include "swad_duplicate.h" #include "swad_enrolment.h" +#include "swad_figure.h" #include "swad_follow.h" #include "swad_form.h" #include "swad_global.h" @@ -60,6 +63,7 @@ #include "swad_notification.h" #include "swad_parameter.h" #include "swad_password.h" +#include "swad_photo.h" #include "swad_privacy.h" #include "swad_QR.h" #include "swad_record.h"