diff --git a/swad_attendance.c b/swad_attendance.c index 0f8e2fbb4..64c36cb44 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -3519,7 +3519,7 @@ static void Att_ListAttEventsForAStd (unsigned NumUsr,struct UsrData *UsrDat) /***** Write user's ID ******/ Tbl_TD_Begin ("class=\"LEFT_MIDDLE COLOR%u\"",Gbl.RowEvenOdd); - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); Tbl_TR_Begin (NULL); Tbl_TD_Begin ("class=\"%s LEFT_MIDDLE\"", diff --git a/swad_changelog.h b/swad_changelog.h index 7fb56a7a7..f73d44ee1 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.33.7 (2019-10-13)" +#define Log_PLATFORM_VERSION "SWAD 19.33.8 (2019-10-13)" #define CSS_FILE "swad19.33.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.33.8: Oct 13, 2019 Fixed bug in tables. (245339 lines) Version 19.33.7: Oct 13, 2019 Fixed bug in surveys. (245317 lines) Version 19.33.6: Oct 13, 2019 Fixed bug in exam announcements. (245299 lines) Version 19.33.5: Oct 13, 2019 Fixed bug in file browser. (245298 lines) diff --git a/swad_date.c b/swad_date.c index 4b4005745..b9af96465 100644 --- a/swad_date.c +++ b/swad_date.c @@ -557,7 +557,7 @@ void Dat_WriteFormClientLocalDateTimeFromTimeUTC (const char *Id, /***** Start table *****/ - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); Tbl_TR_Begin (NULL); /***** Year *****/ @@ -824,7 +824,7 @@ void Dat_WriteFormDate (unsigned FirstYear,unsigned LastYear, unsigned NumDaysSelectedMonth; /***** Start table *****/ - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); Tbl_TR_Begin (NULL); /***** Year *****/ diff --git a/swad_degree.c b/swad_degree.c index d16cac002..6d2e88580 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -2510,8 +2510,8 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan) Tbl_TD_End (); /***** Write institution, centre, degree *****/ - Tbl_TD_Begin ("colspan=\"%u\" class=\"DAT_SMALL_NOBR LEFT_TOP COLOR%u\">", - ColSpan - 1,Gbl.RowEvenOdd); + Tbl_TD_Begin ("colspan=\"%u\" class=\"DAT_SMALL_NOBR LEFT_TOP COLOR%u\"", + ColSpan - 1,Gbl.RowEvenOdd); /* Get next institution, centre, degree */ row = mysql_fetch_row (mysql_res); diff --git a/swad_file_browser.c b/swad_file_browser.c index 0066c0909..3232a4f7d 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -5596,7 +5596,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId, /* Start column */ Tbl_TD_Begin ("class=\"NO_BR LEFT_TOP COLOR%u\" style=\"width:99%%;\"",Gbl.RowEvenOdd); - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); Tbl_TR_Begin (NULL); /* Indent depending on level */ @@ -5824,7 +5824,7 @@ static void Brw_IndentAndWriteIconExpandContract (unsigned Level, Brw_IconTree_t IconThisRow) { Tbl_TD_Begin ("class=\"LEFT_MIDDLE\""); - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); Tbl_TR_Begin (NULL); Brw_IndentDependingOnLevel (Level); @@ -8512,7 +8512,7 @@ static void Brw_PutFormToCreateALink (const char *FileNameToShow) FileNameToShow); /***** URL *****/ - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); Tbl_TR_Begin (NULL); Tbl_TD_Begin ("class=\"RIGHT_MIDDLE\""); diff --git a/swad_follow.c b/swad_follow.c index 0f4f0db12..d6fbe1983 100644 --- a/swad_follow.c +++ b/swad_follow.c @@ -217,7 +217,7 @@ void Fol_SuggestUsrsToFollowMainZoneOnRightColumn (void) Frm_EndForm (); /***** Start table *****/ - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); /***** Initialize structure with user's data *****/ Usr_UsrDataConstructor (&UsrDat); diff --git a/swad_layout.c b/swad_layout.c index 47adc5eeb..8066f13e6 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -1616,11 +1616,11 @@ void Lay_WriteHeaderClassPhoto (bool PrintView,bool DrawingClassPhoto, Crs_GetDataOfCourseByCod (&Crs); /***** Start table *****/ - fprintf (Gbl.F.Out,""); // TODO: Change inline style to class + Tbl_TABLE_BeginWidePadding (10); Tbl_TR_Begin (NULL); /***** First column: institution logo *****/ - Tbl_TD_Begin ("class=\"LEFT_TOP\" style=\"width:80px;\""); + Tbl_TD_Begin ("class=\"LEFT_TOP\" style=\"width:60px;\""); if (InsCod > 0) { if (!PrintView) @@ -1668,7 +1668,7 @@ void Lay_WriteHeaderClassPhoto (bool PrintView,bool DrawingClassPhoto, Tbl_TD_End (); /***** Third column: degree logo *****/ - Tbl_TD_Begin ("class=\"RIGHT_TOP\" style=\"width:80px;\""); + Tbl_TD_Begin ("class=\"RIGHT_TOP\" style=\"width:60px;\""); if (DegCod > 0) { if (!PrintView) diff --git a/swad_message.c b/swad_message.c index 3780eb2e0..cc742ca63 100644 --- a/swad_message.c +++ b/swad_message.c @@ -3363,7 +3363,7 @@ static void Msg_WriteMsgFrom (struct UsrData *UsrDat,bool Deleted) bool ShowPhoto; char PhotoURL[PATH_MAX + 1]; - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); Tbl_TR_Begin (NULL); /***** Put an icon to show if user has read the message *****/ @@ -3492,7 +3492,7 @@ static void Msg_WriteMsgTo (long MsgCod) if (NumRecipientsTotal) { /***** Start table *****/ - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); /***** How many recipients will be shown? *****/ if (NumRecipientsKnown <= Msg_MAX_RECIPIENTS_TO_SHOW) diff --git a/swad_profile.c b/swad_profile.c index 242e99cf0..3d08a860f 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -1538,7 +1538,7 @@ void Prf_ShowRankingFigure (MYSQL_RES **mysql_res,unsigned NumUsrs) /***** Initialize structure with user's data *****/ Usr_UsrDataConstructor (&UsrDat); - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); for (NumUsr = 1, Rank = 1, Gbl.RowEvenOdd = 0; NumUsr <= NumUsrs; @@ -1707,7 +1707,7 @@ void Prf_GetAndShowRankingClicksPerDay (void) /***** Initialize structure with user's data *****/ Usr_UsrDataConstructor (&UsrDat); - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); for (NumUsr = 1, Rank = 1, Gbl.RowEvenOdd = 0; NumUsr <= NumUsrs; diff --git a/swad_statistic.c b/swad_statistic.c index b9dd89594..5557b97d1 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -383,7 +383,7 @@ void Sta_AskShowCrsHits (void) Tbl_TD_End (); Tbl_TD_Begin ("colspan=\"2\" class=\"%s LEFT_TOP\"",The_ClassFormInBox[Gbl.Prefs.Theme]); - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); Usr_ListUsersToSelect (Rol_TCH); Usr_ListUsersToSelect (Rol_NET); Usr_ListUsersToSelect (Rol_STD); diff --git a/swad_table.c b/swad_table.c index d61043471..99e37b302 100644 --- a/swad_table.c +++ b/swad_table.c @@ -55,6 +55,7 @@ extern struct Globals Gbl; /***************************** Private vatiables *****************************/ /*****************************************************************************/ +static unsigned Tbl_TABLE_NestingLevel = 0; static unsigned Tbl_TR_NestingLevel = 0; static unsigned Tbl_TH_NestingLevel = 0; static unsigned Tbl_TD_NestingLevel = 0; @@ -63,10 +64,13 @@ static unsigned Tbl_TD_NestingLevel = 0; /***************************** Private prototypes ****************************/ /*****************************************************************************/ -static void Tbl_TR_BeginWithoutAttr (void); -static void Tbl_TH_BeginWithoutAttr (void); +static void Tbl_TABLE_BeginWithoutAttr (void); +static void Tbl_TR_BeginWithoutAttr (void); + +static void Tbl_TH_BeginWithoutAttr (void); static void Tbl_TH_BeginAttr (const char *fmt,...); + static void Tbl_TD_BeginWithoutAttr (void); /*****************************************************************************/ @@ -95,6 +99,8 @@ void Tbl_TABLE_Begin (const char *fmt,...) /***** Print HTML *****/ fprintf (Gbl.F.Out,"
",Class); + Tbl_TABLE_NestingLevel++; + free ((void *) Class); } else @@ -107,22 +113,32 @@ void Tbl_TABLE_Begin (const char *fmt,...) void Tbl_TABLE_BeginPadding (unsigned CellPadding) { if (CellPadding) + { fprintf (Gbl.F.Out,"
", CellPadding); // CellPadding must be 0, 1, 2, 5 or 10 + + Tbl_TABLE_NestingLevel++; + } else Tbl_TABLE_BeginWithoutAttr (); } -void Tbl_TABLE_BeginWithoutAttr (void) +static void Tbl_TABLE_BeginWithoutAttr (void) { fprintf (Gbl.F.Out,"
"); + + Tbl_TABLE_NestingLevel++; } void Tbl_TABLE_BeginCenterPadding (unsigned CellPadding) { if (CellPadding) + { fprintf (Gbl.F.Out,"
", CellPadding); // CellPadding must be 0, 1, 2, 5 or 10 + + Tbl_TABLE_NestingLevel++; + } else Tbl_TABLE_BeginCenter (); } @@ -130,13 +146,19 @@ void Tbl_TABLE_BeginCenterPadding (unsigned CellPadding) void Tbl_TABLE_BeginCenter (void) { fprintf (Gbl.F.Out,"
"); + + Tbl_TABLE_NestingLevel++; } void Tbl_TABLE_BeginWidePadding (unsigned CellPadding) { if (CellPadding) + { fprintf (Gbl.F.Out,"
", CellPadding); // CellPadding must be 0, 1, 2, 5 or 10 + + Tbl_TABLE_NestingLevel++; + } else Tbl_TABLE_BeginWide (); } @@ -144,13 +166,19 @@ void Tbl_TABLE_BeginWidePadding (unsigned CellPadding) void Tbl_TABLE_BeginWide (void) { fprintf (Gbl.F.Out,"
"); + + Tbl_TABLE_NestingLevel++; } void Tbl_TABLE_BeginWideMarginPadding (unsigned CellPadding) { if (CellPadding) + { fprintf (Gbl.F.Out,"
", CellPadding); // CellPadding must be 0, 1, 2, 5 or 10 + + Tbl_TABLE_NestingLevel++; + } else Tbl_TABLE_BeginWideMargin (); } @@ -158,11 +186,18 @@ void Tbl_TABLE_BeginWideMarginPadding (unsigned CellPadding) void Tbl_TABLE_BeginWideMargin (void) { fprintf (Gbl.F.Out,"
"); + + Tbl_TABLE_NestingLevel++; } void Tbl_TABLE_End (void) { + if (Tbl_TABLE_NestingLevel == 0) // No TABLE open + Ale_ShowAlert (Ale_ERROR,"Trying to close unopened TABLE."); + fprintf (Gbl.F.Out,"
"); + + Tbl_TABLE_NestingLevel--; } /*****************************************************************************/ @@ -210,7 +245,7 @@ static void Tbl_TR_BeginWithoutAttr (void) void Tbl_TR_End (void) { if (Tbl_TR_NestingLevel == 0) // No TR open - Lay_ShowErrorAndExit ("Trying to close unopened TR."); + Ale_ShowAlert (Ale_ERROR,"Trying to close unopened TR."); fprintf (Gbl.F.Out,""); @@ -310,7 +345,7 @@ static void Tbl_TH_BeginWithoutAttr (void) void Tbl_TH_End (void) { if (Tbl_TH_NestingLevel == 0) // No TH open - Lay_ShowErrorAndExit ("Trying to close unopened TR."); + Ale_ShowAlert (Ale_ERROR,"Trying to close unopened TR."); fprintf (Gbl.F.Out,""); @@ -375,7 +410,7 @@ static void Tbl_TD_BeginWithoutAttr (void) void Tbl_TD_End (void) { if (Tbl_TD_NestingLevel == 0) // No TH open - Lay_ShowErrorAndExit ("Trying to close unopened TR."); + Ale_ShowAlert (Ale_ERROR,"Trying to close unopened TR."); fprintf (Gbl.F.Out,""); diff --git a/swad_table.h b/swad_table.h index c4727fc2c..93ebe230b 100644 --- a/swad_table.h +++ b/swad_table.h @@ -41,7 +41,6 @@ void Tbl_TABLE_Begin (const char *fmt,...); void Tbl_TABLE_BeginPadding (unsigned CellPadding); -void Tbl_TABLE_BeginWithoutAttr (void); void Tbl_TABLE_BeginCenterPadding (unsigned CellPadding); void Tbl_TABLE_BeginCenter (void); void Tbl_TABLE_BeginWidePadding (unsigned CellPadding); diff --git a/swad_test_import.c b/swad_test_import.c index 1a7d3da01..d3eadb274 100644 --- a/swad_test_import.c +++ b/swad_test_import.c @@ -1031,7 +1031,7 @@ static void TsI_WriteRowImportedQst (struct XMLElement *StemElem, if (Gbl.Test.Tags.Num) { /***** Write the tags *****/ - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); for (NumTag = 0; NumTag < Gbl.Test.Tags.Num; NumTag++) @@ -1099,7 +1099,7 @@ static void TsI_WriteRowImportedQst (struct XMLElement *StemElem, case Tst_ANS_UNIQUE_CHOICE: case Tst_ANS_MULTIPLE_CHOICE: case Tst_ANS_TEXT: - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); for (NumOpt = 0; NumOpt < Gbl.Test.Answer.NumOptions; NumOpt++) diff --git a/swad_timetable.c b/swad_timetable.c index f48ac7439..4e4b4e443 100644 --- a/swad_timetable.c +++ b/swad_timetable.c @@ -1126,7 +1126,7 @@ static void TT_DrawTimeTable (void) unsigned ContinuousFreeMinicolumns; /***** Start table *****/ - fprintf (Gbl.F.Out,""); + Tbl_TABLE_Begin ("id=\"timetable\""); /***** Top row used for column adjustement *****/ TT_TimeTableDrawAdjustRow (); diff --git a/swad_user.c b/swad_user.c index ba672e3fc..b68b46ef4 100644 --- a/swad_user.c +++ b/swad_user.c @@ -7374,7 +7374,7 @@ void Usr_ListDataAdms (void) fprintf (Gbl.F.Out,""); /***** Heading row with column names *****/ - Tbl_TABLE_BeginWithoutAttr (); + Tbl_TABLE_Begin (NULL); Tbl_TR_Begin (NULL); for (NumCol = 0;