mirror of https://github.com/acanas/swad-core.git
Version 21.83.7: Mar 16, 2022 Code refactoring in forms (input image).
This commit is contained in:
parent
925c2f6a9b
commit
908eae19dc
31
swad_HTML.c
31
swad_HTML.c
|
@ -1246,17 +1246,40 @@ void HTM_INPUT_BUTTON (const char *Name,const char *Value,const char *Attr)
|
|||
Attr);
|
||||
}
|
||||
|
||||
void HTM_INPUT_IMAGE (const char *URL,const char *Icon,
|
||||
const char *Title,const char *Class)
|
||||
void HTM_INPUT_IMAGE (const char *URL,const char *Icon,const char *Title,
|
||||
const char *fmt,...)
|
||||
{
|
||||
va_list ap;
|
||||
int NumBytesPrinted;
|
||||
char *Attr;
|
||||
|
||||
HTM_TxtF ("<input type=\"image\" src=\"%s",URL);
|
||||
if (Icon)
|
||||
if (Icon[0])
|
||||
HTM_TxtF ("/%s",Icon);
|
||||
HTM_Txt ("\"");
|
||||
|
||||
HTM_TxtF (" alt=\"%s\" title=\"%s\" class=\"%s\" />",
|
||||
Title,Title,Class);
|
||||
HTM_TxtF (" alt=\"%s\" title=\"%s\"",
|
||||
Title,Title);
|
||||
|
||||
if (fmt)
|
||||
{
|
||||
if (fmt[0])
|
||||
{
|
||||
va_start (ap,fmt);
|
||||
NumBytesPrinted = vasprintf (&Attr,fmt,ap);
|
||||
va_end (ap);
|
||||
if (NumBytesPrinted < 0) // -1 if no memory or any other error
|
||||
Err_NotEnoughMemoryExit ();
|
||||
|
||||
/***** Print attributes *****/
|
||||
HTM_SPTxt (Attr);
|
||||
|
||||
free (Attr);
|
||||
}
|
||||
}
|
||||
|
||||
HTM_Txt (" />");
|
||||
}
|
||||
|
||||
void HTM_INPUT_PASSWORD (const char *Name,const char *PlaceHolder,
|
||||
|
|
|
@ -148,8 +148,8 @@ void HTM_INPUT_FILE (const char *Name,const char *Accept,
|
|||
HTM_SubmitOnChange_t SubmitOnChange,
|
||||
const char *fmt,...);
|
||||
void HTM_INPUT_BUTTON (const char *Name,const char *Value,const char *Attr);
|
||||
void HTM_INPUT_IMAGE (const char *URL,const char *Icon,
|
||||
const char *Title,const char *Class);
|
||||
void HTM_INPUT_IMAGE (const char *URL,const char *Icon,const char *Title,
|
||||
const char *fmt,...);
|
||||
void HTM_INPUT_PASSWORD (const char *Name,const char *PlaceHolder,
|
||||
const char *AutoComplete,bool Required,
|
||||
const char *fmt,...);
|
||||
|
|
|
@ -1051,7 +1051,8 @@ void Ban_WriteMenuWithBanners (void)
|
|||
|
||||
/* Banner image */
|
||||
HTM_INPUT_IMAGE (Cfg_URL_BANNER_PUBLIC,Banners.Lst[NumBan].Img,
|
||||
Banners.Lst[NumBan].FullName,"BANNER");
|
||||
Banners.Lst[NumBan].FullName,
|
||||
"class=\"BANNER\"");
|
||||
|
||||
/* End form */
|
||||
Frm_EndForm ();
|
||||
|
|
|
@ -5138,7 +5138,6 @@ static void Brw_PutIconFileWithLinkToViewMetadata (struct FileMetadata *FileMeta
|
|||
{
|
||||
extern const char *Ico_ClassColor[Ico_NUM_COLORS][The_NUM_THEMES];
|
||||
extern const char *Txt_Link;
|
||||
char *Class;
|
||||
|
||||
/***** Begin cell *****/
|
||||
HTM_TD_Begin ("class=\"BM %s\"",Gbl.ColorRows[Gbl.RowEvenOdd]);
|
||||
|
@ -5151,18 +5150,14 @@ static void Brw_PutIconFileWithLinkToViewMetadata (struct FileMetadata *FileMeta
|
|||
FileMetadata->FilCod);
|
||||
|
||||
/***** Icon depending on the file extension *****/
|
||||
if (FileMetadata->FilFolLnk.Type == Brw_IS_FILE)
|
||||
Brw_PutIconFile (FileMetadata->FilFolLnk.Name,
|
||||
"CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16",
|
||||
true); // Put link to view metadata
|
||||
else
|
||||
{
|
||||
if (asprintf (&Class,"CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16 %s",
|
||||
Ico_ClassColor[Ico_BLACK][Gbl.Prefs.Theme]) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"link.svg",Txt_Link,Class);
|
||||
free (Class);
|
||||
}
|
||||
if (FileMetadata->FilFolLnk.Type == Brw_IS_FILE)
|
||||
Brw_PutIconFile (FileMetadata->FilFolLnk.Name,
|
||||
"CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16",
|
||||
true); // Put link to view metadata
|
||||
else
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"link.svg",Txt_Link,
|
||||
"class=\"CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16 %s\"",
|
||||
Ico_ClassColor[Ico_BLACK][Gbl.Prefs.Theme]);
|
||||
|
||||
/***** End form *****/
|
||||
Frm_EndForm ();
|
||||
|
@ -5212,10 +5207,9 @@ static void Brw_PutIconFile (const char *FileName,
|
|||
}
|
||||
|
||||
if (PutLinkToViewMetadata)
|
||||
HTM_INPUT_IMAGE (URL,Icon,Title,Class);
|
||||
HTM_INPUT_IMAGE (URL,Icon,Title,"class=\"%s\"",Class);
|
||||
else
|
||||
HTM_IMG (URL,Icon,Title,
|
||||
"class=\"%s\"",Class);
|
||||
HTM_IMG (URL,Icon,Title,"class=\"%s\"",Class);
|
||||
free (Title);
|
||||
free (Icon);
|
||||
free (URL);
|
||||
|
|
|
@ -606,10 +606,11 @@ TODO: Fix bug: error al enviar un mensaje a dos recipientes, error on duplicate
|
|||
|
||||
TODO: Attach pdf files in multimedia.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.83.6 (2022-03-15)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.83.7 (2022-03-16)"
|
||||
#define CSS_FILE "swad21.83.5.css"
|
||||
#define JS_FILE "swad21.78.2.js"
|
||||
/*
|
||||
Version 21.83.7: Mar 16, 2022 Code refactoring in forms (input image). (323585 lines)
|
||||
Version 21.83.6: Mar 15, 2022 Working on design of dark theme. (323581 lines)
|
||||
Version 21.83.5: Mar 15, 2022 Working on design of dark theme. (323559 lines)
|
||||
Version 21.83.4: Mar 11, 2022 Code refactoring in timetable. (323543 lines)
|
||||
|
|
|
@ -425,7 +425,8 @@ static void Con_ShowConnectedUsrsWithARoleBelongingToCurrentCrsOnRightColumn (Ro
|
|||
// is dynamically updated via AJAX
|
||||
Sco_PutParamScope ("ScopeCon",HieLvl_CRS);
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"ellipsis-h.svg",
|
||||
Txt_Connected_users,"ICO16x16");
|
||||
Txt_Connected_users,
|
||||
"class=\"ICO16x16\"");
|
||||
Frm_EndForm ();
|
||||
HTM_TD_End ();
|
||||
HTM_TR_End ();
|
||||
|
|
|
@ -2220,7 +2220,7 @@ void Crs_PutIconToSelectMyCoursesInBreadcrumb (void)
|
|||
|
||||
/***** Put icon with link *****/
|
||||
HTM_INPUT_IMAGE (Gbl.Prefs.URLTheme,"sitemap.svg",Txt_My_courses,
|
||||
"BC_ICON ICO_HIGHLIGHT");
|
||||
"class=\"BC_ICON ICO_HIGHLIGHT\"");
|
||||
|
||||
/***** End form *****/
|
||||
Frm_EndForm ();
|
||||
|
|
|
@ -368,7 +368,7 @@ void Fol_ShowFollowingAndFollowers (const struct UsrData *UsrDat,
|
|||
"user-plus.svg",
|
||||
IFollowUsr ? Txt_Following_unfollow :
|
||||
Txt_Follow,
|
||||
"ICO_HIGHLIGHT ICO40x40");
|
||||
"class=\"ICO_HIGHLIGHT ICO40x40\"");
|
||||
Frm_EndForm ();
|
||||
}
|
||||
HTM_DIV_End ();
|
||||
|
@ -749,16 +749,13 @@ static void Fol_PutIconToFollow (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_
|
|||
{
|
||||
extern const char *Ico_ClassColor[Ico_NUM_COLORS][The_NUM_THEMES];
|
||||
extern const char *Txt_Follow;
|
||||
char *Class;
|
||||
|
||||
/***** Form to unfollow *****/
|
||||
Frm_BeginForm (ActFolUsr);
|
||||
Usr_PutParamUsrCodEncrypted (EncryptedUsrCod);
|
||||
if (asprintf (&Class,"FOLLOW_USR_ICO ICO16x16 %s ICO_HIGHLIGHT",
|
||||
Ico_ClassColor[Ico_BLACK][Gbl.Prefs.Theme]) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"user-plus.svg",Txt_Follow,Class);
|
||||
free (Class);
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"user-plus.svg",Txt_Follow,
|
||||
"class=\"FOLLOW_USR_ICO ICO16x16 %s ICO_HIGHLIGHT\"",
|
||||
Ico_ClassColor[Ico_BLACK][Gbl.Prefs.Theme]);
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
||||
|
@ -774,7 +771,8 @@ static void Fol_PutIconToUnfollow (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTE
|
|||
Frm_BeginForm (ActUnfUsr);
|
||||
Usr_PutParamUsrCodEncrypted (EncryptedUsrCod);
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"user-check.svg",
|
||||
Txt_Unfollow,"FOLLOW_USR_ICO ICO_HIGHLIGHT ICO16x16");
|
||||
Txt_Unfollow,
|
||||
"class=\"FOLLOW_USR_ICO ICO_HIGHLIGHT ICO16x16\"");
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
||||
|
|
20
swad_icon.c
20
swad_icon.c
|
@ -454,13 +454,9 @@ void Ico_PutDivIcon (const char *DivClass,const char *Icon,Ico_Color_t Color,con
|
|||
|
||||
void Ico_PutIconLink (const char *Icon,Ico_Color_t Color,const char *Title)
|
||||
{
|
||||
char *Class;
|
||||
|
||||
if (asprintf (&Class,"CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16 %s",
|
||||
Ico_ClassColor[Color][Gbl.Prefs.Theme]) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,Icon,Title,Class);
|
||||
free (Class);
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,Icon,Title,
|
||||
"class=\"CONTEXT_OPT ICO_HIGHLIGHT CONTEXT_ICO16x16 %s\"",
|
||||
Ico_ClassColor[Color][Gbl.Prefs.Theme]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -482,13 +478,9 @@ void Ico_PutIconTextLink (const char *Icon,Ico_Color_t Color,const char *Text)
|
|||
|
||||
void Ico_PutSettingIconLink (const char *Icon,Ico_Color_t Color,const char *Title)
|
||||
{
|
||||
char *Class;
|
||||
|
||||
if (asprintf (&Class,"ICO_HIGHLIGHT ICOx20 %s",
|
||||
Ico_ClassColor[Color][Gbl.Prefs.Theme]) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,Icon,Title,Class);
|
||||
free (Class);
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,Icon,Title,
|
||||
"class=\"ICO_HIGHLIGHT ICOx20 %s\"",
|
||||
Ico_ClassColor[Color][Gbl.Prefs.Theme]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -1007,12 +1007,14 @@ static void Lay_WritePageTopHeading (void)
|
|||
|
||||
HTM_DIV_Begin ("id=\"head_row_1_logo_small\"");
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,Cfg_PLATFORM_LOGO_SMALL_FILENAME,
|
||||
Cfg_PLATFORM_SHORT_NAME,Cfg_PLATFORM_LOGO_SMALL_CLASS);
|
||||
Cfg_PLATFORM_SHORT_NAME,
|
||||
"class=\"%s\"",Cfg_PLATFORM_LOGO_SMALL_CLASS);
|
||||
HTM_DIV_End (); // head_row_1_logo_small
|
||||
|
||||
HTM_DIV_Begin ("id=\"head_row_1_logo_big\"");
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,Cfg_PLATFORM_LOGO_BIG_FILENAME,
|
||||
Cfg_PLATFORM_SHORT_NAME,Cfg_PLATFORM_LOGO_BIG_CLASS);
|
||||
Cfg_PLATFORM_SHORT_NAME,
|
||||
"class=\"%s\"",Cfg_PLATFORM_LOGO_BIG_CLASS);
|
||||
HTM_DIV_End (); // head_row_1_logo_big
|
||||
|
||||
HTM_DIV_Begin ("id=\"head_row_1_tagline\" class=\"TAGLINE_%s\"",
|
||||
|
|
|
@ -1319,7 +1319,8 @@ static void Mch_PutFormNewMatch (const struct Gam_Game *Game)
|
|||
|
||||
/***** Put icon to submit the form *****/
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"play.svg",
|
||||
Txt_Play,"CONTEXT_OPT ICO_HIGHLIGHT ICO64x64");
|
||||
Txt_Play,
|
||||
"class=\"CONTEXT_OPT ICO_HIGHLIGHT ICO64x64\"");
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
|
|
|
@ -70,7 +70,6 @@ void PhoSha_PutIconsToSelectPhotoShape (void)
|
|||
[PhoSha_SHAPE_RECTANGLE] = "ICO_HIGHLIGHT PHOTOR15x20B",
|
||||
};
|
||||
PhoSha_Shape_t Shape;
|
||||
char *Class;
|
||||
|
||||
Box_BoxBegin (NULL,Txt_User_photos,
|
||||
PhoSha_PutIconsPhotoShape,NULL,
|
||||
|
@ -88,13 +87,11 @@ void PhoSha_PutIconsToSelectPhotoShape (void)
|
|||
HTM_DIV_Begin ("class=\"PREF_OFF\"");
|
||||
Frm_BeginForm (ActChgUsrPho);
|
||||
Par_PutHiddenParamUnsigned (NULL,"PhotoShape",Shape);
|
||||
if (asprintf (&Class,"%s %s",
|
||||
ClassPhoto[Shape],
|
||||
Ico_ClassColor[Ico_BLACK][Gbl.Prefs.Theme]) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,"user.svg",
|
||||
Txt_PHOTO_SHAPES[Shape],Class);
|
||||
free (Class);
|
||||
Txt_PHOTO_SHAPES[Shape],
|
||||
"class=\"%s %s\"",
|
||||
ClassPhoto[Shape],
|
||||
Ico_ClassColor[Ico_BLACK][Gbl.Prefs.Theme]);
|
||||
Frm_EndForm ();
|
||||
HTM_DIV_End ();
|
||||
}
|
||||
|
|
11
swad_user.c
11
swad_user.c
|
@ -6510,7 +6510,6 @@ void Usr_PutWhoIcon (Usr_Who_t Who)
|
|||
[Usr_WHO_FOLLOWED] = "user-check.svg",
|
||||
[Usr_WHO_ALL ] = "users.svg",
|
||||
};
|
||||
char *Class;
|
||||
|
||||
switch (Who)
|
||||
{
|
||||
|
@ -6522,16 +6521,14 @@ void Usr_PutWhoIcon (Usr_Who_t Who)
|
|||
Gbl.Usrs.Me.PhotoURL[0] ? NULL :
|
||||
"usr_bl.jpg",
|
||||
Txt_WHO[Who],
|
||||
"ICO_HIGHLIGHT PHOTOR15x20");
|
||||
"class=\"ICO_HIGHLIGHT PHOTOR15x20\"");
|
||||
break;
|
||||
case Usr_WHO_SELECTED:
|
||||
case Usr_WHO_FOLLOWED:
|
||||
case Usr_WHO_ALL:
|
||||
if (asprintf (&Class,"ICO_HIGHLIGHT ICOx20 %s",
|
||||
Ico_ClassColor[Ico_BLACK][Gbl.Prefs.Theme]) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,Icon[Who],Txt_WHO[Who],Class);
|
||||
free (Class);
|
||||
HTM_INPUT_IMAGE (Cfg_URL_ICON_PUBLIC,Icon[Who],Txt_WHO[Who],
|
||||
"class=\"ICO_HIGHLIGHT ICOx20 %s\"",
|
||||
Ico_ClassColor[Ico_BLACK][Gbl.Prefs.Theme]);
|
||||
break;
|
||||
default:
|
||||
Err_WrongWhoExit ();
|
||||
|
|
Loading…
Reference in New Issue