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,58 +242,60 @@ void Inf_ShowInfo (void)
break; break;
} }
/****** Form to select syllabus *****/ /***** Begin box *****/
Syl_PutFormWhichSyllabus (Syllabus.WhichSyllabus); 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) /****** Form to select syllabus *****/
{ Syl_PutFormWhichSyllabus (Syllabus.WhichSyllabus);
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) switch (FromDB.Src)
{ {
Box_BoxBegin (Txt_INFO_TITLE[Gbl.Crs.Info.Type], case Inf_NONE:
ICanEdit ? Inf_PutIconToEditInfo : ShowWarningNoInfo = true;
NULL, break;
ICanEdit ? &Gbl.Crs.Info.Type : case Inf_EDITOR:
NULL, switch (Gbl.Crs.Info.Type)
Help[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE); {
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); 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) 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 *****/ /***** Link to view in a new window *****/
Box_BoxBegin (Txt_INFO_TITLE[Gbl.Crs.Info.Type], HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"FORM_OUT_%s BOLD\"",
ICanEdit ? Inf_PutIconToEditInfo : URL,The_GetSuffix ());
NULL, Ico_PutIconTextLink ("expand-arrows-alt.svg",Ico_BLACK,
ICanEdit ? &Gbl.Crs.Info.Type : Txt_View_in_a_new_window);
NULL, HTM_A_End ();
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 ();
} }
/*****************************************************************************/ /*****************************************************************************/
@ -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,33 +1348,22 @@ static bool Inf_CheckAndShowPlainTxt (void)
if (TxtHTML[0]) if (TxtHTML[0])
{ {
/***** Begin box *****/ if (Gbl.Crs.Info.Type == Inf_INTRODUCTION ||
Box_BoxBegin (Txt_INFO_TITLE[Gbl.Crs.Info.Type], Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE)
ICanEdit ? Inf_PutIconToEditInfo : Lay_WriteHeaderClassPhoto (Vie_VIEW);
NULL,
ICanEdit ? &Gbl.Crs.Info.Type :
NULL,
Help[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE);
if (Gbl.Crs.Info.Type == Inf_INTRODUCTION || HTM_DIV_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE)
Lay_WriteHeaderClassPhoto (Vie_VIEW);
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 *****/ /***** Write text *****/
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, HTM_Txt (TxtHTML);
TxtHTML,Cns_MAX_BYTES_LONG_TEXT,
Str_DONT_REMOVE_SPACES);
ALn_InsertLinks (TxtHTML,Cns_MAX_BYTES_LONG_TEXT,60); // Insert links
/***** Write text *****/ HTM_DIV_End ();
HTM_Txt (TxtHTML);
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,96 +1413,85 @@ static bool Inf_CheckAndShowRichTxt (void)
if (TxtMD[0]) if (TxtMD[0])
{ {
/***** Begin box *****/ if (Gbl.Crs.Info.Type == Inf_INTRODUCTION ||
Box_BoxBegin (Txt_INFO_TITLE[Gbl.Crs.Info.Type], Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE)
ICanEdit ? Inf_PutIconToEditInfo : Lay_WriteHeaderClassPhoto (Vie_VIEW);
NULL,
ICanEdit ? &Gbl.Crs.Info.Type :
NULL,
Help[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE);
if (Gbl.Crs.Info.Type == Inf_INTRODUCTION || HTM_DIV_Begin ("id=\"crs_info\" class=\"LM CRS_INFO_%s\"",
Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE) The_GetSuffix ());
Lay_WriteHeaderClassPhoto (Vie_VIEW);
HTM_DIV_Begin ("id=\"crs_info\" class=\"LM CRS_INFO_%s\"", /***** Store text into a temporary .md file in HTML output directory *****/
The_GetSuffix ()); // 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 *****/ /* Open Markdown file for writing */
// TODO: change to another directory? if ((FileMD = fopen (PathFileMD,"wb")) == NULL)
/* Create a unique name for the .md file */ Err_ShowErrorAndExit ("Can not create temporary Markdown 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 */ /* Write text into Markdown file */
if ((FileMD = fopen (PathFileMD,"wb")) == NULL) fprintf (FileMD,"%s",TxtMD);
Err_ShowErrorAndExit ("Can not create temporary Markdown file.");
/* Write text into Markdown file */ /* Close Markdown file */
fprintf (FileMD,"%s",TxtMD); fclose (FileMD);
/* Close Markdown file */ /***** Convert from Markdown to HTML *****/
fclose (FileMD); /* 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 *****/ /***** Remove Markdown file *****/
/* MathJax 2.5.1 unlink (PathFileMD);
#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 *****/ /***** Copy HTML file just created to HTML output *****/
unlink (PathFileMD); /* 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 *****/ /* Copy from temporary HTML file to output file */
/* Open temporary HTML file for reading */ Fil_FastCopyOfOpenFiles (FileHTML,Fil_GetOutputFile ());
if ((FileHTML = fopen (PathFileHTML,"rb")) == NULL)
Err_ShowErrorAndExit ("Can not open temporary HTML file.");
/* Copy from temporary HTML file to output file */ /* Close and remove temporary HTML file */
Fil_FastCopyOfOpenFiles (FileHTML,Fil_GetOutputFile ()); fclose (FileHTML);
unlink (PathFileHTML);
/* Close and remove temporary HTML file */ HTM_DIV_End ();
fclose (FileHTML);
unlink (PathFileHTML);
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);
/***** Edit syllabus *****/ /***** Get syllabus type *****/
Syl_CheckAndShowSyllabus (&Syllabus); 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) 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,70 +518,56 @@ 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 *****/ /***** Begin table *****/
Box_BoxBegin (Txt_INFO_TITLE[Gbl.Crs.Info.Type], HTM_TABLE_BeginWide ();
PutIconToEdit ? Inf_PutIconToEditInfo :
NULL,
PutIconToEdit ? &Gbl.Crs.Info.Type :
NULL,
*HelpLink[Syllabus->ViewType],Box_NOT_CLOSABLE);
/***** Begin table *****/ /***** Set width of columns of the table *****/
HTM_TABLE_BeginWide (); 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 *****/ if (Syl_LstItemsSyllabus.NumItems)
HTM_Txt ("<colgroup>"); /***** Loop writing all items of the syllabus *****/
for (Col = 0; for (NumItem = 0;
Col < NumButtons[Syllabus->ViewType]; NumItem < Syl_LstItemsSyllabus.NumItems;
Col++) NumItem++)
HTM_Txt ("<col width=\"12\" />"); {
for (Col = 1; Syl_ShowRowSyllabus (Syllabus,NumItem,
Col <= Syl_LstItemsSyllabus.NumLevels; Syl_LstItemsSyllabus.Lst[NumItem].Level,
Col++) Syl_LstItemsSyllabus.Lst[NumItem].CodItem,
HTM_TxtF ("<col width=\"%d\" />",Col * Syl_WIDTH_NUM_SYLLABUS); Syl_LstItemsSyllabus.Lst[NumItem].Text,false);
HTM_Txt ("<col width=\"*\" />"); if (ShowRowInsertNewItem && NumItem == Syllabus->NumItem)
HTM_Txt ("</colgroup>"); // 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) /***** End table *****/
/***** Loop writing all items of the syllabus *****/ HTM_TABLE_End ();
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 *****/ /***** Button to view *****/
HTM_TABLE_End (); if (Syllabus->ViewType == Vie_EDIT)
{
/***** Button to view *****/ Frm_BeginForm (Inf_Actions[Gbl.Crs.Info.Type]);
if (Syllabus->ViewType == Vie_EDIT) Syl_PutParWhichSyllabus (&Syllabus->WhichSyllabus);
{ Btn_PutConfirmButton (Txt_Done);
Frm_BeginForm (Inf_Actions[Gbl.Crs.Info.Type]); Frm_EndForm ();
Syl_PutParWhichSyllabus (&Syllabus->WhichSyllabus); }
Btn_PutConfirmButton (Txt_Done);
Frm_EndForm ();
}
/***** End box *****/
Box_BoxEnd ();
} }
/*****************************************************************************/ /*****************************************************************************/