mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-04 07:45:27 +02:00
Version 20.67.1: Apr 24, 2021 Code refactoring in error messages.
This commit is contained in:
parent
890bf64be4
commit
78cdd5b982
|
@ -736,7 +736,7 @@ void Acc_CreateNewUsr (struct UsrData *UsrDat,bool CreatingMyOwnAccount)
|
||||||
char PathRelUsr[PATH_MAX + 1];
|
char PathRelUsr[PATH_MAX + 1];
|
||||||
unsigned NumID;
|
unsigned NumID;
|
||||||
|
|
||||||
/***** Check if user's code is initialized *****/
|
/***** Trivial check: user's code should be <= 0 *****/
|
||||||
if (UsrDat->UsrCod > 0)
|
if (UsrDat->UsrCod > 0)
|
||||||
Lay_ShowErrorAndExit ("Can not create new user.");
|
Lay_ShowErrorAndExit ("Can not create new user.");
|
||||||
|
|
||||||
|
|
|
@ -1178,7 +1178,7 @@ static void Agd_GetListEvents (struct Agd_Agenda *Agenda,
|
||||||
NumEvent++)
|
NumEvent++)
|
||||||
/* Get next event code */
|
/* Get next event code */
|
||||||
if ((Agenda->LstAgdCods[NumEvent] = DB_GetNextCode (mysql_res)) < 0)
|
if ((Agenda->LstAgdCods[NumEvent] = DB_GetNextCode (mysql_res)) < 0)
|
||||||
Lay_ShowErrorAndExit ("Error: wrong event code.");
|
Lay_WrongEventExit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
|
@ -1326,8 +1326,8 @@ void Agd_AskRemEvent (void)
|
||||||
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
||||||
|
|
||||||
/***** Get event code *****/
|
/***** Get event code *****/
|
||||||
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L)
|
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of event is missing.");
|
Lay_WrongEventExit ();
|
||||||
|
|
||||||
/***** Get data of the event from database *****/
|
/***** Get data of the event from database *****/
|
||||||
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
|
@ -1362,8 +1362,8 @@ void Agd_RemoveEvent (void)
|
||||||
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
||||||
|
|
||||||
/***** Get event code *****/
|
/***** Get event code *****/
|
||||||
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L)
|
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of event is missing.");
|
Lay_WrongEventExit ();
|
||||||
|
|
||||||
/***** Get data of the event from database *****/
|
/***** Get data of the event from database *****/
|
||||||
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
|
@ -1401,8 +1401,8 @@ void Agd_HideEvent (void)
|
||||||
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
||||||
|
|
||||||
/***** Get event code *****/
|
/***** Get event code *****/
|
||||||
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L)
|
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of event is missing.");
|
Lay_WrongEventExit ();
|
||||||
|
|
||||||
/***** Get data of the event from database *****/
|
/***** Get data of the event from database *****/
|
||||||
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
|
@ -1437,8 +1437,8 @@ void Agd_UnhideEvent (void)
|
||||||
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
||||||
|
|
||||||
/***** Get event code *****/
|
/***** Get event code *****/
|
||||||
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L)
|
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of event is missing.");
|
Lay_WrongEventExit ();
|
||||||
|
|
||||||
/***** Get data of the event from database *****/
|
/***** Get data of the event from database *****/
|
||||||
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
|
@ -1474,8 +1474,8 @@ void Agd_MakeEventPrivate (void)
|
||||||
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
||||||
|
|
||||||
/***** Get event code *****/
|
/***** Get event code *****/
|
||||||
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L)
|
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of event is missing.");
|
Lay_WrongEventExit ();
|
||||||
|
|
||||||
/***** Get data of the event from database *****/
|
/***** Get data of the event from database *****/
|
||||||
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
|
@ -1515,8 +1515,8 @@ void Agd_MakeEventPublic (void)
|
||||||
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
Agd_GetParams (&Agenda,Agd_MY_AGENDA);
|
||||||
|
|
||||||
/***** Get event code *****/
|
/***** Get event code *****/
|
||||||
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) == -1L)
|
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of event is missing.");
|
Lay_WrongEventExit ();
|
||||||
|
|
||||||
/***** Get data of the event from database *****/
|
/***** Get data of the event from database *****/
|
||||||
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||||
|
|
|
@ -720,7 +720,7 @@ static void Att_GetListAttEvents (struct Att_Events *Events,
|
||||||
{
|
{
|
||||||
/* Get next attendance event code */
|
/* Get next attendance event code */
|
||||||
if ((Events->Lst[NumAttEvent].AttCod = DB_GetNextCode (mysql_res)) < 0)
|
if ((Events->Lst[NumAttEvent].AttCod = DB_GetNextCode (mysql_res)) < 0)
|
||||||
Lay_ShowErrorAndExit ("Error: wrong attendance event code.");
|
Lay_WrongEventExit ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -739,10 +739,10 @@ static void Att_GetDataOfAttEventByCodAndCheckCrs (struct Att_Event *Event)
|
||||||
if (Att_GetDataOfAttEventByCod (Event))
|
if (Att_GetDataOfAttEventByCod (Event))
|
||||||
{
|
{
|
||||||
if (Event->CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
if (Event->CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||||
Lay_ShowErrorAndExit ("Attendance event does not belong to current course.");
|
Lay_WrongEventExit ();
|
||||||
}
|
}
|
||||||
else // Attendance event not found
|
else // Attendance event not found
|
||||||
Lay_ShowErrorAndExit ("Error when getting attendance event.");
|
Lay_WrongEventExit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -919,8 +919,8 @@ void Att_AskRemAttEvent (void)
|
||||||
Events.CurrentPage = Pag_GetParamPagNum (Pag_ATT_EVENTS);
|
Events.CurrentPage = Pag_GetParamPagNum (Pag_ATT_EVENTS);
|
||||||
|
|
||||||
/***** Get attendance event code *****/
|
/***** Get attendance event code *****/
|
||||||
if ((Event.AttCod = Att_GetParamAttCod ()) == -1L)
|
if ((Event.AttCod = Att_GetParamAttCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of attendance event is missing.");
|
Lay_WrongEventExit ();
|
||||||
|
|
||||||
/***** Get data of the attendance event from database *****/
|
/***** Get data of the attendance event from database *****/
|
||||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Event);
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Event);
|
||||||
|
@ -954,8 +954,8 @@ void Att_GetAndRemAttEvent (void)
|
||||||
struct Att_Event Event;
|
struct Att_Event Event;
|
||||||
|
|
||||||
/***** Get attendance event code *****/
|
/***** Get attendance event code *****/
|
||||||
if ((Event.AttCod = Att_GetParamAttCod ()) == -1L)
|
if ((Event.AttCod = Att_GetParamAttCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of attendance event is missing.");
|
Lay_WrongEventExit ();
|
||||||
|
|
||||||
/***** Get data of the attendance event from database *****/
|
/***** Get data of the attendance event from database *****/
|
||||||
// Inside this function, the course is checked to be the current one
|
// Inside this function, the course is checked to be the current one
|
||||||
|
@ -997,8 +997,8 @@ void Att_HideAttEvent (void)
|
||||||
struct Att_Event Event;
|
struct Att_Event Event;
|
||||||
|
|
||||||
/***** Get attendance event code *****/
|
/***** Get attendance event code *****/
|
||||||
if ((Event.AttCod = Att_GetParamAttCod ()) == -1L)
|
if ((Event.AttCod = Att_GetParamAttCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of attendance event is missing.");
|
Lay_WrongEventExit ();
|
||||||
|
|
||||||
/***** Get data of the attendance event from database *****/
|
/***** Get data of the attendance event from database *****/
|
||||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Event);
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Event);
|
||||||
|
@ -1025,8 +1025,8 @@ void Att_ShowAttEvent (void)
|
||||||
struct Att_Event Event;
|
struct Att_Event Event;
|
||||||
|
|
||||||
/***** Get attendance event code *****/
|
/***** Get attendance event code *****/
|
||||||
if ((Event.AttCod = Att_GetParamAttCod ()) == -1L)
|
if ((Event.AttCod = Att_GetParamAttCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of attendance event is missing.");
|
Lay_WrongEventExit ();
|
||||||
|
|
||||||
/***** Get data of the attendance event from database *****/
|
/***** Get data of the attendance event from database *****/
|
||||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Event);
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Event);
|
||||||
|
@ -1861,8 +1861,8 @@ void Att_SeeOneAttEvent (void)
|
||||||
Att_ResetEvents (&Events);
|
Att_ResetEvents (&Events);
|
||||||
|
|
||||||
/***** Get attendance event code *****/
|
/***** Get attendance event code *****/
|
||||||
if ((Events.AttCod = Att_GetParamAttCod ()) == -1L)
|
if ((Events.AttCod = Att_GetParamAttCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of attendance event is missing.");
|
Lay_WrongEventExit ();
|
||||||
|
|
||||||
/***** Show event *****/
|
/***** Show event *****/
|
||||||
Att_ShowEvent (&Events);
|
Att_ShowEvent (&Events);
|
||||||
|
@ -2306,8 +2306,8 @@ void Att_RegisterMeAsStdInAttEvent (void)
|
||||||
Att_ResetEvents (&Events);
|
Att_ResetEvents (&Events);
|
||||||
|
|
||||||
/***** Get attendance event code *****/
|
/***** Get attendance event code *****/
|
||||||
if ((Event.AttCod = Att_GetParamAttCod ()) == -1L)
|
if ((Event.AttCod = Att_GetParamAttCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of attendance event is missing.");
|
Lay_WrongEventExit ();
|
||||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Event); // This checks that event belong to current course
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Event); // This checks that event belong to current course
|
||||||
|
|
||||||
if (Event.Open)
|
if (Event.Open)
|
||||||
|
@ -2371,8 +2371,8 @@ void Att_RegisterStudentsInAttEvent (void)
|
||||||
Att_ResetEvents (&Events);
|
Att_ResetEvents (&Events);
|
||||||
|
|
||||||
/***** Get attendance event code *****/
|
/***** Get attendance event code *****/
|
||||||
if ((Event.AttCod = Att_GetParamAttCod ()) == -1L)
|
if ((Event.AttCod = Att_GetParamAttCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of attendance event is missing.");
|
Lay_WrongEventExit ();
|
||||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Event); // This checks that event belong to current course
|
Att_GetDataOfAttEventByCodAndCheckCrs (&Event); // This checks that event belong to current course
|
||||||
|
|
||||||
/***** Get groups selected *****/
|
/***** Get groups selected *****/
|
||||||
|
|
|
@ -750,7 +750,7 @@ static void Ctr_GetDataOfCenterFromRow (struct Ctr_Center *Ctr,MYSQL_ROW row)
|
||||||
{
|
{
|
||||||
/***** 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)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of center.");
|
Lay_WrongCenterExit ();
|
||||||
|
|
||||||
/***** Get institution code (row[1]) *****/
|
/***** Get institution code (row[1]) *****/
|
||||||
Ctr->InsCod = Str_ConvertStrCodToLongCod (row[1]);
|
Ctr->InsCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||||
|
@ -881,7 +881,7 @@ void Ctr_WriteSelectorOfCenter (void)
|
||||||
|
|
||||||
/* Get center code (row[0]) */
|
/* Get center code (row[0]) */
|
||||||
if ((CtrCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((CtrCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of center.");
|
Lay_WrongCenterExit ();
|
||||||
|
|
||||||
/* Write option */
|
/* Write option */
|
||||||
HTM_OPTION (HTM_Type_LONG,&CtrCod,
|
HTM_OPTION (HTM_Type_LONG,&CtrCod,
|
||||||
|
@ -1185,7 +1185,7 @@ long Ctr_GetAndCheckParamOtherCtrCod (long MinCodAllowed)
|
||||||
|
|
||||||
/***** Get and check parameter with code of center *****/
|
/***** Get and check parameter with code of center *****/
|
||||||
if ((CtrCod = Par_GetParToLong ("OthCtrCod")) < MinCodAllowed)
|
if ((CtrCod = Par_GetParToLong ("OthCtrCod")) < MinCodAllowed)
|
||||||
Lay_ShowErrorAndExit ("Code of center is missing or invalid.");
|
Lay_WrongCenterExit ();
|
||||||
|
|
||||||
return CtrCod;
|
return CtrCod;
|
||||||
}
|
}
|
||||||
|
@ -2283,7 +2283,7 @@ static void Ctr_EditingCenterConstructor (void)
|
||||||
{
|
{
|
||||||
/***** Pointer must be NULL *****/
|
/***** Pointer must be NULL *****/
|
||||||
if (Ctr_EditingCtr != NULL)
|
if (Ctr_EditingCtr != NULL)
|
||||||
Lay_ShowErrorAndExit ("Error initializing center.");
|
Lay_WrongCenterExit ();
|
||||||
|
|
||||||
/***** Allocate memory for center *****/
|
/***** Allocate memory for center *****/
|
||||||
if ((Ctr_EditingCtr = malloc (sizeof (*Ctr_EditingCtr))) == NULL)
|
if ((Ctr_EditingCtr = malloc (sizeof (*Ctr_EditingCtr))) == NULL)
|
||||||
|
|
|
@ -600,13 +600,14 @@ TODO: Salvador Romero Cort
|
||||||
|
|
||||||
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
TODO: FIX BUG, URGENT! En las fechas como parámetro Dat_WriteParamsIniEndDates(), por ejemplo al cambiar el color de la gráfica de accesos por día y hora, no se respeta la zona horaria.
|
||||||
*/
|
*/
|
||||||
#define Log_PLATFORM_VERSION "SWAD 20.67 (2021-04-24)"
|
#define Log_PLATFORM_VERSION "SWAD 20.67.1 (2021-04-24)"
|
||||||
#define CSS_FILE "swad20.45.css"
|
#define CSS_FILE "swad20.45.css"
|
||||||
#define JS_FILE "swad20.6.2.js"
|
#define JS_FILE "swad20.6.2.js"
|
||||||
/*
|
/*
|
||||||
TODO: Rename CENTRE to CENTER in help wiki.
|
TODO: Rename CENTRE to CENTER in help wiki.
|
||||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||||
|
|
||||||
|
Version 20.67.1: Apr 24, 2021 Code refactoring in error messages. (309415 lines)
|
||||||
Version 20.67: Apr 24, 2021 Bug fixing and code optimizations related to user's roles. (309356 lines)
|
Version 20.67: Apr 24, 2021 Bug fixing and code optimizations related to user's roles. (309356 lines)
|
||||||
Version 20.66.5: Apr 23, 2021 Including missing head files.
|
Version 20.66.5: Apr 23, 2021 Including missing head files.
|
||||||
Fixed bug getting my courses. (309123 lines)
|
Fixed bug getting my courses. (309123 lines)
|
||||||
|
|
|
@ -176,7 +176,7 @@ void Cht_ShowListOfAvailableChatRooms (void)
|
||||||
/* Get data of this degree */
|
/* Get data of this degree */
|
||||||
Deg.DegCod = Gbl.Usrs.Me.MyDegs.Degs[NumMyDeg].DegCod;
|
Deg.DegCod = Gbl.Usrs.Me.MyDegs.Degs[NumMyDeg].DegCod;
|
||||||
if (!Deg_GetDataOfDegreeByCod (&Deg))
|
if (!Deg_GetDataOfDegreeByCod (&Deg))
|
||||||
Lay_ShowErrorAndExit ("Degree not found.");
|
Lay_WrongDegreeExit ();
|
||||||
|
|
||||||
/* Link to the room of this degree */
|
/* Link to the room of this degree */
|
||||||
IsLastItemInLevel[1] = (NumMyDeg == Gbl.Usrs.Me.MyDegs.Num - 1);
|
IsLastItemInLevel[1] = (NumMyDeg == Gbl.Usrs.Me.MyDegs.Num - 1);
|
||||||
|
|
|
@ -786,7 +786,7 @@ void Cty_GetBasicListOfCountries (void)
|
||||||
|
|
||||||
/* Get numerical country code (row[0]) */
|
/* Get numerical country code (row[0]) */
|
||||||
if ((Cty->CtyCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Cty->CtyCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of country.");
|
Lay_WrongCountrExit ();
|
||||||
|
|
||||||
/* Get Alpha-2 country code (row[1]) */
|
/* Get Alpha-2 country code (row[1]) */
|
||||||
Str_Copy (Cty->Alpha2,row[1],sizeof (Cty->Alpha2) - 1);
|
Str_Copy (Cty->Alpha2,row[1],sizeof (Cty->Alpha2) - 1);
|
||||||
|
@ -912,7 +912,7 @@ void Cty_GetFullListOfCountries (void)
|
||||||
|
|
||||||
/* Get numerical country code (row[0]) */
|
/* Get numerical country code (row[0]) */
|
||||||
if ((Cty->CtyCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Cty->CtyCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of country.");
|
Lay_WrongCountrExit ();
|
||||||
|
|
||||||
/* Get Alpha-2 country code (row[1]) */
|
/* Get Alpha-2 country code (row[1]) */
|
||||||
Str_Copy (Cty->Alpha2,row[1],sizeof (Cty->Alpha2) - 1);
|
Str_Copy (Cty->Alpha2,row[1],sizeof (Cty->Alpha2) - 1);
|
||||||
|
@ -981,7 +981,7 @@ void Cty_WriteSelectorOfCountry (void)
|
||||||
|
|
||||||
/* Get country code (row[0]) */
|
/* Get country code (row[0]) */
|
||||||
if ((CtyCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((CtyCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of country.");
|
Lay_WrongCountrExit ();
|
||||||
|
|
||||||
/* Write option */
|
/* Write option */
|
||||||
HTM_OPTION (HTM_Type_LONG,&CtyCod,
|
HTM_OPTION (HTM_Type_LONG,&CtyCod,
|
||||||
|
@ -1302,7 +1302,7 @@ long Cty_GetAndCheckParamOtherCtyCod (long MinCodAllowed)
|
||||||
|
|
||||||
/***** Get and check parameter with code of country *****/
|
/***** Get and check parameter with code of country *****/
|
||||||
if ((CtyCod = Cty_GetParamOtherCtyCod ()) < MinCodAllowed)
|
if ((CtyCod = Cty_GetParamOtherCtyCod ()) < MinCodAllowed)
|
||||||
Lay_ShowErrorAndExit ("Code of country is missing or invalid.");
|
Lay_WrongCountrExit ();
|
||||||
|
|
||||||
return CtyCod;
|
return CtyCod;
|
||||||
}
|
}
|
||||||
|
@ -2119,7 +2119,7 @@ static void Cty_EditingCountryConstructor (void)
|
||||||
|
|
||||||
/***** Pointer must be NULL *****/
|
/***** Pointer must be NULL *****/
|
||||||
if (Cty_EditingCty != NULL)
|
if (Cty_EditingCty != NULL)
|
||||||
Lay_ShowErrorAndExit ("Error initializing country.");
|
Lay_WrongCountrExit ();
|
||||||
|
|
||||||
/***** Allocate memory for country *****/
|
/***** Allocate memory for country *****/
|
||||||
if ((Cty_EditingCty = malloc (sizeof (*Cty_EditingCty))) == NULL)
|
if ((Cty_EditingCty = malloc (sizeof (*Cty_EditingCty))) == NULL)
|
||||||
|
|
|
@ -215,7 +215,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
||||||
/***** Get data of this institution *****/
|
/***** Get data of this institution *****/
|
||||||
Hie.Cty.CtyCod = Str_ConvertStrCodToLongCod (row[0]);
|
Hie.Cty.CtyCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
if (!Cty_GetDataOfCountryByCod (&Hie.Cty))
|
if (!Cty_GetDataOfCountryByCod (&Hie.Cty))
|
||||||
Lay_ShowErrorAndExit ("Country not found.");
|
Lay_WrongCountrExit ();
|
||||||
|
|
||||||
/***** Write link to country *****/
|
/***** Write link to country *****/
|
||||||
Highlight = (Gbl.Hierarchy.Ins.InsCod <= 0 &&
|
Highlight = (Gbl.Hierarchy.Ins.InsCod <= 0 &&
|
||||||
|
@ -249,7 +249,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
||||||
/***** Get data of this institution *****/
|
/***** Get data of this institution *****/
|
||||||
Hie.Ins.InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
Hie.Ins.InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
if (!Ins_GetDataOfInstitutionByCod (&Hie.Ins))
|
if (!Ins_GetDataOfInstitutionByCod (&Hie.Ins))
|
||||||
Lay_ShowErrorAndExit ("Institution not found.");
|
Lay_WrongInstitExit ();
|
||||||
|
|
||||||
/***** Write link to institution *****/
|
/***** Write link to institution *****/
|
||||||
Highlight = (Gbl.Hierarchy.Ctr.CtrCod <= 0 &&
|
Highlight = (Gbl.Hierarchy.Ctr.CtrCod <= 0 &&
|
||||||
|
@ -283,7 +283,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
||||||
/***** Get data of this center *****/
|
/***** Get data of this center *****/
|
||||||
Hie.Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[0]);
|
Hie.Ctr.CtrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
if (!Ctr_GetDataOfCenterByCod (&Hie.Ctr))
|
if (!Ctr_GetDataOfCenterByCod (&Hie.Ctr))
|
||||||
Lay_ShowErrorAndExit ("Center not found.");
|
Lay_WrongCenterExit ();
|
||||||
|
|
||||||
/***** Write link to center *****/
|
/***** Write link to center *****/
|
||||||
Highlight = (Gbl.Hierarchy.Level == Hie_Lvl_CTR &&
|
Highlight = (Gbl.Hierarchy.Level == Hie_Lvl_CTR &&
|
||||||
|
@ -317,7 +317,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
||||||
/***** Get data of this degree *****/
|
/***** Get data of this degree *****/
|
||||||
Hie.Deg.DegCod = Str_ConvertStrCodToLongCod (row[0]);
|
Hie.Deg.DegCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
if (!Deg_GetDataOfDegreeByCod (&Hie.Deg))
|
if (!Deg_GetDataOfDegreeByCod (&Hie.Deg))
|
||||||
Lay_ShowErrorAndExit ("Degree not found.");
|
Lay_WrongDegreeExit ();
|
||||||
|
|
||||||
/***** Write link to degree *****/
|
/***** Write link to degree *****/
|
||||||
Highlight = (Gbl.Hierarchy.Level == Hie_Lvl_DEG &&
|
Highlight = (Gbl.Hierarchy.Level == Hie_Lvl_DEG &&
|
||||||
|
@ -351,7 +351,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
||||||
/***** Get data of this course *****/
|
/***** Get data of this course *****/
|
||||||
Hie.Crs.CrsCod = Str_ConvertStrCodToLongCod (row[0]);
|
Hie.Crs.CrsCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
if (!Crs_GetDataOfCourseByCod (&Hie.Crs))
|
if (!Crs_GetDataOfCourseByCod (&Hie.Crs))
|
||||||
Lay_ShowErrorAndExit ("Course not found.");
|
Lay_WrongCourseExit ();
|
||||||
|
|
||||||
/***** Write link to course *****/
|
/***** Write link to course *****/
|
||||||
Highlight = (Gbl.Hierarchy.Level == Hie_Lvl_CRS &&
|
Highlight = (Gbl.Hierarchy.Level == Hie_Lvl_CRS &&
|
||||||
|
@ -711,7 +711,7 @@ void Crs_WriteSelectorOfCourse (void)
|
||||||
|
|
||||||
/* Get course code (row[0]) */
|
/* Get course code (row[0]) */
|
||||||
if ((CrsCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((CrsCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong course.");
|
Lay_WrongCourseExit ();
|
||||||
|
|
||||||
/* Write option */
|
/* Write option */
|
||||||
HTM_OPTION (HTM_Type_LONG,&CrsCod,
|
HTM_OPTION (HTM_Type_LONG,&CrsCod,
|
||||||
|
@ -1833,7 +1833,7 @@ static void Crs_GetDataOfCourseFromRow (struct Crs_Course *Crs,MYSQL_ROW row)
|
||||||
{
|
{
|
||||||
/***** 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)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of course.");
|
Lay_WrongCourseExit ();
|
||||||
|
|
||||||
/***** Get code of degree (row[1]) *****/
|
/***** Get code of degree (row[1]) *****/
|
||||||
Crs->DegCod = Str_ConvertStrCodToLongCod (row[1]);
|
Crs->DegCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||||
|
@ -2619,7 +2619,7 @@ static long Crs_GetAndCheckParamOtherCrsCod (long MinCodAllowed)
|
||||||
|
|
||||||
/***** Get and check parameter with code of course *****/
|
/***** Get and check parameter with code of course *****/
|
||||||
if ((CrsCod = Par_GetParToLong ("OthCrsCod")) < MinCodAllowed)
|
if ((CrsCod = Par_GetParToLong ("OthCrsCod")) < MinCodAllowed)
|
||||||
Lay_ShowErrorAndExit ("Code of course is missing or invalid.");
|
Lay_WrongCourseExit ();
|
||||||
|
|
||||||
return CrsCod;
|
return CrsCod;
|
||||||
}
|
}
|
||||||
|
@ -2826,13 +2826,13 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
|
||||||
|
|
||||||
/***** Get degree code (row[0]) *****/
|
/***** Get degree code (row[0]) *****/
|
||||||
if ((Deg.DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Deg.DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of degree.");
|
Lay_WrongDegreeExit ();
|
||||||
if (!Deg_GetDataOfDegreeByCod (&Deg))
|
if (!Deg_GetDataOfDegreeByCod (&Deg))
|
||||||
Lay_ShowErrorAndExit ("Degree not found.");
|
Lay_WrongDegreeExit ();
|
||||||
|
|
||||||
/***** Get course code (row[1]) *****/
|
/***** Get course code (row[1]) *****/
|
||||||
if ((CrsCod = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
if ((CrsCod = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of course.");
|
Lay_WrongCourseExit ();
|
||||||
|
|
||||||
/***** Get number of teachers and students in this course *****/
|
/***** Get number of teachers and students in this course *****/
|
||||||
NumStds = Usr_GetNumUsrsInCrss (Hie_Lvl_CRS,CrsCod,1 << Rol_STD);
|
NumStds = Usr_GetNumUsrsInCrss (Hie_Lvl_CRS,CrsCod,1 << Rol_STD);
|
||||||
|
@ -3071,7 +3071,7 @@ static void Crs_EditingCourseConstructor (void)
|
||||||
{
|
{
|
||||||
/***** Pointer must be NULL *****/
|
/***** Pointer must be NULL *****/
|
||||||
if (Crs_EditingCrs != NULL)
|
if (Crs_EditingCrs != NULL)
|
||||||
Lay_ShowErrorAndExit ("Error initializing course.");
|
Lay_WrongCourseExit ();
|
||||||
|
|
||||||
/***** Allocate memory for course *****/
|
/***** Allocate memory for course *****/
|
||||||
if ((Crs_EditingCrs = malloc (sizeof (*Crs_EditingCrs))) == NULL)
|
if ((Crs_EditingCrs = malloc (sizeof (*Crs_EditingCrs))) == NULL)
|
||||||
|
|
|
@ -296,7 +296,7 @@ void Deg_WriteSelectorOfDegree (void)
|
||||||
|
|
||||||
/* Get degree code (row[0]) */
|
/* Get degree code (row[0]) */
|
||||||
if ((DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong degree.");
|
Lay_WrongDegreeExit ();
|
||||||
|
|
||||||
/* Write option */
|
/* Write option */
|
||||||
HTM_OPTION (HTM_Type_LONG,&DegCod,
|
HTM_OPTION (HTM_Type_LONG,&DegCod,
|
||||||
|
@ -1339,7 +1339,7 @@ long Deg_GetAndCheckParamOtherDegCod (long MinCodAllowed)
|
||||||
|
|
||||||
/***** Get and check parameter with code of degree *****/
|
/***** Get and check parameter with code of degree *****/
|
||||||
if ((DegCod = Par_GetParToLong ("OthDegCod")) < MinCodAllowed)
|
if ((DegCod = Par_GetParToLong ("OthDegCod")) < MinCodAllowed)
|
||||||
Lay_ShowErrorAndExit ("Code of degree is missing or invalid.");
|
Lay_WrongDegreeExit ();
|
||||||
|
|
||||||
return DegCod;
|
return DegCod;
|
||||||
}
|
}
|
||||||
|
@ -1404,7 +1404,7 @@ static void Deg_GetDataOfDegreeFromRow (struct Deg_Degree *Deg,MYSQL_ROW row)
|
||||||
{
|
{
|
||||||
/***** Get degree code (row[0]) *****/
|
/***** Get degree code (row[0]) *****/
|
||||||
if ((Deg->DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Deg->DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of degree.");
|
Lay_WrongDegreeExit ();
|
||||||
|
|
||||||
/***** Get center code (row[1]) *****/
|
/***** Get center code (row[1]) *****/
|
||||||
Deg->CtrCod = Str_ConvertStrCodToLongCod (row[1]);
|
Deg->CtrCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||||
|
@ -1512,7 +1512,7 @@ void Deg_RemoveDegreeCompletely (long DegCod)
|
||||||
{
|
{
|
||||||
/* Get next course */
|
/* Get next course */
|
||||||
if ((CrsCod = DB_GetNextCode (mysql_res)) < 0)
|
if ((CrsCod = DB_GetNextCode (mysql_res)) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of course.");
|
Lay_WrongCourseExit ();
|
||||||
|
|
||||||
/* Remove course */
|
/* Remove course */
|
||||||
Crs_RemoveCourseCompletely (CrsCod);
|
Crs_RemoveCourseCompletely (CrsCod);
|
||||||
|
@ -2197,7 +2197,7 @@ static void Deg_EditingDegreeConstructor (void)
|
||||||
{
|
{
|
||||||
/***** Pointer must be NULL *****/
|
/***** Pointer must be NULL *****/
|
||||||
if (Deg_EditingDeg != NULL)
|
if (Deg_EditingDeg != NULL)
|
||||||
Lay_ShowErrorAndExit ("Error initializing degree.");
|
Lay_WrongDegreeExit ();
|
||||||
|
|
||||||
/***** Allocate memory for degree *****/
|
/***** Allocate memory for degree *****/
|
||||||
if ((Deg_EditingDeg = malloc (sizeof (*Deg_EditingDeg))) == NULL)
|
if ((Deg_EditingDeg = malloc (sizeof (*Deg_EditingDeg))) == NULL)
|
||||||
|
|
|
@ -921,7 +921,7 @@ static void DT_RemoveDegreeTypeCompletely (long DegTypCod)
|
||||||
{
|
{
|
||||||
/* Get next degree */
|
/* Get next degree */
|
||||||
if ((DegCod = DB_GetNextCode (mysql_res)) < 0)
|
if ((DegCod = DB_GetNextCode (mysql_res)) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of degree.");
|
Lay_WrongDegreeExit ();
|
||||||
|
|
||||||
/* Remove degree */
|
/* Remove degree */
|
||||||
Deg_RemoveDegreeCompletely (DegCod);
|
Deg_RemoveDegreeCompletely (DegCod);
|
||||||
|
|
|
@ -395,7 +395,7 @@ static void Dpt_GetListDepartments (struct Dpt_Departments *Departments,long Ins
|
||||||
|
|
||||||
/* Get institution code (row[1]) */
|
/* Get institution code (row[1]) */
|
||||||
if ((Dpt->InsCod = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
if ((Dpt->InsCod = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of institution.");
|
Lay_WrongInstitExit ();
|
||||||
|
|
||||||
/* Get short name (row[2]), full name (row[3])
|
/* Get short name (row[2]), full name (row[3])
|
||||||
and URL (row[4]) of the department */
|
and URL (row[4]) of the department */
|
||||||
|
|
|
@ -4348,7 +4348,7 @@ static void Enr_AskIfRemAdm (bool ItsMe,Hie_Lvl_Level_t Scope,
|
||||||
Txt_Remove_USER_as_an_administrator);
|
Txt_Remove_USER_as_an_administrator);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Lay_ShowErrorAndExit ("User doesn't exist.");
|
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -863,7 +863,7 @@ void Exa_GetListExams (struct Exa_Exams *Exams,Exa_Order_t SelectedOrder)
|
||||||
/* Get next exam code (row[0]) */
|
/* Get next exam code (row[0]) */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((Exams->Lst[NumExam].ExaCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
if ((Exams->Lst[NumExam].ExaCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Error: wrong exam code.");
|
Lay_WrongExamExit ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1130,8 +1130,8 @@ void Exa_RemoveExam (void)
|
||||||
Exa_ResetExam (&Exam);
|
Exa_ResetExam (&Exam);
|
||||||
|
|
||||||
/***** Get exam code *****/
|
/***** Get exam code *****/
|
||||||
if ((Exam.ExaCod = Exa_GetParamExamCod ()) == -1L)
|
if ((Exam.ExaCod = Exa_GetParamExamCod ()) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of exam is missing.");
|
Lay_WrongExamExit ();
|
||||||
|
|
||||||
/***** Get data of the exam from database *****/
|
/***** Get data of the exam from database *****/
|
||||||
Exa_GetDataOfExamByCod (&Exam);
|
Exa_GetDataOfExamByCod (&Exam);
|
||||||
|
|
|
@ -635,11 +635,11 @@ void ExaPrn_GetPrintQuestionsFromDB (struct ExaPrn_Print *Print)
|
||||||
|
|
||||||
/* Get question code (row[0]) */
|
/* Get question code (row[0]) */
|
||||||
if ((Print->PrintedQuestions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Print->PrintedQuestions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Get set code (row[1]) */
|
/* Get set code (row[1]) */
|
||||||
if ((Print->PrintedQuestions[NumQst].SetCod = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
if ((Print->PrintedQuestions[NumQst].SetCod = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of set.");
|
Lay_WrongSetExit ();
|
||||||
|
|
||||||
/* Get score (row[2]) */
|
/* Get score (row[2]) */
|
||||||
Str_SetDecimalPointToUS (); // To get the decimal point as a dot
|
Str_SetDecimalPointToUS (); // To get the decimal point as a dot
|
||||||
|
|
|
@ -870,11 +870,11 @@ static void ExaSes_GetSessionDataFromRow (MYSQL_RES *mysql_res,
|
||||||
/***** 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)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of exam session.");
|
Lay_WrongExamSessionExit ();
|
||||||
|
|
||||||
/* Code of the exam (row[1]) */
|
/* Code of the exam (row[1]) */
|
||||||
if ((Session->ExaCod = Str_ConvertStrCodToLongCod (row[1])) <= 0)
|
if ((Session->ExaCod = Str_ConvertStrCodToLongCod (row[1])) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of exam.");
|
Lay_WrongExamExit ();
|
||||||
|
|
||||||
/* Get whether the session is hidden (row[2]) */
|
/* Get whether the session is hidden (row[2]) */
|
||||||
Session->Hidden = (row[2][0] == 'Y');
|
Session->Hidden = (row[2][0] == 'Y');
|
||||||
|
|
|
@ -785,7 +785,7 @@ static unsigned ExaSet_GetSetIndFromSetCod (long ExaCod,long SetCod)
|
||||||
" WHERE SetCod=%u"
|
" WHERE SetCod=%u"
|
||||||
" AND ExaCod=%ld", // Extra check
|
" AND ExaCod=%ld", // Extra check
|
||||||
SetCod,ExaCod))
|
SetCod,ExaCod))
|
||||||
Lay_ShowErrorAndExit ("Error: wrong set code.");
|
Lay_WrongSetExit ();
|
||||||
|
|
||||||
/***** Get set code (row[0]) *****/
|
/***** Get set code (row[0]) *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
@ -814,7 +814,7 @@ static long ExaSet_GetSetCodFromSetInd (long ExaCod,unsigned SetInd)
|
||||||
ExaCod,
|
ExaCod,
|
||||||
SetInd);
|
SetInd);
|
||||||
if (SetCod <= 0)
|
if (SetCod <= 0)
|
||||||
Lay_ShowErrorAndExit ("Error: wrong set index.");
|
Lay_WrongSetExit ();
|
||||||
|
|
||||||
return SetCod;
|
return SetCod;
|
||||||
}
|
}
|
||||||
|
@ -1323,7 +1323,7 @@ Tst_AnswerType_t ExaSet_GetQstAnswerTypeFromDB (long QstCod)
|
||||||
" FROM exa_set_questions"
|
" FROM exa_set_questions"
|
||||||
" WHERE QstCod=%ld",
|
" WHERE QstCod=%ld",
|
||||||
QstCod))
|
QstCod))
|
||||||
Lay_ShowErrorAndExit ("Question does not exist.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Get type of answer */
|
/* Get type of answer */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
@ -1464,7 +1464,7 @@ void ExaSet_GetQstDataFromDB (struct Tst_Question *Question)
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
if (!QuestionExists)
|
if (!QuestionExists)
|
||||||
Lay_ShowErrorAndExit ("Wrong question.");
|
Lay_WrongQuestionExit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1596,7 +1596,7 @@ void ExaSet_AddQstsToSet (void)
|
||||||
/* Get next code */
|
/* Get next code */
|
||||||
Par_GetNextStrUntilSeparParamMult (&Ptr,LongStr,Cns_MAX_DECIMAL_DIGITS_LONG);
|
Par_GetNextStrUntilSeparParamMult (&Ptr,LongStr,Cns_MAX_DECIMAL_DIGITS_LONG);
|
||||||
if (sscanf (LongStr,"%ld",&QstCod) != 1)
|
if (sscanf (LongStr,"%ld",&QstCod) != 1)
|
||||||
Lay_ShowErrorAndExit ("Wrong question code.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
ExaSet_CopyQstFromBankToExamSet (&Set,QstCod);
|
ExaSet_CopyQstFromBankToExamSet (&Set,QstCod);
|
||||||
}
|
}
|
||||||
|
@ -2008,7 +2008,7 @@ void ExaSet_RemoveQstFromSet (void)
|
||||||
QstCod,
|
QstCod,
|
||||||
Set.SetCod);
|
Set.SetCod);
|
||||||
if (!mysql_affected_rows (&Gbl.mysql))
|
if (!mysql_affected_rows (&Gbl.mysql))
|
||||||
Lay_ShowErrorAndExit ("The question to be removed does not exist.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/***** Write message *****/
|
/***** Write message *****/
|
||||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed);
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Question_removed);
|
||||||
|
|
|
@ -1577,7 +1577,7 @@ static unsigned Fig_GetInsAndStat (struct Ins_Instit *Ins,MYSQL_RES *mysql_res)
|
||||||
/***** Get data of this institution (row[0]) *****/
|
/***** Get data of this institution (row[0]) *****/
|
||||||
Ins->InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
Ins->InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
if (!Ins_GetDataOfInstitutionByCod (Ins))
|
if (!Ins_GetDataOfInstitutionByCod (Ins))
|
||||||
Lay_ShowErrorAndExit ("Institution not found.");
|
Lay_WrongInstitExit ();
|
||||||
|
|
||||||
/***** Get statistic (row[1]) *****/
|
/***** Get statistic (row[1]) *****/
|
||||||
if (sscanf (row[1],"%u",&NumberThisRow) != 1)
|
if (sscanf (row[1],"%u",&NumberThisRow) != 1)
|
||||||
|
|
16
swad_forum.c
16
swad_forum.c
|
@ -2215,13 +2215,13 @@ void For_SetForumName (const struct For_Forum *Forum,
|
||||||
case For_FORUM_INSTIT_USRS:
|
case For_FORUM_INSTIT_USRS:
|
||||||
Hie.Ins.InsCod = Forum->Location;
|
Hie.Ins.InsCod = Forum->Location;
|
||||||
if (!Ins_GetDataOfInstitutionByCod (&Hie.Ins))
|
if (!Ins_GetDataOfInstitutionByCod (&Hie.Ins))
|
||||||
Lay_ShowErrorAndExit ("Institution not found.");
|
Lay_WrongInstitExit ();
|
||||||
Str_Copy (ForumName,Hie.Ins.ShrtName,For_MAX_BYTES_FORUM_NAME);
|
Str_Copy (ForumName,Hie.Ins.ShrtName,For_MAX_BYTES_FORUM_NAME);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_INSTIT_TCHS:
|
case For_FORUM_INSTIT_TCHS:
|
||||||
Hie.Ins.InsCod = Forum->Location;
|
Hie.Ins.InsCod = Forum->Location;
|
||||||
if (!Ins_GetDataOfInstitutionByCod (&Hie.Ins))
|
if (!Ins_GetDataOfInstitutionByCod (&Hie.Ins))
|
||||||
Lay_ShowErrorAndExit ("Institution not found.");
|
Lay_WrongInstitExit ();
|
||||||
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,"%s%s",
|
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,"%s%s",
|
||||||
Hie.Ins.ShrtName,
|
Hie.Ins.ShrtName,
|
||||||
UseHTMLEntities ? Txt_only_teachers :
|
UseHTMLEntities ? Txt_only_teachers :
|
||||||
|
@ -2230,13 +2230,13 @@ void For_SetForumName (const struct For_Forum *Forum,
|
||||||
case For_FORUM_CENTER_USRS:
|
case For_FORUM_CENTER_USRS:
|
||||||
Hie.Ctr.CtrCod = Forum->Location;
|
Hie.Ctr.CtrCod = Forum->Location;
|
||||||
if (!Ctr_GetDataOfCenterByCod (&Hie.Ctr))
|
if (!Ctr_GetDataOfCenterByCod (&Hie.Ctr))
|
||||||
Lay_ShowErrorAndExit ("Center not found.");
|
Lay_WrongCenterExit ();
|
||||||
Str_Copy (ForumName,Hie.Ctr.ShrtName,For_MAX_BYTES_FORUM_NAME);
|
Str_Copy (ForumName,Hie.Ctr.ShrtName,For_MAX_BYTES_FORUM_NAME);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_CENTER_TCHS:
|
case For_FORUM_CENTER_TCHS:
|
||||||
Hie.Ctr.CtrCod = Forum->Location;
|
Hie.Ctr.CtrCod = Forum->Location;
|
||||||
if (!Ctr_GetDataOfCenterByCod (&Hie.Ctr))
|
if (!Ctr_GetDataOfCenterByCod (&Hie.Ctr))
|
||||||
Lay_ShowErrorAndExit ("Center not found.");
|
Lay_WrongCenterExit ();
|
||||||
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,"%s%s",
|
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,"%s%s",
|
||||||
Hie.Ctr.ShrtName,
|
Hie.Ctr.ShrtName,
|
||||||
UseHTMLEntities ? Txt_only_teachers :
|
UseHTMLEntities ? Txt_only_teachers :
|
||||||
|
@ -2245,13 +2245,13 @@ void For_SetForumName (const struct For_Forum *Forum,
|
||||||
case For_FORUM_DEGREE_USRS:
|
case For_FORUM_DEGREE_USRS:
|
||||||
Hie.Deg.DegCod = Forum->Location;
|
Hie.Deg.DegCod = Forum->Location;
|
||||||
if (!Deg_GetDataOfDegreeByCod (&Hie.Deg))
|
if (!Deg_GetDataOfDegreeByCod (&Hie.Deg))
|
||||||
Lay_ShowErrorAndExit ("Degree not found.");
|
Lay_WrongDegreeExit ();
|
||||||
Str_Copy (ForumName,Hie.Deg.ShrtName,For_MAX_BYTES_FORUM_NAME);
|
Str_Copy (ForumName,Hie.Deg.ShrtName,For_MAX_BYTES_FORUM_NAME);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_DEGREE_TCHS:
|
case For_FORUM_DEGREE_TCHS:
|
||||||
Hie.Deg.DegCod = Forum->Location;
|
Hie.Deg.DegCod = Forum->Location;
|
||||||
if (!Deg_GetDataOfDegreeByCod (&Hie.Deg))
|
if (!Deg_GetDataOfDegreeByCod (&Hie.Deg))
|
||||||
Lay_ShowErrorAndExit ("Degree not found.");
|
Lay_WrongDegreeExit ();
|
||||||
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,"%s%s",
|
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,"%s%s",
|
||||||
Hie.Deg.ShrtName,
|
Hie.Deg.ShrtName,
|
||||||
UseHTMLEntities ? Txt_only_teachers :
|
UseHTMLEntities ? Txt_only_teachers :
|
||||||
|
@ -2260,13 +2260,13 @@ void For_SetForumName (const struct For_Forum *Forum,
|
||||||
case For_FORUM_COURSE_USRS:
|
case For_FORUM_COURSE_USRS:
|
||||||
Hie.Crs.CrsCod = Forum->Location;
|
Hie.Crs.CrsCod = Forum->Location;
|
||||||
if (!Crs_GetDataOfCourseByCod (&Hie.Crs))
|
if (!Crs_GetDataOfCourseByCod (&Hie.Crs))
|
||||||
Lay_ShowErrorAndExit ("Course not found.");
|
Lay_WrongCourseExit ();
|
||||||
Str_Copy (ForumName,Hie.Crs.ShrtName,For_MAX_BYTES_FORUM_NAME);
|
Str_Copy (ForumName,Hie.Crs.ShrtName,For_MAX_BYTES_FORUM_NAME);
|
||||||
break;
|
break;
|
||||||
case For_FORUM_COURSE_TCHS:
|
case For_FORUM_COURSE_TCHS:
|
||||||
Hie.Crs.CrsCod = Forum->Location;
|
Hie.Crs.CrsCod = Forum->Location;
|
||||||
if (!Crs_GetDataOfCourseByCod (&Hie.Crs))
|
if (!Crs_GetDataOfCourseByCod (&Hie.Crs))
|
||||||
Lay_ShowErrorAndExit ("Course not found.");
|
Lay_WrongCourseExit ();
|
||||||
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,"%s%s",
|
snprintf (ForumName,For_MAX_BYTES_FORUM_NAME + 1,"%s%s",
|
||||||
Hie.Crs.ShrtName,
|
Hie.Crs.ShrtName,
|
||||||
UseHTMLEntities ? Txt_only_teachers :
|
UseHTMLEntities ? Txt_only_teachers :
|
||||||
|
|
36
swad_game.c
36
swad_game.c
|
@ -469,7 +469,7 @@ void Gam_SeeOneGame (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
|
||||||
/***** Show game *****/
|
/***** Show game *****/
|
||||||
|
@ -929,7 +929,7 @@ void Gam_GetListGames (struct Gam_Games *Games,Gam_Order_t SelectedOrder)
|
||||||
/* Get next game code (row[0]) */
|
/* Get next game code (row[0]) */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((Games->Lst[NumGame].GamCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
if ((Games->Lst[NumGame].GamCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Error: wrong game code.");
|
Lay_WrongGameExit ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1154,7 +1154,7 @@ void Gam_AskRemGame (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
|
|
||||||
/***** Get data of the game from database *****/
|
/***** Get data of the game from database *****/
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
@ -1190,8 +1190,8 @@ void Gam_RemoveGame (void)
|
||||||
Gam_ResetGame (&Game);
|
Gam_ResetGame (&Game);
|
||||||
|
|
||||||
/***** Get game code *****/
|
/***** Get game code *****/
|
||||||
if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L)
|
if ((Game.GamCod = Gam_GetParamGameCod ()) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
|
|
||||||
/***** Get data of the game from database *****/
|
/***** Get data of the game from database *****/
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
@ -1273,7 +1273,7 @@ void Gam_HideGame (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
|
|
||||||
/***** Get data of the game from database *****/
|
/***** Get data of the game from database *****/
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
@ -1308,7 +1308,7 @@ void Gam_UnhideGame (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
|
|
||||||
/***** Get data of the game from database *****/
|
/***** Get data of the game from database *****/
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
@ -1366,7 +1366,7 @@ void Gam_ListGame (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
|
|
||||||
/***** Get game data *****/
|
/***** Get game data *****/
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
@ -1738,7 +1738,7 @@ void Gam_ReqSelectQstsToAddToGame (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
|
||||||
/***** Check if game has matches *****/
|
/***** Check if game has matches *****/
|
||||||
|
@ -1772,7 +1772,7 @@ void Gam_ListQstsToAddToGame (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
|
||||||
/***** Check if game has matches *****/
|
/***** Check if game has matches *****/
|
||||||
|
@ -2170,7 +2170,7 @@ void Gam_AddQstsToGame (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
|
||||||
/***** Check if game has matches *****/
|
/***** Check if game has matches *****/
|
||||||
|
@ -2196,7 +2196,7 @@ void Gam_AddQstsToGame (void)
|
||||||
/* Get next code */
|
/* Get next code */
|
||||||
Par_GetNextStrUntilSeparParamMult (&Ptr,LongStr,Cns_MAX_DECIMAL_DIGITS_LONG);
|
Par_GetNextStrUntilSeparParamMult (&Ptr,LongStr,Cns_MAX_DECIMAL_DIGITS_LONG);
|
||||||
if (sscanf (LongStr,"%ld",&QstCod) != 1)
|
if (sscanf (LongStr,"%ld",&QstCod) != 1)
|
||||||
Lay_ShowErrorAndExit ("Wrong question code.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Check if question is already present in game */
|
/* Check if question is already present in game */
|
||||||
if (Gam_GetQstIndFromQstCod (Game.GamCod,QstCod) == 0) // This question is not yet in this game
|
if (Gam_GetQstIndFromQstCod (Game.GamCod,QstCod) == 0) // This question is not yet in this game
|
||||||
|
@ -2283,7 +2283,7 @@ void Gam_RequestRemoveQstFromGame (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
|
||||||
/***** Check if game has matches *****/
|
/***** Check if game has matches *****/
|
||||||
|
@ -2327,7 +2327,7 @@ void Gam_RemoveQstFromGame (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
|
||||||
/***** Check if game has matches *****/
|
/***** Check if game has matches *****/
|
||||||
|
@ -2349,7 +2349,7 @@ void Gam_RemoveQstFromGame (void)
|
||||||
Game.GamCod,
|
Game.GamCod,
|
||||||
QstInd);
|
QstInd);
|
||||||
if (!mysql_affected_rows (&Gbl.mysql))
|
if (!mysql_affected_rows (&Gbl.mysql))
|
||||||
Lay_ShowErrorAndExit ("The question to be removed does not exist.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Change index of questions greater than this */
|
/* Change index of questions greater than this */
|
||||||
DB_QueryUPDATE ("can not update indexes of questions in table of answers",
|
DB_QueryUPDATE ("can not update indexes of questions in table of answers",
|
||||||
|
@ -2398,7 +2398,7 @@ void Gam_MoveUpQst (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
|
||||||
/***** Check if game has matches *****/
|
/***** Check if game has matches *****/
|
||||||
|
@ -2449,7 +2449,7 @@ void Gam_MoveDownQst (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
|
||||||
/***** Check if game has matches *****/
|
/***** Check if game has matches *****/
|
||||||
|
@ -2599,7 +2599,7 @@ void Gam_RequestNewMatch (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
|
||||||
/***** Show game *****/
|
/***** Show game *****/
|
||||||
|
|
|
@ -3219,7 +3219,7 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
|
||||||
|
|
||||||
/* Get the code of the course (row[1]) */
|
/* Get the code of the course (row[1]) */
|
||||||
if ((GrpDat->CrsCod = Str_ConvertStrCodToLongCod (row[1])) <= 0)
|
if ((GrpDat->CrsCod = Str_ConvertStrCodToLongCod (row[1])) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of course.");
|
Lay_WrongCourseExit ();
|
||||||
|
|
||||||
/* Get the name of the group type (row[2]) */
|
/* Get the name of the group type (row[2]) */
|
||||||
Str_Copy (GrpDat->GrpTypName,row[2],sizeof (GrpDat->GrpTypName) - 1);
|
Str_Copy (GrpDat->GrpTypName,row[2],sizeof (GrpDat->GrpTypName) - 1);
|
||||||
|
|
|
@ -723,7 +723,7 @@ static void Ind_GetNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1
|
||||||
|
|
||||||
/* Get course code (row[2]) */
|
/* Get course code (row[2]) */
|
||||||
if ((CrsCod = Str_ConvertStrCodToLongCod (row[2])) < 0)
|
if ((CrsCod = Str_ConvertStrCodToLongCod (row[2])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of course.");
|
Lay_WrongCourseExit ();
|
||||||
|
|
||||||
/* Get stored number of indicators of this course */
|
/* Get stored number of indicators of this course */
|
||||||
NumIndicators = Ind_GetAndUpdateNumIndicatorsCrs (CrsCod);
|
NumIndicators = Ind_GetAndUpdateNumIndicatorsCrs (CrsCod);
|
||||||
|
@ -991,7 +991,7 @@ static void Ind_ShowTableOfCoursesWithIndicators (const struct Ind_Indicators *I
|
||||||
|
|
||||||
/* Get course code (row[2]) */
|
/* Get course code (row[2]) */
|
||||||
if ((CrsCod = Str_ConvertStrCodToLongCod (row[2])) < 0)
|
if ((CrsCod = Str_ConvertStrCodToLongCod (row[2])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of course.");
|
Lay_WrongCourseExit ();
|
||||||
|
|
||||||
/* Get stored number of indicators of this course */
|
/* Get stored number of indicators of this course */
|
||||||
NumIndicators = Ind_GetAndUpdateNumIndicatorsCrs (CrsCod);
|
NumIndicators = Ind_GetAndUpdateNumIndicatorsCrs (CrsCod);
|
||||||
|
|
|
@ -835,7 +835,7 @@ static void Ins_GetDataOfInstitFromRow (struct Ins_Instit *Ins,MYSQL_ROW row)
|
||||||
{
|
{
|
||||||
/***** 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)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of institution.");
|
Lay_WrongInstitExit ();
|
||||||
|
|
||||||
/***** Get country code (row[1]) *****/
|
/***** Get country code (row[1]) *****/
|
||||||
Ins->CtyCod = Str_ConvertStrCodToLongCod (row[1]);
|
Ins->CtyCod = Str_ConvertStrCodToLongCod (row[1]);
|
||||||
|
@ -1030,7 +1030,7 @@ void Ins_WriteSelectorOfInstitution (void)
|
||||||
|
|
||||||
/* Get institution code (row[0]) */
|
/* Get institution code (row[0]) */
|
||||||
if ((InsCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((InsCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of institution.");
|
Lay_WrongInstitExit ();
|
||||||
|
|
||||||
/* Write option */
|
/* Write option */
|
||||||
HTM_OPTION (HTM_Type_LONG,&InsCod,
|
HTM_OPTION (HTM_Type_LONG,&InsCod,
|
||||||
|
@ -1314,7 +1314,7 @@ long Ins_GetAndCheckParamOtherInsCod (long MinCodAllowed)
|
||||||
|
|
||||||
/***** Get and check parameter with code of institution *****/
|
/***** Get and check parameter with code of institution *****/
|
||||||
if ((InsCod = Ins_GetParamOtherInsCod ()) < MinCodAllowed)
|
if ((InsCod = Ins_GetParamOtherInsCod ()) < MinCodAllowed)
|
||||||
Lay_ShowErrorAndExit ("Code of institution is missing or invalid.");
|
Lay_WrongInstitExit ();
|
||||||
|
|
||||||
return InsCod;
|
return InsCod;
|
||||||
}
|
}
|
||||||
|
@ -2174,7 +2174,7 @@ static void Ins_EditingInstitutionConstructor (void)
|
||||||
{
|
{
|
||||||
/***** Pointer must be NULL *****/
|
/***** Pointer must be NULL *****/
|
||||||
if (Ins_EditingIns != NULL)
|
if (Ins_EditingIns != NULL)
|
||||||
Lay_ShowErrorAndExit ("Error initializing institution.");
|
Lay_WrongInstitExit ();
|
||||||
|
|
||||||
/***** Allocate memory for institution *****/
|
/***** Allocate memory for institution *****/
|
||||||
if ((Ins_EditingIns = malloc (sizeof (*Ins_EditingIns))) == NULL)
|
if ((Ins_EditingIns = malloc (sizeof (*Ins_EditingIns))) == NULL)
|
||||||
|
|
|
@ -1387,6 +1387,36 @@ void Lay_WrongScopeExit (void)
|
||||||
Lay_ShowErrorAndExit ("Wrong scope.");
|
Lay_ShowErrorAndExit ("Wrong scope.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********* Write error message and exit *********/
|
||||||
|
/********* when wrong country, institution, center, degree or course *********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Lay_WrongCountrExit (void)
|
||||||
|
{
|
||||||
|
Lay_ShowErrorAndExit ("Wrong country.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lay_WrongInstitExit (void)
|
||||||
|
{
|
||||||
|
Lay_ShowErrorAndExit ("Wrong institution.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lay_WrongCenterExit (void)
|
||||||
|
{
|
||||||
|
Lay_ShowErrorAndExit ("Wrong center.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lay_WrongDegreeExit (void)
|
||||||
|
{
|
||||||
|
Lay_ShowErrorAndExit ("Wrong degree.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lay_WrongCourseExit (void)
|
||||||
|
{
|
||||||
|
Lay_ShowErrorAndExit ("Wrong course.");
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************* Write error message and exit when wrong order *****************/
|
/************* Write error message and exit when wrong order *****************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1441,6 +1471,15 @@ void Lay_WrongSetExit (void)
|
||||||
Lay_ShowErrorAndExit ("Wrong set of questions.");
|
Lay_ShowErrorAndExit ("Wrong set of questions.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************* Write error message and exit when wrong question **************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Lay_WrongQuestionExit (void)
|
||||||
|
{
|
||||||
|
Lay_ShowErrorAndExit ("Wrong question.");
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********** Write error message and exit when wrong exam session ************/
|
/*********** Write error message and exit when wrong exam session ************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1450,6 +1489,20 @@ void Lay_WrongExamSessionExit (void)
|
||||||
Lay_ShowErrorAndExit ("Wrong exam session.");
|
Lay_ShowErrorAndExit ("Wrong exam session.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************ Write error message and exit when wrong game/match *************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Lay_WrongGameExit (void)
|
||||||
|
{
|
||||||
|
Lay_ShowErrorAndExit ("Wrong game.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void Lay_WrongMatchExit (void)
|
||||||
|
{
|
||||||
|
Lay_ShowErrorAndExit ("Wrong match.");
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*** Write error message and exit when wrong parameter "who" (which users) ***/
|
/*** Write error message and exit when wrong parameter "who" (which users) ***/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -1459,6 +1512,15 @@ void Lay_WrongWhoExit (void)
|
||||||
Lay_ShowErrorAndExit ("Wrong parameter who.");
|
Lay_ShowErrorAndExit ("Wrong parameter who.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**************** Write error message and exit when wrong event **************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void Lay_WrongEventExit (void)
|
||||||
|
{
|
||||||
|
Lay_ShowErrorAndExit ("Wrong event.");
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/************ Write error message and exit when user does not exists *********/
|
/************ Write error message and exit when user does not exists *********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -71,14 +71,23 @@ void Lay_PutContextualCheckbox (Act_Action_t NextAction,
|
||||||
|
|
||||||
void Lay_NotEnoughMemoryExit (void);
|
void Lay_NotEnoughMemoryExit (void);
|
||||||
void Lay_WrongScopeExit (void);
|
void Lay_WrongScopeExit (void);
|
||||||
|
void Lay_WrongCountrExit (void);
|
||||||
|
void Lay_WrongInstitExit (void);
|
||||||
|
void Lay_WrongCenterExit (void);
|
||||||
|
void Lay_WrongDegreeExit (void);
|
||||||
|
void Lay_WrongCourseExit (void);
|
||||||
void Lay_WrongOrderExit (void);
|
void Lay_WrongOrderExit (void);
|
||||||
void Lay_WrongTypeOfViewExit (void);
|
void Lay_WrongTypeOfViewExit (void);
|
||||||
void Lay_WrongProjectExit (void);
|
void Lay_WrongProjectExit (void);
|
||||||
void Lay_WrongCallForExamExit (void);
|
void Lay_WrongCallForExamExit (void);
|
||||||
void Lay_WrongExamExit (void);
|
void Lay_WrongExamExit (void);
|
||||||
void Lay_WrongSetExit (void);
|
void Lay_WrongSetExit (void);
|
||||||
|
void Lay_WrongQuestionExit (void);
|
||||||
void Lay_WrongExamSessionExit (void);
|
void Lay_WrongExamSessionExit (void);
|
||||||
|
void Lay_WrongGameExit (void);
|
||||||
|
void Lay_WrongMatchExit (void);
|
||||||
void Lay_WrongWhoExit (void);
|
void Lay_WrongWhoExit (void);
|
||||||
|
void Lay_WrongEventExit (void);
|
||||||
void Lay_WrongUserExit (void);
|
void Lay_WrongUserExit (void);
|
||||||
void Lay_NoPermissionExit (void);
|
void Lay_NoPermissionExit (void);
|
||||||
void Lay_ShowErrorAndExit (const char *Txt);
|
void Lay_ShowErrorAndExit (const char *Txt);
|
||||||
|
|
24
swad_match.c
24
swad_match.c
|
@ -1014,11 +1014,11 @@ static void Mch_GetMatchDataFromRow (MYSQL_RES *mysql_res,
|
||||||
/***** Get match data *****/
|
/***** Get match data *****/
|
||||||
/* Code of the match (row[0]) */
|
/* Code of the match (row[0]) */
|
||||||
if ((Match->MchCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
if ((Match->MchCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of match.");
|
Lay_WrongMatchExit ();
|
||||||
|
|
||||||
/* Code of the game (row[1]) */
|
/* Code of the game (row[1]) */
|
||||||
if ((Match->GamCod = Str_ConvertStrCodToLongCod (row[1])) <= 0)
|
if ((Match->GamCod = Str_ConvertStrCodToLongCod (row[1])) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of game.");
|
Lay_WrongGameExit ();
|
||||||
|
|
||||||
/* Get match teacher (row[2]) */
|
/* Get match teacher (row[2]) */
|
||||||
Match->UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
Match->UsrCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||||
|
@ -1409,20 +1409,20 @@ void Mch_GetAndCheckParameters (struct Gam_Games *Games,
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
/* Get parameters of game */
|
/* Get parameters of game */
|
||||||
if ((Game->GamCod = Gam_GetParams (Games)) <= 0)
|
if ((Game->GamCod = Gam_GetParams (Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
Grp_GetParamWhichGroups ();
|
Grp_GetParamWhichGroups ();
|
||||||
Gam_GetDataOfGameByCod (Game);
|
Gam_GetDataOfGameByCod (Game);
|
||||||
|
|
||||||
/* Get match code */
|
/* Get match code */
|
||||||
if ((Match->MchCod = Mch_GetParamMchCod ()) <= 0)
|
if ((Match->MchCod = Mch_GetParamMchCod ()) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of match is missing.");
|
Lay_WrongMatchExit ();
|
||||||
Mch_GetDataOfMatchByCod (Match);
|
Mch_GetDataOfMatchByCod (Match);
|
||||||
|
|
||||||
/***** Ensure parameters are correct *****/
|
/***** Ensure parameters are correct *****/
|
||||||
if (Game->GamCod != Match->GamCod)
|
if (Game->GamCod != Match->GamCod)
|
||||||
Lay_ShowErrorAndExit ("Wrong game code.");
|
Lay_WrongGameExit ();
|
||||||
if (Game->CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
if (Game->CrsCod != Gbl.Hierarchy.Crs.CrsCod)
|
||||||
Lay_ShowErrorAndExit ("Match does not belong to this course.");
|
Lay_WrongGameExit ();
|
||||||
|
|
||||||
/***** Initialize context *****/
|
/***** Initialize context *****/
|
||||||
Games->GamCod = Game->GamCod;
|
Games->GamCod = Game->GamCod;
|
||||||
|
@ -1624,8 +1624,8 @@ void Mch_CreateNewMatch (void)
|
||||||
|
|
||||||
/***** Get form parameters *****/
|
/***** Get form parameters *****/
|
||||||
/* Get match code */
|
/* Get match code */
|
||||||
if ((GamCod = Gam_GetParamGameCod ()) == -1L)
|
if ((GamCod = Gam_GetParamGameCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
|
|
||||||
/* Get match title */
|
/* Get match title */
|
||||||
Par_GetParToText ("Title",Title,Mch_MAX_BYTES_TITLE);
|
Par_GetParToText ("Title",Title,Mch_MAX_BYTES_TITLE);
|
||||||
|
@ -1830,7 +1830,7 @@ static void Mch_CreateIndexes (long GamCod,long MchCod)
|
||||||
|
|
||||||
/* Get question code (row[0]) */
|
/* Get question code (row[0]) */
|
||||||
if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Get question index (row[1]) */
|
/* Get question index (row[1]) */
|
||||||
if ((LongNum = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
if ((LongNum = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
||||||
|
@ -3921,7 +3921,7 @@ void Mch_GetMatchBeingPlayed (void)
|
||||||
|
|
||||||
/***** Get match code ****/
|
/***** Get match code ****/
|
||||||
if ((MchCodBeingPlayed = Mch_GetParamMchCod ()) <= 0)
|
if ((MchCodBeingPlayed = Mch_GetParamMchCod ()) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of match is missing.");
|
Lay_WrongMatchExit ();
|
||||||
|
|
||||||
Mch_SetMchCodBeingPlayed (MchCodBeingPlayed);
|
Mch_SetMchCodBeingPlayed (MchCodBeingPlayed);
|
||||||
}
|
}
|
||||||
|
@ -4314,11 +4314,11 @@ void Mch_GetMatchQuestionsFromDB (struct MchPrn_Print *Print)
|
||||||
|
|
||||||
/* Get question code (row[0]) */
|
/* Get question code (row[0]) */
|
||||||
if ((Print->PrintedQuestions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Print->PrintedQuestions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Get question index (row[1]) */
|
/* Get question index (row[1]) */
|
||||||
if ((LongNum = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
if ((LongNum = Str_ConvertStrCodToLongCod (row[1])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
QstInd = (unsigned) LongNum;
|
QstInd = (unsigned) LongNum;
|
||||||
|
|
||||||
/* Get indexes for this question (row[2]) */
|
/* Get indexes for this question (row[2]) */
|
||||||
|
|
|
@ -169,7 +169,7 @@ void MchRes_ShowMyMchResultsInGam (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
|
||||||
/***** Game begin *****/
|
/***** Game begin *****/
|
||||||
|
@ -219,9 +219,9 @@ void MchRes_ShowMyMchResultsInMch (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
if ((Match.MchCod = Mch_GetParamMchCod ()) <= 0)
|
if ((Match.MchCod = Mch_GetParamMchCod ()) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of match is missing.");
|
Lay_WrongMatchExit ();
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
Mch_GetDataOfMatchByCod (&Match);
|
Mch_GetDataOfMatchByCod (&Match);
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ void MchRes_ShowAllMchResultsInGam (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
|
|
||||||
/***** Game begin *****/
|
/***** Game begin *****/
|
||||||
|
@ -462,9 +462,9 @@ void MchRes_ShowAllMchResultsInMch (void)
|
||||||
|
|
||||||
/***** Get parameters *****/
|
/***** Get parameters *****/
|
||||||
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
if ((Game.GamCod = Gam_GetParams (&Games)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of game is missing.");
|
Lay_WrongGameExit ();
|
||||||
if ((Match.MchCod = Mch_GetParamMchCod ()) <= 0)
|
if ((Match.MchCod = Mch_GetParamMchCod ()) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Code of match is missing.");
|
Lay_WrongMatchExit ();
|
||||||
Gam_GetDataOfGameByCod (&Game);
|
Gam_GetDataOfGameByCod (&Game);
|
||||||
Mch_GetDataOfMatchByCod (&Match);
|
Mch_GetDataOfMatchByCod (&Match);
|
||||||
|
|
||||||
|
@ -883,7 +883,7 @@ static void MchRes_ShowMchResults (struct Gam_Games *Games,
|
||||||
/* Get match code */
|
/* Get match code */
|
||||||
MchPrn_ResetPrint (&Print);
|
MchPrn_ResetPrint (&Print);
|
||||||
if ((Print.MchCod = DB_GetNextCode (mysql_res)) < 0)
|
if ((Print.MchCod = DB_GetNextCode (mysql_res)) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of match.");
|
Lay_WrongMatchExit ();
|
||||||
|
|
||||||
/* Get match result data */
|
/* Get match result data */
|
||||||
Print.UsrCod = UsrDat->UsrCod;
|
Print.UsrCod = UsrDat->UsrCod;
|
||||||
|
|
|
@ -2135,7 +2135,7 @@ static void Pho_ShowOrPrintClassPhotoDegrees (struct Pho_DegPhotos *DegPhotos,
|
||||||
{
|
{
|
||||||
/***** Get next degree *****/
|
/***** Get next degree *****/
|
||||||
if ((Deg.DegCod = DB_GetNextCode (mysql_res)) < 0)
|
if ((Deg.DegCod = DB_GetNextCode (mysql_res)) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of degree.");
|
Lay_WrongDegreeExit ();
|
||||||
|
|
||||||
/* Get data of degree */
|
/* Get data of degree */
|
||||||
Deg_GetDataOfDegreeByCod (&Deg);
|
Deg_GetDataOfDegreeByCod (&Deg);
|
||||||
|
@ -2232,7 +2232,7 @@ static void Pho_ShowOrPrintListDegrees (struct Pho_DegPhotos *DegPhotos,
|
||||||
|
|
||||||
/* Get degree code (row[0]) */
|
/* Get degree code (row[0]) */
|
||||||
if ((Deg.DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Deg.DegCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of degree.");
|
Lay_WrongDegreeExit ();
|
||||||
|
|
||||||
/* Get data of degree */
|
/* Get data of degree */
|
||||||
Deg_GetDataOfDegreeByCod (&Deg);
|
Deg_GetDataOfDegreeByCod (&Deg);
|
||||||
|
|
|
@ -1282,7 +1282,7 @@ void Svy_GetDataOfSurveyByCod (struct Svy_Survey *Svy)
|
||||||
|
|
||||||
/* Get survey scope (row[1]) */
|
/* Get survey scope (row[1]) */
|
||||||
if ((Svy->Scope = Sco_GetScopeFromDBStr (row[1])) == Hie_Lvl_UNK)
|
if ((Svy->Scope = Sco_GetScopeFromDBStr (row[1])) == Hie_Lvl_UNK)
|
||||||
Lay_ShowErrorAndExit ("Wrong survey scope.");
|
Lay_WrongScopeExit ();
|
||||||
|
|
||||||
/* Get code of the country, institution, center, degree or course (row[2]) */
|
/* Get code of the country, institution, center, degree or course (row[2]) */
|
||||||
Svy->Cod = Str_ConvertStrCodToLongCod (row[2]);
|
Svy->Cod = Str_ConvertStrCodToLongCod (row[2]);
|
||||||
|
@ -1320,7 +1320,7 @@ void Svy_GetDataOfSurveyByCod (struct Svy_Survey *Svy)
|
||||||
switch (Svy->Scope)
|
switch (Svy->Scope)
|
||||||
{
|
{
|
||||||
case Hie_Lvl_UNK: // Unknown
|
case Hie_Lvl_UNK: // Unknown
|
||||||
Lay_ShowErrorAndExit ("Wrong survey scope.");
|
Lay_WrongScopeExit ();
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_SYS: // System
|
case Hie_Lvl_SYS: // System
|
||||||
Svy->Status.IBelongToScope = Gbl.Usrs.Me.Logged;
|
Svy->Status.IBelongToScope = Gbl.Usrs.Me.Logged;
|
||||||
|
@ -2226,41 +2226,41 @@ void Svy_ReceiveFormSurvey (void)
|
||||||
{
|
{
|
||||||
case Hie_Lvl_SYS:
|
case Hie_Lvl_SYS:
|
||||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
||||||
Lay_ShowErrorAndExit ("Wrong survey scope.");
|
Lay_WrongScopeExit ();
|
||||||
NewSvy.Scope = Hie_Lvl_SYS;
|
NewSvy.Scope = Hie_Lvl_SYS;
|
||||||
NewSvy.Cod = -1L;
|
NewSvy.Cod = -1L;
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_CTY:
|
case Hie_Lvl_CTY:
|
||||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
||||||
Lay_ShowErrorAndExit ("Wrong survey scope.");
|
Lay_WrongScopeExit ();
|
||||||
NewSvy.Scope = Hie_Lvl_CTY;
|
NewSvy.Scope = Hie_Lvl_CTY;
|
||||||
NewSvy.Cod = Gbl.Hierarchy.Cty.CtyCod;
|
NewSvy.Cod = Gbl.Hierarchy.Cty.CtyCod;
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_INS:
|
case Hie_Lvl_INS:
|
||||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
||||||
Gbl.Usrs.Me.Role.Logged != Rol_INS_ADM)
|
Gbl.Usrs.Me.Role.Logged != Rol_INS_ADM)
|
||||||
Lay_ShowErrorAndExit ("Wrong survey scope.");
|
Lay_WrongScopeExit ();
|
||||||
NewSvy.Scope = Hie_Lvl_INS;
|
NewSvy.Scope = Hie_Lvl_INS;
|
||||||
NewSvy.Cod = Gbl.Hierarchy.Ins.InsCod;
|
NewSvy.Cod = Gbl.Hierarchy.Ins.InsCod;
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_CTR:
|
case Hie_Lvl_CTR:
|
||||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
||||||
Gbl.Usrs.Me.Role.Logged != Rol_CTR_ADM)
|
Gbl.Usrs.Me.Role.Logged != Rol_CTR_ADM)
|
||||||
Lay_ShowErrorAndExit ("Wrong survey scope.");
|
Lay_WrongScopeExit ();
|
||||||
NewSvy.Scope = Hie_Lvl_CTR;
|
NewSvy.Scope = Hie_Lvl_CTR;
|
||||||
NewSvy.Cod = Gbl.Hierarchy.Ctr.CtrCod;
|
NewSvy.Cod = Gbl.Hierarchy.Ctr.CtrCod;
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_DEG:
|
case Hie_Lvl_DEG:
|
||||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
||||||
Gbl.Usrs.Me.Role.Logged != Rol_DEG_ADM)
|
Gbl.Usrs.Me.Role.Logged != Rol_DEG_ADM)
|
||||||
Lay_ShowErrorAndExit ("Wrong survey scope.");
|
Lay_WrongScopeExit ();
|
||||||
NewSvy.Scope = Hie_Lvl_DEG;
|
NewSvy.Scope = Hie_Lvl_DEG;
|
||||||
NewSvy.Cod = Gbl.Hierarchy.Deg.DegCod;
|
NewSvy.Cod = Gbl.Hierarchy.Deg.DegCod;
|
||||||
break;
|
break;
|
||||||
case Hie_Lvl_CRS:
|
case Hie_Lvl_CRS:
|
||||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM &&
|
||||||
Gbl.Usrs.Me.Role.Logged != Rol_TCH)
|
Gbl.Usrs.Me.Role.Logged != Rol_TCH)
|
||||||
Lay_ShowErrorAndExit ("Wrong survey scope.");
|
Lay_WrongScopeExit ();
|
||||||
NewSvy.Scope = Hie_Lvl_CRS;
|
NewSvy.Scope = Hie_Lvl_CRS;
|
||||||
NewSvy.Cod = Gbl.Hierarchy.Crs.CrsCod;
|
NewSvy.Cod = Gbl.Hierarchy.Crs.CrsCod;
|
||||||
break;
|
break;
|
||||||
|
@ -3700,7 +3700,7 @@ void Svy_RequestRemoveQst (void)
|
||||||
|
|
||||||
/* Get question code */
|
/* Get question code */
|
||||||
if ((SvyQst.QstCod = Svy_GetParamQstCod ()) < 0)
|
if ((SvyQst.QstCod = Svy_GetParamQstCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Get question index */
|
/* Get question index */
|
||||||
SvyQst.QstInd = Svy_GetQstIndFromQstCod (SvyQst.QstCod);
|
SvyQst.QstInd = Svy_GetQstIndFromQstCod (SvyQst.QstCod);
|
||||||
|
@ -3742,7 +3742,7 @@ void Svy_RemoveQst (void)
|
||||||
|
|
||||||
/* Get question code */
|
/* Get question code */
|
||||||
if ((SvyQst.QstCod = Svy_GetParamQstCod ()) < 0)
|
if ((SvyQst.QstCod = Svy_GetParamQstCod ()) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Get question index */
|
/* Get question index */
|
||||||
SvyQst.QstInd = Svy_GetQstIndFromQstCod (SvyQst.QstCod);
|
SvyQst.QstInd = Svy_GetQstIndFromQstCod (SvyQst.QstCod);
|
||||||
|
@ -3757,7 +3757,7 @@ void Svy_RemoveQst (void)
|
||||||
" WHERE QstCod=%ld",
|
" WHERE QstCod=%ld",
|
||||||
SvyQst.QstCod);
|
SvyQst.QstCod);
|
||||||
if (!mysql_affected_rows (&Gbl.mysql))
|
if (!mysql_affected_rows (&Gbl.mysql))
|
||||||
Lay_ShowErrorAndExit ("The question to be removed does not exist.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Change index of questions greater than this */
|
/* Change index of questions greater than this */
|
||||||
DB_QueryUPDATE ("can not update indexes of questions",
|
DB_QueryUPDATE ("can not update indexes of questions",
|
||||||
|
@ -3844,7 +3844,7 @@ static void Svy_ReceiveAndStoreUserAnswersToASurvey (long SvyCod)
|
||||||
{
|
{
|
||||||
/* Get next question */
|
/* Get next question */
|
||||||
if ((QstCod = DB_GetNextCode (mysql_res)) <= 0)
|
if ((QstCod = DB_GetNextCode (mysql_res)) <= 0)
|
||||||
Lay_ShowErrorAndExit ("Error: wrong question code.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Get possible parameter with the user's answer */
|
/* Get possible parameter with the user's answer */
|
||||||
snprintf (ParamName,sizeof (ParamName),"Ans%010u",(unsigned) QstCod);
|
snprintf (ParamName,sizeof (ParamName),"Ans%010u",(unsigned) QstCod);
|
||||||
|
|
20
swad_test.c
20
swad_test.c
|
@ -2169,7 +2169,7 @@ static void Tst_ListOneOrMoreQuestionsForEdition (struct Tst_Test *Test,
|
||||||
/***** Get question code (row[0]) *****/
|
/***** Get question code (row[0]) *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((Test->Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Test->Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/***** Write question row *****/
|
/***** Write question row *****/
|
||||||
Tst_WriteQuestionListing (Test,NumQst);
|
Tst_WriteQuestionListing (Test,NumQst);
|
||||||
|
@ -2432,7 +2432,7 @@ static void Tst_ListOneOrMoreQuestionsForSelectionForSet (struct Exa_Exams *Exam
|
||||||
/* Get question code (row[0]) */
|
/* Get question code (row[0]) */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Write question row */
|
/* Write question row */
|
||||||
Tst_WriteQuestionRowForSelection (NumQst,&Question);
|
Tst_WriteQuestionRowForSelection (NumQst,&Question);
|
||||||
|
@ -2517,7 +2517,7 @@ static void Tst_ListOneOrMoreQuestionsForSelectionForGame (struct Gam_Games *Gam
|
||||||
/* Get question code (row[0]) */
|
/* Get question code (row[0]) */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Question.QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Write question row */
|
/* Write question row */
|
||||||
Tst_WriteQuestionRowForSelection (NumQst,&Question);
|
Tst_WriteQuestionRowForSelection (NumQst,&Question);
|
||||||
|
@ -3148,7 +3148,7 @@ unsigned Tst_CountNumQuestionsInList (const char *ListQuestions)
|
||||||
{
|
{
|
||||||
Par_GetNextStrUntilSeparParamMult (&Ptr,LongStr,Cns_MAX_DECIMAL_DIGITS_LONG);
|
Par_GetNextStrUntilSeparParamMult (&Ptr,LongStr,Cns_MAX_DECIMAL_DIGITS_LONG);
|
||||||
if (sscanf (LongStr,"%ld",&QstCod) != 1)
|
if (sscanf (LongStr,"%ld",&QstCod) != 1)
|
||||||
Lay_ShowErrorAndExit ("Wrong question code.");
|
Lay_WrongQuestionExit ();
|
||||||
NumQuestions++;
|
NumQuestions++;
|
||||||
}
|
}
|
||||||
return NumQuestions;
|
return NumQuestions;
|
||||||
|
@ -4530,7 +4530,7 @@ bool Tst_CheckIfQuestionExistsInDB (struct Tst_Question *Question)
|
||||||
{
|
{
|
||||||
/* Get question code */
|
/* Get question code */
|
||||||
if ((Question->QstCod = DB_GetNextCode (mysql_res_qst)) < 0)
|
if ((Question->QstCod = DB_GetNextCode (mysql_res_qst)) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Get answers from this question */
|
/* Get answers from this question */
|
||||||
NumOptsExistingQstInDB =
|
NumOptsExistingQstInDB =
|
||||||
|
@ -4714,7 +4714,7 @@ void Tst_RemoveSelectedQsts (void)
|
||||||
/* Get question code (row[0]) */
|
/* Get question code (row[0]) */
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Remove test question from database */
|
/* Remove test question from database */
|
||||||
Tst_RemoveOneQstFromDB (Gbl.Hierarchy.Crs.CrsCod,QstCod);
|
Tst_RemoveOneQstFromDB (Gbl.Hierarchy.Crs.CrsCod,QstCod);
|
||||||
|
@ -4759,7 +4759,7 @@ void Tst_RequestRemoveOneQst (void)
|
||||||
/* Get the question code */
|
/* Get the question code */
|
||||||
Test.Question.QstCod = Tst_GetParamQstCod ();
|
Test.Question.QstCod = Tst_GetParamQstCod ();
|
||||||
if (Test.Question.QstCod <= 0)
|
if (Test.Question.QstCod <= 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Get a parameter that indicates whether it's necessary
|
/* Get a parameter that indicates whether it's necessary
|
||||||
to continue listing the rest of questions */
|
to continue listing the rest of questions */
|
||||||
|
@ -4820,7 +4820,7 @@ void Tst_RemoveOneQst (void)
|
||||||
/***** Get the question code *****/
|
/***** Get the question code *****/
|
||||||
QstCod = Tst_GetParamQstCod ();
|
QstCod = Tst_GetParamQstCod ();
|
||||||
if (QstCod <= 0)
|
if (QstCod <= 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/***** Get a parameter that indicates whether it's necessary
|
/***** Get a parameter that indicates whether it's necessary
|
||||||
to continue listing the rest of questions ******/
|
to continue listing the rest of questions ******/
|
||||||
|
@ -4862,7 +4862,7 @@ static void Tst_RemoveOneQstFromDB (long CrsCod,long QstCod)
|
||||||
CrsCod);
|
CrsCod);
|
||||||
|
|
||||||
if (!mysql_affected_rows (&Gbl.mysql))
|
if (!mysql_affected_rows (&Gbl.mysql))
|
||||||
Lay_ShowErrorAndExit ("Wrong question.");
|
Lay_WrongQuestionExit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -4883,7 +4883,7 @@ void Tst_ChangeShuffleQst (void)
|
||||||
/***** Get the question code *****/
|
/***** Get the question code *****/
|
||||||
Test.Question.QstCod = Tst_GetParamQstCod ();
|
Test.Question.QstCod = Tst_GetParamQstCod ();
|
||||||
if (Test.Question.QstCod <= 0)
|
if (Test.Question.QstCod <= 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/***** Get a parameter that indicates whether it's necessary to continue listing the rest of questions ******/
|
/***** Get a parameter that indicates whether it's necessary to continue listing the rest of questions ******/
|
||||||
EditingOnlyThisQst = Par_GetParToBool ("OnlyThisQst");
|
EditingOnlyThisQst = Par_GetParToBool ("OnlyThisQst");
|
||||||
|
|
|
@ -309,7 +309,7 @@ void TstPrn_ShowTestPrintToFillIt (struct TstPrn_Print *Print,
|
||||||
|
|
||||||
/* Show question */
|
/* Show question */
|
||||||
if (!Tst_GetQstDataFromDB (&Question)) // Question exists
|
if (!Tst_GetQstDataFromDB (&Question)) // Question exists
|
||||||
Lay_ShowErrorAndExit ("Wrong question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Write question and answers */
|
/* Write question and answers */
|
||||||
TstPrn_WriteQstAndAnsToFill (&Print->PrintedQuestions[NumQst],NumQst,&Question);
|
TstPrn_WriteQstAndAnsToFill (&Print->PrintedQuestions[NumQst],NumQst,&Question);
|
||||||
|
@ -2782,7 +2782,7 @@ void TstPrn_GetPrintQuestionsFromDB (struct TstPrn_Print *Print)
|
||||||
|
|
||||||
/* Get question code (row[0]) */
|
/* Get question code (row[0]) */
|
||||||
if ((Print->PrintedQuestions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
if ((Print->PrintedQuestions[NumQst].QstCod = Str_ConvertStrCodToLongCod (row[0])) < 0)
|
||||||
Lay_ShowErrorAndExit ("Wrong code of question.");
|
Lay_WrongQuestionExit ();
|
||||||
|
|
||||||
/* Get score (row[1]) */
|
/* Get score (row[1]) */
|
||||||
Str_SetDecimalPointToUS (); // To get the decimal point as a dot
|
Str_SetDecimalPointToUS (); // To get the decimal point as a dot
|
||||||
|
|
Loading…
Reference in New Issue
Block a user