Version19.46.8

This commit is contained in:
Antonio Cañas Vargas 2019-10-30 22:31:03 +01:00
parent e678096d83
commit a3f44db68c
22 changed files with 203 additions and 183 deletions

View File

@ -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,"<img");
va_list ap;
int NumBytesPrinted;
char *Attr;
if (Id)
if (Id[0])
fprintf (Gbl.F.Out," id=\"%s\"",Id);
fprintf (Gbl.F.Out," src=\"%s/%s\"",URL,Icon);
fprintf (Gbl.F.Out,"<img src=\"%s/%s\"",URL,Icon);
if (Title)
{
@ -729,13 +727,25 @@ void HTM_IMG (const char *URL,const char *Icon,const char *Title,
else
fprintf (Gbl.F.Out," alt=\"\"");
if (Class)
if (Class[0])
fprintf (Gbl.F.Out," class=\"%s\"",Class);
if (fmt)
{
if (fmt[0])
{
va_start (ap,fmt);
NumBytesPrinted = vasprintf (&Attr,fmt,ap);
va_end (ap);
if (Style)
if (Style[0])
fprintf (Gbl.F.Out," style=\"%s\"",Style);
if (NumBytesPrinted < 0) // If memory allocation wasn't possible,
// or some other error occurs,
// vasprintf will return -1
Lay_NotEnoughMemoryExit ();
/***** Print attributes *****/
fprintf (Gbl.F.Out," %s",Attr);
free ((void *) Attr);
}
}
fprintf (Gbl.F.Out," />");
}

View File

@ -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

View File

@ -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 ();

View File

@ -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 ();

View File

@ -25,8 +25,10 @@
/********************************* Headers ***********************************/
/*****************************************************************************/
#define _GNU_SOURCE // For asprintf
#include <linux/stddef.h> // For NULL
#include <stdbool.h> // For boolean type
#include <stdio.h> // For asprintf
#include <stdlib.h> // For calloc
#include <string.h> // For string functions
#include <sys/wait.h> // 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 ();

View File

@ -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 <img a HTM_IMG ()
Version 19.46.8: Oct 29, 2019 Code refactoring in HTML images. (246244 lines)
Version 19.46.7: Oct 29, 2019 Code refactoring in HTML images. (246217 lines)
Version 19.46.6: Oct 29, 2019 Code refactoring in HTML images. (246226 lines)
Version 19.46.5: Oct 29, 2019 Code refactoring in HTML images. (246223 lines)
Version 19.46.4: Oct 28, 2019 Code refactoring in HTML images. (246247 lines)

View File

@ -846,20 +846,26 @@ void Cty_DrawCountryMapAndNameWithLink (struct Country *Cty,Act_Action_t Action,
void Cty_DrawCountryMap (struct Country *Cty,const char *Class)
{
char *URL;
char *Icon;
/***** Draw country map *****/
fprintf (Gbl.F.Out,"<img src=\"");
if (Cty_CheckIfCountryMapExists (Cty))
fprintf (Gbl.F.Out,"%s/%s/%s.png",
Cfg_URL_ICON_COUNTRIES_PUBLIC,
Cty->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);
}
/*****************************************************************************/

View File

@ -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,"<img src=\"%s/%s/%s.png\""
" alt=\"%s\" title=\"%s\""
" class=\"ICO16x16\" />);",
Cfg_URL_ICON_COUNTRIES_PUBLIC,
Cty.Alpha2,
Cty.Alpha2,
Cty.Alpha2,
Cty.Name[Gbl.Prefs.Language]);
Cty_DrawCountryMap (&Cty,"ICO16x16");
fprintf (Gbl.F.Out,"&nbsp;%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 *****/

View File

@ -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,"<img src=\"%s/%s\""
" alt=\"%s%s\" title=\"%s%s\""
" class=\"ICO16x16\" />",
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,"<img src=\"%s/first-day-of-week-%u.png\""
" alt=\"%s\" title=\"%s: %s\""
" class=\"ICO40x40\" />",
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,"<img src=\"%s/%s/cog.svg\""
" alt=\"%s\" title=\"%s\""
" class=\"ICO40x40\" />",
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,"<img src=\"%s/%s/theme_32x20.gif\""
" alt=\"%s\" title=\"%s\""
" style=\"width:40px; height:25px;\" />",
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,"<img src=\"%s/layout%u%u_32x20.gif\""
" alt=\"%s\" title=\"%s\""
" style=\"width:40px; height:25px;\" />",
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\"");

View File

@ -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,"<label>"
"<input type=\"radio\" name=\"GrpCod\" value=\"%ld\"",
GrpDat.GrpCod);
@ -6164,37 +6164,51 @@ static void Brw_PutIconFile (unsigned Size,Brw_FileType_t FileType,const char *F
extern const char *Ext_FileExtensionsAllowed[];
extern const char *Txt_Link;
extern const char *Txt_X_file;
char *URL;
char *Icon;
char *Title;
unsigned DocType;
bool NotFound;
/***** Icon depending on the file extension *****/
if (FileType == Brw_IS_LINK)
fprintf (Gbl.F.Out,"<img src=\"%s/link.svg\" alt=\"%s\"",
Cfg_URL_ICON_PUBLIC,Txt_Link);
Ico_PutIcon ("link.svg",Txt_Link,(Size == 16) ? "CONTEXT_ICO_16x16" :
"ICO40x40");
else // FileType == Brw_IS_FILE
{
fprintf (Gbl.F.Out,"<img src=\"%s%ux%u/",
CfG_URL_ICON_FILEXT_PUBLIC,
Size,Size);
if (asprintf (&URL,"%s%ux%u",
CfG_URL_ICON_FILEXT_PUBLIC,
Size,Size) < 0)
Lay_NotEnoughMemoryExit ();
for (DocType = 0, NotFound = true;
DocType < Ext_NUM_FILE_EXT_ALLOWED && NotFound;
DocType++)
if (Str_FileIs (FileName,Ext_FileExtensionsAllowed[DocType]))
{
fprintf (Gbl.F.Out,"%s%ux%u.gif\" alt=\"",
Ext_FileExtensionsAllowed[DocType],
Size,Size);
fprintf (Gbl.F.Out,Txt_X_file,Ext_FileExtensionsAllowed[DocType]);
fprintf (Gbl.F.Out,"\"");
if (asprintf (&Icon,"%s%ux%u.gif",
Ext_FileExtensionsAllowed[DocType],
Size,Size) < 0)
Lay_NotEnoughMemoryExit ();
if (asprintf (&Title,Txt_X_file,
Ext_FileExtensionsAllowed[DocType]) < 0)
Lay_NotEnoughMemoryExit ();
NotFound = false;
}
if (NotFound)
fprintf (Gbl.F.Out,"xxx%ux%u.gif\" alt=\"\"",
Size,Size);
{
if (asprintf (&Icon,"xxx%ux%u.gif",Size,Size) < 0)
Lay_NotEnoughMemoryExit ();
if (asprintf (&Title,"%s","") < 0)
Lay_NotEnoughMemoryExit ();
}
HTM_IMG (URL,Icon,Title,
"class=\"CONTEXT_OPT ICO_HIGHLIGHT %s\"",
(Size == 16) ? "CONTEXT_ICO_16x16" :
"ICO40x40");
free ((void *) Title);
free ((void *) Icon);
free ((void *) URL);
}
fprintf (Gbl.F.Out," class=\"CONTEXT_OPT ICO_HIGHLIGHT %s\"/>",
(Size == 16) ? "CONTEXT_ICO_16x16" :
"ICO40x40");
}
/*****************************************************************************/

View File

@ -412,7 +412,7 @@ void Ico_PutIconOff (const char *Icon,const char *Title)
void Ico_PutIcon (const char *Icon,const char *Title,const char *Class)
{
HTM_IMG (Cfg_URL_ICON_PUBLIC,Icon,Title,
Class,NULL,NULL);
"class=\"%s\"",Class);
}
/*****************************************************************************/
@ -424,15 +424,13 @@ void Ico_PutCalculateIcon (const char *Title)
{
HTM_DIV_Begin ("class=\"CONTEXT_OPT ICO_HIGHLIGHT\"");
fprintf (Gbl.F.Out,"<img id=\"update_%d\" src=\"%s/recycle16x16.gif\"" // TODO: change name and resolution to refresh64x64.png
" alt=\"%s\" title=\"%s\""
" class=\"CONTEXT_ICO_16x16\" />",
Gbl.Form.Num,Cfg_URL_ICON_PUBLIC,Title,Title);
HTM_IMG (Cfg_URL_ICON_PUBLIC,"recycle16x16.gif",Title, // TODO: change name and resolution to refresh64x64.png
"class=\"CONTEXT_ICO_16x16\""
" id=\"update_%d\"",Gbl.Form.Num);
fprintf (Gbl.F.Out,"<img id=\"updating_%d\" src=\"%s/working16x16.gif\"" // TODO: change name and resolution to refreshing64x64.gif
" alt=\"%s\" title=\"%s\""
" class=\"CONTEXT_ICO_16x16\" style=\"display:none;\" />", // Animated icon hidden
Gbl.Form.Num,Cfg_URL_ICON_PUBLIC,Title,Title);
HTM_IMG (Cfg_URL_ICON_PUBLIC,"working16x16.gif",Title, // TODO: change name and resolution to refreshing64x64.gif
"class=\"CONTEXT_ICO_16x16\" style=\"display:none;\"" // Animated icon hidden
" id=\"updating_%d\"",Gbl.Form.Num);
HTM_DIV_End ();
}
@ -446,15 +444,13 @@ void Ico_PutCalculateIconWithText (const char *Text)
{
HTM_DIV_Begin ("class=\"ICO_HIGHLIGHT\" style=\"margin:0 6px 0 0; display:inline;\"");
fprintf (Gbl.F.Out,"<img id=\"update_%d\" src=\"%s/recycle16x16.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"ICO20x20\" />",
Gbl.Form.Num,Cfg_URL_ICON_PUBLIC,Text,Text);
HTM_IMG (Cfg_URL_ICON_PUBLIC,"recycle16x16.gif",Text,
"class=\"ICO20x20\""
" id=\"update_%d\"",Gbl.Form.Num);
fprintf (Gbl.F.Out,"<img id=\"updating_%d\" src=\"%s/working16x16.gif\""
" alt=\"%s\" title=\"%s\""
" class=\"ICO20x20\" style=\"display:none;\" />", // Animated icon hidden
Gbl.Form.Num,Cfg_URL_ICON_PUBLIC,Text,Text);
HTM_IMG (Cfg_URL_ICON_PUBLIC,"working16x16.gif",Text,
"class=\"ICO20x20\" style=\"display:none;\"" // Animated icon hidden
" id=\"updating_%d\"",Gbl.Form.Num);
fprintf (Gbl.F.Out,"&nbsp;%s",Text);

View File

@ -271,7 +271,7 @@ void Lay_WriteStartOfPage (void)
fprintf (Gbl.F.Out,"<body onload=\"init();\">\n");
HTM_DIV_Begin ("id=\"zoomLyr\" class=\"ZOOM\"");
HTM_IMG (Cfg_URL_ICON_PUBLIC,"usr_bl.jpg",NULL,
"IMG_USR",NULL,"zoomImg");
"class=\"IMG_USR\" id=\"zoomImg\"");
HTM_DIV_Begin ("id=\"zoomTxt\" class=\"CM\"");
HTM_DIV_End ();
HTM_DIV_End ();
@ -895,7 +895,6 @@ static void Lay_WritePageTopHeading (void)
extern const char *Txt_System;
extern const char *Txt_TAGLINE;
extern const char *Txt_TAGLINE_BR;
char Style[64];
const char *ClassHeadRow1[The_NUM_THEMES] =
{
"HEAD_ROW_1_WHITE", // The_THEME_WHITE
@ -931,20 +930,16 @@ static void Lay_WritePageTopHeading (void)
HTM_DIV_Begin ("id=\"head_row_1_logo_small\"");
Frm_LinkFormSubmit (Txt_System,NULL,NULL);
snprintf (Style,sizeof (Style),
"width:%upx; height:%upx;",
Cfg_PLATFORM_LOGO_SMALL_WIDTH,Cfg_PLATFORM_LOGO_SMALL_HEIGHT);
HTM_IMG (Cfg_URL_ICON_PUBLIC,Cfg_PLATFORM_LOGO_SMALL_FILENAME,Cfg_PLATFORM_SHORT_NAME,
"CM",Style,NULL);
"class=\"CM\" style=\"width:%upx; height:%upx;\"",
Cfg_PLATFORM_LOGO_SMALL_WIDTH,Cfg_PLATFORM_LOGO_SMALL_HEIGHT);
Frm_LinkFormEnd ();
HTM_DIV_End (); // head_row_1_logo_small
HTM_DIV_Begin ("id=\"head_row_1_logo_big\"");
Frm_LinkFormSubmit (Txt_System,NULL,NULL);
snprintf (Style,sizeof (Style),
"width:%upx; height:%upx;",
Cfg_PLATFORM_LOGO_BIG_WIDTH,Cfg_PLATFORM_LOGO_BIG_HEIGHT);
HTM_IMG (Cfg_URL_ICON_PUBLIC,Cfg_PLATFORM_LOGO_BIG_FILENAME,Cfg_PLATFORM_SHORT_NAME,
"CM",Style,NULL);
"class=\"CM\" style=\"width:%upx; height:%upx;\"",
Cfg_PLATFORM_LOGO_BIG_WIDTH,Cfg_PLATFORM_LOGO_BIG_HEIGHT);
Frm_LinkFormEnd ();
HTM_DIV_End (); // head_row_1_logo_big
HTM_DIV_Begin ("id=\"head_row_1_tagline\"");
@ -1153,7 +1148,7 @@ static void Lay_ShowRightColumn (void)
" target=\"_blank\" title=\"%s\"",
Txt_If_you_have_an_Android_device_try_SWADroid);
HTM_IMG (Cfg_URL_ICON_PUBLIC,"SWADroid120x200.png","SWADroid",
NULL,"width:150px; height:250px;",NULL);
"style=\"width:150px; height:250px;\"");
HTM_A_End ();
HTM_DIV_End ();
}
@ -1420,18 +1415,15 @@ static void Lay_WriteAboutZone (void)
{
extern const char *Txt_About_X;
extern const char *Txt_Questions_and_problems;
char Style[64];
/***** Start about zone *****/
fprintf (Gbl.F.Out,"<address id=\"about_zone\" class=\"ABOUT\">");
/***** Institution and centre hosting the platform *****/
HTM_A_Begin ("href=\"%s\" class=\"ABOUT\" target=\"_blank\"",Cfg_ABOUT_URL);
snprintf (Style,sizeof (Style),
"width:%upx; height:%upx;",
Cfg_ABOUT_LOGO_WIDTH,Cfg_ABOUT_LOGO_HEIGHT);
HTM_IMG (Cfg_URL_ICON_PUBLIC,Cfg_ABOUT_LOGO,Cfg_ABOUT_NAME,
NULL,Style,NULL);
"style=\"width:%upx; height:%upx;\"",
Cfg_ABOUT_LOGO_WIDTH,Cfg_ABOUT_LOGO_HEIGHT);
HTM_DIV_Begin (NULL);
fprintf (Gbl.F.Out,"%s",Cfg_ABOUT_NAME);
HTM_DIV_End ();
@ -1680,7 +1672,7 @@ void Lay_AdvertisementMobile (void)
" class=\"DAT\"");
fprintf (Gbl.F.Out,"%s<br /><br />",Txt_Stay_connected_with_SWADroid);
HTM_IMG (Cfg_URL_ICON_PUBLIC,"SWADroid200x300.png",Txt_Stay_connected_with_SWADroid,
NULL,"width:250px; height:375px;",NULL);
"style=\"width:250px; height:375px;\"");
HTM_A_End ();
HTM_TD_End ();
HTM_TR_End ();

View File

@ -25,6 +25,8 @@
/*********************************** Headers *********************************/
/*****************************************************************************/
#define _GNU_SOURCE // For asprintf
#include <stdio.h> // For asprintf
#include <string.h> // For string functions
#include "swad_action.h"
@ -68,15 +70,15 @@ extern struct Globals Gbl;
void Log_DrawLogo (Hie_Level_t Scope,long Cod,const char *AltText,
unsigned Size,const char *Class,bool PutIconIfNotExists)
{
static const char *Icon[Hie_NUM_LEVELS] =
static const char *HieIcon[Hie_NUM_LEVELS] =
{
NULL, // Hie_UNK
NULL, // Hie_SYS
NULL, // Hie_CTY
"sitemap.svg", // Hie_UNK, not applicable here
"sitemap.svg", // Hie_SYS, not applicable here
"sitemap.svg", // Hie_CTY, not applicable here
"university.svg", // Hie_INS
"building.svg", // Hie_CTR
"graduation-cap.svg", // Hie_DEG
NULL, // Hie_CRS
"sitemap.svg", // Hie_CRS, not applicable here
};
const char *Folder = NULL; // To avoid warning
char PathLogo[PATH_MAX + 1];
@ -84,9 +86,11 @@ void Log_DrawLogo (Hie_Level_t Scope,long Cod,const char *AltText,
long InsCod;
long CtrCod;
long DegCod;
char *URL;
char *Icon;
/***** Path to logo *****/
if (Icon[Scope]) // Scope is correct
if (HieIcon[Scope]) // Scope is correct
{
if (Cod > 0) // Institution, centre or degree exists
{
@ -149,25 +153,29 @@ void Log_DrawLogo (Hie_Level_t Scope,long Cod,const char *AltText,
if (LogoFound || PutIconIfNotExists)
{
/***** Draw logo *****/
fprintf (Gbl.F.Out,"<img src=\"");
if (LogoFound)
fprintf (Gbl.F.Out,"%s/%s/%02u/%u/logo/%u.png",
Cfg_URL_SWAD_PUBLIC,Folder,
(unsigned) (Cod % 100),
(unsigned) Cod,
(unsigned) Cod);
else if (Icon[Scope])
fprintf (Gbl.F.Out,"%s/%s",
Cfg_URL_ICON_PUBLIC,Icon[Scope]);
fprintf (Gbl.F.Out,"\""
" alt=\"%s\" title=\"%s\""
" class=\"ICO%ux%u",
AltText,AltText,
Size,Size);
if (Class)
if (Class[0])
fprintf (Gbl.F.Out," %s",Class);
fprintf (Gbl.F.Out,"\" />");
{
if (asprintf (&URL,"%s/%s/%02u/%u/logo",
Cfg_URL_SWAD_PUBLIC,Folder,
(unsigned) (Cod % 100),
(unsigned) Cod) < 0)
Lay_NotEnoughMemoryExit ();
if (asprintf (&Icon,"%u.png",(unsigned) Cod) < 0)
Lay_NotEnoughMemoryExit ();
}
else
{
if (asprintf (&URL,"%s",Cfg_URL_ICON_PUBLIC) < 0)
Lay_NotEnoughMemoryExit ();
if (asprintf (&Icon,"%s",HieIcon[Scope]) < 0)
Lay_NotEnoughMemoryExit ();
}
HTM_IMG (URL,Icon,AltText,
"class=\"ICO%ux%u%s\"",
Size,Size,Class ? Class :
"");
free ((void *) Icon);
free ((void *) URL);
}
}
}

View File

@ -323,7 +323,7 @@ void Net_ShowFormMyWebsAndSocialNets (void)
fprintf (Gbl.F.Out,"<label for=\"URL%u\" class=\"%s\">",
(unsigned) NumURL,The_ClassFormInBox[Gbl.Prefs.Theme]);
HTM_IMG (Cfg_URL_ICON_PUBLIC,Net_WebsAndSocialNetworksIcons[NumURL],Net_WebsAndSocialNetworksTitle[NumURL],
"CONTEXT_ICO_16x16","margin-right:6px;",NULL);
"class=\"CONTEXT_ICO_16x16\" style=\"margin-right:6px;\"");
fprintf (Gbl.F.Out,"%s:"
"</label>",
Net_WebsAndSocialNetworksTitle[NumURL]);
@ -577,13 +577,8 @@ void Net_ShowWebAndSocialNetworksStats (void)
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"DAT LM\"");
fprintf (Gbl.F.Out,"<img src=\"%s/%s\""
" alt=\"%s\" title=\"%s\""
" class=\"CONTEXT_ICO_16x16\""
" style=\"margin-right:6px;\" />",
Cfg_URL_ICON_PUBLIC,Net_WebsAndSocialNetworksIcons[Web],
Net_WebsAndSocialNetworksTitle[Web],
Net_WebsAndSocialNetworksTitle[Web]);
HTM_IMG (Cfg_URL_ICON_PUBLIC,Net_WebsAndSocialNetworksIcons[Web],Net_WebsAndSocialNetworksTitle[Web],
"class=\"CONTEXT_ICO_16x16\" style=\"margin-right:6px;\"");
fprintf (Gbl.F.Out,"%s",Net_WebsAndSocialNetworksTitle[Web]);
HTM_TD_End ();

View File

@ -2060,7 +2060,7 @@ void Ntf_WriteNumberOfNewNtfs (void)
if (NumNewNtfs)
{
HTM_IMG (Gbl.Prefs.URLTheme,"bell.svg",Txt_Notifications,
"ICO16x16",NULL,NULL);
"class=\"ICO16x16\"");
fprintf (Gbl.F.Out,"&nbsp;%u<span id=\"notif_new\">&nbsp;%s</span>",
NumNewNtfs,
NumNewNtfs == 1 ? Txt_NOTIF_new_SINGULAR :

View File

@ -1790,7 +1790,6 @@ static void Sta_ShowNumHitsPerUsr (unsigned long NumRows,MYSQL_RES *mysql_res)
unsigned long NumRow;
struct Sta_Hits Hits;
unsigned BarWidth;
char Style[64];
struct UsrData UsrDat;
char PhotoURL[PATH_MAX + 1];
bool ShowPhoto;
@ -1869,13 +1868,12 @@ static void Sta_ShowNumHitsPerUsr (unsigned long NumRows,MYSQL_RES *mysql_res)
HTM_TD_Begin ("class=\"LOG LT COLOR%u\"",Gbl.RowEvenOdd);
if (BarWidth)
{
snprintf (Style,sizeof (Style),
"width:%upx; height:10px; padding-top:4px;",BarWidth);
HTM_IMG (Cfg_URL_ICON_PUBLIC,
UsrDat.Roles.InCurrentCrs.Role == Rol_STD ? "o1x1.png" : // Student
"r1x1.png", // Non-editing teacher or teacher
NULL,
"LT",Style,NULL);
"class=\"LT\" style=\"width:%upx; height:10px; padding-top:4px;\"",
BarWidth);
fprintf (Gbl.F.Out,"&nbsp;");
}
Str_WriteFloatNumToFile (Gbl.F.Out,Hits.Num);

View File

@ -3505,7 +3505,6 @@ static void Svy_WriteAnswersOfAQst (struct Survey *Svy,
static void Svy_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs)
{
extern const char *Txt_of_PART_OF_A_TOTAL;
char Style[64];
unsigned BarWidth = 0;
/***** String with the number of users *****/
@ -3528,10 +3527,8 @@ static void Svy_DrawBarNumUsrs (unsigned NumUsrs,unsigned MaxUsrs)
(float) MaxUsrs) + 0.5);
if (BarWidth < 2)
BarWidth = 2;
snprintf (Style,sizeof (Style),
"width:%upx; height:20px;",BarWidth);
HTM_IMG (Cfg_URL_ICON_PUBLIC,"o1x1.png",Gbl.Title,
"LT",Style,NULL);
"class=\"LT\" style=\"width:%upx; height:20px;\"",BarWidth);
/***** Write the number of users *****/
fprintf (Gbl.F.Out,"&nbsp;%s",Gbl.Title);

View File

@ -137,7 +137,7 @@ void Tab_DrawTabs (void)
NumTab == Gbl.Action.Tab ? The_ClassTxtTabOn[Gbl.Prefs.Theme] :
The_ClassTxtTabOff[Gbl.Prefs.Theme],NULL);
HTM_IMG (Gbl.Prefs.URLIconSet,Tab_GetIcon (NumTab),Txt_TABS_TXT[NumTab],
"TAB_ICO",NULL,NULL);
"class=\"TAB_ICO\"");
HTM_DIV_Begin ("class=\"TAB_TXT %s\"",
NumTab == Gbl.Action.Tab ? The_ClassTxtTabOn[Gbl.Prefs.Theme] :
The_ClassTxtTabOff[Gbl.Prefs.Theme]);

View File

@ -1737,10 +1737,10 @@ static void Tst_ShowFormSelTags (unsigned long NumRows,MYSQL_RES *mysql_res,
HTM_TD_Begin ("class=\"LM\"");
if (TagHidden)
HTM_IMG (Cfg_URL_ICON_PUBLIC,"eye-slash.svg",Txt_Tag_not_allowed,
"ICO_HIDDEN ICO16x16",NULL,NULL);
"class=\"ICO_HIDDEN ICO16x16\"");
else
HTM_IMG (Cfg_URL_ICON_PUBLIC,"eye.svg",Txt_Tag_allowed,
"ICO_HIDDEN ICO16x16",NULL,NULL);
"class=\"ICO_HIDDEN ICO16x16\"");
HTM_TD_End ();
}

View File

@ -1426,11 +1426,11 @@ static void TL_PutLinkToViewOldPublications (void)
"return false;\"",
The_ClassFormInBoxBold[Gbl.Prefs.Theme]);
HTM_IMG (Cfg_URL_ICON_PUBLIC,"recycle16x16.gif","Txt_See_more",
"ICO20x20",NULL,"get_old_timeline");
"class=\"ICO20x20\" id=\"get_old_timeline\"");
HTM_IMG (Cfg_URL_ICON_PUBLIC,"working16x16.gif",Txt_See_more,
"ICO20x20","display:none;","getting_old_timeline"); // Animated icon hidden
"class=\"ICO20x20\" style=\"display:none;\" id=\"getting_old_timeline\""); // Animated icon hidden
HTM_IMG (Cfg_URL_ICON_PUBLIC,"recycle16x16.gif","Txt_See_more",
"ICO20x20","display:none;","get_old_timeline");
"class=\"ICO20x20\" style=\"display:none;\" id=\"get_old_timeline\"");
fprintf (Gbl.F.Out,"&nbsp;%s",Txt_See_more);
HTM_A_End ();
HTM_DIV_End ();

View File

@ -2678,7 +2678,7 @@ void Usr_WelcomeUsr (void)
/* Show cake icon */
HTM_IMG (Gbl.Prefs.URLIconSet,"birthday-cake.svg",NULL,
"ICO160x160",NULL,NULL);
"class=\"ICO160x160\"");
/* End alert */
Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL);

View File

@ -572,7 +572,7 @@ static void ZIP_ShowLinkToDownloadZIP (const char *FileName,const char *URL,
HTM_A_Begin ("href=\"%s\" class=\"FILENAME_TXT\" title=\"%s\" target=\"_blank\"",
URL,FileName);
HTM_IMG (CfG_URL_ICON_FILEXT_PUBLIC "32x32","zip32x32.gif",Txt_ZIP_file,
"ICO40x40",NULL,NULL);
"class=\"ICO40x40\"");
fprintf (Gbl.F.Out,"&nbsp;%s&nbsp;",FileName);
Ico_PutIcon ("download.svg",Txt_Download,"ICO40x40");
HTM_A_End ();