Version 18.28

This commit is contained in:
Antonio Cañas Vargas 2019-01-07 17:00:04 +01:00
parent 82c559128e
commit f32368c9ae
10 changed files with 183 additions and 139 deletions

View File

@ -12591,3 +12591,21 @@ OPTIMIZE TABLE usr_webs;
SHOW TABLE STATUS WHERE Name = 'ws_keys';
ALTER TABLE ws_keys ENGINE=MyISAM;
OPTIMIZE TABLE ws_keys;
SELECT Weekday,TIME_TO_SEC(StartTime) AS S,TIME_TO_SEC(Duration) AS D,Place,ClassType,GrpCod FROM timetable_crs WHERE CrsCod=19 ORDER BY Weekday,S,ClassType,GrpCod,Place,D DESC;

View File

@ -1160,8 +1160,7 @@ CREATE TABLE IF NOT EXISTS timetable_crs (
StartTime TIME NOT NULL,
Duration TIME NOT NULL,
ClassType ENUM('free','lecture','practical') NOT NULL,
Place VARCHAR(511) NOT NULL,
GroupName VARCHAR(2047) NOT NULL,
Info VARCHAR(2047) NOT NULL DEFAULT '',
INDEX(CrsCod,GrpCod));
--
-- Table timetable_tut: stores the timetables of office hours of the teachers
@ -1171,7 +1170,7 @@ CREATE TABLE IF NOT EXISTS timetable_tut (
Weekday TINYINT NOT NULL,
StartTime TIME NOT NULL,
Duration TIME NOT NULL,
Place VARCHAR(511) NOT NULL,
Info VARCHAR(2047) NOT NULL DEFAULT '',
INDEX(UsrCod));
--
-- Table tst_answers: stores the answers to the questions in tests

View File

@ -345,9 +345,6 @@ Buenos d
// TODO: Al crear un evento de asistencia, podría tener por defecto el aula asignada al grupo elegido.
// TODO: En la edición del horario de clases, tomar las aulas de la tabla classrooms.
// El actual campo Place puede dejarse sin cambiar en la base de datos y usarse para otras aclaraciones (renombrándolo simplemente).
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
@ -367,10 +364,22 @@ En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 18.27.11 (2019-01-07)"
#define Log_PLATFORM_VERSION "SWAD 18.28 (2019-01-07)"
#define CSS_FILE "swad18.22.css"
#define JS_FILE "swad17.17.1.js"
/*
Version 18.28: Jan 07, 2019 Changes in edition of timetable related to classrooms. (239208 lines)
9 changes necessary in database:
ALTER TABLE timetable_crs CHANGE COLUMN GroupName GroupName VARCHAR(2047) NOT NULL DEFAULT '';
ALTER TABLE timetable_crs ADD COLUMN Info VARCHAR(2047) NOT NULL DEFAULT '' AFTER ClassType;
ALTER TABLE timetable_tut ADD COLUMN Info VARCHAR(2047) NOT NULL DEFAULT '' AFTER Duration;
UPDATE timetable_crs SET Info=Place WHERE Place<>'' AND GroupName='';
UPDATE timetable_crs SET Info=GroupName WHERE Place='' AND GroupName<>'';
UPDATE timetable_crs SET Info=CONCAT(Place,', ',GroupName) WHERE Place<>'' AND GroupName<>'';
UPDATE timetable_tut SET Info=Place WHERE Place<>'';
ALTER TABLE timetable_crs DROP COLUMN Place,DROP COLUMN GroupName;
ALTER TABLE timetable_tut DROP COLUMN Place;
Version 18.27.11: Jan 07, 2019 Changes in edition of timetable related to classrooms. (239185 lines)
Version 18.27.10: Jan 05, 2019 Remove all classrooms in a centre when it is removed. (239151 lines)
Version 18.27.9: Jan 05, 2019 When a classroom is removed, if it is assigned to groups, remove the association in groups. (239136 lines)

View File

@ -2461,10 +2461,9 @@ mysql> DESCRIBE timetable_crs;
| StartTime | time | NO | | NULL | |
| Duration | time | NO | | NULL | |
| ClassType | enum('free','lecture','practical') | NO | | NULL | |
| Place | varchar(511) | NO | | NULL | |
| GroupName | varchar(2047) | NO | | NULL | |
| Info | varchar(2047) | NO | | | |
+-----------+------------------------------------+------+-----+---------+-------+
8 rows in set (0,00 sec)
7 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS timetable_crs ("
"CrsCod INT NOT NULL DEFAULT -1,"
@ -2473,30 +2472,29 @@ mysql> DESCRIBE timetable_crs;
"StartTime TIME NOT NULL,"
"Duration TIME NOT NULL,"
"ClassType ENUM('free','lecture','practical') NOT NULL,"
"Place VARCHAR(511) NOT NULL," // TT_MAX_BYTES_PLACE
"GroupName VARCHAR(2047) NOT NULL," // Grp_MAX_BYTES_GROUP_NAME
"Info VARCHAR(2047) NOT NULL DEFAULT ''," // TT_MAX_BYTES_INFO
"INDEX(CrsCod,GrpCod))");
/***** Table timetable_tut *****/
/*
mysql> DESCRIBE timetable_tut;
+-----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+-------+
| UsrCod | int(11) | NO | MUL | NULL | |
| Weekday | tinyint(4) | NO | | NULL | |
| StartTime | time | NO | | NULL | |
| Duration | time | NO | | NULL | |
| Place | varchar(511) | NO | | NULL | |
+-----------+--------------+------+-----+---------+-------+
5 rows in set (0,00 sec)
+-----------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------------+------+-----+---------+-------+
| UsrCod | int(11) | NO | MUL | NULL | |
| Weekday | tinyint(4) | NO | | NULL | |
| StartTime | time | NO | | NULL | |
| Duration | time | NO | | NULL | |
| Info | varchar(2047) | NO | | | |
+-----------+---------------+------+-----+---------+-------+
5 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS timetable_tut ("
"UsrCod INT NOT NULL,"
"Weekday TINYINT NOT NULL," // 0=Monday...6=Sunday
"StartTime TIME NOT NULL,"
"Duration TIME NOT NULL,"
"Place VARCHAR(511) NOT NULL," // TT_MAX_BYTES_PLACE
"Info VARCHAR(2047) NOT NULL DEFAULT ''," // TT_MAX_BYTES_INFO
"INDEX(UsrCod))");
/***** Table tst_answers *****/

View File

@ -668,8 +668,8 @@ struct Globals
unsigned Column;
TT_ClassType_t ClassType;
unsigned DurationIntervals;
char Place[TT_MAX_BYTES_PLACE + 1];
char Group[Grp_MAX_BYTES_GROUP_NAME + 1];
char Info[TT_MAX_BYTES_INFO + 1];
// char Place[TT_MAX_BYTES_PLACE + 1];
long GrpCod; // Group code (-1 if no group selected)
struct
{

View File

@ -965,8 +965,12 @@ void Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
static void Grp_LockTables (void)
{
DB_Query ("can not lock tables to change user's groups",
"LOCK TABLES crs_grp_types WRITE,crs_grp WRITE,"
"crs_grp_usr WRITE,crs_usr READ");
"LOCK TABLES "
"crs_grp_types WRITE,"
"crs_grp WRITE,"
"crs_grp_usr WRITE,"
"crs_usr READ,"
"classrooms READ");
Gbl.DB.LockedTables = true;
}
@ -3128,7 +3132,8 @@ unsigned long Grp_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res)
"crs_grp.MaxStudents,"
"crs_grp.Open,"
"crs_grp.FileZones"
" FROM crs_grp LEFT JOIN classrooms"
" FROM crs_grp"
" LEFT JOIN classrooms"
" ON crs_grp.ClaCod=classrooms.ClaCod"
" WHERE crs_grp.GrpTypCod=%ld"
" ORDER BY crs_grp.GrpName",
@ -3213,31 +3218,35 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
unsigned long NumRows;
/***** Reset values *****/
GrpDat->GrpTypCod = -1L;
GrpDat->CrsCod = -1L;
GrpDat->GrpTypName[0] = '\0';
GrpDat->GrpName[0] = '\0';
GrpDat->ClaCod = -1L;
GrpDat->MaxStudents = 0;
GrpDat->Vacant = 0;
GrpDat->Open = false;
GrpDat->FileZones = false;
GrpDat->MultipleEnrolment = false;
GrpDat->GrpTypCod = -1L;
GrpDat->CrsCod = -1L;
GrpDat->GrpTypName[0] = '\0';
GrpDat->GrpName[0] = '\0';
GrpDat->Classroom.ClaCod = -1L;
GrpDat->Classroom.ShrtName[0] = '\0';
GrpDat->MaxStudents = 0;
GrpDat->Vacant = 0;
GrpDat->Open = false;
GrpDat->FileZones = false;
GrpDat->MultipleEnrolment = false;
if (GrpDat->GrpCod > 0)
{
/***** Get data of a group from database *****/
NumRows = DB_QuerySELECT (&mysql_res,"can not get data of a group",
"SELECT crs_grp_types.GrpTypCod,"
"SELECT crs_grp.GrpTypCod,"
"crs_grp_types.CrsCod,"
"crs_grp_types.GrpTypName,"
"crs_grp_types.Multiple,"
"crs_grp.GrpName,"
"crs_grp.ClaCod,"
"classrooms.ShortName,"
"crs_grp.MaxStudents,"
"crs_grp.Open,"
"crs_grp.FileZones"
" FROM crs_grp,crs_grp_types"
" FROM (crs_grp,crs_grp_types)"
" LEFT JOIN classrooms"
" ON crs_grp.ClaCod=classrooms.ClaCod"
" WHERE crs_grp.GrpCod=%ld"
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod",
GrpDat->GrpCod);
@ -3267,16 +3276,20 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
Grp_MAX_BYTES_GROUP_NAME);
/* Get the code of the course (row[5]) */
GrpDat->ClaCod = Str_ConvertStrCodToLongCod (row[5]);
GrpDat->Classroom.ClaCod = Str_ConvertStrCodToLongCod (row[5]);
/* Get maximum number of students (row[6]) */
GrpDat->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[6]);
/* Get the name of the classroom (row[6]) */
Str_Copy (GrpDat->Classroom.ShrtName,row[6],
Grp_MAX_BYTES_GROUP_NAME);
/* Get whether group is open or closed (row[7]) */
GrpDat->Open = (row[7][0] == 'Y');
/* Get maximum number of students (row[7]) */
GrpDat->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[7]);
/* Get whether group has file zones (row[8]) */
GrpDat->FileZones = (row[8][0] == 'Y');
/* Get whether group is open or closed (row[8]) */
GrpDat->Open = (row[8][0] == 'Y');
/* Get whether group has file zones (row[9]) */
GrpDat->FileZones = (row[9][0] == 'Y');
}
/***** Free structure that stores the query result *****/

View File

@ -63,7 +63,11 @@ struct GroupData
long CrsCod; // Course code
char GrpTypName[Grp_MAX_BYTES_GROUP_TYPE_NAME + 1];
char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1];
long ClaCod; // Classroom code
struct
{
long ClaCod; // Classroom code
char ShrtName[Cla_MAX_BYTES_SHRT_NAME + 1]; // Classroom short name
} Classroom;
unsigned MaxStudents;
int Vacant;
bool Open; // Group is open?

View File

@ -15357,6 +15357,27 @@ const char *Txt_Indicators_of_courses =
"Indicadores de disciplinas";
#endif
const char *Txt_Info =
#if L==1 // ca
"Info";
#elif L==2 // de
"Info";
#elif L==3 // en
"Info";
#elif L==4 // es
"Info";
#elif L==5 // fr
"Info";
#elif L==6 // gn
"Info"; // Okoteve traducción
#elif L==7 // it
"Informazione";
#elif L==8 // pl
"Info";
#elif L==9 // pt
"Info";
#endif
const char *Txt_INFO_TITLE[Inf_NUM_INFO_TYPES] =
{
// Inf_INTRODUCTION

View File

@ -85,8 +85,8 @@ struct TT_Column
TT_IntervalType_t IntervalType;
TT_ClassType_t ClassType;
unsigned DurationIntervals;
char Place[TT_MAX_BYTES_PLACE + 1];
char Group[Grp_MAX_BYTES_GROUP_NAME + 1];
char Info[TT_MAX_BYTES_INFO + 1];
// char Place[TT_MAX_BYTES_PLACE + 1];
};
struct TT_Cell
@ -151,7 +151,7 @@ static unsigned TT_CalculateColsToDrawInCell (bool TopCall,
static void TT_DrawCellAlignTimeTable (void);
static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Column,unsigned ColSpan,
long CrsCod,TT_IntervalType_t IntervalType,TT_ClassType_t ClassType,
unsigned DurationNumIntervals,char *Group,long GrpCod,char *Place);
unsigned DurationNumIntervals,long GrpCod,const char *Info);
/*****************************************************************************/
/******************** Create internal timetable in memory ********************/
@ -296,8 +296,8 @@ static void TT_GetParamsTimeTable (void)
/***** Get group code *****/
Gbl.TimeTable.GrpCod = Par_GetParToLong ("TTGrp");
/***** Get place *****/
Par_GetParToText ("TTPlc",Gbl.TimeTable.Place,TT_MAX_BYTES_PLACE);
/***** Get info *****/
Par_GetParToText ("TTInf",Gbl.TimeTable.Info,TT_MAX_BYTES_INFO);
}
/*****************************************************************************/
@ -588,10 +588,10 @@ static void TT_WriteCrsTimeTableIntoDB (long CrsCod)
DB_QueryINSERT ("can not create course timetable",
"INSERT INTO timetable_crs"
" (CrsCod,GrpCod,Weekday,StartTime,Duration,"
"ClassType,Place,GroupName)"
"ClassType,Info)"
" VALUES"
" (%ld,%ld,%u,'%02u:%02u:00',SEC_TO_TIME(%u),"
"'%s','%s','%s')",
"'%s','%s')",
CrsCod,
TT_TimeTable[Weekday][Interval].Columns[Column].GrpCod,
Weekday,
@ -599,8 +599,7 @@ static void TT_WriteCrsTimeTableIntoDB (long CrsCod)
TT_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals *
Gbl.TimeTable.Config.SecondsPerInterval,
TT_ClassTypeDB[TT_TimeTable[Weekday][Interval].Columns[Column].ClassType],
TT_TimeTable[Weekday][Interval].Columns[Column].Place,
TT_TimeTable[Weekday][Interval].Columns[Column].Group);
TT_TimeTable[Weekday][Interval].Columns[Column].Info);
}
/*****************************************************************************/
@ -636,7 +635,7 @@ static void TT_WriteTutTimeTableIntoDB (long UsrCod)
TT_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals)
DB_QueryINSERT ("can not create office timetable",
"INSERT INTO timetable_tut"
" (UsrCod,Weekday,StartTime,Duration,Place)"
" (UsrCod,Weekday,StartTime,Duration,Info)"
" VALUES"
" (%ld,%u,'%02u:%02u:00',SEC_TO_TIME(%u),'%s')",
UsrCod,
@ -644,7 +643,7 @@ static void TT_WriteTutTimeTableIntoDB (long UsrCod)
Hour,Min,
TT_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals *
Gbl.TimeTable.Config.SecondsPerInterval,
TT_TimeTable[Weekday][Interval].Columns[Column].Place);
TT_TimeTable[Weekday][Interval].Columns[Column].Info);
}
/*****************************************************************************/
@ -668,7 +667,6 @@ static void TT_FillTimeTableFromDB (long UsrCod)
unsigned EndTimeSeconds;
struct TT_Range RangeCell;
unsigned FirstFreeColumn;
long GrpCod;
TT_ClassType_t ClassType = TT_FREE; // Initialized to avoid warning
bool TimeTableIsIncomplete = false;
bool TimeTableHasSpaceForThisClass;
@ -685,9 +683,8 @@ static void TT_FillTimeTableFromDB (long UsrCod)
"SELECT timetable_crs.Weekday,"
"TIME_TO_SEC(timetable_crs.StartTime) AS S,"
"TIME_TO_SEC(timetable_crs.Duration) AS D,"
"timetable_crs.Place,"
"timetable_crs.Info,"
"timetable_crs.ClassType,"
"timetable_crs.GroupName,"
"timetable_crs.GrpCod,"
"timetable_crs.CrsCod"
" FROM timetable_crs,crs_usr"
@ -698,9 +695,8 @@ static void TT_FillTimeTableFromDB (long UsrCod)
"SELECT timetable_crs.Weekday,"
"TIME_TO_SEC(timetable_crs.StartTime) AS S,"
"TIME_TO_SEC(timetable_crs.Duration) AS D,"
"timetable_crs.Place,"
"timetable_crs.Info,"
"timetable_crs.ClassType,"
"timetable_crs.GroupName,"
"timetable_crs.GrpCod,"
"timetable_crs.CrsCod"
" FROM timetable_crs,crs_grp_usr"
@ -710,15 +706,14 @@ static void TT_FillTimeTableFromDB (long UsrCod)
"SELECT Weekday,"
"TIME_TO_SEC(StartTime) AS S,"
"TIME_TO_SEC(Duration) AS D,"
"Place,"
"Info,"
"'tutoring' AS ClassType,"
"'' AS GroupName,"
"-1 AS GrpCod,"
"-1 AS CrsCod"
" FROM timetable_tut"
" WHERE UsrCod=%ld"
" ORDER BY Weekday,S,ClassType,"
"GroupName,GrpCod,Place,D DESC,CrsCod",
"GrpCod,Info,D DESC,CrsCod",
UsrCod,UsrCod,UsrCod);
break;
case Grp_ALL_GROUPS:
@ -726,9 +721,8 @@ static void TT_FillTimeTableFromDB (long UsrCod)
"SELECT timetable_crs.Weekday,"
"TIME_TO_SEC(timetable_crs.StartTime) AS S,"
"TIME_TO_SEC(timetable_crs.Duration) AS D,"
"timetable_crs.Place,"
"timetable_crs.Info,"
"timetable_crs.ClassType,"
"timetable_crs.GroupName,"
"timetable_crs.GrpCod,"
"timetable_crs.CrsCod"
" FROM timetable_crs,crs_usr"
@ -738,15 +732,14 @@ static void TT_FillTimeTableFromDB (long UsrCod)
"SELECT Weekday,"
"TIME_TO_SEC(StartTime) AS S,"
"TIME_TO_SEC(Duration) AS D,"
"Place,"
"Info,"
"'tutoring' AS ClassType,"
"'' AS GroupName,"
"-1 AS GrpCod,"
"-1 AS CrsCod"
" FROM timetable_tut"
" WHERE UsrCod=%ld"
" ORDER BY Weekday,S,ClassType,"
"GroupName,GrpCod,Place,D DESC,CrsCod",
"GrpCod,Info,D DESC,CrsCod",
UsrCod,UsrCod);
break;
}
@ -759,23 +752,21 @@ static void TT_FillTimeTableFromDB (long UsrCod)
"SELECT Weekday,"
"TIME_TO_SEC(StartTime) AS S,"
"TIME_TO_SEC(Duration) AS D,"
"Place,"
"Info,"
"ClassType,"
"GroupName,"
"GrpCod"
" FROM timetable_crs"
" WHERE CrsCod=%ld"
" ORDER BY Weekday,S,ClassType,"
"GroupName,GrpCod,Place,D DESC",
"GrpCod,Info,D DESC",
Gbl.CurrentCrs.Crs.CrsCod);
else
NumRows = DB_QuerySELECT (&mysql_res,"can not get timetable",
"SELECT timetable_crs.Weekday,"
"TIME_TO_SEC(timetable_crs.StartTime) AS S,"
"TIME_TO_SEC(timetable_crs.Duration) AS D,"
"timetable_crs.Place,"
"timetable_crs.Info,"
"timetable_crs.ClassType,"
"timetable_crs.GroupName,"
"timetable_crs.GrpCod"
" FROM timetable_crs,crs_usr"
" WHERE timetable_crs.CrsCod=%ld"
@ -785,16 +776,15 @@ static void TT_FillTimeTableFromDB (long UsrCod)
"SELECT timetable_crs.Weekday,"
"TIME_TO_SEC(timetable_crs.StartTime) AS S,"
"TIME_TO_SEC(timetable_crs.Duration) AS D,"
"timetable_crs.Place,"
"timetable_crs.Info,"
"timetable_crs.ClassType,"
"timetable_crs.GroupName,"
"timetable_crs.GrpCod"
" FROM timetable_crs,crs_grp_usr"
" WHERE timetable_crs.CrsCod=%ld"
" AND crs_grp_usr.UsrCod=%ld"
" AND timetable_crs.GrpCod=crs_grp_usr.GrpCod"
" ORDER BY Weekday,S,ClassType,"
"GroupName,GrpCod,Place,D DESC",
"GrpCod,Info,D DESC",
Gbl.CurrentCrs.Crs.CrsCod,UsrCod,
Gbl.CurrentCrs.Crs.CrsCod,UsrCod);
break;
@ -803,10 +793,10 @@ static void TT_FillTimeTableFromDB (long UsrCod)
"SELECT Weekday,"
"TIME_TO_SEC(StartTime) AS S,"
"TIME_TO_SEC(Duration) AS D,"
"Place"
"Info"
" FROM timetable_tut"
" WHERE UsrCod=%ld"
" ORDER BY Weekday,S,Place,D DESC",
" ORDER BY Weekday,S,Info,D DESC",
UsrCod);
break;
}
@ -873,8 +863,7 @@ static void TT_FillTimeTableFromDB (long UsrCod)
TT_TimeTable[Weekday][Interval].Columns[Column].IntervalType = TT_FREE_INTERVAL;
TT_TimeTable[Weekday][Interval].Columns[Column].ClassType = TT_FREE;
TT_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals = 0;
TT_TimeTable[Weekday][Interval].Columns[Column].Group[0] = '\0';
TT_TimeTable[Weekday][Interval].Columns[Column].Place[0] = '\0';
TT_TimeTable[Weekday][Interval].Columns[Column].Info[0] = '\0';
}
}
@ -885,12 +874,6 @@ static void TT_FillTimeTableFromDB (long UsrCod)
{
row = mysql_fetch_row (mysql_res);
if (Gbl.TimeTable.Type == TT_MY_TIMETABLE ||
Gbl.TimeTable.Type == TT_COURSE_TIMETABLE)
/* Group code */
if (sscanf (row[6],"%ld",&GrpCod) != 1)
GrpCod = -1;
/* Day of week (row[0]) */
if (sscanf (row[0],"%u",&Weekday) != 1)
Lay_ShowErrorAndExit ("Wrong day of week in timetable.");
@ -979,24 +962,27 @@ static void TT_FillTimeTableFromDB (long UsrCod)
TT_TimeTable[Weekday][i].NumColumns++;
}
/* Course (row[7]), group (row[5]) and place (row[3])*/
/* Course (row[6]) and info (row[3])*/
switch (Gbl.TimeTable.Type)
{
case TT_MY_TIMETABLE:
case TT_COURSE_TIMETABLE:
/* Group code (row[5]) */
if (Gbl.TimeTable.Type == TT_MY_TIMETABLE ||
Gbl.TimeTable.Type == TT_COURSE_TIMETABLE)
if (sscanf (row[5],"%ld",&TT_TimeTable[Weekday][Interval].Columns[FirstFreeColumn].GrpCod) != 1)
TT_TimeTable[Weekday][Interval].Columns[FirstFreeColumn].GrpCod = -1;
/* Course code (row[6]) */
TT_TimeTable[Weekday][Interval].Columns[FirstFreeColumn].CrsCod =
(Gbl.TimeTable.Type == TT_MY_TIMETABLE ? Str_ConvertStrCodToLongCod (row[7]) :
(Gbl.TimeTable.Type == TT_MY_TIMETABLE ? Str_ConvertStrCodToLongCod (row[6]) :
Gbl.CurrentCrs.Crs.CrsCod);
Str_Copy (TT_TimeTable[Weekday][Interval].Columns[FirstFreeColumn].Group,
row[5],
Grp_MAX_BYTES_GROUP_NAME);
TT_TimeTable[Weekday][Interval].Columns[FirstFreeColumn].GrpCod = GrpCod;
/* falls through */
/* no break */
case TT_TUTORING_TIMETABLE:
Str_Copy (TT_TimeTable[Weekday][Interval].Columns[FirstFreeColumn].Place,
Str_Copy (TT_TimeTable[Weekday][Interval].Columns[FirstFreeColumn].Info,
row[3],
TT_MAX_BYTES_PLACE);
TT_MAX_BYTES_INFO);
break;
}
@ -1098,8 +1084,7 @@ static void TT_ModifTimeTable (void)
TT_TimeTable[Gbl.TimeTable.Weekday][Gbl.TimeTable.Interval].Columns[Gbl.TimeTable.Column].IntervalType = TT_FREE_INTERVAL;
TT_TimeTable[Gbl.TimeTable.Weekday][Gbl.TimeTable.Interval].Columns[Gbl.TimeTable.Column].ClassType = TT_FREE;
TT_TimeTable[Gbl.TimeTable.Weekday][Gbl.TimeTable.Interval].Columns[Gbl.TimeTable.Column].DurationIntervals = 0;
TT_TimeTable[Gbl.TimeTable.Weekday][Gbl.TimeTable.Interval].Columns[Gbl.TimeTable.Column].Group[0] = '\0';
TT_TimeTable[Gbl.TimeTable.Weekday][Gbl.TimeTable.Interval].Columns[Gbl.TimeTable.Column].Place[0] = '\0';
TT_TimeTable[Gbl.TimeTable.Weekday][Gbl.TimeTable.Interval].Columns[Gbl.TimeTable.Column].Info[0] = '\0';
TT_TimeTable[Gbl.TimeTable.Weekday][Gbl.TimeTable.Interval].NumColumns--;
}
@ -1113,12 +1098,9 @@ static void TT_ModifTimeTable (void)
TT_TimeTable[Gbl.TimeTable.Weekday][Gbl.TimeTable.Interval].Columns[Gbl.TimeTable.Column].IntervalType = TT_FIRST_INTERVAL;
TT_TimeTable[Gbl.TimeTable.Weekday][Gbl.TimeTable.Interval].Columns[Gbl.TimeTable.Column].ClassType = Gbl.TimeTable.ClassType;
TT_TimeTable[Gbl.TimeTable.Weekday][Gbl.TimeTable.Interval].Columns[Gbl.TimeTable.Column].DurationIntervals = Gbl.TimeTable.DurationIntervals;
Str_Copy (TT_TimeTable[Gbl.TimeTable.Weekday][Gbl.TimeTable.Interval].Columns[Gbl.TimeTable.Column].Group,
Gbl.TimeTable.Group,
Grp_MAX_BYTES_GROUP_NAME);
Str_Copy (TT_TimeTable[Gbl.TimeTable.Weekday][Gbl.TimeTable.Interval].Columns[Gbl.TimeTable.Column].Place,
Gbl.TimeTable.Place,
TT_MAX_BYTES_PLACE);
Str_Copy (TT_TimeTable[Gbl.TimeTable.Weekday][Gbl.TimeTable.Interval].Columns[Gbl.TimeTable.Column].Info,
Gbl.TimeTable.Info,
TT_MAX_BYTES_INFO);
}
}
@ -1225,7 +1207,7 @@ static void TT_DrawTimeTable (void)
if (ContinuousFreeMinicolumns)
{
TT_TimeTableDrawCell (Weekday,Interval,Column - 1,ContinuousFreeMinicolumns,
-1L,TT_FREE_INTERVAL,TT_FREE,0,NULL,-1,NULL);
-1L,TT_FREE_INTERVAL,TT_FREE,0,-1L,NULL);
ContinuousFreeMinicolumns = 0;
}
TT_TimeTableDrawCell (Weekday,Interval,Column,
@ -1235,13 +1217,12 @@ static void TT_DrawTimeTable (void)
TT_TimeTable[Weekday][Interval].Columns[Column].IntervalType,
TT_TimeTable[Weekday][Interval].Columns[Column].ClassType,
TT_TimeTable[Weekday][Interval].Columns[Column].DurationIntervals,
TT_TimeTable[Weekday][Interval].Columns[Column].Group,
TT_TimeTable[Weekday][Interval].Columns[Column].GrpCod,
TT_TimeTable[Weekday][Interval].Columns[Column].Place);
TT_TimeTable[Weekday][Interval].Columns[Column].Info);
}
if (ContinuousFreeMinicolumns)
TT_TimeTableDrawCell (Weekday,Interval,Column - 1,ContinuousFreeMinicolumns,
-1L,TT_FREE_INTERVAL,TT_FREE,0,NULL,-1L,NULL);
-1L,TT_FREE_INTERVAL,TT_FREE,0,-1L,NULL);
}
/* Empty column used to adjust height */
@ -1434,14 +1415,13 @@ static void TT_DrawCellAlignTimeTable (void)
static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Column,unsigned ColSpan,
long CrsCod,TT_IntervalType_t IntervalType,TT_ClassType_t ClassType,
unsigned DurationNumIntervals,char *Group,long GrpCod,char *Place)
unsigned DurationNumIntervals,long GrpCod,const char *Info)
{
extern const char *Txt_unknown_removed_course;
extern const char *Txt_TIMETABLE_CLASS_TYPES[TT_NUM_CLASS_TYPES];
extern const char *Txt_Group;
extern const char *Txt_All_groups;
extern const char *Txt_Classroom;
extern const char *Txt_Place;
extern const char *Txt_Info;
static const char *TimeTableClasses[TT_NUM_CLASS_TYPES] =
{
"TT_FREE", // TT_FREE (free hour)
@ -1479,13 +1459,13 @@ static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Co
if (RowSpan == 0)
return;
/***** If group code > 0, a group is selected ==> get group type and name *****/
/***** If group code > 0, a group is selected ==> get group data *****/
if (IntervalType == TT_FIRST_INTERVAL &&
(Gbl.TimeTable.View == TT_CRS_VIEW ||
Gbl.TimeTable.View == TT_CRS_EDIT) &&
GrpCod > 0)
{
/* Get group type and name */
/* Get group data */
GrpDat.GrpCod = GrpCod;
Grp_GetDataOfGroupByCod (&GrpDat);
}
@ -1539,21 +1519,20 @@ static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Co
Gbl.TimeTable.Config.Range.MinutesPerInterval); // Minutes
/***** Group *****/
if (Gbl.TimeTable.View == TT_CRS_VIEW)
if (Gbl.TimeTable.View == TT_CRS_VIEW &&
GrpCod > 0)
{
if (GrpCod <= 0)
{
if (Group[0])
fprintf (Gbl.F.Out,"<br />%s",Group);
}
else
fprintf (Gbl.F.Out,"<br />%s %s",
GrpDat.GrpTypName,GrpDat.GrpName);
fprintf (Gbl.F.Out,"<br />%s"
"<br />%s",
GrpDat.GrpTypName,GrpDat.GrpName);
if (GrpDat.Classroom.ClaCod > 0)
fprintf (Gbl.F.Out,"<br />(%s)",
GrpDat.Classroom.ShrtName);
}
/***** Place *****/
if (Place[0])
fprintf (Gbl.F.Out,"<br />%s",Place);
/***** Info *****/
if (Info[0])
fprintf (Gbl.F.Out,"<br />%s",Info);
/***** End cell *****/
fprintf (Gbl.F.Out,"</div>");
@ -1679,36 +1658,36 @@ static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Co
}
fprintf (Gbl.F.Out,"</select>");
/***** Classroom *****/
/***** Info *****/
fprintf (Gbl.F.Out,"<br />"
"<label for=\"TTPlc%s\">"
"<label for=\"TTInf%s\">"
"%s"
"</label>"
"<input id=\"TTPlc%s\" name=\"TTPlc\""
"<input id=\"TTInf%s\" name=\"TTInf\""
" type=\"text\" size=\"1\" maxlength=\"%u\""
" value=\"%s\""
" onchange=\"document.getElementById('%s').submit();\" />",
CellStr,
Txt_Classroom,
Txt_Info,
CellStr,
TT_MAX_CHARS_PLACE,Place,
TT_MAX_CHARS_INFO,Info,
Gbl.Form.Id);
}
else // TimeTableView == TT_TUT_EDIT
{
/***** Place *****/
/***** Info *****/
fprintf (Gbl.F.Out,"<br />"
"<label for=\"TTPlc%s\" class=\"DAT_SMALL\">"
"<label for=\"TTInf%s\" class=\"DAT_SMALL\">"
"%s"
"</label>"
"<input id=\"TTPlc%s\" name=\"TTPlc\""
"<input id=\"TTInf%s\" name=\"TTInf\""
" type=\"text\" size=\"12\" maxlength=\"%u\""
" value=\"%s\""
" onchange=\"document.getElementById('%s').submit();\" />",
CellStr,
Txt_Place,
Txt_Info,
CellStr,
TT_MAX_CHARS_PLACE,Place,
TT_MAX_CHARS_INFO,Info,
Gbl.Form.Id);
}
}

View File

@ -33,8 +33,11 @@
/************************* Public constants and types ************************/
/*****************************************************************************/
#define TT_MAX_CHARS_PLACE (32 - 1) // 31
#define TT_MAX_BYTES_PLACE ((TT_MAX_CHARS_PLACE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
#define TT_MAX_CHARS_INFO (128 - 1) // 127
#define TT_MAX_BYTES_INFO ((TT_MAX_CHARS_INFO + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
// #define TT_MAX_CHARS_PLACE (32 - 1) // 31
// #define TT_MAX_BYTES_PLACE ((TT_MAX_CHARS_INFO + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
typedef enum
{