Version 16.154.4

This commit is contained in:
Antonio Cañas Vargas 2017-03-09 01:33:09 +01:00
parent 72817bd1a1
commit 1dce7654a1
6 changed files with 62 additions and 30 deletions

View File

@ -110,7 +110,7 @@ CREATE TABLE IF NOT EXISTS att_events (
StartTime DATETIME NOT NULL,
EndTime DATETIME NOT NULL,
CommentTchVisible ENUM('N','Y') NOT NULL DEFAULT 'N',
Title VARCHAR(255) NOT NULL,
Title VARCHAR(2047) NOT NULL,
Txt TEXT NOT NULL,
UNIQUE INDEX(AttCod),
INDEX(CrsCod,Hidden));

View File

@ -1486,7 +1486,10 @@ static bool Agd_CheckIfSimilarEventExists (struct AgendaEvent *AgdEvent)
static void Agd_CreateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
{
char Query[1024 + Cns_MAX_BYTES_TEXT];
char Query[1024 +
Agd_MAX_BYTES_EVENT +
Agd_MAX_BYTES_LOCATION +
Cns_MAX_BYTES_TEXT];
/***** Create a new event *****/
sprintf (Query,"INSERT INTO agendas"
@ -1509,7 +1512,10 @@ static void Agd_CreateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
static void Agd_UpdateEvent (struct AgendaEvent *AgdEvent,const char *Txt)
{
char Query[1024 + Cns_MAX_BYTES_TEXT];
char Query[1024 +
Agd_MAX_BYTES_EVENT +
Agd_MAX_BYTES_LOCATION +
Cns_MAX_BYTES_TEXT];
/***** Update the data of the event *****/
sprintf (Query,"UPDATE agendas SET "

View File

@ -678,7 +678,7 @@ void Asg_GetDataOfAssignmentByCod (struct Assignment *Asg)
void Asg_GetDataOfAssignmentByFolder (struct Assignment *Asg)
{
char Query[1024];
char Query[1024 + Brw_MAX_BYTES_FOLDER];
if (Asg->Folder[0])
{
@ -1044,7 +1044,7 @@ void Asg_ShowAssignment (void)
static bool Asg_CheckIfSimilarAssignmentExists (const char *Field,const char *Value,long AsgCod)
{
char Query[512];
char Query[256 + Asg_MAX_BYTES_ASSIGNMENT_TITLE];
/***** Get number of assignments with a field value from database *****/
sprintf (Query,"SELECT COUNT(*) FROM assignments"
@ -1418,7 +1418,9 @@ static void Asg_UpdateNumUsrsNotifiedByEMailAboutAssignment (long AsgCod,unsigne
static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt)
{
char Query[1024 + Cns_MAX_BYTES_TEXT];
char Query[1024 +
Asg_MAX_BYTES_ASSIGNMENT_TITLE +
Cns_MAX_BYTES_TEXT];
/***** Create a new assignment *****/
sprintf (Query,"INSERT INTO assignments"
@ -1446,7 +1448,9 @@ static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt)
static void Asg_UpdateAssignment (struct Assignment *Asg,const char *Txt)
{
char Query[1024 + Cns_MAX_BYTES_TEXT];
char Query[1024 +
Asg_MAX_BYTES_ASSIGNMENT_TITLE +
Cns_MAX_BYTES_TEXT];
/***** Update the data of the assignment *****/
sprintf (Query,"UPDATE assignments SET "
@ -1491,10 +1495,11 @@ static bool Asg_CheckIfAsgIsAssociatedToGrps (long AsgCod)
bool Asg_CheckIfAsgIsAssociatedToGrp (long AsgCod,long GrpCod)
{
char Query[512];
char Query[256];
/***** Get if an assignment is associated to a group from database *****/
sprintf (Query,"SELECT COUNT(*) FROM asg_grp WHERE AsgCod='%ld' AND GrpCod='%ld'",
sprintf (Query,"SELECT COUNT(*) FROM asg_grp"
" WHERE AsgCod='%ld' AND GrpCod='%ld'",
AsgCod,GrpCod);
return (DB_QueryCOUNT (Query,"can not check if an assignment is associated to a group") != 0);
}
@ -1535,7 +1540,8 @@ void Asg_RemoveGroupsOfType (long GrpTypCod)
/***** Remove group from all the assignments *****/
sprintf (Query,"DELETE FROM asg_grp USING crs_grp,asg_grp"
" WHERE crs_grp.GrpTypCod='%ld' AND crs_grp.GrpCod=asg_grp.GrpCod",
" WHERE crs_grp.GrpTypCod='%ld'"
" AND crs_grp.GrpCod=asg_grp.GrpCod",
GrpTypCod);
DB_QueryDELETE (Query,"can not remove groups of a type from the associations between assignments and groups");
}
@ -1555,7 +1561,8 @@ static void Asg_CreateGrps (long AsgCod)
NumGrpSel++)
{
/* Create group */
sprintf (Query,"INSERT INTO asg_grp (AsgCod,GrpCod) VALUES ('%ld','%ld')",
sprintf (Query,"INSERT INTO asg_grp (AsgCod,GrpCod)"
" VALUES ('%ld','%ld')",
AsgCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
DB_QueryINSERT (Query,"can not associate a group to an assignment");
}
@ -1580,7 +1587,8 @@ static void Asg_GetAndWriteNamesOfGrpsAssociatedToAsg (struct Assignment *Asg)
/***** Get groups associated to an assignment from database *****/
sprintf (Query,"SELECT crs_grp_types.GrpTypName,crs_grp.GrpName"
" FROM asg_grp,crs_grp,crs_grp_types"
" WHERE asg_grp.AsgCod='%ld' AND asg_grp.GrpCod=crs_grp.GrpCod"
" WHERE asg_grp.AsgCod='%ld'"
" AND asg_grp.GrpCod=crs_grp.GrpCod"
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
" ORDER BY crs_grp_types.GrpTypName,crs_grp.GrpName",
Asg->AsgCod);
@ -1637,7 +1645,8 @@ void Asg_RemoveCrsAssignments (long CrsCod)
/***** Remove groups *****/
sprintf (Query,"DELETE FROM asg_grp USING assignments,asg_grp"
" WHERE assignments.CrsCod='%ld' AND assignments.AsgCod=asg_grp.AsgCod",
" WHERE assignments.CrsCod='%ld'"
" AND assignments.AsgCod=asg_grp.AsgCod",
CrsCod);
DB_QueryDELETE (Query,"can not remove all the groups associated to assignments of a course");

View File

@ -634,7 +634,8 @@ static void Att_GetListAttEvents (Att_OrderTime_t Order)
" WHERE CrsCod='%ld'%s"
" AND (AttCod NOT IN (SELECT AttCod FROM att_grp) OR"
" AttCod IN (SELECT att_grp.AttCod FROM att_grp,crs_grp_usr"
" WHERE crs_grp_usr.UsrCod='%ld' AND att_grp.GrpCod=crs_grp_usr.GrpCod))"
" WHERE crs_grp_usr.UsrCod='%ld'"
" AND att_grp.GrpCod=crs_grp_usr.GrpCod))"
" ORDER BY %s",
Gbl.CurrentCrs.Crs.CrsCod,HiddenSubQuery,Gbl.Usrs.Me.UsrDat.UsrCod,OrderBySubQuery);
else // Gbl.CurrentCrs.Grps.WhichGrps == Grp_ALL_GROUPS
@ -1007,7 +1008,7 @@ void Att_ShowAttEvent (void)
static bool Att_CheckIfSimilarAttEventExists (const char *Field,const char *Value,long AttCod)
{
char Query[512];
char Query[256 + Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE];
/***** Get number of attendance events with a field value from database *****/
sprintf (Query,"SELECT COUNT(*) FROM att_events"
@ -1324,7 +1325,9 @@ void Att_RecFormAttEvent (void)
void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt)
{
char Query[1024 + Cns_MAX_BYTES_TEXT];
char Query[1024 +
Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE +
Cns_MAX_BYTES_TEXT];
/***** Create a new attendance event *****/
sprintf (Query,"INSERT INTO att_events"
@ -1356,7 +1359,9 @@ void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt)
void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Txt)
{
char Query[1024 + Cns_MAX_BYTES_TEXT];
char Query[1024 +
Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE +
Cns_MAX_BYTES_TEXT];
/***** Update the data of the attendance event *****/
sprintf (Query,"UPDATE att_events SET "
@ -1450,7 +1455,8 @@ void Att_RemoveGroupsOfType (long GrpTypCod)
/***** Remove group from all the attendance events *****/
sprintf (Query,"DELETE FROM att_grp USING crs_grp,att_grp"
" WHERE crs_grp.GrpTypCod='%ld' AND crs_grp.GrpCod=att_grp.GrpCod",
" WHERE crs_grp.GrpTypCod='%ld'"
" AND crs_grp.GrpCod=att_grp.GrpCod",
GrpTypCod);
DB_QueryDELETE (Query,"can not remove groups of a type from the associations between attendance events and groups");
}
@ -1470,7 +1476,8 @@ static void Att_CreateGrps (long AttCod)
NumGrpSel++)
{
/* Create group */
sprintf (Query,"INSERT INTO att_grp (AttCod,GrpCod) VALUES ('%ld','%ld')",
sprintf (Query,"INSERT INTO att_grp (AttCod,GrpCod)"
" VALUES ('%ld','%ld')",
AttCod,Gbl.CurrentCrs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
DB_QueryINSERT (Query,"can not associate a group to an attendance event");
}
@ -1495,7 +1502,8 @@ static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct AttendanceEve
/***** Get groups associated to an attendance event from database *****/
sprintf (Query,"SELECT crs_grp_types.GrpTypName,crs_grp.GrpName"
" FROM att_grp,crs_grp,crs_grp_types"
" WHERE att_grp.AttCod='%ld' AND att_grp.GrpCod=crs_grp.GrpCod"
" WHERE att_grp.AttCod='%ld'"
" AND att_grp.GrpCod=crs_grp.GrpCod"
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
" ORDER BY crs_grp_types.GrpTypName,crs_grp.GrpName",
Att->AttCod);
@ -1578,7 +1586,8 @@ void Att_RemoveUsrFromCrsAttEvents (long UsrCod,long CrsCod)
/***** Remove group from all the attendance events *****/
sprintf (Query,"DELETE FROM att_usr USING att_events,att_usr"
" WHERE att_events.CrsCod='%ld'"
" AND att_events.AttCod=att_usr.AttCod AND att_usr.UsrCod='%ld'",
" AND att_events.AttCod=att_usr.AttCod"
" AND att_usr.UsrCod='%ld'",
CrsCod,UsrCod);
DB_QueryDELETE (Query,"can not remove user from attendance events of a course");
}
@ -1607,13 +1616,15 @@ void Att_RemoveCrsAttEvents (long CrsCod)
/***** Remove students *****/
sprintf (Query,"DELETE FROM att_usr USING att_events,att_usr"
" WHERE att_events.CrsCod='%ld' AND att_events.AttCod=att_usr.AttCod",
" WHERE att_events.CrsCod='%ld'"
" AND att_events.AttCod=att_usr.AttCod",
CrsCod);
DB_QueryDELETE (Query,"can not remove all the students registered in events of a course");
/***** Remove groups *****/
sprintf (Query,"DELETE FROM att_grp USING att_events,att_grp"
" WHERE att_events.CrsCod='%ld' AND att_events.AttCod=att_grp.AttCod",
" WHERE att_events.CrsCod='%ld'"
" AND att_events.AttCod=att_grp.AttCod",
CrsCod);
DB_QueryDELETE (Query,"can not remove all the groups associated to attendance events of a course");
@ -2506,7 +2517,7 @@ static bool Att_CheckIfUsrIsPresentInAttEventAndGetComments (long AttCod,long Us
void Att_RegUsrInAttEventNotChangingComments (long AttCod,long UsrCod)
{
bool Present;
char Query[128];
char Query[256];
/***** Check if user is already in table att_usr (present or not) *****/
if (Att_CheckIfUsrIsInTableAttUsr (AttCod,UsrCod,&Present)) // User is in table att_usr
@ -2535,7 +2546,8 @@ static void Att_RegUsrInAttEventChangingComments (long AttCod,long UsrCod,bool P
char Query[256 + Cns_MAX_BYTES_TEXT * 2];
/***** Register user as assistant to an event in database *****/
sprintf (Query,"REPLACE INTO att_usr (AttCod,UsrCod,Present,CommentStd,CommentTch)"
sprintf (Query,"REPLACE INTO att_usr"
" (AttCod,UsrCod,Present,CommentStd,CommentTch)"
" VALUES ('%ld','%ld','%c','%s','%s')",
AttCod,UsrCod,
Present ? 'Y' :

View File

@ -204,13 +204,18 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.154.3 (2017-03-08)"
#define Log_PLATFORM_VERSION "SWAD 16.154.4 (2017-03-09)"
#define CSS_FILE "swad16.147.css"
#define JS_FILE "swad16.144.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/*
Version 16.154.4: Mar 09, 2017 Adjusting size of database fields.
Bug fixing related to agendas, assignments and attendance events. (216504 lines)
1 change necessary in database:
ALTER TABLE att_events CHANGE COLUMN Title Title VARCHAR(2047) NOT NULL;
Version 16.154.3: Mar 08, 2017 Bug fixing related to folders in assignments and file browsers. (216473 lines)
Version 16.154.2: Mar 08, 2017 Adjusting size of database fields. (216466 lines)
2 changes necessary in database:

View File

@ -307,10 +307,10 @@ mysql> DESCRIBE att_events;
| StartTime | datetime | NO | | NULL | |
| EndTime | datetime | NO | | NULL | |
| CommentTchVisible | enum('N','Y') | NO | | N | |
| Title | varchar(255) | NO | | NULL | |
| Title | varchar(2047) | NO | | NULL | |
| Txt | text | NO | | NULL | |
+-------------------+---------------+------+-----+---------+----------------+
9 rows in set (0.00 sec)
9 rows in set (0,00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS att_events ("
"AttCod INT NOT NULL AUTO_INCREMENT,"
@ -320,8 +320,8 @@ mysql> DESCRIBE att_events;
"StartTime DATETIME NOT NULL,"
"EndTime DATETIME NOT NULL,"
"CommentTchVisible ENUM('N','Y') NOT NULL DEFAULT 'N',"
"Title VARCHAR(255) NOT NULL,"
"Txt TEXT NOT NULL,"
"Title VARCHAR(2047) NOT NULL," // Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE
"Txt TEXT NOT NULL," // Cns_MAX_BYTES_TEXT
"UNIQUE INDEX(AttCod),"
"INDEX(CrsCod,Hidden))");