diff --git a/swad_HTML.c b/swad_HTML.c
index 5f5d0999..7cc2a046 100644
--- a/swad_HTML.c
+++ b/swad_HTML.c
@@ -709,15 +709,13 @@ void HTM_A_End (void)
/*****************************************************************************/
void HTM_IMG (const char *URL,const char *Icon,const char *Title,
- const char *Class,const char *Style,const char *Id)
+ const char *fmt,...)
{
- fprintf (Gbl.F.Out,"");
}
diff --git a/swad_HTML.h b/swad_HTML.h
index 12ca02cc..5f677784 100644
--- a/swad_HTML.h
+++ b/swad_HTML.h
@@ -84,6 +84,6 @@ void HTM_A_Begin (const char *fmt,...);
void HTM_A_End (void);
void HTM_IMG (const char *URL,const char *Icon,const char *Title,
- const char *Class,const char *Style,const char *Id);
+ const char *fmt,...);
#endif
diff --git a/swad_MFU.c b/swad_MFU.c
index f09ab17f..e066adc4 100644
--- a/swad_MFU.c
+++ b/swad_MFU.c
@@ -246,7 +246,7 @@ void MFU_WriteBigMFUActions (struct MFU_ListMFUActions *ListMFUActions)
Frm_StartForm (Action);
Frm_LinkFormSubmit (TabMenuStr,The_ClassFormInBoxNoWrap[Gbl.Prefs.Theme],NULL);
HTM_IMG (Gbl.Prefs.URLIconSet,Act_GetIcon (Action),MenuStr,
- NULL,NULL,NULL);
+ NULL);
fprintf (Gbl.F.Out," %s",TabMenuStr);
Frm_LinkFormEnd ();
Frm_EndForm ();
@@ -307,7 +307,7 @@ void MFU_WriteSmallMFUActions (struct MFU_ListMFUActions *ListMFUActions)
Frm_StartForm (Action);
Frm_LinkFormSubmit (TabMenuStr,NULL,NULL);
HTM_IMG (Gbl.Prefs.URLIconSet,Act_GetIcon (Action),MenuStr,
- NULL,NULL,NULL);
+ NULL);
fprintf (Gbl.F.Out," %s",MenuStr);
Frm_LinkFormEnd ();
Frm_EndForm ();
diff --git a/swad_banner.c b/swad_banner.c
index 508a5ce6..6fdfd5c8 100644
--- a/swad_banner.c
+++ b/swad_banner.c
@@ -157,7 +157,7 @@ static void Ban_WriteListOfBanners (void)
Gbl.Banners.Lst[NumBan].WWW,
Gbl.Banners.Lst[NumBan].FullName);
HTM_IMG (Cfg_URL_BANNER_PUBLIC,Gbl.Banners.Lst[NumBan].Img,Gbl.Banners.Lst[NumBan].FullName,
- "BANNER",NULL,NULL);
+ "class=\"BANNER\"");
HTM_A_End ();
HTM_LI_End ();
}
@@ -1048,7 +1048,7 @@ void Ban_WriteMenuWithBanners (void)
Par_PutHiddenParamString ("URL",Gbl.Banners.Lst[NumBan].WWW);
Frm_LinkFormSubmit (Gbl.Banners.Lst[NumBan].FullName,"BANNER",NULL);
HTM_IMG (Cfg_URL_BANNER_PUBLIC,Gbl.Banners.Lst[NumBan].Img,Gbl.Banners.Lst[NumBan].FullName,
- "BANNER",NULL,NULL);
+ "class=\"BANNER\"");
Frm_LinkFormEnd ();
Frm_EndForm ();
HTM_DIV_End ();
diff --git a/swad_centre.c b/swad_centre.c
index 1b4f1f19..d87e0b6f 100644
--- a/swad_centre.c
+++ b/swad_centre.c
@@ -25,8 +25,10 @@
/********************************* Headers ***********************************/
/*****************************************************************************/
+#define _GNU_SOURCE // For asprintf
#include // For NULL
#include // For boolean type
+#include // For asprintf
#include // For calloc
#include // For string functions
#include // For the macro WEXITSTATUS
@@ -309,8 +311,8 @@ static void Ctr_Configuration (bool PrintView)
bool PhotoExists;
char *PhotoAttribution = NULL;
bool PutLink;
- char URL[Cns_MAX_BYTES_WWW + 1];
- char Icon[NAME_MAX + 1];
+ char *URL;
+ char *Icon;
/***** Trivial check *****/
if (Gbl.Hierarchy.Ctr.CtrCod <= 0) // No centre selected
@@ -359,18 +361,19 @@ static void Ctr_Configuration (bool PrintView)
if (PutLink)
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT_N\"",
Gbl.Hierarchy.Ctr.WWW);
- snprintf (URL,sizeof (URL),
- "%s/%02u/%u",
- Cfg_URL_CTR_PUBLIC,
- (unsigned) (Gbl.Hierarchy.Ctr.CtrCod % 100),
- (unsigned) Gbl.Hierarchy.Ctr.CtrCod);
- snprintf (Icon,sizeof (Icon),
- "%u.jpg",
- (unsigned) Gbl.Hierarchy.Ctr.CtrCod);
+ if (asprintf (&URL,"%s/%02u/%u",
+ Cfg_URL_CTR_PUBLIC,
+ (unsigned) (Gbl.Hierarchy.Ctr.CtrCod % 100),
+ (unsigned) Gbl.Hierarchy.Ctr.CtrCod) < 0)
+ Lay_NotEnoughMemoryExit ();
+ if (asprintf (&Icon,"%u.jpg",
+ (unsigned) Gbl.Hierarchy.Ctr.CtrCod) < 0)
+ Lay_NotEnoughMemoryExit ();
HTM_IMG (URL,Icon,Gbl.Hierarchy.Ctr.FullName,
- PrintView ? "CENTRE_PHOTO_PRINT" :
- "CENTRE_PHOTO_SHOW",
- NULL,NULL);
+ "class=\"%s\"",PrintView ? "CENTRE_PHOTO_PRINT" :
+ "CENTRE_PHOTO_SHOW");
+ free ((void *) Icon);
+ free ((void *) URL);
if (PutLink)
HTM_A_End ();
HTM_DIV_End ();
diff --git a/swad_changelog.h b/swad_changelog.h
index 84792a0a..072b2ee8 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.46.6 (2019-10-29)"
+#define Log_PLATFORM_VERSION "SWAD 19.46.8 (2019-10-29)"
#define CSS_FILE "swad19.45.css"
#define JS_FILE "swad19.39.js"
/*
@@ -495,6 +495,8 @@ ps2pdf source.ps destination.pdf
// TODO: Impedir la creación y edición de proyectos si no son editables.
// TODO: Continuar convirtiendo Alpha2,
- Cty->Alpha2);
+ {
+ if (asprintf (&URL,"%s/%s",
+ Cfg_URL_ICON_COUNTRIES_PUBLIC,
+ Cty->Alpha2) < 0)
+ Lay_NotEnoughMemoryExit ();
+ if (asprintf (&Icon,"%s.png",
+ Cty->Alpha2) < 0)
+ Lay_NotEnoughMemoryExit ();
+ HTM_IMG (URL,Icon,Cty->Name[Gbl.Prefs.Language],
+ "class=\"%s\"",Class);
+ free ((void *) Icon);
+ free ((void *) URL);
+ }
else
- fprintf (Gbl.F.Out,"%s/tr16x16.gif", // TODO: Change for a 1x1 image or a generic image
- Cfg_URL_ICON_PUBLIC);
- fprintf (Gbl.F.Out,"\" alt=\"%s\" title=\"%s\" class=\"%s\" />",
- Cty->Alpha2,
- Cty->Name[Gbl.Prefs.Language],
- Class);
+ Ico_PutIcon ("tr16x16.gif",Cty->Name[Gbl.Prefs.Language],Class);
}
/*****************************************************************************/
diff --git a/swad_course.c b/swad_course.c
index 5742ca31..f3448d89 100644
--- a/swad_course.c
+++ b/swad_course.c
@@ -624,15 +624,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
Frm_LinkFormSubmit (Act_GetActionTextFromDB (Act_GetActCod (ActSeeCtyInf),ActTxt),
Highlight ? ClassHighlight :
ClassNormal,NULL);
- /* Country map */
- fprintf (Gbl.F.Out,");",
- Cfg_URL_ICON_COUNTRIES_PUBLIC,
- Cty.Alpha2,
- Cty.Alpha2,
- Cty.Alpha2,
- Cty.Name[Gbl.Prefs.Language]);
+ Cty_DrawCountryMap (&Cty,"ICO16x16");
fprintf (Gbl.F.Out," %s",Cty.Name[Gbl.Prefs.Language]);
Frm_LinkFormEnd ();
Frm_EndForm ();
@@ -2940,7 +2932,7 @@ void Crs_PutIconToSelectMyCoursesInBreadcrumb (void)
/***** Put icon with link *****/
Frm_LinkFormSubmit (Txt_My_courses,NULL,NULL);
HTM_IMG (Gbl.Prefs.URLTheme,"sitemap.svg",Txt_My_courses,
- "BC_ICON ICO_HIGHLIGHT",NULL,NULL);
+ "class=\"BC_ICON ICO_HIGHLIGHT\"");
Frm_LinkFormEnd ();
/***** End form *****/
diff --git a/swad_figure.c b/swad_figure.c
index 5735c7db..5cc037c9 100644
--- a/swad_figure.c
+++ b/swad_figure.c
@@ -4026,6 +4026,7 @@ static void Fig_WriteForumTitleAndStats (For_ForumType_t ForumType,
float NumThrsPerForum;
float NumPostsPerThread;
float NumPostsPerForum;
+ char *ForumName;
/***** Compute number of forums, number of threads and number of posts *****/
NumForums = For_GetNumTotalForumsOfType (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod);
@@ -4050,12 +4051,11 @@ static void Fig_WriteForumTitleAndStats (For_ForumType_t ForumType,
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"BT\"");
- fprintf (Gbl.F.Out,"",
- Cfg_URL_ICON_PUBLIC,Icon,
- ForumName1,ForumName2,
- ForumName1,ForumName2);
+ if (asprintf (&ForumName,"%s%s",
+ ForumName1,ForumName2) < 0)
+ Lay_NotEnoughMemoryExit ();
+ Ico_PutIcon (Icon,ForumName,"ICO16x16");
+ free ((void *) ForumName);
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT LT\"");
@@ -4907,6 +4907,8 @@ static void Fig_GetAndShowNumUsrsPerFirstDayOfWeek (void)
extern const char *Txt_PERCENT_of_users;
unsigned FirstDayOfWeek;
char *SubQuery;
+ char *Icon;
+ char *Title;
unsigned NumUsrs[7]; // 7: seven days in a week
unsigned NumUsrsTotal = 0;
@@ -4949,12 +4951,15 @@ static void Fig_GetAndShowNumUsrsPerFirstDayOfWeek (void)
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"CM\"");
- fprintf (Gbl.F.Out,"",
- Cfg_URL_ICON_PUBLIC,FirstDayOfWeek,
- Txt_DAYS_SMALL[FirstDayOfWeek],
- Txt_First_day_of_the_week,Txt_DAYS_SMALL[FirstDayOfWeek]);
+ if (asprintf (&Icon,"first-day-of-week-%u.png",
+ FirstDayOfWeek) < 0)
+ Lay_NotEnoughMemoryExit ();
+ if (asprintf (&Title,"%s: %s",
+ Txt_First_day_of_the_week,Txt_DAYS_SMALL[FirstDayOfWeek]) < 0)
+ Lay_NotEnoughMemoryExit ();
+ Ico_PutIcon (Icon,Title,"ICO40x40");
+ free ((void *) Title);
+ free ((void *) Icon);
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM\"");
@@ -5065,6 +5070,7 @@ static void Fig_GetAndShowNumUsrsPerIconSet (void)
extern const char *Txt_PERCENT_of_users;
Ico_IconSet_t IconSet;
char *SubQuery;
+ char *URL;
unsigned NumUsrs[Ico_NUM_ICON_SETS];
unsigned NumUsrsTotal = 0;
@@ -5105,13 +5111,12 @@ static void Fig_GetAndShowNumUsrsPerIconSet (void)
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"LM\"");
- fprintf (Gbl.F.Out,"",
- Cfg_URL_ICON_SETS_PUBLIC,
- Ico_IconSetId[IconSet],
- Ico_IconSetNames[IconSet],
- Ico_IconSetNames[IconSet]);
+ if (asprintf (&URL,"%s/%s",
+ Cfg_URL_ICON_SETS_PUBLIC,Ico_IconSetId[IconSet]) < 0)
+ Lay_NotEnoughMemoryExit ();
+ HTM_IMG (URL,"cog.svg",Ico_IconSetNames[IconSet],
+ "class=\"ICO40x40\"");
+ free ((void *) URL);
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM\"");
@@ -5223,6 +5228,7 @@ static void Fig_GetAndShowNumUsrsPerTheme (void)
extern const char *Txt_PERCENT_of_users;
The_Theme_t Theme;
char *SubQuery;
+ char *URL;
unsigned NumUsrs[The_NUM_THEMES];
unsigned NumUsrsTotal = 0;
@@ -5263,12 +5269,12 @@ static void Fig_GetAndShowNumUsrsPerTheme (void)
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"CM\"");
- fprintf (Gbl.F.Out,"",
- Cfg_URL_ICON_THEMES_PUBLIC,The_ThemeId[Theme],
- The_ThemeNames[Theme],
- The_ThemeNames[Theme]);
+ if (asprintf (&URL,"%s/%s",
+ Cfg_URL_ICON_THEMES_PUBLIC,The_ThemeId[Theme]) < 0)
+ Lay_NotEnoughMemoryExit ();
+ HTM_IMG (URL,"theme_32x20.gif",The_ThemeNames[Theme],
+ "style=\"width:40px;height:25px;\"");
+ free ((void *) URL);
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM\"");
@@ -5302,6 +5308,7 @@ static void Fig_GetAndShowNumUsrsPerSideColumns (void)
extern const char *Txt_PERCENT_of_users;
unsigned SideCols;
char *SubQuery;
+ char *Icon;
unsigned NumUsrs[4];
unsigned NumUsrsTotal = 0;
extern const char *Txt_LAYOUT_SIDE_COLUMNS[4];
@@ -5343,12 +5350,12 @@ static void Fig_GetAndShowNumUsrsPerSideColumns (void)
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"CM\"");
- fprintf (Gbl.F.Out,"",
- Cfg_URL_ICON_PUBLIC,SideCols >> 1,SideCols & 1,
- Txt_LAYOUT_SIDE_COLUMNS[SideCols],
- Txt_LAYOUT_SIDE_COLUMNS[SideCols]);
+ if (asprintf (&Icon,"layout%u%u_32x20.gif",
+ SideCols >> 1,SideCols & 1) < 0)
+ Lay_NotEnoughMemoryExit ();
+ HTM_IMG (Cfg_URL_ICON_PUBLIC,Icon,Txt_LAYOUT_SIDE_COLUMNS[SideCols],
+ "style=\"width:40px;height:25px;\"");
+ free ((void *) Icon);
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RM\"");
diff --git a/swad_file_browser.c b/swad_file_browser.c
index bd3e2cc6..891c9515 100644
--- a/swad_file_browser.c
+++ b/swad_file_browser.c
@@ -3296,7 +3296,7 @@ static void Brw_FormToChangeCrsGrpZone (void)
NumGrp < LstMyGrps.NumGrps - 1 ? "submid20x20.gif" :
"subend20x20.gif",
NULL,
- "ICO25x25","margin-left:6px;",NULL);
+ "class=\"ICO25x25\" style=\"margin-left:6px;\"");
fprintf (Gbl.F.Out,"