mirror of https://github.com/acanas/swad-core.git
Version 23.70.2: Mar 19, 2024 Changes in course info.
This commit is contained in:
parent
12c503501e
commit
de62eb7e5e
|
@ -633,10 +633,11 @@ Me sale este error, no s
|
|||
"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 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: 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)
|
||||
|
|
345
swad_info.c
345
swad_info.c
|
@ -242,58 +242,60 @@ void Inf_ShowInfo (void)
|
|||
break;
|
||||
}
|
||||
|
||||
/****** Form to select syllabus *****/
|
||||
Syl_PutFormWhichSyllabus (Syllabus.WhichSyllabus);
|
||||
/***** 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);
|
||||
|
||||
switch (FromDB.Src)
|
||||
{
|
||||
case Inf_NONE:
|
||||
ShowWarningNoInfo = true;
|
||||
break;
|
||||
case Inf_EDITOR:
|
||||
switch (Gbl.Crs.Info.Type)
|
||||
{
|
||||
case Inf_LECTURES:
|
||||
case Inf_PRACTICALS:
|
||||
ShowWarningNoInfo = !Syl_CheckAndShowSyllabus (&Syllabus);
|
||||
break;
|
||||
case Inf_INTRODUCTION:
|
||||
case Inf_TEACHING_GUIDE:
|
||||
case Inf_BIBLIOGRAPHY:
|
||||
case Inf_FAQ:
|
||||
case Inf_LINKS:
|
||||
case Inf_ASSESSMENT:
|
||||
ShowWarningNoInfo = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Inf_PLAIN_TEXT:
|
||||
ShowWarningNoInfo = !Inf_CheckAndShowPlainTxt ();
|
||||
break;
|
||||
case Inf_RICH_TEXT:
|
||||
ShowWarningNoInfo = !Inf_CheckAndShowRichTxt ();
|
||||
break;
|
||||
case Inf_PAGE:
|
||||
/***** Open file with web page *****/
|
||||
ShowWarningNoInfo = !Inf_CheckAndShowPage ();
|
||||
break;
|
||||
case Inf_URL:
|
||||
/***** Check if file with URL exists *****/
|
||||
ShowWarningNoInfo = !Inf_CheckAndShowURL ();
|
||||
break;
|
||||
}
|
||||
/****** Form to select syllabus *****/
|
||||
Syl_PutFormWhichSyllabus (Syllabus.WhichSyllabus);
|
||||
|
||||
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);
|
||||
switch (FromDB.Src)
|
||||
{
|
||||
case Inf_NONE:
|
||||
ShowWarningNoInfo = true;
|
||||
break;
|
||||
case Inf_EDITOR:
|
||||
switch (Gbl.Crs.Info.Type)
|
||||
{
|
||||
case Inf_LECTURES:
|
||||
case Inf_PRACTICALS:
|
||||
ShowWarningNoInfo = !Syl_CheckAndShowSyllabus (&Syllabus);
|
||||
break;
|
||||
case Inf_INTRODUCTION:
|
||||
case Inf_TEACHING_GUIDE:
|
||||
case Inf_BIBLIOGRAPHY:
|
||||
case Inf_FAQ:
|
||||
case Inf_LINKS:
|
||||
case Inf_ASSESSMENT:
|
||||
ShowWarningNoInfo = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Inf_PLAIN_TEXT:
|
||||
ShowWarningNoInfo = !Inf_CheckAndShowPlainTxt ();
|
||||
break;
|
||||
case Inf_RICH_TEXT:
|
||||
ShowWarningNoInfo = !Inf_CheckAndShowRichTxt ();
|
||||
break;
|
||||
case Inf_PAGE:
|
||||
/***** Open file with web page *****/
|
||||
ShowWarningNoInfo = !Inf_CheckAndShowPage ();
|
||||
break;
|
||||
case Inf_URL:
|
||||
/***** Check if file with URL exists *****/
|
||||
ShowWarningNoInfo = !Inf_CheckAndShowURL ();
|
||||
break;
|
||||
}
|
||||
|
||||
if (ShowWarningNoInfo)
|
||||
Ale_ShowAlert (Ale_INFO,Txt_No_information);
|
||||
Box_BoxEnd ();
|
||||
}
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -794,38 +796,13 @@ void Inf_WriteURLIntoTxtBuffer (char TxtBuffer[Cns_MAX_BYTES_WWW + 1])
|
|||
static void Inf_ShowPage (const char *URL)
|
||||
{
|
||||
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 *****/
|
||||
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"FORM_OUT_%s BOLD\"",
|
||||
URL,The_GetSuffix ());
|
||||
Ico_PutIconTextLink ("expand-arrows-alt.svg",Ico_BLACK,
|
||||
Txt_View_in_a_new_window);
|
||||
HTM_A_End ();
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
/***** Link to view in a new window *****/
|
||||
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"FORM_OUT_%s BOLD\"",
|
||||
URL,The_GetSuffix ());
|
||||
Ico_PutIconTextLink ("expand-arrows-alt.svg",Ico_BLACK,
|
||||
Txt_View_in_a_new_window);
|
||||
HTM_A_End ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1364,19 +1341,6 @@ static bool Inf_CheckAndShowPlainTxt (void)
|
|||
{
|
||||
extern const char *Txt_INFO_TITLE[Inf_NUM_TYPES];
|
||||
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 *****/
|
||||
Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Node[Hie_CRS].HieCod,Gbl.Crs.Info.Type,
|
||||
|
@ -1384,33 +1348,22 @@ static bool Inf_CheckAndShowPlainTxt (void)
|
|||
|
||||
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 ||
|
||||
Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE)
|
||||
Lay_WriteHeaderClassPhoto (Vie_VIEW);
|
||||
|
||||
if (Gbl.Crs.Info.Type == Inf_INTRODUCTION ||
|
||||
Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE)
|
||||
Lay_WriteHeaderClassPhoto (Vie_VIEW);
|
||||
HTM_DIV_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
|
||||
HTM_DIV_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
/***** Convert to respectful HTML and insert links *****/
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
TxtHTML,Cns_MAX_BYTES_LONG_TEXT,
|
||||
Str_DONT_REMOVE_SPACES);
|
||||
ALn_InsertLinks (TxtHTML,Cns_MAX_BYTES_LONG_TEXT,60); // Insert links
|
||||
|
||||
/***** Convert to respectful HTML and insert links *****/
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
TxtHTML,Cns_MAX_BYTES_LONG_TEXT,
|
||||
Str_DONT_REMOVE_SPACES);
|
||||
ALn_InsertLinks (TxtHTML,Cns_MAX_BYTES_LONG_TEXT,60); // Insert links
|
||||
/***** Write text *****/
|
||||
HTM_Txt (TxtHTML);
|
||||
|
||||
/***** Write text *****/
|
||||
HTM_Txt (TxtHTML);
|
||||
|
||||
HTM_DIV_End ();
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
HTM_DIV_End ();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1453,19 +1406,6 @@ static bool Inf_CheckAndShowRichTxt (void)
|
|||
char MathJaxURL[PATH_MAX + 1];
|
||||
char Command[512 + PATH_MAX * 3]; // Command to call the program of preprocessing of photos
|
||||
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 *****/
|
||||
Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Node[Hie_CRS].HieCod,Gbl.Crs.Info.Type,
|
||||
|
@ -1473,96 +1413,85 @@ static bool Inf_CheckAndShowRichTxt (void)
|
|||
|
||||
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 ||
|
||||
Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE)
|
||||
Lay_WriteHeaderClassPhoto (Vie_VIEW);
|
||||
|
||||
if (Gbl.Crs.Info.Type == Inf_INTRODUCTION ||
|
||||
Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE)
|
||||
Lay_WriteHeaderClassPhoto (Vie_VIEW);
|
||||
HTM_DIV_Begin ("id=\"crs_info\" class=\"LM CRS_INFO_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
||||
HTM_DIV_Begin ("id=\"crs_info\" class=\"LM CRS_INFO_%s\"",
|
||||
The_GetSuffix ());
|
||||
/***** Store text into a temporary .md file in HTML output directory *****/
|
||||
// TODO: change to another directory?
|
||||
/* Create a unique name for the .md file */
|
||||
UniqueNameEncrypted = Cry_GetUniqueNameEncrypted ();
|
||||
snprintf (PathFileMD,sizeof (PathFileMD),"%s/%s.md",
|
||||
Cfg_PATH_OUT_PRIVATE,UniqueNameEncrypted);
|
||||
snprintf (PathFileHTML,sizeof (PathFileHTML),"%s/%s.md.html", // Do not use only .html because that is the output temporary file
|
||||
Cfg_PATH_OUT_PRIVATE,UniqueNameEncrypted);
|
||||
|
||||
/***** Store text into a temporary .md file in HTML output directory *****/
|
||||
// TODO: change to another directory?
|
||||
/* Create a unique name for the .md file */
|
||||
UniqueNameEncrypted = Cry_GetUniqueNameEncrypted ();
|
||||
snprintf (PathFileMD,sizeof (PathFileMD),"%s/%s.md",
|
||||
Cfg_PATH_OUT_PRIVATE,UniqueNameEncrypted);
|
||||
snprintf (PathFileHTML,sizeof (PathFileHTML),"%s/%s.md.html", // Do not use only .html because that is the output temporary file
|
||||
Cfg_PATH_OUT_PRIVATE,UniqueNameEncrypted);
|
||||
/* Open Markdown file for writing */
|
||||
if ((FileMD = fopen (PathFileMD,"wb")) == NULL)
|
||||
Err_ShowErrorAndExit ("Can not create temporary Markdown file.");
|
||||
|
||||
/* Open Markdown file for writing */
|
||||
if ((FileMD = fopen (PathFileMD,"wb")) == NULL)
|
||||
Err_ShowErrorAndExit ("Can not create temporary Markdown file.");
|
||||
/* Write text into Markdown file */
|
||||
fprintf (FileMD,"%s",TxtMD);
|
||||
|
||||
/* Write text into Markdown file */
|
||||
fprintf (FileMD,"%s",TxtMD);
|
||||
/* Close Markdown file */
|
||||
fclose (FileMD);
|
||||
|
||||
/* Close Markdown file */
|
||||
fclose (FileMD);
|
||||
/***** Convert from Markdown to HTML *****/
|
||||
/* MathJax 2.5.1
|
||||
#ifdef Cfg_MATHJAX_LOCAL
|
||||
// Use the local copy of MathJax
|
||||
snprintf (MathJaxURL,sizeof (MathJaxURL),
|
||||
"=%s/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML",
|
||||
Cfg_URL_SWAD_PUBLIC);
|
||||
#else
|
||||
// Use the MathJax Content Delivery Network (CDN)
|
||||
MathJaxURL[0] = '\0';
|
||||
#endif
|
||||
*/
|
||||
/* MathJax 3.0.1 */
|
||||
#ifdef Cfg_MATHJAX_LOCAL
|
||||
// Use the local copy of MathJax
|
||||
snprintf (MathJaxURL,sizeof (MathJaxURL),"=%s/mathjax/tex-chtml.js",
|
||||
Cfg_URL_SWAD_PUBLIC);
|
||||
#else
|
||||
// Use the MathJax Content Delivery Network (CDN)
|
||||
MathJaxURL[0] = '\0';
|
||||
#endif
|
||||
// --ascii uses only ascii characters in output
|
||||
// (uses numerical entities instead of UTF-8)
|
||||
// is mandatory in order to convert (with iconv) the UTF-8 output of pandoc to WINDOWS-1252
|
||||
snprintf (Command,sizeof (Command),
|
||||
"iconv -f WINDOWS-1252 -t UTF-8 %s"
|
||||
" | "
|
||||
"pandoc --ascii --mathjax%s -f markdown_github+tex_math_dollars -t html5"
|
||||
" | "
|
||||
"iconv -f UTF-8 -t WINDOWS-1252 -o %s",
|
||||
PathFileMD,
|
||||
MathJaxURL,
|
||||
PathFileHTML);
|
||||
ReturnCode = system (Command);
|
||||
if (ReturnCode == -1)
|
||||
Err_ShowErrorAndExit ("Error when running command to convert from Markdown to HTML.");
|
||||
|
||||
/***** Convert from Markdown to HTML *****/
|
||||
/* MathJax 2.5.1
|
||||
#ifdef Cfg_MATHJAX_LOCAL
|
||||
// Use the local copy of MathJax
|
||||
snprintf (MathJaxURL,sizeof (MathJaxURL),
|
||||
"=%s/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML",
|
||||
Cfg_URL_SWAD_PUBLIC);
|
||||
#else
|
||||
// Use the MathJax Content Delivery Network (CDN)
|
||||
MathJaxURL[0] = '\0';
|
||||
#endif
|
||||
*/
|
||||
/* MathJax 3.0.1 */
|
||||
#ifdef Cfg_MATHJAX_LOCAL
|
||||
// Use the local copy of MathJax
|
||||
snprintf (MathJaxURL,sizeof (MathJaxURL),"=%s/mathjax/tex-chtml.js",
|
||||
Cfg_URL_SWAD_PUBLIC);
|
||||
#else
|
||||
// Use the MathJax Content Delivery Network (CDN)
|
||||
MathJaxURL[0] = '\0';
|
||||
#endif
|
||||
// --ascii uses only ascii characters in output
|
||||
// (uses numerical entities instead of UTF-8)
|
||||
// is mandatory in order to convert (with iconv) the UTF-8 output of pandoc to WINDOWS-1252
|
||||
snprintf (Command,sizeof (Command),
|
||||
"iconv -f WINDOWS-1252 -t UTF-8 %s"
|
||||
" | "
|
||||
"pandoc --ascii --mathjax%s -f markdown_github+tex_math_dollars -t html5"
|
||||
" | "
|
||||
"iconv -f UTF-8 -t WINDOWS-1252 -o %s",
|
||||
PathFileMD,
|
||||
MathJaxURL,
|
||||
PathFileHTML);
|
||||
ReturnCode = system (Command);
|
||||
if (ReturnCode == -1)
|
||||
Err_ShowErrorAndExit ("Error when running command to convert from Markdown to HTML.");
|
||||
/***** Remove Markdown file *****/
|
||||
unlink (PathFileMD);
|
||||
|
||||
/***** Remove Markdown file *****/
|
||||
unlink (PathFileMD);
|
||||
/***** Copy HTML file just created to HTML output *****/
|
||||
/* Open temporary HTML file for reading */
|
||||
if ((FileHTML = fopen (PathFileHTML,"rb")) == NULL)
|
||||
Err_ShowErrorAndExit ("Can not open temporary HTML file.");
|
||||
|
||||
/***** Copy HTML file just created to HTML output *****/
|
||||
/* Open temporary HTML file for reading */
|
||||
if ((FileHTML = fopen (PathFileHTML,"rb")) == NULL)
|
||||
Err_ShowErrorAndExit ("Can not open temporary HTML file.");
|
||||
/* Copy from temporary HTML file to output file */
|
||||
Fil_FastCopyOfOpenFiles (FileHTML,Fil_GetOutputFile ());
|
||||
|
||||
/* Copy from temporary HTML file to output file */
|
||||
Fil_FastCopyOfOpenFiles (FileHTML,Fil_GetOutputFile ());
|
||||
/* Close and remove temporary HTML file */
|
||||
fclose (FileHTML);
|
||||
unlink (PathFileHTML);
|
||||
|
||||
/* Close and remove temporary HTML file */
|
||||
fclose (FileHTML);
|
||||
unlink (PathFileHTML);
|
||||
|
||||
HTM_DIV_End ();
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
HTM_DIV_End ();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
136
swad_syllabus.c
136
swad_syllabus.c
|
@ -258,11 +258,6 @@ bool Syl_CheckSyllabus (struct Syl_Syllabus *Syllabus,long CrsCod)
|
|||
|
||||
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 *****/
|
||||
Syl_LoadListItemsSyllabusIntoMemory (Syllabus,Gbl.Hierarchy.Node[Hie_CRS].HieCod);
|
||||
|
||||
|
@ -301,13 +296,28 @@ bool Syl_CheckAndShowSyllabus (struct Syl_Syllabus *Syllabus)
|
|||
|
||||
void Syl_EditSyllabus (void)
|
||||
{
|
||||
extern const char *Hlp_COURSE_Syllabus_edit;
|
||||
extern const char *Txt_INFO_TITLE[Inf_NUM_TYPES];
|
||||
struct Syl_Syllabus Syllabus;
|
||||
|
||||
/***** Reset syllabus context *****/
|
||||
Syl_ResetSyllabus (&Syllabus);
|
||||
|
||||
/***** Edit syllabus *****/
|
||||
Syl_CheckAndShowSyllabus (&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 *****/
|
||||
Syl_CheckAndShowSyllabus (&Syllabus);
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -483,17 +493,11 @@ int Syl_ReadLevelItemSyllabus (FILE *XML)
|
|||
|
||||
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;
|
||||
extern const char *Txt_INFO_TITLE[Inf_NUM_TYPES];
|
||||
extern const char *Txt_Done;
|
||||
unsigned NumItem;
|
||||
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] =
|
||||
{
|
||||
[Vie_VIEW] = 0,
|
||||
|
@ -514,70 +518,56 @@ static void Syl_ShowSyllabus (struct Syl_Syllabus *Syllabus)
|
|||
Gbl.Action.Act == ActModIteSylLec || Gbl.Action.Act == ActModIteSylPra ||
|
||||
Gbl.Action.Act == ActRgtIteSylLec || Gbl.Action.Act == ActRgtIteSylPra ||
|
||||
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 *****/
|
||||
HTM_TABLE_BeginWide ();
|
||||
|
||||
/***** Begin table *****/
|
||||
HTM_TABLE_BeginWide ();
|
||||
/***** Set width of columns of the table *****/
|
||||
HTM_Txt ("<colgroup>");
|
||||
for (Col = 0;
|
||||
Col < NumButtons[Syllabus->ViewType];
|
||||
Col++)
|
||||
HTM_Txt ("<col width=\"12\" />");
|
||||
for (Col = 1;
|
||||
Col <= Syl_LstItemsSyllabus.NumLevels;
|
||||
Col++)
|
||||
HTM_TxtF ("<col width=\"%d\" />",Col * Syl_WIDTH_NUM_SYLLABUS);
|
||||
HTM_Txt ("<col width=\"*\" />");
|
||||
HTM_Txt ("</colgroup>");
|
||||
|
||||
/***** Set width of columns of the table *****/
|
||||
HTM_Txt ("<colgroup>");
|
||||
for (Col = 0;
|
||||
Col < NumButtons[Syllabus->ViewType];
|
||||
Col++)
|
||||
HTM_Txt ("<col width=\"12\" />");
|
||||
for (Col = 1;
|
||||
Col <= Syl_LstItemsSyllabus.NumLevels;
|
||||
Col++)
|
||||
HTM_TxtF ("<col width=\"%d\" />",Col * Syl_WIDTH_NUM_SYLLABUS);
|
||||
HTM_Txt ("<col width=\"*\" />");
|
||||
HTM_Txt ("</colgroup>");
|
||||
if (Syl_LstItemsSyllabus.NumItems)
|
||||
/***** Loop writing all items of the syllabus *****/
|
||||
for (NumItem = 0;
|
||||
NumItem < Syl_LstItemsSyllabus.NumItems;
|
||||
NumItem++)
|
||||
{
|
||||
Syl_ShowRowSyllabus (Syllabus,NumItem,
|
||||
Syl_LstItemsSyllabus.Lst[NumItem].Level,
|
||||
Syl_LstItemsSyllabus.Lst[NumItem].CodItem,
|
||||
Syl_LstItemsSyllabus.Lst[NumItem].Text,false);
|
||||
if (ShowRowInsertNewItem && NumItem == Syllabus->NumItem)
|
||||
// Mostrar a new row where se puede insert a new item
|
||||
Syl_ShowRowSyllabus (Syllabus,NumItem + 1,
|
||||
Syl_LstItemsSyllabus.Lst[NumItem].Level,NULL,
|
||||
"",true);
|
||||
}
|
||||
else if (Syllabus->ViewType == Vie_EDIT)
|
||||
/***** If the syllabus is empty ==>
|
||||
show form to add a iten to the end *****/
|
||||
Syl_ShowRowSyllabus (Syllabus,0,
|
||||
1,Syl_LstItemsSyllabus.Lst[0].CodItem,"",true);
|
||||
|
||||
if (Syl_LstItemsSyllabus.NumItems)
|
||||
/***** Loop writing all items of the syllabus *****/
|
||||
for (NumItem = 0;
|
||||
NumItem < Syl_LstItemsSyllabus.NumItems;
|
||||
NumItem++)
|
||||
{
|
||||
Syl_ShowRowSyllabus (Syllabus,NumItem,
|
||||
Syl_LstItemsSyllabus.Lst[NumItem].Level,
|
||||
Syl_LstItemsSyllabus.Lst[NumItem].CodItem,
|
||||
Syl_LstItemsSyllabus.Lst[NumItem].Text,false);
|
||||
if (ShowRowInsertNewItem && NumItem == Syllabus->NumItem)
|
||||
// Mostrar a new row where se puede insert a new item
|
||||
Syl_ShowRowSyllabus (Syllabus,NumItem + 1,
|
||||
Syl_LstItemsSyllabus.Lst[NumItem].Level,NULL,
|
||||
"",true);
|
||||
}
|
||||
else if (Syllabus->ViewType == Vie_EDIT)
|
||||
/***** If the syllabus is empty ==>
|
||||
show form to add a iten to the end *****/
|
||||
Syl_ShowRowSyllabus (Syllabus,0,
|
||||
1,Syl_LstItemsSyllabus.Lst[0].CodItem,"",true);
|
||||
/***** End table *****/
|
||||
HTM_TABLE_End ();
|
||||
|
||||
/***** End table *****/
|
||||
HTM_TABLE_End ();
|
||||
|
||||
/***** Button to view *****/
|
||||
if (Syllabus->ViewType == Vie_EDIT)
|
||||
{
|
||||
Frm_BeginForm (Inf_Actions[Gbl.Crs.Info.Type]);
|
||||
Syl_PutParWhichSyllabus (&Syllabus->WhichSyllabus);
|
||||
Btn_PutConfirmButton (Txt_Done);
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
/***** Button to view *****/
|
||||
if (Syllabus->ViewType == Vie_EDIT)
|
||||
{
|
||||
Frm_BeginForm (Inf_Actions[Gbl.Crs.Info.Type]);
|
||||
Syl_PutParWhichSyllabus (&Syllabus->WhichSyllabus);
|
||||
Btn_PutConfirmButton (Txt_Done);
|
||||
Frm_EndForm ();
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue