Version19.51.9

This commit is contained in:
Antonio Cañas Vargas 2019-11-04 09:45:57 +01:00
parent 2a7413a31c
commit 6b4dfb737f
36 changed files with 248 additions and 226 deletions

View File

@ -792,7 +792,7 @@ void HTM_LABEL_End (void)
}
/*****************************************************************************/
/******************************** Input text *********************************/
/************************* Input text, email, url ****************************/
/*****************************************************************************/
void HTM_INPUT_TEXT (const char *Name,unsigned MaxLength,const char *Value,
@ -829,6 +829,74 @@ void HTM_INPUT_TEXT (const char *Name,unsigned MaxLength,const char *Value,
fprintf (Gbl.F.Out," />");
}
void HTM_INPUT_EMAIL (const char *Name,unsigned MaxLength,const char *Value,
const char *fmt,...)
{
va_list ap;
int NumBytesPrinted;
char *Attr;
fprintf (Gbl.F.Out,"<input type=\"email\" id=\"%s\" name=\"%s\""
" maxlength=\"%u\" value=\"%s\"",
Name,Name,MaxLength,Value);
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 attributes *****/
fprintf (Gbl.F.Out," %s",Attr);
free ((void *) Attr);
}
}
fprintf (Gbl.F.Out," />");
}
void HTM_INPUT_URL (const char *Name,const char *Value,
const char *fmt,...)
{
va_list ap;
int NumBytesPrinted;
char *Attr;
fprintf (Gbl.F.Out,"<input type=\"url\" id=\"%s\" name=\"%s\""
" maxlength=\"%u\" value=\"%s\"",
Name,Name,Cns_MAX_CHARS_WWW,Value);
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 attributes *****/
fprintf (Gbl.F.Out," %s",Attr);
free ((void *) Attr);
}
}
fprintf (Gbl.F.Out," />");
}
/*****************************************************************************/
/********************************* Text areas ********************************/
/*****************************************************************************/

View File

@ -91,6 +91,10 @@ void HTM_LABEL_End (void);
void HTM_INPUT_TEXT (const char *Name,unsigned MaxLength,const char *Value,
const char *fmt,...);
void HTM_INPUT_EMAIL (const char *Name,unsigned MaxLength,const char *Value,
const char *fmt,...);
void HTM_INPUT_URL (const char *Name,const char *Value,
const char *fmt,...);
void HTM_TEXTAREA_Begin (const char *fmt,...);
void HTM_TEXTAREA_End (void);

View File

@ -389,13 +389,9 @@ static void Acc_ShowFormRequestNewAccountWithParams (const char *NewNicknameWith
HTM_TD_End ();
HTM_TD_Begin ("class=\"LM\"");
fprintf (Gbl.F.Out,"<input type=\"email\" id=\"NewEmail\" name=\"NewEmail\""
" size=\"18\" maxlength=\"%u\""
" placeholder=\"%s\" value=\"%s\""
" required=\"required\" />",
Cns_MAX_CHARS_EMAIL_ADDRESS,
Txt_HELP_email,
NewEmail);
HTM_INPUT_EMAIL ("NewEmail",Cns_MAX_CHARS_EMAIL_ADDRESS,NewEmail,
"size=\"18\" placeholder=\"%s\" required=\"required\"",
Txt_HELP_email);
HTM_TD_End ();
HTM_TR_End ();

View File

@ -478,11 +478,10 @@ static void Ban_ListBannersForEdition (void)
HTM_TD_Begin ("class=\"CM\"");
Frm_StartForm (ActChgBanWWW);
Ban_PutParamBanCodToEdit ();
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
HTM_INPUT_URL ("WWW",Ban->WWW,
"class=\"INPUT_WWW\""
" onchange=\"document.getElementById('%s').submit();\" />",
Cns_MAX_CHARS_WWW,Ban->WWW,Gbl.Form.Id);
" onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
Frm_EndForm ();
HTM_TD_End ();
@ -891,11 +890,8 @@ static void Ban_PutFormToCreateBanner (void)
/***** Banner WWW *****/
HTM_TD_Begin ("class=\"CM\"");
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
" class=\"INPUT_WWW\""
" required=\"required\" />",
Cns_MAX_CHARS_WWW,Ban_EditingBan->WWW);
HTM_INPUT_URL ("WWW",Ban_EditingBan->WWW,
"class=\"INPUT_WWW\" required=\"required\"");
HTM_TD_End ();
HTM_TR_End ();

View File

@ -573,12 +573,9 @@ static void Ctr_Configuration (bool PrintView)
{
/* Form to change centre WWW */
Frm_StartForm (ActChgCtrWWWCfg);
fprintf (Gbl.F.Out,"<input type=\"url\" id=\"WWW\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
HTM_INPUT_URL ("WWW",Gbl.Hierarchy.Ctr.WWW,
"class=\"INPUT_WWW\""
" onchange=\"document.getElementById('%s').submit();\" />",
Cns_MAX_CHARS_WWW,
Gbl.Hierarchy.Ctr.WWW,
" onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
Frm_EndForm ();
}
@ -1589,11 +1586,10 @@ static void Ctr_ListCentresForEdition (void)
{
Frm_StartForm (ActChgCtrWWW);
Ctr_PutParamOtherCtrCod (Ctr->CtrCod);
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
HTM_INPUT_URL ("WWW",Ctr->WWW,
"class=\"INPUT_WWW\""
" onchange=\"document.getElementById('%s').submit();\" />",
Cns_MAX_CHARS_WWW,Ctr->WWW,Gbl.Form.Id);
" onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
Frm_EndForm ();
}
else
@ -2551,11 +2547,8 @@ static void Ctr_PutFormToCreateCentre (void)
/***** Centre WWW *****/
HTM_TD_Begin ("class=\"LM\"");
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
" class=\"INPUT_WWW\""
" required=\"required\" />",
Cns_MAX_CHARS_WWW,Ctr_EditingCtr->WWW);
HTM_INPUT_URL ("WWW",Ctr_EditingCtr->WWW,
"class=\"INPUT_WWW\" required=\"required\"");
HTM_TD_End ();
/***** Number of users who claim to belong to this centre *****/

View File

@ -487,14 +487,15 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.51.8 (2019-11-04)"
#define Log_PLATFORM_VERSION "SWAD 19.51.9 (2019-11-04)"
#define CSS_FILE "swad19.47.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.
// TODO: Importante: filtrar proyectos por usuarios (igual que en trabajos o en asistencia)
*
Version 19.51.9: Nov 04, 2019 Code refactoring in HTML inputs. (245974 lines)
Version 19.51.8: Nov 04, 2019 Code refactoring in HTML inputs. (245968 lines)
Version 19.51.7: Nov 03, 2019 Code refactoring in HTML inputs. (246051 lines)
Version 19.51.6: Nov 03, 2019 Code refactoring in HTML inputs. (246125 lines)

View File

@ -1685,12 +1685,10 @@ static void Cty_ListCountriesForEdition (void)
Frm_StartForm (ActChgCtyWWW);
Cty_PutParamOtherCtyCod (Cty->CtyCod);
Par_PutHiddenParamUnsigned (NULL,"Lan",(unsigned) Lan);
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
HTM_INPUT_URL ("WWW",Cty->WWW[Lan],
"class=\"INPUT_WWW\""
" onchange=\"document.getElementById('%s').submit();\" />",
Cns_MAX_CHARS_WWW,
Cty->WWW[Lan],Gbl.Form.Id);
" onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
Frm_EndForm ();
HTM_TD_End ();
@ -2111,12 +2109,11 @@ static void Cty_PutFormToCreateCountry (void)
/* WWW */
HTM_TD_Begin ("class=\"LM\"");
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW_%s\""
" maxlength=\"%u\" value=\"%s\""
" class=\"INPUT_WWW\" />",
Lan_STR_LANG_ID[Lan],
Cns_MAX_CHARS_WWW,
Cty_EditingCty->WWW[Lan]);
snprintf (StrName,sizeof (StrName),
"WWW_%s",
Lan_STR_LANG_ID[Lan]);
HTM_INPUT_URL (StrName,Cty_EditingCty->WWW[Lan],
"class=\"INPUT_WWW\"");
HTM_TD_End ();
HTM_TR_End ();

View File

@ -453,12 +453,9 @@ static void Deg_Configuration (bool PrintView)
{
/* Form to change degree WWW */
Frm_StartForm (ActChgDegWWWCfg);
fprintf (Gbl.F.Out,"<input type=\"url\" id=\"WWW\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
HTM_INPUT_URL ("WWW",Gbl.Hierarchy.Deg.WWW,
"class=\"INPUT_WWW\""
" onchange=\"document.getElementById('%s').submit();\" />",
Cns_MAX_CHARS_WWW,
Gbl.Hierarchy.Deg.WWW,
" onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
Frm_EndForm ();
}
@ -813,11 +810,10 @@ static void Deg_ListDegreesForEdition (void)
{
Frm_StartForm (ActChgDegWWW);
Deg_PutParamOtherDegCod (Deg->DegCod);
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
HTM_INPUT_URL ("WWW",Deg->WWW,
"class=\"INPUT_WWW\""
" onchange=\"document.getElementById('%s').submit();\" />",
Cns_MAX_CHARS_WWW,Deg->WWW,Gbl.Form.Id);
" onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
Frm_EndForm ();
}
else
@ -1003,11 +999,8 @@ static void Deg_PutFormToCreateDegree (void)
/***** Degree WWW *****/
HTM_TD_Begin ("class=\"LM\"");
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
" class=\"INPUT_WWW\""
" required=\"required\" />",
Cns_MAX_CHARS_WWW,Deg_EditingDeg->WWW);
HTM_INPUT_URL ("WWW",Deg_EditingDeg->WWW,
"class=\"INPUT_WWW\" required=\"required\"");
HTM_TD_End ();
/***** Current number of courses in this degree *****/

View File

@ -584,11 +584,10 @@ static void Dpt_ListDepartmentsForEdition (void)
HTM_TD_Begin ("class=\"CM\"");
Frm_StartForm (ActChgDptWWW);
Dpt_PutParamDptCod (Dpt->DptCod);
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
HTM_INPUT_URL ("WWW",Dpt->WWW,
"class=\"INPUT_WWW\""
" onchange=\"document.getElementById('%s').submit();\" />",
Cns_MAX_CHARS_WWW,Dpt->WWW,Gbl.Form.Id);
" onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
Frm_EndForm ();
HTM_TD_End ();
@ -955,11 +954,8 @@ static void Dpt_PutFormToCreateDepartment (void)
/***** Department WWW *****/
HTM_TD_Begin ("class=\"CM\"");
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
" class=\"INPUT_WWW\""
" required=\"required\" />",
Cns_MAX_CHARS_WWW,Dpt_EditingDpt->WWW);
HTM_INPUT_URL ("WWW",Dpt_EditingDpt->WWW,
"class=\"INPUT_WWW\" required=\"required\"");
HTM_TD_End ();
HTM_TR_End ();

View File

@ -8511,11 +8511,8 @@ static void Brw_PutFormToCreateALink (const char *FileNameToShow)
HTM_TD_End ();
HTM_TD_Begin ("class=\"LM\"");
fprintf (Gbl.F.Out,"<input type=\"url\""
" id=\"NewLinkURL\" name=\"NewLinkURL\""
" size=\"30\" maxlength=\"%u\" value=\"\""
" required=\"required\" />",
PATH_MAX);
HTM_INPUT_URL ("NewLinkURL","",
"size=\"30\" required=\"required\"");
HTM_TD_End ();
HTM_TR_End ();

View File

@ -1308,22 +1308,21 @@ void Inf_FormToSendURL (Inf_InfoSrc_t InfoSrc)
Frm_StartForm (Inf_ActionsInfo[InfoSrc][Gbl.Crs.Info.Type]);
/***** Link *****/
HTM_DIV_Begin ("class=\"CM\"");
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"%s:&nbsp;",Txt_URL);
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"InfoSrcURL\""
" size=\"50\" maxlength=\"256\" value=\"");
if ((FileURL = fopen (PathFile,"rb")) == NULL)
fprintf (Gbl.F.Out,"http://");
else
if ((FileURL = fopen (PathFile,"rb")) != NULL)
{
if (fgets (Gbl.Crs.Info.URL,Cns_MAX_BYTES_WWW,FileURL) == NULL)
Gbl.Crs.Info.URL[0] = '\0';
/* File is not needed now. Close it */
/* File is not longer needed. Close it */
fclose (FileURL);
fprintf (Gbl.F.Out,"%s",Gbl.Crs.Info.URL);
}
fprintf (Gbl.F.Out,"\" />");
else
Gbl.Crs.Info.URL[0] = '\0';
HTM_DIV_Begin ("class=\"CM\"");
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"%s:&nbsp;",Txt_URL);
HTM_INPUT_URL ("InfoSrcURL",Gbl.Crs.Info.URL,
"size=\"50\"");
HTM_LABEL_End ();
HTM_DIV_End ();

View File

@ -466,12 +466,9 @@ static void Ins_Configuration (bool PrintView)
{
/* Form to change institution WWW */
Frm_StartForm (ActChgInsWWWCfg);
fprintf (Gbl.F.Out,"<input type=\"url\" id=\"WWW\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
HTM_INPUT_URL ("WWW",Gbl.Hierarchy.Ins.WWW,
"class=\"INPUT_WWW\""
" onchange=\"document.getElementById('%s').submit();\" />",
Cns_MAX_CHARS_WWW,
Gbl.Hierarchy.Ins.WWW,
" onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
Frm_EndForm ();
}
@ -1527,12 +1524,9 @@ static void Ins_ListInstitutionsForEdition (void)
{
Frm_StartForm (ActChgInsWWW);
Ins_PutParamOtherInsCod (Ins->InsCod);
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
HTM_INPUT_URL ("WWW",Ins->WWW,
"class=\"INPUT_WWW\""
" onchange=\"document.getElementById('%s').submit();\" />",
Cns_MAX_CHARS_WWW,
Ins->WWW,
" onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
Frm_EndForm ();
HTM_TD_End ();
@ -2236,11 +2230,8 @@ static void Ins_PutFormToCreateInstitution (void)
/***** Institution WWW *****/
HTM_TD_Begin ("class=\"LM\"");
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
" class=\"INPUT_WWW\""
" required=\"required\" />",
Cns_MAX_CHARS_WWW,Ins_EditingIns->WWW);
HTM_INPUT_URL ("WWW",Ins_EditingIns->WWW,
"class=\"INPUT_WWW\" required=\"required\"");
HTM_TD_End ();
/***** Number of users who claim to belong to this institution ****/

View File

@ -462,11 +462,9 @@ static void Lnk_ListLinksForEdition (void)
HTM_TD_Begin ("class=\"CM\"");
Frm_StartForm (ActChgLnkWWW);
Lnk_PutParamLnkCod (Lnk->LnkCod);
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
HTM_INPUT_URL ("WWW",Lnk->WWW,
"class=\"INPUT_WWW\""
" onchange=\"document.getElementById('%s').submit();\" />",
Cns_MAX_CHARS_WWW,Lnk->WWW,
" onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
Frm_EndForm ();
HTM_TD_End ();
@ -763,11 +761,8 @@ static void Lnk_PutFormToCreateLink (void)
/***** Link WWW *****/
HTM_TD_Begin ("class=\"CM\"");
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"WWW\""
" maxlength=\"%u\" value=\"%s\""
" class=\"INPUT_WWW\""
" required=\"required\" />",
Cns_MAX_CHARS_WWW,Lnk_EditingLnk->WWW);
HTM_INPUT_URL ("WWW",Lnk_EditingLnk->WWW,
"class=\"INPUT_WWW\" required=\"required\"");
HTM_TD_End ();
HTM_TR_End ();

View File

@ -1394,10 +1394,8 @@ static void Mai_ShowFormChangeUsrEmail (const struct UsrData *UsrDat,bool ItsMe,
Frm_StartFormAnchor (NextAction,Mai_EMAIL_SECTION_ID);
Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod);
}
fprintf (Gbl.F.Out,"<input type=\"email\" id=\"NewEmail\" name=\"NewEmail\""
" size=\"18\" maxlength=\"%u\" value=\"%s\" />",
Cns_MAX_CHARS_EMAIL_ADDRESS,
Gbl.Usrs.Me.UsrDat.Email);
HTM_INPUT_EMAIL ("NewEmail",Cns_MAX_CHARS_EMAIL_ADDRESS,Gbl.Usrs.Me.UsrDat.Email,
"size=\"18\"");
fprintf (Gbl.F.Out,"<br />");
Btn_PutCreateButtonInline (NumEmails ? Txt_Change_email : // User already has an email address
Txt_Save_changes); // User has no email address yet

View File

@ -273,6 +273,7 @@ void Net_ShowFormMyWebsAndSocialNets (void)
Net_WebsAndSocialNetworks_t NumURL;
char URL[Cns_MAX_BYTES_WWW + 1];
char StrRecordWidth[10 + 1];
char StrName[32];
/***** Start section *****/
HTM_SECTION_Begin (Net_MY_WEBS_ID);
@ -330,11 +331,11 @@ void Net_ShowFormMyWebsAndSocialNets (void)
HTM_TD_End ();
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
fprintf (Gbl.F.Out,"<input type=\"url\" id=\"URL%u\" name=\"URL%u\""
" maxlength=\"%u\" value=\"%s\""
" class=\"REC_C2_BOT_INPUT\" />",
(unsigned) NumURL,(unsigned) NumURL,
Cns_MAX_CHARS_WWW,URL);
snprintf (StrName,sizeof (StrName),
"URL%u",
(unsigned) NumURL);
HTM_INPUT_URL ("WWW",StrName,
"class=\"REC_C2_BOT_INPUT\"");
HTM_TD_End ();
HTM_TR_End ();

View File

@ -470,10 +470,10 @@ static void Plg_ListPluginsForEdition (void)
HTM_TD_Begin ("class=\"CM\"");
Frm_StartForm (ActChgPlgURL);
Plg_PutParamPlgCod (Plg->PlgCod);
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"URL\""
" size=\"15\" maxlength=\"%u\" value=\"%s\""
" onchange=\"document.getElementById('%s').submit();\" />",
Cns_MAX_CHARS_WWW,Plg->URL,Gbl.Form.Id);
HTM_INPUT_URL ("URL",Plg->URL,
"size=\"15\""
" onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
Frm_EndForm ();
HTM_TD_End ();
@ -928,10 +928,8 @@ static void Plg_PutFormToCreatePlugin (void)
/***** Plugin URL *****/
HTM_TD_Begin ("class=\"CM\"");
fprintf (Gbl.F.Out,"<input type=\"url\" name=\"URL\""
" size=\"15\" maxlength=\"%u\" value=\"%s\""
" required=\"required\" />",
Cns_MAX_CHARS_WWW,Plg_EditingPlg->URL);
HTM_INPUT_URL ("URL",Plg_EditingPlg->URL,
"size=\"15\" required=\"required\"");
HTM_TD_End ();
/***** Plugin IP address *****/

View File

@ -3422,9 +3422,8 @@ static void Prj_PutFormProject (struct Project *Prj,bool ItsANewProject)
HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT LM\"");
fprintf (Gbl.F.Out,"<input type=\"url\" id=\"URL\" name=\"URL\""
" size=\"45\" maxlength=\"%u\" value=\"%s\" />",
Cns_MAX_CHARS_WWW,Prj->URL);
HTM_INPUT_URL ("URL",Prj->URL,
"size=\"45\"");
HTM_TD_End ();
HTM_TR_End ();