Version 16.129

This commit is contained in:
Antonio Cañas Vargas 2017-01-28 20:32:50 +01:00
parent 0bfae295e3
commit 4b8bf39c6c
37 changed files with 140 additions and 330 deletions

View File

@ -1039,11 +1039,8 @@ static void Agd_PutParamAgdCod (long AgdCod)
long Agd_GetParamAgdCod (void) long Agd_GetParamAgdCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of event *****/
return Par_GetParToLong ("AgdCod");
/***** Get parameter with code of event *****/
Par_GetParToText ("AgdCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -387,12 +387,10 @@ static void Ann_PutParams (void)
static long Ann_GetParamAnnCod (void) static long Ann_GetParamAnnCod (void)
{ {
char LongStr[1 + 10 + 1]; // String that holds the announcement code
long AnnCod; long AnnCod;
/* Get announcement code */ /***** Get announcement code *****/
Par_GetParToText ("AnnCod",LongStr,1 + 10); if ((AnnCod = Par_GetParToLong ("AnnCod")) <= 0)
if (sscanf (LongStr,"%ld",&AnnCod) != 1)
Lay_ShowErrorAndExit ("Wrong code of announcement."); Lay_ShowErrorAndExit ("Wrong code of announcement.");
return AnnCod; return AnnCod;

View File

@ -929,11 +929,8 @@ static void Asg_PutParamAsgCod (long AsgCod)
long Asg_GetParamAsgCod (void) long Asg_GetParamAsgCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of assignment *****/
return Par_GetParToLong ("AsgCod");
/***** Get parameter with code of assignment *****/
Par_GetParToText ("AsgCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -893,11 +893,8 @@ void Att_PutParamAttCod (long AttCod)
long Att_GetParamAttCod (void) long Att_GetParamAttCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of attendance event *****/
return Par_GetParToLong ("AttCod");
/***** Get parameter with code of attendance event *****/
Par_GetParToText ("AttCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1280,7 +1277,6 @@ void Att_RecFormAttEvent (void)
extern const char *Txt_The_event_has_been_modified; extern const char *Txt_The_event_has_been_modified;
struct AttendanceEvent OldAtt; struct AttendanceEvent OldAtt;
struct AttendanceEvent ReceivedAtt; struct AttendanceEvent ReceivedAtt;
char YN[1 + 1];
bool ItsANewAttEvent; bool ItsANewAttEvent;
bool ReceivedAttEventIsCorrect = true; bool ReceivedAttEventIsCorrect = true;
char Txt[Cns_MAX_BYTES_TEXT + 1]; char Txt[Cns_MAX_BYTES_TEXT + 1];
@ -1301,8 +1297,7 @@ void Att_RecFormAttEvent (void)
ReceivedAtt.TimeUTC[Att_END_TIME ] = Dat_GetTimeUTCFromForm ("EndTimeUTC" ); ReceivedAtt.TimeUTC[Att_END_TIME ] = Dat_GetTimeUTCFromForm ("EndTimeUTC" );
/***** Get boolean parameter that indicates if teacher's comments are visible by students *****/ /***** Get boolean parameter that indicates if teacher's comments are visible by students *****/
Par_GetParToText ("ComTchVisible",YN,1); ReceivedAtt.CommentTchVisible = Par_GetParToBool ("ComTchVisible");
ReceivedAtt.CommentTchVisible = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/***** Get attendance event title *****/ /***** Get attendance event title *****/
Par_GetParToText ("Title",ReceivedAtt.Title,Att_MAX_LENGTH_ATTENDANCE_EVENT_TITLE); Par_GetParToText ("Title",ReceivedAtt.Title,Att_MAX_LENGTH_ATTENDANCE_EVENT_TITLE);
@ -2719,14 +2714,12 @@ void Usr_PrintMyAttendanceCrs (void)
static void Usr_ListOrPrintMyAttendanceCrs (Att_TypeOfView_t TypeOfView) static void Usr_ListOrPrintMyAttendanceCrs (Att_TypeOfView_t TypeOfView)
{ {
unsigned NumAttEvent; unsigned NumAttEvent;
char YN[1 + 1];
/***** Get list of attendance events *****/ /***** Get list of attendance events *****/
Att_GetListAttEvents (Att_OLDEST_FIRST); Att_GetListAttEvents (Att_OLDEST_FIRST);
/***** Get boolean parameter that indicates if details must be shown *****/ /***** Get boolean parameter that indicates if details must be shown *****/
Par_GetParToText ("ShowDetails",YN,1); Gbl.AttEvents.ShowDetails = Par_GetParToBool ("ShowDetails");
Gbl.AttEvents.ShowDetails = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/***** Get list of groups selected ******/ /***** Get list of groups selected ******/
Grp_GetParCodsSeveralGrpsToShowUsrs (); Grp_GetParCodsSeveralGrpsToShowUsrs ();
@ -2785,7 +2778,6 @@ static void Usr_ListOrPrintStdsAttendanceCrs (Att_TypeOfView_t TypeOfView)
unsigned NumStdsInList; unsigned NumStdsInList;
long *LstSelectedUsrCods; long *LstSelectedUsrCods;
unsigned NumAttEvent; unsigned NumAttEvent;
char YN[1 + 1];
/***** Get list of attendance events *****/ /***** Get list of attendance events *****/
Att_GetListAttEvents (Att_OLDEST_FIRST); Att_GetListAttEvents (Att_OLDEST_FIRST);
@ -2797,8 +2789,7 @@ static void Usr_ListOrPrintStdsAttendanceCrs (Att_TypeOfView_t TypeOfView)
if ((NumStdsInList = Usr_CountNumUsrsInListOfSelectedUsrs ())) if ((NumStdsInList = Usr_CountNumUsrsInListOfSelectedUsrs ()))
{ {
/***** Get boolean parameter that indicates if details must be shown *****/ /***** Get boolean parameter that indicates if details must be shown *****/
Par_GetParToText ("ShowDetails",YN,1); Gbl.AttEvents.ShowDetails = Par_GetParToBool ("ShowDetails");
Gbl.AttEvents.ShowDetails = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/***** Get list of groups selected ******/ /***** Get list of groups selected ******/
Grp_GetParCodsSeveralGrpsToShowUsrs (); Grp_GetParCodsSeveralGrpsToShowUsrs ();

View File

@ -423,11 +423,8 @@ static void Ban_PutParamBanCod (long BanCod)
long Ban_GetParamBanCod (void) long Ban_GetParamBanCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of banner *****/
return Par_GetParToLong ("BanCod");
/***** Get parameter with code of banner *****/
Par_GetParToText ("BanCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -94,7 +94,6 @@ static Ctr_StatusTxt_t Ctr_GetStatusTxtFromStatusBits (Ctr_Status_t Status);
static Ctr_Status_t Ctr_GetStatusBitsFromStatusTxt (Ctr_StatusTxt_t StatusTxt); static Ctr_Status_t Ctr_GetStatusBitsFromStatusTxt (Ctr_StatusTxt_t StatusTxt);
static void Ctr_PutParamOtherCtrCod (long CtrCod); static void Ctr_PutParamOtherCtrCod (long CtrCod);
static long Ctr_GetParamOtherCtrCod (void);
static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod); static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod);
static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName); static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName);
@ -1670,21 +1669,12 @@ long Ctr_GetAndCheckParamOtherCtrCod (void)
long CtrCod; long CtrCod;
/***** Get and check parameter with code of centre *****/ /***** Get and check parameter with code of centre *****/
if ((CtrCod = Ctr_GetParamOtherCtrCod ()) < 0) if ((CtrCod = Par_GetParToLong ("OthCtrCod")) <= 0)
Lay_ShowErrorAndExit ("Code of centre is missing."); Lay_ShowErrorAndExit ("Code of centre is missing.");
return CtrCod; return CtrCod;
} }
static long Ctr_GetParamOtherCtrCod (void)
{
char LongStr[1 + 10 + 1];
/***** Get parameter with code of centre *****/
Par_GetParToText ("OthCtrCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
}
/*****************************************************************************/ /*****************************************************************************/
/******************************* Remove a centre *****************************/ /******************************* Remove a centre *****************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -191,13 +191,15 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.127.3 (2017-01-28)" #define Log_PLATFORM_VERSION "SWAD 16.129 (2017-01-28)"
#define CSS_FILE "swad16.123.css" #define CSS_FILE "swad16.123.css"
#define JS_FILE "swad16.123.js" #define JS_FILE "swad16.123.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/* /*
Version 16.129: Jan 28, 2017 Code refactoring in Y/N parameters. (211974 lines)
Version 16.128: Jan 28, 2017 Code refactoring in long parameters. (212037 lines)
Version 16.127.3: Jan 28, 2017 Fixed bug in permissions to change another user's data. (212127 lines) Version 16.127.3: Jan 28, 2017 Fixed bug in permissions to change another user's data. (212127 lines)
Version 16.127.2: Jan 28, 2017 Fixed bug creating a new account. (212124 lines) Version 16.127.2: Jan 28, 2017 Fixed bug creating a new account. (212124 lines)
Version 16.127.1: Jan 28, 2017 Fixed bug in listing of users. (212125 lines) Version 16.127.1: Jan 28, 2017 Fixed bug in listing of users. (212125 lines)

View File

@ -1601,11 +1601,8 @@ long Cty_GetAndCheckParamOtherCtyCod (void)
static long Cty_GetParamOtherCtyCod (void) static long Cty_GetParamOtherCtyCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of country *****/
return Par_GetParToLong ("OthCtyCod");
/***** Get parameter with code of country *****/
Par_GetParToText ("OthCtyCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -120,7 +120,6 @@ static void Sch_PutLinkToSearchCoursesParams (void);
static void Crs_PutParamOtherCrsCod (long CrsCod); static void Crs_PutParamOtherCrsCod (long CrsCod);
static long Crs_GetAndCheckParamOtherCrsCod (void); static long Crs_GetAndCheckParamOtherCrsCod (void);
static long Crs_GetParamOtherCrsCod (void);
static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnAccepted); static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnAccepted);
@ -2977,21 +2976,12 @@ static long Crs_GetAndCheckParamOtherCrsCod (void)
long CrsCod; long CrsCod;
/***** Get and check parameter with code of course *****/ /***** Get and check parameter with code of course *****/
if ((CrsCod = Crs_GetParamOtherCrsCod ()) < 0) if ((CrsCod = Par_GetParToLong ("OthCrsCod")) <= 0)
Lay_ShowErrorAndExit ("Code of course is missing."); Lay_ShowErrorAndExit ("Code of course is missing.");
return CrsCod; return CrsCod;
} }
static long Crs_GetParamOtherCrsCod (void)
{
char LongStr[1 + 10 + 1];
/***** Get parameter with code of course *****/
Par_GetParToText ("OthCrsCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
}
/*****************************************************************************/ /*****************************************************************************/
/************************** Write courses of a user **************************/ /************************** Write courses of a user **************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -519,11 +519,8 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id,
time_t Dat_GetTimeUTCFromForm (const char *ParamName) time_t Dat_GetTimeUTCFromForm (const char *ParamName)
{ {
char LongStr[1 + 10 + 1];
/**** Get time ****/ /**** Get time ****/
Par_GetParToText (ParamName,LongStr,1 + 10); return Par_GetParToLong (ParamName);
return Dat_GetUNIXTimeFromStr (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -102,7 +102,6 @@ static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg);
static void Deg_RecFormRequestOrCreateDeg (unsigned Status); static void Deg_RecFormRequestOrCreateDeg (unsigned Status);
static void Deg_PutParamOtherDegCod (long DegCod); static void Deg_PutParamOtherDegCod (long DegCod);
static long Deg_GetParamOtherDegCod (void);
static void Deg_GetDataOfDegreeFromRow (struct Degree *Deg,MYSQL_ROW row); static void Deg_GetDataOfDegreeFromRow (struct Degree *Deg,MYSQL_ROW row);
static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFullName); static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFullName);
@ -1652,21 +1651,12 @@ long Deg_GetAndCheckParamOtherDegCod (void)
long DegCod; long DegCod;
/***** Get and check parameter with code of degree *****/ /***** Get and check parameter with code of degree *****/
if ((DegCod = Deg_GetParamOtherDegCod ()) < 0) if ((DegCod = Par_GetParToLong ("OthDegCod")) <= 0)
Lay_ShowErrorAndExit ("Code of degree is missing."); Lay_ShowErrorAndExit ("Code of degree is missing.");
return DegCod; return DegCod;
} }
static long Deg_GetParamOtherDegCod (void)
{
char LongStr[1 + 10 + 1];
/***** Get parameter with code of degree *****/
Par_GetParToText ("OthDegCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
}
/*****************************************************************************/ /*****************************************************************************/
/********************* Get data of a degree from its code ********************/ /********************* Get data of a degree from its code ********************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -598,11 +598,8 @@ static void DT_PutParamOtherDegTypCod (long DegTypCod)
long DT_GetParamOtherDegTypCod (void) long DT_GetParamOtherDegTypCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of degree type *****/
return Par_GetParToLong ("OthDegTypCod");
/***** Get parameter with code of degree type *****/
Par_GetParToText ("OthDegTypCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -616,11 +616,8 @@ static void Dpt_PutParamDptCod (long DptCod)
long Dpt_GetParamDptCod (void) long Dpt_GetParamDptCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of department *****/
return Par_GetParToLong ("DptCod");
/***** Get parameter with code of department *****/
Par_GetParToText ("DptCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1611,11 +1611,8 @@ void Exa_PutHiddenParamExaCod (long ExaCod)
static long Exa_GetParamExaCod (void) static long Exa_GetParamExaCod (void)
{ {
char LongStr[1 + 10 + 1]; // String that holds the exam announcement code
/* Get notice code */ /* Get notice code */
Par_GetParToText ("ExaCod",LongStr,1 + 10); return Par_GetParToLong ("ExaCod");
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -2413,11 +2413,8 @@ void Brw_PutHiddenParamFilCod (long FilCod)
long Brw_GetParamFilCod (void) long Brw_GetParamFilCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of file *****/
return Par_GetParToLong ("FilCod");
/***** Get parameter with code of file *****/
Par_GetParToText ("FilCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4705,10 +4702,7 @@ void Brw_PutHiddenParamFullTreeIfSelected (void)
static bool Brw_GetFullTreeFromForm (void) static bool Brw_GetFullTreeFromForm (void)
{ {
char YN[1 + 1]; return Par_GetParToBool ("FullTree");
Par_GetParToText ("FullTree",YN,1);
return (Str_ConvertToUpperLetter (YN[0]) == 'Y');
} }
/*****************************************************************************/ /*****************************************************************************/
@ -9867,10 +9861,7 @@ void Brw_ChgFileMetadata (void)
static bool Brw_GetParamPublicFile (void) static bool Brw_GetParamPublicFile (void)
{ {
char YN[1 + 1]; return Par_GetParToBool ("PublicFile");
Par_GetParToText ("PublicFile",YN,1);
return (Str_ConvertToUpperLetter (YN[0]) == 'Y');
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -3729,7 +3729,6 @@ void For_GetParamsForum (void)
{ {
char UnsignedStr[10 + 1]; char UnsignedStr[10 + 1];
unsigned UnsignedNum; unsigned UnsignedNum;
char LongStr[1 + 10 + 1];
/***** Get which forums I want to see *****/ /***** Get which forums I want to see *****/
Par_GetParToText ("WhichForum",UnsignedStr,10); Par_GetParToText ("WhichForum",UnsignedStr,10);
@ -3746,23 +3745,19 @@ void For_GetParamsForum (void)
Gbl.Forum.SelectedOrderType = For_DEFAULT_ORDER; Gbl.Forum.SelectedOrderType = For_DEFAULT_ORDER;
/***** Get parameter with code of institution *****/ /***** Get parameter with code of institution *****/
Par_GetParToText ("ForInsCod",LongStr,1 + 10); Gbl.Forum.Ins.InsCod = Par_GetParToLong ("ForInsCod");
Gbl.Forum.Ins.InsCod = Str_ConvertStrCodToLongCod (LongStr);
Ins_GetDataOfInstitutionByCod (&Gbl.Forum.Ins,Ins_GET_BASIC_DATA); Ins_GetDataOfInstitutionByCod (&Gbl.Forum.Ins,Ins_GET_BASIC_DATA);
/***** Get parameter with code of institution *****/ /***** Get parameter with code of institution *****/
Par_GetParToText ("ForCtrCod",LongStr,1 + 10); Gbl.Forum.Ctr.CtrCod = Par_GetParToLong ("ForCtrCod");
Gbl.Forum.Ctr.CtrCod = Str_ConvertStrCodToLongCod (LongStr);
Ctr_GetDataOfCentreByCod (&Gbl.Forum.Ctr); Ctr_GetDataOfCentreByCod (&Gbl.Forum.Ctr);
/***** Get parameter with code of degree *****/ /***** Get parameter with code of degree *****/
Par_GetParToText ("ForDegCod",LongStr,1 + 10); Gbl.Forum.Deg.DegCod = Par_GetParToLong ("ForDegCod");
Gbl.Forum.Deg.DegCod = Str_ConvertStrCodToLongCod (LongStr);
Deg_GetDataOfDegreeByCod (&Gbl.Forum.Deg); Deg_GetDataOfDegreeByCod (&Gbl.Forum.Deg);
/***** Get parameter with code of course *****/ /***** Get parameter with code of course *****/
Par_GetParToText ("ForCrsCod",LongStr,1 + 10); Gbl.Forum.Crs.CrsCod = Par_GetParToLong ("ForCrsCod");
Gbl.Forum.Crs.CrsCod = Str_ConvertStrCodToLongCod (LongStr);
Crs_GetDataOfCourseByCod (&Gbl.Forum.Crs); Crs_GetDataOfCourseByCod (&Gbl.Forum.Crs);
} }
@ -3781,12 +3776,10 @@ void For_PutHiddenParamThrCod (long ThrCod)
static long For_GetParamThrCod (void) static long For_GetParamThrCod (void)
{ {
char StrThrCod[1 + 10 + 1]; // String that holds the thread code
long ThrCod; long ThrCod;
/* Get thread code */ /***** Get thread code *****/
Par_GetParToText ("ThrCod",StrThrCod,1 + 10); if ((ThrCod = Par_GetParToLong ("ThrCod")) <= 0)
if (sscanf (StrThrCod,"%ld",&ThrCod) != 1)
Lay_ShowErrorAndExit ("Wrong thread code."); Lay_ShowErrorAndExit ("Wrong thread code.");
return ThrCod; return ThrCod;
@ -3807,12 +3800,10 @@ static void For_PutHiddenParamPstCod (long PstCod)
static long For_GetParamPstCod (void) static long For_GetParamPstCod (void)
{ {
char StrPstCod[1 + 10 + 1]; // String that holds the post code
long PstCod; long PstCod;
/* Get post code */ /***** Get post code *****/
Par_GetParToText ("PstCod",StrPstCod,1 + 10); if ((PstCod = Par_GetParToLong ("PstCod")) <= 0)
if (sscanf (StrPstCod,"%ld",&PstCod) != 1)
Lay_ShowErrorAndExit ("Wrong post code."); Lay_ShowErrorAndExit ("Wrong post code.");
return PstCod; return PstCod;

View File

@ -342,7 +342,6 @@ void Grp_PutParamsCodGrps (void)
void Grp_GetParCodsSeveralGrpsToShowUsrs (void) void Grp_GetParCodsSeveralGrpsToShowUsrs (void)
{ {
char YN[1 + 1];
struct ListCodGrps LstGrpsIBelong; struct ListCodGrps LstGrpsIBelong;
unsigned NumGrp; unsigned NumGrp;
@ -350,8 +349,7 @@ void Grp_GetParCodsSeveralGrpsToShowUsrs (void)
return; return;
/***** Get boolean parameter that indicates if all groups must be listed *****/ /***** Get boolean parameter that indicates if all groups must be listed *****/
Par_GetParToText ("AllGroups",YN,1); Gbl.Usrs.ClassPhoto.AllGroups = Par_GetParToBool ("AllGroups");
Gbl.Usrs.ClassPhoto.AllGroups = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/***** Get parameter with list of groups selected *****/ /***** Get parameter with list of groups selected *****/
Grp_GetParCodsSeveralGrps (); Grp_GetParCodsSeveralGrps ();
@ -3084,19 +3082,16 @@ void Grp_RecFormNewGrpTyp (void)
{ {
extern const char *Txt_The_type_of_group_X_already_exists; extern const char *Txt_The_type_of_group_X_already_exists;
extern const char *Txt_You_must_specify_the_name_of_the_new_type_of_group; extern const char *Txt_You_must_specify_the_name_of_the_new_type_of_group;
char YN[1 + 1];
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the name of group type */ /* Get the name of group type */
Par_GetParToText ("GrpTypName",Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,Grp_MAX_LENGTH_GROUP_TYPE_NAME); Par_GetParToText ("GrpTypName",Gbl.CurrentCrs.Grps.GrpTyp.GrpTypName,Grp_MAX_LENGTH_GROUP_TYPE_NAME);
/* Get whether it is mandatory to regisrer in any group of this type */ /* Get whether it is mandatory to regisrer in any group of this type */
Par_GetParToText ("MandatoryEnrollment",YN,1); Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrollment = Par_GetParToBool ("MandatoryEnrollment");
Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrollment = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/* Get whether it is possible to register in multiple groups of this type */ /* Get whether it is possible to register in multiple groups of this type */
Par_GetParToText ("MultipleEnrollment",YN,1); Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrollment = Par_GetParToBool ("MultipleEnrollment");
Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrollment = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/* Get open time */ /* Get open time */
Gbl.CurrentCrs.Grps.GrpTyp.OpenTimeUTC = Dat_GetTimeUTCFromForm ("OpenTimeUTC"); Gbl.CurrentCrs.Grps.GrpTyp.OpenTimeUTC = Dat_GetTimeUTCFromForm ("OpenTimeUTC");
@ -3691,7 +3686,6 @@ void Grp_ChangeMandatGrpTyp (void)
extern const char *Txt_The_enrollment_of_students_into_groups_of_type_X_is_now_mandatory; extern const char *Txt_The_enrollment_of_students_into_groups_of_type_X_is_now_mandatory;
extern const char *Txt_The_enrollment_of_students_into_groups_of_type_X_is_now_voluntary; extern const char *Txt_The_enrollment_of_students_into_groups_of_type_X_is_now_voluntary;
char Query[1024]; char Query[1024];
char YN[1 + 1];
bool NewMandatoryEnrollment; bool NewMandatoryEnrollment;
/***** Get parameters of the form *****/ /***** Get parameters of the form *****/
@ -3700,8 +3694,7 @@ void Grp_ChangeMandatGrpTyp (void)
Lay_ShowErrorAndExit ("Code of type of group is missing."); Lay_ShowErrorAndExit ("Code of type of group is missing.");
/* Get the new type of enrollment (mandatory or voluntaria) of this type of group */ /* Get the new type of enrollment (mandatory or voluntaria) of this type of group */
Par_GetParToText ("MandatoryEnrollment",YN,1); NewMandatoryEnrollment = Par_GetParToBool ("MandatoryEnrollment");
NewMandatoryEnrollment = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/* Get from the database the name of the type and the old type of enrollment */ /* Get from the database the name of the type and the old type of enrollment */
Grp_GetDataOfGroupTypeByCod (&Gbl.CurrentCrs.Grps.GrpTyp); Grp_GetDataOfGroupTypeByCod (&Gbl.CurrentCrs.Grps.GrpTyp);
@ -3746,7 +3739,6 @@ void Grp_ChangeMultiGrpTyp (void)
extern const char *Txt_Now_each_student_can_belong_to_multiple_groups_of_type_X; extern const char *Txt_Now_each_student_can_belong_to_multiple_groups_of_type_X;
extern const char *Txt_Now_each_student_can_only_belong_to_a_group_of_type_X; extern const char *Txt_Now_each_student_can_only_belong_to_a_group_of_type_X;
char Query[1024]; char Query[1024];
char YN[1 + 1];
bool NewMultipleEnrollment; bool NewMultipleEnrollment;
/***** Get parameters from the form *****/ /***** Get parameters from the form *****/
@ -3755,8 +3747,7 @@ void Grp_ChangeMultiGrpTyp (void)
Lay_ShowErrorAndExit ("Code of type of group is missing."); Lay_ShowErrorAndExit ("Code of type of group is missing.");
/* Get the new type of enrollment (single or multiple) of this type of group */ /* Get the new type of enrollment (single or multiple) of this type of group */
Par_GetParToText ("MultipleEnrollment",YN,1); NewMultipleEnrollment = Par_GetParToBool ("MultipleEnrollment");
NewMultipleEnrollment = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/* Get from the database the name of the type and the old type of enrollment */ /* Get from the database the name of the type and the old type of enrollment */
Grp_GetDataOfGroupTypeByCod (&Gbl.CurrentCrs.Grps.GrpTyp); Grp_GetDataOfGroupTypeByCod (&Gbl.CurrentCrs.Grps.GrpTyp);
@ -4064,11 +4055,8 @@ void Grp_RenameGroup (void)
static long Grp_GetParamGrpTypCod (void) static long Grp_GetParamGrpTypCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of group type *****/
return Par_GetParToLong ("GrpTypCod");
/***** Get parameter with code of group type *****/
Par_GetParToText ("GrpTypCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -4077,11 +4065,8 @@ static long Grp_GetParamGrpTypCod (void)
static long Grp_GetParamGrpCod (void) static long Grp_GetParamGrpCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get group code *****/
return Par_GetParToLong ("GrpCod");
/***** Get parameter with group code *****/
Par_GetParToText ("GrpCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -622,11 +622,8 @@ static void Hld_PutParamHldCod (long HldCod)
long Hld_GetParamHldCod (void) long Hld_GetParamHldCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of holiday *****/
return Par_GetParToLong ("HldCod");
/***** Get parameter with code of holiday *****/
Par_GetParToText ("HldCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -494,15 +494,13 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
static bool Ind_GetIfShowBigList (unsigned NumCrss) static bool Ind_GetIfShowBigList (unsigned NumCrss)
{ {
bool ShowBigList; bool ShowBigList;
char YN[1 + 1];
/***** If list of courses is too big... *****/ /***** If list of courses is too big... *****/
if (NumCrss <= Cfg_MIN_NUM_COURSES_TO_CONFIRM_SHOW_BIG_LIST) if (NumCrss <= Cfg_MIN_NUM_COURSES_TO_CONFIRM_SHOW_BIG_LIST)
return true; // List is not too big ==> show it return true; // List is not too big ==> show it
/***** Get parameter with user's confirmation to see a big list of courses *****/ /***** Get parameter with user's confirmation to see a big list of courses *****/
Par_GetParToText ("ShowBigList",YN,1); if (!(ShowBigList = Par_GetParToBool ("ShowBigList")))
if (!(ShowBigList = (Str_ConvertToUpperLetter (YN[0]) == 'Y')))
Ind_PutButtonToConfirmIWantToSeeBigList (NumCrss); Ind_PutButtonToConfirmIWantToSeeBigList (NumCrss);
return ShowBigList; return ShowBigList;

View File

@ -669,11 +669,7 @@ void Inf_ChangeIHaveReadInfo (void)
static bool Inf_GetMustBeReadFromForm (void) static bool Inf_GetMustBeReadFromForm (void)
{ {
char YN[1 + 1]; return Par_GetParToBool ("MustBeRead");
/***** Get a parameter that indicates if info must be read by students ******/
Par_GetParToText ("MustBeRead",YN,1);
return (Str_ConvertToUpperLetter (YN[0]) == 'Y');
} }
/*****************************************************************************/ /*****************************************************************************/
@ -682,11 +678,7 @@ static bool Inf_GetMustBeReadFromForm (void)
static bool Inf_GetIfIHaveReadFromForm (void) static bool Inf_GetIfIHaveReadFromForm (void)
{ {
char YN[1 + 1]; return Par_GetParToBool ("IHaveRead");
/***** Get a parameter that indicates if I have read a course info ******/
Par_GetParToText ("IHaveRead",YN,1);
return (Str_ConvertToUpperLetter (YN[0]) == 'Y');
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1556,11 +1556,8 @@ long Ins_GetAndCheckParamOtherInsCod (void)
static long Ins_GetParamOtherInsCod (void) static long Ins_GetParamOtherInsCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of institution *****/
return Par_GetParToLong ("OthInsCod");
/***** Get parameter with code of institution *****/
Par_GetParToText ("OthInsCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -409,11 +409,8 @@ static void Lnk_PutParamLnkCod (long LnkCod)
long Lnk_GetParamLnkCod (void) long Lnk_GetParamLnkCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of link *****/
return Par_GetParToLong ("LnkCod");
/***** Get parameter with code of link *****/
Par_GetParToText ("LnkCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -533,11 +533,8 @@ static void Mai_PutParamMaiCod (long MaiCod)
long Mai_GetParamMaiCod (void) long Mai_GetParamMaiCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of mail *****/
return Par_GetParToLong ("MaiCod");
/***** Get parameter with code of mail *****/
Par_GetParToText ("MaiCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -173,7 +173,6 @@ static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1])
extern const char *Txt_New_message; extern const char *Txt_New_message;
extern const char *Txt_MSG_To; extern const char *Txt_MSG_To;
extern const char *Txt_Send_message; extern const char *Txt_Send_message;
char YN[1 + 1];
unsigned NumUsrsInCrs = 0; // Initialized to avoid warning unsigned NumUsrsInCrs = 0; // Initialized to avoid warning
bool ShowUsrsInCrs = false; bool ShowUsrsInCrs = false;
bool GetUsrsInCrs; bool GetUsrsInCrs;
@ -182,21 +181,17 @@ static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1])
Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs = 0; Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs = 0;
/***** Get parameter that indicates if the message is a reply to another message *****/ /***** Get parameter that indicates if the message is a reply to another message *****/
Par_GetParToText ("IsReply",YN,1); if ((Gbl.Msg.Reply.IsReply = Par_GetParToBool ("IsReply")))
if ((Gbl.Msg.Reply.IsReply = (Str_ConvertToUpperLetter (YN[0]) == 'Y')))
/* Get original message code */ /* Get original message code */
if ((Gbl.Msg.Reply.OriginalMsgCod = Msg_GetParamMsgCod ()) <= 0) if ((Gbl.Msg.Reply.OriginalMsgCod = Msg_GetParamMsgCod ()) <= 0)
Lay_ShowErrorAndExit ("Wrong code of message."); Lay_ShowErrorAndExit ("Wrong code of message.");
/***** Get user's code of possible preselected recipient *****/ /***** Get user's code of possible preselected recipient *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) // There is a preselected recipient if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) // There is a preselected recipient
{
/* Get who to show as potential recipients: /* Get who to show as potential recipients:
- only the selected recipient - only the selected recipient
- any user (default) */ - any user (default) */
Par_GetParToText ("ShowOnlyOneRecipient",YN,1); Gbl.Msg.ShowOnlyOneRecipient = Par_GetParToBool ("ShowOnlyOneRecipient");
Gbl.Msg.ShowOnlyOneRecipient = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
}
else else
Gbl.Msg.ShowOnlyOneRecipient = false; Gbl.Msg.ShowOnlyOneRecipient = false;
@ -637,7 +632,6 @@ void Msg_RecMsgFromUsr (void)
extern const char *Txt_The_message_has_been_sent_to_1_recipient; extern const char *Txt_The_message_has_been_sent_to_1_recipient;
extern const char *Txt_The_message_has_been_sent_to_X_recipients; extern const char *Txt_The_message_has_been_sent_to_X_recipients;
extern const char *Txt_There_have_been_X_errors_in_sending_the_message; extern const char *Txt_There_have_been_X_errors_in_sending_the_message;
char YN[1 + 1];
bool IsReply; bool IsReply;
bool RecipientHasBannedMe; bool RecipientHasBannedMe;
bool Replied = false; bool Replied = false;
@ -665,8 +659,7 @@ void Msg_RecMsgFromUsr (void)
Str_DONT_CHANGE,false); Str_DONT_CHANGE,false);
/* Get parameter that indicates if the message is a reply to a previous message */ /* Get parameter that indicates if the message is a reply to a previous message */
Par_GetParToText ("IsReply",YN,1); if ((IsReply = Par_GetParToBool ("IsReply")))
if ((IsReply = (Str_ConvertToUpperLetter (YN[0]) == 'Y')))
/* Get original message code */ /* Get original message code */
if ((OriginalMsgCod = Msg_GetParamMsgCod ()) <= 0) if ((OriginalMsgCod = Msg_GetParamMsgCod ()) <= 0)
Lay_ShowErrorAndExit ("Wrong code of message."); Lay_ShowErrorAndExit ("Wrong code of message.");
@ -1011,12 +1004,9 @@ static void Msg_ShowNumMsgsDeleted (unsigned NumMsgs)
void Msg_GetParamMsgsCrsCod (void) void Msg_GetParamMsgsCrsCod (void)
{ {
extern const char *Txt_any_course; extern const char *Txt_any_course;
char LongStr[1 + 10 + 1];
struct Course Crs; struct Course Crs;
Par_GetParToText ("FilterCrsCod",LongStr,1 + 10); if ((Gbl.Msg.FilterCrsCod = Par_GetParToLong ("FilterCrsCod")) > 0) // If origin course specified
Gbl.Msg.FilterCrsCod = Str_ConvertStrCodToLongCod (LongStr);
if (Gbl.Msg.FilterCrsCod > 0) // If origin course specified
{ {
/* Get data of course */ /* Get data of course */
Crs.CrsCod = Gbl.Msg.FilterCrsCod; Crs.CrsCod = Gbl.Msg.FilterCrsCod;
@ -2649,11 +2639,8 @@ static void Msg_ShowFormToShowOnlyUnreadMessages (void)
static void Msg_GetParamOnlyUnreadMsgs (void) static void Msg_GetParamOnlyUnreadMsgs (void)
{ {
char YN[1 + 1];
/***** Get parameter to show only unread (received) messages *****/ /***** Get parameter to show only unread (received) messages *****/
Par_GetParToText ("OnlyUnreadMsgs",YN,1); Gbl.Msg.ShowOnlyUnreadMsgs = Par_GetParToBool ("OnlyUnreadMsgs");
Gbl.Msg.ShowOnlyUnreadMsgs = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
} }
/*****************************************************************************/ /*****************************************************************************/
@ -3362,7 +3349,6 @@ static void Msg_WriteMsgTo (long MsgCod)
unsigned NumRecipientsKnown; unsigned NumRecipientsKnown;
unsigned NumRecipientsUnknown; unsigned NumRecipientsUnknown;
unsigned NumRecipientsToShow; unsigned NumRecipientsToShow;
char YN[1 + 1];
struct UsrData UsrDat; struct UsrData UsrDat;
bool Deleted; bool Deleted;
bool OpenByDst; bool OpenByDst;
@ -3408,12 +3394,9 @@ static void Msg_WriteMsgTo (long MsgCod)
if (NumRecipientsKnown <= Msg_MAX_RECIPIENTS_TO_SHOW) if (NumRecipientsKnown <= Msg_MAX_RECIPIENTS_TO_SHOW)
NumRecipientsToShow = NumRecipientsKnown; NumRecipientsToShow = NumRecipientsKnown;
else // A lot of recipients else // A lot of recipients
{
/***** Get parameter that indicates if I want to see all recipients *****/ /***** Get parameter that indicates if I want to see all recipients *****/
Par_GetParToText ("SeeAllRcpts",YN,1); NumRecipientsToShow = Par_GetParToBool ("SeeAllRcpts") ? NumRecipientsKnown :
NumRecipientsToShow = (Str_ConvertToUpperLetter (YN[0]) == 'Y') ? NumRecipientsKnown : Msg_DEF_RECIPIENTS_TO_SHOW;
Msg_DEF_RECIPIENTS_TO_SHOW;
}
/***** Initialize structure with user's data *****/ /***** Initialize structure with user's data *****/
Usr_UsrDataConstructor (&UsrDat); Usr_UsrDataConstructor (&UsrDat);
@ -3599,11 +3582,8 @@ void Msg_PutHiddenParamMsgCod (long MsgCod)
static long Msg_GetParamMsgCod (void) static long Msg_GetParamMsgCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of message *****/
return Par_GetParToLong ("MsgCod");
/***** Get parameter with code of message *****/
Par_GetParToText ("MsgCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -996,12 +996,10 @@ void Not_PutHiddenParamNotCod (long NotCod)
static long Not_GetParamNotCod (void) static long Not_GetParamNotCod (void)
{ {
char LongStr[1 + 10 + 1]; // String that holds the notice code
long NotCod; long NotCod;
/* Get notice code */ /***** Get notice code *****/
Par_GetParToText ("NotCod",LongStr,1 + 10); if ((NotCod = Par_GetParToLong ("NotCod")) <= 0)
if (sscanf (LongStr,"%ld",&NotCod) != 1)
Lay_ShowErrorAndExit ("Wrong code of notice."); Lay_ShowErrorAndExit ("Wrong code of notice.");
return NotCod; return NotCod;

View File

@ -673,10 +673,7 @@ static void Ntf_WriteFormAllNotifications (bool AllNotifications)
static bool Ntf_GetAllNotificationsFromForm (void) static bool Ntf_GetAllNotificationsFromForm (void)
{ {
char YN[1 + 1]; return Par_GetParToBool ("All");
Par_GetParToText ("All",YN,1);
return (Str_ConvertToUpperLetter (YN[0]) == 'Y');
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1956,7 +1953,6 @@ void Ntf_PutFormChangeNotifSentByEMail (void)
static void Ntf_GetParamsNotifyEvents (void) static void Ntf_GetParamsNotifyEvents (void)
{ {
Ntf_NotifyEvent_t NotifyEvent; Ntf_NotifyEvent_t NotifyEvent;
char YN[1 + 1];
bool CreateNotifForThisEvent; bool CreateNotifForThisEvent;
Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents = 0; Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents = 0;
@ -1965,14 +1961,13 @@ static void Ntf_GetParamsNotifyEvents (void)
NotifyEvent < Ntf_NUM_NOTIFY_EVENTS; NotifyEvent < Ntf_NUM_NOTIFY_EVENTS;
NotifyEvent++) // 0 is reserved for Ntf_EVENT_UNKNOWN NotifyEvent++) // 0 is reserved for Ntf_EVENT_UNKNOWN
{ {
Par_GetParToText (Ntf_ParamNotifMeAboutNotifyEvents[NotifyEvent],YN,1); if ((CreateNotifForThisEvent = Par_GetParToBool (Ntf_ParamNotifMeAboutNotifyEvents[NotifyEvent])))
if ((CreateNotifForThisEvent = (Str_ConvertToUpperLetter (YN[0]) == 'Y')))
Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents |= (1 << NotifyEvent); Gbl.Usrs.Me.UsrDat.Prefs.NotifNtfEvents |= (1 << NotifyEvent);
if (CreateNotifForThisEvent) if (CreateNotifForThisEvent)
{ {
Par_GetParToText (Ntf_ParamEmailMeAboutNotifyEvents[NotifyEvent],YN,1); Par_GetParToBool (Ntf_ParamEmailMeAboutNotifyEvents[NotifyEvent]);
if (Str_ConvertToUpperLetter (YN[0]) == 'Y') if (Par_GetParToBool (Ntf_ParamEmailMeAboutNotifyEvents[NotifyEvent]))
Gbl.Usrs.Me.UsrDat.Prefs.EmailNtfEvents |= (1 << NotifyEvent); Gbl.Usrs.Me.UsrDat.Prefs.EmailNtfEvents |= (1 << NotifyEvent);
} }
} }

View File

@ -872,6 +872,32 @@ unsigned Par_GetParToText (const char *ParamName,char *ParamValue,size_t MaxByte
Str_TO_TEXT,true); Str_TO_TEXT,true);
} }
/*****************************************************************************/
/******************** Get the long value of a parameter **********************/
/*****************************************************************************/
long Par_GetParToLong (const char *ParamName)
{
char LongStr[1 + 10 + 1];
/***** Get parameter with long number *****/
Par_GetParToText (ParamName,LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
}
/*****************************************************************************/
/************************** Get a boolean parameter **************************/
/*****************************************************************************/
bool Par_GetParToBool (const char *ParamName)
{
char YN[1 + 1];
/***** Get parameter "Y"/"N" and convert to boolean *****/
Par_GetParToText (ParamName,YN,1);
return (Str_ConvertToUpperLetter (YN[0]) == 'Y');
}
/*****************************************************************************/ /*****************************************************************************/
/*** Get value of a single parameter and change format to not rigorous HTML **/ /*** Get value of a single parameter and change format to not rigorous HTML **/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -72,6 +72,8 @@ unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
void Par_GetMainParameters (void); void Par_GetMainParameters (void);
unsigned Par_GetParToText (const char *ParamName,char *ParamValue,size_t MaxBytes); unsigned Par_GetParToText (const char *ParamName,char *ParamValue,size_t MaxBytes);
long Par_GetParToLong (const char *ParamName);
bool Par_GetParToBool (const char *ParamName);
unsigned Par_GetParToHTML (const char *ParamName,char *ParamValue,size_t MaxBytes); unsigned Par_GetParToHTML (const char *ParamName,char *ParamValue,size_t MaxBytes);
unsigned Par_GetParMultiToText (const char *ParamName,char *ParamValue,size_t MaxBytes); unsigned Par_GetParMultiToText (const char *ParamName,char *ParamValue,size_t MaxBytes);
unsigned Par_GetParAndChangeFormat (const char *ParamName,char *ParamValue,size_t MaxBytes, unsigned Par_GetParAndChangeFormat (const char *ParamName,char *ParamValue,size_t MaxBytes,

View File

@ -927,8 +927,7 @@ bool Pwd_GetConfirmationOnDangerousAction (void)
char EncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1]; char EncryptedPassword[Cry_LENGTH_ENCRYPTED_STR_SHA512_BASE64 + 1];
/***** Get if consent has been done *****/ /***** Get if consent has been done *****/
Par_GetParToText ("Consent",YN,1); if (Par_GetParToBool ("Consent"))
if (Str_ConvertToUpperLetter (YN[0]) != 'Y')
{ {
Lay_ShowAlert (Lay_WARNING,Txt_You_have_not_confirmed_the_action); Lay_ShowAlert (Lay_WARNING,Txt_You_have_not_confirmed_the_action);
return false; return false;

View File

@ -507,11 +507,8 @@ static void Plc_PutParamPlcCod (long PlcCod)
long Plc_GetParamPlcCod (void) long Plc_GetParamPlcCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of place *****/
return Par_GetParToLong ("PlcCod");
/***** Get parameter with code of place *****/
Par_GetParToText ("PlcCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -476,11 +476,8 @@ static void Plg_PutParamPlgCod (long PlgCod)
long Plg_GetParamPlgCod (void) long Plg_GetParamPlgCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of plugin *****/
return Par_GetParToLong ("PlgCod");
/***** Get parameter with code of plugin *****/
Par_GetParToText ("PlgCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -590,11 +590,8 @@ void Rec_ReqRemField (void)
long Rec_GetFieldCod (void) long Rec_GetFieldCod (void)
{ {
char LongStr[1 + 10 + 1];
/***** Get the code of the field *****/ /***** Get the code of the field *****/
Par_GetParToText ("FieldCod",LongStr,1 + 10); return Par_GetParToLong ("FieldCod");
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1492,14 +1489,9 @@ static void Rec_PutParamsShowOfficeHoursSeveralTchs (void)
static bool Rec_GetParamShowOfficeHours (void) static bool Rec_GetParamShowOfficeHours (void)
{ {
char YN[1 + 1]; if (Par_GetParToBool ("ParamOfficeHours"))
return Par_GetParToBool ("ShowOfficeHours");
Par_GetParToText ("ParamOfficeHours",YN,1);
if (Str_ConvertToUpperLetter (YN[0]) == 'Y')
{
Par_GetParToText ("ShowOfficeHours",YN,1);
return (Str_ConvertToUpperLetter (YN[0]) == 'Y');
}
return Rec_SHOW_OFFICE_HOURS_DEFAULT; return Rec_SHOW_OFFICE_HOURS_DEFAULT;
} }
@ -3614,7 +3606,6 @@ void Rec_GetUsrNameFromRecordForm (struct UsrData *UsrDat)
static void Rec_GetUsrExtraDataFromRecordForm (struct UsrData *UsrDat) static void Rec_GetUsrExtraDataFromRecordForm (struct UsrData *UsrDat)
{ {
char UnsignedStr[10 + 1]; char UnsignedStr[10 + 1];
char LongStr[1 + 10 + 1];
unsigned UnsignedNum; unsigned UnsignedNum;
/***** Get sex from form *****/ /***** Get sex from form *****/
@ -3625,8 +3616,7 @@ static void Rec_GetUsrExtraDataFromRecordForm (struct UsrData *UsrDat)
UsrDat->Sex = (Usr_Sex_t) UnsignedNum; UsrDat->Sex = (Usr_Sex_t) UnsignedNum;
/***** Get country code *****/ /***** Get country code *****/
Par_GetParToText ("OthCtyCod",LongStr,1 + 10); UsrDat->CtyCod = Par_GetParToLong ("OthCtyCod");
UsrDat->CtyCod = Str_ConvertStrCodToLongCod (LongStr);
Par_GetParToText ("OriginPlace",UsrDat->OriginPlace,Cns_MAX_BYTES_STRING); Par_GetParToText ("OriginPlace",UsrDat->OriginPlace,Cns_MAX_BYTES_STRING);
Str_ConvertToTitleType (UsrDat->OriginPlace); Str_ConvertToTitleType (UsrDat->OriginPlace);

View File

@ -2790,15 +2790,8 @@ void Soc_PutHiddenParamPubCod (long PubCod)
static long Soc_GetParamNotCod (void) static long Soc_GetParamNotCod (void)
{ {
char LongStr[1 + 10 + 1]; // String that holds the social note code /***** Get social note code *****/
long NotCod; return Par_GetParToLong ("NotCod");
/* Get social note code */
Par_GetParToText ("NotCod",LongStr,1 + 10);
if (sscanf (LongStr,"%ld",&NotCod) != 1)
return -1L;
return NotCod;
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2807,15 +2800,8 @@ static long Soc_GetParamNotCod (void)
static long Soc_GetParamPubCod (void) static long Soc_GetParamPubCod (void)
{ {
char LongStr[1 + 10 + 1]; // String that holds the code /***** Get social comment code *****/
long PubCod; return Par_GetParToLong ("PubCod");
/* Get social comment code */
Par_GetParToText ("PubCod",LongStr,1 + 10);
if (sscanf (LongStr,"%ld",&PubCod) != 1)
return -1L;
return PubCod;
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1508,11 +1508,8 @@ static void Svy_PutParamSvyCod (long SvyCod)
static long Svy_GetParamSvyCod (void) static long Svy_GetParamSvyCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of survey *****/
return Par_GetParToLong ("SvyCod");
/***** Get parameter with code of survey *****/
Par_GetParToText ("SvyCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -2834,11 +2831,8 @@ static void Svy_PutParamQstCod (long QstCod)
static long Svy_GetParamQstCod (void) static long Svy_GetParamQstCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of question *****/
return Par_GetParToLong ("QstCod");
/***** Get parameter with code of survey *****/
Par_GetParToText ("QstCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -497,7 +497,6 @@ void Tst_AssessTest (void)
extern const char *Txt_The_test_X_has_already_been_assessed_previously; extern const char *Txt_The_test_X_has_already_been_assessed_previously;
extern const char *Txt_There_was_an_error_in_assessing_the_test_X; extern const char *Txt_There_was_an_error_in_assessing_the_test_X;
unsigned NumTst; unsigned NumTst;
char YN[1 + 1];
long TstCod = -1L; // Initialized to avoid warning long TstCod = -1L; // Initialized to avoid warning
unsigned NumQstsNotBlank; unsigned NumQstsNotBlank;
double TotalScore; double TotalScore;
@ -517,8 +516,7 @@ void Tst_AssessTest (void)
Tst_GetParamNumQst (); Tst_GetParamNumQst ();
/***** Get if test must be saved *****/ /***** Get if test must be saved *****/
Par_GetParToText ("Save",YN,1); Gbl.Test.AllowTeachers = Par_GetParToBool ("Save");
Gbl.Test.AllowTeachers = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/***** Get questions and answers from form to assess a test *****/ /***** Get questions and answers from form to assess a test *****/
Tst_GetQuestionsAndAnswersFromForm (); Tst_GetQuestionsAndAnswersFromForm ();
@ -581,7 +579,6 @@ static void Tst_GetQuestionsAndAnswersFromForm (void)
{ {
unsigned NumQst; unsigned NumQst;
char StrQstIndOrAns[3 + 10 + 1]; // "Qstxx...x", "Indxx...x" or "Ansxx...x" char StrQstIndOrAns[3 + 10 + 1]; // "Qstxx...x", "Indxx...x" or "Ansxx...x"
char LongStr[1 + 10 + 1];
/***** Get questions and answers *****/ /***** Get questions and answers *****/
for (NumQst = 0; for (NumQst = 0;
@ -590,8 +587,7 @@ static void Tst_GetQuestionsAndAnswersFromForm (void)
{ {
/* Get question code */ /* Get question code */
sprintf (StrQstIndOrAns,"Qst%06u",NumQst); sprintf (StrQstIndOrAns,"Qst%06u",NumQst);
Par_GetParToText (StrQstIndOrAns,LongStr,1 + 10); if ((Gbl.Test.QstCodes[NumQst] = Par_GetParToLong (StrQstIndOrAns)) <= 0)
if ((Gbl.Test.QstCodes[NumQst] = Str_ConvertStrCodToLongCod (LongStr)) < 0)
Lay_ShowErrorAndExit ("Code of question is missing."); Lay_ShowErrorAndExit ("Code of question is missing.");
/* Get indexes for this question */ /* Get indexes for this question */
@ -1418,11 +1414,10 @@ void Tst_DisableTag (void)
static long Tst_GetParamTagCode (void) static long Tst_GetParamTagCode (void)
{ {
char StrLong[1 + 10 + 1];
long TagCod; long TagCod;
Par_GetParToText ("TagCod",StrLong,1 + 10); /***** Get tag code *****/
if ((TagCod = Str_ConvertStrCodToLongCod (StrLong)) < 0) if ((TagCod = Par_GetParToLong ("TagCod")) <= 0)
Lay_ShowErrorAndExit ("Code of tag is missing."); Lay_ShowErrorAndExit ("Code of tag is missing.");
return TagCod; return TagCod;
@ -4274,15 +4269,13 @@ static bool Tst_GetParamsTst (void)
extern const char *Txt_You_must_select_one_ore_more_tags; extern const char *Txt_You_must_select_one_ore_more_tags;
extern const char *Txt_You_must_select_one_ore_more_types_of_answer; extern const char *Txt_You_must_select_one_ore_more_types_of_answer;
extern const char *Txt_The_number_of_questions_must_be_in_the_interval_X; extern const char *Txt_The_number_of_questions_must_be_in_the_interval_X;
char YN[1 + 1];
bool Error = false; bool Error = false;
char UnsignedStr[10 + 1]; char UnsignedStr[10 + 1];
unsigned UnsignedNum; unsigned UnsignedNum;
/***** Tags *****/ /***** Tags *****/
/* Get parameter that indicates whether all tags are selected */ /* Get parameter that indicates whether all tags are selected */
Par_GetParToText ("AllTags",YN,1); Gbl.Test.Tags.All = Par_GetParToBool ("AllTags");
Gbl.Test.Tags.All = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/* Get the tags */ /* Get the tags */
if ((Gbl.Test.Tags.List = malloc (Tst_MAX_BYTES_TAGS_LIST + 1)) == NULL) if ((Gbl.Test.Tags.List = malloc (Tst_MAX_BYTES_TAGS_LIST + 1)) == NULL)
@ -4298,8 +4291,7 @@ static bool Tst_GetParamsTst (void)
/***** Types of answer *****/ /***** Types of answer *****/
/* Get parameter that indicates if all types of answer are selected */ /* Get parameter that indicates if all types of answer are selected */
Par_GetParToText ("AllAnsTypes",YN,1); Gbl.Test.AllAnsTypes = Par_GetParToBool ("AllAnsTypes");
Gbl.Test.AllAnsTypes = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/* Get types of answer */ /* Get types of answer */
Par_GetParMultiToText ("AnswerType",Gbl.Test.ListAnsTypes,Tst_MAX_BYTES_LIST_ANSWER_TYPES); Par_GetParMultiToText ("AnswerType",Gbl.Test.ListAnsTypes,Tst_MAX_BYTES_LIST_ANSWER_TYPES);
@ -4394,10 +4386,7 @@ static void Tst_GetParamNumQst (void)
static bool Tst_GetCreateXMLFromForm (void) static bool Tst_GetCreateXMLFromForm (void)
{ {
char YN[1 + 1]; return Par_GetParToBool ("CreateXML");
Par_GetParToText ("CreateXML",YN,1);
return (Str_ConvertToUpperLetter (YN[0]) == 'Y');
} }
/*****************************************************************************/ /*****************************************************************************/
@ -5322,7 +5311,6 @@ void Tst_ReceiveQst (void)
static void Tst_GetQstFromForm (char *Stem,char *Feedback) static void Tst_GetQstFromForm (char *Stem,char *Feedback)
{ {
char UnsignedStr[10 + 1]; char UnsignedStr[10 + 1];
char YN[1 + 1];
unsigned NumTag; unsigned NumTag;
unsigned NumTagRead; unsigned NumTagRead;
unsigned NumOpt; unsigned NumOpt;
@ -5397,14 +5385,12 @@ static void Tst_GetQstFromForm (char *Stem,char *Feedback)
Par_GetParToText ("AnsFloatMax",Gbl.Test.Answer.Options[1].Text,Tst_MAX_BYTES_FLOAT_ANSWER); Par_GetParToText ("AnsFloatMax",Gbl.Test.Answer.Options[1].Text,Tst_MAX_BYTES_FLOAT_ANSWER);
break; break;
case Tst_ANS_TRUE_FALSE: case Tst_ANS_TRUE_FALSE:
Par_GetParToText ("AnsTF",YN,1); Gbl.Test.Answer.TF = Par_GetParToBool ("AnsTF");
Gbl.Test.Answer.TF = YN[0];
break; break;
case Tst_ANS_UNIQUE_CHOICE: case Tst_ANS_UNIQUE_CHOICE:
case Tst_ANS_MULTIPLE_CHOICE: case Tst_ANS_MULTIPLE_CHOICE:
/* Get shuffle */ /* Get shuffle */
Par_GetParToText ("Shuffle",YN,1); Gbl.Test.Shuffle = Par_GetParToBool ("Shuffle");
Gbl.Test.Shuffle = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
// No break // No break
case Tst_ANS_TEXT: case Tst_ANS_TEXT:
/* Get the texts of the answers */ /* Get the texts of the answers */
@ -5880,7 +5866,6 @@ void Tst_RequestRemoveQst (void)
{ {
extern const char *Txt_Do_you_really_want_to_remove_the_question_X; extern const char *Txt_Do_you_really_want_to_remove_the_question_X;
extern const char *Txt_Remove_question; extern const char *Txt_Remove_question;
char YN[1 + 1];
bool EditingOnlyThisQst; bool EditingOnlyThisQst;
/***** Get main parameters from form *****/ /***** Get main parameters from form *****/
@ -5891,8 +5876,7 @@ void Tst_RequestRemoveQst (void)
/* 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 */
Par_GetParToText ("OnlyThisQst",YN,1); EditingOnlyThisQst = Par_GetParToBool ("OnlyThisQst");
EditingOnlyThisQst = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/***** Start form *****/ /***** Start form *****/
Act_FormStart (ActRemTstQst); Act_FormStart (ActRemTstQst);
@ -5934,7 +5918,6 @@ void Tst_RemoveQst (void)
{ {
extern const char *Txt_Question_removed; extern const char *Txt_Question_removed;
char Query[512]; char Query[512];
char YN[1 + 1];
bool EditingOnlyThisQst; bool EditingOnlyThisQst;
/***** Get the question code *****/ /***** Get the question code *****/
@ -5944,8 +5927,7 @@ void Tst_RemoveQst (void)
/***** 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 ******/
Par_GetParToText ("OnlyThisQst",YN,1); EditingOnlyThisQst = Par_GetParToBool ("OnlyThisQst");
EditingOnlyThisQst = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/***** Remove images associated to question *****/ /***** Remove images associated to question *****/
Tst_RemoveAllImgFilesFromAnsOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod); Tst_RemoveAllImgFilesFromAnsOfQst (Gbl.CurrentCrs.Crs.CrsCod,Gbl.Test.QstCod);
@ -5983,7 +5965,6 @@ void Tst_ChangeShuffleQst (void)
extern const char *Txt_The_answers_of_the_question_with_code_X_will_appear_shuffled; extern const char *Txt_The_answers_of_the_question_with_code_X_will_appear_shuffled;
extern const char *Txt_The_answers_of_the_question_with_code_X_will_appear_without_shuffling; extern const char *Txt_The_answers_of_the_question_with_code_X_will_appear_without_shuffling;
char Query[512]; char Query[512];
char YN[1 + 1];
bool EditingOnlyThisQst; bool EditingOnlyThisQst;
bool Shuffle; bool Shuffle;
@ -5993,12 +5974,10 @@ void Tst_ChangeShuffleQst (void)
Lay_ShowErrorAndExit ("Wrong code of question."); Lay_ShowErrorAndExit ("Wrong code of question.");
/***** 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 ******/
Par_GetParToText ("OnlyThisQst",YN,1); EditingOnlyThisQst = Par_GetParToBool ("OnlyThisQst");
EditingOnlyThisQst = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/***** Get a parameter that indicates whether it's possible to shuffle the answers of this question ******/ /***** Get a parameter that indicates whether it's possible to shuffle the answers of this question ******/
Par_GetParToText ("Shuffle",YN,1); Shuffle = Par_GetParToBool ("Shuffle");
Shuffle = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
/***** Remove the question from all the tables *****/ /***** Remove the question from all the tables *****/
/* Update the question changing the current shuffle */ /* Update the question changing the current shuffle */
@ -6029,10 +6008,8 @@ void Tst_ChangeShuffleQst (void)
static long Tst_GetQstCod (void) static long Tst_GetQstCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of test question *****/
return Par_GetParToLong ("QstCod");
Par_GetParToText ("QstCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -7573,11 +7550,8 @@ static void Tst_PutParamTstCod (long TstCod)
static long Tst_GetParamTstCod (void) static long Tst_GetParamTstCod (void)
{ {
char LongStr[1 + 10 + 1]; /***** Get code of test *****/
return Par_GetParToLong ("TstCod");
/***** Get parameter with code of test *****/
Par_GetParToText ("TstCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -5060,16 +5060,13 @@ void Usr_FreeUsrsList (Rol_Role_t Role)
bool Usr_GetIfShowBigList (unsigned NumUsrs,const char *OnSubmit) bool Usr_GetIfShowBigList (unsigned NumUsrs,const char *OnSubmit)
{ {
bool ShowBigList; bool ShowBigList;
char YN[1 + 1];
/***** If list of users is too big... *****/ /***** If list of users is too big... *****/
if (NumUsrs > Cfg_MIN_NUM_USERS_TO_CONFIRM_SHOW_BIG_LIST) if (NumUsrs > Cfg_MIN_NUM_USERS_TO_CONFIRM_SHOW_BIG_LIST)
{ {
/***** Get parameter with user's confirmation /***** Get parameter with user's confirmation
to see a big list of users *****/ to see a big list of users *****/
Par_GetParToText ("ShowBigList",YN,1); if (!(ShowBigList = Par_GetParToBool ("ShowBigList")))
ShowBigList = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
if (!ShowBigList)
Usr_PutButtonToConfirmIWantToSeeBigList (NumUsrs,OnSubmit); Usr_PutButtonToConfirmIWantToSeeBigList (NumUsrs,OnSubmit);
return ShowBigList; return ShowBigList;
@ -6986,19 +6983,15 @@ void Usr_PutParamListWithPhotos (void)
static bool Usr_GetParamListWithPhotosFromForm (void) static bool Usr_GetParamListWithPhotosFromForm (void)
{ {
char YN[1 + 1];
/***** Get if exists parameter with preference about photos in users' list *****/ /***** Get if exists parameter with preference about photos in users' list *****/
Par_GetParToText ("WithPhotosExists",YN,1); if (Par_GetParToBool ("WithPhotosExists"))
if (Str_ConvertToUpperLetter (YN[0]) != 'Y')
{ {
Gbl.Usrs.Listing.WithPhotos = Usr_LIST_WITH_PHOTOS_DEF; Gbl.Usrs.Listing.WithPhotos = Usr_LIST_WITH_PHOTOS_DEF;
return false; return false;
} }
/***** Parameter with preference about photos in users' list exists, so get it *****/ /***** Parameter with preference about photos in users' list exists, so get it *****/
Par_GetParToText ("WithPhotos",YN,1); Gbl.Usrs.Listing.WithPhotos = Par_GetParToBool ("WithPhotos");
Gbl.Usrs.Listing.WithPhotos = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
return true; return true;
} }

View File

@ -140,10 +140,7 @@ static void ZIP_PutLinkToCreateZIPAsgWrkParams (void)
bool ZIP_GetCreateZIPFromForm (void) bool ZIP_GetCreateZIPFromForm (void)
{ {
char YN[1 + 1]; return Par_GetParToBool ("CreateZIP");
Par_GetParToText ("CreateZIP",YN,1);
return (Str_ConvertToUpperLetter (YN[0]) == 'Y');
} }
/*****************************************************************************/ /*****************************************************************************/