From 71cbf128f2106ee4bc7c4f10e033a090b9af30c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sat, 26 Oct 2019 22:49:13 +0200 Subject: [PATCH] Version19.45 --- css/{swad19.44.3.css => swad19.45.css} | 20 +++--- swad_HTML.c | 54 ++++++++++++++ swad_HTML.h | 3 + swad_MFU.c | 8 +-- swad_banner.c | 10 +-- swad_changelog.h | 5 +- swad_chat.c | 12 ++-- swad_course.c | 42 +++++------ swad_database.c | 6 +- swad_date.c | 11 ++- swad_enrolment.c | 76 +++++++++++--------- swad_file_browser.c | 27 ++++--- swad_forum.c | 16 ++--- swad_info.c | 4 +- swad_link.c | 10 +-- swad_menu.c | 4 +- swad_privacy.c | 12 ++-- swad_profile.c | 6 +- swad_project.c | 6 +- swad_survey.c | 97 ++++++++++++++++---------- swad_syllabus.c | 8 +-- swad_tab.c | 12 ++-- swad_test.c | 9 ++- swad_timeline.c | 27 ++++--- swad_user.c | 10 +-- 25 files changed, 293 insertions(+), 202 deletions(-) rename css/{swad19.44.3.css => swad19.45.css} (99%) diff --git a/css/swad19.44.3.css b/css/swad19.45.css similarity index 99% rename from css/swad19.44.3.css rename to css/swad19.45.css index 8247d8ed..e9bd976d 100644 --- a/css/swad19.44.3.css +++ b/css/swad19.45.css @@ -1976,18 +1976,6 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;} margin:12px; } -/********************* List of my courses ************************************/ -.MY_CRSS_LNK - { - box-sizing:border-box; - max-width:500px; - text-align:left; - vertical-align:middle; - white-space:nowrap; - overflow:hidden; - text-overflow:ellipsis; - } - /******************* Web of institution, centre, degree **********************/ .EXTERNAL_WWW_SHORT { @@ -2234,7 +2222,15 @@ a:hover img.CENTRE_PHOTO_SHOW } .LIST_TREE li { + box-sizing:border-box; + max-width:500px; height:25px; + text-align:left; + vertical-align:middle; + white-space:nowrap; + overflow:hidden; + text-overflow:ellipsis; + } } .LIST_I_MUST_READ diff --git a/swad_HTML.c b/swad_HTML.c index 4314f342..b66b8f0a 100644 --- a/swad_HTML.c +++ b/swad_HTML.c @@ -61,6 +61,7 @@ static unsigned HTM_TH_NestingLevel = 0; static unsigned HTM_TD_NestingLevel = 0; static unsigned HTM_DIV_NestingLevel = 0; static unsigned HTM_UL_NestingLevel = 0; +static unsigned HTM_LI_NestingLevel = 0; /*****************************************************************************/ /***************************** Private prototypes ****************************/ @@ -78,6 +79,7 @@ static void HTM_TD_BeginWithoutAttr (void); static void HTM_DIV_BeginWithoutAttr (void); static void HTM_UL_BeginWithoutAttr (void); +static void HTM_LI_BeginWithoutAttr (void); /*****************************************************************************/ /******************************* Start/end table *****************************/ @@ -594,3 +596,55 @@ void HTM_UL_End (void) HTM_UL_NestingLevel--; } + +/*****************************************************************************/ +/******************************** List items *********************************/ +/*****************************************************************************/ + +void HTM_LI_Begin (const char *fmt,...) + { + va_list ap; + int NumBytesPrinted; + char *Attr; + + if (fmt) + { + if (fmt[0]) + { + va_start (ap,fmt); + NumBytesPrinted = vasprintf (&Attr,fmt,ap); + va_end (ap); + + if (NumBytesPrinted < 0) // If memory allocation wasn't possible, + // or some other error occurs, + // vasprintf will return -1 + Lay_NotEnoughMemoryExit (); + + /***** Print HTML *****/ + fprintf (Gbl.F.Out,"
  • ",Attr); + + free ((void *) Attr); + } + else + HTM_LI_BeginWithoutAttr (); + } + else + HTM_LI_BeginWithoutAttr (); + + HTM_LI_NestingLevel++; + } + +static void HTM_LI_BeginWithoutAttr (void) + { + fprintf (Gbl.F.Out,"
  • "); + } + +void HTM_LI_End (void) + { + if (HTM_LI_NestingLevel == 0) // No LI open + Ale_ShowAlert (Ale_ERROR,"Trying to close unopened LI."); + + fprintf (Gbl.F.Out,"
  • "); + + HTM_LI_NestingLevel--; + } diff --git a/swad_HTML.h b/swad_HTML.h index 23dd10a2..8f7c5335 100644 --- a/swad_HTML.h +++ b/swad_HTML.h @@ -77,4 +77,7 @@ void HTM_SECTION_End (void); void HTM_UL_Begin (const char *fmt,...); void HTM_UL_End (void); +void HTM_LI_Begin (const char *fmt,...); +void HTM_LI_End (void); + #endif diff --git a/swad_MFU.c b/swad_MFU.c index e9c502e0..404d97f7 100644 --- a/swad_MFU.c +++ b/swad_MFU.c @@ -242,7 +242,7 @@ void MFU_WriteBigMFUActions (struct MFU_ListMFUActions *ListMFUActions) TabStr,MenuStr); /* Icon and text */ - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_Begin ("class=\"ICO_HIGHLIGHT\""); Frm_StartForm (Action); Frm_LinkFormSubmit (TabMenuStr,The_ClassFormInBoxNoWrap[Gbl.Prefs.Theme],NULL); fprintf (Gbl.F.Out,"\"%s\"", @@ -251,7 +251,7 @@ void MFU_WriteBigMFUActions (struct MFU_ListMFUActions *ListMFUActions) MenuStr); fprintf (Gbl.F.Out," %s",TabMenuStr); Frm_EndForm (); - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); } } @@ -305,7 +305,7 @@ void MFU_WriteSmallMFUActions (struct MFU_ListMFUActions *ListMFUActions) TabStr,MenuStr); /* Icon and text */ - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_Begin ("class=\"ICO_HIGHLIGHT\""); Frm_StartForm (Action); Frm_LinkFormSubmit (TabMenuStr,NULL,NULL); fprintf (Gbl.F.Out,"\"%s\"", @@ -314,7 +314,7 @@ void MFU_WriteSmallMFUActions (struct MFU_ListMFUActions *ListMFUActions) MenuStr); fprintf (Gbl.F.Out," %s",MenuStr); Frm_EndForm (); - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); } } HTM_UL_End (); diff --git a/swad_banner.c b/swad_banner.c index 10f62cfb..be6b5ab9 100644 --- a/swad_banner.c +++ b/swad_banner.c @@ -150,20 +150,22 @@ static void Ban_WriteListOfBanners (void) for (NumBan = 0; NumBan < Gbl.Banners.Num; NumBan++) + { /* Write data of this banner */ - fprintf (Gbl.F.Out,"
  • " - "" + HTM_LI_Begin (NULL); + fprintf (Gbl.F.Out,"" "\"%s\"" - "" - "
  • ", + "", Gbl.Banners.Lst[NumBan].WWW, Gbl.Banners.Lst[NumBan].FullName, Cfg_URL_BANNER_PUBLIC, Gbl.Banners.Lst[NumBan].Img, Gbl.Banners.Lst[NumBan].ShrtName, Gbl.Banners.Lst[NumBan].FullName); + HTM_LI_End (); + } /***** List end *****/ HTM_UL_End (); diff --git a/swad_changelog.h b/swad_changelog.h index 237c3613..0c28261e 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -487,13 +487,14 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.44.4 (2019-10-26)" -#define CSS_FILE "swad19.44.3.css" +#define Log_PLATFORM_VERSION "SWAD 19.45 (2019-10-26)" +#define CSS_FILE "swad19.45.css" #define JS_FILE "swad19.39.js" /* // TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.) // TODO: Impedir la creación y edición de proyectos si no son editables. + Version 19.45: Oct 26, 2019 Code refactoring in HTML lists. (246444 lines) Version 19.44.4: Oct 26, 2019 Fixed bug in HTML divs. (246370 lines) Version 19.44.3: Oct 26, 2019 Code refactoring in HTML lists. (246369 lines) Version 19.44.2: Oct 26, 2019 Changes in layout. (246318 lines) diff --git a/swad_chat.c b/swad_chat.c index b0b1102a..8fedbed5 100644 --- a/swad_chat.c +++ b/swad_chat.c @@ -129,16 +129,16 @@ void Cht_ShowListOfAvailableChatRooms (void) HTM_UL_Begin ("class=\"LIST_TREE\""); /***** Title of top level *****/ - fprintf (Gbl.F.Out,"
  • " - "\"%s\"" - " %s" - "
  • ", + " %s", Cfg_URL_ICON_PUBLIC, Txt_Chat_rooms, Txt_Chat_rooms, Txt_Chat_rooms); + HTM_LI_End (); /***** Link to chat available for all the users *****/ IsLastItemInLevel[1] = (!Gbl.Usrs.Me.IBelongToCurrentCrs && @@ -328,7 +328,7 @@ static void Cht_WriteLinkToChat1 (const char *RoomCode,const char *RoomShrtName, { extern const char *The_ClassFormInBox[The_NUM_THEMES]; - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_Begin (NULL); Lay_IndentDependingOnLevel (Level,IsLastItemInLevel); Frm_StartForm (ActCht); Cht_WriteParamsRoomCodeAndNames (RoomCode,RoomShrtName,RoomFullName); @@ -354,7 +354,7 @@ static void Cht_WriteLinkToChat2 (const char *RoomCode,const char *RoomFullName) fprintf (Gbl.F.Out,""); fprintf (Gbl.F.Out,""); Frm_EndForm (); - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); } /*****************************************************************************/ diff --git a/swad_course.c b/swad_course.c index 4d552221..ba88acac 100644 --- a/swad_course.c +++ b/swad_course.c @@ -587,9 +587,8 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Write link to platform *****/ Highlight = (Gbl.Hierarchy.Cty.CtyCod <= 0); - fprintf (Gbl.F.Out,"
  • ", - Highlight ? ClassHighlight : - ClassNormal); + HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight : + ClassNormal); Frm_StartForm (ActMyCrs); Cty_PutParamCtyCod (-1L); Frm_LinkFormSubmit (Txt_System, @@ -604,7 +603,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void) Txt_System, Txt_System); Frm_EndForm (); - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); /***** Get my countries *****/ NumCtys = Usr_GetCtysFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod,&mysql_resCty); @@ -623,9 +622,8 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Write link to country *****/ Highlight = (Gbl.Hierarchy.Ins.InsCod <= 0 && Gbl.Hierarchy.Cty.CtyCod == Cty.CtyCod); - fprintf (Gbl.F.Out,"
  • ", - Highlight ? ClassHighlight : - ClassNormal); + HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight : + ClassNormal); IsLastItemInLevel[1] = (NumCty == NumCtys - 1); Lay_IndentDependingOnLevel (1,IsLastItemInLevel); Frm_StartForm (ActMyCrs); @@ -644,7 +642,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void) Cty.Name[Gbl.Prefs.Language], Cty.Name[Gbl.Prefs.Language]); Frm_EndForm (); - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); /***** Get my institutions in this country *****/ NumInss = (unsigned) Usr_GetInssFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod, @@ -664,9 +662,8 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Write link to institution *****/ Highlight = (Gbl.Hierarchy.Ctr.CtrCod <= 0 && Gbl.Hierarchy.Ins.InsCod == Ins.InsCod); - fprintf (Gbl.F.Out,"
  • ", - Highlight ? ClassHighlight : - ClassNormal); + HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight : + ClassNormal); IsLastItemInLevel[2] = (NumIns == NumInss - 1); Lay_IndentDependingOnLevel (2,IsLastItemInLevel); Frm_StartForm (ActMyCrs); @@ -677,7 +674,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void) Log_DrawLogo (Hie_INS,Ins.InsCod,Ins.ShrtName,16,NULL,true); fprintf (Gbl.F.Out," %s",Ins.FullName); Frm_EndForm (); - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); /***** Get my centres in this institution *****/ NumCtrs = (unsigned) Usr_GetCtrsFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod, @@ -697,9 +694,8 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Write link to centre *****/ Highlight = (Gbl.Hierarchy.Level == Hie_CTR && Gbl.Hierarchy.Ctr.CtrCod == Ctr.CtrCod); - fprintf (Gbl.F.Out,"
  • ", - Highlight ? ClassHighlight : - ClassNormal); + HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight : + ClassNormal); IsLastItemInLevel[3] = (NumCtr == NumCtrs - 1); Lay_IndentDependingOnLevel (3,IsLastItemInLevel); Frm_StartForm (ActMyCrs); @@ -710,7 +706,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void) Log_DrawLogo (Hie_CTR,Ctr.CtrCod,Ctr.ShrtName,16,NULL,true); fprintf (Gbl.F.Out," %s",Ctr.FullName); Frm_EndForm (); - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); /***** Get my degrees in this centre *****/ NumDegs = (unsigned) Usr_GetDegsFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod, @@ -730,9 +726,8 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Write link to degree *****/ Highlight = (Gbl.Hierarchy.Level == Hie_DEG && Gbl.Hierarchy.Deg.DegCod == Deg.DegCod); - fprintf (Gbl.F.Out,"
  • ", - Highlight ? ClassHighlight : - ClassNormal); + HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight : + ClassNormal); IsLastItemInLevel[4] = (NumDeg == NumDegs - 1); Lay_IndentDependingOnLevel (4,IsLastItemInLevel); Frm_StartForm (ActMyCrs); @@ -743,7 +738,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void) Log_DrawLogo (Hie_DEG,Deg.DegCod,Deg.ShrtName,16,NULL,true); fprintf (Gbl.F.Out," %s",Deg.FullName); Frm_EndForm (); - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); /***** Get my courses in this degree *****/ NumCrss = (unsigned) Usr_GetCrssFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod, @@ -763,9 +758,8 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Write link to course *****/ Highlight = (Gbl.Hierarchy.Level == Hie_CRS && Gbl.Hierarchy.Crs.CrsCod == Crs.CrsCod); - fprintf (Gbl.F.Out,"
  • ", - Highlight ? ClassHighlight : - ClassNormal); + HTM_LI_Begin ("class=\"%s\"",Highlight ? ClassHighlight : + ClassNormal); IsLastItemInLevel[5] = (NumCrs == NumCrss - 1); Lay_IndentDependingOnLevel (5,IsLastItemInLevel); Frm_StartForm (ActMyCrs); @@ -790,7 +784,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Put link to register students *****/ Enr_PutButtonInlineToRegisterStds (Crs.CrsCod); - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); } /* Free structure that stores the query result */ diff --git a/swad_database.c b/swad_database.c index e88b29b4..f1f0d3ac 100644 --- a/swad_database.c +++ b/swad_database.c @@ -36,6 +36,7 @@ #include "swad_config.h" #include "swad_database.h" #include "swad_global.h" +#include "swad_HTML.h" #include "swad_language.h" /*****************************************************************************/ @@ -3236,7 +3237,10 @@ mysql> DESCRIBE ws_keys; static void DB_CreateTable (const char *Query) { - fprintf (Gbl.F.Out,"
  • %s
  • ",Query); + HTM_LI_Begin ("class=\"DAT\""); + fprintf (Gbl.F.Out,"%s",Query); + HTM_LI_End (); + if (mysql_query (&Gbl.mysql,Query)) DB_ExitOnMySQLError ("can not create table"); } diff --git a/swad_date.c b/swad_date.c index 490201b5..90172108 100644 --- a/swad_date.c +++ b/swad_date.c @@ -116,11 +116,10 @@ void Dat_PutBoxToSelectDateFormat (void) Format <= (Dat_Format_t) (Dat_NUM_OPTIONS_FORMAT - 1); Format++) { - fprintf (Gbl.F.Out,"
  • " - "
  • "); + fprintf (Gbl.F.Out,""); + HTM_LI_End (); } /***** End list *****/ diff --git a/swad_enrolment.c b/swad_enrolment.c index 827e4ab4..e4e429ed 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -956,55 +956,61 @@ static void Enr_PutActionsRegRemSeveralUsrs (void) /***** Register / remove users listed or not listed *****/ if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected - fprintf (Gbl.F.Out,"
  • " - "" "" - "
  • " - "
  • " - "", + (unsigned) Enr_REGISTER_SPECIFIED_USRS_IN_CRS, + (unsigned) Enr_REGISTER_SPECIFIED_USRS_IN_CRS, + (unsigned) Enr_REGISTER_SPECIFIED_USRS_IN_CRS, + Txt_Register_the_users_indicated_in_step_1); + HTM_LI_End (); + + HTM_LI_Begin (NULL); + fprintf (Gbl.F.Out,"" "" - "
  • " - "
  • " - "", + (unsigned) Enr_REMOVE_SPECIFIED_USRS_FROM_CRS, + (unsigned) Enr_REMOVE_SPECIFIED_USRS_FROM_CRS, + (unsigned) Enr_REMOVE_SPECIFIED_USRS_FROM_CRS, + Txt_Remove_the_users_indicated_in_step_1); + HTM_LI_End (); + + HTM_LI_Begin (NULL); + fprintf (Gbl.F.Out,"" "" - "
  • " - "
  • " - "", + (unsigned) Enr_REMOVE_NOT_SPECIFIED_USRS_FROM_CRS, + (unsigned) Enr_REMOVE_NOT_SPECIFIED_USRS_FROM_CRS, + (unsigned) Enr_REMOVE_NOT_SPECIFIED_USRS_FROM_CRS, + Txt_Remove_the_users_not_indicated_in_step_1); + HTM_LI_End (); + + HTM_LI_Begin (NULL); + fprintf (Gbl.F.Out,"" "" - "
  • ", - (unsigned) Enr_REGISTER_SPECIFIED_USRS_IN_CRS, - (unsigned) Enr_REGISTER_SPECIFIED_USRS_IN_CRS, - (unsigned) Enr_REGISTER_SPECIFIED_USRS_IN_CRS, - Txt_Register_the_users_indicated_in_step_1, - (unsigned) Enr_REMOVE_SPECIFIED_USRS_FROM_CRS, - (unsigned) Enr_REMOVE_SPECIFIED_USRS_FROM_CRS, - (unsigned) Enr_REMOVE_SPECIFIED_USRS_FROM_CRS, - Txt_Remove_the_users_indicated_in_step_1, - (unsigned) Enr_REMOVE_NOT_SPECIFIED_USRS_FROM_CRS, - (unsigned) Enr_REMOVE_NOT_SPECIFIED_USRS_FROM_CRS, - (unsigned) Enr_REMOVE_NOT_SPECIFIED_USRS_FROM_CRS, - Txt_Remove_the_users_not_indicated_in_step_1, + "", (unsigned) Enr_UPDATE_USRS_IN_CRS, (unsigned) Enr_UPDATE_USRS_IN_CRS, (unsigned) Enr_UPDATE_USRS_IN_CRS, Txt_Register_the_users_indicated_in_step_1_and_remove_the_users_not_indicated); + HTM_LI_End (); + } /***** Only for superusers *****/ if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) - fprintf (Gbl.F.Out,"
  • " - "" "
  • " - "" - "
  • "); + fprintf (Gbl.F.Out,""); + HTM_LI_End (); } /*****************************************************************************/ diff --git a/swad_file_browser.c b/swad_file_browser.c index 60a43205..0b4168b4 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -3263,19 +3263,18 @@ static void Brw_FormToChangeCrsGrpZone (void) HTM_UL_Begin ("class=\"LIST_LEFT\""); /***** Select the complete course, not a group *****/ - fprintf (Gbl.F.Out,"
  • " - "" - "
  • ", + "", Gbl.Form.Id, Gbl.Hierarchy.Crs.FullName); + HTM_LI_End (); /***** List my groups for unique selection *****/ if (Gbl.Crs.Grps.NumGrps) // This course has groups? @@ -3289,16 +3288,16 @@ static void Brw_FormToChangeCrsGrpZone (void) Grp_GetDataOfGroupByCod (&GrpDat); /* Select this group */ - fprintf (Gbl.F.Out,"
  • " - "\"\"" "" - "
  • ", + "", Gbl.Form.Id, GrpDat.GrpTypName,GrpDat.GrpName); + HTM_LI_End (); } /***** Free memory with the list of groups I belong to *****/ diff --git a/swad_forum.c b/swad_forum.c index 82c896ff..79322b5c 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -1764,8 +1764,8 @@ static void For_PutFormWhichForums (void) ForumSet < For_NUM_FORUM_SETS; ForumSet++) { - fprintf (Gbl.F.Out,"
  • " - "
  • ", + "", Gbl.Form.Id,Txt_FORUM_WHICH_FORUM[ForumSet]); + HTM_LI_End (); } HTM_UL_End (); HTM_DIV_End (); @@ -2046,10 +2046,8 @@ static void For_WriteLinkToForum (struct Forum *Forum, The_ClassFormInBox[Gbl.Prefs.Theme]); /***** Start row *****/ - fprintf (Gbl.F.Out,""); + HTM_LI_Begin (Highlight ? "class=\"LIGHT_BLUE\"" : + NULL); /***** Indent forum title *****/ Lay_IndentDependingOnLevel (Level,IsLastItemInLevel); @@ -2151,7 +2149,7 @@ static void For_WriteLinkToForum (struct Forum *Forum, if (Forum->Type == For_FORUM_COURSE_USRS) Enr_PutButtonInlineToRegisterStds (Forum->Location); - fprintf (Gbl.F.Out,""); + HTM_LI_End (); } /*****************************************************************************/ diff --git a/swad_info.c b/swad_info.c index a7b3dbf8..1cf9b811 100644 --- a/swad_info.c +++ b/swad_info.c @@ -609,7 +609,7 @@ void Inf_WriteMsgYouMustReadInfo (void) InfoType++) if (Gbl.Crs.Info.MustBeRead[InfoType]) { - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_Begin (NULL); Frm_StartForm (Inf_ActionsSeeInfo[InfoType]); Frm_LinkFormSubmit (Act_GetTitleAction (Inf_ActionsSeeInfo[InfoType]), The_ClassFormInBox[Gbl.Prefs.Theme],NULL); @@ -617,7 +617,7 @@ void Inf_WriteMsgYouMustReadInfo (void) "", Act_GetTitleAction (Inf_ActionsSeeInfo[InfoType])); Frm_EndForm (); - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); } HTM_UL_End (); HTM_DIV_End (); diff --git a/swad_link.c b/swad_link.c index d785df53..0a9cc5be 100644 --- a/swad_link.c +++ b/swad_link.c @@ -194,16 +194,18 @@ static void Lnk_WriteListOfLinks (void) for (NumLnk = 0; NumLnk < Gbl.Links.Num; NumLnk++) + { /* Write data of this link */ - fprintf (Gbl.F.Out,"
  • " - "" "%s" - "" - "
  • ", + "", Gbl.Links.Lst[NumLnk].WWW, Gbl.Links.Lst[NumLnk].FullName, Gbl.Links.Lst[NumLnk].ShrtName); + HTM_LI_End (); + } /***** List end *****/ HTM_UL_End (); diff --git a/swad_menu.c b/swad_menu.c index 1265d369..baaf21d0 100644 --- a/swad_menu.c +++ b/swad_menu.c @@ -357,7 +357,7 @@ void Mnu_WriteMenuThisTab (void) Title = Act_GetSubtitleAction (NumAct); /***** Start element *****/ - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_Begin ("class=\"MENU_LIST_ITEM\""); /***** Start container used to highlight this option *****/ HTM_DIV_Begin ("class=\"%s\"", @@ -387,7 +387,7 @@ void Mnu_WriteMenuThisTab (void) HTM_DIV_End (); /***** End element *****/ - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); } } diff --git a/swad_privacy.c b/swad_privacy.c index fa51a614..7aaf0731 100644 --- a/swad_privacy.c +++ b/swad_privacy.c @@ -172,11 +172,11 @@ static void Pri_PutFormVisibility (const char *TxtLabel, Visibility++) if (MaskAllowedVisibility & (1 << Visibility)) { - fprintf (Gbl.F.Out,"
  • " - "
  • ", + "", Txt_PRIVACY_OPTIONS[Visibility]); + HTM_LI_End (); } /***** End list and form *****/ diff --git a/swad_profile.c b/swad_profile.c index 8b876ae8..daa5d171 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -780,15 +780,15 @@ static void Prf_ShowNumMessagesSent (const struct UsrData *UsrDat, static void Prf_StartListItem (const char *Title,const char *Icon) { - fprintf (Gbl.F.Out,"
  • ", + HTM_LI_Begin ("title=\"%s\" class=\"PRF_FIG_LI\"" + " style=\"background-image:url('%s/%s');\"", Title, Cfg_URL_ICON_PUBLIC,Icon); } static void Prf_EndListItem (void) { - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); } /*****************************************************************************/ diff --git a/swad_project.c b/swad_project.c index d0adc9c1..43bb422f 100644 --- a/swad_project.c +++ b/swad_project.c @@ -2037,10 +2037,12 @@ static void Prj_ShowTableAllProjectsMembersWithARole (const struct Project *Prj, if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) { /* Write user's name in "Surname1 Surname2, FirstName" format */ - fprintf (Gbl.F.Out,"
  • %s",Gbl.Usrs.Other.UsrDat.Surname1); + HTM_LI_Begin (NULL); + fprintf (Gbl.F.Out,"%s",Gbl.Usrs.Other.UsrDat.Surname1); if (Gbl.Usrs.Other.UsrDat.Surname2[0]) fprintf (Gbl.F.Out," %s",Gbl.Usrs.Other.UsrDat.Surname2); - fprintf (Gbl.F.Out,", %s
  • ",Gbl.Usrs.Other.UsrDat.FirstName); + fprintf (Gbl.F.Out,", %s",Gbl.Usrs.Other.UsrDat.FirstName); + HTM_LI_End (); } } diff --git a/swad_survey.c b/swad_survey.c index 96570c21..1dec1055 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -731,59 +731,84 @@ static void Svy_WriteStatus (struct Survey *Svy) /* Write whether survey is visible or hidden */ if (Svy->Status.Visible) - fprintf (Gbl.F.Out,"
  • %s
  • ", - Txt_Visible_survey); + { + HTM_LI_Begin ("class=\"STATUS_GREEN\""); + fprintf (Gbl.F.Out,"%s",Txt_Visible_survey); + } else - fprintf (Gbl.F.Out,"
  • %s
  • ", - Txt_Hidden_survey); + { + HTM_LI_Begin ("class=\"STATUS_RED_LIGHT\""); + fprintf (Gbl.F.Out,"%s",Txt_Hidden_survey); + } + HTM_LI_End (); /* Write whether survey is open or closed */ if (Svy->Status.Open) - fprintf (Gbl.F.Out,"
  • %s
  • ", - Svy->Status.Visible ? "STATUS_GREEN" : - "STATUS_GREEN_LIGHT", - Txt_Open_survey); + { + HTM_LI_Begin ("class=\"%s\"", + Svy->Status.Visible ? "STATUS_GREEN" : + "STATUS_GREEN_LIGHT"); + fprintf (Gbl.F.Out,"%s",Txt_Open_survey); + } else - fprintf (Gbl.F.Out,"
  • %s
  • ", - Svy->Status.Visible ? "STATUS_RED" : - "STATUS_RED_LIGHT", - Txt_Closed_survey); + { + HTM_LI_Begin ("class=\"%s\"", + Svy->Status.Visible ? "STATUS_RED" : + "STATUS_RED_LIGHT"); + fprintf (Gbl.F.Out,"%s",Txt_Closed_survey); + } + HTM_LI_End (); /* Write whether survey can be answered by me or not depending on user type */ if (Svy->Status.IAmLoggedWithAValidRoleToAnswer) - fprintf (Gbl.F.Out,"
  • %s
  • ", - Svy->Status.Visible ? "STATUS_GREEN" : - "STATUS_GREEN_LIGHT", - Txt_SURVEY_Type_of_user_allowed); + { + HTM_LI_Begin ("class=\"%s\"", + Svy->Status.Visible ? "STATUS_GREEN" : + "STATUS_GREEN_LIGHT"); + fprintf (Gbl.F.Out,"%s",Txt_SURVEY_Type_of_user_allowed); + } else - fprintf (Gbl.F.Out,"
  • %s
  • ", - Svy->Status.Visible ? "STATUS_RED" : - "STATUS_RED_LIGHT", - Txt_SURVEY_Type_of_user_not_allowed); + { + HTM_LI_Begin ("class=\"%s\"", + Svy->Status.Visible ? "STATUS_RED" : + "STATUS_RED_LIGHT"); + fprintf (Gbl.F.Out,"%s",Txt_SURVEY_Type_of_user_not_allowed); + } + HTM_LI_End (); /* Write whether survey can be answered by me or not depending on groups */ if (Svy->Status.IBelongToScope) - fprintf (Gbl.F.Out,"
  • %s
  • ", - Svy->Status.Visible ? "STATUS_GREEN" : - "STATUS_GREEN_LIGHT", - Txt_SURVEY_You_belong_to_the_scope_of_the_survey); + { + HTM_LI_Begin ("class=\"%s\"", + Svy->Status.Visible ? "STATUS_GREEN" : + "STATUS_GREEN_LIGHT"); + fprintf (Gbl.F.Out,"%s",Txt_SURVEY_You_belong_to_the_scope_of_the_survey); + } else - fprintf (Gbl.F.Out,"
  • %s
  • ", - Svy->Status.Visible ? "STATUS_RED" : - "STATUS_RED_LIGHT", - Txt_SURVEY_You_dont_belong_to_the_scope_of_the_survey); + { + HTM_LI_Begin ("class=\"%s\"", + Svy->Status.Visible ? "STATUS_RED" : + "STATUS_RED_LIGHT"); + fprintf (Gbl.F.Out,"%s",Txt_SURVEY_You_dont_belong_to_the_scope_of_the_survey); + } + HTM_LI_End (); /* Write whether survey has been already answered by me or not */ if (Svy->Status.IHaveAnswered) - fprintf (Gbl.F.Out,"
  • %s
  • ", - Svy->Status.Visible ? "STATUS_GREEN" : - "STATUS_GREEN_LIGHT", - Txt_SURVEY_You_have_already_answered); + { + HTM_LI_Begin ("class=\"%s\"", + Svy->Status.Visible ? "STATUS_GREEN" : + "STATUS_GREEN_LIGHT"); + fprintf (Gbl.F.Out,"%s",Txt_SURVEY_You_have_already_answered); + } else - fprintf (Gbl.F.Out,"
  • %s
  • ", - Svy->Status.Visible ? "STATUS_RED" : - "STATUS_RED_LIGHT", - Txt_SURVEY_You_have_not_answered); + { + HTM_LI_Begin ("class=\"%s\"", + Svy->Status.Visible ? "STATUS_RED" : + "STATUS_RED_LIGHT"); + fprintf (Gbl.F.Out,"%s",Txt_SURVEY_You_have_not_answered); + } + HTM_LI_End (); /***** End list with items of status *****/ HTM_UL_End (); diff --git a/swad_syllabus.c b/swad_syllabus.c index 97dbe797..906e6eef 100644 --- a/swad_syllabus.c +++ b/swad_syllabus.c @@ -148,17 +148,17 @@ void Syl_PutFormWhichSyllabus (void) WhichSyllabus < For_NUM_FORUM_SETS; WhichSyllabus++) { - fprintf (Gbl.F.Out,"
  • " - "
  • ", + "", Gbl.Form.Id,Txt_SYLLABUS_WHICH_SYLLABUS[WhichSyllabus]); + HTM_LI_End (); } HTM_UL_End (); HTM_DIV_End (); diff --git a/swad_tab.c b/swad_tab.c index fb46220c..3a40558c 100644 --- a/swad_tab.c +++ b/swad_tab.c @@ -120,11 +120,11 @@ void Tab_DrawTabs (void) if (ICanViewTab) // Don't show the first hidden tabs { /* Form, icon (at top) and text (at bottom) of the tab */ - fprintf (Gbl.F.Out,"
  • ", - NumTab == Gbl.Action.Tab ? "TAB_ON" : - "TAB_OFF", - NumTab == Gbl.Action.Tab ? The_TabOnBgColors[Gbl.Prefs.Theme] : - The_TabOffBgColors[Gbl.Prefs.Theme]); + HTM_LI_Begin ("class=\"%s %s\"", + NumTab == Gbl.Action.Tab ? "TAB_ON" : + "TAB_OFF", + NumTab == Gbl.Action.Tab ? The_TabOnBgColors[Gbl.Prefs.Theme] : + The_TabOffBgColors[Gbl.Prefs.Theme]); if (NumTab == Gbl.Action.Tab) HTM_DIV_Begin (NULL); // This div must be present even in current tab in order to render properly the tab @@ -151,7 +151,7 @@ void Tab_DrawTabs (void) Frm_EndForm (); HTM_DIV_End (); - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); } } diff --git a/swad_test.c b/swad_test.c index 721397ff..476d21da 100644 --- a/swad_test.c +++ b/swad_test.c @@ -912,8 +912,9 @@ void Tst_ShowTagList (unsigned NumTags,MYSQL_RES *mysql_res) NumTag++) { row = mysql_fetch_row (mysql_res); - fprintf (Gbl.F.Out,"
  • %s
  • ", - row[0]); + HTM_LI_Begin (NULL); + fprintf (Gbl.F.Out,"%s",row[0]); + HTM_LI_End (); } HTM_UL_End (); } @@ -4779,7 +4780,9 @@ void Tst_GetAndWriteTagsQst (long QstCod) NumRow++) { row = mysql_fetch_row (mysql_res); - fprintf (Gbl.F.Out,"
  • %s
  • ",row[0]); + HTM_LI_Begin (NULL); + fprintf (Gbl.F.Out,"%s",row[0]); + HTM_LI_End (); } HTM_UL_End (); } diff --git a/swad_timeline.c b/swad_timeline.c index e3c3b4b9..1d0c98b7 100644 --- a/swad_timeline.c +++ b/swad_timeline.c @@ -1478,12 +1478,11 @@ static void TL_WriteNote (const struct TL_Note *SocNot, } /***** Start list item *****/ - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_Begin ("class=\"%s\"", + ShowNoteAlone ? (Highlight ? "TL_WIDTH TL_NEW_PUB" : + "TL_WIDTH") : + (Highlight ? "TL_WIDTH TL_SEP TL_NEW_PUB" : + "TL_WIDTH TL_SEP")); if (SocNot->NotCod <= 0 || SocNot->NoteType == TL_NOTE_UNKNOWN || @@ -1684,7 +1683,7 @@ static void TL_WriteNote (const struct TL_Note *SocNot, } /***** End list item *****/ - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); /***** End box ****/ if (ShowNoteAlone) @@ -2318,7 +2317,7 @@ static void TL_PutFormToWriteNewPost (void) /***** Start list *****/ HTM_UL_Begin ("class=\"TL_LIST\""); - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_Begin ("class=\"TL_WIDTH\""); /***** Left: write author's photo (my photo) *****/ HTM_DIV_Begin ("class=\"TL_LEFT_PHOTO\""); @@ -2356,7 +2355,7 @@ static void TL_PutFormToWriteNewPost (void) HTM_DIV_End (); /***** End list *****/ - fprintf (Gbl.F.Out,"
  • "); + HTM_LI_End (); HTM_UL_End (); } @@ -2746,10 +2745,10 @@ static void TL_WriteComment (struct TL_Comment *SocCom, } /***** Start list item *****/ - fprintf (Gbl.F.Out,""); + if (ShowCommentAlone) + HTM_LI_Begin (NULL); + else + HTM_LI_Begin ("class=\"TL_COM\""); if (SocCom->PubCod <= 0 || SocCom->NotCod <= 0 || @@ -2815,7 +2814,7 @@ static void TL_WriteComment (struct TL_Comment *SocCom, } /***** End list item *****/ - fprintf (Gbl.F.Out,""); + HTM_LI_End (); if (ShowCommentAlone) { diff --git a/swad_user.c b/swad_user.c index 06ca7f9e..64d4e4df 100644 --- a/swad_user.c +++ b/swad_user.c @@ -8363,8 +8363,9 @@ static void Usr_PutOptionsListUsrs (const bool ICanChooseOption[Usr_LIST_USRS_NU static void Usr_ShowOneListUsrsOption (Usr_ListUsrsOption_t ListUsrsAction, const char *Label) { - fprintf (Gbl.F.Out,"
  • " - "" "" - "
  • ", + "", (unsigned) ListUsrsAction, Label); + + HTM_LI_End (); } /*****************************************************************************/