mirror of https://github.com/acanas/swad-core.git
Version 22.78: Mar 22, 2023 New fields Source and Cod in rubric criteria.
This commit is contained in:
parent
4b463c43fb
commit
b4caf9e0f8
|
@ -84,7 +84,9 @@ static void Ctr_GetParCtrOrder (void);
|
||||||
static void Ctr_EditCentersInternal (void);
|
static void Ctr_EditCentersInternal (void);
|
||||||
static void Ctr_PutIconsEditingCenters (__attribute__((unused)) void *Args);
|
static void Ctr_PutIconsEditingCenters (__attribute__((unused)) void *Args);
|
||||||
|
|
||||||
static void Ctr_GetDataOfCenterFromRow (struct Ctr_Center *Ctr,MYSQL_ROW row);
|
static void Ctr_GetDataOfCenterFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct Ctr_Center *Ctr,
|
||||||
|
bool GetNumUsrsWhoClaimToBelongToCtr);
|
||||||
|
|
||||||
static void Ctr_ListCentersForEdition (const struct Plc_Places *Places);
|
static void Ctr_ListCentersForEdition (const struct Plc_Places *Places);
|
||||||
static bool Ctr_CheckIfICanEditACenter (struct Ctr_Center *Ctr);
|
static bool Ctr_CheckIfICanEditACenter (struct Ctr_Center *Ctr);
|
||||||
|
@ -516,9 +518,7 @@ void Ctr_PutIconToViewCenters (void)
|
||||||
void Ctr_GetBasicListOfCenters (long InsCod)
|
void Ctr_GetBasicListOfCenters (long InsCod)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumCtr;
|
unsigned NumCtr;
|
||||||
struct Ctr_Center *Ctr;
|
|
||||||
|
|
||||||
/***** Get centers from database *****/
|
/***** Get centers from database *****/
|
||||||
Gbl.Hierarchy.Ctrs.Num = Ctr_DB_GetListOfCtrsFull (&mysql_res,InsCod);
|
Gbl.Hierarchy.Ctrs.Num = Ctr_DB_GetListOfCtrsFull (&mysql_res,InsCod);
|
||||||
|
@ -534,16 +534,9 @@ void Ctr_GetBasicListOfCenters (long InsCod)
|
||||||
for (NumCtr = 0;
|
for (NumCtr = 0;
|
||||||
NumCtr < Gbl.Hierarchy.Ctrs.Num;
|
NumCtr < Gbl.Hierarchy.Ctrs.Num;
|
||||||
NumCtr++)
|
NumCtr++)
|
||||||
{
|
|
||||||
Ctr = &(Gbl.Hierarchy.Ctrs.Lst[NumCtr]);
|
|
||||||
|
|
||||||
/* Get center data */
|
/* Get center data */
|
||||||
row = mysql_fetch_row (mysql_res);
|
Ctr_GetDataOfCenterFromRow (mysql_res,&(Gbl.Hierarchy.Ctrs.Lst[NumCtr]),
|
||||||
Ctr_GetDataOfCenterFromRow (Ctr,row);
|
false); // Don't get number of users who claim to belong to this center
|
||||||
|
|
||||||
/* Reset number of users who claim to belong to this center */
|
|
||||||
Ctr->NumUsrsWhoClaimToBelongToCtr.Valid = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
|
@ -558,9 +551,7 @@ void Ctr_GetBasicListOfCenters (long InsCod)
|
||||||
void Ctr_GetFullListOfCenters (long InsCod,Ctr_Order_t SelectedOrder)
|
void Ctr_GetFullListOfCenters (long InsCod,Ctr_Order_t SelectedOrder)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumCtr;
|
unsigned NumCtr;
|
||||||
struct Ctr_Center *Ctr;
|
|
||||||
|
|
||||||
/***** Get centers from database *****/
|
/***** Get centers from database *****/
|
||||||
Gbl.Hierarchy.Ctrs.Num = Ctr_DB_GetListOfCtrsFullWithNumUsrs (&mysql_res,InsCod,SelectedOrder);
|
Gbl.Hierarchy.Ctrs.Num = Ctr_DB_GetListOfCtrsFullWithNumUsrs (&mysql_res,InsCod,SelectedOrder);
|
||||||
|
@ -576,18 +567,9 @@ void Ctr_GetFullListOfCenters (long InsCod,Ctr_Order_t SelectedOrder)
|
||||||
for (NumCtr = 0;
|
for (NumCtr = 0;
|
||||||
NumCtr < Gbl.Hierarchy.Ctrs.Num;
|
NumCtr < Gbl.Hierarchy.Ctrs.Num;
|
||||||
NumCtr++)
|
NumCtr++)
|
||||||
{
|
|
||||||
Ctr = &(Gbl.Hierarchy.Ctrs.Lst[NumCtr]);
|
|
||||||
|
|
||||||
/* Get center data */
|
/* Get center data */
|
||||||
row = mysql_fetch_row (mysql_res);
|
Ctr_GetDataOfCenterFromRow (mysql_res,&(Gbl.Hierarchy.Ctrs.Lst[NumCtr]),
|
||||||
Ctr_GetDataOfCenterFromRow (Ctr,row);
|
true); // Get number of users who claim to belong to this center
|
||||||
|
|
||||||
/* Get number of users who claim to belong to this center (row[11]) */
|
|
||||||
Ctr->NumUsrsWhoClaimToBelongToCtr.Valid = false;
|
|
||||||
if (sscanf (row[11],"%u",&(Ctr->NumUsrsWhoClaimToBelongToCtr.NumUsrs)) == 1)
|
|
||||||
Ctr->NumUsrsWhoClaimToBelongToCtr.Valid = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
|
@ -601,7 +583,6 @@ void Ctr_GetFullListOfCenters (long InsCod,Ctr_Order_t SelectedOrder)
|
||||||
bool Ctr_GetDataOfCenterByCod (struct Ctr_Center *Ctr)
|
bool Ctr_GetDataOfCenterByCod (struct Ctr_Center *Ctr)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
bool CtrFound = false;
|
bool CtrFound = false;
|
||||||
|
|
||||||
/***** Clear data *****/
|
/***** Clear data *****/
|
||||||
|
@ -620,9 +601,9 @@ bool Ctr_GetDataOfCenterByCod (struct Ctr_Center *Ctr)
|
||||||
/***** Get data of a center from database *****/
|
/***** Get data of a center from database *****/
|
||||||
if (Ctr_DB_GetDataOfCenterByCod (&mysql_res,Ctr->CtrCod)) // Center found...
|
if (Ctr_DB_GetDataOfCenterByCod (&mysql_res,Ctr->CtrCod)) // Center found...
|
||||||
{
|
{
|
||||||
/* Get row */
|
/* Get center data */
|
||||||
row = mysql_fetch_row (mysql_res);
|
Ctr_GetDataOfCenterFromRow (mysql_res,Ctr,
|
||||||
Ctr_GetDataOfCenterFromRow (Ctr,row);
|
false); // Don't get number of users who claim to belong to this center
|
||||||
|
|
||||||
/* Set return value */
|
/* Set return value */
|
||||||
CtrFound = true;
|
CtrFound = true;
|
||||||
|
@ -639,8 +620,15 @@ bool Ctr_GetDataOfCenterByCod (struct Ctr_Center *Ctr)
|
||||||
/********** Get data of a center from a row resulting of a query *************/
|
/********** Get data of a center from a row resulting of a query *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Ctr_GetDataOfCenterFromRow (struct Ctr_Center *Ctr,MYSQL_ROW row)
|
static void Ctr_GetDataOfCenterFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct Ctr_Center *Ctr,
|
||||||
|
bool GetNumUsrsWhoClaimToBelongToCtr)
|
||||||
{
|
{
|
||||||
|
MYSQL_ROW row;
|
||||||
|
|
||||||
|
/***** Get row *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/***** Get center code (row[0]) *****/
|
/***** Get center code (row[0]) *****/
|
||||||
if ((Ctr->CtrCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
if ((Ctr->CtrCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongCenterExit ();
|
Err_WrongCenterExit ();
|
||||||
|
@ -668,6 +656,12 @@ static void Ctr_GetDataOfCenterFromRow (struct Ctr_Center *Ctr,MYSQL_ROW row)
|
||||||
Str_Copy (Ctr->ShrtName,row[ 8],sizeof (Ctr->ShrtName) - 1);
|
Str_Copy (Ctr->ShrtName,row[ 8],sizeof (Ctr->ShrtName) - 1);
|
||||||
Str_Copy (Ctr->FullName,row[ 9],sizeof (Ctr->FullName) - 1);
|
Str_Copy (Ctr->FullName,row[ 9],sizeof (Ctr->FullName) - 1);
|
||||||
Str_Copy (Ctr->WWW ,row[10],sizeof (Ctr->WWW ) - 1);
|
Str_Copy (Ctr->WWW ,row[10],sizeof (Ctr->WWW ) - 1);
|
||||||
|
|
||||||
|
/* Get number of users who claim to belong to this center (row[11]) */
|
||||||
|
Ctr->NumUsrsWhoClaimToBelongToCtr.Valid = false;
|
||||||
|
if (GetNumUsrsWhoClaimToBelongToCtr)
|
||||||
|
if (sscanf (row[11],"%u",&(Ctr->NumUsrsWhoClaimToBelongToCtr.NumUsrs)) == 1)
|
||||||
|
Ctr->NumUsrsWhoClaimToBelongToCtr.Valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -629,11 +629,16 @@ TODO: Emilce Barrera Mesa: Podr
|
||||||
TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen.
|
TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 22.77 (2023-03-18)"
|
#define Log_PLATFORM_VERSION "SWAD 22.78 (2023-03-22)"
|
||||||
#define CSS_FILE "swad22.57.1.css"
|
#define CSS_FILE "swad22.57.1.css"
|
||||||
#define JS_FILE "swad22.49.js"
|
#define JS_FILE "swad22.49.js"
|
||||||
/*
|
/*
|
||||||
*
|
Version 22.78: Mar 22, 2023 New fields Source and Cod in rubric criteria. (337770 lines)
|
||||||
|
3 changes necessary in database:
|
||||||
|
ALTER TABLE rub_criteria ADD COLUMN Source ENUM('teacher','rubric','exam','game') NOT NULL DEFAULT 'teacher' AFTER CriInd;
|
||||||
|
ALTER TABLE rub_criteria ADD COLUMN Cod INT NOT NULL DEFAULT -1 AFTER Source;
|
||||||
|
ALTER TABLE rub_criteria ADD INDEX (Source,Cod);
|
||||||
|
|
||||||
Version 22.77: Mar 18, 2023 New field Weight in rubric criteria. (337735 lines)
|
Version 22.77: Mar 18, 2023 New field Weight in rubric criteria. (337735 lines)
|
||||||
1 change necessary in database:
|
1 change necessary in database:
|
||||||
ALTER TABLE rub_criteria ADD COLUMN Weight DOUBLE PRECISION NOT NULL DEFAULT 1 AFTER MaxVal;
|
ALTER TABLE rub_criteria ADD COLUMN Weight DOUBLE PRECISION NOT NULL DEFAULT 1 AFTER MaxVal;
|
||||||
|
|
|
@ -110,7 +110,8 @@ static void Crs_PutHeadCoursesForEdition (void);
|
||||||
static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status);
|
static void Crs_ReceiveFormRequestOrCreateCrs (Hie_Status_t Status);
|
||||||
static void Crs_GetParsNewCourse (struct Crs_Course *Crs);
|
static void Crs_GetParsNewCourse (struct Crs_Course *Crs);
|
||||||
|
|
||||||
static void Crs_GetDataOfCourseFromRow (struct Crs_Course *Crs,MYSQL_ROW row);
|
static void Crs_GetDataOfCourseFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct Crs_Course *Crs);
|
||||||
|
|
||||||
static void Crs_EmptyCourseCompletely (long CrsCod);
|
static void Crs_EmptyCourseCompletely (long CrsCod);
|
||||||
|
|
||||||
|
@ -707,10 +708,8 @@ void Crs_ShowCrssOfCurrentDeg (void)
|
||||||
static void Crs_GetListCrssInCurrentDeg (void)
|
static void Crs_GetListCrssInCurrentDeg (void)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumCrss;
|
unsigned NumCrss;
|
||||||
unsigned NumCrs;
|
unsigned NumCrs;
|
||||||
struct Crs_Course *Crs;
|
|
||||||
|
|
||||||
/***** Get courses of a degree from database *****/
|
/***** Get courses of a degree from database *****/
|
||||||
if ((NumCrss = Crs_DB_GetCrssInCurrentDegFull (&mysql_res))) // Courses found...
|
if ((NumCrss = Crs_DB_GetCrssInCurrentDegFull (&mysql_res))) // Courses found...
|
||||||
|
@ -724,13 +723,8 @@ static void Crs_GetListCrssInCurrentDeg (void)
|
||||||
for (NumCrs = 0;
|
for (NumCrs = 0;
|
||||||
NumCrs < NumCrss;
|
NumCrs < NumCrss;
|
||||||
NumCrs++)
|
NumCrs++)
|
||||||
{
|
/* Get data of next course */
|
||||||
Crs = &Gbl.Hierarchy.Crss.Lst[NumCrs];
|
Crs_GetDataOfCourseFromRow (mysql_res,&Gbl.Hierarchy.Crss.Lst[NumCrs]);
|
||||||
|
|
||||||
/* Get next course */
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
Crs_GetDataOfCourseFromRow (Crs,row);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Gbl.Hierarchy.Crss.Num = NumCrss;
|
Gbl.Hierarchy.Crss.Num = NumCrss;
|
||||||
|
@ -1619,7 +1613,6 @@ void Crs_RemoveCourse (void)
|
||||||
bool Crs_GetDataOfCourseByCod (struct Crs_Course *Crs)
|
bool Crs_GetDataOfCourseByCod (struct Crs_Course *Crs)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
bool CrsFound = false;
|
bool CrsFound = false;
|
||||||
|
|
||||||
/***** Clear data *****/
|
/***** Clear data *****/
|
||||||
|
@ -1637,8 +1630,7 @@ bool Crs_GetDataOfCourseByCod (struct Crs_Course *Crs)
|
||||||
if (Crs_DB_GetDataOfCourseByCod (&mysql_res,Crs->CrsCod)) // Course found...
|
if (Crs_DB_GetDataOfCourseByCod (&mysql_res,Crs->CrsCod)) // Course found...
|
||||||
{
|
{
|
||||||
/***** Get data of the course *****/
|
/***** Get data of the course *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
Crs_GetDataOfCourseFromRow (mysql_res,Crs);
|
||||||
Crs_GetDataOfCourseFromRow (Crs,row);
|
|
||||||
|
|
||||||
/* Set return value */
|
/* Set return value */
|
||||||
CrsFound = true;
|
CrsFound = true;
|
||||||
|
@ -1655,8 +1647,14 @@ bool Crs_GetDataOfCourseByCod (struct Crs_Course *Crs)
|
||||||
/********** Get data of a course from a row resulting of a query *************/
|
/********** Get data of a course from a row resulting of a query *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Crs_GetDataOfCourseFromRow (struct Crs_Course *Crs,MYSQL_ROW row)
|
static void Crs_GetDataOfCourseFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct Crs_Course *Crs)
|
||||||
{
|
{
|
||||||
|
MYSQL_ROW row;
|
||||||
|
|
||||||
|
/***** Get row *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/***** Get course code (row[0]) *****/
|
/***** Get course code (row[0]) *****/
|
||||||
if ((Crs->CrsCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
if ((Crs->CrsCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Err_WrongCourseExit ();
|
Err_WrongCourseExit ();
|
||||||
|
|
|
@ -2799,29 +2799,34 @@ mysql> DESCRIBE roo_check_in;
|
||||||
/***** Table rub_criteria *****/
|
/***** Table rub_criteria *****/
|
||||||
/*
|
/*
|
||||||
mysql> DESCRIBE rub_criteria;
|
mysql> DESCRIBE rub_criteria;
|
||||||
+--------+---------------+------+-----+---------+----------------+
|
+--------+----------------------------------------+------+-----+---------+----------------+
|
||||||
| Field | Type | Null | Key | Default | Extra |
|
| Field | Type | Null | Key | Default | Extra |
|
||||||
+--------+---------------+------+-----+---------+----------------+
|
+--------+----------------------------------------+------+-----+---------+----------------+
|
||||||
| CriCod | int | NO | PRI | NULL | auto_increment |
|
| CriCod | int | NO | PRI | NULL | auto_increment |
|
||||||
| RubCod | int | NO | MUL | NULL | |
|
| RubCod | int | NO | MUL | NULL | |
|
||||||
| CriInd | int | NO | | NULL | |
|
| CriInd | int | NO | | NULL | |
|
||||||
| MinVal | double | NO | | 0 | |
|
| Source | enum('teacher','rubric','exam','game') | NO | MUL | teacher | |
|
||||||
| MaxVal | double | NO | | 1 | |
|
| Cod | int | NO | | -1 | |
|
||||||
| Weight | double | NO | | 1 | |
|
| MinVal | double | NO | | 0 | |
|
||||||
| Title | varchar(2047) | NO | | NULL | |
|
| MaxVal | double | NO | | 1 | |
|
||||||
+--------+---------------+------+-----+---------+----------------+
|
| Weight | double | NO | | 1 | |
|
||||||
7 rows in set (0,00 sec)
|
| Title | varchar(2047) | NO | | NULL | |
|
||||||
|
+--------+----------------------------------------+------+-----+---------+----------------+
|
||||||
|
9 rows in set (0,00 sec)
|
||||||
*/
|
*/
|
||||||
DB_CreateTable ("CREATE TABLE IF NOT EXISTS rub_criteria ("
|
DB_CreateTable ("CREATE TABLE IF NOT EXISTS rub_criteria ("
|
||||||
"CriCod INT NOT NULL AUTO_INCREMENT,"
|
"CriCod INT NOT NULL AUTO_INCREMENT,"
|
||||||
"RubCod INT NOT NULL,"
|
"RubCod INT NOT NULL,"
|
||||||
"CriInd INT NOT NULL,"
|
"CriInd INT NOT NULL,"
|
||||||
|
"Source ENUM('teacher','rubric','exam','game') NOT NULL DEFAULT 'teacher',"
|
||||||
|
"Cod INT NOT NULL DEFAULT -1,"
|
||||||
"MinVal DOUBLE PRECISION NOT NULL DEFAULT 0,"
|
"MinVal DOUBLE PRECISION NOT NULL DEFAULT 0,"
|
||||||
"MaxVal DOUBLE PRECISION NOT NULL DEFAULT 1,"
|
"MaxVal DOUBLE PRECISION NOT NULL DEFAULT 1,"
|
||||||
"Weight DOUBLE PRECISION NOT NULL DEFAULT 1,"
|
"Weight DOUBLE PRECISION NOT NULL DEFAULT 1,"
|
||||||
"Title VARCHAR(2047) NOT NULL,"
|
"Title VARCHAR(2047) NOT NULL,"
|
||||||
"UNIQUE INDEX(CriCod),"
|
"UNIQUE INDEX(CriCod),"
|
||||||
"UNIQUE INDEX(RubCod,CriInd))");
|
"UNIQUE INDEX(RubCod,CriInd),"
|
||||||
|
"INDEX(Source,Cod))");
|
||||||
|
|
||||||
/***** Table rub_rubrics *****/
|
/***** Table rub_rubrics *****/
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -733,7 +733,7 @@ static void ExaSes_GetSessionDataFromRow (MYSQL_RES *mysql_res,
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
Dat_StartEndTime_t StartEndTime;
|
Dat_StartEndTime_t StartEndTime;
|
||||||
|
|
||||||
/***** Get exam session data *****/
|
/***** Get row *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
/*
|
/*
|
||||||
row[0] SesCod
|
row[0] SesCod
|
||||||
|
@ -746,6 +746,7 @@ static void ExaSes_GetSessionDataFromRow (MYSQL_RES *mysql_res,
|
||||||
row[7] Title
|
row[7] Title
|
||||||
row[8] ShowUsrResults
|
row[8] ShowUsrResults
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/***** Get session data *****/
|
/***** Get session data *****/
|
||||||
/* Code of the session (row[0]) */
|
/* Code of the session (row[0]) */
|
||||||
if ((Session->SesCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
if ((Session->SesCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
|
|
|
@ -86,7 +86,9 @@ static void Ins_EditInstitutionsInternal (void);
|
||||||
static void Ins_PutIconsEditingInstitutions (__attribute__((unused)) void *Args);
|
static void Ins_PutIconsEditingInstitutions (__attribute__((unused)) void *Args);
|
||||||
static void Ins_PutIconToViewInstitutions (void);
|
static void Ins_PutIconToViewInstitutions (void);
|
||||||
|
|
||||||
static void Ins_GetDataOfInstitFromRow (struct Ins_Instit *Ins,MYSQL_ROW row);
|
static void Ins_GetDataOfInstitFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct Ins_Instit *Ins,
|
||||||
|
bool GetNumUsrsWhoClaimToBelongToIns);
|
||||||
|
|
||||||
static void Ins_ListInstitutionsForEdition (void);
|
static void Ins_ListInstitutionsForEdition (void);
|
||||||
static bool Ins_CheckIfICanEdit (struct Ins_Instit *Ins);
|
static bool Ins_CheckIfICanEdit (struct Ins_Instit *Ins);
|
||||||
|
@ -605,9 +607,7 @@ static void Ins_PutIconToViewInstitutions (void)
|
||||||
void Ins_GetBasicListOfInstitutions (long CtyCod)
|
void Ins_GetBasicListOfInstitutions (long CtyCod)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumIns;
|
unsigned NumIns;
|
||||||
struct Ins_Instit *Ins;
|
|
||||||
|
|
||||||
/***** Get institutions from database *****/
|
/***** Get institutions from database *****/
|
||||||
if ((Gbl.Hierarchy.Inss.Num = Ins_DB_GetInssInCtyOrderedByFullName (&mysql_res,CtyCod))) // Institutions found...
|
if ((Gbl.Hierarchy.Inss.Num = Ins_DB_GetInssInCtyOrderedByFullName (&mysql_res,CtyCod))) // Institutions found...
|
||||||
|
@ -621,16 +621,9 @@ void Ins_GetBasicListOfInstitutions (long CtyCod)
|
||||||
for (NumIns = 0;
|
for (NumIns = 0;
|
||||||
NumIns < Gbl.Hierarchy.Inss.Num;
|
NumIns < Gbl.Hierarchy.Inss.Num;
|
||||||
NumIns++)
|
NumIns++)
|
||||||
{
|
|
||||||
Ins = &(Gbl.Hierarchy.Inss.Lst[NumIns]);
|
|
||||||
|
|
||||||
/* Get institution data */
|
/* Get institution data */
|
||||||
row = mysql_fetch_row (mysql_res);
|
Ins_GetDataOfInstitFromRow (mysql_res,&(Gbl.Hierarchy.Inss.Lst[NumIns]),
|
||||||
Ins_GetDataOfInstitFromRow (Ins,row);
|
false); // Don't get number of users who claim to belong to this institution
|
||||||
|
|
||||||
/* Reset number of users who claim to belong to this institution */
|
|
||||||
Ins->NumUsrsWhoClaimToBelongToIns.Valid = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Gbl.Hierarchy.Inss.Lst = NULL;
|
Gbl.Hierarchy.Inss.Lst = NULL;
|
||||||
|
@ -647,9 +640,7 @@ void Ins_GetBasicListOfInstitutions (long CtyCod)
|
||||||
void Ins_GetFullListOfInstitutions (long CtyCod)
|
void Ins_GetFullListOfInstitutions (long CtyCod)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumIns;
|
unsigned NumIns;
|
||||||
struct Ins_Instit *Ins;
|
|
||||||
|
|
||||||
/***** Get institutions from database *****/
|
/***** Get institutions from database *****/
|
||||||
if ((Gbl.Hierarchy.Inss.Num = Ins_DB_GetFullListOfInssInCty (&mysql_res,CtyCod))) // Institutions found...
|
if ((Gbl.Hierarchy.Inss.Num = Ins_DB_GetFullListOfInssInCty (&mysql_res,CtyCod))) // Institutions found...
|
||||||
|
@ -663,18 +654,9 @@ void Ins_GetFullListOfInstitutions (long CtyCod)
|
||||||
for (NumIns = 0;
|
for (NumIns = 0;
|
||||||
NumIns < Gbl.Hierarchy.Inss.Num;
|
NumIns < Gbl.Hierarchy.Inss.Num;
|
||||||
NumIns++)
|
NumIns++)
|
||||||
{
|
|
||||||
Ins = &(Gbl.Hierarchy.Inss.Lst[NumIns]);
|
|
||||||
|
|
||||||
/* Get institution data */
|
/* Get institution data */
|
||||||
row = mysql_fetch_row (mysql_res);
|
Ins_GetDataOfInstitFromRow (mysql_res,&(Gbl.Hierarchy.Inss.Lst[NumIns]),
|
||||||
Ins_GetDataOfInstitFromRow (Ins,row);
|
true); // Get number of users who claim to belong to this institution
|
||||||
|
|
||||||
/* Get number of users who claim to belong to this institution (row[7]) */
|
|
||||||
Ins->NumUsrsWhoClaimToBelongToIns.Valid = false;
|
|
||||||
if (sscanf (row[7],"%u",&(Ins->NumUsrsWhoClaimToBelongToIns.NumUsrs)) == 1)
|
|
||||||
Ins->NumUsrsWhoClaimToBelongToIns.Valid = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Gbl.Hierarchy.Inss.Lst = NULL;
|
Gbl.Hierarchy.Inss.Lst = NULL;
|
||||||
|
@ -708,7 +690,6 @@ void Ins_WriteInstitutionNameAndCty (long InsCod)
|
||||||
bool Ins_GetDataOfInstitByCod (struct Ins_Instit *Ins)
|
bool Ins_GetDataOfInstitByCod (struct Ins_Instit *Ins)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
bool InsFound = false;
|
bool InsFound = false;
|
||||||
|
|
||||||
/***** Clear data *****/
|
/***** Clear data *****/
|
||||||
|
@ -727,8 +708,8 @@ bool Ins_GetDataOfInstitByCod (struct Ins_Instit *Ins)
|
||||||
if (Ins_DB_GetDataOfInstitutionByCod (&mysql_res,Ins->InsCod)) // Institution found...
|
if (Ins_DB_GetDataOfInstitutionByCod (&mysql_res,Ins->InsCod)) // Institution found...
|
||||||
{
|
{
|
||||||
/* Get institution data */
|
/* Get institution data */
|
||||||
row = mysql_fetch_row (mysql_res);
|
Ins_GetDataOfInstitFromRow (mysql_res,Ins,
|
||||||
Ins_GetDataOfInstitFromRow (Ins,row);
|
false); // Don't get number of users who claim to belong to this institution
|
||||||
|
|
||||||
/* Set return value */
|
/* Set return value */
|
||||||
InsFound = true;
|
InsFound = true;
|
||||||
|
@ -745,8 +726,14 @@ bool Ins_GetDataOfInstitByCod (struct Ins_Instit *Ins)
|
||||||
/********** Get data of a center from a row resulting of a query *************/
|
/********** Get data of a center from a row resulting of a query *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Ins_GetDataOfInstitFromRow (struct Ins_Instit *Ins,MYSQL_ROW row)
|
static void Ins_GetDataOfInstitFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct Ins_Instit *Ins,
|
||||||
|
bool GetNumUsrsWhoClaimToBelongToIns)
|
||||||
{
|
{
|
||||||
|
MYSQL_ROW row;
|
||||||
|
|
||||||
|
/***** Get row *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
/*
|
/*
|
||||||
row[0]: InsCod
|
row[0]: InsCod
|
||||||
row[1]: CtyCod
|
row[1]: CtyCod
|
||||||
|
@ -755,6 +742,7 @@ static void Ins_GetDataOfInstitFromRow (struct Ins_Instit *Ins,MYSQL_ROW row)
|
||||||
row[4]: ShortName
|
row[4]: ShortName
|
||||||
row[5]: FullName
|
row[5]: FullName
|
||||||
row[6]: WWW
|
row[6]: WWW
|
||||||
|
row[7]: number of users who claim to belong to this institution
|
||||||
*/
|
*/
|
||||||
/***** Get institution code (row[0]) *****/
|
/***** Get institution code (row[0]) *****/
|
||||||
if ((Ins->InsCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
if ((Ins->InsCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
|
@ -775,6 +763,12 @@ static void Ins_GetDataOfInstitFromRow (struct Ins_Instit *Ins,MYSQL_ROW row)
|
||||||
Str_Copy (Ins->ShrtName,row[4],sizeof (Ins->ShrtName) - 1);
|
Str_Copy (Ins->ShrtName,row[4],sizeof (Ins->ShrtName) - 1);
|
||||||
Str_Copy (Ins->FullName,row[5],sizeof (Ins->FullName) - 1);
|
Str_Copy (Ins->FullName,row[5],sizeof (Ins->FullName) - 1);
|
||||||
Str_Copy (Ins->WWW ,row[6],sizeof (Ins->WWW ) - 1);
|
Str_Copy (Ins->WWW ,row[6],sizeof (Ins->WWW ) - 1);
|
||||||
|
|
||||||
|
/***** Get number of users who claim to belong to this institution (row[7]) *****/
|
||||||
|
Ins->NumUsrsWhoClaimToBelongToIns.Valid = false;
|
||||||
|
if (GetNumUsrsWhoClaimToBelongToIns)
|
||||||
|
if (sscanf (row[7],"%u",&(Ins->NumUsrsWhoClaimToBelongToIns.NumUsrs)) == 1)
|
||||||
|
Ins->NumUsrsWhoClaimToBelongToIns.Valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -137,7 +137,8 @@ unsigned Ins_DB_GetDataOfInstitutionByCod (MYSQL_RES **mysql_res,long InsCod)
|
||||||
"RequesterUsrCod," // row[3]
|
"RequesterUsrCod," // row[3]
|
||||||
"ShortName," // row[4]
|
"ShortName," // row[4]
|
||||||
"FullName," // row[5]
|
"FullName," // row[5]
|
||||||
"WWW" // row[6]
|
"WWW," // row[6]
|
||||||
|
"0 AS NumUsrs" // row[7] (not used)
|
||||||
" FROM ins_instits"
|
" FROM ins_instits"
|
||||||
" WHERE InsCod=%ld",
|
" WHERE InsCod=%ld",
|
||||||
InsCod);
|
InsCod);
|
||||||
|
@ -281,7 +282,8 @@ unsigned Ins_DB_GetInssInCtyOrderedByFullName (MYSQL_RES **mysql_res,long CtyCod
|
||||||
"RequesterUsrCod," // row[3]
|
"RequesterUsrCod," // row[3]
|
||||||
"ShortName," // row[4]
|
"ShortName," // row[4]
|
||||||
"FullName," // row[5]
|
"FullName," // row[5]
|
||||||
"WWW" // row[6]
|
"WWW," // row[6]
|
||||||
|
"0 AS NumUsrs" // row[7] (not used)
|
||||||
" FROM ins_instits"
|
" FROM ins_instits"
|
||||||
" WHERE CtyCod=%ld"
|
" WHERE CtyCod=%ld"
|
||||||
" ORDER BY FullName",
|
" ORDER BY FullName",
|
||||||
|
|
|
@ -884,7 +884,7 @@ static void Mch_GetMatchDataFromRow (MYSQL_RES *mysql_res,
|
||||||
Dat_StartEndTime_t StartEndTime;
|
Dat_StartEndTime_t StartEndTime;
|
||||||
long LongNum;
|
long LongNum;
|
||||||
|
|
||||||
/***** Get match data *****/
|
/***** Get row *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
/*
|
/*
|
||||||
row[ 0] MchCod
|
row[ 0] MchCod
|
||||||
|
|
|
@ -297,7 +297,8 @@ static void Prj_UpdateProject (struct Prj_Project *Prj);
|
||||||
|
|
||||||
static bool Prj_CheckIfICanConfigAllProjects (void);
|
static bool Prj_CheckIfICanConfigAllProjects (void);
|
||||||
static void Prj_GetCrsPrjsConfig (struct Prj_Projects *Projects);
|
static void Prj_GetCrsPrjsConfig (struct Prj_Projects *Projects);
|
||||||
static void Prj_GetConfigFromRow (struct Prj_Projects *Projects,MYSQL_ROW row);
|
static void Prj_GetConfigFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct Prj_Projects *Projects);
|
||||||
static bool Prj_GetEditableFromForm (void);
|
static bool Prj_GetEditableFromForm (void);
|
||||||
static void Prj_PutIconsToLockUnlockAllProjects (struct Prj_Projects *Projects);
|
static void Prj_PutIconsToLockUnlockAllProjects (struct Prj_Projects *Projects);
|
||||||
|
|
||||||
|
@ -4221,14 +4222,10 @@ void Prj_ShowFormConfig (void)
|
||||||
static void Prj_GetCrsPrjsConfig (struct Prj_Projects *Projects)
|
static void Prj_GetCrsPrjsConfig (struct Prj_Projects *Projects)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
|
|
||||||
/***** Get configuration of projects for current course from database *****/
|
/***** Get configuration of projects for current course from database *****/
|
||||||
if (Prj_DB_GetCrsPrjsConfig (&mysql_res))
|
if (Prj_DB_GetCrsPrjsConfig (&mysql_res))
|
||||||
{
|
Prj_GetConfigFromRow (mysql_res,Projects);
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
Prj_GetConfigFromRow (Projects,row);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
Projects->Config.Editable = Prj_EDITABLE_DEFAULT;
|
Projects->Config.Editable = Prj_EDITABLE_DEFAULT;
|
||||||
|
|
||||||
|
@ -4240,8 +4237,14 @@ static void Prj_GetCrsPrjsConfig (struct Prj_Projects *Projects)
|
||||||
/************ Get configuration values from a database table row *************/
|
/************ Get configuration values from a database table row *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Prj_GetConfigFromRow (struct Prj_Projects *Projects,MYSQL_ROW row)
|
static void Prj_GetConfigFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct Prj_Projects *Projects)
|
||||||
{
|
{
|
||||||
|
MYSQL_ROW row;
|
||||||
|
|
||||||
|
/***** Get row *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/***** Get whether project are visible via plugins or not *****/
|
/***** Get whether project are visible via plugins or not *****/
|
||||||
Projects->Config.Editable = (row[0][0] == 'Y');
|
Projects->Config.Editable = (row[0][0] == 'Y');
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,10 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
||||||
unsigned NumCriteria,
|
unsigned NumCriteria,
|
||||||
MYSQL_RES *mysql_res,
|
MYSQL_RES *mysql_res,
|
||||||
bool ICanEditCriteria);
|
bool ICanEditCriteria);
|
||||||
|
|
||||||
|
static void RubCri_GetCriterionDataFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct RubCri_Criterion *Criterion);
|
||||||
|
|
||||||
static void RubCri_PutTableHeadingForCriteria (void);
|
static void RubCri_PutTableHeadingForCriteria (void);
|
||||||
|
|
||||||
static void RubCri_GetAndCheckPars (struct Rub_Rubrics *Rubrics,
|
static void RubCri_GetAndCheckPars (struct Rub_Rubrics *Rubrics,
|
||||||
|
@ -108,8 +112,6 @@ static void RubCri_PutParsOneCriterion (void *Rubrics)
|
||||||
void RubCri_GetDataOfCriterionByCod (struct RubCri_Criterion *Criterion)
|
void RubCri_GetDataOfCriterionByCod (struct RubCri_Criterion *Criterion)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
RubCri_ValueRange_t ValueRange;
|
|
||||||
|
|
||||||
/***** Trivial check *****/
|
/***** Trivial check *****/
|
||||||
if (Criterion->CriCod <= 0)
|
if (Criterion->CriCod <= 0)
|
||||||
|
@ -121,39 +123,7 @@ void RubCri_GetDataOfCriterionByCod (struct RubCri_Criterion *Criterion)
|
||||||
|
|
||||||
/***** Get data of rubric criterion from database *****/
|
/***** Get data of rubric criterion from database *****/
|
||||||
if (Rub_DB_GetDataOfCriterionByCod (&mysql_res,Criterion->CriCod)) // Criterion found...
|
if (Rub_DB_GetDataOfCriterionByCod (&mysql_res,Criterion->CriCod)) // Criterion found...
|
||||||
{
|
RubCri_GetCriterionDataFromRow (mysql_res,Criterion);
|
||||||
/* Get row */
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
/*
|
|
||||||
row[0] CriCod
|
|
||||||
row[1] RubCod
|
|
||||||
row[2] CriInd
|
|
||||||
row[3] MinVal
|
|
||||||
row[4] MaxVal
|
|
||||||
row[5] Weight
|
|
||||||
row[6] Title
|
|
||||||
*/
|
|
||||||
/* Get criterion code (row[0]) */
|
|
||||||
Criterion->CriCod = Str_ConvertStrCodToLongCod (row[0]);
|
|
||||||
|
|
||||||
/* Get rubric code (row[0]) */
|
|
||||||
Criterion->RubCod = Str_ConvertStrCodToLongCod (row[1]);
|
|
||||||
|
|
||||||
/* Get criterion index (row[2]) */
|
|
||||||
Criterion->CriInd = Str_ConvertStrToUnsigned (row[2]);
|
|
||||||
|
|
||||||
/* Get criterion minimum and maximum values (row[3], row[4]) */
|
|
||||||
for (ValueRange = (RubCri_ValueRange_t) 0;
|
|
||||||
ValueRange <= (RubCri_ValueRange_t) (RubCri_NUM_VALUES - 1);
|
|
||||||
ValueRange++)
|
|
||||||
Criterion->Values[ValueRange] = Str_GetDoubleFromStr (row[3 + ValueRange]);
|
|
||||||
|
|
||||||
/* Get criterion weight (row[5]) */
|
|
||||||
Criterion->Weight = Str_GetDoubleFromStr (row[3 + RubCri_NUM_VALUES]);
|
|
||||||
|
|
||||||
/* Get the title of the criterion (row[6]) */
|
|
||||||
Str_Copy (Criterion->Title,row[3 + RubCri_NUM_VALUES + 1],sizeof (Criterion->Title) - 1);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
/* Initialize to empty criterion */
|
/* Initialize to empty criterion */
|
||||||
RubCri_ResetCriterion (Criterion);
|
RubCri_ResetCriterion (Criterion);
|
||||||
|
@ -558,7 +528,6 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
||||||
};
|
};
|
||||||
unsigned NumCriterion;
|
unsigned NumCriterion;
|
||||||
struct RubCri_Criterion Criterion;
|
struct RubCri_Criterion Criterion;
|
||||||
MYSQL_ROW row;
|
|
||||||
char *Anchor;
|
char *Anchor;
|
||||||
RubCri_ValueRange_t ValueRange;
|
RubCri_ValueRange_t ValueRange;
|
||||||
|
|
||||||
|
@ -579,35 +548,9 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
||||||
{
|
{
|
||||||
/***** Create criterion of questions *****/
|
/***** Create criterion of questions *****/
|
||||||
RubCri_ResetCriterion (&Criterion);
|
RubCri_ResetCriterion (&Criterion);
|
||||||
Criterion.RubCod = Rubrics->Rubric.RubCod;
|
|
||||||
|
|
||||||
/***** Get criterion data *****/
|
/***** Get criterion data *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
RubCri_GetCriterionDataFromRow (mysql_res,&Criterion);
|
||||||
/*
|
|
||||||
row[0] CriCod
|
|
||||||
row[1] CriInd
|
|
||||||
row[2] MinVal
|
|
||||||
row[3] MaxVal
|
|
||||||
row[4] Weight
|
|
||||||
row[5] Title
|
|
||||||
*/
|
|
||||||
/* Get criterion code (row[0]) */
|
|
||||||
Criterion.CriCod = Str_ConvertStrCodToLongCod (row[0]);
|
|
||||||
|
|
||||||
/* Get criterion index (row[1]) */
|
|
||||||
Criterion.CriInd = Str_ConvertStrToUnsigned (row[1]);
|
|
||||||
|
|
||||||
/* Get minimum value (row[2]) and maximum value (row[3]) */
|
|
||||||
for (ValueRange = (RubCri_ValueRange_t) 0;
|
|
||||||
ValueRange <= (RubCri_ValueRange_t) (RubCri_NUM_VALUES - 1);
|
|
||||||
ValueRange++)
|
|
||||||
Criterion.Values[ValueRange] = Str_GetDoubleFromStr (row[2 + ValueRange]);
|
|
||||||
|
|
||||||
/* Get weight (row[4]) */
|
|
||||||
Criterion.Weight = Str_GetDoubleFromStr (row[2 + RubCri_NUM_VALUES]);
|
|
||||||
|
|
||||||
/* Get the title of the criterion (row[5]) */
|
|
||||||
Str_Copy (Criterion.Title,row[2 + RubCri_NUM_VALUES + 1],sizeof (Criterion.Title) - 1);
|
|
||||||
|
|
||||||
/* Initialize context */
|
/* Initialize context */
|
||||||
Rubrics->CriCod = Criterion.CriCod;
|
Rubrics->CriCod = Criterion.CriCod;
|
||||||
|
@ -748,6 +691,92 @@ static void RubCri_ListOneOrMoreCriteriaForEdition (struct Rub_Rubrics *Rubrics,
|
||||||
HTM_TABLE_End ();
|
HTM_TABLE_End ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************************** Get rubric criteria data *************************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void RubCri_GetCriterionDataFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct RubCri_Criterion *Criterion)
|
||||||
|
{
|
||||||
|
MYSQL_ROW row;
|
||||||
|
RubCri_ValueRange_t ValueRange;
|
||||||
|
|
||||||
|
/* Get row */
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
/*
|
||||||
|
row[0] CriCod
|
||||||
|
row[1] RubCod
|
||||||
|
row[2] CriInd
|
||||||
|
row[3] Source
|
||||||
|
row[4] Cod
|
||||||
|
row[5] MinVal
|
||||||
|
row[6] MaxVal
|
||||||
|
row[7] Weight
|
||||||
|
row[8] Title
|
||||||
|
*/
|
||||||
|
/* Get criterion code (row[0]) */
|
||||||
|
Criterion->CriCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
|
||||||
|
/* Get rubric code (row[0]) */
|
||||||
|
Criterion->RubCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||||
|
|
||||||
|
/* Get criterion index (row[2]) */
|
||||||
|
Criterion->CriInd = Str_ConvertStrToUnsigned (row[2]);
|
||||||
|
|
||||||
|
/* Get source (row[3]) and code (row[4]) */
|
||||||
|
Criterion->Source = RubCri_GetSourceFromDBStr (row[3]);
|
||||||
|
Criterion->Cod = Str_ConvertStrCodToLongCod (row[4]);
|
||||||
|
|
||||||
|
/* Get criterion minimum and maximum values (row[5], row[6]) */
|
||||||
|
for (ValueRange = (RubCri_ValueRange_t) 0;
|
||||||
|
ValueRange <= (RubCri_ValueRange_t) (RubCri_NUM_VALUES - 1);
|
||||||
|
ValueRange++)
|
||||||
|
Criterion->Values[ValueRange] = Str_GetDoubleFromStr (row[5 + ValueRange]);
|
||||||
|
|
||||||
|
/* Get criterion weight (row[7]) */
|
||||||
|
Criterion->Weight = Str_GetDoubleFromStr (row[5 + RubCri_NUM_VALUES]);
|
||||||
|
|
||||||
|
/* Get the title of the criterion (row[8]) */
|
||||||
|
Str_Copy (Criterion->Title,row[5 + RubCri_NUM_VALUES + 1],sizeof (Criterion->Title) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********************** Get source from database string *********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
RubCri_Source_t RubCri_GetSourceFromDBStr (const char *SourceDBStr)
|
||||||
|
{
|
||||||
|
RubCri_Source_t Source;
|
||||||
|
|
||||||
|
for (Source = (RubCri_Source_t) 0;
|
||||||
|
Source <= (RubCri_Source_t) (RubCri_NUM_SOURCES - 1);
|
||||||
|
Source++)
|
||||||
|
if (!strcmp (RubCri_GetDBStrFromSource (Source),SourceDBStr))
|
||||||
|
return Source;
|
||||||
|
|
||||||
|
return RubCri_SOURCE_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********************** Get database string from source *********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
const char *RubCri_GetDBStrFromSource (RubCri_Source_t Source)
|
||||||
|
{
|
||||||
|
static const char *RubCri_SourceDB[RubCri_NUM_SOURCES] =
|
||||||
|
{
|
||||||
|
[RubCri_FROM_TEACHER ] = "teacher",
|
||||||
|
[RubCri_FROM_ANOTHER_RUBRIC] = "rubric",
|
||||||
|
[RubCri_FROM_EXAM_PRINT ] = "exam",
|
||||||
|
[RubCri_FROM_GAME_MATCH ] = "game",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (Source >= RubCri_NUM_SOURCES)
|
||||||
|
Source = RubCri_SOURCE_DEFAULT;
|
||||||
|
|
||||||
|
return RubCri_SourceDB[Source];
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************** Put table heading for rubric criteria ********************/
|
/****************** Put table heading for rubric criteria ********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -789,15 +818,17 @@ void RubCri_ResetCriterion (struct RubCri_Criterion *Criterion)
|
||||||
};
|
};
|
||||||
RubCri_ValueRange_t ValueRange;
|
RubCri_ValueRange_t ValueRange;
|
||||||
|
|
||||||
Criterion->RubCod = -1L;
|
Criterion->RubCod = -1L;
|
||||||
Criterion->CriCod = -1L;
|
Criterion->CriCod = -1L;
|
||||||
Criterion->CriInd = 0;
|
Criterion->CriInd = 0;
|
||||||
Criterion->Title[0] = '\0';
|
Criterion->Source = RubCri_SOURCE_DEFAULT;
|
||||||
|
Criterion->Cod = -1L;
|
||||||
for (ValueRange = (RubCri_ValueRange_t) 0;
|
for (ValueRange = (RubCri_ValueRange_t) 0;
|
||||||
ValueRange <= (RubCri_ValueRange_t) (RubCri_NUM_VALUES - 1);
|
ValueRange <= (RubCri_ValueRange_t) (RubCri_NUM_VALUES - 1);
|
||||||
ValueRange++)
|
ValueRange++)
|
||||||
Criterion->Values[ValueRange] = RubCri_DefaultValues[ValueRange];
|
Criterion->Values[ValueRange] = RubCri_DefaultValues[ValueRange];
|
||||||
Criterion->Weight = 1.0;
|
Criterion->Weight = 1.0;
|
||||||
|
Criterion->Title[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -44,6 +44,9 @@ void RubCri_ChangeWeightCriterion (void);
|
||||||
void RubCri_ListCriteria (struct Rub_Rubrics *Rubrics,
|
void RubCri_ListCriteria (struct Rub_Rubrics *Rubrics,
|
||||||
struct RubCri_Criterion *Criterion);
|
struct RubCri_Criterion *Criterion);
|
||||||
|
|
||||||
|
RubCri_Source_t RubCri_GetSourceFromDBStr (const char *SourceDBStr);
|
||||||
|
const char *RubCri_GetDBStrFromSource (RubCri_Source_t Source);
|
||||||
|
|
||||||
void RubCri_ResetCriterion (struct RubCri_Criterion *Criterion);
|
void RubCri_ResetCriterion (struct RubCri_Criterion *Criterion);
|
||||||
|
|
||||||
void RubCri_ReqRemCriterion (void);
|
void RubCri_ReqRemCriterion (void);
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "swad_database.h"
|
#include "swad_database.h"
|
||||||
#include "swad_error.h"
|
#include "swad_error.h"
|
||||||
#include "swad_rubric_database.h"
|
#include "swad_rubric_database.h"
|
||||||
|
#include "swad_rubric_criteria.h"
|
||||||
#include "swad_global.h"
|
#include "swad_global.h"
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -356,13 +357,15 @@ long Rub_DB_CreateCriterion (const struct RubCri_Criterion *Criterion)
|
||||||
CriCod =
|
CriCod =
|
||||||
DB_QueryINSERTandReturnCode ("can not create new criterion",
|
DB_QueryINSERTandReturnCode ("can not create new criterion",
|
||||||
"INSERT INTO rub_criteria"
|
"INSERT INTO rub_criteria"
|
||||||
" (RubCod,CriInd,%s,%s,Weight,Title)"
|
" (RubCod,CriInd,Source,Cod,%s,%s,Weight,Title)"
|
||||||
" VALUES"
|
" VALUES"
|
||||||
" (%ld,%u,%.15lg,%.15lg,%.15lg,'%s')",
|
" (%ld,%u,'%s',%ld,%.15lg,%.15lg,%.15lg,'%s')",
|
||||||
RubCri_ValuesFields[RubCri_MIN],
|
RubCri_ValuesFields[RubCri_MIN],
|
||||||
RubCri_ValuesFields[RubCri_MAX],
|
RubCri_ValuesFields[RubCri_MAX],
|
||||||
Criterion->RubCod,
|
Criterion->RubCod,
|
||||||
Criterion->CriInd,
|
Criterion->CriInd,
|
||||||
|
RubCri_GetDBStrFromSource (Criterion->Source),
|
||||||
|
Criterion->Cod,
|
||||||
Criterion->Values[RubCri_MIN],
|
Criterion->Values[RubCri_MIN],
|
||||||
Criterion->Values[RubCri_MAX],
|
Criterion->Values[RubCri_MAX],
|
||||||
Criterion->Weight,
|
Criterion->Weight,
|
||||||
|
@ -586,11 +589,14 @@ unsigned Rub_DB_GetCriteria (MYSQL_RES **mysql_res,long RubCod)
|
||||||
return (unsigned)
|
return (unsigned)
|
||||||
DB_QuerySELECT (mysql_res,"can not get criteria",
|
DB_QuerySELECT (mysql_res,"can not get criteria",
|
||||||
"SELECT CriCod," // row[0]
|
"SELECT CriCod," // row[0]
|
||||||
"CriInd," // row[1]
|
"RubCod," // row[1]
|
||||||
"%s," // row[2]
|
"CriInd," // row[2]
|
||||||
"%s," // row[3]
|
"Source," // row[3]
|
||||||
"Weight," // row[4]
|
"Cod," // row[4]
|
||||||
"Title" // row[5]
|
"%s," // row[5]
|
||||||
|
"%s," // row[6]
|
||||||
|
"Weight," // row[7]
|
||||||
|
"Title" // row[8]
|
||||||
" FROM rub_criteria"
|
" FROM rub_criteria"
|
||||||
" WHERE RubCod=%ld"
|
" WHERE RubCod=%ld"
|
||||||
" ORDER BY CriInd",
|
" ORDER BY CriInd",
|
||||||
|
@ -610,10 +616,12 @@ unsigned Rub_DB_GetDataOfCriterionByCod (MYSQL_RES **mysql_res,long CriCod)
|
||||||
"SELECT CriCod," // row[0]
|
"SELECT CriCod," // row[0]
|
||||||
"RubCod," // row[1]
|
"RubCod," // row[1]
|
||||||
"CriInd," // row[2]
|
"CriInd," // row[2]
|
||||||
"%s," // row[3]
|
"Source," // row[3]
|
||||||
"%s," // row[4]
|
"Cod," // row[4]
|
||||||
"Weight," // row[5]
|
"%s," // row[5]
|
||||||
"Title" // row[6]
|
"%s," // row[6]
|
||||||
|
"Weight," // row[7]
|
||||||
|
"Title" // row[8]
|
||||||
" FROM rub_criteria"
|
" FROM rub_criteria"
|
||||||
" WHERE CriCod=%ld",
|
" WHERE CriCod=%ld",
|
||||||
RubCri_ValuesFields[RubCri_MIN],
|
RubCri_ValuesFields[RubCri_MIN],
|
||||||
|
|
|
@ -44,13 +44,6 @@
|
||||||
#define RubCri_MAX_CHARS_TITLE (128 - 1) // 127
|
#define RubCri_MAX_CHARS_TITLE (128 - 1) // 127
|
||||||
#define RubCri_MAX_BYTES_TITLE ((RubCri_MAX_CHARS_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
#define RubCri_MAX_BYTES_TITLE ((RubCri_MAX_CHARS_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
||||||
|
|
||||||
#define RubCri_NUM_VALUES 2
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
RubCri_MIN = 0,
|
|
||||||
RubCri_MAX = 1,
|
|
||||||
} RubCri_ValueRange_t;
|
|
||||||
|
|
||||||
struct Rub_Rubric
|
struct Rub_Rubric
|
||||||
{
|
{
|
||||||
long RubCod; // Rubric code
|
long RubCod; // Rubric code
|
||||||
|
@ -73,11 +66,30 @@ struct Rub_Rubrics
|
||||||
long QstCod; // Current question code
|
long QstCod; // Current question code
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define RubCri_NUM_VALUES 2
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
RubCri_MIN = 0,
|
||||||
|
RubCri_MAX = 1,
|
||||||
|
} RubCri_ValueRange_t;
|
||||||
|
|
||||||
|
#define RubCri_NUM_SOURCES 4
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
RubCri_FROM_TEACHER,
|
||||||
|
RubCri_FROM_ANOTHER_RUBRIC,
|
||||||
|
RubCri_FROM_EXAM_PRINT,
|
||||||
|
RubCri_FROM_GAME_MATCH,
|
||||||
|
} RubCri_Source_t;
|
||||||
|
#define RubCri_SOURCE_DEFAULT RubCri_FROM_TEACHER
|
||||||
|
|
||||||
struct RubCri_Criterion
|
struct RubCri_Criterion
|
||||||
{
|
{
|
||||||
long RubCod; // Rubric code
|
long RubCod; // Rubric code
|
||||||
long CriCod; // Criterion code
|
long CriCod; // Criterion code
|
||||||
unsigned CriInd; // Criterion index (position in the rubric)
|
unsigned CriInd; // Criterion index (position in the rubric)
|
||||||
|
RubCri_Source_t Source;
|
||||||
|
long Cod;
|
||||||
double Values[RubCri_NUM_VALUES];
|
double Values[RubCri_NUM_VALUES];
|
||||||
double Weight; // Relative weight (from 0.0 to 1.0)
|
double Weight; // Relative weight (from 0.0 to 1.0)
|
||||||
char Title[RubCri_MAX_BYTES_TITLE + 1]; // Title of the criterion
|
char Title[RubCri_MAX_BYTES_TITLE + 1]; // Title of the criterion
|
||||||
|
|
|
@ -326,7 +326,7 @@ HieLvl_Level_t Sco_GetScopeFromDBStr (const char *ScopeDBStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********************** Get scope from database string **********************/
|
/*********************** Get database string from source *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
const char *Sco_GetDBStrFromScope (HieLvl_Level_t Scope)
|
const char *Sco_GetDBStrFromScope (HieLvl_Level_t Scope)
|
||||||
|
|
|
@ -128,9 +128,9 @@ static void Svy_FreeTextChoiceAnswer (struct Svy_Question *SvyQst,unsigned NumAn
|
||||||
|
|
||||||
static unsigned Svy_GetNextQuestionIndexInSvy (long SvyCod);
|
static unsigned Svy_GetNextQuestionIndexInSvy (long SvyCod);
|
||||||
static void Svy_ListSvyQuestions (struct Svy_Surveys *Surveys);
|
static void Svy_ListSvyQuestions (struct Svy_Surveys *Surveys);
|
||||||
static void Svy_GetDataOfQstFromRow (struct Svy_Question *SvyQst,
|
static void Svy_GetDataOfQstFromRow (MYSQL_RES *mysql_res,
|
||||||
char Stem[Cns_MAX_BYTES_TEXT + 1],
|
struct Svy_Question *SvyQst,
|
||||||
MYSQL_ROW row);
|
char Stem[Cns_MAX_BYTES_TEXT + 1]);
|
||||||
static void Svy_PutParsToEditQuestion (void *Surveys);
|
static void Svy_PutParsToEditQuestion (void *Surveys);
|
||||||
static void Svy_PutIconToAddNewQuestion (void *Surveys);
|
static void Svy_PutIconToAddNewQuestion (void *Surveys);
|
||||||
static void Svy_PutButtonToCreateNewQuestion (struct Svy_Surveys *Surveys);
|
static void Svy_PutButtonToCreateNewQuestion (struct Svy_Surveys *Surveys);
|
||||||
|
@ -2310,10 +2310,7 @@ static void Svy_ShowFormEditOneQst (struct Svy_Surveys *Surveys,
|
||||||
{
|
{
|
||||||
/***** Get question data from database *****/
|
/***** Get question data from database *****/
|
||||||
if (Svy_DB_GetQstDataByCod (&mysql_res,SvyQst->QstCod,Surveys->Svy.SvyCod))
|
if (Svy_DB_GetQstDataByCod (&mysql_res,SvyQst->QstCod,Surveys->Svy.SvyCod))
|
||||||
{
|
Svy_GetDataOfQstFromRow (mysql_res,SvyQst,Stem);
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
Svy_GetDataOfQstFromRow (SvyQst,Stem,row);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
Err_WrongQuestionExit ();
|
Err_WrongQuestionExit ();
|
||||||
|
|
||||||
|
@ -2715,7 +2712,6 @@ static void Svy_ListSvyQuestions (struct Svy_Surveys *Surveys)
|
||||||
extern const char *Txt_This_survey_has_no_questions;
|
extern const char *Txt_This_survey_has_no_questions;
|
||||||
extern const char *Txt_Done;
|
extern const char *Txt_Done;
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
unsigned NumQsts;
|
unsigned NumQsts;
|
||||||
unsigned NumQst;
|
unsigned NumQst;
|
||||||
struct Svy_Question SvyQst;
|
struct Svy_Question SvyQst;
|
||||||
|
@ -2765,8 +2761,7 @@ static void Svy_ListSvyQuestions (struct Svy_Surveys *Surveys)
|
||||||
Svy_InitQst (&SvyQst);
|
Svy_InitQst (&SvyQst);
|
||||||
|
|
||||||
/* Get question data from row */
|
/* Get question data from row */
|
||||||
row = mysql_fetch_row (mysql_res);
|
Svy_GetDataOfQstFromRow (mysql_res,&SvyQst,Stem);
|
||||||
Svy_GetDataOfQstFromRow (&SvyQst,Stem,row);
|
|
||||||
|
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
@ -2844,10 +2839,15 @@ static void Svy_ListSvyQuestions (struct Svy_Surveys *Surveys)
|
||||||
/************************* Get question data from row ************************/
|
/************************* Get question data from row ************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Svy_GetDataOfQstFromRow (struct Svy_Question *SvyQst,
|
static void Svy_GetDataOfQstFromRow (MYSQL_RES *mysql_res,
|
||||||
char Stem[Cns_MAX_BYTES_TEXT + 1],
|
struct Svy_Question *SvyQst,
|
||||||
MYSQL_ROW row)
|
char Stem[Cns_MAX_BYTES_TEXT + 1])
|
||||||
{
|
{
|
||||||
|
MYSQL_ROW row;
|
||||||
|
|
||||||
|
/***** Get row *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/***** Get the code of the question (row[0]) *****/
|
/***** Get the code of the question (row[0]) *****/
|
||||||
if (sscanf (row[0],"%ld",&(SvyQst->QstCod)) != 1)
|
if (sscanf (row[0],"%ld",&(SvyQst->QstCod)) != 1)
|
||||||
Err_WrongQuestionExit ();
|
Err_WrongQuestionExit ();
|
||||||
|
|
|
@ -70,7 +70,7 @@ static void TstCfg_ShowFormConfig (void);
|
||||||
static void TstCfg_PutInputFieldNumQsts (const char *Field,const char *Label,
|
static void TstCfg_PutInputFieldNumQsts (const char *Field,const char *Label,
|
||||||
unsigned Value);
|
unsigned Value);
|
||||||
|
|
||||||
static void TstCfg_GetConfigFromRow (MYSQL_ROW row);
|
static void TstCfg_GetConfigFromRow (MYSQL_RES *mysql_res);
|
||||||
|
|
||||||
static TstCfg_Pluggable_t TstCfg_GetPluggableFromForm (void);
|
static TstCfg_Pluggable_t TstCfg_GetPluggableFromForm (void);
|
||||||
static void TstCfg_CheckAndCorrectMinDefMax (void);
|
static void TstCfg_CheckAndCorrectMinDefMax (void);
|
||||||
|
@ -308,14 +308,10 @@ static void TstCfg_PutInputFieldNumQsts (const char *Field,const char *Label,
|
||||||
void TstCfg_GetConfig (void)
|
void TstCfg_GetConfig (void)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
|
|
||||||
/***** Get configuration of test for current course from database *****/
|
/***** Get configuration of test for current course from database *****/
|
||||||
if (Tst_DB_GetConfig (&mysql_res,Gbl.Hierarchy.Crs.CrsCod))
|
if (Tst_DB_GetConfig (&mysql_res,Gbl.Hierarchy.Crs.CrsCod))
|
||||||
{
|
TstCfg_GetConfigFromRow (mysql_res);
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
TstCfg_GetConfigFromRow (row);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TstCfg_SetConfigPluggable (TstCfg_PLUGGABLE_UNKNOWN);
|
TstCfg_SetConfigPluggable (TstCfg_PLUGGABLE_UNKNOWN);
|
||||||
|
@ -334,13 +330,17 @@ void TstCfg_GetConfig (void)
|
||||||
/************ Get configuration values from a database table row *************/
|
/************ Get configuration values from a database table row *************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void TstCfg_GetConfigFromRow (MYSQL_ROW row)
|
static void TstCfg_GetConfigFromRow (MYSQL_RES *mysql_res)
|
||||||
{
|
{
|
||||||
extern const char *Tst_DB_Pluggable[TstCfg_NUM_OPTIONS_PLUGGABLE];
|
extern const char *Tst_DB_Pluggable[TstCfg_NUM_OPTIONS_PLUGGABLE];
|
||||||
|
MYSQL_ROW row;
|
||||||
int IntNum;
|
int IntNum;
|
||||||
long LongNum;
|
long LongNum;
|
||||||
TstCfg_Pluggable_t Pluggable;
|
TstCfg_Pluggable_t Pluggable;
|
||||||
|
|
||||||
|
/***** Get row *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
/***** Get whether test are visible via plugins or not *****/
|
/***** Get whether test are visible via plugins or not *****/
|
||||||
TstCfg_SetConfigPluggable (TstCfg_PLUGGABLE_UNKNOWN);
|
TstCfg_SetConfigPluggable (TstCfg_PLUGGABLE_UNKNOWN);
|
||||||
for (Pluggable = TstCfg_PLUGGABLE_NO;
|
for (Pluggable = TstCfg_PLUGGABLE_NO;
|
||||||
|
|
|
@ -108,7 +108,7 @@ static void TmlCom_RequestRemovalComm (struct Tml_Timeline *Timeline);
|
||||||
static void TmlCom_PutParsRemoveComm (void *Timeline);
|
static void TmlCom_PutParsRemoveComm (void *Timeline);
|
||||||
static void TmlCom_RemoveComm (void);
|
static void TmlCom_RemoveComm (void);
|
||||||
|
|
||||||
static void TmlCom_GetDataOfCommFromRow (MYSQL_ROW row,
|
static void TmlCom_GetDataOfCommFromRow (MYSQL_RES *mysql_res,
|
||||||
struct TmlCom_Comment *Com);
|
struct TmlCom_Comment *Com);
|
||||||
|
|
||||||
static void TmlCom_ResetComm (struct TmlCom_Comment *Com);
|
static void TmlCom_ResetComm (struct TmlCom_Comment *Com);
|
||||||
|
@ -437,15 +437,13 @@ static void TmlCom_ListComms (const struct Tml_Timeline *Timeline,
|
||||||
static void TmlCom_WriteOneCommInList (const struct Tml_Timeline *Timeline,
|
static void TmlCom_WriteOneCommInList (const struct Tml_Timeline *Timeline,
|
||||||
MYSQL_RES *mysql_res)
|
MYSQL_RES *mysql_res)
|
||||||
{
|
{
|
||||||
MYSQL_ROW row;
|
|
||||||
struct TmlCom_Comment Com;
|
struct TmlCom_Comment Com;
|
||||||
|
|
||||||
/***** Initialize image *****/
|
/***** Initialize image *****/
|
||||||
Med_MediaConstructor (&Com.Content.Media);
|
Med_MediaConstructor (&Com.Content.Media);
|
||||||
|
|
||||||
/***** Get data of comment *****/
|
/***** Get data of comment *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
TmlCom_GetDataOfCommFromRow (mysql_res,&Com);
|
||||||
TmlCom_GetDataOfCommFromRow (row,&Com);
|
|
||||||
|
|
||||||
/***** Write comment *****/
|
/***** Write comment *****/
|
||||||
HTM_LI_Begin ("class=\"Tml_COM\"");
|
HTM_LI_Begin ("class=\"Tml_COM\"");
|
||||||
|
@ -1045,7 +1043,6 @@ void TmlCom_RemoveCommMediaAndDBEntries (long PubCod)
|
||||||
void TmlCom_GetDataOfCommByCod (struct TmlCom_Comment *Com)
|
void TmlCom_GetDataOfCommByCod (struct TmlCom_Comment *Com)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
|
|
||||||
/***** Trivial check: publication code should be > 0 *****/
|
/***** Trivial check: publication code should be > 0 *****/
|
||||||
if (Com->PubCod <= 0)
|
if (Com->PubCod <= 0)
|
||||||
|
@ -1057,11 +1054,7 @@ void TmlCom_GetDataOfCommByCod (struct TmlCom_Comment *Com)
|
||||||
|
|
||||||
/***** Get data of comment from database *****/
|
/***** Get data of comment from database *****/
|
||||||
if (Tml_DB_GetDataOfCommByCod (Com->PubCod,&mysql_res))
|
if (Tml_DB_GetDataOfCommByCod (Com->PubCod,&mysql_res))
|
||||||
{
|
TmlCom_GetDataOfCommFromRow (mysql_res,Com);
|
||||||
/* Get data of comment */
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
TmlCom_GetDataOfCommFromRow (row,Com);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
/* Reset fields of comment */
|
/* Reset fields of comment */
|
||||||
TmlCom_ResetComm (Com);
|
TmlCom_ResetComm (Com);
|
||||||
|
@ -1074,9 +1067,13 @@ void TmlCom_GetDataOfCommByCod (struct TmlCom_Comment *Com)
|
||||||
/********************** Get data of comment from row *************************/
|
/********************** Get data of comment from row *************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void TmlCom_GetDataOfCommFromRow (MYSQL_ROW row,
|
static void TmlCom_GetDataOfCommFromRow (MYSQL_RES *mysql_res,
|
||||||
struct TmlCom_Comment *Com)
|
struct TmlCom_Comment *Com)
|
||||||
{
|
{
|
||||||
|
MYSQL_ROW row;
|
||||||
|
|
||||||
|
/***** Get row *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
/*
|
/*
|
||||||
row[0]: PubCod
|
row[0]: PubCod
|
||||||
row[1]: PublisherCod]
|
row[1]: PublisherCod]
|
||||||
|
|
|
@ -116,7 +116,8 @@ static void TmlNot_PutParsRemoveNote (void *Timeline);
|
||||||
static void TmlNot_RemoveNote (void);
|
static void TmlNot_RemoveNote (void);
|
||||||
static void TmlNot_RemoveNoteMediaAndDBEntries (struct TmlNot_Note *Not);
|
static void TmlNot_RemoveNoteMediaAndDBEntries (struct TmlNot_Note *Not);
|
||||||
|
|
||||||
static void TmlNot_GetDataOfNoteFromRow (MYSQL_ROW row,struct TmlNot_Note *Not);
|
static void TmlNot_GetDataOfNoteFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct TmlNot_Note *Not);
|
||||||
|
|
||||||
static TmlNot_Type_t TmlNot_GetNoteTypeFromStr (const char *Str);
|
static TmlNot_Type_t TmlNot_GetNoteTypeFromStr (const char *Str);
|
||||||
|
|
||||||
|
@ -127,7 +128,7 @@ static void TmlNot_ResetNote (struct TmlNot_Note *Not);
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void TmlNot_ShowHighlightedNote (struct Tml_Timeline *Timeline,
|
void TmlNot_ShowHighlightedNote (struct Tml_Timeline *Timeline,
|
||||||
struct TmlNot_Note *Not)
|
struct TmlNot_Note *Not)
|
||||||
{
|
{
|
||||||
struct Usr_Data PublisherDat;
|
struct Usr_Data PublisherDat;
|
||||||
Ntf_NotifyEvent_t NotifyEvent;
|
Ntf_NotifyEvent_t NotifyEvent;
|
||||||
|
@ -1195,8 +1196,13 @@ static void TmlNot_RemoveNoteMediaAndDBEntries (struct TmlNot_Note *Not)
|
||||||
/************************ Get data of note from row **************************/
|
/************************ Get data of note from row **************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void TmlNot_GetDataOfNoteFromRow (MYSQL_ROW row,struct TmlNot_Note *Not)
|
static void TmlNot_GetDataOfNoteFromRow (MYSQL_RES *mysql_res,
|
||||||
|
struct TmlNot_Note *Not)
|
||||||
{
|
{
|
||||||
|
MYSQL_ROW row;
|
||||||
|
|
||||||
|
/***** Get row *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
/*
|
/*
|
||||||
row[0]: NotCod
|
row[0]: NotCod
|
||||||
row[1]: NoteType
|
row[1]: NoteType
|
||||||
|
@ -1269,7 +1275,6 @@ static void TmlNot_ResetNote (struct TmlNot_Note *Not)
|
||||||
void TmlNot_GetDataOfNoteByCod (struct TmlNot_Note *Not)
|
void TmlNot_GetDataOfNoteByCod (struct TmlNot_Note *Not)
|
||||||
{
|
{
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
|
||||||
|
|
||||||
/***** Trivial check: note code should be > 0 *****/
|
/***** Trivial check: note code should be > 0 *****/
|
||||||
if (Not->NotCod <= 0)
|
if (Not->NotCod <= 0)
|
||||||
|
@ -1281,11 +1286,7 @@ void TmlNot_GetDataOfNoteByCod (struct TmlNot_Note *Not)
|
||||||
|
|
||||||
/***** Get data of note from database *****/
|
/***** Get data of note from database *****/
|
||||||
if (Tml_DB_GetDataOfNoteByCod (Not->NotCod,&mysql_res))
|
if (Tml_DB_GetDataOfNoteByCod (Not->NotCod,&mysql_res))
|
||||||
{
|
TmlNot_GetDataOfNoteFromRow (mysql_res,Not);
|
||||||
/* Get data of note */
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
TmlNot_GetDataOfNoteFromRow (row,Not);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
/* Reset fields of note */
|
/* Reset fields of note */
|
||||||
TmlNot_ResetNote (Not);
|
TmlNot_ResetNote (Not);
|
||||||
|
|
Loading…
Reference in New Issue