Version 22.67: Mar 04, 2023 Code refactoring in parameters. Not finished.

This commit is contained in:
acanas 2023-03-04 22:07:29 +01:00
parent 68bd4d4db8
commit 10ea1d24c7
42 changed files with 216 additions and 327 deletions

View File

@ -1156,16 +1156,6 @@ static void Agd_FreeListEvents (struct Agd_Agenda *Agenda)
} }
} }
/*****************************************************************************/
/******************** Get parameter with code of event ***********************/
/*****************************************************************************/
long Agd_GetParamAgdCod (void)
{
/***** Get code of event *****/
return Par_GetParToLong ("AgdCod");
}
/*****************************************************************************/ /*****************************************************************************/
/************** Ask for confirmation of removing of an event *****************/ /************** Ask for confirmation of removing of an event *****************/
/*****************************************************************************/ /*****************************************************************************/
@ -1184,8 +1174,7 @@ void Agd_AskRemEvent (void)
Agd_GetParams (&Agenda,Agd_MY_AGENDA); Agd_GetParams (&Agenda,Agd_MY_AGENDA);
/***** Get event code *****/ /***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0) AgdEvent.AgdCod = Par_GetAndCheckParCode (Par_AgdCod);
Err_WrongEventExit ();
/***** Get data of the event from database *****/ /***** Get data of the event from database *****/
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
@ -1220,8 +1209,7 @@ void Agd_RemoveEvent (void)
Agd_GetParams (&Agenda,Agd_MY_AGENDA); Agd_GetParams (&Agenda,Agd_MY_AGENDA);
/***** Get event code *****/ /***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0) AgdEvent.AgdCod = Par_GetAndCheckParCode (Par_AgdCod);
Err_WrongEventExit ();
/***** Get data of the event from database *****/ /***** Get data of the event from database *****/
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
@ -1254,8 +1242,7 @@ void Agd_HideEvent (void)
Agd_GetParams (&Agenda,Agd_MY_AGENDA); Agd_GetParams (&Agenda,Agd_MY_AGENDA);
/***** Get event code *****/ /***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0) AgdEvent.AgdCod = Par_GetAndCheckParCode (Par_AgdCod);
Err_WrongEventExit ();
/***** Get data of the event from database *****/ /***** Get data of the event from database *****/
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
@ -1284,8 +1271,7 @@ void Agd_UnhideEvent (void)
Agd_GetParams (&Agenda,Agd_MY_AGENDA); Agd_GetParams (&Agenda,Agd_MY_AGENDA);
/***** Get event code *****/ /***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0) AgdEvent.AgdCod = Par_GetAndCheckParCode (Par_AgdCod);
Err_WrongEventExit ();
/***** Get data of the event from database *****/ /***** Get data of the event from database *****/
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
@ -1315,8 +1301,7 @@ void Agd_MakeEventPrivate (void)
Agd_GetParams (&Agenda,Agd_MY_AGENDA); Agd_GetParams (&Agenda,Agd_MY_AGENDA);
/***** Get event code *****/ /***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0) AgdEvent.AgdCod = Par_GetAndCheckParCode (Par_AgdCod);
Err_WrongEventExit ();
/***** Get data of the event from database *****/ /***** Get data of the event from database *****/
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
@ -1350,8 +1335,7 @@ void Agd_MakeEventPublic (void)
Agd_GetParams (&Agenda,Agd_MY_AGENDA); Agd_GetParams (&Agenda,Agd_MY_AGENDA);
/***** Get event code *****/ /***** Get event code *****/
if ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) < 0) AgdEvent.AgdCod = Par_GetAndCheckParCode (Par_AgdCod);
Err_WrongEventExit ();
/***** Get data of the event from database *****/ /***** Get data of the event from database *****/
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
@ -1400,7 +1384,7 @@ void Agd_RequestCreatOrEditEvent (void)
Agd_GetParams (&Agenda,Agd_MY_AGENDA); Agd_GetParams (&Agenda,Agd_MY_AGENDA);
/***** Get the code of the event *****/ /***** Get the code of the event *****/
ItsANewEvent = ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) <= 0); ItsANewEvent = ((AgdEvent.AgdCod = Par_GetParCode (Par_AgdCod)) <= 0);
/***** Get from the database the data of the event *****/ /***** Get from the database the data of the event *****/
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
@ -1546,7 +1530,7 @@ void Agd_ReceiveFormEvent (void)
AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; AgdEvent.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod;
/***** Get the code of the event *****/ /***** Get the code of the event *****/
ItsANewEvent = ((AgdEvent.AgdCod = Agd_GetParamAgdCod ()) <= 0); ItsANewEvent = ((AgdEvent.AgdCod = Par_GetParCode (Par_AgdCod)) <= 0);
/***** Get start/end date-times *****/ /***** Get start/end date-times *****/
AgdEvent.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC"); AgdEvent.TimeUTC[Dat_STR_TIME] = Dat_GetTimeUTCFromForm ("StartTimeUTC");

View File

@ -121,8 +121,6 @@ void Agd_PutParamsMyAgenda (unsigned Past__FutureEvents,
long AgdCodToEdit); long AgdCodToEdit);
void Agd_PutHiddenParamEventsOrder (Dat_StartEndTime_t SelectedOrder); void Agd_PutHiddenParamEventsOrder (Dat_StartEndTime_t SelectedOrder);
long Agd_GetParamAgdCod (void);
void Agd_AskRemEvent (void); void Agd_AskRemEvent (void);
void Agd_RemoveEvent (void); void Agd_RemoveEvent (void);

View File

@ -57,7 +57,6 @@ static void Ann_DrawAnAnnouncement (long AnnCod,Ann_Status_t Status,
bool ShowAllAnnouncements, bool ShowAllAnnouncements,
bool ICanEdit); bool ICanEdit);
static void Ann_PutParams (void *AnnCod); static void Ann_PutParams (void *AnnCod);
static long Ann_GetParamAnnCod (void);
static void Ann_PutSubjectMessage (const char *Field,const char *Label, static void Ann_PutSubjectMessage (const char *Field,const char *Label,
unsigned Rows); unsigned Rows);
@ -308,21 +307,6 @@ static void Ann_PutParams (void *AnnCod)
Par_PutHiddenParamLong (NULL,"AnnCod",*((long *) AnnCod)); Par_PutHiddenParamLong (NULL,"AnnCod",*((long *) AnnCod));
} }
/*****************************************************************************/
/************** Get parameter with the code of an announcement ***************/
/*****************************************************************************/
static long Ann_GetParamAnnCod (void)
{
long AnnCod;
/***** Get announcement code *****/
if ((AnnCod = Par_GetParToLong ("AnnCod")) <= 0)
Err_WrongAnnouncementExit ();
return AnnCod;
}
/*****************************************************************************/ /*****************************************************************************/
/***************** Show form to create a new announcement ********************/ /***************** Show form to create a new announcement ********************/
/*****************************************************************************/ /*****************************************************************************/
@ -444,7 +428,7 @@ void Ann_HideActiveAnnouncement (void)
long AnnCod; long AnnCod;
/***** Get the code of the global announcement to hide *****/ /***** Get the code of the global announcement to hide *****/
AnnCod = Ann_GetParamAnnCod (); AnnCod = Par_GetAndCheckParCode (Par_AnnCod);
/***** Set global announcement as hidden *****/ /***** Set global announcement as hidden *****/
Ann_DB_HideAnnouncement (AnnCod); Ann_DB_HideAnnouncement (AnnCod);
@ -459,7 +443,7 @@ void Ann_RevealHiddenAnnouncement (void)
long AnnCod; long AnnCod;
/***** Get the code of the global announcement to show *****/ /***** Get the code of the global announcement to show *****/
AnnCod = Ann_GetParamAnnCod (); AnnCod = Par_GetAndCheckParCode (Par_AnnCod);
/***** Set global announcement as not hidden *****/ /***** Set global announcement as not hidden *****/
Ann_DB_UnhideAnnouncement (AnnCod); Ann_DB_UnhideAnnouncement (AnnCod);
@ -475,7 +459,7 @@ void Ann_RemoveAnnouncement (void)
long AnnCod; long AnnCod;
/***** Get the code of the global announcement *****/ /***** Get the code of the global announcement *****/
AnnCod = Ann_GetParamAnnCod (); AnnCod = Par_GetAndCheckParCode (Par_AnnCod);
/***** Remove users who have seen the announcement *****/ /***** Remove users who have seen the announcement *****/
Ann_DB_RemoveUsrsWhoSawAnnouncement (AnnCod); Ann_DB_RemoveUsrsWhoSawAnnouncement (AnnCod);
@ -499,7 +483,7 @@ void Ann_MarkAnnouncementAsSeen (void)
long AnnCod; long AnnCod;
/***** Get the code of the global announcement *****/ /***** Get the code of the global announcement *****/
AnnCod = Ann_GetParamAnnCod (); AnnCod = Par_GetAndCheckParCode (Par_AnnCod);
/***** Mark announcement as seen *****/ /***** Mark announcement as seen *****/
Ann_DB_MarkAnnouncementAsSeenByMe (AnnCod); Ann_DB_MarkAnnouncementAsSeenByMe (AnnCod);

View File

@ -382,7 +382,7 @@ void Asg_SeeOneAssignment (void)
Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS); Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS);
/***** Get the code of the assignment *****/ /***** Get the code of the assignment *****/
Assignments.Asg.AsgCod = Asg_GetParamAsgCod (); Assignments.Asg.AsgCod = Par_GetAndCheckParCode (Par_AsgCod);
/***** Show selected assignment in a box *****/ /***** Show selected assignment in a box *****/
Asg_ShowOneAssignmentInBox (&Assignments); Asg_ShowOneAssignmentInBox (&Assignments);
@ -403,7 +403,7 @@ void Asg_PrintOneAssignment (void)
Asg_ResetAssignments (&Assignments); Asg_ResetAssignments (&Assignments);
/***** Get the code of the assignment *****/ /***** Get the code of the assignment *****/
Assignments.Asg.AsgCod = Asg_GetParamAsgCod (); Assignments.Asg.AsgCod = Par_GetAndCheckParCode (Par_AsgCod);
/***** Write header *****/ /***** Write header *****/
Lay_WriteHeaderClassPhoto (true,false, Lay_WriteHeaderClassPhoto (true,false,
@ -1014,16 +1014,6 @@ void Asg_PutParamAsgCod (long AsgCod)
Par_PutHiddenParamLong (NULL,"AsgCod",AsgCod); Par_PutHiddenParamLong (NULL,"AsgCod",AsgCod);
} }
/*****************************************************************************/
/****************** Get parameter with code of assignment ********************/
/*****************************************************************************/
long Asg_GetParamAsgCod (void)
{
/***** Get code of assignment *****/
return Par_GetParToLong ("AsgCod");
}
/*****************************************************************************/ /*****************************************************************************/
/************* Ask for confirmation of removing an assignment ****************/ /************* Ask for confirmation of removing an assignment ****************/
/*****************************************************************************/ /*****************************************************************************/
@ -1043,8 +1033,7 @@ void Asg_ReqRemAssignment (void)
Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS); Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS);
/***** Get assignment code *****/ /***** Get assignment code *****/
if ((Assignments.Asg.AsgCod = Asg_GetParamAsgCod ()) <= 0) Assignments.Asg.AsgCod = Par_GetAndCheckParCode (Par_AsgCod);
Err_WrongAssignmentExit ();
/***** Get data of the assignment from database *****/ /***** Get data of the assignment from database *****/
Asg_GetDataOfAssignmentByCod (&Assignments.Asg); Asg_GetDataOfAssignmentByCod (&Assignments.Asg);
@ -1078,8 +1067,7 @@ void Asg_RemoveAssignment (void)
Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS); Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS);
/***** Get assignment code *****/ /***** Get assignment code *****/
if ((Assignments.Asg.AsgCod = Asg_GetParamAsgCod ()) <= 0) Assignments.Asg.AsgCod = Par_GetAndCheckParCode (Par_AsgCod);
Err_WrongAssignmentExit ();
/***** Get data of the assignment from database *****/ /***** Get data of the assignment from database *****/
Asg_GetDataOfAssignmentByCod (&Assignments.Asg); // Inside this function, the course is checked to be the current one Asg_GetDataOfAssignmentByCod (&Assignments.Asg); // Inside this function, the course is checked to be the current one
@ -1122,8 +1110,7 @@ void Asg_HideAssignment (void)
Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS); Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS);
/***** Get assignment code *****/ /***** Get assignment code *****/
if ((Assignments.Asg.AsgCod = Asg_GetParamAsgCod ()) <= 0) Assignments.Asg.AsgCod = Par_GetAndCheckParCode (Par_AsgCod);
Err_WrongAssignmentExit ();
/***** Get data of the assignment from database *****/ /***** Get data of the assignment from database *****/
Asg_GetDataOfAssignmentByCod (&Assignments.Asg); Asg_GetDataOfAssignmentByCod (&Assignments.Asg);
@ -1152,8 +1139,7 @@ void Asg_UnhideAssignment (void)
Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS); Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS);
/***** Get assignment code *****/ /***** Get assignment code *****/
if ((Assignments.Asg.AsgCod = Asg_GetParamAsgCod ()) <= 0) Assignments.Asg.AsgCod = Par_GetAndCheckParCode (Par_AsgCod);
Err_WrongAssignmentExit ();
/***** Get data of the assignment from database *****/ /***** Get data of the assignment from database *****/
Asg_GetDataOfAssignmentByCod (&Assignments.Asg); Asg_GetDataOfAssignmentByCod (&Assignments.Asg);
@ -1204,7 +1190,7 @@ void Asg_RequestCreatOrEditAsg (void)
Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS); Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS);
/***** Get the code of the assignment *****/ /***** Get the code of the assignment *****/
ItsANewAssignment = ((Assignments.Asg.AsgCod = Asg_GetParamAsgCod ()) <= 0); ItsANewAssignment = ((Assignments.Asg.AsgCod = Par_GetParCode (Par_AsgCod)) <= 0);
/***** Get from the database the data of the assignment *****/ /***** Get from the database the data of the assignment *****/
if (ItsANewAssignment) if (ItsANewAssignment)
@ -1422,8 +1408,7 @@ void Asg_ReceiveFormAssignment (void)
Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS); Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS);
/***** Get the code of the assignment *****/ /***** Get the code of the assignment *****/
Assignments.Asg.AsgCod = Asg_GetParamAsgCod (); ItsANewAssignment = ((Assignments.Asg.AsgCod = Par_GetParCode (Par_AsgCod)) <= 0);
ItsANewAssignment = (Assignments.Asg.AsgCod < 0);
if (ItsANewAssignment) if (ItsANewAssignment)
{ {

View File

@ -99,7 +99,6 @@ void Asg_GetNotifAssignment (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
long AsgCod,bool GetContent); long AsgCod,bool GetContent);
void Asg_PutParamAsgCod (long AsgCod); void Asg_PutParamAsgCod (long AsgCod);
long Asg_GetParamAsgCod (void);
void Asg_ReqRemAssignment (void); void Asg_ReqRemAssignment (void);
void Asg_RemoveAssignment (void); void Asg_RemoveAssignment (void);
void Asg_HideAssignment (void); void Asg_HideAssignment (void);

View File

@ -33,6 +33,7 @@
#include "swad_error.h" #include "swad_error.h"
#include "swad_form.h" #include "swad_form.h"
#include "swad_pagination.h" #include "swad_pagination.h"
#include "swad_parameter.h"
#include "swad_program_database.h" #include "swad_program_database.h"
/*****************************************************************************/ /*****************************************************************************/
@ -54,7 +55,7 @@ void AsgRsc_GetLinkToAssignment (void)
Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS); Assignments.CurrentPage = Pag_GetParamPagNum (Pag_ASSIGNMENTS);
/***** Get assignment code *****/ /***** Get assignment code *****/
Assignments.Asg.AsgCod = Asg_GetParamAsgCod (); Assignments.Asg.AsgCod = Par_GetAndCheckParCode (Par_AsgCod);
/***** Get assignment title *****/ /***** Get assignment title *****/
AsgRsc_GetTitleFromAsgCod (Assignments.Asg.AsgCod,Title,sizeof (Title) - 1); AsgRsc_GetTitleFromAsgCod (Assignments.Asg.AsgCod,Title,sizeof (Title) - 1);

View File

@ -829,15 +829,6 @@ void Att_PutParamAttCod (long AttCod)
Par_PutHiddenParamLong (NULL,"AttCod",AttCod); Par_PutHiddenParamLong (NULL,"AttCod",AttCod);
} }
/*****************************************************************************/
/*************** Get parameter with code of attendance event *****************/
/*****************************************************************************/
long Att_GetParamAttCod (void)
{
return Par_GetParToLong ("AttCod");
}
/*****************************************************************************/ /*****************************************************************************/
/********* Ask for confirmation of removing of an attendance event ***********/ /********* Ask for confirmation of removing of an attendance event ***********/
/*****************************************************************************/ /*****************************************************************************/
@ -857,8 +848,7 @@ void Att_AskRemAttEvent (void)
Events.CurrentPage = Pag_GetParamPagNum (Pag_ATT_EVENTS); Events.CurrentPage = Pag_GetParamPagNum (Pag_ATT_EVENTS);
/***** Get attendance event code *****/ /***** Get attendance event code *****/
if ((Events.Event.AttCod = Att_GetParamAttCod ()) < 0) Events.Event.AttCod = Par_GetAndCheckParCode (Par_AttCod);
Err_WrongEventExit ();
/***** Get data of the attendance event from database *****/ /***** Get data of the attendance event from database *****/
Att_GetDataOfAttEventByCodAndCheckCrs (&Events.Event); Att_GetDataOfAttEventByCodAndCheckCrs (&Events.Event);
@ -884,8 +874,7 @@ void Att_GetAndRemAttEvent (void)
struct Att_Event Event; struct Att_Event Event;
/***** Get attendance event code *****/ /***** Get attendance event code *****/
if ((Event.AttCod = Att_GetParamAttCod ()) < 0) Event.AttCod = Par_GetAndCheckParCode (Par_AttCod);
Err_WrongEventExit ();
/***** Get data of the attendance event from database *****/ /***** Get data of the attendance event from database *****/
// Inside this function, the course is checked to be the current one // Inside this function, the course is checked to be the current one
@ -927,8 +916,7 @@ void Att_HideAttEvent (void)
struct Att_Event Event; struct Att_Event Event;
/***** Get attendance event code *****/ /***** Get attendance event code *****/
if ((Event.AttCod = Att_GetParamAttCod ()) < 0) Event.AttCod = Par_GetAndCheckParCode (Par_AttCod);
Err_WrongEventExit ();
/***** Get data of the attendance event from database *****/ /***** Get data of the attendance event from database *****/
Att_GetDataOfAttEventByCodAndCheckCrs (&Event); Att_GetDataOfAttEventByCodAndCheckCrs (&Event);
@ -949,8 +937,7 @@ void Att_UnhideAttEvent (void)
struct Att_Event Event; struct Att_Event Event;
/***** Get attendance event code *****/ /***** Get attendance event code *****/
if ((Event.AttCod = Att_GetParamAttCod ()) < 0) Event.AttCod = Par_GetAndCheckParCode (Par_AttCod);
Err_WrongEventExit ();
/***** Get data of the attendance event from database *****/ /***** Get data of the attendance event from database *****/
Att_GetDataOfAttEventByCodAndCheckCrs (&Event); Att_GetDataOfAttEventByCodAndCheckCrs (&Event);
@ -998,8 +985,7 @@ void Att_RequestCreatOrEditAttEvent (void)
Events.CurrentPage = Pag_GetParamPagNum (Pag_ATT_EVENTS); Events.CurrentPage = Pag_GetParamPagNum (Pag_ATT_EVENTS);
/***** Get the code of the attendance event *****/ /***** Get the code of the attendance event *****/
Events.Event.AttCod = Att_GetParamAttCod (); ItsANewAttEvent = ((Events.Event.AttCod = Par_GetParCode (Par_AttCod)) <= 0);
ItsANewAttEvent = (Events.Event.AttCod <= 0);
/***** Get from the database the data of the attendance event *****/ /***** Get from the database the data of the attendance event *****/
if (ItsANewAttEvent) if (ItsANewAttEvent)
@ -1206,7 +1192,7 @@ void Att_ReceiveFormAttEvent (void)
char Description[Cns_MAX_BYTES_TEXT + 1]; char Description[Cns_MAX_BYTES_TEXT + 1];
/***** Get the code of the attendance event *****/ /***** Get the code of the attendance event *****/
ItsANewAttEvent = ((ReceivedAtt.AttCod = Att_GetParamAttCod ()) <= 0); ItsANewAttEvent = ((ReceivedAtt.AttCod = Par_GetParCode (Par_AttCod)) <= 0);
if (!ItsANewAttEvent) if (!ItsANewAttEvent)
{ {
@ -1466,8 +1452,7 @@ void Att_SeeOneAttEvent (void)
Att_ResetEvents (&Events); Att_ResetEvents (&Events);
/***** Get attendance event code *****/ /***** Get attendance event code *****/
if ((Events.Event.AttCod = Att_GetParamAttCod ()) < 0) Events.Event.AttCod = Par_GetAndCheckParCode (Par_AttCod);
Err_WrongEventExit ();
/***** Show event *****/ /***** Show event *****/
Att_ShowEvent (&Events); Att_ShowEvent (&Events);
@ -1957,8 +1942,7 @@ void Att_RegisterMeAsStdInAttEvent (void)
Att_ResetEvents (&Events); Att_ResetEvents (&Events);
/***** Get attendance event code *****/ /***** Get attendance event code *****/
if ((Events.Event.AttCod = Att_GetParamAttCod ()) < 0) Events.Event.AttCod = Par_GetAndCheckParCode (Par_AttCod);
Err_WrongEventExit ();
Att_GetDataOfAttEventByCodAndCheckCrs (&Events.Event); // This checks that event belong to current course Att_GetDataOfAttEventByCodAndCheckCrs (&Events.Event); // This checks that event belong to current course
if (Events.Event.Open) if (Events.Event.Open)
@ -2021,8 +2005,7 @@ void Att_RegisterStudentsInAttEvent (void)
Att_ResetEvents (&Events); Att_ResetEvents (&Events);
/***** Get attendance event code *****/ /***** Get attendance event code *****/
if ((Events.Event.AttCod = Att_GetParamAttCod ()) < 0) Events.Event.AttCod = Par_GetAndCheckParCode (Par_AttCod);
Err_WrongEventExit ();
Att_GetDataOfAttEventByCodAndCheckCrs (&Events.Event); // This checks that event belong to current course Att_GetDataOfAttEventByCodAndCheckCrs (&Events.Event); // This checks that event belong to current course
/***** Get groups selected *****/ /***** Get groups selected *****/

View File

@ -91,7 +91,6 @@ void Att_RequestCreatOrEditAttEvent (void);
bool Att_GetDataOfAttEventByCod (struct Att_Event *Event); bool Att_GetDataOfAttEventByCod (struct Att_Event *Event);
void Att_PutParamAttCod (long AttCod); void Att_PutParamAttCod (long AttCod);
long Att_GetParamAttCod (void);
void Att_AskRemAttEvent (void); void Att_AskRemAttEvent (void);
void Att_GetAndRemAttEvent (void); void Att_GetAndRemAttEvent (void);

View File

@ -31,6 +31,7 @@
#include "swad_attendance_resource.h" #include "swad_attendance_resource.h"
#include "swad_error.h" #include "swad_error.h"
#include "swad_form.h" #include "swad_form.h"
#include "swad_parameter.h"
#include "swad_program_database.h" #include "swad_program_database.h"
/*****************************************************************************/ /*****************************************************************************/
@ -44,7 +45,7 @@ void AttRsc_GetLinkToEvent (void)
char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1]; char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
/***** Get attendance event code *****/ /***** Get attendance event code *****/
AttCod = Att_GetParamAttCod (); AttCod = Par_GetAndCheckParCode (Par_AttCod);
/***** Get attendance event title *****/ /***** Get attendance event title *****/
AttRsc_GetTitleFromAttCod (AttCod,Title,sizeof (Title) - 1); AttRsc_GetTitleFromAttCod (AttCod,Title,sizeof (Title) - 1);

View File

@ -517,16 +517,6 @@ static void Ban_PutParamBanCod (long BanCod)
Par_PutHiddenParamLong (NULL,"BanCod",BanCod); Par_PutHiddenParamLong (NULL,"BanCod",BanCod);
} }
/*****************************************************************************/
/******************** Get parameter with code of banner **********************/
/*****************************************************************************/
long Ban_GetParamBanCod (void)
{
/***** Get code of banner *****/
return Par_GetParToLong ("BanCod");
}
/*****************************************************************************/ /*****************************************************************************/
/******************************* Remove a banner *****************************/ /******************************* Remove a banner *****************************/
/*****************************************************************************/ /*****************************************************************************/
@ -540,8 +530,7 @@ void Ban_RemoveBanner (void)
Ban_ResetBanner (Ban); Ban_ResetBanner (Ban);
/***** Get banner code *****/ /***** Get banner code *****/
if ((Ban->BanCod = Ban_GetParamBanCod ()) <= 0) Ban->BanCod = Par_GetAndCheckParCode (Par_BanCod);
Err_WrongBannerExit ();
/***** Get data of the banner from database *****/ /***** Get data of the banner from database *****/
Ban_GetDataOfBannerByCod (Ban); Ban_GetDataOfBannerByCod (Ban);
@ -592,8 +581,7 @@ void Ban_HideBanner (void)
static void Ban_ShowOrHideBanner (struct Ban_Banner *Ban,bool Hide) static void Ban_ShowOrHideBanner (struct Ban_Banner *Ban,bool Hide)
{ {
/***** Get banner code *****/ /***** Get banner code *****/
if ((Ban->BanCod = Ban_GetParamBanCod ()) <= 0) Ban->BanCod = Par_GetAndCheckParCode (Par_BanCod);
Err_WrongBannerExit ();
/***** Get data of the banner from database *****/ /***** Get data of the banner from database *****/
Ban_GetDataOfBannerByCod (Ban); Ban_GetDataOfBannerByCod (Ban);
@ -667,8 +655,7 @@ static void Ban_RenameBanner (struct Ban_Banner *Ban,
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the code of the banner */ /* Get the code of the banner */
if ((Ban->BanCod = Ban_GetParamBanCod ()) <= 0) Ban->BanCod = Par_GetAndCheckParCode (Par_BanCod);
Err_WrongBannerExit ();
/* Get the new name for the banner */ /* Get the new name for the banner */
Par_GetParToText (ParamName,NewBanName,MaxBytes); Par_GetParToText (ParamName,NewBanName,MaxBytes);
@ -726,8 +713,7 @@ void Ban_ChangeBannerImg (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the code of the banner */ /* Get the code of the banner */
if ((Ban->BanCod = Ban_GetParamBanCod ()) <= 0) Ban->BanCod = Par_GetAndCheckParCode (Par_BanCod);
Err_WrongBannerExit ();
/* Get the new WWW for the banner */ /* Get the new WWW for the banner */
Par_GetParToText ("Img",NewImg,Ban_MAX_BYTES_IMAGE); Par_GetParToText ("Img",NewImg,Ban_MAX_BYTES_IMAGE);
@ -769,8 +755,7 @@ void Ban_ChangeBannerWWW (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the code of the banner */ /* Get the code of the banner */
if ((Ban->BanCod = Ban_GetParamBanCod ()) <= 0) Ban->BanCod = Par_GetAndCheckParCode (Par_BanCod);
Err_WrongBannerExit ();
/* Get the new WWW for the banner */ /* Get the new WWW for the banner */
Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW); Par_GetParToText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
@ -1030,8 +1015,7 @@ void Ban_ClickOnBanner (void)
struct Ban_Banner Ban; struct Ban_Banner Ban;
/***** Get banner code *****/ /***** Get banner code *****/
if ((Ban.BanCod = Ban_GetParamBanCod ()) <= 0) Ban.BanCod = Par_GetAndCheckParCode (Par_BanCod);
Err_WrongBannerExit ();
/***** Get data of the banner from database *****/ /***** Get data of the banner from database *****/
Ban_GetDataOfBannerByCod (&Ban); Ban_GetDataOfBannerByCod (&Ban);

View File

@ -1978,7 +1978,7 @@ static long Brw_GetGrpSettings (void)
{ {
long GrpCod; long GrpCod;
if ((GrpCod = Par_GetParToLong ("GrpCod")) > 0) if ((GrpCod = Par_GetParCode (Par_GrpCod)) > 0)
return GrpCod; return GrpCod;
else else
/***** Try to get group code from database *****/ /***** Try to get group code from database *****/
@ -2085,16 +2085,6 @@ void Brw_PutHiddenParamFilCod (long FilCod)
Par_PutHiddenParamLong (NULL,"FilCod",FilCod); Par_PutHiddenParamLong (NULL,"FilCod",FilCod);
} }
/*****************************************************************************/
/********************* Get parameter with code of file ***********************/
/*****************************************************************************/
long Brw_GetParamFilCod (void)
{
/***** Get code of file *****/
return Par_GetParToLong ("FilCod");
}
/*****************************************************************************/ /*****************************************************************************/
/**************** Write parameters related with file browser *****************/ /**************** Write parameters related with file browser *****************/
/*****************************************************************************/ /*****************************************************************************/
@ -7489,7 +7479,7 @@ void Brw_ShowFileMetadata (void)
Brw_GetParAndInitFileBrowser (); Brw_GetParAndInitFileBrowser ();
/***** Get file metadata *****/ /***** Get file metadata *****/
FileMetadata.FilCod = Brw_GetParamFilCod (); FileMetadata.FilCod = Par_GetAndCheckParCode (Par_FilCod);
Brw_GetFileMetadataByCod (&FileMetadata); Brw_GetFileMetadataByCod (&FileMetadata);
Found = Brw_GetFileTypeSizeAndDate (&FileMetadata); Found = Brw_GetFileTypeSizeAndDate (&FileMetadata);
@ -8299,7 +8289,7 @@ void Brw_ChgFileMetadata (void)
Brw_GetParAndInitFileBrowser (); Brw_GetParAndInitFileBrowser ();
/***** Get file metadata *****/ /***** Get file metadata *****/
FileMetadata.FilCod = Brw_GetParamFilCod (); FileMetadata.FilCod = Par_GetAndCheckParCode (Par_FilCod);
Brw_GetFileMetadataByCod (&FileMetadata); Brw_GetFileMetadataByCod (&FileMetadata);
Found = Brw_GetFileTypeSizeAndDate (&FileMetadata); Found = Brw_GetFileTypeSizeAndDate (&FileMetadata);

View File

@ -182,7 +182,6 @@ struct Brw_FileMetadata
void Brw_GetParAndInitFileBrowser (void); void Brw_GetParAndInitFileBrowser (void);
void Brw_PutHiddenParamFilCod (long FilCod); void Brw_PutHiddenParamFilCod (long FilCod);
long Brw_GetParamFilCod (void);
void Brw_InitializeFileBrowser (void); void Brw_InitializeFileBrowser (void);
bool Brw_CheckIfExistsFolderAssigmentForAnyUsr (const char *FolderName); bool Brw_CheckIfExistsFolderAssigmentForAnyUsr (const char *FolderName);
bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName, bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName,

View File

@ -32,6 +32,7 @@
#include "swad_error.h" #include "swad_error.h"
#include "swad_form.h" #include "swad_form.h"
#include "swad_global.h" #include "swad_global.h"
#include "swad_parameter.h"
#include "swad_program.h" #include "swad_program.h"
#include "swad_program_database.h" #include "swad_program_database.h"
#include "swad_program_resource.h" #include "swad_program_resource.h"
@ -57,7 +58,7 @@ void BrwRsc_GetLinkToFile (void)
Brw_GetParAndInitFileBrowser (); Brw_GetParAndInitFileBrowser ();
/***** Get file code *****/ /***** Get file code *****/
FilCod = Brw_GetParamFilCod (); FilCod = Par_GetAndCheckParCode (Par_FilCod);
/***** Get file title *****/ /***** Get file title *****/
switch (Gbl.Action.Act) switch (Gbl.Action.Act)

View File

@ -492,16 +492,6 @@ static void Bld_PutParamBldCod (void *BldCod)
Par_PutHiddenParamLong (NULL,"BldCod",*((long *) BldCod)); Par_PutHiddenParamLong (NULL,"BldCod",*((long *) BldCod));
} }
/*****************************************************************************/
/******************** Get parameter with code of building ********************/
/*****************************************************************************/
long Bld_GetParamBldCod (void)
{
/***** Get code of building *****/
return Par_GetParToLong ("BldCod");
}
/*****************************************************************************/ /*****************************************************************************/
/****************************** Remove a building ****************************/ /****************************** Remove a building ****************************/
/*****************************************************************************/ /*****************************************************************************/
@ -514,8 +504,7 @@ void Bld_RemoveBuilding (void)
Bld_EditingBuildingConstructor (); Bld_EditingBuildingConstructor ();
/***** Get building code *****/ /***** Get building code *****/
if ((Bld_EditingBuilding->BldCod = Bld_GetParamBldCod ()) <= 0) Bld_EditingBuilding->BldCod = Par_GetAndCheckParCode (Par_BldCod);
Err_WrongBuildingExit ();
/***** Get data of the building from database *****/ /***** Get data of the building from database *****/
Bld_GetDataOfBuildingByCod (Bld_EditingBuilding); Bld_GetDataOfBuildingByCod (Bld_EditingBuilding);
@ -591,8 +580,7 @@ static void Bld_RenameBuilding (Cns_ShrtOrFullName_t ShrtOrFullName)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the code of the building */ /* Get the code of the building */
if ((Bld_EditingBuilding->BldCod = Bld_GetParamBldCod ()) <= 0) Bld_EditingBuilding->BldCod = Par_GetAndCheckParCode (Par_BldCod);
Err_WrongBuildingExit ();
/* Get the new name for the building */ /* Get the new name for the building */
Par_GetParToText (ParamName,NewClaName,MaxBytes); Par_GetParToText (ParamName,NewClaName,MaxBytes);
@ -649,8 +637,7 @@ void Bld_ChangeBuildingLocation (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the code of the building */ /* Get the code of the building */
if ((Bld_EditingBuilding->BldCod = Bld_GetParamBldCod ()) <= 0) Bld_EditingBuilding->BldCod = Par_GetAndCheckParCode (Par_BldCod);
Err_WrongBuildingExit ();
/* Get the new location for the building */ /* Get the new location for the building */
Par_GetParToText ("Location",NewLocation,Bld_MAX_BYTES_LOCATION); Par_GetParToText ("Location",NewLocation,Bld_MAX_BYTES_LOCATION);

View File

@ -90,7 +90,6 @@ void Bld_FreeListBuildings (struct Bld_Buildings *Buildings);
void Bld_GetListBuildingsInThisCtr (void); void Bld_GetListBuildingsInThisCtr (void);
void Bld_GetDataOfBuildingByCod (struct Bld_Building *Roo); void Bld_GetDataOfBuildingByCod (struct Bld_Building *Roo);
long Bld_GetParamBldCod (void);
void Bld_RemoveBuilding (void); void Bld_RemoveBuilding (void);
void Bld_RenameBuildingShort (void); void Bld_RenameBuildingShort (void);

View File

@ -169,7 +169,7 @@ static long Cfe_GetParamsCallsForExams (struct Cfe_CallsForExams *CallsForExams)
long ExaCod; long ExaCod;
/***** Get the code of the call for exam *****/ /***** Get the code of the call for exam *****/
ExaCod = Cfe_GetParamExaCod (); ExaCod = Par_GetAndCheckParCode (Par_ExaCod);
/***** Get the name of the course (it is allowed to be different from the official name of the course) *****/ /***** Get the name of the course (it is allowed to be different from the official name of the course) *****/
Par_GetParToText ("CrsName",CallsForExams->CallForExam.CrsFullName,Cns_HIERARCHY_MAX_BYTES_FULL_NAME); Par_GetParToText ("CrsName",CallsForExams->CallForExam.CrsFullName,Cns_HIERARCHY_MAX_BYTES_FULL_NAME);
@ -379,8 +379,7 @@ void Cfe_PrintCallForExam (void)
Cfe_AllocMemCallForExam (&CallsForExams); Cfe_AllocMemCallForExam (&CallsForExams);
/***** Get the code of the call for exam *****/ /***** Get the code of the call for exam *****/
if ((ExaCod = Cfe_GetParamExaCod ()) <= 0) ExaCod = Par_GetAndCheckParCode (Par_ExaCod);
Err_WrongCallForExamExit ();
/***** Read call for exam from the database *****/ /***** Read call for exam from the database *****/
Cfe_GetDataCallForExamFromDB (&CallsForExams,ExaCod); Cfe_GetDataCallForExamFromDB (&CallsForExams,ExaCod);
@ -407,8 +406,7 @@ void Cfe_ReqRemoveCallForExam (void)
Cfe_ResetCallsForExams (&CallsForExams); Cfe_ResetCallsForExams (&CallsForExams);
/***** Get the code of the call for exam *****/ /***** Get the code of the call for exam *****/
if ((ExaCod = Cfe_GetParamExaCod ()) <= 0) ExaCod = Par_GetAndCheckParCode (Par_ExaCod);
Err_WrongCallForExamExit ();
/***** Show question and button to remove call for exam *****/ /***** Show question and button to remove call for exam *****/
/* Begin alert */ /* Begin alert */
@ -442,8 +440,7 @@ void Cfe_RemoveCallForExam1 (void)
Cfe_ResetCallsForExams (CallsForExams); Cfe_ResetCallsForExams (CallsForExams);
/***** Get the code of the call for exam *****/ /***** Get the code of the call for exam *****/
if ((ExaCod = Cfe_GetParamExaCod ()) <= 0) ExaCod = Par_GetAndCheckParCode (Par_ExaCod);
Err_WrongCallForExamExit ();
/***** Mark the call for exam as deleted in the database *****/ /***** Mark the call for exam as deleted in the database *****/
Cfe_DB_MarkACallForExamAsDeleted (ExaCod); Cfe_DB_MarkACallForExamAsDeleted (ExaCod);
@ -484,8 +481,7 @@ void Cfe_HideCallForExam (void)
Cfe_ResetCallsForExams (CallsForExams); Cfe_ResetCallsForExams (CallsForExams);
/***** Get the code of the call for exam *****/ /***** Get the code of the call for exam *****/
if ((ExaCod = Cfe_GetParamExaCod ()) <= 0) ExaCod = Par_GetAndCheckParCode (Par_ExaCod);
Err_WrongCallForExamExit ();
/***** Mark the call for exam as hidden in the database *****/ /***** Mark the call for exam as hidden in the database *****/
Cfe_DB_HideCallForExam (ExaCod); Cfe_DB_HideCallForExam (ExaCod);
@ -509,8 +505,7 @@ void Cfe_UnhideCallForExam (void)
Cfe_ResetCallsForExams (CallsForExams); Cfe_ResetCallsForExams (CallsForExams);
/***** Get the code of the call for exam *****/ /***** Get the code of the call for exam *****/
if ((ExaCod = Cfe_GetParamExaCod ()) <= 0) ExaCod = Par_GetAndCheckParCode (Par_ExaCod);
Err_WrongCallForExamExit ();
/***** Mark the call for exam as visible in the database *****/ /***** Mark the call for exam as visible in the database *****/
Cfe_DB_UnhideCallForExam (ExaCod); Cfe_DB_UnhideCallForExam (ExaCod);
@ -592,7 +587,7 @@ static void Cfe_GetExaCodToHighlight (struct Cfe_CallsForExams *CallsForExams)
{ {
/***** Get the call for exam code /***** Get the call for exam code
of the call for exam to highlight *****/ of the call for exam to highlight *****/
CallsForExams->HighlightExaCod = Cfe_GetParamExaCod (); CallsForExams->HighlightExaCod = Par_GetParCode (Par_ExaCod);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1562,16 +1557,6 @@ void Cfe_PutHiddenParamExaCod (long ExaCod)
Par_PutHiddenParamLong (NULL,"ExaCod",ExaCod); Par_PutHiddenParamLong (NULL,"ExaCod",ExaCod);
} }
/*****************************************************************************/
/************ Get parameter with the code of a call for exam *****************/
/*****************************************************************************/
long Cfe_GetParamExaCod (void)
{
/* Get notice code */
return Par_GetParToLong ("ExaCod");
}
/*****************************************************************************/ /*****************************************************************************/
/************** Get summary and content about a call for exam ****************/ /************** Get summary and content about a call for exam ****************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -132,7 +132,6 @@ void Cfe_CreateListCallsForExams (struct Cfe_CallsForExams *CallsForExams);
bool Cfe_CheckIfICanEditCallsForExams (void); bool Cfe_CheckIfICanEditCallsForExams (void);
void Cfe_PutHiddenParamExaCod (long ExaCod); void Cfe_PutHiddenParamExaCod (long ExaCod);
long Cfe_GetParamExaCod (void);
void Cfe_GetSummaryAndContentCallForExam (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1], void Cfe_GetSummaryAndContentCallForExam (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr, char **ContentStr,

View File

@ -31,6 +31,7 @@
#include "swad_call_for_exam_resource.h" #include "swad_call_for_exam_resource.h"
#include "swad_error.h" #include "swad_error.h"
#include "swad_form.h" #include "swad_form.h"
#include "swad_parameter.h"
#include "swad_program_database.h" #include "swad_program_database.h"
/*****************************************************************************/ /*****************************************************************************/
@ -45,7 +46,7 @@ void Cfe_GetLinkToCallForExam (void)
char Title[Cfe_MAX_BYTES_SESSION_AND_DATE]; char Title[Cfe_MAX_BYTES_SESSION_AND_DATE];
/***** Get the code of the call for exam *****/ /***** Get the code of the call for exam *****/
ExaCod = Cfe_GetParamExaCod (); ExaCod = Par_GetAndCheckParCode (Par_ExaCod);
/***** Get session and date of the exam *****/ /***** Get session and date of the exam *****/
CfeRsc_GetTitleFromExaCod (ExaCod,Title,sizeof (Title) - 1); CfeRsc_GetTitleFromExaCod (ExaCod,Title,sizeof (Title) - 1);

View File

@ -961,21 +961,6 @@ void Ctr_PutParamCtrCod (long CtrCod)
Par_PutHiddenParamLong (NULL,"ctr",CtrCod); Par_PutHiddenParamLong (NULL,"ctr",CtrCod);
} }
/*****************************************************************************/
/****************** Get parameter with code of other center ******************/
/*****************************************************************************/
long Ctr_GetAndCheckParamOtherCtrCod (long MinCodAllowed)
{
long CtrCod;
/***** Get and check parameter with code of center *****/
if ((CtrCod = Par_GetParToLong ("OthCtrCod")) < MinCodAllowed)
Err_WrongCenterExit ();
return CtrCod;
}
/*****************************************************************************/ /*****************************************************************************/
/******************************* Remove a center *****************************/ /******************************* Remove a center *****************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -94,7 +94,6 @@ bool Ctr_GetDataOfCenterByCod (struct Ctr_Center *Ctr);
void Ctr_FreeListCenters (void); void Ctr_FreeListCenters (void);
void Ctr_WriteSelectorOfCenter (void); void Ctr_WriteSelectorOfCenter (void);
void Ctr_PutParamCtrCod (long CtrCod); void Ctr_PutParamCtrCod (long CtrCod);
long Ctr_GetAndCheckParamOtherCtrCod (long MinCodAllowed);
void Ctr_RemoveCenter (void); void Ctr_RemoveCenter (void);
void Ctr_ChangeCtrPlc (void); void Ctr_ChangeCtrPlc (void);
void Ctr_RenameCenterShort (void); void Ctr_RenameCenterShort (void);

View File

@ -1006,7 +1006,7 @@ void CtrCfg_ChangeCtrIns (void)
struct Ins_Instit NewIns; struct Ins_Instit NewIns;
/***** Get parameter with institution code *****/ /***** Get parameter with institution code *****/
NewIns.InsCod = Ins_GetAndCheckParamOtherInsCod (1); NewIns.InsCod = Par_GetAndCheckParCode (Par_OthInsCod);
/***** Check if institution has changed *****/ /***** Check if institution has changed *****/
if (NewIns.InsCod != Gbl.Hierarchy.Ctr.InsCod) if (NewIns.InsCod != Gbl.Hierarchy.Ctr.InsCod)

View File

@ -629,10 +629,12 @@ TODO: Emilce Barrera Mesa: Podr
TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen. TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen.
*/ */
#define Log_PLATFORM_VERSION "SWAD 22.66.3 (2023-03-04)" #define Log_PLATFORM_VERSION "SWAD 22.67 (2023-03-04)"
#define CSS_FILE "swad22.57.1.css" #define CSS_FILE "swad22.57.1.css"
#define JS_FILE "swad22.49.js" #define JS_FILE "swad22.49.js"
/* /*
Version 22.67: Mar 04, 2023 Code refactoring in parameters. Not finished. (337245 lines)
Version 22.66.4: Mar 04, 2023 Fixed issues in exams. (337245 lines)
Version 22.66.3: Mar 04, 2023 New action to edit a new rubric criterion. Not finished. (337198 lines) Version 22.66.3: Mar 04, 2023 New action to edit a new rubric criterion. Not finished. (337198 lines)
Version 22.66.2: Mar 03, 2023 Fixed bugs in figures. (337128 lines) Version 22.66.2: Mar 03, 2023 Fixed bugs in figures. (337128 lines)
Version 22.66.1: Mar 02, 2023 Rubric removal. (337126 lines) Version 22.66.1: Mar 02, 2023 Rubric removal. (337126 lines)

View File

@ -80,7 +80,6 @@ static void Cty_PutIconToViewCountries (void);
static void Cty_ListCountriesForEdition (void); static void Cty_ListCountriesForEdition (void);
static void Cty_PutParamOtherCtyCod (void *CtyCod); static void Cty_PutParamOtherCtyCod (void *CtyCod);
static long Cty_GetParamOtherCtyCod (void);
static void Cty_UpdateCtyName (long CtyCod,const char *FieldName,const char *NewCtyName); static void Cty_UpdateCtyName (long CtyCod,const char *FieldName,const char *NewCtyName);
@ -1184,27 +1183,6 @@ static void Cty_PutParamOtherCtyCod (void *CtyCod)
Par_PutHiddenParamLong (NULL,"OthCtyCod",*((long *) CtyCod)); Par_PutHiddenParamLong (NULL,"OthCtyCod",*((long *) CtyCod));
} }
/*****************************************************************************/
/******************* Get parameter with code of country **********************/
/*****************************************************************************/
long Cty_GetAndCheckParamOtherCtyCod (long MinCodAllowed)
{
long CtyCod;
/***** Get and check parameter with code of country *****/
if ((CtyCod = Cty_GetParamOtherCtyCod ()) < MinCodAllowed)
Err_WrongCountrExit ();
return CtyCod;
}
static long Cty_GetParamOtherCtyCod (void)
{
/***** Get code of country *****/
return Par_GetParToLong ("OthCtyCod");
}
/*****************************************************************************/ /*****************************************************************************/
/****************************** Remove a country *****************************/ /****************************** Remove a country *****************************/
/*****************************************************************************/ /*****************************************************************************/
@ -1218,7 +1196,7 @@ void Cty_RemoveCountry (void)
Cty_EditingCountryConstructor (); Cty_EditingCountryConstructor ();
/***** Get country code *****/ /***** Get country code *****/
Cty_EditingCty->CtyCod = Cty_GetAndCheckParamOtherCtyCod (0); Cty_EditingCty->CtyCod = Par_GetAndCheckParCode (Par_OthCtyCod);
/***** Get data of the country from database *****/ /***** Get data of the country from database *****/
Cty_GetDataOfCountryByCod (Cty_EditingCty); Cty_GetDataOfCountryByCod (Cty_EditingCty);
@ -1279,7 +1257,7 @@ void Cty_RenameCountry (void)
Cty_EditingCountryConstructor (); Cty_EditingCountryConstructor ();
/***** Get the code of the country *****/ /***** Get the code of the country *****/
Cty_EditingCty->CtyCod = Cty_GetAndCheckParamOtherCtyCod (0); Cty_EditingCty->CtyCod = Par_GetAndCheckParCode (Par_OthCtyCod);
/***** Get the lenguage *****/ /***** Get the lenguage *****/
Language = Lan_GetParamLanguage (); Language = Lan_GetParamLanguage ();
@ -1358,7 +1336,7 @@ void Cty_ChangeCtyWWW (void)
Cty_EditingCountryConstructor (); Cty_EditingCountryConstructor ();
/***** Get the code of the country *****/ /***** Get the code of the country *****/
Cty_EditingCty->CtyCod = Cty_GetAndCheckParamOtherCtyCod (0); Cty_EditingCty->CtyCod = Par_GetAndCheckParCode (Par_OthCtyCod);
/***** Get the lenguage *****/ /***** Get the lenguage *****/
Language = Lan_GetParamLanguage (); Language = Lan_GetParamLanguage ();
@ -1587,7 +1565,7 @@ void Cty_ReceiveFormNewCountry (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get numeric country code */ /* Get numeric country code */
if ((Cty_EditingCty->CtyCod = Cty_GetParamOtherCtyCod ()) < 0) if ((Cty_EditingCty->CtyCod = Par_GetParCode (Par_OthCtyCod)) < 0)
{ {
Ale_CreateAlert (Ale_WARNING,NULL, Ale_CreateAlert (Ale_WARNING,NULL,
Txt_You_must_specify_the_numerical_code_of_the_new_country); Txt_You_must_specify_the_numerical_code_of_the_new_country);

View File

@ -104,7 +104,6 @@ void Cty_FlushCacheCountryName (void);
void Cty_GetCountryName (long CtyCod,Lan_Language_t Language, void Cty_GetCountryName (long CtyCod,Lan_Language_t Language,
char CtyName[Cty_MAX_BYTES_NAME + 1]); char CtyName[Cty_MAX_BYTES_NAME + 1]);
void Cty_PutParamCtyCod (long CtyCod); void Cty_PutParamCtyCod (long CtyCod);
long Cty_GetAndCheckParamOtherCtyCod (long MinCodAllowed);
void Cty_RemoveCountry (void); void Cty_RemoveCountry (void);
void Cty_RenameCountry (void); void Cty_RenameCountry (void);
void Cty_ChangeCtyWWW (void); void Cty_ChangeCtyWWW (void);

View File

@ -472,7 +472,7 @@ void CrsCfg_ChangeCrsDeg (void)
struct Deg_Degree NewDeg; struct Deg_Degree NewDeg;
/***** Get parameter with degree code *****/ /***** Get parameter with degree code *****/
NewDeg.DegCod = Deg_GetAndCheckParamOtherDegCod (1L); NewDeg.DegCod = Par_GetAndCheckParCode (Par_OthDegCod);
/***** Check if degree has changed *****/ /***** Check if degree has changed *****/
if (NewDeg.DegCod != Gbl.Hierarchy.Crs.DegCod) if (NewDeg.DegCod != Gbl.Hierarchy.Crs.DegCod)

View File

@ -1176,21 +1176,6 @@ void Deg_PutParamDegCod (long DegCod)
Par_PutHiddenParamLong (NULL,"deg",DegCod); Par_PutHiddenParamLong (NULL,"deg",DegCod);
} }
/*****************************************************************************/
/********************* Get parameter with code of degree *********************/
/*****************************************************************************/
long Deg_GetAndCheckParamOtherDegCod (long MinCodAllowed)
{
long DegCod;
/***** Get and check parameter with code of degree *****/
if ((DegCod = Par_GetParToLong ("OthDegCod")) < MinCodAllowed)
Err_WrongDegreeExit ();
return DegCod;
}
/*****************************************************************************/ /*****************************************************************************/
/********************* Get data of a degree from its code ********************/ /********************* Get data of a degree from its code ********************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -93,7 +93,6 @@ void Deg_ReceiveFormNewDeg (void);
void Deg_RemoveDegree (void); void Deg_RemoveDegree (void);
void Deg_PutParamDegCod (long DegCod); void Deg_PutParamDegCod (long DegCod);
long Deg_GetAndCheckParamOtherDegCod (long MinCodAllowed);
bool Deg_GetDataOfDegreeByCod (struct Deg_Degree *Deg); bool Deg_GetDataOfDegreeByCod (struct Deg_Degree *Deg);
void Deg_RemoveDegreeCompletely (long DegCod); void Deg_RemoveDegreeCompletely (long DegCod);

View File

@ -360,7 +360,7 @@ void DegCfg_ChangeDegCtr (void)
struct Ctr_Center NewCtr; struct Ctr_Center NewCtr;
/***** Get parameter with center code *****/ /***** Get parameter with center code *****/
NewCtr.CtrCod = Ctr_GetAndCheckParamOtherCtrCod (1); NewCtr.CtrCod = Par_GetAndCheckParCode (Par_OthCtrCod);
/***** Check if center has changed *****/ /***** Check if center has changed *****/
if (NewCtr.CtrCod != Gbl.Hierarchy.Deg.CtrCod) if (NewCtr.CtrCod != Gbl.Hierarchy.Deg.CtrCod)

View File

@ -626,7 +626,7 @@ void Dpt_ChangeDepartIns (void)
Dpt_EditingDpt->DptCod = Dpt_GetAndCheckParamDptCod (1); Dpt_EditingDpt->DptCod = Dpt_GetAndCheckParamDptCod (1);
/* Get parameter with institution code */ /* Get parameter with institution code */
NewInsCod = Ins_GetAndCheckParamOtherInsCod (1); NewInsCod = Par_GetAndCheckParCode (Par_OthInsCod);
/***** Get data of the department from database *****/ /***** Get data of the department from database *****/
Dpt_GetDataOfDepartmentByCod (Dpt_EditingDpt); Dpt_GetDataOfDepartmentByCod (Dpt_EditingDpt);
@ -919,7 +919,7 @@ void Dpt_ReceiveFormNewDpt (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get institution */ /* Get institution */
Dpt_EditingDpt->InsCod = Ins_GetAndCheckParamOtherInsCod (1); Dpt_EditingDpt->InsCod = Par_GetAndCheckParCode (Par_OthInsCod);
/* Get department short name */ /* Get department short name */
Par_GetParToText ("ShortName",Dpt_EditingDpt->ShrtName,Cns_HIERARCHY_MAX_BYTES_SHRT_NAME); Par_GetParToText ("ShortName",Dpt_EditingDpt->ShrtName,Cns_HIERARCHY_MAX_BYTES_SHRT_NAME);

View File

@ -473,6 +473,15 @@ void Err_WrongWhoExit (void)
Err_ShowErrorAndExit ("Wrong parameter who."); Err_ShowErrorAndExit ("Wrong parameter who.");
} }
/*****************************************************************************/
/**************** Write error message and exit when wrong code ***************/
/*****************************************************************************/
void Err_WrongCodeExit (void)
{
Err_ShowErrorAndExit ("Wrong code.");
}
/*****************************************************************************/ /*****************************************************************************/
/**************** Write error message and exit when wrong event **************/ /**************** Write error message and exit when wrong event **************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -82,6 +82,7 @@ void Err_WrongCriterionExit (void);
void Err_WrongCriterionIndexExit (void); void Err_WrongCriterionIndexExit (void);
void Err_WrongSurveyExit (void); void Err_WrongSurveyExit (void);
void Err_WrongWhoExit (void); void Err_WrongWhoExit (void);
void Err_WrongCodeExit (void);
void Err_WrongEventExit (void); void Err_WrongEventExit (void);
void Err_WrongAnnouncementExit (void); void Err_WrongAnnouncementExit (void);
void Err_WrongNoticeExit (void); void Err_WrongNoticeExit (void);

View File

@ -662,7 +662,7 @@ static void ExaSet_ListSetQuestions (struct Exa_Exams *Exams,
bool ICanEditQuestions = Exa_CheckIfEditable (&Exams->Exam); bool ICanEditQuestions = Exa_CheckIfEditable (&Exams->Exam);
/***** Begin box *****/ /***** Begin box *****/
Box_BoxBegin (NULL,Txt_Questions, Box_BoxBegin ("100%",Txt_Questions,
ICanEditQuestions ? ExaSet_PutIconToAddNewQuestions : ICanEditQuestions ? ExaSet_PutIconToAddNewQuestions :
NULL, NULL,
ICanEditQuestions ? Exams : ICanEditQuestions ? Exams :
@ -970,7 +970,7 @@ static void ExaSet_ListOneOrMoreQuestionsForEdition (struct Exa_Exams *Exams,
else else
Ico_PutIconRemovalNotAllowed (); Ico_PutIconRemovalNotAllowed ();
/* Put icon to cancel the question */ /* Put icon to validate/invalidate the question */
Lay_PutContextualLinkOnlyIcon (ValInv[Question.Validity].NextAction,Anchor, Lay_PutContextualLinkOnlyIcon (ValInv[Question.Validity].NextAction,Anchor,
ExaSet_PutParamsOneQst,Exams, ExaSet_PutParamsOneQst,Exams,
ValInv[Question.Validity].Icon, ValInv[Question.Validity].Icon,

View File

@ -143,8 +143,6 @@ static void Grp_RemoveGroupTypeCompletely (void);
static void Grp_RemoveGroupCompletely (void); static void Grp_RemoveGroupCompletely (void);
static void Grp_WriteMaxStds (char Str[Cns_MAX_DECIMAL_DIGITS_UINT + 1],unsigned MaxStudents); static void Grp_WriteMaxStds (char Str[Cns_MAX_DECIMAL_DIGITS_UINT + 1],unsigned MaxStudents);
static long Grp_GetParamGrpTypCod (void);
static long Grp_GetParamGrpCod (void);
static void Grp_PutParamGrpTypCod (void *GrpTypCod); static void Grp_PutParamGrpTypCod (void *GrpTypCod);
/*****************************************************************************/ /*****************************************************************************/
@ -3297,7 +3295,7 @@ void Grp_ReceiveFormNewGrp (void)
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME]; char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get parameters from form *****/ /***** Get parameters from form *****/
if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) > 0) // Group type valid if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Par_GetParCode (Par_GrpTypCod)) > 0) // Group type valid
{ {
/* Get group name */ /* Get group name */
Par_GetParToText ("GrpName",Gbl.Crs.Grps.GrpName, Par_GetParToText ("GrpName",Gbl.Crs.Grps.GrpName,
@ -3362,8 +3360,7 @@ void Grp_ReqRemGroupType (void)
unsigned NumGrps; unsigned NumGrps;
/***** Get the code of the group type *****/ /***** Get the code of the group type *****/
if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) <= 0) Gbl.Crs.Grps.GrpTyp.GrpTypCod = Par_GetAndCheckParCode (Par_GrpTypCod);
Err_WrongGrpTypExit ();
/***** Check if this group type has groups *****/ /***** Check if this group type has groups *****/
if ((NumGrps = Grp_DB_CountNumGrpsInThisCrsOfType (Gbl.Crs.Grps.GrpTyp.GrpTypCod))) // Group type has groups ==> Ask for confirmation if ((NumGrps = Grp_DB_CountNumGrpsInThisCrsOfType (Gbl.Crs.Grps.GrpTyp.GrpTypCod))) // Group type has groups ==> Ask for confirmation
@ -3379,8 +3376,7 @@ void Grp_ReqRemGroupType (void)
void Grp_ReqRemGroup (void) void Grp_ReqRemGroup (void)
{ {
/***** Get group code *****/ /***** Get group code *****/
if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) <= 0) Gbl.Crs.Grps.GrpCod = Par_GetAndCheckParCode (Par_GrpCod);
Err_WrongGroupExit ();
/***** Confirm removing *****/ /***** Confirm removing *****/
Grp_AskConfirmRemGrp (); Grp_AskConfirmRemGrp ();
@ -3476,8 +3472,7 @@ static void Grp_AskConfirmRemGrp (void)
void Grp_RemoveGroupType (void) void Grp_RemoveGroupType (void)
{ {
/***** Get param with code of group type *****/ /***** Get param with code of group type *****/
if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) <= 0) Gbl.Crs.Grps.GrpTyp.GrpTypCod = Par_GetAndCheckParCode (Par_GrpTypCod);
Err_WrongGrpTypExit ();
/***** Remove group type and its groups *****/ /***** Remove group type and its groups *****/
Grp_RemoveGroupTypeCompletely (); Grp_RemoveGroupTypeCompletely ();
@ -3490,8 +3485,7 @@ void Grp_RemoveGroupType (void)
void Grp_RemoveGroup (void) void Grp_RemoveGroup (void)
{ {
/***** Get param with group code *****/ /***** Get param with group code *****/
if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) <= 0) Gbl.Crs.Grps.GrpCod = Par_GetAndCheckParCode (Par_GrpCod);
Err_WrongGroupExit ();
/***** Remove group *****/ /***** Remove group *****/
Grp_RemoveGroupCompletely (); Grp_RemoveGroupCompletely ();
@ -3609,8 +3603,7 @@ void Grp_OpenGroup (void)
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME]; char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get group code *****/ /***** Get group code *****/
if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) <= 0) Gbl.Crs.Grps.GrpCod = Par_GetAndCheckParCode (Par_GrpCod);
Err_WrongGroupExit ();
/***** Get group data from database *****/ /***** Get group data from database *****/
GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod;
@ -3640,8 +3633,7 @@ void Grp_CloseGroup (void)
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME]; char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get group code *****/ /***** Get group code *****/
if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) <= 0) Gbl.Crs.Grps.GrpCod = Par_GetAndCheckParCode (Par_GrpCod);
Err_WrongGroupExit ();
/***** Get group data from database *****/ /***** Get group data from database *****/
GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod;
@ -3671,8 +3663,7 @@ void Grp_EnableFileZonesGrp (void)
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME]; char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get group code *****/ /***** Get group code *****/
if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) <= 0) Gbl.Crs.Grps.GrpCod = Par_GetAndCheckParCode (Par_GrpCod);
Err_WrongGroupExit ();
/***** Get group data from database *****/ /***** Get group data from database *****/
GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod;
@ -3703,8 +3694,7 @@ void Grp_DisableFileZonesGrp (void)
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME]; char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
/***** Get group code *****/ /***** Get group code *****/
if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) <= 0) Gbl.Crs.Grps.GrpCod = Par_GetAndCheckParCode (Par_GrpCod);
Err_WrongGroupExit ();
/***** Get group data from database *****/ /***** Get group data from database *****/
GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod;
@ -3739,11 +3729,10 @@ void Grp_ChangeGroupType (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get group code */ /* Get group code */
if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) <= 0) Gbl.Crs.Grps.GrpCod = Par_GetAndCheckParCode (Par_GrpCod);
Err_WrongGroupExit ();
/* Get the new group type */ /* Get the new group type */
NewGrpTypCod = Grp_GetParamGrpTypCod (); NewGrpTypCod = Par_GetAndCheckParCode (Par_GrpTypCod);
/* Get from the database the type and the name of the group */ /* Get from the database the type and the name of the group */
GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod;
@ -3789,8 +3778,7 @@ void Grp_ChangeGroupRoom (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get group code */ /* Get group code */
if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) <= 0) Gbl.Crs.Grps.GrpCod = Par_GetAndCheckParCode (Par_GrpCod);
Err_WrongGroupExit ();
/* Get the new room */ /* Get the new room */
NewRooCod = Roo_GetParamRooCod (); NewRooCod = Roo_GetParamRooCod ();
@ -3829,8 +3817,7 @@ void Grp_ChangeMandatGrpTyp (void)
/***** Get parameters of the form *****/ /***** Get parameters of the form *****/
/* Get the código of type of group */ /* Get the código of type of group */
if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) <= 0) Gbl.Crs.Grps.GrpTyp.GrpTypCod = Par_GetAndCheckParCode (Par_GrpTypCod);
Err_WrongGrpTypExit ();
/* Get the new type of enrolment (mandatory or voluntaria) of this type of group */ /* Get the new type of enrolment (mandatory or voluntaria) of this type of group */
NewMandatoryEnrolment = Par_GetParToBool ("MandatoryEnrolment"); NewMandatoryEnrolment = Par_GetParToBool ("MandatoryEnrolment");
@ -3883,8 +3870,7 @@ void Grp_ChangeMultiGrpTyp (void)
/***** Get parameters from the form *****/ /***** Get parameters from the form *****/
/* Get the code of type of group */ /* Get the code of type of group */
if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) <= 0) Gbl.Crs.Grps.GrpTyp.GrpTypCod = Par_GetAndCheckParCode (Par_GrpTypCod);
Err_WrongGrpTypExit ();
/* Get the new type of enrolment (single or multiple) of this type of group */ /* Get the new type of enrolment (single or multiple) of this type of group */
NewMultipleEnrolment = Par_GetParToBool ("MultipleEnrolment"); NewMultipleEnrolment = Par_GetParToBool ("MultipleEnrolment");
@ -3930,8 +3916,7 @@ void Grp_ChangeOpenTimeGrpTyp (void)
extern const char *Txt_The_date_time_of_opening_of_groups_has_changed; extern const char *Txt_The_date_time_of_opening_of_groups_has_changed;
/***** Get the code of type of group *****/ /***** Get the code of type of group *****/
if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) <= 0) Gbl.Crs.Grps.GrpTyp.GrpTypCod = Par_GetAndCheckParCode (Par_GrpTypCod);
Err_WrongGrpTypExit ();
/***** Get from the database the data of this type of group *****/ /***** Get from the database the data of this type of group *****/
Grp_GetDataOfGroupTypeByCod (&Gbl.Crs.Grps.GrpTyp); Grp_GetDataOfGroupTypeByCod (&Gbl.Crs.Grps.GrpTyp);
@ -3970,8 +3955,7 @@ void Grp_ChangeMaxStdsGrp (void)
/***** Get parameters of the form *****/ /***** Get parameters of the form *****/
/* Get group code */ /* Get group code */
if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) <= 0) Gbl.Crs.Grps.GrpCod = Par_GetAndCheckParCode (Par_GrpCod);
Err_WrongGroupExit ();
/* Get the new maximum number of students of the group */ /* Get the new maximum number of students of the group */
NewMaxStds = (unsigned) NewMaxStds = (unsigned)
@ -4059,8 +4043,7 @@ void Grp_RenameGroupType (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the code of the group type */ /* Get the code of the group type */
if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) <= 0) Gbl.Crs.Grps.GrpTyp.GrpTypCod = Par_GetAndCheckParCode (Par_GrpTypCod);
Err_WrongGrpTypExit ();
/* Get the new name for the group type */ /* Get the new name for the group type */
Par_GetParToText ("GrpTypName",NewNameGrpTyp,Grp_MAX_BYTES_GROUP_TYPE_NAME); Par_GetParToText ("GrpTypName",NewNameGrpTyp,Grp_MAX_BYTES_GROUP_TYPE_NAME);
@ -4132,8 +4115,7 @@ void Grp_RenameGroup (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get the code of the group */ /* Get the code of the group */
if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) <= 0) Gbl.Crs.Grps.GrpCod = Par_GetAndCheckParCode (Par_GrpCod);
Err_WrongGroupExit ();
/* Get the new name for the group */ /* Get the new name for the group */
Par_GetParToText ("GrpName",NewNameGrp,Grp_MAX_BYTES_GROUP_NAME); Par_GetParToText ("GrpName",NewNameGrp,Grp_MAX_BYTES_GROUP_NAME);
@ -4188,26 +4170,6 @@ void Grp_RenameGroup (void)
AlertType,AlertTxt); AlertType,AlertTxt);
} }
/*****************************************************************************/
/******************* Get parameter with code of group type *******************/
/*****************************************************************************/
static long Grp_GetParamGrpTypCod (void)
{
/***** Get code of group type *****/
return Par_GetParToLong ("GrpTypCod");
}
/*****************************************************************************/
/*********************** Get parameter with group code ***********************/
/*****************************************************************************/
static long Grp_GetParamGrpCod (void)
{
/***** Get group code *****/
return Par_GetParToLong ("GrpCod");
}
/*****************************************************************************/ /*****************************************************************************/
/****************** Write parameter with code of group type ******************/ /****************** Write parameter with code of group type ******************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -1116,21 +1116,6 @@ void Ins_PutParamInsCod (long InsCod)
Par_PutHiddenParamLong (NULL,"ins",InsCod); Par_PutHiddenParamLong (NULL,"ins",InsCod);
} }
/*****************************************************************************/
/******************* Get parameter with code of institution ******************/
/*****************************************************************************/
long Ins_GetAndCheckParamOtherInsCod (long MinCodAllowed)
{
long InsCod;
/***** Get and check parameter with code of institution *****/
if ((InsCod = Par_GetParToLong ("OthInsCod")) < MinCodAllowed)
Err_WrongInstitExit ();
return InsCod;
}
/*****************************************************************************/ /*****************************************************************************/
/**************************** Remove a institution ***************************/ /**************************** Remove a institution ***************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -93,7 +93,6 @@ void Ins_FreeListInstitutions (void);
void Ins_WriteSelectorOfInstitution (void); void Ins_WriteSelectorOfInstitution (void);
void Ins_PutParamCurrentInsCod (void *InsCod); void Ins_PutParamCurrentInsCod (void *InsCod);
void Ins_PutParamInsCod (long InsCod); void Ins_PutParamInsCod (long InsCod);
long Ins_GetAndCheckParamOtherInsCod (long MinCodAllowed);
void Ins_RemoveInstitution (void); void Ins_RemoveInstitution (void);
void Ins_RenameInsShort (void); void Ins_RenameInsShort (void);
void Ins_RenameInsFull (void); void Ins_RenameInsFull (void);

View File

@ -539,7 +539,7 @@ void InsCfg_ChangeInsCty (void)
struct Cty_Countr NewCty; struct Cty_Countr NewCty;
/***** Get the new country code for the institution *****/ /***** Get the new country code for the institution *****/
NewCty.CtyCod = Cty_GetAndCheckParamOtherCtyCod (0); NewCty.CtyCod = Par_GetAndCheckParCode (Par_OthCtyCod);
/***** Check if country has changed *****/ /***** Check if country has changed *****/
if (NewCty.CtyCod != Gbl.Hierarchy.Ins.CtyCod) if (NewCty.CtyCod != Gbl.Hierarchy.Ins.CtyCod)

View File

@ -946,6 +946,49 @@ long Par_GetParToLong (const char *ParamName)
return Str_ConvertStrCodToLongCod (LongStr); return Str_ConvertStrCodToLongCod (LongStr);
} }
/*****************************************************************************/
/******************** Get the value of a code parameter **********************/
/*****************************************************************************/
long Par_GetAndCheckParCode (Par_Code_t ParamCode)
{
return Par_GetAndCheckParCodeMin (ParamCode,1);
}
long Par_GetAndCheckParCodeMin (Par_Code_t ParamCode,long MinCodAllowed)
{
long Cod;
/***** Get code and check that is a valid code (>= minimum) *****/
if ((Cod = Par_GetParCode (ParamCode)) < MinCodAllowed)
Err_WrongCodeExit ();
return Cod;
}
long Par_GetParCode (Par_Code_t ParamCode)
{
static const char *Par_CodeStr[] =
{
[Par_AgdCod] = "AgdCod",
[Par_AnnCod] = "AnnCod",
[Par_AsgCod] = "AsgCod",
[Par_AttCod] = "AttCod",
[Par_BanCod] = "BanCod",
[Par_BldCod] = "BldCod",
[Par_ExaCod] = "ExaCod",
[Par_FilCod] = "FilCod",
[Par_GrpCod] = "GrpCod",
[Par_GrpTypCod] = "GrpTypCod",
[Par_OthCtrCod] = "OthCtrCod",
[Par_OthCtyCod] = "OthCtyCod",
[Par_OthDegCod] = "OthDegCod",
[Par_OthInsCod] = "OthInsCod",
};
return Par_GetParToLong (Par_CodeStr[ParamCode]);
}
/*****************************************************************************/ /*****************************************************************************/
/************************** Get a boolean parameter **************************/ /************************** Get a boolean parameter **************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -63,6 +63,24 @@ typedef enum
Par_PARAM_MULTIPLE, Par_PARAM_MULTIPLE,
} Par_ParamType_t; // Parameter is present only one time / multiple times } Par_ParamType_t; // Parameter is present only one time / multiple times
typedef enum
{
Par_AgdCod,
Par_AnnCod,
Par_AsgCod,
Par_AttCod,
Par_BanCod,
Par_BldCod,
Par_ExaCod,
Par_FilCod,
Par_GrpCod,
Par_GrpTypCod,
Par_OthCtrCod,
Par_OthCtyCod,
Par_OthDegCod,
Par_OthInsCod,
} Par_Code_t;
/*****************************************************************************/ /*****************************************************************************/
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
@ -85,6 +103,9 @@ unsigned long Par_GetParToUnsignedLong (const char *ParamName,
unsigned long Max, unsigned long Max,
unsigned long Default); unsigned long Default);
long Par_GetParToLong (const char *ParamName); long Par_GetParToLong (const char *ParamName);
long Par_GetAndCheckParCode (Par_Code_t ParamCode);
long Par_GetAndCheckParCodeMin (Par_Code_t ParamCode,long MinCodAllowed);
long Par_GetParCode (Par_Code_t ParamCode);
bool Par_GetParToBool (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);

View File

@ -1410,11 +1410,8 @@ void Pho_CalcPhotoDegree (void)
Fil_CreateDirIfNotExists (Cfg_PATH_PHOTO_TMP_PRIVATE); Fil_CreateDirIfNotExists (Cfg_PATH_PHOTO_TMP_PRIVATE);
/***** Get the degree which photo will be computed *****/ /***** Get the degree which photo will be computed *****/
DegCod = Deg_GetAndCheckParamOtherDegCod (-1L); // Parameter may be omitted if ((DegCod = Par_GetParCode (Par_OthDegCod)) > 0) // Parameter may be omitted
// (when selecting classphoto/list) { // (when selecting classphoto/list)
if (DegCod > 0)
{
/***** Prevent the computing of an average photo too recently updated *****/ /***** Prevent the computing of an average photo too recently updated *****/
if (Pho_GetTimeAvgPhotoWasComputed (DegCod) >= if (Pho_GetTimeAvgPhotoWasComputed (DegCod) >=
Dat_GetStartExecutionTimeUTC () - Cfg_MIN_TIME_TO_RECOMPUTE_AVG_PHOTO) Dat_GetStartExecutionTimeUTC () - Cfg_MIN_TIME_TO_RECOMPUTE_AVG_PHOTO)

View File

@ -3987,7 +3987,7 @@ void Rec_ChgCountryOfMyInstitution (void)
unsigned NumInss; unsigned NumInss;
/***** Get country code of my institution *****/ /***** Get country code of my institution *****/
Gbl.Usrs.Me.UsrDat.InsCtyCod = Cty_GetAndCheckParamOtherCtyCod (0); Gbl.Usrs.Me.UsrDat.InsCtyCod = Par_GetAndCheckParCode (Par_OthCtyCod);
/***** When country changes, the institution, center and department must be reset *****/ /***** When country changes, the institution, center and department must be reset *****/
NumInss = Ins_GetNumInssInCty (Gbl.Usrs.Me.UsrDat.InsCtyCod); NumInss = Ins_GetNumInssInCty (Gbl.Usrs.Me.UsrDat.InsCtyCod);
@ -4023,7 +4023,7 @@ void Rec_UpdateMyInstitution (void)
/***** Get my institution *****/ /***** Get my institution *****/
/* Get institution code */ /* Get institution code */
Ins.InsCod = Ins_GetAndCheckParamOtherInsCod (0); // 0 (another institution) is allowed here Ins.InsCod = Par_GetAndCheckParCodeMin (Par_OthInsCod,0); // 0 (another institution) is allowed here
/* Get country of institution */ /* Get country of institution */
if (Ins.InsCod > 0) if (Ins.InsCod > 0)
@ -4059,7 +4059,7 @@ void Rec_UpdateMyCenter (void)
/***** Get my center *****/ /***** Get my center *****/
/* Get center code */ /* Get center code */
Ctr.CtrCod = Ctr_GetAndCheckParamOtherCtrCod (0); // 0 (another center) is allowed here Ctr.CtrCod = Par_GetAndCheckParCodeMin (Par_OthCtrCod,0); // 0 (another center) is allowed here
/* Get institution of center */ /* Get institution of center */
if (Ctr.CtrCod > 0) if (Ctr.CtrCod > 0)

View File

@ -937,7 +937,7 @@ void Roo_ChangeBuilding (void)
Err_WrongRoomExit (); Err_WrongRoomExit ();
/* Get room building */ /* Get room building */
NewBldCod = Bld_GetParamBldCod (); NewBldCod = Par_GetAndCheckParCode (Par_BldCod);
/***** Get data of the room from database *****/ /***** Get data of the room from database *****/
Roo_GetDataOfRoomByCod (Roo_EditingRoom); Roo_GetDataOfRoomByCod (Roo_EditingRoom);
@ -1386,7 +1386,7 @@ void Roo_ReceiveFormNewRoom (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get room building, floor and type */ /* Get room building, floor and type */
Roo_EditingRoom->BldCod = Bld_GetParamBldCod (); Roo_EditingRoom->BldCod = Par_GetAndCheckParCode (Par_BldCod);
Roo_EditingRoom->Floor = Roo_GetParamFloor (); Roo_EditingRoom->Floor = Roo_GetParamFloor ();
Roo_EditingRoom->Type = Roo_GetParamType (); Roo_EditingRoom->Type = Roo_GetParamType ();

View File

@ -12296,6 +12296,52 @@ const char *Txt_Actions[ActLst_NUM_ACTIONS] =
"Remove exam question" // Precisa de tradução "Remove exam question" // Precisa de tradução
#elif L==10 // tr #elif L==10 // tr
"Remove exam question" // Çeviri lazim! "Remove exam question" // Çeviri lazim!
#endif
,
[ActValSetQst] =
#if L==1 // ca
"Validar pregunta d'examen"
#elif L==2 // de
"Pr&uuml;fungsfrage validieren"
#elif L==3 // en
"Validate exam question"
#elif L==4 // es
"Validar pregunta de examen"
#elif L==5 // fr
"Valider question d'examen"
#elif L==6 // gn
"Validar pregunta de examen" // Okoteve traducción
#elif L==7 // it
"Validare domanda d'esame"
#elif L==8 // pl
"Potwierd&zacute; pytanie egzaminacyjne"
#elif L==9 // pt
"Validar pergunta do exame"
#elif L==10 // tr
"S&inodot;nav sorusunu do&gbreve;rula"
#endif
,
[ActInvSetQst] =
#if L==1 // ca
"Invalidar pregunta d'examen"
#elif L==2 // de
"Pr&uuml;fungsfrage ung&uuml;ltig machen"
#elif L==3 // en
"Invalidate exam question"
#elif L==4 // es
"Invalidar pregunta de examen"
#elif L==5 // fr
"Invalider question d'examen"
#elif L==6 // gn
"Invalidar pregunta de examen" // Okoteve traducción
#elif L==7 // it
"Invalidare domanda d'esame"
#elif L==8 // pl
"Uniewa&zdot;nij pytanie egzaminacyjne"
#elif L==9 // pt
"Invalidar pergunta do exame"
#elif L==10 // tr
"Ge&ccedil;ersiz s&inodot;nav sorusu"
#endif #endif
, ,
[ActReqNewExaSes] = [ActReqNewExaSes] =