Version 23.70.2: Mar 19, 2024 Changes in course info.

This commit is contained in:
acanas 2024-03-19 23:39:54 +01:00
parent 12c503501e
commit de62eb7e5e
3 changed files with 202 additions and 282 deletions

View File

@ -633,10 +633,11 @@ Me sale este error, no s
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod') "can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
*/ */
#define Log_PLATFORM_VERSION "SWAD 23.70.1 (2024-03-19)" #define Log_PLATFORM_VERSION "SWAD 23.70.2 (2024-03-19)"
#define CSS_FILE "swad23.67.2.css" #define CSS_FILE "swad23.67.2.css"
#define JS_FILE "swad23.53.6.js" #define JS_FILE "swad23.53.6.js"
/* /*
Version 23.70.2: Mar 19, 2024 Changes in course info. (335353 lines)
Version 23.70.1: Mar 19, 2024 Bug fixing in syllabus. (335429 lines) Version 23.70.1: Mar 19, 2024 Bug fixing in syllabus. (335429 lines)
Version 23.70: Mar 19, 2024 Code refactoring and bug fixing in syllabus. (335413 lines) Version 23.70: Mar 19, 2024 Code refactoring and bug fixing in syllabus. (335413 lines)
Version 23.69: Mar 14, 2024 Actions defined as enum type. (335591 lines) Version 23.69: Mar 14, 2024 Actions defined as enum type. (335591 lines)

View File

@ -242,6 +242,14 @@ void Inf_ShowInfo (void)
break; break;
} }
/***** Begin box *****/
Box_BoxBegin (Txt_INFO_TITLE[Gbl.Crs.Info.Type],
ICanEdit ? Inf_PutIconToEditInfo :
NULL,
ICanEdit ? &Gbl.Crs.Info.Type :
NULL,
Help[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE);
/****** Form to select syllabus *****/ /****** Form to select syllabus *****/
Syl_PutFormWhichSyllabus (Syllabus.WhichSyllabus); Syl_PutFormWhichSyllabus (Syllabus.WhichSyllabus);
@ -284,17 +292,11 @@ void Inf_ShowInfo (void)
} }
if (ShowWarningNoInfo) if (ShowWarningNoInfo)
{
Box_BoxBegin (Txt_INFO_TITLE[Gbl.Crs.Info.Type],
ICanEdit ? Inf_PutIconToEditInfo :
NULL,
ICanEdit ? &Gbl.Crs.Info.Type :
NULL,
Help[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE);
Ale_ShowAlert (Ale_INFO,Txt_No_information); Ale_ShowAlert (Ale_INFO,Txt_No_information);
/***** End box *****/
Box_BoxEnd (); Box_BoxEnd ();
} }
}
/*****************************************************************************/ /*****************************************************************************/
/************************ Put icon to edit course info ***********************/ /************************ Put icon to edit course info ***********************/
@ -794,28 +796,6 @@ void Inf_WriteURLIntoTxtBuffer (char TxtBuffer[Cns_MAX_BYTES_WWW + 1])
static void Inf_ShowPage (const char *URL) static void Inf_ShowPage (const char *URL)
{ {
extern const char *Txt_View_in_a_new_window; extern const char *Txt_View_in_a_new_window;
extern const char *Txt_INFO_TITLE[Inf_NUM_TYPES];
bool ICanEdit = (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
const char *Help[Inf_NUM_TYPES] =
{
[Inf_INTRODUCTION ] = Hlp_COURSE_Information_textual_information,
[Inf_TEACHING_GUIDE] = Hlp_COURSE_Guide,
[Inf_LECTURES ] = Hlp_COURSE_Syllabus,
[Inf_PRACTICALS ] = Hlp_COURSE_Syllabus,
[Inf_BIBLIOGRAPHY ] = Hlp_COURSE_Bibliography,
[Inf_FAQ ] = Hlp_COURSE_FAQ,
[Inf_LINKS ] = Hlp_COURSE_Links,
[Inf_ASSESSMENT ] = Hlp_COURSE_Assessment,
};
/***** Begin box *****/
Box_BoxBegin (Txt_INFO_TITLE[Gbl.Crs.Info.Type],
ICanEdit ? Inf_PutIconToEditInfo :
NULL,
ICanEdit ? &Gbl.Crs.Info.Type :
NULL,
Help[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE);
/***** Link to view in a new window *****/ /***** Link to view in a new window *****/
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"FORM_OUT_%s BOLD\"", HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"FORM_OUT_%s BOLD\"",
@ -823,9 +803,6 @@ static void Inf_ShowPage (const char *URL)
Ico_PutIconTextLink ("expand-arrows-alt.svg",Ico_BLACK, Ico_PutIconTextLink ("expand-arrows-alt.svg",Ico_BLACK,
Txt_View_in_a_new_window); Txt_View_in_a_new_window);
HTM_A_End (); HTM_A_End ();
/***** End box *****/
Box_BoxEnd ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -1364,19 +1341,6 @@ static bool Inf_CheckAndShowPlainTxt (void)
{ {
extern const char *Txt_INFO_TITLE[Inf_NUM_TYPES]; extern const char *Txt_INFO_TITLE[Inf_NUM_TYPES];
char TxtHTML[Cns_MAX_BYTES_LONG_TEXT + 1]; char TxtHTML[Cns_MAX_BYTES_LONG_TEXT + 1];
bool ICanEdit = (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
const char *Help[Inf_NUM_TYPES] =
{
[Inf_INTRODUCTION ] = Hlp_COURSE_Information_textual_information,
[Inf_TEACHING_GUIDE] = Hlp_COURSE_Guide,
[Inf_LECTURES ] = Hlp_COURSE_Syllabus,
[Inf_PRACTICALS ] = Hlp_COURSE_Syllabus,
[Inf_BIBLIOGRAPHY ] = Hlp_COURSE_Bibliography,
[Inf_FAQ ] = Hlp_COURSE_FAQ,
[Inf_LINKS ] = Hlp_COURSE_Links,
[Inf_ASSESSMENT ] = Hlp_COURSE_Assessment,
};
/***** Get info text from database *****/ /***** Get info text from database *****/
Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Node[Hie_CRS].HieCod,Gbl.Crs.Info.Type, Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Node[Hie_CRS].HieCod,Gbl.Crs.Info.Type,
@ -1384,14 +1348,6 @@ static bool Inf_CheckAndShowPlainTxt (void)
if (TxtHTML[0]) if (TxtHTML[0])
{ {
/***** Begin box *****/
Box_BoxBegin (Txt_INFO_TITLE[Gbl.Crs.Info.Type],
ICanEdit ? Inf_PutIconToEditInfo :
NULL,
ICanEdit ? &Gbl.Crs.Info.Type :
NULL,
Help[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE);
if (Gbl.Crs.Info.Type == Inf_INTRODUCTION || if (Gbl.Crs.Info.Type == Inf_INTRODUCTION ||
Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE) Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE)
Lay_WriteHeaderClassPhoto (Vie_VIEW); Lay_WriteHeaderClassPhoto (Vie_VIEW);
@ -1409,9 +1365,6 @@ static bool Inf_CheckAndShowPlainTxt (void)
HTM_DIV_End (); HTM_DIV_End ();
/***** End box *****/
Box_BoxEnd ();
return true; return true;
} }
@ -1453,19 +1406,6 @@ static bool Inf_CheckAndShowRichTxt (void)
char MathJaxURL[PATH_MAX + 1]; char MathJaxURL[PATH_MAX + 1];
char Command[512 + PATH_MAX * 3]; // Command to call the program of preprocessing of photos char Command[512 + PATH_MAX * 3]; // Command to call the program of preprocessing of photos
int ReturnCode; int ReturnCode;
bool ICanEdit = (Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
const char *Help[Inf_NUM_TYPES] =
{
[Inf_INTRODUCTION ] = Hlp_COURSE_Information_textual_information,
[Inf_TEACHING_GUIDE] = Hlp_COURSE_Guide,
[Inf_LECTURES ] = Hlp_COURSE_Syllabus,
[Inf_PRACTICALS ] = Hlp_COURSE_Syllabus,
[Inf_BIBLIOGRAPHY ] = Hlp_COURSE_Bibliography,
[Inf_FAQ ] = Hlp_COURSE_FAQ,
[Inf_LINKS ] = Hlp_COURSE_Links,
[Inf_ASSESSMENT ] = Hlp_COURSE_Assessment,
};
/***** Get info text from database *****/ /***** Get info text from database *****/
Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Node[Hie_CRS].HieCod,Gbl.Crs.Info.Type, Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Node[Hie_CRS].HieCod,Gbl.Crs.Info.Type,
@ -1473,14 +1413,6 @@ static bool Inf_CheckAndShowRichTxt (void)
if (TxtMD[0]) if (TxtMD[0])
{ {
/***** Begin box *****/
Box_BoxBegin (Txt_INFO_TITLE[Gbl.Crs.Info.Type],
ICanEdit ? Inf_PutIconToEditInfo :
NULL,
ICanEdit ? &Gbl.Crs.Info.Type :
NULL,
Help[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE);
if (Gbl.Crs.Info.Type == Inf_INTRODUCTION || if (Gbl.Crs.Info.Type == Inf_INTRODUCTION ||
Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE) Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE)
Lay_WriteHeaderClassPhoto (Vie_VIEW); Lay_WriteHeaderClassPhoto (Vie_VIEW);
@ -1509,25 +1441,25 @@ static bool Inf_CheckAndShowRichTxt (void)
/***** Convert from Markdown to HTML *****/ /***** Convert from Markdown to HTML *****/
/* MathJax 2.5.1 /* MathJax 2.5.1
#ifdef Cfg_MATHJAX_LOCAL #ifdef Cfg_MATHJAX_LOCAL
// Use the local copy of MathJax // Use the local copy of MathJax
snprintf (MathJaxURL,sizeof (MathJaxURL), snprintf (MathJaxURL,sizeof (MathJaxURL),
"=%s/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML", "=%s/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML",
Cfg_URL_SWAD_PUBLIC); Cfg_URL_SWAD_PUBLIC);
#else #else
// Use the MathJax Content Delivery Network (CDN) // Use the MathJax Content Delivery Network (CDN)
MathJaxURL[0] = '\0'; MathJaxURL[0] = '\0';
#endif #endif
*/ */
/* MathJax 3.0.1 */ /* MathJax 3.0.1 */
#ifdef Cfg_MATHJAX_LOCAL #ifdef Cfg_MATHJAX_LOCAL
// Use the local copy of MathJax // Use the local copy of MathJax
snprintf (MathJaxURL,sizeof (MathJaxURL),"=%s/mathjax/tex-chtml.js", snprintf (MathJaxURL,sizeof (MathJaxURL),"=%s/mathjax/tex-chtml.js",
Cfg_URL_SWAD_PUBLIC); Cfg_URL_SWAD_PUBLIC);
#else #else
// Use the MathJax Content Delivery Network (CDN) // Use the MathJax Content Delivery Network (CDN)
MathJaxURL[0] = '\0'; MathJaxURL[0] = '\0';
#endif #endif
// --ascii uses only ascii characters in output // --ascii uses only ascii characters in output
// (uses numerical entities instead of UTF-8) // (uses numerical entities instead of UTF-8)
// is mandatory in order to convert (with iconv) the UTF-8 output of pandoc to WINDOWS-1252 // is mandatory in order to convert (with iconv) the UTF-8 output of pandoc to WINDOWS-1252
@ -1561,9 +1493,6 @@ static bool Inf_CheckAndShowRichTxt (void)
HTM_DIV_End (); HTM_DIV_End ();
/***** End box *****/
Box_BoxEnd ();
return true; return true;
} }

View File

@ -258,11 +258,6 @@ bool Syl_CheckSyllabus (struct Syl_Syllabus *Syllabus,long CrsCod)
bool Syl_CheckAndShowSyllabus (struct Syl_Syllabus *Syllabus) bool Syl_CheckAndShowSyllabus (struct Syl_Syllabus *Syllabus)
{ {
/***** Get syllabus type *****/
Syllabus->WhichSyllabus = Syl_GetParWhichSyllabus ();
Gbl.Crs.Info.Type = (Syllabus->WhichSyllabus == Syl_LECTURES ? Inf_LECTURES :
Inf_PRACTICALS);
/***** Load syllabus from XML file to memory *****/ /***** Load syllabus from XML file to memory *****/
Syl_LoadListItemsSyllabusIntoMemory (Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod); Syl_LoadListItemsSyllabusIntoMemory (Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
@ -301,13 +296,28 @@ bool Syl_CheckAndShowSyllabus (struct Syl_Syllabus *Syllabus)
void Syl_EditSyllabus (void) void Syl_EditSyllabus (void)
{ {
extern const char *Hlp_COURSE_Syllabus_edit;
extern const char *Txt_INFO_TITLE[Inf_NUM_TYPES];
struct Syl_Syllabus Syllabus; struct Syl_Syllabus Syllabus;
/***** Reset syllabus context *****/ /***** Reset syllabus context *****/
Syl_ResetSyllabus (&Syllabus); Syl_ResetSyllabus (&Syllabus);
/***** Get syllabus type *****/
Syllabus.WhichSyllabus = Syl_GetParWhichSyllabus ();
Gbl.Crs.Info.Type = (Syllabus.WhichSyllabus == Syl_LECTURES ? Inf_LECTURES :
Inf_PRACTICALS);
/***** Begin box *****/
Box_BoxBegin (Txt_INFO_TITLE[Gbl.Crs.Info.Type],
NULL,NULL,
Hlp_COURSE_Syllabus_edit,Box_NOT_CLOSABLE);
/***** Edit syllabus *****/ /***** Edit syllabus *****/
Syl_CheckAndShowSyllabus (&Syllabus); Syl_CheckAndShowSyllabus (&Syllabus);
/***** End box *****/
Box_BoxEnd ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -483,17 +493,11 @@ int Syl_ReadLevelItemSyllabus (FILE *XML)
static void Syl_ShowSyllabus (struct Syl_Syllabus *Syllabus) static void Syl_ShowSyllabus (struct Syl_Syllabus *Syllabus)
{ {
extern const char *Txt_INFO_TITLE[Inf_NUM_TYPES];
extern const char *Hlp_COURSE_Syllabus_edit; extern const char *Hlp_COURSE_Syllabus_edit;
extern const char *Hlp_COURSE_Syllabus; extern const char *Txt_INFO_TITLE[Inf_NUM_TYPES];
extern const char *Txt_Done; extern const char *Txt_Done;
unsigned NumItem; unsigned NumItem;
int Col; int Col;
static const char **HelpLink[Vie_NUM_VIEW_TYPES] =
{
[Vie_VIEW] = &Hlp_COURSE_Syllabus,
[Vie_EDIT] = &Hlp_COURSE_Syllabus_edit,
};
static int NumButtons[Vie_NUM_VIEW_TYPES] = static int NumButtons[Vie_NUM_VIEW_TYPES] =
{ {
[Vie_VIEW] = 0, [Vie_VIEW] = 0,
@ -514,17 +518,6 @@ static void Syl_ShowSyllabus (struct Syl_Syllabus *Syllabus)
Gbl.Action.Act == ActModIteSylLec || Gbl.Action.Act == ActModIteSylPra || Gbl.Action.Act == ActModIteSylLec || Gbl.Action.Act == ActModIteSylPra ||
Gbl.Action.Act == ActRgtIteSylLec || Gbl.Action.Act == ActRgtIteSylPra || Gbl.Action.Act == ActRgtIteSylLec || Gbl.Action.Act == ActRgtIteSylPra ||
Gbl.Action.Act == ActLftIteSylLec || Gbl.Action.Act == ActLftIteSylPra); Gbl.Action.Act == ActLftIteSylLec || Gbl.Action.Act == ActLftIteSylPra);
bool ICanEdit = Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM;
bool PutIconToEdit = Syllabus->ViewType == Vie_VIEW && ICanEdit;
/***** Begin box *****/
Box_BoxBegin (Txt_INFO_TITLE[Gbl.Crs.Info.Type],
PutIconToEdit ? Inf_PutIconToEditInfo :
NULL,
PutIconToEdit ? &Gbl.Crs.Info.Type :
NULL,
*HelpLink[Syllabus->ViewType],Box_NOT_CLOSABLE);
/***** Begin table *****/ /***** Begin table *****/
HTM_TABLE_BeginWide (); HTM_TABLE_BeginWide ();
@ -575,9 +568,6 @@ static void Syl_ShowSyllabus (struct Syl_Syllabus *Syllabus)
Btn_PutConfirmButton (Txt_Done); Btn_PutConfirmButton (Txt_Done);
Frm_EndForm (); Frm_EndForm ();
} }
/***** End box *****/
Box_BoxEnd ();
} }
/*****************************************************************************/ /*****************************************************************************/