diff --git a/swad_changelog.h b/swad_changelog.h
index 61febfaf..5834e58b 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -487,7 +487,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
-#define Log_PLATFORM_VERSION "SWAD 19.31.37 (2019-10-10)"
+#define Log_PLATFORM_VERSION "SWAD 19.31.38 (2019-10-10)"
#define CSS_FILE "swad19.29.css"
#define JS_FILE "swad19.30.js"
/*
@@ -496,6 +496,7 @@ ps2pdf source.ps destination.pdf
// TODO: En un TFG no preasignado con estudiante tiene que salir un triángulo amarillo
// TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.)
+ Version 19.31.38: Oct 10, 2019 Code refactoring in HTML tables. (246657 lines)
Version 19.31.37: Oct 10, 2019 Code refactoring in HTML tables. (246626 lines)
Version 19.31.36: Oct 10, 2019 Code refactoring in HTML tables. (246620 lines)
Version 19.31.35: Oct 10, 2019 Code refactoring in HTML tables. (246629 lines)
diff --git a/swad_test.c b/swad_test.c
index 6f23395e..0599b17a 100644
--- a/swad_test.c
+++ b/swad_test.c
@@ -4512,28 +4512,29 @@ static void Tst_WriteIntAnsAssessTest (struct UsrData *UsrDat,
Tbl_StartRow ();
/***** Write the user answer *****/
- fprintf (Gbl.F.Out,"
"
- "%ld",
+ {
+ Tbl_StartCellAttr ("class=\"%s CENTER_MIDDLE\"",
(Gbl.Test.Config.Feedback == Tst_FEEDBACK_EACH_GOOD_BAD ||
Gbl.Test.Config.Feedback == Tst_FEEDBACK_FULL_FEEDBACK) ?
(IntAnswerUsr == IntAnswerCorr ? "ANS_OK" :
"ANS_BAD") :
- "ANS_0",
- IntAnswerUsr);
+ "ANS_0");
+ fprintf (Gbl.F.Out,"%ld",IntAnswerUsr);
+ Tbl_EndCell ();
+ }
else
{
Gbl.Test.StrAnswersOneQst[NumQst][0] = '\0';
- fprintf (Gbl.F.Out," class=\"ANS_0 CENTER_MIDDLE\">"
- "?");
+ Tbl_StartCellAttr ("class=\"ANS_0 CENTER_MIDDLE\"");
+ fprintf (Gbl.F.Out,"?");
+ Tbl_EndCell ();
}
}
else // If user has omitted the answer
- fprintf (Gbl.F.Out,">");
- Tbl_EndCell ();
+ Tbl_PutEmptyCells (1);
/***** Write the correct answer *****/
Tbl_StartCellAttr ("class=\"ANS_0 CENTER_MIDDLE\"");
diff --git a/swad_timetable.c b/swad_timetable.c
index 88d5ae05..95b62073 100644
--- a/swad_timetable.c
+++ b/swad_timetable.c
@@ -1135,7 +1135,7 @@ static void TT_DrawTimeTable (void)
Tbl_StartRow ();
Tbl_StartCellAttr ("rowspan=\"2\" class=\"TT_HOUR_BIG RIGHT_MIDDLE\""
- " style=\"width:%u%%;\">",
+ " style=\"width:%u%%;\"",
TT_PERCENT_WIDTH_OF_AN_HOUR_COLUMN);
fprintf (Gbl.F.Out,"%02u:00",Gbl.TimeTable.Config.Range.Hours.Start);
Tbl_EndCell ();
@@ -1145,7 +1145,7 @@ static void TT_DrawTimeTable (void)
TT_DrawCellAlignTimeTable ();
Tbl_StartCellAttr ("rowspan=\"2\" class=\"TT_HOUR_BIG LEFT_MIDDLE\""
- " style=\"width:%u%%;\">",
+ " style=\"width:%u%%;\"",
TT_PERCENT_WIDTH_OF_AN_HOUR_COLUMN);
fprintf (Gbl.F.Out,"%02u:00",Gbl.TimeTable.Config.Range.Hours.Start);
Tbl_EndCell ();
@@ -1452,6 +1452,9 @@ static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Co
unsigned Dur;
unsigned MaxDuration;
unsigned RowSpan = 0;
+ char *RowSpanStr;
+ char *ColSpanStr;
+ char *ClassStr;
TT_ClassType_t CT;
struct Course Crs;
struct GroupType *GrpTyp;
@@ -1486,17 +1489,45 @@ static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Co
}
/***** Cell start *****/
- fprintf (Gbl.F.Out," | 1)
- fprintf (Gbl.F.Out," rowspan=\"%u\"",RowSpan);
- if (ColSpan > 1)
- fprintf (Gbl.F.Out," colspan=\"%u\"",ColSpan);
- fprintf (Gbl.F.Out," class=\"%s",TimeTableClasses[ClassType]);
- if (ClassType == TT_FREE)
- fprintf (Gbl.F.Out,"%u",Interval % 4);
+ {
+ if (asprintf (&RowSpanStr,"%s","") < 0)
+ Lay_NotEnoughMemoryExit ();
+ }
else
- fprintf (Gbl.F.Out," CENTER_MIDDLE DAT_SMALL");
- fprintf (Gbl.F.Out,"\">");
+ {
+ if (asprintf (&RowSpanStr,"rowspan=\"%u\" ",RowSpan) < 0)
+ Lay_NotEnoughMemoryExit ();
+ }
+ if (ColSpan > 1)
+ {
+ if (asprintf (&ColSpanStr,"%s","") < 0)
+ Lay_NotEnoughMemoryExit ();
+ }
+ else
+ {
+ if (asprintf (&ColSpanStr,"colspan=\"%u\" ",ColSpan) < 0)
+ Lay_NotEnoughMemoryExit ();
+ }
+ if (ClassType == TT_FREE)
+ {
+ if (asprintf (&ClassStr,"%s%u",TimeTableClasses[ClassType],Interval % 4) < 0)
+ Lay_NotEnoughMemoryExit ();
+ }
+ else
+ {
+ if (asprintf (&ClassStr,"%s CENTER_MIDDLE DAT_SMALL",TimeTableClasses[ClassType]) < 0)
+ Lay_NotEnoughMemoryExit ();
+ }
+
+ /* Start cell */
+ Tbl_StartCellAttr ("%s%sclass=\"%s\"",RowSpanStr,ColSpanStr,ClassStr);
+
+ /* Free allocated memory for rowspan, colspan and class strings */
+ free ((void *) RowSpanStr);
+ free ((void *) ColSpanStr);
+ free ((void *) ClassStr);
/***** Form to modify this cell *****/
if (Gbl.TimeTable.View == TT_CRS_EDIT)
|