diff --git a/swad_attendance.c b/swad_attendance.c
index bfae516c..26e5f3b1 100644
--- a/swad_attendance.c
+++ b/swad_attendance.c
@@ -3578,7 +3578,7 @@ static void Att_ListAttEventsForAStd (unsigned NumUsr,struct UsrData *UsrDat)
/***** Write a row for this event *****/
Tbl_StartRow ();
- Tbl_PutEmptyCells (1);
+ Tbl_PutEmptyColouredCells (1);
fprintf (Gbl.F.Out,"
"
"%u:"
" "
@@ -3610,7 +3610,7 @@ static void Att_ListAttEventsForAStd (unsigned NumUsr,struct UsrData *UsrDat)
if (ShowCommentStd || ShowCommentTch)
{
Tbl_StartRow ();
- Tbl_PutEmptyCells (2);
+ Tbl_PutEmptyColouredCells (2);
fprintf (Gbl.F.Out," "
""
"",
diff --git a/swad_banner.c b/swad_banner.c
index 5d639f1c..a173b740 100644
--- a/swad_banner.c
+++ b/swad_banner.c
@@ -866,8 +866,8 @@ static void Ban_PutFormToCreateBanner (void)
/***** Banner code *****/
Tbl_StartRow ();
fprintf (Gbl.F.Out," "
- " "
- " ");
+ " ");
+ Tbl_PutEmptyCells (1);
/***** Banner short name *****/
fprintf (Gbl.F.Out,""
diff --git a/swad_changelog.h b/swad_changelog.h
index 6cc8af8d..59a6c560 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -487,12 +487,13 @@ 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.5 (2019-10-05)"
+#define Log_PLATFORM_VERSION "SWAD 19.31.6 (2019-10-05)"
#define CSS_FILE "swad19.29.css"
#define JS_FILE "swad19.30.js"
/*
// TODO: Perico: poner un candado de bloqueo de creación/edición de proyectos (por ejemplo en asignaturas obsoletas)
+ Version 19.31.6: Oct 05, 2019 Code refactoring in HTML tables. (247066 lines)
Version 19.31.5: Oct 05, 2019 Code refactoring in HTML tables. (247044 lines)
Version 19.31.4: Oct 04, 2019 Code refactoring in HTML tables. (247043 lines)
Version 19.31.3: Oct 04, 2019 Code refactoring in HTML tables. (247039 lines)
diff --git a/swad_country.c b/swad_country.c
index b93056bf..1a64273c 100644
--- a/swad_country.c
+++ b/swad_country.c
@@ -1610,8 +1610,9 @@ static void Cty_ListCountriesForEdition (void)
{
Cty = &Gbl.Hierarchy.Sys.Ctys.Lst[NumCty];
- /* Put icon to remove country */
Tbl_StartRow ();
+
+ /* Put icon to remove country */
fprintf (Gbl.F.Out," ",
1 + Lan_NUM_LANGUAGES);
if (Cty->Inss.Num ||
@@ -1639,9 +1640,7 @@ static void Cty_ListCountriesForEdition (void)
" ",
1 + Lan_NUM_LANGUAGES,Cty->Alpha2);
- fprintf (Gbl.F.Out," "
- " "
- " ");
+ Tbl_PutEmptyCells (3);
/* Number of users */
fprintf (Gbl.F.Out,""
@@ -1654,6 +1653,7 @@ static void Cty_ListCountriesForEdition (void)
"%u"
" ",
1 + Lan_NUM_LANGUAGES,Cty->Inss.Num);
+
Tbl_EndRow ();
/* Country name in several languages */
@@ -1661,8 +1661,9 @@ static void Cty_ListCountriesForEdition (void)
Lan <= Lan_NUM_LANGUAGES;
Lan++)
{
- /* Language */
Tbl_StartRow ();
+
+ /* Language */
fprintf (Gbl.F.Out,""
"%s:"
" ",
@@ -1694,6 +1695,7 @@ static void Cty_ListCountriesForEdition (void)
Cty->WWW[Lan],Gbl.Form.Id);
Frm_EndForm ();
fprintf (Gbl.F.Out," ");
+
Tbl_EndRow ();
}
}
@@ -2048,8 +2050,9 @@ static void Cty_PutFormToCreateCountry (void)
/***** Write heading *****/
Cty_PutHeadCountriesForEdition ();
- /***** Column to remove country, disabled here *****/
Tbl_StartRow ();
+
+ /***** Column to remove country, disabled here *****/
fprintf (Gbl.F.Out," ",
1 + Lan_NUM_LANGUAGES);
@@ -2071,21 +2074,20 @@ static void Cty_PutFormToCreateCountry (void)
"",
1 + Lan_NUM_LANGUAGES,Cty_EditingCty->Alpha2);
- fprintf (Gbl.F.Out," "
- " "
- " ");
+ Tbl_PutEmptyCells (3);
- /* Number of users */
+ /***** Number of users *****/
fprintf (Gbl.F.Out,""
"0"
" ",
1 + Lan_NUM_LANGUAGES);
- /* Number of institutions */
+ /***** Number of institutions *****/
fprintf (Gbl.F.Out,""
"0"
" ",
1 + Lan_NUM_LANGUAGES);
+
Tbl_EndRow ();
/***** Country name in several languages *****/
@@ -2093,8 +2095,9 @@ static void Cty_PutFormToCreateCountry (void)
Lan <= Lan_NUM_LANGUAGES;
Lan++)
{
- /* Language */
Tbl_StartRow ();
+
+ /* Language */
fprintf (Gbl.F.Out,""
"%s"
" ",
@@ -2119,6 +2122,7 @@ static void Cty_PutFormToCreateCountry (void)
Lan_STR_LANG_ID[Lan],
Cns_MAX_CHARS_WWW,
Cty_EditingCty->WWW[Lan]);
+
Tbl_EndRow ();
}
diff --git a/swad_file_browser.c b/swad_file_browser.c
index 49a39266..2aaf0308 100644
--- a/swad_file_browser.c
+++ b/swad_file_browser.c
@@ -8534,7 +8534,7 @@ static void Brw_PutFormToCreateALink (const char *FileNameToShow)
" "
- ""
+ "",
The_ClassFormInBox[Gbl.Prefs.Theme],Txt_Save_as,Txt_optional,
Brw_MAX_CHARS_FOLDER);
Tbl_EndRow ();
diff --git a/swad_group.c b/swad_group.c
index 990659bd..888b773e 100644
--- a/swad_group.c
+++ b/swad_group.c
@@ -2275,6 +2275,7 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp,
/* Write checkbox to select the group */
ICanSelUnselGroup = (Gbl.Usrs.Me.Role.Logged >= Rol_STD);
Tbl_StartRow ();
+
fprintf (Gbl.F.Out,""
" ",
Grp_CountNumUsrsInNoGrpsOfType (Role,GrpTyp->GrpTypCod));
- /* Last void columns for max. students and vacants */
- fprintf (Gbl.F.Out," "
- " ");
+ /* Last empty columns for max. students and vacants */
+ Tbl_PutEmptyCells (2);
+
Tbl_EndRow ();
}
diff --git a/swad_holiday.c b/swad_holiday.c
index f5dbf180..5aecd561 100644
--- a/swad_holiday.c
+++ b/swad_holiday.c
@@ -992,8 +992,9 @@ static void Hld_PutFormToCreateHoliday (void)
Txt_Holiday);
Tbl_EndRow ();
- /***** Holiday place *****/
Tbl_StartRow ();
+
+ /***** Holiday place *****/
fprintf (Gbl.F.Out,""
""
" "
- " "
- " ",
+ "",
Hld_MAX_CHARS_HOLIDAY_NAME,Hld_EditingHld->Name);
+
+ Tbl_PutEmptyCells (1);
+
Tbl_EndRow ();
/***** End table, send button and end box *****/
diff --git a/swad_link.c b/swad_link.c
index df6617c7..be64b03f 100644
--- a/swad_link.c
+++ b/swad_link.c
@@ -745,10 +745,11 @@ static void Lnk_PutFormToCreateLink (void)
/***** Write heading *****/
Lnk_PutHeadLinks ();
- /***** Link code *****/
Tbl_StartRow ();
- fprintf (Gbl.F.Out," "
- " ");
+
+ /***** Link code *****/
+ fprintf (Gbl.F.Out," ");
+ Tbl_PutEmptyCells (1);
/***** Link short name *****/
fprintf (Gbl.F.Out,""
@@ -776,6 +777,7 @@ static void Lnk_PutFormToCreateLink (void)
" required=\"required\" />"
" ",
Cns_MAX_CHARS_WWW,Lnk_EditingLnk->WWW);
+
Tbl_EndRow ();
/***** End table, send button and end box *****/
diff --git a/swad_mail.c b/swad_mail.c
index f3157a1a..9d72eb33 100644
--- a/swad_mail.c
+++ b/swad_mail.c
@@ -762,8 +762,9 @@ static void Mai_PutFormToCreateMailDomain (void)
Txt_EMAIL_DOMAIN_ORDER[Mai_ORDER_BY_INFO ]);
Tbl_EndRow ();
- /***** Mail domain *****/
Tbl_StartRow ();
+
+ /***** Mail domain *****/
fprintf (Gbl.F.Out,""
" "
- " "
- " ",
+ "",
Mai_MAX_CHARS_MAIL_INFO,Mai_EditingMai->Info);
- Tbl_EndRow ();
+ Tbl_PutEmptyCells (1);
+
+ Tbl_EndRow ();
/***** End table, send button and end box *****/
Box_EndBoxTableWithButton (Btn_CREATE_BUTTON,Txt_Create_email_domain);
diff --git a/swad_mark.c b/swad_mark.c
index b02fc4f0..996d00d1 100644
--- a/swad_mark.c
+++ b/swad_mark.c
@@ -114,7 +114,7 @@ void Mrk_GetAndWriteNumRowsHeaderAndFooter (void)
struct MarksProperties Marks;
if (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER)
- Tbl_PutEmptyCells (2);
+ Tbl_PutEmptyColouredCells (2);
else // File or link
{
/***** Get number of rows in header or footer *****/
diff --git a/swad_match.c b/swad_match.c
index 5e0059d7..348559be 100644
--- a/swad_match.c
+++ b/swad_match.c
@@ -3147,7 +3147,7 @@ static void Mch_DrawBarNumUsrs (unsigned NumAnswerersAns,unsigned NumAnswerersQs
/***** Bar proportional to number of users *****/
Tbl_StartTableWide ();
- fprintf (Gbl.F.Out,"");
+ Tbl_StartClass ("MATCH_RES_TR");
for (i = 0;
i < 100;
i++)
diff --git a/swad_match_result.c b/swad_match_result.c
index ec750169..c9ae097e 100644
--- a/swad_match_result.c
+++ b/swad_match_result.c
@@ -561,7 +561,7 @@ static void McR_ShowMchResults (Usr_MeOrOther_t MeOrOther)
}
else
{
- Tbl_PutEmptyCells (8);
+ Tbl_PutEmptyColouredCells (8);
Tbl_EndRow ();
}
diff --git a/swad_survey.c b/swad_survey.c
index c3ecba21..86bded60 100644
--- a/swad_survey.c
+++ b/swad_survey.c
@@ -2720,10 +2720,12 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
Tbl_EndRow ();
/***** Answers *****/
- /* Unique or multiple choice answers */
Tbl_StartRow ();
- fprintf (Gbl.F.Out," "
- "");
+
+ Tbl_PutEmptyCells (1);
+
+ /* Unique or multiple choice answers */
+ fprintf (Gbl.F.Out," ");
Tbl_StartTablePadding (2);
for (NumAns = 0;
NumAns < Svy_MAX_ANSWERS_PER_QUESTION;
@@ -2749,6 +2751,7 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
}
Tbl_EndTable ();
fprintf (Gbl.F.Out," ");
+
Tbl_EndRow ();
/***** End table *****/
diff --git a/swad_table.c b/swad_table.c
index 411249f1..0a102013 100644
--- a/swad_table.c
+++ b/swad_table.c
@@ -161,6 +161,23 @@ void Tbl_EndTable (void)
"");
}
+void Tbl_StartClass (const char *Class)
+ {
+ if (Class)
+ {
+ if (Class[0])
+ {
+ fprintf (Gbl.F.Out,
+ " ",
+ Class);
+ }
+ else
+ Tbl_StartRow ();
+ }
+ else
+ Tbl_StartRow ();
+ }
+
void Tbl_StartRow (void)
{
fprintf (Gbl.F.Out,
@@ -174,6 +191,17 @@ void Tbl_EndRow (void)
}
void Tbl_PutEmptyCells (unsigned NumColumns)
+ {
+ unsigned NumCol;
+
+ for (NumCol = 0;
+ NumCol < NumColumns;
+ NumCol++)
+ fprintf (Gbl.F.Out,
+ " ");
+ }
+
+void Tbl_PutEmptyColouredCells (unsigned NumColumns)
{
unsigned NumCol;
diff --git a/swad_table.h b/swad_table.h
index 3839183e..e06f7245 100644
--- a/swad_table.h
+++ b/swad_table.h
@@ -55,9 +55,11 @@ void Tbl_StartTableWideMargin (void);
void Tbl_EndTable (void);
+void Tbl_StartClass (const char *Class);
void Tbl_StartRow (void);
void Tbl_EndRow (void);
void Tbl_PutEmptyCells (unsigned NumColumns);
+void Tbl_PutEmptyColouredCells (unsigned NumColumns);
#endif
diff --git a/swad_test.c b/swad_test.c
index 32276dfe..41a424b8 100644
--- a/swad_test.c
+++ b/swad_test.c
@@ -1709,7 +1709,7 @@ static void Tst_ShowFormSelTags (unsigned long NumRows,MYSQL_RES *mysql_res,
Tbl_StartTablePadding (2);
Tbl_StartRow ();
if (!ShowOnlyEnabledTags)
- fprintf (Gbl.F.Out," ");
+ Tbl_PutEmptyCells (1);
fprintf (Gbl.F.Out,""
""
" "
- " ");
+ Tbl_PutEmptyCells (2);
Tbl_EndRow ();
/***** Write answers (one row per answer) *****/
@@ -3881,7 +3880,7 @@ static void Tst_WriteChoiceAnsAssessTest (struct UsrData *UsrDat,
Ans.Class,Txt_TST_Answer_given_by_the_user,Ans.Str);
}
else // This answer has NOT been selected by the user
- fprintf (Gbl.F.Out," ");
+ Tbl_PutEmptyCells (1);
/* Draw icon that indicates whether the answer is correct */
if (Gbl.Test.Config.Feedback == Tst_FEEDBACK_EACH_GOOD_BAD ||
@@ -3891,7 +3890,7 @@ static void Tst_WriteChoiceAnsAssessTest (struct UsrData *UsrDat,
fprintf (Gbl.F.Out,"• ",
Txt_TST_Answer_given_by_the_teachers);
else
- fprintf (Gbl.F.Out," ");
+ Tbl_PutEmptyCells (1);
}
else
fprintf (Gbl.F.Out,"? ");
@@ -5229,8 +5228,8 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
/* Floating point answer */
Tbl_StartRow ();
- fprintf (Gbl.F.Out," "
- "");
+ Tbl_PutEmptyCells (1);
+ fprintf (Gbl.F.Out," ");
Tst_PutFloatInputField (Txt_Real_number_between_A_and_B_1,"AnsFloatMin",
Gbl.Test.Answer.FloatingPoint[0]);
Tst_PutFloatInputField (Txt_Real_number_between_A_and_B_2,"AnsFloatMax",
@@ -5240,8 +5239,8 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
/* T/F answer */
Tbl_StartRow ();
- fprintf (Gbl.F.Out," "
- "");
+ Tbl_PutEmptyCells (1);
+ fprintf (Gbl.F.Out," ");
Tst_PutTFInputField (Txt_TF_QST[0],'T');
Tst_PutTFInputField (Txt_TF_QST[1],'F');
fprintf (Gbl.F.Out," ");
@@ -5249,8 +5248,8 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
/* Questions can be shuffled? */
Tbl_StartRow ();
- fprintf (Gbl.F.Out," "
- ""
+ Tbl_PutEmptyCells (1);
+ fprintf (Gbl.F.Out," "
""
" "
- "");
+ Tbl_PutEmptyCells (1);
+ fprintf (Gbl.F.Out," ");
Tbl_StartTablePadding (2); // Table with choice answers
OptionsDisabled = Gbl.Test.AnswerType != Tst_ANS_UNIQUE_CHOICE &&
@@ -7890,7 +7889,7 @@ static void Tst_ShowTstResults (struct UsrData *UsrDat)
}
else
{
- Tbl_PutEmptyCells (7);
+ Tbl_PutEmptyColouredCells (7);
Tbl_EndRow ();
}