Version 22.72: Mar 09, 2023 Code refactoring in parameters. Not finished.

This commit is contained in:
acanas 2023-03-09 00:23:54 +01:00
parent ce3877188e
commit 95b6707b9e
19 changed files with 108 additions and 176 deletions

View File

@ -43,7 +43,7 @@
/* Parameters used in forms to edit MAC address */ /* Parameters used in forms to edit MAC address */
struct MAC_Params struct MAC_Params
{ {
long Cod; // Code (i.e. room code) long RooCod; // Room code
char MACstr[MAC_LENGTH_MAC_ADDRESS + 1]; // MAC address char MACstr[MAC_LENGTH_MAC_ADDRESS + 1]; // MAC address
}; };
@ -63,8 +63,8 @@ static void MAC_PutParams (void *Args)
{ {
if (Args) if (Args)
{ {
Par_PutParLong (NULL,"Cod",((struct MAC_Params *) Args)->Cod); Par_PutParCode (Par_RooCod,((struct MAC_Params *) Args)->RooCod);
Par_PutParString (NULL,"MAC",((struct MAC_Params *) Args)->MACstr); Par_PutParString (NULL,"MAC" ,((struct MAC_Params *) Args)->MACstr);
} }
} }
@ -124,7 +124,7 @@ void MAC_ListMACAddresses (unsigned NumMACs,MYSQL_RES **mysql_res)
/************************ List several MAC addresses *************************/ /************************ List several MAC addresses *************************/
/*****************************************************************************/ /*****************************************************************************/
void MAC_EditMACAddresses (long Cod,const char *Anchor, void MAC_EditMACAddresses (long RooCod,const char *Anchor,
unsigned NumMACs,MYSQL_RES **mysql_res) unsigned NumMACs,MYSQL_RES **mysql_res)
{ {
MYSQL_ROW row; MYSQL_ROW row;
@ -143,7 +143,7 @@ void MAC_EditMACAddresses (long Cod,const char *Anchor,
/* Write MAC address (row[0]) */ /* Write MAC address (row[0]) */
if (sscanf (row[0],"%llu",&MACnum) == 1) if (sscanf (row[0],"%llu",&MACnum) == 1)
{ {
Params.Cod = Cod; // Code (i.e. room code) Params.RooCod = RooCod; // Code (i.e. room code)
MAC_MACnumToMACstr (MACnum,Params.MACstr); // Current MAC address in xx:xx:xx:xx:xx:xx format MAC_MACnumToMACstr (MACnum,Params.MACstr); // Current MAC address in xx:xx:xx:xx:xx:xx format
MAC_PutFormToEditMACAddress (ActChgRooMAC,Anchor, MAC_PutFormToEditMACAddress (ActChgRooMAC,Anchor,
MAC_PutParams,&Params); MAC_PutParams,&Params);
@ -154,7 +154,7 @@ void MAC_EditMACAddresses (long Cod,const char *Anchor,
} }
/* Form to enter a new MAC address */ /* Form to enter a new MAC address */
Params.Cod = Cod; // Code (i.e. room code) Params.RooCod = RooCod; // Room code
Params.MACstr[0] = '\0'; // Current MAC address in xx:xx:xx:xx:xx:xx format Params.MACstr[0] = '\0'; // Current MAC address in xx:xx:xx:xx:xx:xx format
MAC_PutFormToEditMACAddress (ActChgRooMAC,Anchor, MAC_PutFormToEditMACAddress (ActChgRooMAC,Anchor,
MAC_PutParams,&Params); MAC_PutParams,&Params);

View File

@ -35,7 +35,7 @@
/*****************************************************************************/ /*****************************************************************************/
void MAC_ListMACAddresses (unsigned NumMACs,MYSQL_RES **mysql_res); void MAC_ListMACAddresses (unsigned NumMACs,MYSQL_RES **mysql_res);
void MAC_EditMACAddresses (long Cod,const char *Anchor, void MAC_EditMACAddresses (long RooCod,const char *Anchor,
unsigned NumMACs,MYSQL_RES **mysql_res); unsigned NumMACs,MYSQL_RES **mysql_res);
unsigned long long MAC_GetMACnumFromForm (const char *ParamName); unsigned long long MAC_GetMACnumFromForm (const char *ParamName);

View File

@ -1865,7 +1865,7 @@ void Brw_GetParAndInitFileBrowser (void)
/***** Get other parameters *****/ /***** Get other parameters *****/
if (Brw_GetIfProjectFileBrowser ()) if (Brw_GetIfProjectFileBrowser ())
/* Get project code */ /* Get project code */
Prj_SetPrjCod (Prj_GetParamPrjCod ()); Prj_SetPrjCod (Par_GetParCode (Par_PrjCod));
else if (Brw_GetIfCrsAssigWorksFileBrowser ()) else if (Brw_GetIfCrsAssigWorksFileBrowser ())
{ {
/* Get lists of the selected users if not already got */ /* Get lists of the selected users if not already got */

View File

@ -629,10 +629,11 @@ 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.71 (2023-03-08)" #define Log_PLATFORM_VERSION "SWAD 22.72 (2023-03-09)"
#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.72: Mar 09, 2023 Code refactoring in parameters. Not finished. (? lines)
Version 22.71: Mar 08, 2023 Code refactoring in parameters. Not finished. (336806 lines) Version 22.71: Mar 08, 2023 Code refactoring in parameters. Not finished. (336806 lines)
Version 22.70: Mar 07, 2023 Code refactoring in parameters. Not finished. (336824 lines) Version 22.70: Mar 07, 2023 Code refactoring in parameters. Not finished. (336824 lines)
Version 22.69: Mar 07, 2023 Code refactoring in parameters. Not finished. (336866 lines) Version 22.69: Mar 07, 2023 Code refactoring in parameters. Not finished. (336866 lines)

View File

@ -3298,18 +3298,17 @@ void Grp_ReceiveFormNewGrp (void)
if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Par_GetParCode (Par_GrpTypCod)) > 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_GetParText ("GrpName",Gbl.Crs.Grps.GrpName, Par_GetParText ("GrpName",Gbl.Crs.Grps.GrpName,Grp_MAX_BYTES_GROUP_NAME);
Grp_MAX_BYTES_GROUP_NAME);
/* Get room */ /* Get room */
Gbl.Crs.Grps.RooCod = Roo_GetParamRooCod (); Gbl.Crs.Grps.RooCod = Par_GetParCode (Par_RooCod);
/* Get maximum number of students */ /* Get maximum number of students */
Gbl.Crs.Grps.MaxStudents = (unsigned) Gbl.Crs.Grps.MaxStudents = (unsigned)
Par_GetParUnsignedLong ("MaxStudents", Par_GetParUnsignedLong ("MaxStudents",
0, 0,
Grp_MAX_STUDENTS_IN_A_GROUP, Grp_MAX_STUDENTS_IN_A_GROUP,
Grp_NUM_STUDENTS_NOT_LIMITED); Grp_NUM_STUDENTS_NOT_LIMITED);
if (Gbl.Crs.Grps.GrpName[0]) // If there's a group name if (Gbl.Crs.Grps.GrpName[0]) // If there's a group name
{ {
@ -3781,7 +3780,7 @@ void Grp_ChangeGroupRoom (void)
Gbl.Crs.Grps.GrpCod = Par_GetAndCheckParCode (Par_GrpCod); Gbl.Crs.Grps.GrpCod = Par_GetAndCheckParCode (Par_GrpCod);
/* Get the new room */ /* Get the new room */
NewRooCod = Roo_GetParamRooCod (); NewRooCod = Par_GetParCode (Par_RooCod);
/* Get from the database the name of the group */ /* Get from the database the name of the group */
GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod;

View File

@ -67,10 +67,12 @@ const char *Par_CodeStr[] =
[Par_ExaCod ] = "ExaCod", // Exam code in calls for exams and exams [Par_ExaCod ] = "ExaCod", // Exam code in calls for exams and exams
[Par_FilCod ] = "FilCod", // File code [Par_FilCod ] = "FilCod", // File code
[Par_FilterCrsCod] = "FilterCrsCod", // Course code filtering messages [Par_FilterCrsCod] = "FilterCrsCod", // Course code filtering messages
[Par_FldCod ] = "FldCod", // Field code in course record
[Par_GamCod ] = "GamCod", // Game code [Par_GamCod ] = "GamCod", // Game code
[Par_GrpCod ] = "GrpCod", // Group code [Par_GrpCod ] = "GrpCod", // Group code
[Par_GrpTypCod ] = "GrpTypCod", // Group type code [Par_GrpTypCod ] = "GrpTypCod", // Group type code
[Par_HldCod ] = "HldCod", // Holiday code [Par_HldCod ] = "HldCod", // Holiday code
[Par_ItmCod ] = "ItmCod", // Item code in course program
[Par_LnkCod ] = "LnkCod", // Link code [Par_LnkCod ] = "LnkCod", // Link code
[Par_MaiCod ] = "MaiCod", // Domain mail code [Par_MaiCod ] = "MaiCod", // Domain mail code
[Par_MchCod ] = "MchCod", // Match code in game [Par_MchCod ] = "MchCod", // Match code in game
@ -85,9 +87,11 @@ const char *Par_CodeStr[] =
[Par_OthInsCod ] = "OthInsCod", // Other institution code [Par_OthInsCod ] = "OthInsCod", // Other institution code
[Par_PlcCod ] = "PlcCod", // Place code [Par_PlcCod ] = "PlcCod", // Place code
[Par_PlgCod ] = "PlgCod", // Plugin code [Par_PlgCod ] = "PlgCod", // Plugin code
[Par_PrjCod ] = "PrjCod", // Project code
[Par_PstCod ] = "PstCod", // Post code in forum [Par_PstCod ] = "PstCod", // Post code in forum
[Par_PubCod ] = "PubCod", // Publication code in timeline [Par_PubCod ] = "PubCod", // Publication code in timeline
[Par_QstCod ] = "QstCod", // Question code in assessment/survey [Par_QstCod ] = "QstCod", // Question code in assessment/survey
[Par_RooCod ] = "RooCod", // Room code
[Par_RscCod ] = "RscCod", // Resource code in course program [Par_RscCod ] = "RscCod", // Resource code in course program
[Par_SesCod ] = "SesCod", // Session code in exam [Par_SesCod ] = "SesCod", // Session code in exam
[Par_SvyCod ] = "SvyCod", // Syrvey code [Par_SvyCod ] = "SvyCod", // Syrvey code

View File

@ -75,10 +75,12 @@ typedef enum
Par_ExaCod, Par_ExaCod,
Par_FilCod, Par_FilCod,
Par_FilterCrsCod, Par_FilterCrsCod,
Par_FldCod,
Par_GamCod, Par_GamCod,
Par_GrpCod, Par_GrpCod,
Par_GrpTypCod, Par_GrpTypCod,
Par_HldCod, Par_HldCod,
Par_ItmCod,
Par_LnkCod, Par_LnkCod,
Par_MaiCod, Par_MaiCod,
Par_MchCod, Par_MchCod,
@ -93,9 +95,11 @@ typedef enum
Par_OthInsCod, Par_OthInsCod,
Par_PlcCod, Par_PlcCod,
Par_PlgCod, Par_PlgCod,
Par_PrjCod,
Par_PstCod, Par_PstCod,
Par_PubCod, Par_PubCod,
Par_QstCod, Par_QstCod,
Par_RooCod,
Par_RscCod, Par_RscCod,
Par_SesCod, Par_SesCod,
Par_SvyCod, Par_SvyCod,

View File

@ -456,10 +456,8 @@ static void Prg_PutIconToCreateNewItem (void)
static void Prg_PutButtonToCreateNewItem (void) static void Prg_PutButtonToCreateNewItem (void)
{ {
extern const char *Txt_New_item; extern const char *Txt_New_item;
long ItmCod = -1L;
Frm_BeginFormAnchor (ActFrmNewPrgItm,Prg_ITEM_SECTION_ID); Frm_BeginFormAnchor (ActFrmNewPrgItm,Prg_ITEM_SECTION_ID);
Prg_PutParamItmCod (&ItmCod);
Btn_PutConfirmButton (Txt_New_item); Btn_PutConfirmButton (Txt_New_item);
Frm_EndForm (); Frm_EndForm ();
} }
@ -1134,28 +1132,26 @@ static bool Prg_CheckIfMoveRightIsAllowed (unsigned NumItem)
void Prg_PutParamItmCod (void *ItmCod) void Prg_PutParamItmCod (void *ItmCod)
{ {
if (ItmCod) if (ItmCod)
if (*((long *) ItmCod) > 0) Par_PutParCode (Par_ItmCod,*((long *) ItmCod));
Par_PutParLong (NULL,"ItmCod",*((long *) ItmCod));
} }
void Prg_PutParamRscCod (void *RscCod) void Prg_PutParamRscCod (void *RscCod)
{ {
if (RscCod) if (RscCod)
if (*((long *) RscCod) > 0) Par_PutParCode (Par_RscCod,*((long *) RscCod));
Par_PutParLong (NULL,"RscCod",*((long *) RscCod));
} }
void Prg_GetParams (struct Prg_Item *Item) void Prg_GetParams (struct Prg_Item *Item)
{ {
/***** Try to get item resource *****/ /***** Try to get item resource *****/
Item->Resource.Hierarchy.RscCod = Par_GetParLong ("RscCod"); Item->Resource.Hierarchy.RscCod = Par_GetParCode (Par_RscCod);
/***** Get data of the program item from database *****/ /***** Get data of the program item from database *****/
PrgRsc_GetDataOfResourceByCod (Item); PrgRsc_GetDataOfResourceByCod (Item);
if (Item->Hierarchy.ItmCod <= 0) // No resource specified if (Item->Hierarchy.ItmCod <= 0) // No resource specified
/***** Try to get data of the program item from database *****/ /***** Try to get data of the program item from database *****/
Item->Hierarchy.ItmCod = Par_GetParLong ("ItmCod"); Item->Hierarchy.ItmCod = Par_GetParCode (Par_ItmCod);
/***** Get data of the program item from database *****/ /***** Get data of the program item from database *****/
Prg_GetDataOfItemByCod (Item); Prg_GetDataOfItemByCod (Item);
@ -1977,7 +1973,7 @@ static void Prg_ShowFormToCreateItem (long ParentItmCod)
/***** Begin form *****/ /***** Begin form *****/
Frm_BeginFormAnchor (ActNewPrgItm,Prg_HIGHLIGHTED_SECTION_ID); Frm_BeginFormAnchor (ActNewPrgItm,Prg_HIGHLIGHTED_SECTION_ID);
Prg_PutParamItmCod (&ParentItem.Hierarchy.ItmCod); Par_PutParCode (Par_ItmCod,ParentItem.Hierarchy.ItmCod);
/***** Begin box and table *****/ /***** Begin box and table *****/
Box_BoxTableBegin ("100%",Txt_New_item, Box_BoxTableBegin ("100%",Txt_New_item,
@ -2016,12 +2012,9 @@ static void Prg_ShowFormToChangeItem (long ItmCod)
Prg_GetDataOfItemByCod (&Item); Prg_GetDataOfItemByCod (&Item);
Prg_DB_GetItemTxt (Item.Hierarchy.ItmCod,Txt); Prg_DB_GetItemTxt (Item.Hierarchy.ItmCod,Txt);
/***** Show pending alerts */
// Ale_ShowAlerts (NULL);
/***** Begin form *****/ /***** Begin form *****/
Frm_BeginFormAnchor (ActChgPrgItm,Prg_HIGHLIGHTED_SECTION_ID); Frm_BeginFormAnchor (ActChgPrgItm,Prg_HIGHLIGHTED_SECTION_ID);
Prg_PutParamItmCod (&Item.Hierarchy.ItmCod); Par_PutParCode (Par_ItmCod,Item.Hierarchy.ItmCod);
/***** Begin box and table *****/ /***** Begin box and table *****/
Box_BoxTableBegin ("100%", Box_BoxTableBegin ("100%",

View File

@ -464,7 +464,7 @@ static void PrgRsc_WriteRowEditResource (unsigned NumRsc,unsigned NumResources,
/* Title */ /* Title */
Frm_BeginFormAnchor (ActRenPrgRsc,PrgRsc_RESOURCE_SECTION_ID); Frm_BeginFormAnchor (ActRenPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
Prg_PutParamRscCod (&Item->Resource.Hierarchy.RscCod); Par_PutParCode (Par_RscCod,Item->Resource.Hierarchy.RscCod);
HTM_INPUT_TEXT ("Title",PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE,Item->Resource.Title, HTM_INPUT_TEXT ("Title",PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE,Item->Resource.Title,
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
"class=\"PRG_RSC_INPUT INPUT_%s\"", "class=\"PRG_RSC_INPUT INPUT_%s\"",
@ -518,7 +518,7 @@ static void PrgRsc_WriteRowNewResource (unsigned NumResources,
/* Title */ /* Title */
Frm_BeginFormAnchor (ActNewPrgRsc,PrgRsc_RESOURCE_SECTION_ID); Frm_BeginFormAnchor (ActNewPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
Prg_PutParamItmCod (&Item->Hierarchy.ItmCod); Par_PutParCode (Par_ItmCod,Item->Hierarchy.ItmCod);
HTM_INPUT_TEXT ("Title",PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE,"", HTM_INPUT_TEXT ("Title",PrgRsc_MAX_CHARS_PROGRAM_RESOURCE_TITLE,"",
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
"placeholder=\"%s\"" "placeholder=\"%s\""
@ -609,15 +609,6 @@ static void PrgRsc_PutFormsToRemEditOneResource (struct Prg_Item *Item,
} }
} }
/*****************************************************************************/
/**************** Write parameter with code of program item ******************/
/*****************************************************************************/
void PrgRsc_PutParamRscCod (long RscCod)
{
Par_PutParLong (NULL,"RscCod",RscCod);
}
/*****************************************************************************/ /*****************************************************************************/
/******************************** Rename resource ****************************/ /******************************** Rename resource ****************************/
/*****************************************************************************/ /*****************************************************************************/
@ -915,10 +906,10 @@ static void PrgRsc_ShowClipboard (struct Prg_Item *Item)
/***** Begin form *****/ /***** Begin form *****/
Frm_BeginFormAnchor (ActChgLnkPrgRsc,PrgRsc_RESOURCE_SECTION_ID); Frm_BeginFormAnchor (ActChgLnkPrgRsc,PrgRsc_RESOURCE_SECTION_ID);
if (Item->Resource.Hierarchy.RscCod > 0) if (Item->Resource.Hierarchy.RscCod > 0)
Prg_PutParamRscCod (&Item->Resource.Hierarchy.RscCod); Par_PutParCode (Par_RscCod,Item->Resource.Hierarchy.RscCod);
else else
/* No resource selected, so it's a new resource at the end of the item */ /* No resource selected, so it's a new resource at the end of the item */
Prg_PutParamItmCod (&Item->Hierarchy.ItmCod); Par_PutParCode (Par_ItmCod,Item->Hierarchy.ItmCod);
/***** Begin list *****/ /***** Begin list *****/
HTM_UL_Begin ("class=\"PRG_CLIPBOARD\""); HTM_UL_Begin ("class=\"PRG_CLIPBOARD\"");

View File

@ -43,8 +43,6 @@ void PrgRsc_ListItemResources (Prg_ListingType_t ListingType,
void PrgRsc_GetDataOfResourceByCod (struct Prg_Item *Item); void PrgRsc_GetDataOfResourceByCod (struct Prg_Item *Item);
void PrgRsc_PutParamRscCod (long RscCod);
void PrgRsc_CreateResource (void); void PrgRsc_CreateResource (void);
void PrgRsc_RenameResource (void); void PrgRsc_RenameResource (void);

View File

@ -1006,11 +1006,11 @@ static void Prj_PutHiddenParamFilterDptCod (long DptCod)
static void Prj_GetHiddenParamPreNon (struct Prj_Projects *Projects) static void Prj_GetHiddenParamPreNon (struct Prj_Projects *Projects)
{ {
Projects->Filter.Assign = (unsigned) Par_GetParUnsignedLong (Prj_PARAM_FILTER_PRE_NON_NAME, Projects->Filter.Assign = (unsigned) Par_GetParUnsignedLong (Prj_PARAM_FILTER_PRE_NON_NAME,
0, 0,
(1 << Prj_ASSIGNED) | (1 << Prj_ASSIGNED) |
(1 << Prj_NONASSIG), (1 << Prj_NONASSIG),
(unsigned) Prj_FILTER_ASSIGNED_DEFAULT | (unsigned) Prj_FILTER_ASSIGNED_DEFAULT |
(unsigned) Prj_FILTER_NONASSIG_DEFAULT); (unsigned) Prj_FILTER_NONASSIG_DEFAULT);
} }
static Prj_HiddenVisibl_t Prj_GetHiddenParamHidVis (void) static Prj_HiddenVisibl_t Prj_GetHiddenParamHidVis (void)
@ -1024,11 +1024,11 @@ static Prj_HiddenVisibl_t Prj_GetHiddenParamHidVis (void)
case Rol_SYS_ADM: case Rol_SYS_ADM:
return (Prj_HiddenVisibl_t) return (Prj_HiddenVisibl_t)
Par_GetParUnsignedLong (Prj_PARAM_FILTER_HID_VIS_NAME, Par_GetParUnsignedLong (Prj_PARAM_FILTER_HID_VIS_NAME,
0, 0,
(1 << Prj_HIDDEN) | (1 << Prj_HIDDEN) |
(1 << Prj_VISIBL), (1 << Prj_VISIBL),
(unsigned) Prj_FILTER_HIDDEN_DEFAULT | (unsigned) Prj_FILTER_HIDDEN_DEFAULT |
(unsigned) Prj_FILTER_VISIBL_DEFAULT); (unsigned) Prj_FILTER_VISIBL_DEFAULT);
default: default:
Err_WrongRoleExit (); Err_WrongRoleExit ();
return Prj_NEW_PRJ_HIDDEN_VISIBL_DEFAULT; // Not reached return Prj_NEW_PRJ_HIDDEN_VISIBL_DEFAULT; // Not reached
@ -1039,24 +1039,24 @@ static unsigned Prj_GetHiddenParamFaulti (void)
{ {
return (unsigned) return (unsigned)
Par_GetParUnsignedLong (Prj_PARAM_FILTER_FAULTIN_NAME, Par_GetParUnsignedLong (Prj_PARAM_FILTER_FAULTIN_NAME,
0, 0,
(1 << Prj_FAULTY) | (1 << Prj_FAULTY) |
(1 << Prj_FAULTLESS), (1 << Prj_FAULTLESS),
(unsigned) Prj_FILTER_FAULTY_DEFAULT | (unsigned) Prj_FILTER_FAULTY_DEFAULT |
(unsigned) Prj_FILTER_FAULTLESS_DEFAULT); (unsigned) Prj_FILTER_FAULTLESS_DEFAULT);
} }
static unsigned Prj_GetHiddenParamReview (void) static unsigned Prj_GetHiddenParamReview (void)
{ {
return (unsigned) return (unsigned)
Par_GetParUnsignedLong (Prj_PARAM_FILTER_REVIEW_NAME, Par_GetParUnsignedLong (Prj_PARAM_FILTER_REVIEW_NAME,
0, 0,
(1 << Prj_UNREVIEWED) | (1 << Prj_UNREVIEWED) |
(1 << Prj_UNAPPROVED) | (1 << Prj_UNAPPROVED) |
(1 << Prj_APPROVED), (1 << Prj_APPROVED),
(unsigned) Prj_FILTER_UNREVIEWED_DEFAULT | (unsigned) Prj_FILTER_UNREVIEWED_DEFAULT |
(unsigned) Prj_FILTER_UNAPPROVED_DEFAULT | (unsigned) Prj_FILTER_UNAPPROVED_DEFAULT |
(unsigned) Prj_FILTER_APPROVED_DEFAULT); (unsigned) Prj_FILTER_APPROVED_DEFAULT);
} }
static long Prj_GetHiddenParamFilterDptCod (void) static long Prj_GetHiddenParamFilterDptCod (void)
@ -1322,7 +1322,7 @@ void Prj_ShowOneProject (void)
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (&Projects); Prj_GetParams (&Projects);
Projects.Prj.PrjCod = Prj_GetParamPrjCod (); Projects.Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
/***** Show project and (if possible) its file browser *****/ /***** Show project and (if possible) its file browser *****/
Prj_ShowOneProjectWithFileBrowser (&Projects); Prj_ShowOneProjectWithFileBrowser (&Projects);
@ -1413,7 +1413,7 @@ void Prj_PrintOneProject (void)
Prj_AllocMemProject (&Projects.Prj); Prj_AllocMemProject (&Projects.Prj);
/***** Get project data *****/ /***** Get project data *****/
Projects.Prj.PrjCod = Prj_GetParamPrjCod (); Projects.Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
Prj_GetDataOfProjectByCod (&Projects.Prj); Prj_GetDataOfProjectByCod (&Projects.Prj);
/***** Write header *****/ /***** Write header *****/
@ -2865,8 +2865,7 @@ static void Prj_FormToSelectUsrs (struct Prj_Projects *Projects,
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (Projects); Prj_GetParams (Projects);
if ((Projects->Prj.PrjCod = Prj_GetParamPrjCod ()) <= 0) Projects->Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
Err_WrongProjectExit ();
/***** Put form to select users *****/ /***** Put form to select users *****/
if (asprintf (&TxtButton,Txt_Add_USERS, if (asprintf (&TxtButton,Txt_Add_USERS,
@ -2941,8 +2940,7 @@ static void Prj_AddUsrsToProject (Prj_RoleInProject_t RoleInPrj)
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (&Projects); Prj_GetParams (&Projects);
if ((Projects.Prj.PrjCod = Prj_GetParamPrjCod ()) <= 0) Projects.Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
Err_WrongProjectExit ();
/***** Add the selected users to project *****/ /***** Add the selected users to project *****/
Ptr = Prj_MembersToAdd.List[Rol_UNK]; Ptr = Prj_MembersToAdd.List[Rol_UNK];
@ -3034,8 +3032,7 @@ static void Prj_ReqRemUsrFromPrj (struct Prj_Projects *Projects,
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (Projects); Prj_GetParams (Projects);
if ((Projects->Prj.PrjCod = Prj_GetParamPrjCod ()) < 0) Projects->Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
Err_WrongProjectExit ();
/***** Get data of the project from database *****/ /***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Projects->Prj); Prj_GetDataOfProjectByCod (&Projects->Prj);
@ -3114,8 +3111,7 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInPrj)
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (&Projects); Prj_GetParams (&Projects);
if ((Projects.Prj.PrjCod = Prj_GetParamPrjCod ()) < 0) Projects.Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
Err_WrongProjectExit ();
/***** Get data of the project from database *****/ /***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Projects.Prj); Prj_GetDataOfProjectByCod (&Projects.Prj);
@ -3491,16 +3487,6 @@ void Prj_PutParamPrjCod (long PrjCod)
Par_PutParLong (NULL,"PrjCod",PrjCod); Par_PutParLong (NULL,"PrjCod",PrjCod);
} }
/*****************************************************************************/
/******************** Get parameter with code of project *********************/
/*****************************************************************************/
long Prj_GetParamPrjCod (void)
{
/***** Get code of project *****/
return Par_GetParLong ("PrjCod");
}
/*****************************************************************************/ /*****************************************************************************/
/**************** Ask for confirmation of removing a project *****************/ /**************** Ask for confirmation of removing a project *****************/
/*****************************************************************************/ /*****************************************************************************/
@ -3519,8 +3505,7 @@ void Prj_ReqRemProject (void)
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (&Projects); Prj_GetParams (&Projects);
if ((Projects.Prj.PrjCod = Prj_GetParamPrjCod ()) < 0) Projects.Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
Err_WrongProjectExit ();
/***** Get data of the project from database *****/ /***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Projects.Prj); Prj_GetDataOfProjectByCod (&Projects.Prj);
@ -3560,8 +3545,7 @@ void Prj_RemoveProject (void)
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (&Projects); Prj_GetParams (&Projects);
if ((Projects.Prj.PrjCod = Prj_GetParamPrjCod ()) < 0) Projects.Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
Err_WrongProjectExit ();
/***** Get data of the project from database *****/ /***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Projects.Prj); // Inside this function, the course is checked to be the current one Prj_GetDataOfProjectByCod (&Projects.Prj); // Inside this function, the course is checked to be the current one
@ -3616,8 +3600,7 @@ void Prj_HideProject (void)
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (&Projects); Prj_GetParams (&Projects);
if ((Projects.Prj.PrjCod = Prj_GetParamPrjCod ()) < 0) Projects.Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
Err_WrongProjectExit ();
/***** Get data of the project from database *****/ /***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Projects.Prj); Prj_GetDataOfProjectByCod (&Projects.Prj);
@ -3651,8 +3634,7 @@ void Prj_UnhideProject (void)
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (&Projects); Prj_GetParams (&Projects);
if ((Projects.Prj.PrjCod = Prj_GetParamPrjCod ()) < 0) Projects.Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
Err_WrongProjectExit ();
/***** Get data of the project from database *****/ /***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Projects.Prj); Prj_GetDataOfProjectByCod (&Projects.Prj);
@ -3698,8 +3680,7 @@ void Prj_RequestEditPrj (void)
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (&Projects); Prj_GetParams (&Projects);
if ((Projects.Prj.PrjCod = Prj_GetParamPrjCod ()) <= 0) Projects.Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
Err_WrongProjectExit ();
/***** Form to edit project *****/ /***** Form to edit project *****/
Prj_RequestCreatOrEditPrj (&Projects); Prj_RequestCreatOrEditPrj (&Projects);
@ -4032,7 +4013,6 @@ void Prj_FreeMemProject (struct Prj_Project *Prj)
void Prj_ReceiveFormProject (void) void Prj_ReceiveFormProject (void)
{ {
extern const char *Par_CodeStr[];
extern const char *Txt_Created_new_project_X; extern const char *Txt_Created_new_project_X;
extern const char *Txt_The_project_has_been_modified; extern const char *Txt_The_project_has_been_modified;
struct Prj_Projects Projects; struct Prj_Projects Projects;
@ -4048,7 +4028,7 @@ void Prj_ReceiveFormProject (void)
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (&Projects); Prj_GetParams (&Projects);
ItsANewProject = ((Projects.Prj.PrjCod = Prj_GetParamPrjCod ()) < 0); ItsANewProject = ((Projects.Prj.PrjCod = Par_GetParCode (Par_PrjCod)) <= 0);
if (ItsANewProject) if (ItsANewProject)
{ {
@ -4071,25 +4051,25 @@ void Prj_ReceiveFormProject (void)
Par_GetParText ("Title",Projects.Prj.Title,Prj_MAX_BYTES_TITLE); Par_GetParText ("Title",Projects.Prj.Title,Prj_MAX_BYTES_TITLE);
/* Get department */ /* Get department */
Projects.Prj.DptCod = Par_GetParLong (Par_CodeStr[Par_DptCod]); Projects.Prj.DptCod = Par_GetParCode (Par_DptCod);
/* Get whether the project is assigned */ /* Get whether the project is assigned */
Projects.Prj.Assigned = (Par_GetParBool ("Assigned")) ? Prj_ASSIGNED : Projects.Prj.Assigned = (Par_GetParBool ("Assigned")) ? Prj_ASSIGNED :
Prj_NONASSIG; Prj_NONASSIG;
/* Get number of students */ /* Get number of students */
Projects.Prj.NumStds = (unsigned) Projects.Prj.NumStds = (unsigned)
Par_GetParUnsignedLong ("NumStds", Par_GetParUnsignedLong ("NumStds",
0, 0,
UINT_MAX, UINT_MAX,
1); 1);
/* Get status */ /* Get status */
Projects.Prj.Proposal = (Prj_Proposal_t) Projects.Prj.Proposal = (Prj_Proposal_t)
Par_GetParUnsignedLong ("Proposal", Par_GetParUnsignedLong ("Proposal",
0, 0,
Prj_NUM_PROPOSAL_TYPES - 1, Prj_NUM_PROPOSAL_TYPES - 1,
(unsigned long) Prj_PROPOSAL_DEFAULT); (unsigned long) Prj_PROPOSAL_DEFAULT);
/* Get project description, required knowledge and required materials */ /* Get project description, required knowledge and required materials */
Par_GetParHTML ("Description",Projects.Prj.Description,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous) Par_GetParHTML ("Description",Projects.Prj.Description,Cns_MAX_BYTES_TEXT); // Store in HTML format (not rigorous)
@ -4555,8 +4535,7 @@ void Prj_LockProjectEdition (void)
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (&Projects); Prj_GetParams (&Projects);
if ((Projects.Prj.PrjCod = Prj_GetParamPrjCod ()) < 0) Projects.Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
Err_WrongProjectExit ();
/***** Get data of the project from database *****/ /***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Projects.Prj); Prj_GetDataOfProjectByCod (&Projects.Prj);
@ -4593,8 +4572,7 @@ void Prj_UnloProjectEdition (void)
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (&Projects); Prj_GetParams (&Projects);
if ((Projects.Prj.PrjCod = Prj_GetParamPrjCod ()) < 0) Projects.Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
Err_WrongProjectExit ();
/***** Get data of the project from database *****/ /***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Projects.Prj); Prj_GetDataOfProjectByCod (&Projects.Prj);
@ -4631,8 +4609,7 @@ void Prj_ChangeReviewStatus (void)
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (&Projects); Prj_GetParams (&Projects);
if ((Projects.Prj.PrjCod = Prj_GetParamPrjCod ()) < 0) Projects.Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
Err_WrongProjectExit ();
/***** Get data of the project from database *****/ /***** Get data of the project from database *****/
Prj_GetDataOfProjectByCod (&Projects.Prj); Prj_GetDataOfProjectByCod (&Projects.Prj);

View File

@ -256,7 +256,6 @@ void Prj_GetDataOfProjectByCod (struct Prj_Project *Prj);
void Prj_FreeListProjects (struct Prj_Projects *Projects); void Prj_FreeListProjects (struct Prj_Projects *Projects);
void Prj_PutParamPrjCod (long PrjCod); void Prj_PutParamPrjCod (long PrjCod);
long Prj_GetParamPrjCod (void);
void Prj_ReqRemProject (void); void Prj_ReqRemProject (void);
void Prj_RemoveProject (void); void Prj_RemoveProject (void);
void Prj_HideProject (void); void Prj_HideProject (void);

View File

@ -1,4 +1,4 @@
// swad_game_resource.c: links to games as program resources // swad_project_resource.c: links to projects as program resources
/* /*
SWAD (Shared Workspace At a Distance), SWAD (Shared Workspace At a Distance),
@ -29,6 +29,7 @@
#include "swad_alert.h" #include "swad_alert.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"
#include "swad_project.h" #include "swad_project.h"
#include "swad_project_database.h" #include "swad_project_database.h"
@ -49,7 +50,7 @@ void PrjRsc_GetLinkToProject (void)
/***** Get parameters *****/ /***** Get parameters *****/
Prj_GetParams (&Projects); Prj_GetParams (&Projects);
Projects.Prj.PrjCod = Prj_GetParamPrjCod (); Projects.Prj.PrjCod = Par_GetAndCheckParCode (Par_PrjCod);
/***** Get project title *****/ /***** Get project title *****/
PrjRsc_GetTitleFromPrjCod (Projects.Prj.PrjCod,Title,sizeof (Title) - 1); PrjRsc_GetTitleFromPrjCod (Projects.Prj.PrjCod,Title,sizeof (Title) - 1);

View File

@ -290,7 +290,7 @@ void Rec_ListFieldsRecordsForEdition (void)
/* Name of the field */ /* Name of the field */
HTM_TD_Begin ("class=\"LM\""); HTM_TD_Begin ("class=\"LM\"");
Frm_BeginForm (ActRenFie); Frm_BeginForm (ActRenFie);
Rec_PutParamFieldCod (&Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); Par_PutParCode (Par_FldCod,Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
HTM_INPUT_TEXT ("FieldName",Rec_MAX_CHARS_NAME_FIELD, HTM_INPUT_TEXT ("FieldName",Rec_MAX_CHARS_NAME_FIELD,
Gbl.Crs.Records.LstFields.Lst[NumField].Name, Gbl.Crs.Records.LstFields.Lst[NumField].Name,
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
@ -302,7 +302,7 @@ void Rec_ListFieldsRecordsForEdition (void)
/* Number of lines in the form */ /* Number of lines in the form */
HTM_TD_Begin ("class=\"CM\""); HTM_TD_Begin ("class=\"CM\"");
Frm_BeginForm (ActChgRowFie); Frm_BeginForm (ActChgRowFie);
Rec_PutParamFieldCod (&Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); Par_PutParCode (Par_FldCod,Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
snprintf (StrNumLines,sizeof (StrNumLines),"%u", snprintf (StrNumLines,sizeof (StrNumLines),"%u",
Gbl.Crs.Records.LstFields.Lst[NumField].NumLines); Gbl.Crs.Records.LstFields.Lst[NumField].NumLines);
HTM_INPUT_TEXT ("NumLines",Cns_MAX_DECIMAL_DIGITS_UINT,StrNumLines, HTM_INPUT_TEXT ("NumLines",Cns_MAX_DECIMAL_DIGITS_UINT,StrNumLines,
@ -315,7 +315,7 @@ void Rec_ListFieldsRecordsForEdition (void)
/* Visibility of a field */ /* Visibility of a field */
HTM_TD_Begin ("class=\"CM\""); HTM_TD_Begin ("class=\"CM\"");
Frm_BeginForm (ActChgVisFie); Frm_BeginForm (ActChgVisFie);
Rec_PutParamFieldCod (&Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); Par_PutParCode (Par_FldCod,Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE, HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
"name=\"Visibility\" class=\"INPUT_%s\"", "name=\"Visibility\" class=\"INPUT_%s\"",
The_GetSuffix ()); The_GetSuffix ());
@ -552,8 +552,7 @@ void Rec_ReqRemField (void)
unsigned NumRecords; unsigned NumRecords;
/***** Get the code of field *****/ /***** Get the code of field *****/
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) <= 0) Gbl.Crs.Records.Field.FieldCod = Par_GetAndCheckParCode (Par_FldCod);
Err_WrongRecordFieldExit ();
/***** Check if exists any record with that field filled *****/ /***** Check if exists any record with that field filled *****/
if ((NumRecords = Rec_DB_CountNumRecordsWithFieldContent (Gbl.Crs.Records.Field.FieldCod))) // There are records with that field filled if ((NumRecords = Rec_DB_CountNumRecordsWithFieldContent (Gbl.Crs.Records.Field.FieldCod))) // There are records with that field filled
@ -562,16 +561,6 @@ void Rec_ReqRemField (void)
Rec_RemoveFieldFromDB (); Rec_RemoveFieldFromDB ();
} }
/*****************************************************************************/
/************ Get a parameter with a code of field of records ****************/
/*****************************************************************************/
long Rec_GetFieldCod (void)
{
/***** Get the code of the field *****/
return Par_GetParLong ("FieldCod");
}
/*****************************************************************************/ /*****************************************************************************/
/******* Request confirmation for the removing of a field with records *******/ /******* Request confirmation for the removing of a field with records *******/
/*****************************************************************************/ /*****************************************************************************/
@ -634,7 +623,7 @@ void Rec_RemoveFieldFromDB (void)
static void Rec_PutParamFieldCod (void *FieldCod) static void Rec_PutParamFieldCod (void *FieldCod)
{ {
if (FieldCod) if (FieldCod)
Par_PutParLong (NULL,"FieldCod",*((long *) FieldCod)); Par_PutParCode (Par_FldCod,*((long *) FieldCod));
} }
/*****************************************************************************/ /*****************************************************************************/
@ -678,8 +667,7 @@ static void Rec_GetFieldByCod (long FieldCod,char Name[Rec_MAX_BYTES_NAME_FIELD
void Rec_RemoveField (void) void Rec_RemoveField (void)
{ {
/***** Get the code of the field *****/ /***** Get the code of the field *****/
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) <= 0) Gbl.Crs.Records.Field.FieldCod = Par_GetAndCheckParCode (Par_FldCod);
Err_WrongRecordFieldExit ();
/***** Borrarlo from the database *****/ /***** Borrarlo from the database *****/
Rec_RemoveFieldFromDB (); Rec_RemoveFieldFromDB ();
@ -698,8 +686,7 @@ void Rec_RenameField (void)
/***** Get parameters of the form *****/ /***** Get parameters of the form *****/
/* Get the code of the field */ /* Get the code of the field */
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) <= 0) Gbl.Crs.Records.Field.FieldCod = Par_GetAndCheckParCode (Par_FldCod);
Err_WrongRecordFieldExit ();
/* Get the new group name */ /* Get the new group name */
Par_GetParText ("FieldName",NewFieldName,Rec_MAX_BYTES_NAME_FIELD); Par_GetParText ("FieldName",NewFieldName,Rec_MAX_BYTES_NAME_FIELD);
@ -755,8 +742,7 @@ void Rec_ChangeLinesField (void)
/***** Get parameters of the form *****/ /***** Get parameters of the form *****/
/* Get the code of field */ /* Get the code of field */
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) <= 0) Gbl.Crs.Records.Field.FieldCod = Par_GetAndCheckParCode (Par_FldCod);
Err_WrongRecordFieldExit ();
/* Get the new number of lines */ /* Get the new number of lines */
NewNumLines = (unsigned) NewNumLines = (unsigned)
@ -800,8 +786,7 @@ void Rec_ChangeVisibilityField (void)
/***** Get parameters of the form *****/ /***** Get parameters of the form *****/
/* Get the code of field */ /* Get the code of field */
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) <= 0) Gbl.Crs.Records.Field.FieldCod = Par_GetAndCheckParCode (Par_FldCod);
Err_WrongRecordFieldExit ();
/* Get the new visibility of the field */ /* Get the new visibility of the field */
NewVisibility = (Rec_VisibilityRecordFields_t) NewVisibility = (Rec_VisibilityRecordFields_t)

View File

@ -125,7 +125,6 @@ unsigned Rec_ConvertToNumLinesField (const char *StrNumLines);
bool Rec_CheckIfRecordFieldIsRepeated (const char *FieldName); bool Rec_CheckIfRecordFieldIsRepeated (const char *FieldName);
void Rec_CreateRecordField (void); void Rec_CreateRecordField (void);
void Rec_ReqRemField (void); void Rec_ReqRemField (void);
long Rec_GetFieldCod (void);
void Rec_AskConfirmRemFieldWithRecords (unsigned NumRecords); void Rec_AskConfirmRemFieldWithRecords (unsigned NumRecords);
void Rec_RemoveFieldFromDB (void); void Rec_RemoveFieldFromDB (void);
void Rec_RemoveField (void); void Rec_RemoveField (void);

View File

@ -347,8 +347,7 @@ void Roo_ChangeMAC (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get room code */ /* Get room code */
if ((Roo_EditingRoom->RooCod = Par_GetParLong ("Cod")) <= 0) Roo_EditingRoom->RooCod = Par_GetAndCheckParCode (Par_RooCod);
Err_WrongRoomExit ();
/* Get the old MAC address of the room */ /* Get the old MAC address of the room */
OldMACnum = MAC_GetMACnumFromForm ("MAC"); OldMACnum = MAC_GetMACnumFromForm ("MAC");
@ -700,7 +699,7 @@ static void Roo_ListRoomsForEdition (const struct Bld_Buildings *Buildings,
/* Building */ /* Building */
HTM_TD_Begin ("class=\"CT\""); HTM_TD_Begin ("class=\"CT\"");
Frm_BeginFormAnchor (ActChgRooBld,Anchor); Frm_BeginFormAnchor (ActChgRooBld,Anchor);
Roo_PutParamRooCod (&Room->RooCod); Par_PutParCode (Par_RooCod,Room->RooCod);
Roo_PutSelectorBuilding (Room->BldCod,Buildings, Roo_PutSelectorBuilding (Room->BldCod,Buildings,
HTM_SUBMIT_ON_CHANGE); HTM_SUBMIT_ON_CHANGE);
Frm_EndForm (); Frm_EndForm ();
@ -709,7 +708,7 @@ static void Roo_ListRoomsForEdition (const struct Bld_Buildings *Buildings,
/* Floor */ /* Floor */
HTM_TD_Begin ("class=\"LT\""); HTM_TD_Begin ("class=\"LT\"");
Frm_BeginFormAnchor (ActChgRooFlo,Anchor); Frm_BeginFormAnchor (ActChgRooFlo,Anchor);
Roo_PutParamRooCod (&Room->RooCod); Par_PutParCode (Par_RooCod,Room->RooCod);
HTM_INPUT_LONG ("Floor",(long) INT_MIN,(long) INT_MAX,(long) Room->Floor, HTM_INPUT_LONG ("Floor",(long) INT_MIN,(long) INT_MAX,(long) Room->Floor,
HTM_SUBMIT_ON_CHANGE,false, HTM_SUBMIT_ON_CHANGE,false,
"class=\"INPUT_LONG INPUT_%s\"", "class=\"INPUT_LONG INPUT_%s\"",
@ -720,7 +719,7 @@ static void Roo_ListRoomsForEdition (const struct Bld_Buildings *Buildings,
/* Room type */ /* Room type */
HTM_TD_Begin ("class=\"CT\""); HTM_TD_Begin ("class=\"CT\"");
Frm_BeginFormAnchor (ActChgRooTyp,Anchor); Frm_BeginFormAnchor (ActChgRooTyp,Anchor);
Roo_PutParamRooCod (&Room->RooCod); Par_PutParCode (Par_RooCod,Room->RooCod);
Roo_PutSelectorType (Room->Type, Roo_PutSelectorType (Room->Type,
HTM_SUBMIT_ON_CHANGE); HTM_SUBMIT_ON_CHANGE);
Frm_EndForm (); Frm_EndForm ();
@ -729,7 +728,7 @@ static void Roo_ListRoomsForEdition (const struct Bld_Buildings *Buildings,
/* Room short name */ /* Room short name */
HTM_TD_Begin ("class=\"LT\""); HTM_TD_Begin ("class=\"LT\"");
Frm_BeginFormAnchor (ActRenRooSho,Anchor); Frm_BeginFormAnchor (ActRenRooSho,Anchor);
Roo_PutParamRooCod (&Room->RooCod); Par_PutParCode (Par_RooCod,Room->RooCod);
HTM_INPUT_TEXT ("ShortName",Roo_MAX_CHARS_SHRT_NAME,Room->ShrtName, HTM_INPUT_TEXT ("ShortName",Roo_MAX_CHARS_SHRT_NAME,Room->ShrtName,
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
"size=\"10\"" "size=\"10\""
@ -741,7 +740,7 @@ static void Roo_ListRoomsForEdition (const struct Bld_Buildings *Buildings,
/* Room full name */ /* Room full name */
HTM_TD_Begin ("class=\"LT\""); HTM_TD_Begin ("class=\"LT\"");
Frm_BeginFormAnchor (ActRenRooFul,Anchor); Frm_BeginFormAnchor (ActRenRooFul,Anchor);
Roo_PutParamRooCod (&Room->RooCod); Par_PutParCode (Par_RooCod,Room->RooCod);
HTM_INPUT_TEXT ("FullName",Roo_MAX_CHARS_FULL_NAME,Room->FullName, HTM_INPUT_TEXT ("FullName",Roo_MAX_CHARS_FULL_NAME,Room->FullName,
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
"size=\"20\"" "size=\"20\""
@ -753,7 +752,7 @@ static void Roo_ListRoomsForEdition (const struct Bld_Buildings *Buildings,
/* Seating capacity */ /* Seating capacity */
HTM_TD_Begin ("class=\"LT\""); HTM_TD_Begin ("class=\"LT\"");
Frm_BeginFormAnchor (ActChgRooMaxUsr,Anchor); Frm_BeginFormAnchor (ActChgRooMaxUsr,Anchor);
Roo_PutParamRooCod (&Room->RooCod); Par_PutParCode (Par_RooCod,Room->RooCod);
Roo_WriteCapacity (StrCapacity,Room->Capacity); Roo_WriteCapacity (StrCapacity,Room->Capacity);
HTM_INPUT_TEXT ("Capacity",Cns_MAX_DECIMAL_DIGITS_UINT,StrCapacity, HTM_INPUT_TEXT ("Capacity",Cns_MAX_DECIMAL_DIGITS_UINT,StrCapacity,
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
@ -848,17 +847,7 @@ static void Roo_PutSelectorType (Roo_RoomType_t RoomType,
static void Roo_PutParamRooCod (void *RooCod) static void Roo_PutParamRooCod (void *RooCod)
{ {
if (RooCod) if (RooCod)
Par_PutParLong (NULL,"RooCod",*((long *) RooCod)); Par_PutParCode (Par_RooCod,*((long *) RooCod));
}
/*****************************************************************************/
/********************** Get parameter with code of room **********************/
/*****************************************************************************/
long Roo_GetParamRooCod (void)
{
/***** Get code of room *****/
return Par_GetParLong ("RooCod");
} }
/*****************************************************************************/ /*****************************************************************************/
@ -900,8 +889,7 @@ void Roo_RemoveRoom (void)
Roo_EditingRoomConstructor (); Roo_EditingRoomConstructor ();
/***** Get room code *****/ /***** Get room code *****/
if ((Roo_EditingRoom->RooCod = Roo_GetParamRooCod ()) <= 0) Roo_EditingRoom->RooCod = Par_GetAndCheckParCode (Par_RooCod);
Err_WrongRoomExit ();
/***** Get data of the room from database *****/ /***** Get data of the room from database *****/
Roo_GetDataOfRoomByCod (Roo_EditingRoom); Roo_GetDataOfRoomByCod (Roo_EditingRoom);
@ -933,8 +921,7 @@ void Roo_ChangeBuilding (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get room code */ /* Get room code */
if ((Roo_EditingRoom->RooCod = Roo_GetParamRooCod ()) <= 0) Roo_EditingRoom->RooCod = Par_GetAndCheckParCode (Par_RooCod);
Err_WrongRoomExit ();
/* Get room building */ /* Get room building */
NewBldCod = Par_GetAndCheckParCode (Par_BldCod); NewBldCod = Par_GetAndCheckParCode (Par_BldCod);
@ -981,8 +968,7 @@ void Roo_ChangeFloor (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get room code */ /* Get room code */
if ((Roo_EditingRoom->RooCod = Roo_GetParamRooCod ()) <= 0) Roo_EditingRoom->RooCod = Par_GetAndCheckParCode (Par_RooCod);
Err_WrongRoomExit ();
/* Get room floor */ /* Get room floor */
NewFloor = Roo_GetParamFloor (); NewFloor = Roo_GetParamFloor ();
@ -1028,8 +1014,7 @@ void Roo_ChangeType (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get room code */ /* Get room code */
if ((Roo_EditingRoom->RooCod = Roo_GetParamRooCod ()) <= 0) Roo_EditingRoom->RooCod = Par_GetAndCheckParCode (Par_RooCod);
Err_WrongRoomExit ();
/* Get room type */ /* Get room type */
NewType = Roo_GetParamType (); NewType = Roo_GetParamType ();
@ -1120,8 +1105,7 @@ static void Roo_RenameRoom (Cns_ShrtOrFullName_t ShrtOrFullName)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get room code */ /* Get room code */
if ((Roo_EditingRoom->RooCod = Roo_GetParamRooCod ()) <= 0) Roo_EditingRoom->RooCod = Par_GetAndCheckParCode (Par_RooCod);
Err_WrongRoomExit ();
/* Get the new name for the room */ /* Get the new name for the room */
Par_GetParText (ParamName,NewClaName,MaxBytes); Par_GetParText (ParamName,NewClaName,MaxBytes);
@ -1181,8 +1165,7 @@ void Roo_ChangeCapacity (void)
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get room code */ /* Get room code */
if ((Roo_EditingRoom->RooCod = Roo_GetParamRooCod ()) <= 0) Roo_EditingRoom->RooCod = Par_GetAndCheckParCode (Par_RooCod);
Err_WrongRoomExit ();
/* Get the seating capacity of the room */ /* Get the seating capacity of the room */
NewCapacity = (unsigned) NewCapacity = (unsigned)

View File

@ -130,8 +130,6 @@ void Roo_FreeListRooms (struct Roo_Rooms *Rooms);
void Roo_GetListRoomsInThisCtr (void); void Roo_GetListRoomsInThisCtr (void);
long Roo_GetParamRooCod (void);
void Roo_RemoveRoom (void); void Roo_RemoveRoom (void);
void Roo_ChangeBuilding (void); void Roo_ChangeBuilding (void);
void Roo_ChangeFloor (void); void Roo_ChangeFloor (void);

View File

@ -1100,7 +1100,7 @@ static void TmlCom_GetDataOfCommFromRow (MYSQL_ROW row,
/***** Get number of times this comment has been favourited *****/ /***** Get number of times this comment has been favourited *****/
Com->NumFavs = Tml_DB_GetNumFavers (TmlUsr_FAV_UNF_COMM, Com->NumFavs = Tml_DB_GetNumFavers (TmlUsr_FAV_UNF_COMM,
Com->PubCod,Com->UsrCod); Com->PubCod,Com->UsrCod);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -319,7 +319,7 @@ static void TmlFav_UnfComm (struct TmlCom_Comment *Com)
/***** Trivial check: Have I faved this comment? *****/ /***** Trivial check: Have I faved this comment? *****/
if (!TmlUsr_CheckIfFavedSharedByUsr (TmlUsr_FAV_UNF_COMM,Com->PubCod, if (!TmlUsr_CheckIfFavedSharedByUsr (TmlUsr_FAV_UNF_COMM,Com->PubCod,
Gbl.Usrs.Me.UsrDat.UsrCod)) Gbl.Usrs.Me.UsrDat.UsrCod))
{ {
Med_MediaDestructor (&Com->Content.Media); Med_MediaDestructor (&Com->Content.Media);
return; return;