Version19.108.2

This commit is contained in:
Antonio Cañas Vargas 2019-12-30 14:55:25 +01:00
parent 0bb8245fdc
commit fef1cb17ae
11 changed files with 81 additions and 68 deletions

View File

@ -420,11 +420,10 @@ void Acc_ShowFormGoToRequestNewAccount (void)
extern const char *Txt_Create_account; extern const char *Txt_Create_account;
/***** Begin box *****/ /***** Begin box *****/
snprintf (Gbl.Title,sizeof (Gbl.Title), Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_New_on_PLATFORM_Sign_up,
Txt_New_on_PLATFORM_Sign_up, Cfg_PLATFORM_SHORT_NAME),NULL,
Cfg_PLATFORM_SHORT_NAME);
Box_BoxBegin (NULL,Gbl.Title,NULL,
Hlp_PROFILE_SignUp,Box_NOT_CLOSABLE); Hlp_PROFILE_SignUp,Box_NOT_CLOSABLE);
Str_FreeStrMsg ();
/***** Button to go to request the creation of a new account *****/ /***** Button to go to request the creation of a new account *****/
Frm_StartForm (ActFrmMyAcc); Frm_StartForm (ActFrmMyAcc);

View File

@ -356,14 +356,13 @@ void Agd_ShowUsrAgenda (void)
Error = false; Error = false;
/***** Begin box *****/ /***** Begin box *****/
snprintf (Gbl.Title,sizeof (Gbl.Title),
Txt_Public_agenda_USER,
Gbl.Usrs.Other.UsrDat.FullName);
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod); ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
Box_BoxBegin ("100%",Gbl.Title, Box_BoxBegin ("100%",Str_BuildStrMsg (Txt_Public_agenda_USER,
Gbl.Usrs.Other.UsrDat.FullName),
ItsMe ? Agd_PutIconsMyPublicAgenda : ItsMe ? Agd_PutIconsMyPublicAgenda :
Agd_PutIconsOtherPublicAgenda, Agd_PutIconsOtherPublicAgenda,
Hlp_PROFILE_Agenda_public_agenda,Box_NOT_CLOSABLE); Hlp_PROFILE_Agenda_public_agenda,Box_NOT_CLOSABLE);
Str_FreeStrMsg ();
/***** Show the current events in the user's agenda *****/ /***** Show the current events in the user's agenda *****/
Agd_ShowEventsToday (Agd_ANOTHER_AGENDA_TODAY); Agd_ShowEventsToday (Agd_ANOTHER_AGENDA_TODAY);
@ -400,14 +399,13 @@ void Agd_ShowOtherAgendaAfterLogIn (void)
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Existing user if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Existing user
{ {
/***** Begin box *****/ /***** Begin box *****/
snprintf (Gbl.Title,sizeof (Gbl.Title),
Txt_Public_agenda_USER,
Gbl.Usrs.Other.UsrDat.FullName);
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod); ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
Box_BoxBegin ("100%",Gbl.Title, Box_BoxBegin ("100%",Str_BuildStrMsg (Txt_Public_agenda_USER,
Gbl.Usrs.Other.UsrDat.FullName),
ItsMe ? Agd_PutIconToViewEditMyFullAgenda : ItsMe ? Agd_PutIconToViewEditMyFullAgenda :
Agd_PutIconsOtherPublicAgenda, Agd_PutIconsOtherPublicAgenda,
Hlp_PROFILE_Agenda_public_agenda,Box_NOT_CLOSABLE); Hlp_PROFILE_Agenda_public_agenda,Box_NOT_CLOSABLE);
Str_FreeStrMsg ();
/***** Show the current events in the user's agenda *****/ /***** Show the current events in the user's agenda *****/
Agd_ShowEventsToday (Agd_ANOTHER_AGENDA_TODAY); Agd_ShowEventsToday (Agd_ANOTHER_AGENDA_TODAY);
@ -1902,11 +1900,10 @@ void Agd_PrintAgdQRCode (void)
extern const char *Txt_Where_s_USER; extern const char *Txt_Where_s_USER;
/***** Begin box *****/ /***** Begin box *****/
snprintf (Gbl.Title,sizeof (Gbl.Title), Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Where_s_USER,
Txt_Where_s_USER, Gbl.Usrs.Me.UsrDat.FullName),NULL,
Gbl.Usrs.Me.UsrDat.FullName);
Box_BoxBegin (NULL,Gbl.Title,NULL,
NULL,Box_NOT_CLOSABLE); NULL,Box_NOT_CLOSABLE);
Str_FreeStrMsg ();
/***** Print QR code ****/ /***** Print QR code ****/
QR_PrintQRCode (); QR_PrintQRCode ();

View File

@ -264,11 +264,11 @@ static void Ctr_ListCentres (void)
unsigned NumCtr; unsigned NumCtr;
/***** Begin box *****/ /***** Begin box *****/
snprintf (Gbl.Title,sizeof (Gbl.Title), Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Centres_of_INSTITUTION_X,
Txt_Centres_of_INSTITUTION_X, Gbl.Hierarchy.Ins.FullName),
Gbl.Hierarchy.Ins.FullName); Ctr_PutIconsListingCentres,
Box_BoxBegin (NULL,Gbl.Title,Ctr_PutIconsListingCentres,
Hlp_INSTITUTION_Centres,Box_NOT_CLOSABLE); Hlp_INSTITUTION_Centres,Box_NOT_CLOSABLE);
Str_FreeStrMsg ();
if (Gbl.Hierarchy.Ins.Ctrs.Num) // There are centres in the current institution if (Gbl.Hierarchy.Ins.Ctrs.Num) // There are centres in the current institution
{ {
@ -476,11 +476,11 @@ static void Ctr_EditCentresInternal (void)
Hie_WriteMenuHierarchy (); Hie_WriteMenuHierarchy ();
/***** Begin box *****/ /***** Begin box *****/
snprintf (Gbl.Title,sizeof (Gbl.Title), Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Centres_of_INSTITUTION_X,
Txt_Centres_of_INSTITUTION_X, Gbl.Hierarchy.Ins.FullName),
Gbl.Hierarchy.Ins.FullName); Ctr_PutIconsEditingCentres,
Box_BoxBegin (NULL,Gbl.Title,Ctr_PutIconsEditingCentres,
Hlp_INSTITUTION_Centres,Box_NOT_CLOSABLE); Hlp_INSTITUTION_Centres,Box_NOT_CLOSABLE);
Str_FreeStrMsg ();
/***** Put a form to create a new centre *****/ /***** Put a form to create a new centre *****/
Ctr_PutFormToCreateCentre (); Ctr_PutFormToCreateCentre ();

View File

@ -797,10 +797,10 @@ static void CtrCfg_NumDegs (void)
HTM_TD_Begin ("class=\"LB\""); HTM_TD_Begin ("class=\"LB\"");
Frm_StartFormGoTo (ActSeeDeg); Frm_StartFormGoTo (ActSeeDeg);
Ctr_PutParamCtrCod (Gbl.Hierarchy.Ctr.CtrCod); Ctr_PutParamCtrCod (Gbl.Hierarchy.Ctr.CtrCod);
snprintf (Gbl.Title,sizeof (Gbl.Title), HTM_BUTTON_SUBMIT_Begin (Str_BuildStrMsg (Txt_Degrees_of_CENTRE_X,
Txt_Degrees_of_CENTRE_X, Gbl.Hierarchy.Ctr.ShrtName),
Gbl.Hierarchy.Ctr.ShrtName); "BT_LINK DAT",NULL);
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,"BT_LINK DAT",NULL); Str_FreeStrMsg ();
HTM_Unsigned (Deg_GetNumDegsInCtr (Gbl.Hierarchy.Ctr.CtrCod)); HTM_Unsigned (Deg_GetNumDegsInCtr (Gbl.Hierarchy.Ctr.CtrCod));
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();

View File

@ -492,7 +492,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 19.108 (2019-12-30)" #define Log_PLATFORM_VERSION "SWAD 19.108.2 (2019-12-30)"
#define CSS_FILE "swad19.101.5.css" #define CSS_FILE "swad19.101.5.css"
#define JS_FILE "swad19.91.1.js" #define JS_FILE "swad19.91.1.js"
/* /*
@ -502,6 +502,8 @@ ps2pdf source.ps destination.pdf
Version 19.10x: Dec 30, 2019 Map in country information. (? lines) Version 19.10x: Dec 30, 2019 Map in country information. (? lines)
Version 19.10x: Dec 30, 2019 Map in institution information. (? lines) Version 19.10x: Dec 30, 2019 Map in institution information. (? lines)
Version 19.108.2: Dec 30, 2019 Code refactoring related to printing messages. (249739 lines)
Version 19.108.1: Dec 30, 2019 Code refactoring related to printing messages. (249746 lines)
Version 19.108: Dec 30, 2019 Code refactoring related to hierarchy. (249730 lines) Version 19.108: Dec 30, 2019 Code refactoring related to hierarchy. (249730 lines)
Version 19.107: Dec 29, 2019 New module swad_hierarchy_config for common hierarchy configuration functions. (249760 lines) Version 19.107: Dec 29, 2019 New module swad_hierarchy_config for common hierarchy configuration functions. (249760 lines)
Version 19.106: Dec 29, 2019 New module swad_country_config for country configuration. (249683 lines) Version 19.106: Dec 29, 2019 New module swad_country_config for country configuration. (249683 lines)

View File

@ -343,10 +343,10 @@ static void CtyCfg_NumInss (void)
HTM_TD_Begin ("class=\"LB\""); HTM_TD_Begin ("class=\"LB\"");
Frm_StartFormGoTo (ActSeeIns); Frm_StartFormGoTo (ActSeeIns);
Cty_PutParamCtyCod (Gbl.Hierarchy.Cty.CtyCod); Cty_PutParamCtyCod (Gbl.Hierarchy.Cty.CtyCod);
snprintf (Gbl.Title,sizeof (Gbl.Title), HTM_BUTTON_SUBMIT_Begin (Str_BuildStrMsg (Txt_Institutions_of_COUNTRY_X,
Txt_Institutions_of_COUNTRY_X, Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]),
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]); "BT_LINK DAT",NULL);
HTM_BUTTON_SUBMIT_Begin (Gbl.Title,"BT_LINK DAT",NULL); Str_FreeStrMsg ();
HTM_Unsigned (Ins_GetNumInssInCty (Gbl.Hierarchy.Cty.CtyCod)); HTM_Unsigned (Ins_GetNumInssInCty (Gbl.Hierarchy.Cty.CtyCod));
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();

View File

@ -743,11 +743,11 @@ static void Crs_ListCourses (void)
unsigned Year; unsigned Year;
/***** Begin box *****/ /***** Begin box *****/
snprintf (Gbl.Title,sizeof (Gbl.Title), Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Courses_of_DEGREE_X,
Txt_Courses_of_DEGREE_X, Gbl.Hierarchy.Deg.ShrtName),
Gbl.Hierarchy.Deg.ShrtName); Crs_PutIconsListCourses,
Box_BoxBegin (NULL,Gbl.Title,Crs_PutIconsListCourses,
Hlp_DEGREE_Courses,Box_NOT_CLOSABLE); Hlp_DEGREE_Courses,Box_NOT_CLOSABLE);
Str_FreeStrMsg ();
if (Gbl.Hierarchy.Deg.Crss.Num) // There are courses in the current degree if (Gbl.Hierarchy.Deg.Crss.Num) // There are courses in the current degree
{ {
@ -947,11 +947,11 @@ static void Crs_EditCoursesInternal (void)
Hie_WriteMenuHierarchy (); Hie_WriteMenuHierarchy ();
/***** Begin box *****/ /***** Begin box *****/
snprintf (Gbl.Title,sizeof (Gbl.Title), Box_BoxBegin (NULL,Str_BuildStrMsg (Txt_Courses_of_DEGREE_X,
Txt_Courses_of_DEGREE_X, Gbl.Hierarchy.Deg.ShrtName),
Gbl.Hierarchy.Deg.ShrtName); Crs_PutIconsEditingCourses,
Box_BoxBegin (NULL,Gbl.Title,Crs_PutIconsEditingCourses,
Hlp_DEGREE_Courses,Box_NOT_CLOSABLE); Hlp_DEGREE_Courses,Box_NOT_CLOSABLE);
Str_FreeStrMsg ();
/***** Put a form to create or request a new course *****/ /***** Put a form to create or request a new course *****/
Crs_PutFormToCreateCourse (); Crs_PutFormToCreateCourse ();
@ -2269,10 +2269,9 @@ static void Crs_PutButtonToRegisterInCrs (void)
// If the course being edited is different to the current one... // If the course being edited is different to the current one...
if (Crs_EditingCrs->CrsCod != Gbl.Hierarchy.Crs.CrsCod) if (Crs_EditingCrs->CrsCod != Gbl.Hierarchy.Crs.CrsCod)
Crs_PutParamCrsCod (Crs_EditingCrs->CrsCod); Crs_PutParamCrsCod (Crs_EditingCrs->CrsCod);
snprintf (Gbl.Title,sizeof (Gbl.Title), Btn_PutCreateButton (Str_BuildStrMsg (Txt_Register_me_in_X,
Txt_Register_me_in_X, Crs_EditingCrs->ShrtName));
Crs_EditingCrs->ShrtName); Str_FreeStrMsg ();
Btn_PutCreateButton (Gbl.Title);
Frm_EndForm (); Frm_EndForm ();
} }
@ -2443,15 +2442,13 @@ void Crs_GetAndWriteCrssOfAUsr (const struct UsrData *UsrDat,Rol_Role_t Role)
NULL,Box_NOT_CLOSABLE,2); NULL,Box_NOT_CLOSABLE,2);
/* Heading row */ /* Heading row */
snprintf (Gbl.Title,sizeof (Gbl.Title),
Txt_USER_in_COURSE,
Role == Rol_UNK ? Txt_User[Usr_SEX_UNKNOWN] : // Role == Rol_UNK ==> any role
Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]);
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TH_Begin (1,7,"LM"); HTM_TH_Begin (1,7,"LM");
HTM_TxtF ("%s:",Gbl.Title); HTM_TxtF ("%s:",Str_BuildStrMsg (Txt_USER_in_COURSE,
Role == Rol_UNK ? Txt_User[Usr_SEX_UNKNOWN] : // Role == Rol_UNK ==> any role
Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]));
Str_FreeStrMsg ();
HTM_TH_End (); HTM_TH_End ();
HTM_TR_End (); HTM_TR_End ();

View File

@ -48,12 +48,6 @@ extern struct Globals Gbl;
/***************************** Private types *********************************/ /***************************** Private types *********************************/
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/
/*************************** Private variables *******************************/
/*****************************************************************************/
char *Hie_GoToMsg = NULL;
/*****************************************************************************/ /*****************************************************************************/
/*************************** Private constants *******************************/ /*************************** Private constants *******************************/
/*****************************************************************************/ /*****************************************************************************/
@ -794,15 +788,10 @@ char *Hie_BuildGoToMsg (const char *Where)
{ {
extern const char *Txt_Go_to_X; extern const char *Txt_Go_to_X;
Hie_FreeGoToMsg (); return Str_BuildStrMsg (Txt_Go_to_X,Where);
if (asprintf (&Hie_GoToMsg,Txt_Go_to_X,Where) < 0)
Lay_NotEnoughMemoryExit ();
return Hie_GoToMsg;
} }
void Hie_FreeGoToMsg (void) void Hie_FreeGoToMsg (void)
{ {
if (Hie_GoToMsg != NULL) Str_FreeStrMsg ();
free (Hie_GoToMsg);
} }

View File

@ -998,14 +998,14 @@ static void Rep_GetAndWriteMyCurrentCrss (Rol_Role_t Role,
long CrsCod; long CrsCod;
NumCrss = Usr_GetNumCrssOfUsrWithARole (Gbl.Usrs.Me.UsrDat.UsrCod,Role); NumCrss = Usr_GetNumCrssOfUsrWithARole (Gbl.Usrs.Me.UsrDat.UsrCod,Role);
snprintf (Gbl.Title,sizeof (Gbl.Title),
Txt_USER_in_COURSE,
Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]);
fprintf (Gbl.F.Rep,"<li>%s %u %s", fprintf (Gbl.F.Rep,"<li>%s %u %s",
Gbl.Title, Str_BuildStrMsg (Txt_USER_in_COURSE,
Txt_ROLES_SINGUL_Abc[Role][Gbl.Usrs.Me.UsrDat.Sex]),
NumCrss, NumCrss,
NumCrss == 1 ? Txt_course : NumCrss == 1 ? Txt_course :
Txt_courses); Txt_courses);
Str_FreeStrMsg ();
if (NumCrss) if (NumCrss)
{ {
fprintf (Gbl.F.Rep," (%u %s / %u %s):", fprintf (Gbl.F.Rep," (%u %s / %u %s):",

View File

@ -2922,3 +2922,29 @@ void Str_Concat (char *Dst,const char *Src,size_t DstSize)
/***** Concatenate ******/ /***** Concatenate ******/
strcat (Dst,Src); strcat (Dst,Src);
} }
/*****************************************************************************/
/************************** Build a string message ***************************/
/*****************************************************************************/
// FormatMsg must be a string including "%s"
// Str_FreeStrMsg() must be called after calling this function
static char *Str_StrMsg = NULL;
char *Str_BuildStrMsg (const char *FormatMsg,const char *Str)
{
Str_FreeStrMsg ();
if (asprintf (&Str_StrMsg,FormatMsg,Str) < 0)
Lay_NotEnoughMemoryExit ();
return Str_StrMsg;
}
void Str_FreeStrMsg (void)
{
if (Str_StrMsg != NULL)
{
free (Str_StrMsg);
Str_StrMsg = NULL;
}
}

View File

@ -136,4 +136,7 @@ void Str_CreateRandomAlphanumStr (char *Str,size_t Length);
void Str_Copy (char *Dst,const char *Src,size_t DstSize); void Str_Copy (char *Dst,const char *Src,size_t DstSize);
void Str_Concat (char *Dst,const char *Src,size_t DstSize); void Str_Concat (char *Dst,const char *Src,size_t DstSize);
char *Str_BuildStrMsg (const char *FormatMsg,const char *Str);
void Str_FreeStrMsg (void);
#endif #endif