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)
{
char LongStr[1 + 10 + 1];
/***** Get parameter with code of event *****/
Par_GetParToText ("AgdCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
/***** Get code of event *****/
return Par_GetParToLong ("AgdCod");
}
/*****************************************************************************/

View File

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

View File

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

View File

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

View File

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

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 void Ctr_PutParamOtherCtrCod (long CtrCod);
static long Ctr_GetParamOtherCtrCod (void);
static void Ctr_UpdateCtrInsDB (long CtrCod,long InsCod);
static void Ctr_RenameCentre (struct Centre *Ctr,Cns_ShrtOrFullName_t ShrtOrFullName);
@ -1670,21 +1669,12 @@ long Ctr_GetAndCheckParamOtherCtrCod (void)
long CtrCod;
/***** 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.");
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 *****************************/
/*****************************************************************************/

View File

@ -191,13 +191,15 @@
/****************************** 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 JS_FILE "swad16.123.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/*
Version 16.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.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)

View File

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

View File

@ -120,7 +120,6 @@ static void Sch_PutLinkToSearchCoursesParams (void);
static void Crs_PutParamOtherCrsCod (long CrsCod);
static long Crs_GetAndCheckParamOtherCrsCod (void);
static long Crs_GetParamOtherCrsCod (void);
static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnAccepted);
@ -2977,21 +2976,12 @@ static long Crs_GetAndCheckParamOtherCrsCod (void)
long CrsCod;
/***** 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.");
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 **************************/
/*****************************************************************************/

View File

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

View File

@ -102,7 +102,6 @@ static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg);
static void Deg_RecFormRequestOrCreateDeg (unsigned Status);
static void Deg_PutParamOtherDegCod (long DegCod);
static long Deg_GetParamOtherDegCod (void);
static void Deg_GetDataOfDegreeFromRow (struct Degree *Deg,MYSQL_ROW row);
static void Deg_RenameDegree (struct Degree *Deg,Cns_ShrtOrFullName_t ShrtOrFullName);
@ -1652,21 +1651,12 @@ long Deg_GetAndCheckParamOtherDegCod (void)
long DegCod;
/***** 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.");
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 ********************/
/*****************************************************************************/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -342,7 +342,6 @@ void Grp_PutParamsCodGrps (void)
void Grp_GetParCodsSeveralGrpsToShowUsrs (void)
{
char YN[1 + 1];
struct ListCodGrps LstGrpsIBelong;
unsigned NumGrp;
@ -350,8 +349,7 @@ void Grp_GetParCodsSeveralGrpsToShowUsrs (void)
return;
/***** Get boolean parameter that indicates if all groups must be listed *****/
Par_GetParToText ("AllGroups",YN,1);
Gbl.Usrs.ClassPhoto.AllGroups = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
Gbl.Usrs.ClassPhoto.AllGroups = Par_GetParToBool ("AllGroups");
/***** Get parameter with list of groups selected *****/
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_You_must_specify_the_name_of_the_new_type_of_group;
char YN[1 + 1];
/***** Get parameters from form *****/
/* Get the name of group type */
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 */
Par_GetParToText ("MandatoryEnrollment",YN,1);
Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrollment = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
Gbl.CurrentCrs.Grps.GrpTyp.MandatoryEnrollment = Par_GetParToBool ("MandatoryEnrollment");
/* Get whether it is possible to register in multiple groups of this type */
Par_GetParToText ("MultipleEnrollment",YN,1);
Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrollment = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
Gbl.CurrentCrs.Grps.GrpTyp.MultipleEnrollment = Par_GetParToBool ("MultipleEnrollment");
/* Get open time */
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_voluntary;
char Query[1024];
char YN[1 + 1];
bool NewMandatoryEnrollment;
/***** Get parameters of the form *****/
@ -3700,8 +3694,7 @@ void Grp_ChangeMandatGrpTyp (void)
Lay_ShowErrorAndExit ("Code of type of group is missing.");
/* Get the new type of enrollment (mandatory or voluntaria) of this type of group */
Par_GetParToText ("MandatoryEnrollment",YN,1);
NewMandatoryEnrollment = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
NewMandatoryEnrollment = Par_GetParToBool ("MandatoryEnrollment");
/* Get from the database the name of the type and the old type of enrollment */
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_only_belong_to_a_group_of_type_X;
char Query[1024];
char YN[1 + 1];
bool NewMultipleEnrollment;
/***** Get parameters from the form *****/
@ -3755,8 +3747,7 @@ void Grp_ChangeMultiGrpTyp (void)
Lay_ShowErrorAndExit ("Code of type of group is missing.");
/* Get the new type of enrollment (single or multiple) of this type of group */
Par_GetParToText ("MultipleEnrollment",YN,1);
NewMultipleEnrollment = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
NewMultipleEnrollment = Par_GetParToBool ("MultipleEnrollment");
/* Get from the database the name of the type and the old type of enrollment */
Grp_GetDataOfGroupTypeByCod (&Gbl.CurrentCrs.Grps.GrpTyp);
@ -4064,11 +4055,8 @@ void Grp_RenameGroup (void)
static long Grp_GetParamGrpTypCod (void)
{
char LongStr[1 + 10 + 1];
/***** Get parameter with code of group type *****/
Par_GetParToText ("GrpTypCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
/***** Get code of group type *****/
return Par_GetParToLong ("GrpTypCod");
}
/*****************************************************************************/
@ -4077,11 +4065,8 @@ static long Grp_GetParamGrpTypCod (void)
static long Grp_GetParamGrpCod (void)
{
char LongStr[1 + 10 + 1];
/***** Get parameter with group code *****/
Par_GetParToText ("GrpCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
/***** Get group code *****/
return Par_GetParToLong ("GrpCod");
}
/*****************************************************************************/

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

@ -72,6 +72,8 @@ unsigned Par_GetParameter (tParamType ParamType,const char *ParamName,
void Par_GetMainParameters (void);
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_GetParMultiToText (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];
/***** Get if consent has been done *****/
Par_GetParToText ("Consent",YN,1);
if (Str_ConvertToUpperLetter (YN[0]) != 'Y')
if (Par_GetParToBool ("Consent"))
{
Lay_ShowAlert (Lay_WARNING,Txt_You_have_not_confirmed_the_action);
return false;

View File

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

View File

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

View File

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

View File

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

View File

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

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_There_was_an_error_in_assessing_the_test_X;
unsigned NumTst;
char YN[1 + 1];
long TstCod = -1L; // Initialized to avoid warning
unsigned NumQstsNotBlank;
double TotalScore;
@ -517,8 +516,7 @@ void Tst_AssessTest (void)
Tst_GetParamNumQst ();
/***** Get if test must be saved *****/
Par_GetParToText ("Save",YN,1);
Gbl.Test.AllowTeachers = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
Gbl.Test.AllowTeachers = Par_GetParToBool ("Save");
/***** Get questions and answers from form to assess a test *****/
Tst_GetQuestionsAndAnswersFromForm ();
@ -581,7 +579,6 @@ static void Tst_GetQuestionsAndAnswersFromForm (void)
{
unsigned NumQst;
char StrQstIndOrAns[3 + 10 + 1]; // "Qstxx...x", "Indxx...x" or "Ansxx...x"
char LongStr[1 + 10 + 1];
/***** Get questions and answers *****/
for (NumQst = 0;
@ -590,8 +587,7 @@ static void Tst_GetQuestionsAndAnswersFromForm (void)
{
/* Get question code */
sprintf (StrQstIndOrAns,"Qst%06u",NumQst);
Par_GetParToText (StrQstIndOrAns,LongStr,1 + 10);
if ((Gbl.Test.QstCodes[NumQst] = Str_ConvertStrCodToLongCod (LongStr)) < 0)
if ((Gbl.Test.QstCodes[NumQst] = Par_GetParToLong (StrQstIndOrAns)) <= 0)
Lay_ShowErrorAndExit ("Code of question is missing.");
/* Get indexes for this question */
@ -1418,11 +1414,10 @@ void Tst_DisableTag (void)
static long Tst_GetParamTagCode (void)
{
char StrLong[1 + 10 + 1];
long TagCod;
Par_GetParToText ("TagCod",StrLong,1 + 10);
if ((TagCod = Str_ConvertStrCodToLongCod (StrLong)) < 0)
/***** Get tag code *****/
if ((TagCod = Par_GetParToLong ("TagCod")) <= 0)
Lay_ShowErrorAndExit ("Code of tag is missing.");
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_types_of_answer;
extern const char *Txt_The_number_of_questions_must_be_in_the_interval_X;
char YN[1 + 1];
bool Error = false;
char UnsignedStr[10 + 1];
unsigned UnsignedNum;
/***** Tags *****/
/* Get parameter that indicates whether all tags are selected */
Par_GetParToText ("AllTags",YN,1);
Gbl.Test.Tags.All = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
Gbl.Test.Tags.All = Par_GetParToBool ("AllTags");
/* Get the tags */
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 *****/
/* Get parameter that indicates if all types of answer are selected */
Par_GetParToText ("AllAnsTypes",YN,1);
Gbl.Test.AllAnsTypes = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
Gbl.Test.AllAnsTypes = Par_GetParToBool ("AllAnsTypes");
/* Get types of answer */
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)
{
char YN[1 + 1];
Par_GetParToText ("CreateXML",YN,1);
return (Str_ConvertToUpperLetter (YN[0]) == 'Y');
return Par_GetParToBool ("CreateXML");
}
/*****************************************************************************/
@ -5322,7 +5311,6 @@ void Tst_ReceiveQst (void)
static void Tst_GetQstFromForm (char *Stem,char *Feedback)
{
char UnsignedStr[10 + 1];
char YN[1 + 1];
unsigned NumTag;
unsigned NumTagRead;
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);
break;
case Tst_ANS_TRUE_FALSE:
Par_GetParToText ("AnsTF",YN,1);
Gbl.Test.Answer.TF = YN[0];
Gbl.Test.Answer.TF = Par_GetParToBool ("AnsTF");
break;
case Tst_ANS_UNIQUE_CHOICE:
case Tst_ANS_MULTIPLE_CHOICE:
/* Get shuffle */
Par_GetParToText ("Shuffle",YN,1);
Gbl.Test.Shuffle = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
Gbl.Test.Shuffle = Par_GetParToBool ("Shuffle");
// No break
case Tst_ANS_TEXT:
/* 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_Remove_question;
char YN[1 + 1];
bool EditingOnlyThisQst;
/***** Get main parameters from form *****/
@ -5891,8 +5876,7 @@ void Tst_RequestRemoveQst (void)
/* Get a parameter that indicates whether it's necessary
to continue listing the rest of questions */
Par_GetParToText ("OnlyThisQst",YN,1);
EditingOnlyThisQst = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
EditingOnlyThisQst = Par_GetParToBool ("OnlyThisQst");
/***** Start form *****/
Act_FormStart (ActRemTstQst);
@ -5934,7 +5918,6 @@ void Tst_RemoveQst (void)
{
extern const char *Txt_Question_removed;
char Query[512];
char YN[1 + 1];
bool EditingOnlyThisQst;
/***** Get the question code *****/
@ -5944,8 +5927,7 @@ void Tst_RemoveQst (void)
/***** Get a parameter that indicates whether it's necessary
to continue listing the rest of questions ******/
Par_GetParToText ("OnlyThisQst",YN,1);
EditingOnlyThisQst = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
EditingOnlyThisQst = Par_GetParToBool ("OnlyThisQst");
/***** Remove images associated to question *****/
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_without_shuffling;
char Query[512];
char YN[1 + 1];
bool EditingOnlyThisQst;
bool Shuffle;
@ -5993,12 +5974,10 @@ void Tst_ChangeShuffleQst (void)
Lay_ShowErrorAndExit ("Wrong code of question.");
/***** Get a parameter that indicates whether it's necessary to continue listing the rest of questions ******/
Par_GetParToText ("OnlyThisQst",YN,1);
EditingOnlyThisQst = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
EditingOnlyThisQst = Par_GetParToBool ("OnlyThisQst");
/***** Get a parameter that indicates whether it's possible to shuffle the answers of this question ******/
Par_GetParToText ("Shuffle",YN,1);
Shuffle = (Str_ConvertToUpperLetter (YN[0]) == 'Y');
Shuffle = Par_GetParToBool ("Shuffle");
/***** Remove the question from all the tables *****/
/* Update the question changing the current shuffle */
@ -6029,10 +6008,8 @@ void Tst_ChangeShuffleQst (void)
static long Tst_GetQstCod (void)
{
char LongStr[1 + 10 + 1];
Par_GetParToText ("QstCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
/***** Get code of test question *****/
return Par_GetParToLong ("QstCod");
}
/*****************************************************************************/
@ -7573,11 +7550,8 @@ static void Tst_PutParamTstCod (long TstCod)
static long Tst_GetParamTstCod (void)
{
char LongStr[1 + 10 + 1];
/***** Get parameter with code of test *****/
Par_GetParToText ("TstCod",LongStr,1 + 10);
return Str_ConvertStrCodToLongCod (LongStr);
/***** Get code of test *****/
return Par_GetParToLong ("TstCod");
}
/*****************************************************************************/

View File

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

View File

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