diff --git a/sql/swad.sql b/sql/swad.sql index bf56e0be2..fef12b133 100644 --- a/sql/swad.sql +++ b/sql/swad.sql @@ -186,6 +186,7 @@ CREATE TABLE IF NOT EXISTS classrooms ( ShortName VARCHAR(511) NOT NULL, FullName VARCHAR(2047) NOT NULL, Capacity INT NOT NULL, + Location VARCHAR(2047) NOT NULL, UNIQUE INDEX(ClaCod), INDEX(CtrCod)); -- diff --git a/swad_changelog.h b/swad_changelog.h index 4e58d3410..b8909e468 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -364,10 +364,14 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.26.1 (2019-01-02)" +#define Log_PLATFORM_VERSION "SWAD 18.26.2 (2019-01-02)" #define CSS_FILE "swad18.22.css" #define JS_FILE "swad17.17.1.js" /* + Version 18.26.2: Jan 02, 2019 New field location in classrooms table. (238711 lines) + 1 change necessary in database: +ALTER TABLE classrooms ADD COLUMN Location VARCHAR(2047) NOT NULL AFTER Capacity; + Version 18.26.1: Jan 02, 2019 "Maximum number of students" in a classroom is changed to "(seating) capacity". (238702 lines) 2 changes necessary in database: ALTER TABLE classrooms CHANGE COLUMN MaxStudents Capacity INT NOT NULL; diff --git a/swad_classroom.c b/swad_classroom.c index 00d38f376..ff33b2675 100644 --- a/swad_classroom.c +++ b/swad_classroom.c @@ -450,7 +450,7 @@ static void Cla_ListClassroomsForEdition (void) Cla->ClaCod); /* Classroom short name */ - fprintf (Gbl.F.Out,""); + fprintf (Gbl.F.Out,""); Frm_StartForm (ActRenClaSho); Cla_PutParamClaCod (Cla->ClaCod); fprintf (Gbl.F.Out,""); /* Classroom full name */ - fprintf (Gbl.F.Out,""); + fprintf (Gbl.F.Out,""); Frm_StartForm (ActRenClaFul); Cla_PutParamClaCod (Cla->ClaCod); fprintf (Gbl.F.Out,""); /* Seating capacity */ - fprintf (Gbl.F.Out,""); + fprintf (Gbl.F.Out,""); Frm_StartForm (ActChgClaMaxStd); Cla_PutParamClaCod (Cla->ClaCod); fprintf (Gbl.F.Out,"" "%s" "" - "" + "" "%s" "" "", diff --git a/swad_classroom.h b/swad_classroom.h index 5913228e8..e777ba188 100644 --- a/swad_classroom.h +++ b/swad_classroom.h @@ -43,13 +43,17 @@ #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 Classroom { long ClaCod; long InsCod; char ShrtName[Cla_MAX_BYTES_CLASSROOM_SHRT_NAME + 1]; char FullName[Cla_MAX_BYTES_CLASSROOM_FULL_NAME + 1]; - unsigned Capacity; // Seating capacity (maximum number of people that fit in the room) + 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 2 diff --git a/swad_database.c b/swad_database.c index 1d35ed1a4..66683d7d4 100644 --- a/swad_database.c +++ b/swad_database.c @@ -467,23 +467,25 @@ mysql> DESCRIBE chat; /***** Table classrooms *****/ /* mysql> DESCRIBE classrooms; -+-------------+---------------+------+-----+---------+----------------+ -| Field | Type | Null | Key | Default | Extra | -+-------------+---------------+------+-----+---------+----------------+ -| ClaCod | int(11) | NO | PRI | NULL | auto_increment | -| CtrCod | int(11) | NO | MUL | NULL | | -| ShortName | varchar(511) | NO | | NULL | | -| FullName | varchar(2047) | NO | | NULL | | -| MaxStudents | int(11) | NO | | NULL | | -+-------------+---------------+------+-----+---------+----------------+ -5 rows in set (0.00 sec) ++-----------+---------------+------+-----+---------+----------------+ +| 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_CLASSROOM_SHRT_NAME "FullName VARCHAR(2047) NOT NULL," // Cla_MAX_BYTES_CLASSROOM_FULL_NAME - "MaxStudents INT NOT NULL," + "Capacity INT NOT NULL," + "Location VARCHAR(2047) NOT NULL," // Cla_MAX_BYTES_LOCATION "UNIQUE INDEX(ClaCod)," "INDEX(CtrCod))");