Version19.51.17

This commit is contained in:
Antonio Cañas Vargas 2019-11-04 18:17:39 +01:00
parent 36843ef246
commit 019285b91a
16 changed files with 202 additions and 202 deletions

View File

@ -972,7 +972,7 @@ void HTM_INPUT_PASSWORD (const char *Name,const char *PlaceHolder,
{ {
fprintf (Gbl.F.Out,"<input type=\"password\" id=\"%s\" name=\"%s\"" fprintf (Gbl.F.Out,"<input type=\"password\" id=\"%s\" name=\"%s\""
" size=\"18\" maxlength=\"%u\"", " size=\"18\" maxlength=\"%u\"",
Name,Name,Pwd_MIN_CHARS_PLAIN_PASSWORD); Name,Name,Pwd_MAX_CHARS_PLAIN_PASSWORD);
if (PlaceHolder) if (PlaceHolder)
if (PlaceHolder[0]) if (PlaceHolder[0])
fprintf (Gbl.F.Out," placeholder=\"%s\"",PlaceHolder); fprintf (Gbl.F.Out," placeholder=\"%s\"",PlaceHolder);
@ -995,6 +995,41 @@ void HTM_INPUT_NUMBER (const char *Name,long Min,long Max,long Value,bool Disabl
fprintf (Gbl.F.Out," />"); fprintf (Gbl.F.Out," />");
} }
void HTM_INPUT_RADIO (const char *Name,bool SubmitOnClick,
const char *fmt,...)
{
va_list ap;
int NumBytesPrinted;
char *Attr;
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"%s\"",Name);
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);
}
}
if (SubmitOnClick)
fprintf (Gbl.F.Out," onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
fprintf (Gbl.F.Out," />");
}
/*****************************************************************************/ /*****************************************************************************/
/********************************* Text areas ********************************/ /********************************* Text areas ********************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -103,6 +103,8 @@ void HTM_INPUT_IMAGE (const char *ImgFile,const char *Title,const char *Class);
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,bool Required);
void HTM_INPUT_NUMBER (const char *Name,long Min,long Max,long Value,bool Disabled); void HTM_INPUT_NUMBER (const char *Name,long Min,long Max,long Value,bool Disabled);
void HTM_INPUT_RADIO (const char *Name,bool SubmitOnClick,
const char *fmt,...);
void HTM_TEXTAREA_Begin (const char *fmt,...); void HTM_TEXTAREA_Begin (const char *fmt,...);
void HTM_TEXTAREA_End (void); void HTM_TEXTAREA_End (void);

View File

@ -487,7 +487,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD: En OpenSWAD:
ps2pdf source.ps destination.pdf ps2pdf source.ps destination.pdf
*/ */
#define Log_PLATFORM_VERSION "SWAD 19.51.16 (2019-11-04)" #define Log_PLATFORM_VERSION "SWAD 19.51.17 (2019-11-04)"
#define CSS_FILE "swad19.47.css" #define CSS_FILE "swad19.47.css"
#define JS_FILE "swad19.39.js" #define JS_FILE "swad19.39.js"
/* /*
@ -495,6 +495,7 @@ ps2pdf source.ps destination.pdf
// TODO: Impedir la creación y edición de proyectos si no son editables. // 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) // TODO: Importante: filtrar proyectos por usuarios (igual que en trabajos o en asistencia)
Version 19.51.17: Nov 04, 2019 Code refactoring in HTML inputs. (245887 lines)
Version 19.51.16: Nov 04, 2019 Code refactoring in HTML inputs. (245893 lines) Version 19.51.16: Nov 04, 2019 Code refactoring in HTML inputs. (245893 lines)
Version 19.51.15: Nov 04, 2019 Code refactoring in HTML inputs. (245874 lines) Version 19.51.15: Nov 04, 2019 Code refactoring in HTML inputs. (245874 lines)
Version 19.51.14: Nov 04, 2019 Code refactoring in HTML inputs. (245868 lines) Version 19.51.14: Nov 04, 2019 Code refactoring in HTML inputs. (245868 lines)

View File

@ -121,12 +121,10 @@ void Dat_PutBoxToSelectDateFormat (void)
HTM_LI_Begin ("class=\%s\"",(Format == Gbl.Prefs.DateFormat) ? "DAT_N LIGHT_BLUE" : HTM_LI_Begin ("class=\%s\"",(Format == Gbl.Prefs.DateFormat) ? "DAT_N LIGHT_BLUE" :
"DAT"); "DAT");
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"DateFormat\" value=\"%u\"", HTM_INPUT_RADIO ("DateFormat",true,
(unsigned) Format); " value=\"%u\"%s",
if (Format == Gbl.Prefs.DateFormat) (unsigned) Format,
fprintf (Gbl.F.Out," checked=\"checked\""); Format == Gbl.Prefs.DateFormat ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />",
Gbl.Form.Id);
Dat_PutSpanDateFormat (Format); Dat_PutSpanDateFormat (Format);
Dat_PutScriptDateFormat (Format); Dat_PutScriptDateFormat (Format);
HTM_LABEL_End (); HTM_LABEL_End ();

View File

@ -953,44 +953,37 @@ static void Enr_PutActionsRegRemSeveralUsrs (void)
if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected
{ {
HTM_LI_Begin (NULL); HTM_LI_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" id=\"RegRemAction%u\"" HTM_LABEL_Begin (NULL);
" name=\"RegRemAction\" value=\"%u\" checked=\"checked\" />", HTM_INPUT_RADIO ("RegRemAction",false,
(unsigned) Enr_REGISTER_SPECIFIED_USRS_IN_CRS, " value=\"%u\" checked=\"checked\"",
(unsigned) Enr_REGISTER_SPECIFIED_USRS_IN_CRS); (unsigned) Enr_REGISTER_SPECIFIED_USRS_IN_CRS);
HTM_LABEL_Begin ("for=\"RegRemAction%u\"",
(unsigned) Enr_REGISTER_SPECIFIED_USRS_IN_CRS);
fprintf (Gbl.F.Out,"%s",Txt_Register_the_users_indicated_in_step_1); fprintf (Gbl.F.Out,"%s",Txt_Register_the_users_indicated_in_step_1);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_LI_End (); HTM_LI_End ();
HTM_LI_Begin (NULL); HTM_LI_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" id=\"RegRemAction%u\"" HTM_LABEL_Begin (NULL);
" name=\"RegRemAction\" value=\"%u\" />", HTM_INPUT_RADIO ("RegRemAction",false,
(unsigned) Enr_REMOVE_SPECIFIED_USRS_FROM_CRS, " value=\"%u\"",
(unsigned) Enr_REMOVE_SPECIFIED_USRS_FROM_CRS); (unsigned) Enr_REMOVE_SPECIFIED_USRS_FROM_CRS);
HTM_LABEL_Begin ("for=\"RegRemAction%u\"",
(unsigned) Enr_REMOVE_SPECIFIED_USRS_FROM_CRS);
fprintf (Gbl.F.Out,"%s",Txt_Remove_the_users_indicated_in_step_1); fprintf (Gbl.F.Out,"%s",Txt_Remove_the_users_indicated_in_step_1);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_LI_End (); HTM_LI_End ();
HTM_LI_Begin (NULL); HTM_LI_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" id=\"RegRemAction%u\"" HTM_LABEL_Begin (NULL);
" name=\"RegRemAction\" value=\"%u\" />", HTM_INPUT_RADIO ("RegRemAction",false,
(unsigned) Enr_REMOVE_NOT_SPECIFIED_USRS_FROM_CRS, " value=\"%u\"",
(unsigned) Enr_REMOVE_NOT_SPECIFIED_USRS_FROM_CRS); (unsigned) Enr_REMOVE_NOT_SPECIFIED_USRS_FROM_CRS);
HTM_LABEL_Begin ("for=\"RegRemAction%u\"",
(unsigned) Enr_REMOVE_NOT_SPECIFIED_USRS_FROM_CRS);
fprintf (Gbl.F.Out,"%s",Txt_Remove_the_users_not_indicated_in_step_1); fprintf (Gbl.F.Out,"%s",Txt_Remove_the_users_not_indicated_in_step_1);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_LI_End (); HTM_LI_End ();
HTM_LI_Begin (NULL); HTM_LI_Begin (NULL);
fprintf (Gbl.F.Out,"<input id=\"RegRemAction%u\" type=\"radio\"" HTM_LABEL_Begin (NULL);
" name=\"RegRemAction\" value=\"%u\" />", HTM_INPUT_RADIO ("RegRemAction",false,
(unsigned) Enr_UPDATE_USRS_IN_CRS, " value=\"%u\"",
(unsigned) Enr_UPDATE_USRS_IN_CRS); (unsigned) Enr_UPDATE_USRS_IN_CRS);
HTM_LABEL_Begin ("for=\"RegRemAction%u\"",(unsigned) Enr_UPDATE_USRS_IN_CRS);
fprintf (Gbl.F.Out,"%s", fprintf (Gbl.F.Out,"%s",
Txt_Register_the_users_indicated_in_step_1_and_remove_the_users_not_indicated); Txt_Register_the_users_indicated_in_step_1_and_remove_the_users_not_indicated);
HTM_LABEL_End (); HTM_LABEL_End ();
@ -1001,12 +994,10 @@ static void Enr_PutActionsRegRemSeveralUsrs (void)
if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
{ {
HTM_LI_Begin (NULL); HTM_LI_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" id=\"RegRemAction%u\"" HTM_LABEL_Begin (NULL);
" name=\"RegRemAction\" value=\"%u\" />", HTM_INPUT_RADIO ("RegRemAction",false,
(unsigned) Enr_ELIMINATE_USRS_FROM_PLATFORM, " value=\"%u\"",
(unsigned) Enr_ELIMINATE_USRS_FROM_PLATFORM); (unsigned) Enr_ELIMINATE_USRS_FROM_PLATFORM);
HTM_LABEL_Begin ("for=\"RegRemAction%u\"",
(unsigned) Enr_ELIMINATE_USRS_FROM_PLATFORM);
fprintf (Gbl.F.Out,"%s", fprintf (Gbl.F.Out,"%s",
Txt_Eliminate_from_the_platform_the_users_indicated_in_step_1); Txt_Eliminate_from_the_platform_the_users_indicated_in_step_1);
HTM_LABEL_End (); HTM_LABEL_End ();
@ -1757,17 +1748,13 @@ static void Enr_StartRegRemOneUsrAction (Enr_RegRemOneUsrAction_t RegRemOneUsrAc
bool *OptionChecked) bool *OptionChecked)
{ {
HTM_LI_Begin (NULL); HTM_LI_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" id=\"RegRemAction%u\"" HTM_LABEL_Begin (NULL);
" name=\"RegRemAction\" value=\"%u\"", HTM_INPUT_RADIO ("RegRemAction",false,
(unsigned) RegRemOneUsrAction, "value=\"%u\"%s",
(unsigned) RegRemOneUsrAction); (unsigned) RegRemOneUsrAction,
*OptionChecked ? "" : " checked=\"checked\"");
if (!*OptionChecked) if (!*OptionChecked)
{
fprintf (Gbl.F.Out," checked=\"checked\"");
*OptionChecked = true; *OptionChecked = true;
}
fprintf (Gbl.F.Out," />");
HTM_LABEL_Begin ("for=\"RegRemAction%u\"",(unsigned) RegRemOneUsrAction);
} }
static void Enr_EndRegRemOneUsrAction (void) static void Enr_EndRegRemOneUsrAction (void)

View File

@ -3266,11 +3266,9 @@ static void Brw_FormToChangeCrsGrpZone (void)
HTM_LI_Begin ("class=\"%s\"",IsCourseZone ? "BROWSER_TITLE" : HTM_LI_Begin ("class=\"%s\"",IsCourseZone ? "BROWSER_TITLE" :
"BROWSER_TITLE_LIGHT"); "BROWSER_TITLE_LIGHT");
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"GrpCod\" value=\"-1\""); HTM_INPUT_RADIO ("GrpCod",true,
if (IsCourseZone) "value=\"-1\"%s",
fprintf (Gbl.F.Out," checked=\"checked\""); IsCourseZone ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />",
Gbl.Form.Id);
fprintf (Gbl.F.Out,"%s",Gbl.Hierarchy.Crs.FullName); fprintf (Gbl.F.Out,"%s",Gbl.Hierarchy.Crs.FullName);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_LI_End (); HTM_LI_End ();
@ -3297,12 +3295,11 @@ static void Brw_FormToChangeCrsGrpZone (void)
NULL, NULL,
"class=\"ICO25x25\" style=\"margin-left:6px;\""); "class=\"ICO25x25\" style=\"margin-left:6px;\"");
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"GrpCod\" value=\"%ld\"", HTM_INPUT_RADIO ("GrpCod",true,
GrpDat.GrpCod); "value=\"%ld\"%s",
if (IsGroupZone && GrpDat.GrpCod == Gbl.Crs.Grps.GrpCod) GrpDat.GrpCod,
fprintf (Gbl.F.Out," checked=\"checked\""); (IsGroupZone &&
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />", GrpDat.GrpCod == Gbl.Crs.Grps.GrpCod) ? " checked=\"checked\"" : "");
Gbl.Form.Id);
fprintf (Gbl.F.Out,"%s %s",GrpDat.GrpTypName,GrpDat.GrpName); fprintf (Gbl.F.Out,"%s %s",GrpDat.GrpTypName,GrpDat.GrpName);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_LI_End (); HTM_LI_End ();

View File

@ -1755,13 +1755,10 @@ static void For_PutFormWhichForums (void)
{ {
HTM_LI_Begin (NULL); HTM_LI_Begin (NULL);
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"ForumSet\"" HTM_INPUT_RADIO ("ForumSet",true,
" value=\"%u\"", "value=\"%u\"%s",
(unsigned) ForumSet); (unsigned) ForumSet,
if (ForumSet == Gbl.Forum.ForumSet) (ForumSet == Gbl.Forum.ForumSet) ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />",
Gbl.Form.Id);
fprintf (Gbl.F.Out,"%s",Txt_FORUM_WHICH_FORUM[ForumSet]); fprintf (Gbl.F.Out,"%s",Txt_FORUM_WHICH_FORUM[ForumSet]);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_LI_End (); HTM_LI_End ();

View File

@ -1918,6 +1918,7 @@ static bool Grp_ListGrpsForChangeMySelection (struct GroupType *GrpTyp,
bool IBelongToAClosedGroup; bool IBelongToAClosedGroup;
bool ICanChangeMySelectionForThisGrpTyp; bool ICanChangeMySelectionForThisGrpTyp;
bool ICanChangeMySelectionForThisGrp; bool ICanChangeMySelectionForThisGrp;
char StrGrpCod[32];
/***** Write heading *****/ /***** Write heading *****/
Grp_WriteGrpHead (GrpTyp); Grp_WriteGrpHead (GrpTyp);
@ -2009,28 +2010,6 @@ static bool Grp_ListGrpsForChangeMySelection (struct GroupType *GrpTyp,
else else
HTM_TD_Begin ("class=\"LM\""); HTM_TD_Begin ("class=\"LM\"");
if (Gbl.Usrs.Me.Role.Logged == Rol_STD && // If I am a student
!GrpTyp->MultipleEnrolment && // ...and the enrolment is single
GrpTyp->NumGrps > 1) // ...and there are more than one group
{
/* Put a radio item */
fprintf (Gbl.F.Out,"<input type=\"radio\""
" id=\"Grp%ld\" name=\"GrpCod%ld\" value=\"%ld\"",
Grp->GrpCod,GrpTyp->GrpTypCod,Grp->GrpCod);
if (!GrpTyp->MandatoryEnrolment) // If the enrolment is not mandatory, I can select no groups
fprintf (Gbl.F.Out," onclick=\"selectUnselectRadio(this,this.form.GrpCod%ld,%u)\"",
GrpTyp->GrpTypCod,GrpTyp->NumGrps);
}
else
/* Put a checkbox item */
fprintf (Gbl.F.Out,"<input type=\"checkbox\""
" id=\"Grp%ld\" name=\"GrpCod%ld\" value=\"%ld\"",
Grp->GrpCod,GrpTyp->GrpTypCod,Grp->GrpCod);
/* Group checked? */
if (IBelongToThisGroup)
fprintf (Gbl.F.Out," checked=\"checked\""); // Group selected
/* Selection disabled? */ /* Selection disabled? */
if (ICanChangeMySelectionForThisGrpTyp) // I can change my selection for this group type if (ICanChangeMySelectionForThisGrpTyp) // I can change my selection for this group type
{ {
@ -2050,11 +2029,51 @@ static bool Grp_ListGrpsForChangeMySelection (struct GroupType *GrpTyp,
else // I can not change my selection for this group type else // I can not change my selection for this group type
ICanChangeMySelectionForThisGrp = false; ICanChangeMySelectionForThisGrp = false;
if (!ICanChangeMySelectionForThisGrp) // I can not change my selection for this group snprintf (StrGrpCod,sizeof (StrGrpCod),
fprintf (Gbl.F.Out,IBelongToThisGroup ? " readonly" : // I can not unregister (disabled does not work because the value is not submitted) "GrpCod%ld",
" disabled=\"disabled\""); // I can not register GrpTyp->GrpTypCod);
if (Gbl.Usrs.Me.Role.Logged == Rol_STD && // If I am a student
!GrpTyp->MultipleEnrolment && // ...and the enrolment is single
GrpTyp->NumGrps > 1) // ...and there are more than one group
{
/* Put a radio item */
if (GrpTyp->MandatoryEnrolment)
HTM_INPUT_RADIO (StrGrpCod,false,
"id=\"Grp%ld\" value=\"%ld\"%s%s",
Grp->GrpCod,Grp->GrpCod,
IBelongToThisGroup ? " checked=\"checked\"" : "", // Group selected?
ICanChangeMySelectionForThisGrp ? "" :
IBelongToThisGroup ? " readonly" : // I can not unregister (disabled does not work because the value is not submitted)
" disabled=\"disabled\""); // I can not register
else // If the enrolment is not mandatory, I can select no groups
HTM_INPUT_RADIO (StrGrpCod,false,
"id=\"Grp%ld\" value=\"%ld\"%s%s"
" onclick=\"selectUnselectRadio(this,this.form.GrpCod%ld,%u)\"",
Grp->GrpCod,Grp->GrpCod,
IBelongToThisGroup ? " checked=\"checked\"" : "", // Group selected?
ICanChangeMySelectionForThisGrp ? "" :
IBelongToThisGroup ? " readonly" : // I can not unregister (disabled does not work because the value is not submitted)
" disabled=\"disabled\"", // I can not register
GrpTyp->GrpTypCod,GrpTyp->NumGrps);
}
else
{
/* Put a checkbox item */
fprintf (Gbl.F.Out,"<input type=\"checkbox\""
" id=\"Grp%ld\" name=\"GrpCod%ld\" value=\"%ld\"",
Grp->GrpCod,GrpTyp->GrpTypCod,Grp->GrpCod);
/* Group checked? */
if (IBelongToThisGroup)
fprintf (Gbl.F.Out," checked=\"checked\""); // Group selected
if (!ICanChangeMySelectionForThisGrp) // I can not change my selection for this group
fprintf (Gbl.F.Out,IBelongToThisGroup ? " readonly" : // I can not unregister (disabled does not work because the value is not submitted)
" disabled=\"disabled\""); // I can not register
fprintf (Gbl.F.Out," />");
}
fprintf (Gbl.F.Out," />");
HTM_TD_End (); HTM_TD_End ();
Grp_WriteRowGrp (Grp,IBelongToThisGroup); Grp_WriteRowGrp (Grp,IBelongToThisGroup);

View File

@ -1143,21 +1143,16 @@ void Inf_FormsToSelSendInfo (void)
else else
HTM_TD_Begin ("class=\"DAT LT\""); HTM_TD_Begin ("class=\"DAT LT\"");
Frm_StartForm (Inf_ActionsSelecInfoSrc[Gbl.Crs.Info.Type]); Frm_StartForm (Inf_ActionsSelecInfoSrc[Gbl.Crs.Info.Type]);
fprintf (Gbl.F.Out,"<input type=\"radio\""
" id=\"InfoSrc%u\" name=\"InfoSrc\" value=\"%u\"", HTM_INPUT_RADIO ("InfoSrc",InfoSrc != InfoSrcSelected &&
(unsigned) InfoSrc,(unsigned) InfoSrc); (InfoSrc == Inf_INFO_SRC_NONE ||
if (InfoSrc == InfoSrcSelected) InfoAvailable[InfoSrc]), // Info available for this source
fprintf (Gbl.F.Out," checked=\"checked\""); "id=\"InfoSrc%u\" value=\"%u\"%s",
else (unsigned) InfoSrc,(unsigned) InfoSrc,
{ InfoSrc == InfoSrcSelected ? " checked=\"checked\"" :
if (InfoSrc == Inf_INFO_SRC_NONE || (InfoSrc == Inf_INFO_SRC_NONE ||
InfoAvailable[InfoSrc]) // If no info available for this source InfoAvailable[InfoSrc]) ? "" : // Info available for this source
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\"", " disabled=\"disabled\"");
Gbl.Form.Id);
else
fprintf (Gbl.F.Out," disabled=\"disabled\"");
}
fprintf (Gbl.F.Out," />");
Frm_EndForm (); Frm_EndForm ();
HTM_TD_End (); HTM_TD_End ();

View File

@ -176,16 +176,11 @@ static void Pri_PutFormVisibility (const char *TxtLabel,
(Visibility == CurrentVisibilityInDB) ? "DAT_N LIGHT_BLUE" : (Visibility == CurrentVisibilityInDB) ? "DAT_N LIGHT_BLUE" :
"DAT"); "DAT");
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"%s\" value=\"%u\"", HTM_INPUT_RADIO (ParamName,Action != ActUnk,
ParamName,(unsigned) Visibility); "value=\"%u\"%s%s",
if (Visibility == CurrentVisibilityInDB) (unsigned) Visibility,
fprintf (Gbl.F.Out," checked=\"checked\""); Visibility == CurrentVisibilityInDB ? " checked=\"checked\"" : "",
if (Action == ActUnk) Action == ActUnk ? " disabled=\"disabled\"" : "");
fprintf (Gbl.F.Out," disabled=\"disabled\"");
else
fprintf (Gbl.F.Out," onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
fprintf (Gbl.F.Out," />");
fprintf (Gbl.F.Out,"%s",Txt_PRIVACY_OPTIONS[Visibility]); fprintf (Gbl.F.Out,"%s",Txt_PRIVACY_OPTIONS[Visibility]);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_LI_End (); HTM_LI_End ();

View File

@ -3120,11 +3120,10 @@ static void Rec_ShowRole (struct UsrData *UsrDat,
Sex++) Sex++)
{ {
HTM_LABEL_Begin ("class=\"REC_DAT_BOLD\""); HTM_LABEL_Begin ("class=\"REC_DAT_BOLD\"");
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"Sex\" value=\"%u\"", HTM_INPUT_RADIO ("Sex",false,
(unsigned) Sex); "value=\"%u\"%s required=\"required\"",
if (Sex == Gbl.Usrs.Me.UsrDat.Sex) (unsigned) Sex,
fprintf (Gbl.F.Out," checked=\"checked\""); Sex == Gbl.Usrs.Me.UsrDat.Sex ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," required=\"required\" />");
fprintf (Gbl.F.Out,"%s %s",Usr_StringsSexIcons[Sex],Txt_SEX_SINGULAR_Abc[Sex]); fprintf (Gbl.F.Out,"%s %s",Usr_StringsSexIcons[Sex],Txt_SEX_SINGULAR_Abc[Sex]);
HTM_LABEL_End (); HTM_LABEL_End ();
} }

View File

@ -409,12 +409,10 @@ void Sta_AskShowCrsHits (void)
Gbl.Stat.ClicksGroupedBy != Sta_CLICKS_CRS_DETAILED_LIST) Gbl.Stat.ClicksGroupedBy != Sta_CLICKS_CRS_DETAILED_LIST)
Gbl.Stat.ClicksGroupedBy = Sta_CLICKS_GROUPED_BY_DEFAULT; Gbl.Stat.ClicksGroupedBy = Sta_CLICKS_GROUPED_BY_DEFAULT;
fprintf (Gbl.F.Out,"<input type=\"radio\"" HTM_INPUT_RADIO ("GroupedOrDetailed",false,
" name=\"GroupedOrDetailed\" value=\"%u\"", "value=\"%u\"%s onclick=\"disableDetailedClicks();\"",
(unsigned) Sta_CLICKS_GROUPED); (unsigned) Sta_CLICKS_GROUPED,
if (Gbl.Stat.ClicksGroupedBy != Sta_CLICKS_CRS_DETAILED_LIST) Gbl.Stat.ClicksGroupedBy == Sta_CLICKS_CRS_DETAILED_LIST ? "" : " checked=\"checked\"");
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," onclick=\"disableDetailedClicks()\" />");
/* Selection of count type (number of pages generated, accesses per user, etc.) */ /* Selection of count type (number of pages generated, accesses per user, etc.) */
Sta_WriteSelectorCountType (); Sta_WriteSelectorCountType ();
@ -441,12 +439,10 @@ void Sta_AskShowCrsHits (void)
/***** Option b) Listing of detailed clicks to this course *****/ /***** Option b) Listing of detailed clicks to this course *****/
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\"" HTM_INPUT_RADIO ("GroupedOrDetailed",false,
" name=\"GroupedOrDetailed\" value=\"%u\"", "value=\"%u\"%s onclick=\"enableDetailedClicks();\"",
(unsigned) Sta_CLICKS_DETAILED); (unsigned) Sta_CLICKS_DETAILED,
if (Gbl.Stat.ClicksGroupedBy == Sta_CLICKS_CRS_DETAILED_LIST) Gbl.Stat.ClicksGroupedBy == Sta_CLICKS_CRS_DETAILED_LIST ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," onclick=\"enableDetailedClicks()\" />");
fprintf (Gbl.F.Out,"%s", fprintf (Gbl.F.Out,"%s",
Txt_STAT_CLICKS_GROUPED_BY[Sta_CLICKS_CRS_DETAILED_LIST]); Txt_STAT_CLICKS_GROUPED_BY[Sta_CLICKS_CRS_DETAILED_LIST]);
HTM_LABEL_End (); HTM_LABEL_End ();

View File

@ -2748,11 +2748,10 @@ static void Svy_ShowFormEditOneQst (long SvyCod,struct SurveyQuestion *SvyQst,
AnsType++) AnsType++)
{ {
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"AnswerType\" value=\"%u\"", HTM_INPUT_RADIO ("AnswerType",false,
(unsigned) AnsType); "value=\"%u\"%s",
if (AnsType == SvyQst->AnswerType) (unsigned) AnsType,
fprintf (Gbl.F.Out," checked=\"checked\""); AnsType == SvyQst->AnswerType ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," />");
fprintf (Gbl.F.Out,"%s",Txt_SURVEY_STR_ANSWER_TYPES[AnsType]); fprintf (Gbl.F.Out,"%s",Txt_SURVEY_STR_ANSWER_TYPES[AnsType]);
HTM_LABEL_End (); HTM_LABEL_End ();
fprintf (Gbl.F.Out,"<br />"); fprintf (Gbl.F.Out,"<br />");

View File

@ -150,12 +150,10 @@ void Syl_PutFormWhichSyllabus (void)
{ {
HTM_LI_Begin ("class=\"DAT LM\""); HTM_LI_Begin ("class=\"DAT LM\"");
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"WhichSyllabus\" value=\"%u\"", HTM_INPUT_RADIO ("WhichSyllabus",true,
(unsigned) WhichSyllabus); "value=\"%u\"%s",
if (WhichSyllabus == Gbl.Syllabus.WhichSyllabus) (unsigned) WhichSyllabus,
fprintf (Gbl.F.Out," checked=\"checked\""); WhichSyllabus == Gbl.Syllabus.WhichSyllabus ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />",
Gbl.Form.Id);
fprintf (Gbl.F.Out,"%s",Txt_SYLLABUS_WHICH_SYLLABUS[WhichSyllabus]); fprintf (Gbl.F.Out,"%s",Txt_SYLLABUS_WHICH_SYLLABUS[WhichSyllabus]);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_LI_End (); HTM_LI_End ();

View File

@ -1132,23 +1132,20 @@ static void Tst_PutFormToEditQstMedia (struct Media *Media,int NumMediaInForm,
/***** Choice 1: No media *****/ /***** Choice 1: No media *****/
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"%s\" value=\"%u\"", HTM_INPUT_RADIO (ParamUploadMedia.Action,false,
ParamUploadMedia.Action,Med_ACTION_NO_MEDIA); "value=\"%u\"%s",
if (OptionsDisabled) (unsigned) Med_ACTION_NO_MEDIA,
fprintf (Gbl.F.Out," disabled=\"disabled\""); OptionsDisabled ? " disabled=\"disabled\"" : "");
fprintf (Gbl.F.Out," />");
fprintf (Gbl.F.Out,"%s",Txt_No_image_video); fprintf (Gbl.F.Out,"%s",Txt_No_image_video);
HTM_LABEL_End (); HTM_LABEL_End ();
fprintf (Gbl.F.Out,"<br />"); fprintf (Gbl.F.Out,"<br />");
/***** Choice 2: Current media *****/ /***** Choice 2: Current media *****/
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"%s\" value=\"%u\"" HTM_INPUT_RADIO (ParamUploadMedia.Action,false,
" checked=\"checked\"", "value=\"%u\"%s checked=\"checked\"",
ParamUploadMedia.Action,Med_ACTION_KEEP_MEDIA); (unsigned) Med_ACTION_KEEP_MEDIA,
if (OptionsDisabled) OptionsDisabled ? " disabled=\"disabled\"" : "");
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," />");
fprintf (Gbl.F.Out,"%s",Txt_Current_image_video); fprintf (Gbl.F.Out,"%s",Txt_Current_image_video);
HTM_LABEL_End (); HTM_LABEL_End ();
Med_ShowMedia (Media, Med_ShowMedia (Media,
@ -1158,13 +1155,11 @@ static void Tst_PutFormToEditQstMedia (struct Media *Media,int NumMediaInForm,
/***** Choice 3: Change media *****/ /***** Choice 3: Change media *****/
UniqueId++; UniqueId++;
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"<input type=\"radio\" id=\"chg_img_%u\" name=\"%s\"" HTM_INPUT_RADIO (ParamUploadMedia.Action,false,
" value=\"%u\"", "id=\"chg_img_%u\" value=\"%u\"%s",
UniqueId,ParamUploadMedia.Action, UniqueId,
Med_ACTION_NEW_MEDIA); // Replace existing image by new image (unsigned) Med_ACTION_NEW_MEDIA,
if (OptionsDisabled) OptionsDisabled ? " disabled=\"disabled\"" : "");
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," />");
fprintf (Gbl.F.Out,"%s: ",Txt_Change_image_video); fprintf (Gbl.F.Out,"%s: ",Txt_Change_image_video);
HTM_LABEL_End (); HTM_LABEL_End ();
Med_PutMediaUploader (NumMediaInForm,"TEST_MED_INPUT"); Med_PutMediaUploader (NumMediaInForm,"TEST_MED_INPUT");
@ -1907,11 +1902,10 @@ static void Tst_ShowFormConfigTst (void)
Pluggable++) Pluggable++)
{ {
HTM_LABEL_Begin ("class=\"DAT\""); HTM_LABEL_Begin ("class=\"DAT\"");
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"Pluggable\" value=\"%u\"", HTM_INPUT_RADIO ("Pluggable",false,
(unsigned) Pluggable); "value=\"%u\"%s",
if (Pluggable == Gbl.Test.Config.Pluggable) (unsigned) Pluggable,
fprintf (Gbl.F.Out," checked=\"checked\""); Pluggable == Gbl.Test.Config.Pluggable ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," />");
fprintf (Gbl.F.Out,"%s",Txt_TST_PLUGGABLE[Pluggable]); fprintf (Gbl.F.Out,"%s",Txt_TST_PLUGGABLE[Pluggable]);
HTM_LABEL_End (); HTM_LABEL_End ();
fprintf (Gbl.F.Out,"<br />"); fprintf (Gbl.F.Out,"<br />");
@ -1973,11 +1967,10 @@ static void Tst_ShowFormConfigTst (void)
Feedback++) Feedback++)
{ {
HTM_LABEL_Begin ("class=\"DAT\""); HTM_LABEL_Begin ("class=\"DAT\"");
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"Feedback\" value=\"%u\"", HTM_INPUT_RADIO ("Feedback",false,
(unsigned) Feedback); "value=\"%u\"%s",
if (Feedback == Gbl.Test.Config.Feedback) (unsigned) Feedback,
fprintf (Gbl.F.Out," checked=\"checked\""); Feedback == Gbl.Test.Config.Feedback ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," />");
fprintf (Gbl.F.Out,"%s",Txt_TST_STR_FEEDBACK[Feedback]); fprintf (Gbl.F.Out,"%s",Txt_TST_STR_FEEDBACK[Feedback]);
HTM_LABEL_End (); HTM_LABEL_End ();
fprintf (Gbl.F.Out,"<br />"); fprintf (Gbl.F.Out,"<br />");
@ -5182,11 +5175,10 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
AnsType++) AnsType++)
{ {
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"AnswerType\" value=\"%u\"", HTM_INPUT_RADIO ("AnswerType",false,
(unsigned) AnsType); "value=\"%u\"%s onclick=\"enableDisableAns(this.form);\"",
if (AnsType == Gbl.Test.AnswerType) (unsigned) AnsType,
fprintf (Gbl.F.Out," checked=\"checked\""); AnsType == Gbl.Test.AnswerType ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," onclick=\"enableDisableAns(this.form);\" />");
fprintf (Gbl.F.Out,"%s&nbsp;",Txt_TST_STR_ANSWER_TYPES[AnsType]); fprintf (Gbl.F.Out,"%s&nbsp;",Txt_TST_STR_ANSWER_TYPES[AnsType]);
HTM_LABEL_End (); HTM_LABEL_End ();
fprintf (Gbl.F.Out,"<br />"); fprintf (Gbl.F.Out,"<br />");
@ -5287,15 +5279,12 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
HTM_TD_Begin ("class=\"TEST_EDI_ANS_LEFT_COL COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"TEST_EDI_ANS_LEFT_COL COLOR%u\"",Gbl.RowEvenOdd);
/* Radio selector for unique choice answers */ /* Radio selector for unique choice answers */
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"AnsUni\" value=\"%u\"", HTM_INPUT_RADIO ("AnsUni",false,
NumOpt); "value=\"%u\"%s%s%s onclick=\"enableDisableAns(this.form);\"",
if (Gbl.Test.AnswerType != Tst_ANS_UNIQUE_CHOICE) NumOpt,
fprintf (Gbl.F.Out," disabled=\"disabled\""); Gbl.Test.Answer.Options[NumOpt].Correct ? " checked=\"checked\"" : "",
if (Gbl.Test.Answer.Options[NumOpt].Correct) NumOpt < 2 ? " required=\"required\"" : "", // First or second options required
fprintf (Gbl.F.Out," checked=\"checked\""); Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE ? "" : " disabled=\"disabled\"");
if (NumOpt < 2) // First or second options required
fprintf (Gbl.F.Out," required=\"required\"");
fprintf (Gbl.F.Out," />");
/* Checkbox for multiple choice answers */ /* Checkbox for multiple choice answers */
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"AnsMulti\" value=\"%u\"", fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"AnsMulti\" value=\"%u\"",
@ -5430,12 +5419,11 @@ static void Tst_PutTFInputField (const char *Label,char Value)
extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *The_ClassFormInBox[The_NUM_THEMES];
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"<input type=\"radio\" name=\"AnsTF\" value=\"%c\"",Value); HTM_INPUT_RADIO ("AnsTF",false,
if (Gbl.Test.Answer.TF == Value) "value=\"%c\"%s%s required=\"required\"",
fprintf (Gbl.F.Out," checked=\"checked\""); Value,
if (Gbl.Test.AnswerType != Tst_ANS_TRUE_FALSE) Gbl.Test.Answer.TF == Value ? " checked=\"checked\"" : "",
fprintf (Gbl.F.Out," disabled=\"disabled\""); Gbl.Test.AnswerType == Tst_ANS_TRUE_FALSE ? "" : " disabled=\"disabled\"");
fprintf (Gbl.F.Out," required=\"required\" />");
fprintf (Gbl.F.Out,"%s",Label); fprintf (Gbl.F.Out,"%s",Label);
HTM_LABEL_End (); HTM_LABEL_End ();
} }

View File

@ -8343,19 +8343,13 @@ static void Usr_ShowOneListUsrsOption (Usr_ListUsrsOption_t ListUsrsAction,
const char *Label) const char *Label)
{ {
HTM_LI_Begin (NULL); HTM_LI_Begin (NULL);
HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"radio\" id=\"ListUsrsAction%u\"" HTM_INPUT_RADIO ("ListUsrsAction",false,
" name=\"ListUsrsAction\" value=\"%u\"", "value=\"%u\"%s",
(unsigned) ListUsrsAction, (unsigned) ListUsrsAction,
(unsigned) ListUsrsAction); ListUsrsAction == Gbl.Usrs.Selected.Option ? " checked=\"checked\"" : "");
if (ListUsrsAction == Gbl.Usrs.Selected.Option)
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," />");
HTM_LABEL_Begin ("for=\"ListUsrsAction%u\"",(unsigned) ListUsrsAction);
fprintf (Gbl.F.Out,"%s",Label); fprintf (Gbl.F.Out,"%s",Label);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_LI_End (); HTM_LI_End ();
} }