Version19.187

This commit is contained in:
acanas 2020-04-15 02:17:57 +02:00
parent c32968550c
commit 0083dbe54d
13 changed files with 402 additions and 70 deletions

View File

@ -1401,6 +1401,12 @@ a:hover img.CENTRE_PHOTO_SHOW
width:60px;
}
/***************************** Buildings and rooms ***************************/
.BLD_SEL
{
width:80px;
}
/*********************************** Month ***********************************/
.CALENDAR
{
@ -4073,6 +4079,11 @@ a.PAG:hover, .PAG_CUR
box-sizing:border-box;
width:180px;
}
.INPUT_LONG
{
box-sizing:border-box;
width:60px;
}
.INPUT_WWW_NARROW
{
box-sizing:border-box;

View File

@ -13337,5 +13337,8 @@ SELECT my_courses.CrsCod,COUNT(*) AS N FROM (SELECT CrsCod FROM crs_usr WHERE Us
SELECT COUNT(*) FROM usr_data WHERE InsCod=25037;
UPDATE usr_data SET InsCod=1130 WHERE InsCod=25037;
ALTER TABLE rooms CHANGE COLUMN BldCod BldCod INT NOT NULL DEFAULT -1;

View File

@ -1135,12 +1135,14 @@ CREATE TABLE IF NOT EXISTS projects (
CREATE TABLE IF NOT EXISTS rooms (
RooCod INT NOT NULL AUTO_INCREMENT,
CtrCod INT NOT NULL,
BldCod INT NOT NULL DEFAULT -1,
Floor INT NOT NULL DEFAULT 0,
ShortName VARCHAR(511) NOT NULL,
FullName VARCHAR(2047) NOT NULL,
Capacity INT NOT NULL,
Location VARCHAR(2047) NOT NULL,
UNIQUE INDEX(RooCod),
INDEX(CtrCod));
INDEX(CtrCod,BldCod,Floor));
--
-- Table sessions: stores the information of open sessions
--

View File

@ -362,6 +362,8 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
[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},
[ActChgRooBld ] = {1845,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_ChangeBuilding ,Roo_ContEditAfterChgRoom ,NULL},
[ActChgRooFlo ] = {1846,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_ChangeFloor ,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},
@ -3591,6 +3593,8 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
ActRenBldSho, // #1842
ActRenBldFul, // #1843
ActRenBldLoc, // #1844
ActChgRooBld, // #1845
ActChgRooFlo, // #1846
};
/*****************************************************************************/

View File

@ -64,7 +64,7 @@ typedef enum
typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action
#define Act_MAX_ACTION_COD 1844
#define Act_MAX_ACTION_COD 1846
#define Act_MAX_OPTIONS_IN_MENU_PER_TAB 13
@ -339,10 +339,12 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActEdiRoo (ActRenHld + 40)
#define ActNewRoo (ActRenHld + 41)
#define ActRemRoo (ActRenHld + 42)
#define ActRenRooSho (ActRenHld + 43)
#define ActRenRooFul (ActRenHld + 44)
#define ActChgRooMaxUsr (ActRenHld + 45)
#define ActRenRooLoc (ActRenHld + 46)
#define ActChgRooBld (ActRenHld + 43)
#define ActChgRooFlo (ActRenHld + 44)
#define ActRenRooSho (ActRenHld + 45)
#define ActRenRooFul (ActRenHld + 46)
#define ActChgRooMaxUsr (ActRenHld + 47)
#define ActRenRooLoc (ActRenHld + 48)
/*****************************************************************************/
/********************************* Degree tab ********************************/

View File

@ -497,8 +497,8 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.186.1 (2020-04-14)"
#define CSS_FILE "swad19.146.css"
#define Log_PLATFORM_VERSION "SWAD 19.187 (2020-04-15)"
#define CSS_FILE "swad19.187.css"
#define JS_FILE "swad19.172.1.js"
/*
*
@ -548,6 +548,12 @@ 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.187: Apr 15, 2020 New columns in rooms for building and floor. Not finished. (287671 lines)
3 changes necessary in database:
ALTER TABLE rooms ADD COLUMN BldCod INT NOT NULL DEFAULT -1 AFTER CtrCod;
ALTER TABLE rooms ADD COLUMN Floor INT NOT NULL DEFAULT 0 AFTER BldCod;
ALTER TABLE rooms DROP INDEX CtrCod,ADD INDEX(CtrCod,BldCod,Floor);
Version 19.186.1: Apr 14, 2020 Fixed bug in edition of test questions. (287379 lines)
Version 19.186: Apr 14, 2020 New module swad_building for buildings in a centre. (287372 lines)
1 change necessary in database:

View File

@ -2359,22 +2359,26 @@ mysql> DESCRIBE rooms;
+-----------+---------------+------+-----+---------+----------------+
| RooCod | int(11) | NO | PRI | NULL | auto_increment |
| CtrCod | int(11) | NO | MUL | NULL | |
| BldCod | int(11) | NO | | -1 | |
| Floor | int(11) | NO | | 0 | |
| 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)
8 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS rooms ("
"RooCod INT NOT NULL AUTO_INCREMENT,"
"CtrCod INT NOT NULL,"
"BldCod INT NOT NULL DEFAULT -1,"
"Floor INT NOT NULL DEFAULT 0,"
"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))");
"INDEX(CtrCod,BldCod,Floor))");
/***** Table sessions *****/
/*

View File

@ -1486,7 +1486,7 @@ static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms)
unsigned NumGrpTyp;
unsigned NumTipGrpAux;
unsigned NumGrpThisType;
unsigned NumCla;
unsigned NumRoo;
struct GroupType *GrpTyp;
struct GroupType *GrpTypAux;
struct Group *Grp;
@ -1601,12 +1601,12 @@ static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms)
"%s",Txt_Another_room);
/* Options for rooms */
for (NumCla = 0;
NumCla < Rooms->Num;
NumCla++)
HTM_OPTION (HTM_Type_LONG,&Rooms->Lst[NumCla].RooCod,
Rooms->Lst[NumCla].RooCod == Grp->Room.RooCod,false,
"%s",Rooms->Lst[NumCla].ShrtName);
for (NumRoo = 0;
NumRoo < Rooms->Num;
NumRoo++)
HTM_OPTION (HTM_Type_LONG,&Rooms->Lst[NumRoo].RooCod,
Rooms->Lst[NumRoo].RooCod == Grp->Room.RooCod,false,
"%s",Rooms->Lst[NumRoo].ShrtName);
/* End selector */
HTM_SELECT_End ();
@ -2585,7 +2585,7 @@ static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms)
extern const char *Txt_Another_room;
extern const char *Txt_Create_group;
unsigned NumGrpTyp;
unsigned NumCla;
unsigned NumRoo;
Rol_Role_t Role;
char StrMaxStudents[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
@ -2657,12 +2657,12 @@ static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms)
"%s",Txt_Another_room);
/* Options for rooms */
for (NumCla = 0;
NumCla < Rooms->Num;
NumCla++)
HTM_OPTION (HTM_Type_LONG,&Rooms->Lst[NumCla].RooCod,
Rooms->Lst[NumCla].RooCod == Gbl.Crs.Grps.RooCod,false,
"%s",Rooms->Lst[NumCla].ShrtName);
for (NumRoo = 0;
NumRoo < Rooms->Num;
NumRoo++)
HTM_OPTION (HTM_Type_LONG,&Rooms->Lst[NumRoo].RooCod,
Rooms->Lst[NumRoo].RooCod == Gbl.Crs.Grps.RooCod,false,
"%s",Rooms->Lst[NumRoo].ShrtName);
/* End selector */
HTM_SELECT_End ();

View File

@ -3720,7 +3720,7 @@ static void Prj_PutFormProject (struct Prj_Projects *Projects,
HTM_TD_Begin ("class=\"LM\"");
HTM_INPUT_LONG ("NumStds",(long) 0,(long) UINT_MAX,(long) Prj->NumStds,false,
NULL);
NULL);
HTM_TD_End ();
HTM_TR_End ();

View File

@ -30,6 +30,7 @@
#include <string.h> // For string functions
#include "swad_box.h"
#include "swad_building.h"
#include "swad_database.h"
#include "swad_form.h"
#include "swad_global.h"
@ -68,7 +69,10 @@ 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_ListRoomsForEdition (const struct Bld_Buildings *Buildings,
const struct Roo_Rooms *Rooms);
static void Roo_PutSelectorBuilding (long BldCod,
const struct Bld_Buildings *Buildings);
static void Roo_PutParamRooCod (long RooCod);
static void Roo_RenameRoom (Cns_ShrtOrFullName_t ShrtOrFullName);
@ -77,7 +81,7 @@ static void Roo_UpdateRoomNameDB (long RooCod,const char *FieldName,const char *
static void Roo_WriteCapacity (char Str[Cns_MAX_DECIMAL_DIGITS_UINT + 1],unsigned Capacity);
static void Roo_PutFormToCreateRoom (void);
static void Roo_PutFormToCreateRoom (const struct Bld_Buildings *Buildings);
static void Roo_PutHeadRooms (void);
static void Roo_CreateRoom (struct Roo_Room *Room);
@ -261,12 +265,15 @@ static void Roo_EditRoomsInternal (void)
{
extern const char *Hlp_CENTRE_Rooms_edit;
extern const char *Txt_Rooms;
struct Bld_Buildings Buildings;
struct Roo_Rooms Rooms;
/***** Reset rooms context *****/
/***** Reset context *****/
Bld_ResetBuildings (&Buildings);
Roo_ResetRooms (&Rooms);
/***** Get list of rooms *****/
/***** Get lists of buildings and rooms *****/
Bld_GetListBuildings (&Buildings,Roo_ALL_DATA);
Roo_GetListRooms (&Rooms,Roo_ALL_DATA);
/***** Begin box *****/
@ -275,17 +282,18 @@ static void Roo_EditRoomsInternal (void)
Hlp_CENTRE_Rooms_edit,Box_NOT_CLOSABLE);
/***** Put a form to create a new room *****/
Roo_PutFormToCreateRoom ();
Roo_PutFormToCreateRoom (&Buildings);
/***** Forms to edit current rooms *****/
if (Rooms.Num)
Roo_ListRoomsForEdition (&Rooms);
Roo_ListRoomsForEdition (&Buildings,&Rooms);
/***** End box *****/
Box_BoxEnd ();
/***** Free list of rooms *****/
/***** Free lists of rooms and buildings *****/
Roo_FreeListRooms (&Rooms);
Bld_FreeListBuildings (&Buildings);
}
/*****************************************************************************/
@ -337,11 +345,13 @@ void Roo_GetListRooms (struct Roo_Rooms *Rooms,
{
case Roo_ALL_DATA:
NumRows = DB_QuerySELECT (&mysql_res,"can not get rooms",
"SELECT RooCod,"
"ShortName,"
"FullName,"
"Capacity,"
"Location"
"SELECT RooCod," // row[0]
"ShortName," // row[1]
"BldCod," // row[2]
"Floor," // row[3]
"FullName," // row[4]
"Capacity," // row[5]
"Location" // row[6]
" FROM rooms"
" WHERE CtrCod=%ld"
" ORDER BY %s",
@ -351,8 +361,8 @@ void Roo_GetListRooms (struct Roo_Rooms *Rooms,
case Roo_ONLY_SHRT_NAME:
default:
NumRows = DB_QuerySELECT (&mysql_res,"can not get rooms",
"SELECT RooCod,"
"ShortName"
"SELECT RooCod," // row[0]
"ShortName" // row[1]
" FROM rooms"
" WHERE CtrCod=%ld"
" ORDER BY ShortName",
@ -367,8 +377,8 @@ void Roo_GetListRooms (struct Roo_Rooms *Rooms,
/***** Create list with courses in centre *****/
if ((Rooms->Lst = (struct Roo_Room *)
calloc (NumRows,
sizeof (struct Roo_Room))) == NULL)
calloc (NumRows,
sizeof (struct Roo_Room))) == NULL)
Lay_NotEnoughMemoryExit ();
/***** Get the rooms *****/
@ -391,16 +401,22 @@ void Roo_GetListRooms (struct Roo_Rooms *Rooms,
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 building code (row[2]) */
Room->BldCod = Str_ConvertStrCodToLongCod (row[2]);
/* Get seating capacity in this room (row[3]) */
if (sscanf (row[3],"%u",&Room->Capacity) != 1)
Room->Capacity = Roo_UNLIMITED_CAPACITY;
/* Get floor (row[3]) */
Room->Floor = Str_ConvertStrCodToLongCod (row[3]);
/* Get the full name of the room (row[4]) */
Str_Copy (Room->Location,row[4],
Str_Copy (Room->FullName,row[4],
Roo_MAX_BYTES_FULL_NAME);
/* Get seating capacity in this room (row[5]) */
if (sscanf (row[5],"%u",&Room->Capacity) != 1)
Room->Capacity = Roo_UNLIMITED_CAPACITY;
/* Get the full name of the room (row[6]) */
Str_Copy (Room->Location,row[6],
Roo_MAX_BYTES_LOCATION);
}
}
@ -433,10 +449,12 @@ void Roo_GetDataOfRoomByCod (struct Roo_Room *Room)
{
/***** Get data of a room from database *****/
NumRows = DB_QuerySELECT (&mysql_res,"can not get data of a room",
"SELECT ShortName,"
"FullName,"
"Capacity,"
"Location"
"SELECT BldCod," // row[0]
"Floor," // row[1]
"ShortName," // row[2]
"FullName," // row[3]
"Capacity," // row[4]
"Location" // row[5]
" FROM rooms"
" WHERE RooCod=%ld",
Room->RooCod);
@ -447,20 +465,26 @@ void Roo_GetDataOfRoomByCod (struct Roo_Room *Room)
/* Get row */
row = mysql_fetch_row (mysql_res);
/* Get the short name of the room (row[0]) */
Str_Copy (Room->ShrtName,row[0],
/* Get building code (row[0]) */
Room->BldCod = Str_ConvertStrCodToLongCod (row[0]);
/* Get floor (row[1]) */
Room->Floor = Str_ConvertStrCodToLongCod (row[1]);
/* Get the short name of the room (row[2]) */
Str_Copy (Room->ShrtName,row[2],
Roo_MAX_BYTES_SHRT_NAME);
/* Get the full name of the room (row[1]) */
Str_Copy (Room->FullName,row[1],
/* Get the full name of the room (row[3]) */
Str_Copy (Room->FullName,row[3],
Roo_MAX_BYTES_FULL_NAME);
/* Get seating capacity in this room (row[2]) */
if (sscanf (row[2],"%u",&Room->Capacity) != 1)
/* Get seating capacity in this room (row[4]) */
if (sscanf (row[4],"%u",&Room->Capacity) != 1)
Room->Capacity = Roo_UNLIMITED_CAPACITY;
/* Get the location of the room (row[3]) */
Str_Copy (Room->Location,row[3],
/* Get the location of the room (row[5]) */
Str_Copy (Room->Location,row[5],
Roo_MAX_BYTES_LOCATION);
}
@ -488,7 +512,8 @@ void Roo_FreeListRooms (struct Roo_Rooms *Rooms)
/*************************** List all the rooms ******************************/
/*****************************************************************************/
static void Roo_ListRoomsForEdition (const struct Roo_Rooms *Rooms)
static void Roo_ListRoomsForEdition (const struct Bld_Buildings *Buildings,
const struct Roo_Rooms *Rooms)
{
unsigned NumRoom;
struct Roo_Room *Room;
@ -520,6 +545,23 @@ static void Roo_ListRoomsForEdition (const struct Roo_Rooms *Rooms)
HTM_Long (Room->RooCod);
HTM_TD_End ();
/* Building */
HTM_TD_Begin ("class=\"CM\"");
Frm_StartForm (ActChgRooBld);
Roo_PutParamRooCod (Room->RooCod);
Roo_PutSelectorBuilding (Room->BldCod,Buildings);
Frm_EndForm ();
HTM_TD_End ();
/* Floor */
HTM_TD_Begin ("class=\"LM\"");
Frm_StartForm (ActChgRooFlo);
Roo_PutParamRooCod (Room->RooCod);
HTM_INPUT_LONG ("Floor",(long) INT_MIN,(long) INT_MAX,(long) Room->Floor,false,
"class=\"INPUT_LONG\"");
Frm_EndForm ();
HTM_TD_End ();
/* Room short name */
HTM_TD_Begin ("class=\"LM\"");
Frm_StartForm (ActRenRooSho);
@ -564,6 +606,43 @@ static void Roo_ListRoomsForEdition (const struct Roo_Rooms *Rooms)
HTM_TABLE_End ();
}
/*****************************************************************************/
/**************************** Put building selector **************************/
/*****************************************************************************/
static void Roo_PutSelectorBuilding (long BldCod,
const struct Bld_Buildings *Buildings)
{
extern const char *Txt_No_assigned_building;
extern const char *Txt_Another_building;
unsigned NumBld;
/***** Begin selector *****/
HTM_SELECT_Begin (true,
"name=\"BldCod\" class=\"BLD_SEL\"");
/***** Option for no assigned building *****/
HTM_OPTION (HTM_Type_STRING,"-1",
BldCod < 0,false,
"%s",Txt_No_assigned_building);
/***** Option for another room *****/
HTM_OPTION (HTM_Type_STRING,"0",
BldCod == 0,false,
"%s",Txt_Another_building);
/***** Options for buildings *****/
for (NumBld = 0;
NumBld < Buildings->Num;
NumBld++)
HTM_OPTION (HTM_Type_LONG,&Buildings->Lst[NumBld].BldCod,
Buildings->Lst[NumBld].BldCod == BldCod,false,
"%s",Buildings->Lst[NumBld].ShrtName);
/***** End selector *****/
HTM_SELECT_End ();
}
/*****************************************************************************/
/********************* Write parameter with code of room *********************/
/*****************************************************************************/
@ -631,6 +710,101 @@ void Roo_RemoveAllRoomsInCtr (long CtrCod)
CtrCod);
}
/*****************************************************************************/
/********************* Change sitting capacity of a room *********************/
/*****************************************************************************/
void Roo_ChangeBuilding (void)
{
extern const char *Txt_The_capacity_of_room_X_has_not_changed;
extern const char *Txt_The_capacity_of_room_X_is_now_Y;
long NewBldCod;
/***** 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 building of the room */
NewBldCod = Par_GetParToLong ("BldCod");
/***** 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 (NewBldCod < 0)
NewBldCod = -1L;
if (NewBldCod == Roo_EditingRoom->BldCod)
/***** Message to show no changes made *****/
Ale_CreateAlert (Ale_INFO,NULL,
Txt_The_capacity_of_room_X_has_not_changed, // TODO: Change
Roo_EditingRoom->FullName);
else
{
/***** Update the table of rooms changing the old building to the new *****/
DB_QueryUPDATE ("can not update the capacity of a room",
"UPDATE rooms SET BldCod=%ld WHERE RooCod=%ld",
NewBldCod,Roo_EditingRoom->RooCod);
Roo_EditingRoom->BldCod = NewBldCod;
/***** Message to show the change made *****/
Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_capacity_of_room_X_is_now_Y, // TODO: Change
Roo_EditingRoom->FullName,0);
}
}
/*****************************************************************************/
/********************* Change sitting capacity of a room *********************/
/*****************************************************************************/
void Roo_ChangeFloor (void)
{
extern const char *Txt_The_capacity_of_room_X_has_not_changed;
extern const char *Txt_The_capacity_of_room_X_is_now_Y;
int NewFloor;
/***** 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 floor of the room */
NewFloor = Par_GetParToLong ("Floor");
/***** 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 (NewFloor == Roo_EditingRoom->Floor)
/***** Message to show no changes made *****/
Ale_CreateAlert (Ale_INFO,NULL,
Txt_The_capacity_of_room_X_has_not_changed, // TODO: Change
Roo_EditingRoom->FullName);
else
{
/***** Update the table of rooms changing the old capacity to the new *****/
DB_QueryUPDATE ("can not update the capacity of a room",
"UPDATE rooms SET Floor=%d WHERE RooCod=%ld",
NewFloor,Roo_EditingRoom->RooCod);
Roo_EditingRoom->Floor = NewFloor;
/***** Message to show the change made *****/
Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_capacity_of_room_X_is_now_Y, // TODO: Change
Roo_EditingRoom->FullName,0);
}
}
/*****************************************************************************/
/********************** Change the short name of a room **********************/
/*****************************************************************************/
@ -794,14 +968,14 @@ void Roo_ChangeCapacity (void)
/***** Check if the old capacity equals the new one
(this happens when return is pressed without changes) *****/
if (Roo_EditingRoom->Capacity == NewCapacity)
if (NewCapacity == Roo_EditingRoom->Capacity)
/***** 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 *****/
/***** Update the table of rooms 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);
@ -859,7 +1033,7 @@ void Roo_ChangeRoomLocation (void)
/***** 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
if (strcmp (NewLocation,Roo_EditingRoom->Location)) // Different locations
{
/* Update the table changing old name by new name */
Roo_UpdateRoomNameDB (Roo_EditingRoom->RooCod,"Location",NewLocation);
@ -897,7 +1071,7 @@ void Roo_ContEditAfterChgRoom (void)
/********************** Put a form to create a new room **********************/
/*****************************************************************************/
static void Roo_PutFormToCreateRoom (void)
static void Roo_PutFormToCreateRoom (const struct Bld_Buildings *Buildings)
{
extern const char *Txt_New_room;
extern const char *Txt_Create_room;
@ -924,6 +1098,17 @@ static void Roo_PutFormToCreateRoom (void)
HTM_TD_Begin ("class=\"CODE\"");
HTM_TD_End ();
/***** Building *****/
HTM_TD_Begin ("class=\"LM\"");
Roo_PutSelectorBuilding (Roo_EditingRoom->BldCod,Buildings);
HTM_TD_End ();
/***** Floor *****/
HTM_TD_Begin ("class=\"LM\"");
HTM_INPUT_LONG ("Floor",(long) INT_MIN,(long) INT_MAX,(long) Roo_EditingRoom->Floor,false,
"class=\"INPUT_LONG\"");
HTM_TD_End ();
/***** Room short name *****/
HTM_TD_Begin ("class=\"LM\"");
HTM_INPUT_TEXT ("ShortName",Roo_MAX_CHARS_SHRT_NAME,Roo_EditingRoom->ShrtName,false,
@ -965,6 +1150,8 @@ static void Roo_PutFormToCreateRoom (void)
static void Roo_PutHeadRooms (void)
{
extern const char *Txt_Code;
extern const char *Txt_Building;
extern const char *Txt_Floor;
extern const char *Txt_Short_name;
extern const char *Txt_Full_name;
extern const char *Txt_Capacity_OF_A_ROOM;
@ -974,6 +1161,8 @@ static void Roo_PutHeadRooms (void)
HTM_TH (1,1,"BM",NULL);
HTM_TH (1,1,"RM",Txt_Code);
HTM_TH (1,1,"LM",Txt_Building);
HTM_TH (1,1,"LM",Txt_Floor);
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);
@ -1069,7 +1258,9 @@ static void Roo_EditingRoomConstructor (void)
/***** Reset room *****/
Roo_EditingRoom->RooCod = -1L;
Roo_EditingRoom->InsCod = -1L;
Roo_EditingRoom->CtrCod = -1L;
Roo_EditingRoom->BldCod = -1L;
Roo_EditingRoom->Floor = 0;
Roo_EditingRoom->ShrtName[0] = '\0';
Roo_EditingRoom->FullName[0] = '\0';
Roo_EditingRoom->Capacity = Roo_UNLIMITED_CAPACITY;

View File

@ -49,7 +49,9 @@
struct Roo_Room
{
long RooCod;
long InsCod;
long CtrCod;
long BldCod;
int Floor;
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)
@ -100,6 +102,8 @@ long Roo_GetParamRooCod (void);
void Roo_RemoveRoom (void);
void Roo_RemoveAllRoomsInCtr (long CtrCod);
void Roo_ChangeBuilding (void);
void Roo_ChangeFloor (void);
void Roo_RenameRoomShort (void);
void Roo_RenameRoomFull (void);
void Roo_ChangeCapacity (void);

View File

@ -1633,6 +1633,27 @@ const char *Txt_Announcements_of_exams =
"Chamadas para exames";
#endif
const char *Txt_Another_building = // TODO: Translate
#if L==1 // ca
"Una altra sala";
#elif L==2 // de
"Eine weitere Raum";
#elif L==3 // en
"Another room";
#elif L==4 // es
"Otra sala";
#elif L==5 // fr
"Un autre salle";
#elif L==6 // gn
"Otra sala"; // Okoteve traducción
#elif L==7 // it
"Un'altra aula";
#elif L==8 // pl
"Kolejna klasa";
#elif L==9 // pt
"Outra sala";
#endif
const char *Txt_Another_centre =
#if L==1 // ca
"Un altre centre";
@ -12613,6 +12634,27 @@ const char *Txt_First_name =
"Nome";
#endif
const char *Txt_Floor =
#if L==1 // ca
"Planta";
#elif L==2 // de
"Stock";
#elif L==3 // en
"Floor";
#elif L==4 // es
"Planta";
#elif L==5 // fr
"&Eacute;tage";
#elif L==6 // gn
"Planta"; // Okoteve traducción
#elif L==7 // it
"Piano";
#elif L==8 // pl
"Pi&eogon;trze";
#elif L==9 // pt
"Andar";
#endif
const char *Txt_Folder =
#if L==1 // ca
"Carpeta";
@ -25302,6 +25344,27 @@ const char *Txt_No_announcements_of_exams_of_X = // Warning: it is very importan
"N&atilde;o chamadas para exame de <strong>%s</strong>.";
#endif
const char *Txt_No_assigned_building = // TODO: Translate
#if L==1 // ca
"Sense sala assignada";
#elif L==2 // de
"Kein zugewiesenes Raum";
#elif L==3 // en
"No assigned room";
#elif L==4 // es
"Sin sala asignada";
#elif L==5 // fr
"Aucune salle assign&eacute;e";
#elif L==6 // gn
"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 atribu&iacute;da";
#endif
const char *Txt_No_assigned_room =
#if L==1 // ca
"Sense sala assignada";

View File

@ -4407,6 +4407,48 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
"" // Potrzebujesz tlumaczenie
#elif L==9 // pt
"" // Precisa de tradução
#endif
,
[ActChgRooBld] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"Change building of a room"
#elif L==4 // es
"Cambiar edificio de una sala"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
"" // Okoteve traducción
#elif L==7 // it
"" // Bisogno di traduzione
#elif L==8 // pl
"" // Potrzebujesz tlumaczenie
#elif L==9 // pt
"" // Precisa de tradução
#endif
,
[ActChgRooMaxUsr] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"Change number of users of a room"
#elif L==4 // es
"Cambiar n&uacute;mero de usuarios de una sala"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
"" // Okoteve traducción
#elif L==7 // it
"" // Bisogno di traduzione
#elif L==8 // pl
"" // Potrzebujesz tlumaczenie
#elif L==9 // pt
"" // Precisa de tradução
#endif
,
[ActRenRooSho] =
@ -4451,15 +4493,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
"" // Precisa de tradução
#endif
,
[ActChgRooMaxUsr] =
[ActChgRooFlo] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"Change number of usuarios in a room"
"Change floor of a room"
#elif L==4 // es
"Cambiar n&uacute;mero de usuarios de una sala"
"Cambiar planta de una sala"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn