diff --git a/swad_ID.c b/swad_ID.c
index a1445fb17..0e9441ad2 100644
--- a/swad_ID.c
+++ b/swad_ID.c
@@ -529,10 +529,10 @@ void ID_ShowFormOthIDs (void)
Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,&Gbl.Usrs.Other.UsrDat);
/***** Form with the user's ID *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_StartTableWide (2);
ID_ShowFormChangeUsrID (&Gbl.Usrs.Other.UsrDat,
(Gbl.Usrs.Other.UsrDat.UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)); // It's me?
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** End frame *****/
Lay_EndRoundFrame ();
diff --git a/swad_centre.c b/swad_centre.c
index d8612506c..0e3432823 100644
--- a/swad_centre.c
+++ b/swad_centre.c
@@ -381,7 +381,7 @@ static void Ctr_Configuration (bool PrintView)
}
/***** Start table *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
/***** Institution *****/
fprintf (Gbl.F.Out,""
@@ -659,7 +659,7 @@ static void Ctr_Configuration (bool PrintView)
}
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** End frame *****/
Lay_EndRoundFrame ();
@@ -1413,7 +1413,7 @@ static void Ctr_ListCentresForEdition (void)
Usr_UsrDataConstructor (&UsrDat);
/***** Write heading *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
Ctr_PutHeadCentresForEdition ();
/***** Write all the centres *****/
@@ -1606,7 +1606,7 @@ static void Ctr_ListCentresForEdition (void)
}
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** Free memory used for user's data *****/
Usr_UsrDataDestructor (&UsrDat);
diff --git a/swad_changelog.h b/swad_changelog.h
index 805ee5e4b..74b1da8e3 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -223,13 +223,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 16.198.4 (2017-04-30)"
+#define Log_PLATFORM_VERSION "SWAD 16.198.5 (2017-05-01)"
#define CSS_FILE "swad16.195.8.css"
#define JS_FILE "swad16.181.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/*
+ Version 16.198.5: May 01, 2017 Code refactoring related to tables. (218302 lines)
Version 16.198.4: Apr 30, 2017 Code refactoring related to contextual icons to remove. (218294 lines)
Version 16.198.3: Apr 30, 2017 Code refactoring related to contextual icons to hide and unhide. (218320 lines)
Version 16.198.2: Apr 30, 2017 Changes in layout of edition of places. (218341 lines)
diff --git a/swad_country.c b/swad_country.c
index ff68f01ea..32929cebb 100644
--- a/swad_country.c
+++ b/swad_country.c
@@ -300,7 +300,7 @@ static void Cty_Configuration (bool PrintView)
}
/***** Start table *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
/***** Country name (an link to WWW if exists) *****/
fprintf (Gbl.F.Out,""
@@ -470,7 +470,7 @@ static void Cty_Configuration (bool PrintView)
}
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** End frame *****/
Lay_EndRoundFrame ();
@@ -1533,7 +1533,7 @@ static void Cty_ListCountriesForEdition (void)
Txt_Language_t Lan;
/***** Write heading *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
Cty_PutHeadCountriesForEdition ();
/***** Write all the countries *****/
@@ -1632,7 +1632,7 @@ static void Cty_ListCountriesForEdition (void)
}
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
}
/*****************************************************************************/
diff --git a/swad_course.c b/swad_course.c
index aa640a5fe..b405497a3 100644
--- a/swad_course.c
+++ b/swad_course.c
@@ -216,7 +216,7 @@ static void Crs_Configuration (bool PrintView)
Gbl.CurrentCrs.Crs.FullName);
/***** Start table *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
/***** Degree *****/
fprintf (Gbl.F.Out,""
@@ -480,7 +480,7 @@ static void Crs_Configuration (bool PrintView)
}
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** End frame *****/
Lay_EndRoundFrame ();
@@ -1359,7 +1359,7 @@ static void Crs_ListCoursesForEdition (void)
unsigned Year;
/***** Write heading *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
Crs_PutHeadCoursesForEdition ();
/***** List the courses *****/
@@ -1370,7 +1370,7 @@ static void Crs_ListCoursesForEdition (void)
Crs_ListCoursesOfAYearForEdition (0);
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
}
/*****************************************************************************/
diff --git a/swad_degree.c b/swad_degree.c
index bd6f3a32f..fd97239cf 100644
--- a/swad_degree.c
+++ b/swad_degree.c
@@ -315,7 +315,7 @@ static void Deg_Configuration (bool PrintView)
fprintf (Gbl.F.Out,"");
/***** Start table *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
/***** Centre *****/
fprintf (Gbl.F.Out,""
@@ -540,7 +540,7 @@ static void Deg_Configuration (bool PrintView)
}
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** End frame *****/
Lay_EndRoundFrame ();
@@ -674,7 +674,7 @@ static void Deg_ListDegreesForEdition (void)
Usr_UsrDataConstructor (&UsrDat);
/***** Write heading *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
Deg_PutHeadDegreesForEdition ();
/***** List the degrees *****/
@@ -852,7 +852,7 @@ static void Deg_ListDegreesForEdition (void)
}
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** Free memory used for user's data *****/
Usr_UsrDataDestructor (&UsrDat);
diff --git a/swad_degree_type.c b/swad_degree_type.c
index ab2315b5b..d2dcfb096 100644
--- a/swad_degree_type.c
+++ b/swad_degree_type.c
@@ -357,7 +357,7 @@ static void DT_ListDegreeTypesForEdition (void)
unsigned NumDegTyp;
/***** Write heading *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
DT_PutHeadDegreeTypesForEdition ();
/***** List degree types with forms for edition *****/
@@ -407,7 +407,7 @@ static void DT_ListDegreeTypesForEdition (void)
}
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
}
/*****************************************************************************/
diff --git a/swad_forum.c b/swad_forum.c
index 4fbdad600..5152cfe08 100644
--- a/swad_forum.c
+++ b/swad_forum.c
@@ -1065,7 +1065,7 @@ static void For_ShowPostsOfAThread (Lay_AlertType_t AlertType,const char *Messag
&PaginationPsts);
/***** Start table *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
/***** Show posts from this page, the author and the date of last reply *****/
mysql_data_seek (mysql_res,(my_ulonglong) (PaginationPsts.FirstItemVisible - 1));
@@ -1117,7 +1117,7 @@ static void For_ShowPostsOfAThread (Lay_AlertType_t AlertType,const char *Messag
}
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** Write again links to pages *****/
if (PaginationPsts.MoreThanOnePage)
diff --git a/swad_group.c b/swad_group.c
index 5ff192de0..1d80eac81 100644
--- a/swad_group.c
+++ b/swad_group.c
@@ -378,13 +378,13 @@ void Grp_ShowFormToSelectSeveralGroups (Act_Action_t NextAction)
Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS);
/***** List the groups for each group type *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
for (NumGrpTyp = 0;
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
NumGrpTyp++)
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps)
Grp_ListGrpsForMultipleSelection (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]);
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** Free list of groups types and groups in this course *****/
Grp_FreeListGrpTypesAndGrps ();
@@ -1196,7 +1196,7 @@ static void Grp_ListGroupTypesForEdition (void)
char Id[32];
/***** Write heading *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
Grp_WriteHeadingGroupTypes ();
/***** List group types with forms for edition *****/
@@ -1313,7 +1313,7 @@ static void Grp_ListGroupTypesForEdition (void)
}
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
}
/*****************************************************************************/
@@ -1401,7 +1401,7 @@ static void Grp_ListGroupsForEdition (void)
struct Group *Grp;
/***** Write heading *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
Grp_WriteHeadingGroups ();
/***** List the groups *****/
@@ -1521,7 +1521,7 @@ static void Grp_ListGroupsForEdition (void)
}
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
}
/*****************************************************************************/
@@ -1681,13 +1681,13 @@ void Grp_ShowLstGrpsToChgMyGrps (bool ShowWarningsToStudents)
Act_FormStart (ActChgGrp);
/***** List the groups the user belongs to for change *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
for (NumGrpTyp = 0;
NumGrpTyp < Gbl.CurrentCrs.Grps.GrpTypes.Num;
NumGrpTyp++)
if (Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) // If there are groups of this type
NumGrpsIBelong += Grp_ListGrpsForChange (&Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]);
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** End form *****/
if (PutFormToChangeGrps)
diff --git a/swad_indicator.c b/swad_indicator.c
index d506b8fe2..3cc377f77 100644
--- a/swad_indicator.c
+++ b/swad_indicator.c
@@ -108,9 +108,9 @@ void Ind_ReqIndicatorsCourses (void)
Hlp_STATS_Indicators);
/***** Form to update indicators *****/
- /* Start form */
+ /* Start form and table */
Act_FormStart (ActReqStaCrs);
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
/* Scope */
fprintf (Gbl.F.Out,""
@@ -171,8 +171,7 @@ void Ind_ReqIndicatorsCourses (void)
fprintf (Gbl.F.Out,""
"
");
- /* End form */
- fprintf (Gbl.F.Out,"
");
+ /* End form and form */
Act_FormEnd ();
/***** Show the stats of courses *****/
diff --git a/swad_institution.c b/swad_institution.c
index 63aa276a1..d9766cf72 100644
--- a/swad_institution.c
+++ b/swad_institution.c
@@ -325,7 +325,7 @@ static void Ins_Configuration (bool PrintView)
fprintf (Gbl.F.Out,"");
/***** Start table *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
/***** Country *****/
fprintf (Gbl.F.Out,""
@@ -614,7 +614,7 @@ static void Ins_Configuration (bool PrintView)
}
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** End frame *****/
Lay_EndRoundFrame ();
@@ -1408,7 +1408,7 @@ static void Ins_ListInstitutionsForEdition (void)
Usr_UsrDataConstructor (&UsrDat);
/***** Write heading *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
Ins_PutHeadInstitutionsForEdition ();
/***** Write all the institutions *****/
@@ -1573,7 +1573,7 @@ static void Ins_ListInstitutionsForEdition (void)
}
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** Free memory used for user's data *****/
Usr_UsrDataDestructor (&UsrDat);
diff --git a/swad_layout.c b/swad_layout.c
index 998516a4c..ba11e3dcc 100644
--- a/swad_layout.c
+++ b/swad_layout.c
@@ -1445,27 +1445,19 @@ void Lay_PutRemoveButtonInline (const char *TxtButton)
void Lay_StartRoundFrameTable (const char *Width,const char *Title,
void (*FunctionToDrawContextualIcons) (void),
const char *HelpLink,
- unsigned CellPadding)
+ unsigned CellPadding) // CellPadding must be 0, 1, 2, 5 or 10
{
Lay_StartRoundFrame (Width,Title,FunctionToDrawContextualIcons,HelpLink);
-
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (CellPadding);
}
void Lay_StartRoundFrameTableShadow (const char *Width,const char *Title,
void (*FunctionToDrawContextualIcons) (void),
const char *HelpLink,
- unsigned CellPadding)
+ unsigned CellPadding) // CellPadding must be 0, 1, 2, 5 or 10
{
Lay_StartRoundFrameShadow (Width,Title,FunctionToDrawContextualIcons,HelpLink);
-
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (CellPadding);
}
void Lay_StartRoundFrame (const char *Width,const char *Title,
@@ -1536,15 +1528,13 @@ static void Lay_StartRoundFrameInternal (const char *Width,const char *Title,
void Lay_EndRoundFrameTable (void)
{
- fprintf (Gbl.F.Out,"
");
-
+ Lay_EndTable ();
Lay_EndRoundFrame ();
}
void Lay_EndRoundFrameTableWithButton (Lay_Button_t Button,const char *TxtButton)
{
- fprintf (Gbl.F.Out,"
");
-
+ Lay_EndTable ();
Lay_EndRoundFrameWithButton (Button,TxtButton);
}
@@ -1562,6 +1552,19 @@ void Lay_EndRoundFrame (void)
"");
}
+void Lay_StartTableWide (unsigned CellPadding)
+ {
+ fprintf (Gbl.F.Out,"");
+ }
+
+void Lay_EndTable (void)
+ {
+ fprintf (Gbl.F.Out,"
");
+ }
+
/*****************************************************************************/
/******* Write error message, close files, remove lock file, and exit ********/
/*****************************************************************************/
diff --git a/swad_layout.h b/swad_layout.h
index d433cb8bc..33f594429 100644
--- a/swad_layout.h
+++ b/swad_layout.h
@@ -122,6 +122,8 @@ void Lay_EndRoundFrameTable (void);
void Lay_EndRoundFrameTableWithButton (Lay_Button_t Button,const char *TxtButton);
void Lay_EndRoundFrameWithButton (Lay_Button_t Button,const char *TxtButton);
void Lay_EndRoundFrame (void);
+void Lay_StartTableWide (unsigned CellPadding);
+void Lay_EndTable (void);
void Lay_ShowErrorAndExit (const char *Message);
void Lay_ShowAlert (Lay_AlertType_t AlertType,const char *Message);
diff --git a/swad_place.c b/swad_place.c
index 3809dc63b..998c43113 100644
--- a/swad_place.c
+++ b/swad_place.c
@@ -461,7 +461,7 @@ static void Plc_ListPlacesForEdition (void)
struct Place *Plc;
/***** Write heading *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
Plc_PutHeadPlaces ();
/***** Write all the places *****/
@@ -523,7 +523,8 @@ static void Plc_ListPlacesForEdition (void)
Plc->NumCtrs);
}
- Lay_EndRoundFrameTable ();
+ /***** End table *****/
+ Lay_EndTable ();
}
/*****************************************************************************/
diff --git a/swad_record.c b/swad_record.c
index 174424215..aef39430c 100644
--- a/swad_record.c
+++ b/swad_record.c
@@ -2231,10 +2231,10 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
/***** Show email and user's ID *****/
if (ShowIDRows)
{
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
Rec_ShowEmail (UsrDat,ClassForm);
Rec_ShowUsrIDs (UsrDat,ClassForm);
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
}
/***** Start form *****/
@@ -2259,7 +2259,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
break;
}
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
if (ShowIDRows)
{
@@ -2318,7 +2318,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
Rec_ShowOfficePhone (UsrDat,ShowData,ClassForm);
}
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** Button and end form *****/
switch (TypeOfView)
diff --git a/swad_survey.c b/swad_survey.c
index 452c59e38..4a1bd498b 100644
--- a/swad_survey.c
+++ b/swad_survey.c
@@ -438,7 +438,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,
/***** Start table *****/
if (ShowOnlyThisSvyComplete)
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
/***** Start date/time *****/
UniqueId++;
@@ -657,7 +657,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst,
if (ShowOnlyThisSvyComplete)
{
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** End frame *****/
Lay_EndRoundFrame ();
@@ -2649,7 +2649,7 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
Svy_PutParamQstCod (SvyQst->QstCod);
/***** Start table *****/
- fprintf (Gbl.F.Out,"");
+ Lay_StartTableWide (2);
/***** Stem *****/
fprintf (Gbl.F.Out,""
@@ -2727,7 +2727,7 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
"
");
/***** End table *****/
- fprintf (Gbl.F.Out,"
");
+ Lay_EndTable ();
/***** Send button *****/
if (SvyQst->QstCod > 0) // If the question already has assigned a code