mirror of https://github.com/acanas/swad-core.git
Version 23.79.1: Apr 24, 2024 Code refactoring in HTML related to required field in form.
This commit is contained in:
parent
98a7747d18
commit
a58aa9cd19
|
@ -1333,7 +1333,7 @@ void HTM_INPUT_IMAGE (const char *URL,const char *Icon,const char *Title,
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTM_INPUT_PASSWORD (const char *Name,const char *PlaceHolder,
|
void HTM_INPUT_PASSWORD (const char *Name,const char *PlaceHolder,
|
||||||
const char *AutoComplete,bool Required,
|
const char *AutoComplete,HTM_Required_t Required,
|
||||||
const char *fmt,...)
|
const char *fmt,...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -1348,7 +1348,7 @@ void HTM_INPUT_PASSWORD (const char *Name,const char *PlaceHolder,
|
||||||
if (AutoComplete)
|
if (AutoComplete)
|
||||||
if (AutoComplete[0])
|
if (AutoComplete[0])
|
||||||
HTM_TxtF (" autocomplete=\"%s\"",AutoComplete);
|
HTM_TxtF (" autocomplete=\"%s\"",AutoComplete);
|
||||||
if (Required)
|
if (Required == HTM_REQUIRED)
|
||||||
HTM_Txt (" required=\"required\"");
|
HTM_Txt (" required=\"required\"");
|
||||||
|
|
||||||
if (fmt)
|
if (fmt)
|
||||||
|
|
|
@ -52,6 +52,13 @@ typedef enum
|
||||||
HTM_SUBMIT_ON_CLICK,
|
HTM_SUBMIT_ON_CLICK,
|
||||||
} HTM_SubmitOnClick_t;
|
} HTM_SubmitOnClick_t;
|
||||||
|
|
||||||
|
#define HTM_NUM_REQUIRED 2
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
HTM_NOT_REQUIRED,
|
||||||
|
HTM_REQUIRED,
|
||||||
|
} HTM_Required_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
HTM_OPTION_UNSELECTED,
|
HTM_OPTION_UNSELECTED,
|
||||||
|
@ -175,7 +182,7 @@ 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,
|
void HTM_INPUT_IMAGE (const char *URL,const char *Icon,const char *Title,
|
||||||
const char *fmt,...);
|
const char *fmt,...);
|
||||||
void HTM_INPUT_PASSWORD (const char *Name,const char *PlaceHolder,
|
void HTM_INPUT_PASSWORD (const char *Name,const char *PlaceHolder,
|
||||||
const char *AutoComplete,bool Required,
|
const char *AutoComplete,HTM_Required_t Required,
|
||||||
const char *fmt,...);
|
const char *fmt,...);
|
||||||
void HTM_INPUT_LONG (const char *Name,long Min,long Max,long Value,
|
void HTM_INPUT_LONG (const char *Name,long Min,long Max,long Value,
|
||||||
HTM_SubmitOnChange_t SubmitOnChange,bool Disabled,
|
HTM_SubmitOnChange_t SubmitOnChange,bool Disabled,
|
||||||
|
|
|
@ -637,6 +637,7 @@ Me sale este error, no s
|
||||||
#define CSS_FILE "swad23.67.2.css"
|
#define CSS_FILE "swad23.67.2.css"
|
||||||
#define JS_FILE "swad23.79.js"
|
#define JS_FILE "swad23.79.js"
|
||||||
/*
|
/*
|
||||||
|
Version 23.79.1: Apr 24, 2024 Code refactoring in HTML related to required field in form. (335751 lines)
|
||||||
Version 23.79: Apr 24, 2024 Code refactoring writing dates. (335741 lines)
|
Version 23.79: Apr 24, 2024 Code refactoring writing dates. (335741 lines)
|
||||||
Version 23.78: Apr 23, 2024 Code refactoring in list of actions. (335577 lines)
|
Version 23.78: Apr 23, 2024 Code refactoring in list of actions. (335577 lines)
|
||||||
Version 23.77: Apr 19, 2024 Code refactoring in list of actions. (335567 lines)
|
Version 23.77: Apr 19, 2024 Code refactoring in list of actions. (335567 lines)
|
||||||
|
|
|
@ -620,7 +620,7 @@ void Pwd_ShowFormChgMyPwd (void)
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"Frm_C2 LM\"");
|
HTM_TD_Begin ("class=\"Frm_C2 LM\"");
|
||||||
HTM_INPUT_PASSWORD ("UsrPwd",NULL,"off",
|
HTM_INPUT_PASSWORD ("UsrPwd",NULL,"off",
|
||||||
true, // Required
|
HTM_REQUIRED,
|
||||||
"id=\"UsrPwd\""
|
"id=\"UsrPwd\""
|
||||||
" class=\"Frm_C2_INPUT INPUT_%s\"",
|
" class=\"Frm_C2_INPUT INPUT_%s\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
|
@ -670,7 +670,7 @@ void Pwd_PutFormToGetNewPasswordOnce (void)
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"Frm_C2 LM\"");
|
HTM_TD_Begin ("class=\"Frm_C2 LM\"");
|
||||||
HTM_INPUT_PASSWORD ("Paswd",Txt_HELP_password,NULL,
|
HTM_INPUT_PASSWORD ("Paswd",Txt_HELP_password,NULL,
|
||||||
true, // Required
|
HTM_REQUIRED,
|
||||||
"id=\"Paswd\" class=\"REC_C2_BOT_INPUT INPUT_%s\"",
|
"id=\"Paswd\" class=\"REC_C2_BOT_INPUT INPUT_%s\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
|
|
||||||
|
@ -698,7 +698,7 @@ void Pwd_PutFormToGetNewPasswordTwice (void)
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"Frm_C2 LM\"");
|
HTM_TD_Begin ("class=\"Frm_C2 LM\"");
|
||||||
HTM_INPUT_PASSWORD ("Paswd1",Txt_HELP_password,NULL,
|
HTM_INPUT_PASSWORD ("Paswd1",Txt_HELP_password,NULL,
|
||||||
true, // Required
|
HTM_REQUIRED,
|
||||||
"id=\"Paswd1\" class=\"Frm_C2_INPUT INPUT_%s\"",
|
"id=\"Paswd1\" class=\"Frm_C2_INPUT INPUT_%s\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -714,7 +714,7 @@ void Pwd_PutFormToGetNewPasswordTwice (void)
|
||||||
/* Data */
|
/* Data */
|
||||||
HTM_TD_Begin ("class=\"Frm_C2 LM\"");
|
HTM_TD_Begin ("class=\"Frm_C2 LM\"");
|
||||||
HTM_INPUT_PASSWORD ("Paswd2",Txt_HELP_password,NULL,
|
HTM_INPUT_PASSWORD ("Paswd2",Txt_HELP_password,NULL,
|
||||||
true, // Required
|
HTM_REQUIRED,
|
||||||
"id=\"Paswd2\" class=\"Frm_C2_INPUT INPUT_%s\"",
|
"id=\"Paswd2\" class=\"Frm_C2_INPUT INPUT_%s\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
@ -799,7 +799,7 @@ void Pwd_AskForConfirmationOnDangerousAction (void)
|
||||||
HTM_LABEL_Begin ("class=\"FORM_IN_%s\"",The_GetSuffix ());
|
HTM_LABEL_Begin ("class=\"FORM_IN_%s\"",The_GetSuffix ());
|
||||||
HTM_TxtColonNBSP (Txt_For_security_enter_your_password);
|
HTM_TxtColonNBSP (Txt_For_security_enter_your_password);
|
||||||
HTM_INPUT_PASSWORD ("OthUsrPwd",NULL,"off",
|
HTM_INPUT_PASSWORD ("OthUsrPwd",NULL,"off",
|
||||||
true, // Required
|
HTM_REQUIRED,
|
||||||
"class=\"INPUT_%s\"",
|
"class=\"INPUT_%s\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
|
|
|
@ -300,7 +300,7 @@ static void Prj_ReqCreatOrEditPrj (struct Prj_Projects *Projects);
|
||||||
static void Prj_PutFormProject (struct Prj_Projects *Projects,bool ItsANewProject);
|
static void Prj_PutFormProject (struct Prj_Projects *Projects,bool ItsANewProject);
|
||||||
static void Prj_EditOneProjectTxtArea (const char *Id,
|
static void Prj_EditOneProjectTxtArea (const char *Id,
|
||||||
const char *Label,char *TxtField,
|
const char *Label,char *TxtField,
|
||||||
unsigned NumRows,bool Required);
|
unsigned NumRows,HTM_Required_t Required);
|
||||||
|
|
||||||
static void Prj_CreateProject (struct Prj_Project *Prj);
|
static void Prj_CreateProject (struct Prj_Project *Prj);
|
||||||
static void Prj_UpdateProject (struct Prj_Project *Prj);
|
static void Prj_UpdateProject (struct Prj_Project *Prj);
|
||||||
|
@ -3901,17 +3901,17 @@ static void Prj_PutFormProject (struct Prj_Projects *Projects,
|
||||||
/* Description of the project */
|
/* Description of the project */
|
||||||
Prj_EditOneProjectTxtArea ("Description",Txt_Description,
|
Prj_EditOneProjectTxtArea ("Description",Txt_Description,
|
||||||
Projects->Prj.Description,12,
|
Projects->Prj.Description,12,
|
||||||
true); // Required
|
HTM_REQUIRED);
|
||||||
|
|
||||||
/* Required knowledge to carry out the project */
|
/* Required knowledge to carry out the project */
|
||||||
Prj_EditOneProjectTxtArea ("Knowledge",Txt_Required_knowledge,
|
Prj_EditOneProjectTxtArea ("Knowledge",Txt_Required_knowledge,
|
||||||
Projects->Prj.Knowledge,4,
|
Projects->Prj.Knowledge,4,
|
||||||
false); // Not required
|
HTM_NOT_REQUIRED);
|
||||||
|
|
||||||
/* Required materials to carry out the project */
|
/* Required materials to carry out the project */
|
||||||
Prj_EditOneProjectTxtArea ("Materials",Txt_Required_materials,
|
Prj_EditOneProjectTxtArea ("Materials",Txt_Required_materials,
|
||||||
Projects->Prj.Materials,4,
|
Projects->Prj.Materials,4,
|
||||||
false); // Not required
|
HTM_NOT_REQUIRED);
|
||||||
|
|
||||||
/* URL for additional info */
|
/* URL for additional info */
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
@ -3952,8 +3952,14 @@ static void Prj_PutFormProject (struct Prj_Projects *Projects,
|
||||||
|
|
||||||
static void Prj_EditOneProjectTxtArea (const char *Id,
|
static void Prj_EditOneProjectTxtArea (const char *Id,
|
||||||
const char *Label,char *TxtField,
|
const char *Label,char *TxtField,
|
||||||
unsigned NumRows,bool Required)
|
unsigned NumRows,HTM_Required_t Required)
|
||||||
{
|
{
|
||||||
|
static const char *RequiredTxt[HTM_NUM_REQUIRED] =
|
||||||
|
{
|
||||||
|
[HTM_NOT_REQUIRED] = "",
|
||||||
|
[HTM_REQUIRED ] = " required=\"required\"",
|
||||||
|
};
|
||||||
|
|
||||||
/***** Description *****/
|
/***** Description *****/
|
||||||
HTM_TR_Begin (NULL);
|
HTM_TR_Begin (NULL);
|
||||||
|
|
||||||
|
@ -3965,9 +3971,7 @@ static void Prj_EditOneProjectTxtArea (const char *Id,
|
||||||
HTM_TEXTAREA_Begin ("id=\"%s\" name=\"%s\" rows=\"%u\""
|
HTM_TEXTAREA_Begin ("id=\"%s\" name=\"%s\" rows=\"%u\""
|
||||||
" class=\"Frm_C2_INPUT INPUT_%s\"%s",
|
" class=\"Frm_C2_INPUT INPUT_%s\"%s",
|
||||||
Id,Id,NumRows,
|
Id,Id,NumRows,
|
||||||
The_GetSuffix (),
|
The_GetSuffix (),RequiredTxt[Required]);
|
||||||
Required ? " required=\"required\"" :
|
|
||||||
"");
|
|
||||||
HTM_Txt (TxtField);
|
HTM_Txt (TxtField);
|
||||||
HTM_TEXTAREA_End ();
|
HTM_TEXTAREA_End ();
|
||||||
HTM_TD_End ();
|
HTM_TD_End ();
|
||||||
|
|
|
@ -1180,7 +1180,7 @@ void Usr_WriteFormLogin (Act_Action_t NextAction,void (*FuncPars) (void))
|
||||||
Txt_Password,"CONTEXT_ICO16x16");
|
Txt_Password,"CONTEXT_ICO16x16");
|
||||||
HTM_LABEL_End ();
|
HTM_LABEL_End ();
|
||||||
HTM_INPUT_PASSWORD ("UsrPwd",Txt_password,NULL,
|
HTM_INPUT_PASSWORD ("UsrPwd",Txt_password,NULL,
|
||||||
false, // Not required
|
HTM_NOT_REQUIRED,
|
||||||
"id=\"UsrPwd\" class=\"INPUT_%s\"",
|
"id=\"UsrPwd\" class=\"INPUT_%s\"",
|
||||||
The_GetSuffix ());
|
The_GetSuffix ());
|
||||||
HTM_DIV_End ();
|
HTM_DIV_End ();
|
||||||
|
|
Loading…
Reference in New Issue