Version19.51.18

This commit is contained in:
Antonio Cañas Vargas 2019-11-04 20:41:35 +01:00
parent 019285b91a
commit 023b977416
18 changed files with 315 additions and 280 deletions

View File

@ -833,6 +833,44 @@ void HTM_INPUT_TEXT (const char *Name,unsigned MaxLength,const char *Value,bool
fprintf (Gbl.F.Out," />"); fprintf (Gbl.F.Out," />");
} }
void HTM_INPUT_SEARCH (const char *Name,unsigned MaxLength,const char *Value,bool SubmitOnChange,
const char *fmt,...)
{
va_list ap;
int NumBytesPrinted;
char *Attr;
fprintf (Gbl.F.Out,"<input type=\"search\" 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);
}
}
if (SubmitOnChange)
fprintf (Gbl.F.Out," onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
fprintf (Gbl.F.Out," />");
}
void HTM_INPUT_TEL (const char *Name,const char *Value,bool SubmitOnChange, void HTM_INPUT_TEL (const char *Name,const char *Value,bool SubmitOnChange,
const char *fmt,...) const char *fmt,...)
{ {
@ -1030,6 +1068,41 @@ void HTM_INPUT_RADIO (const char *Name,bool SubmitOnClick,
fprintf (Gbl.F.Out," />"); fprintf (Gbl.F.Out," />");
} }
void HTM_INPUT_CHECKBOX (const char *Name,bool SubmitOnChange,
const char *fmt,...)
{
va_list ap;
int NumBytesPrinted;
char *Attr;
fprintf (Gbl.F.Out,"<input type=\"checkbox\" 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 (SubmitOnChange)
fprintf (Gbl.F.Out," onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
fprintf (Gbl.F.Out," />");
}
/*****************************************************************************/ /*****************************************************************************/
/********************************* Text areas ********************************/ /********************************* Text areas ********************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -91,6 +91,8 @@ void HTM_LABEL_End (void);
void HTM_INPUT_TEXT (const char *Name,unsigned MaxLength,const char *Value,bool SubmitOnChange, void HTM_INPUT_TEXT (const char *Name,unsigned MaxLength,const char *Value,bool SubmitOnChange,
const char *fmt,...); const char *fmt,...);
void HTM_INPUT_SEARCH (const char *Name,unsigned MaxLength,const char *Value,bool SubmitOnChange,
const char *fmt,...);
void HTM_INPUT_TEL (const char *Name,const char *Value,bool SubmitOnChange, void HTM_INPUT_TEL (const char *Name,const char *Value,bool SubmitOnChange,
const char *fmt,...); const char *fmt,...);
void HTM_INPUT_EMAIL (const char *Name,unsigned MaxLength,const char *Value, void HTM_INPUT_EMAIL (const char *Name,unsigned MaxLength,const char *Value,
@ -105,6 +107,8 @@ void HTM_INPUT_PASSWORD (const char *Name,const char *PlaceHolder,
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, void HTM_INPUT_RADIO (const char *Name,bool SubmitOnClick,
const char *fmt,...); const char *fmt,...);
void HTM_INPUT_CHECKBOX (const char *Name,bool SubmitOnChange,
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

@ -1266,11 +1266,10 @@ static void Asg_ShowLstGrpsToEditAssignment (long AsgCod)
HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\""); HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\"");
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"checkbox\" id=\"WholeCrs\"" HTM_INPUT_CHECKBOX ("WholeCrs",false,
" name=\"WholeCrs\" value=\"Y\""); "id=\"WholeCrs\" value=\"Y\"%s"
if (!Asg_CheckIfAsgIsAssociatedToGrps (AsgCod)) " onclick=\"uncheckChildren(this,'GrpCods')\"",
fprintf (Gbl.F.Out," checked=\"checked\""); Asg_CheckIfAsgIsAssociatedToGrps (AsgCod) ? "" : " checked=\"checked\"");
fprintf (Gbl.F.Out," onclick=\"uncheckChildren(this,'GrpCods')\" />");
fprintf (Gbl.F.Out,"%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName); fprintf (Gbl.F.Out,"%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();

View File

@ -1214,11 +1214,10 @@ static void Att_ShowLstGrpsToEditAttEvent (long AttCod)
HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\""); HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\"");
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"checkbox\" id=\"WholeCrs\"" HTM_INPUT_CHECKBOX ("WholeCrs",false,
" name=\"WholeCrs\" value=\"Y\""); "id=\"WholeCrs\" value=\"Y\"%s"
if (!Att_CheckIfAttEventIsAssociatedToGrps (AttCod)) " onclick=\"uncheckChildren(this,'GrpCods')\"",
fprintf (Gbl.F.Out," checked=\"checked\""); Att_CheckIfAttEventIsAssociatedToGrps (AttCod) ? "" : " checked=\"checked\"");
fprintf (Gbl.F.Out," onclick=\"uncheckChildren(this,'GrpCods')\" />");
fprintf (Gbl.F.Out,"%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName); fprintf (Gbl.F.Out,"%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();
@ -2089,14 +2088,11 @@ static void Att_WriteRowUsrToCallTheRoll (unsigned NumUsr,
/***** Checkbox to select user *****/ /***** Checkbox to select user *****/
HTM_TD_Begin ("class=\"CT COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"CT COLOR%u\"",Gbl.RowEvenOdd);
fprintf (Gbl.F.Out,"<input type=\"checkbox\"" HTM_INPUT_CHECKBOX ("UsrCodStd",false,
" id=\"Std%u\" name=\"UsrCodStd\" value=\"%s\"", "id=\"Std%u\" value=\"%s\"%s%s",
NumUsr,UsrDat->EncryptedUsrCod); NumUsr,UsrDat->EncryptedUsrCod,
if (Present) // This student has attended to the event? Present ? " checked=\"checked\"" : "",
fprintf (Gbl.F.Out," checked=\"checked\""); ICanChangeStdAttendance ? "" : " disabled=\"disabled\"");
if (!ICanChangeStdAttendance)
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," />");
HTM_TD_End (); HTM_TD_End ();
/***** Write number of student in the list *****/ /***** Write number of student in the list *****/
@ -3128,13 +3124,10 @@ static void Att_ListEventsToSelect (Att_TypeOfView_t TypeOfView)
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"DAT CT COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"DAT CT COLOR%u\"",Gbl.RowEvenOdd);
fprintf (Gbl.F.Out,"<input type=\"checkbox\"" HTM_INPUT_CHECKBOX ("AttCods",false,
" id=\"Att%u\" name=\"AttCods\" value=\"%ld\"", "id=\"Att%u\" value=\"%ld\"%s",
NumAttEvent, NumAttEvent,Gbl.AttEvents.Lst[NumAttEvent].AttCod,
Gbl.AttEvents.Lst[NumAttEvent].AttCod); Gbl.AttEvents.Lst[NumAttEvent].Selected ? " checked=\"checked\"" : "");
if (Gbl.AttEvents.Lst[NumAttEvent].Selected)
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," />");
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd);

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.17 (2019-11-04)" #define Log_PLATFORM_VERSION "SWAD 19.51.18 (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.18: Nov 04, 2019 Code refactoring in HTML inputs. (245912 lines)
Version 19.51.17: Nov 04, 2019 Code refactoring in HTML inputs. (245887 lines) 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)

View File

@ -81,13 +81,11 @@ void Coo_EditMyPrefsOnCookies (void)
"DAT"); "DAT");
/* Check box */ /* Check box */
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"checkbox\"" HTM_INPUT_CHECKBOX ("cookies",true,
" name=\"cookies\" value=\"Y\""); "value=\"Y\"%s",
if (Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies) Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," checked=\"checked\""); fprintf (Gbl.F.Out,"%s",
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />", Txt_Accept_third_party_cookies_to_view_multimedia_content_from_other_websites);
Gbl.Form.Id);
fprintf (Gbl.F.Out,"%s",Txt_Accept_third_party_cookies_to_view_multimedia_content_from_other_websites);
HTM_LABEL_End (); HTM_LABEL_End ();
/* End container */ /* End container */

View File

@ -454,18 +454,13 @@ static void Grp_PutCheckboxAllGrps (Grp_WhichGroups_t GroupsSelectableByStdsOrNE
} }
HTM_DIV_Begin ("class=\"CONTEXT_OPT\""); HTM_DIV_Begin ("class=\"CONTEXT_OPT\"");
fprintf (Gbl.F.Out,"<input type=\"checkbox\"" HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
" id=\"AllGroups\" name=\"AllGroups\" value=\"Y\""); HTM_INPUT_CHECKBOX ("AllGroups",false,
if (ICanSelUnselGroup) "value=\"Y\"%s",
{ ICanSelUnselGroup ? (Gbl.Usrs.ClassPhoto.AllGroups ? " checked=\"checked\""
if (Gbl.Usrs.ClassPhoto.AllGroups) " onclick=\"togglecheckChildren(this,'GrpCods')\"" :
fprintf (Gbl.F.Out," checked=\"checked\""); " onclick=\"togglecheckChildren(this,'GrpCods')\"") :
fprintf (Gbl.F.Out," onclick=\"togglecheckChildren(this,'GrpCods')\""); " disabled=\"disabled\"");
}
else
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," />");
HTM_LABEL_Begin ("for=\"AllGroups\" class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"&nbsp;%s",Txt_All_groups); fprintf (Gbl.F.Out,"&nbsp;%s",Txt_All_groups);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_DIV_End (); HTM_DIV_End ();
@ -1714,19 +1709,8 @@ void Grp_ListGrpsToEditAsgAttSvyMch (struct GroupType *GrpTyp,long Cod,
Grp = &(GrpTyp->LstGrps[NumGrpThisType]); Grp = &(GrpTyp->LstGrps[NumGrpThisType]);
IBelongToThisGroup = Grp_CheckIfGrpIsInList (Grp->GrpCod,&LstGrpsIBelong); IBelongToThisGroup = Grp_CheckIfGrpIsInList (Grp->GrpCod,&LstGrpsIBelong);
/* Put checkbox to select the group */ AssociatedToGrp = false;
HTM_TR_Begin (NULL);
if (IBelongToThisGroup)
HTM_TD_Begin ("class=\"LM LIGHT_BLUE\"");
else
HTM_TD_Begin ("class=\"LM\"");
fprintf (Gbl.F.Out,"<input type=\"checkbox\""
" id=\"Grp%ld\" name=\"GrpCods\" value=\"%ld\"",
Grp->GrpCod,
Grp->GrpCod);
if (Cod > 0) // Cod == -1L means new assignment or survey if (Cod > 0) // Cod == -1L means new assignment or survey
{
switch (Grp_AsgAttOrSvy) switch (Grp_AsgAttOrSvy)
{ {
case Grp_ASSIGNMENT: case Grp_ASSIGNMENT:
@ -1742,13 +1726,21 @@ void Grp_ListGrpsToEditAsgAttSvyMch (struct GroupType *GrpTyp,long Cod,
AssociatedToGrp = Gam_CheckIfMatchIsAssociatedToGrp (Cod,Grp->GrpCod); AssociatedToGrp = Gam_CheckIfMatchIsAssociatedToGrp (Cod,Grp->GrpCod);
break; break;
} }
if (AssociatedToGrp)
fprintf (Gbl.F.Out," checked=\"checked\""); /* Put checkbox to select the group */
} HTM_TR_Begin (NULL);
if (!(IBelongToThisGroup ||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)) if (IBelongToThisGroup)
fprintf (Gbl.F.Out," disabled=\"disabled\""); HTM_TD_Begin ("class=\"LM LIGHT_BLUE\"");
fprintf (Gbl.F.Out," onclick=\"uncheckParent(this,'WholeCrs')\" />"); else
HTM_TD_Begin ("class=\"LM\"");
HTM_INPUT_CHECKBOX ("GrpCods",false,
"id=\"Grp%ld\" value=\"%ld\"%s%s"
" onclick=\"uncheckParent(this,'WholeCrs')\"",
Grp->GrpCod,Grp->GrpCod,
AssociatedToGrp ? " checked=\"checked\"" : "",
(IBelongToThisGroup ||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM) ? "" : " disabled=\"disabled\"");
HTM_TD_End (); HTM_TD_End ();
Grp_WriteRowGrp (Grp,IBelongToThisGroup); Grp_WriteRowGrp (Grp,IBelongToThisGroup);
@ -2002,14 +1994,6 @@ static bool Grp_ListGrpsForChangeMySelection (struct GroupType *GrpTyp,
Grp = &(GrpTyp->LstGrps[NumGrpThisType]); Grp = &(GrpTyp->LstGrps[NumGrpThisType]);
IBelongToThisGroup = Grp_CheckIfGrpIsInList (Grp->GrpCod,&LstGrpsIBelong); IBelongToThisGroup = Grp_CheckIfGrpIsInList (Grp->GrpCod,&LstGrpsIBelong);
/* Put radio item or checkbox to select the group */
HTM_TR_Begin (NULL);
if (IBelongToThisGroup)
HTM_TD_Begin ("class=\"LM LIGHT_BLUE\"");
else
HTM_TD_Begin ("class=\"LM\"");
/* 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
{ {
@ -2029,6 +2013,14 @@ 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;
/* Put radio item or checkbox to select the group */
HTM_TR_Begin (NULL);
if (IBelongToThisGroup)
HTM_TD_Begin ("class=\"LM LIGHT_BLUE\"");
else
HTM_TD_Begin ("class=\"LM\"");
snprintf (StrGrpCod,sizeof (StrGrpCod), snprintf (StrGrpCod,sizeof (StrGrpCod),
"GrpCod%ld", "GrpCod%ld",
GrpTyp->GrpTypCod); GrpTyp->GrpTypCod);
@ -2057,23 +2049,15 @@ static bool Grp_ListGrpsForChangeMySelection (struct GroupType *GrpTyp,
GrpTyp->GrpTypCod,GrpTyp->NumGrps); GrpTyp->GrpTypCod,GrpTyp->NumGrps);
} }
else else
{
/* Put a checkbox item */ /* Put a checkbox item */
fprintf (Gbl.F.Out,"<input type=\"checkbox\"" HTM_INPUT_CHECKBOX (StrGrpCod,false,
" id=\"Grp%ld\" name=\"GrpCod%ld\" value=\"%ld\"", "id=\"Grp%ld\" value=\"%ld\"%s%s",
Grp->GrpCod,GrpTyp->GrpTypCod,Grp->GrpCod); Grp->GrpCod,Grp->GrpCod,
IBelongToThisGroup ? " checked=\"checked\"" : "",
/* Group checked? */ ICanChangeMySelectionForThisGrp ? "" :
if (IBelongToThisGroup) IBelongToThisGroup ? " readonly" : // I can not unregister (disabled does not work because the value is not submitted)
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 " disabled=\"disabled\""); // I can not register
fprintf (Gbl.F.Out," />");
}
HTM_TD_End (); HTM_TD_End ();
Grp_WriteRowGrp (Grp,IBelongToThisGroup); Grp_WriteRowGrp (Grp,IBelongToThisGroup);
@ -2132,6 +2116,7 @@ static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod)
unsigned NumGrpThisType; unsigned NumGrpThisType;
bool UsrBelongsToThisGroup; bool UsrBelongsToThisGroup;
struct Group *Grp; struct Group *Grp;
char StrGrpCod[32];
/***** Write heading *****/ /***** Write heading *****/
Grp_WriteGrpHead (GrpTyp); Grp_WriteGrpHead (GrpTyp);
@ -2162,12 +2147,13 @@ static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod)
/* Put checkbox to select the group */ /* Put checkbox to select the group */
// Always checkbox, not radio, because the role in the form may be teacher, // Always checkbox, not radio, because the role in the form may be teacher,
// so if he/she is registered as teacher, he/she can belong to several groups // so if he/she is registered as teacher, he/she can belong to several groups
fprintf (Gbl.F.Out,"<input type=\"checkbox\"" snprintf (StrGrpCod,sizeof (StrGrpCod),
" id=\"Grp%ld\" name=\"GrpCod%ld\" value=\"%ld\"", "GrpCod%ld",
Grp->GrpCod,GrpTyp->GrpTypCod,Grp->GrpCod); GrpTyp->GrpTypCod);
if (UsrBelongsToThisGroup) HTM_INPUT_CHECKBOX (StrGrpCod,false,
fprintf (Gbl.F.Out," checked=\"checked\""); "id=\"Grp%ld\" value=\"%ld\"%s%s",
fprintf (Gbl.F.Out," />"); Grp->GrpCod,Grp->GrpCod,
UsrBelongsToThisGroup ? " checked=\"checked\"" : ""); // I can not register
/* End cell for checkbox */ /* End cell for checkbox */
HTM_TD_End (); HTM_TD_End ();
@ -2197,6 +2183,7 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp,
struct ListCodGrps LstGrpsIBelong; struct ListCodGrps LstGrpsIBelong;
bool IBelongToThisGroup; bool IBelongToThisGroup;
bool ICanSelUnselGroup; bool ICanSelUnselGroup;
bool Checked;
struct Group *Grp; struct Group *Grp;
Rol_Role_t Role; Rol_Role_t Role;
@ -2241,6 +2228,19 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp,
break; break;
} }
/* This group should be checked? */
if (Gbl.Usrs.ClassPhoto.AllGroups)
Checked = true;
else
for (NumGrpSel = 0, Checked = false;
NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps;
NumGrpSel++)
if (Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel] == Grp->GrpCod)
{
Checked = true;
break;
}
/* Put checkbox to select the group */ /* Put checkbox to select the group */
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -2248,26 +2248,12 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp,
HTM_TD_Begin ("class=\"LM LIGHT_BLUE\""); HTM_TD_Begin ("class=\"LM LIGHT_BLUE\"");
else else
HTM_TD_Begin ("class=\"LM\""); HTM_TD_Begin ("class=\"LM\"");
fprintf (Gbl.F.Out,"<input type=\"checkbox\"" HTM_INPUT_CHECKBOX ("GrpCods",false,
" id=\"Grp%ld\" name=\"GrpCods\" value=\"%ld\"", "id=\"Grp%ld\" value=\"%ld\"%s%s",
Grp->GrpCod, Grp->GrpCod,Grp->GrpCod,
Grp->GrpCod); Checked ? " checked=\"checked\"" : "",
if (Gbl.Usrs.ClassPhoto.AllGroups) ICanSelUnselGroup ? " onclick=\"checkParent(this,'AllGroups')\"" :
fprintf (Gbl.F.Out," checked=\"checked\""); " disabled=\"disabled\"");
else
for (NumGrpSel = 0;
NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps;
NumGrpSel++)
if (Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel] == Grp->GrpCod)
{
fprintf (Gbl.F.Out," checked=\"checked\"");
break;
}
if (ICanSelUnselGroup)
fprintf (Gbl.F.Out," onclick=\"checkParent(this,'AllGroups')\"");
else
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," />");
HTM_TD_End (); HTM_TD_End ();
Grp_WriteRowGrp (Grp,IBelongToThisGroup); Grp_WriteRowGrp (Grp,IBelongToThisGroup);
@ -2282,30 +2268,34 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp,
/* To get the students who don't belong to a type of group, use group code -(GrpTyp->GrpTypCod) */ /* To get the students who don't belong to a type of group, use group code -(GrpTyp->GrpTypCod) */
/* Write checkbox to select the group */ /* Write checkbox to select the group */
ICanSelUnselGroup = (Gbl.Usrs.Me.Role.Logged >= Rol_STD); ICanSelUnselGroup = (Gbl.Usrs.Me.Role.Logged >= Rol_STD);
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"LM\"");
fprintf (Gbl.F.Out,"<input type=\"checkbox\" id=\"Grp%ld\" name=\"GrpCods\""
" value=\"%ld\"",
-(GrpTyp->GrpTypCod),
-(GrpTyp->GrpTypCod));
if (ICanSelUnselGroup) if (ICanSelUnselGroup)
{ {
if (Gbl.Usrs.ClassPhoto.AllGroups) if (Gbl.Usrs.ClassPhoto.AllGroups)
fprintf (Gbl.F.Out," checked=\"checked\""); Checked = true;
else else
for (NumGrpSel = 0; for (NumGrpSel = 0, Checked = false;
NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps; NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps;
NumGrpSel++) NumGrpSel++)
if (Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel] == -(GrpTyp->GrpTypCod)) if (Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel] == -(GrpTyp->GrpTypCod))
{ {
fprintf (Gbl.F.Out," checked=\"checked\""); Checked = true;
break; break;
} }
} }
else else
{
Checked = false;
fprintf (Gbl.F.Out," disabled=\"disabled\""); fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," onclick=\"checkParent(this,'AllGroups')\" />"); }
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"LM\"");
HTM_INPUT_CHECKBOX ("GrpCods",false,
"id=\"Grp%ld\" value=\"%ld\"%s%s onclick=\"checkParent(this,'AllGroups')\"",
-(GrpTyp->GrpTypCod),-(GrpTyp->GrpTypCod),
ICanSelUnselGroup ? (Checked ? " checked=\"checked\"" : "") :
" disabled=\"disabled\"");
HTM_TD_End (); HTM_TD_End ();
/* Column closed/open */ /* Column closed/open */

View File

@ -667,14 +667,10 @@ static void Ind_ShowNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1
if (PutForm) if (PutForm)
{ {
HTM_TD_Begin ("class=\"%s\"",Class); HTM_TD_Begin ("class=\"%s\"",Class);
fprintf (Gbl.F.Out,"<input type=\"checkbox\"" HTM_INPUT_CHECKBOX ("Indicators",true,
" id=\"Indicators%u\" name=\"Indicators\"" "id=\"Indicators%u\" value=\"%u\"%s",
" value=\"%u\"", Ind,Ind,
Ind,Ind); Gbl.Stat.IndicatorsSelected[Ind] ? " checked=\"checked\"" : "");
if (Gbl.Stat.IndicatorsSelected[Ind])
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," onchange=\"document.getElementById('%s').submit();\" />",
Gbl.Form.Id);
HTM_TD_End (); HTM_TD_End ();
} }

View File

@ -1269,16 +1269,10 @@ void Lay_PutContextualCheckbox (Act_Action_t NextAction,
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
/****** Checkbox *****/ /****** Checkbox *****/
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"%s\" value=\"Y\"", HTM_INPUT_CHECKBOX (CheckboxName,true,
CheckboxName); "value=\"Y\"%s%s",
if (Checked) Checked ? " checked=\"checked\"" : "",
fprintf (Gbl.F.Out," checked=\"checked\""); Disabled ? " disabled=\"disabled\"" : "");
if (Disabled)
fprintf (Gbl.F.Out," disabled=\"disabled\"");
else
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
fprintf (Gbl.F.Out," />");
/***** Text *****/ /***** Text *****/
if (Text) if (Text)

View File

@ -1263,10 +1263,9 @@ static void Mch_ShowLstGrpsToCreateMatch (void)
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\""); HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\"");
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"checkbox\"" HTM_INPUT_CHECKBOX ("WholeCrs",true,
" id=\"WholeCrs\" name=\"WholeCrs\" value=\"Y\"" "id=\"WholeCrs\" value=\"Y\" checked=\"checked\""
" checked=\"checked\"" " onclick=\"uncheckChildren(this,'GrpCods')\"");
" onclick=\"uncheckChildren(this,'GrpCods')\" />");
fprintf (Gbl.F.Out,"%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName); fprintf (Gbl.F.Out,"%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();

View File

@ -2662,9 +2662,9 @@ void Msg_ShowFormToFilterMsgs (void)
HTM_TD_Begin ("class=\"LM\""); HTM_TD_Begin ("class=\"LM\"");
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"%s:&nbsp;",TxtFromTo[Gbl.Msg.TypeOfMessages]); fprintf (Gbl.F.Out,"%s:&nbsp;",TxtFromTo[Gbl.Msg.TypeOfMessages]);
fprintf (Gbl.F.Out,"<input type=\"search\" name=\"FilterFromTo\"" HTM_INPUT_SEARCH ("FilterFromTo",Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME * 3,
" size=\"20\" maxlength=\"%u\" value=\"%s\" />", Gbl.Msg.FilterFromTo,false,
Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME * 3,Gbl.Msg.FilterFromTo); "size=\"20\"");
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();
@ -2672,9 +2672,9 @@ void Msg_ShowFormToFilterMsgs (void)
HTM_TD_Begin ("class=\"LM\""); HTM_TD_Begin ("class=\"LM\"");
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
fprintf (Gbl.F.Out,"%s:&nbsp;",Txt_MSG_Content); fprintf (Gbl.F.Out,"%s:&nbsp;",Txt_MSG_Content);
fprintf (Gbl.F.Out,"<input type=\"search\" name=\"FilterContent\"" HTM_INPUT_SEARCH ("FilterContent",Msg_MAX_CHARS_FILTER_CONTENT,
" size=\"20\" maxlength=\"%u\" value=\"%s\" />", Gbl.Msg.FilterContent,false,
Msg_MAX_CHARS_FILTER_CONTENT,Gbl.Msg.FilterContent); "size=\"20\"");
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();
@ -2695,11 +2695,9 @@ static void Msg_ShowFormToShowOnlyUnreadMessages (void)
/***** Put checkbox to select whether to show only unread (received) messages *****/ /***** Put checkbox to select whether to show only unread (received) messages *****/
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=\"checkbox\" name=\"OnlyUnreadMsgs\"" HTM_INPUT_CHECKBOX ("OnlyUnreadMsgs",false,
" value=\"Y\""); "value=\"Y\"%s",
if (Gbl.Msg.ShowOnlyUnreadMsgs) Gbl.Msg.ShowOnlyUnreadMsgs ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," />");
fprintf (Gbl.F.Out,"%s",Txt_only_unread_messages); fprintf (Gbl.F.Out,"%s",Txt_only_unread_messages);
HTM_LABEL_End (); HTM_LABEL_End ();
} }

View File

@ -1941,19 +1941,17 @@ void Ntf_PutFormChangeNotifSentByEMail (void)
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"CM\""); HTM_TD_Begin ("class=\"CM\"");
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"%s\" value=\"Y\"", HTM_INPUT_CHECKBOX (Ntf_ParamNotifMeAboutNotifyEvents[NotifyEvent],false,
Ntf_ParamNotifMeAboutNotifyEvents[NotifyEvent]); "value=\"Y\"%s",
if ((Gbl.Usrs.Me.UsrDat.NtfEvents.CreateNotif & (1 << NotifyEvent))) (Gbl.Usrs.Me.UsrDat.NtfEvents.CreateNotif &
fprintf (Gbl.F.Out," checked=\"checked\""); (1 << NotifyEvent)) ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," />");
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"CM\""); HTM_TD_Begin ("class=\"CM\"");
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"%s\" value=\"Y\"", HTM_INPUT_CHECKBOX (Ntf_ParamEmailMeAboutNotifyEvents[NotifyEvent],false,
Ntf_ParamEmailMeAboutNotifyEvents[NotifyEvent]); "value=\"Y\"%s",
if ((Gbl.Usrs.Me.UsrDat.NtfEvents.SendEmail & (1 << NotifyEvent))) (Gbl.Usrs.Me.UsrDat.NtfEvents.SendEmail &
fprintf (Gbl.F.Out," checked=\"checked\""); (1 << NotifyEvent)) ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," />");
HTM_TD_End (); HTM_TD_End ();
HTM_TR_End (); HTM_TR_End ();

View File

@ -863,7 +863,8 @@ void Pwd_AskForConfirmationOnDangerousAction (void)
/***** Checkbox *****/ /***** Checkbox *****/
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=\"checkbox\" name=\"Consent\" value=\"Y\" />"); HTM_INPUT_CHECKBOX ("Consent",false,
"value=\"Y\"");
fprintf (Gbl.F.Out,"%s",Txt_I_understand_that_this_action_can_not_be_undone); fprintf (Gbl.F.Out,"%s",Txt_I_understand_that_this_action_can_not_be_undone);
HTM_LABEL_End (); HTM_LABEL_End ();

View File

@ -3758,11 +3758,9 @@ void Prj_ShowFormConfig (void)
HTM_TD_Begin ("class=\"LT\""); HTM_TD_Begin ("class=\"LT\"");
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"checkbox\" id=\"Editable\"" HTM_INPUT_CHECKBOX ("Editable",false,
" name=\"Editable\" value=\"Y\""); "id=\"Editable\" value=\"Y\"%s",
if (Gbl.Prjs.Config.Editable) Gbl.Prjs.Config.Editable ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," />");
fprintf (Gbl.F.Out,"%s",Txt_Editable_by_non_editing_teachers); fprintf (Gbl.F.Out,"%s",Txt_Editable_by_non_editing_teachers);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();

View File

@ -547,20 +547,11 @@ void Rol_WriteSelectorRoles (unsigned RolesAllowed,unsigned RolesSelected,
if ((RolesAllowed & (1 << Role))) if ((RolesAllowed & (1 << Role)))
{ {
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"Role\" value=\"%u\"", HTM_INPUT_CHECKBOX ("Role",SendOnChange,
(unsigned) Role); "value=\"%u\"%s%s",
(unsigned) Role,
if ((RolesSelected & (1 << Role))) (RolesSelected & (1 << Role)) ? " checked=\"checked\"" : "",
fprintf (Gbl.F.Out," checked=\"checked\""); Disabled ? " disabled=\"disabled\"" : "");
if (Disabled)
fprintf (Gbl.F.Out," disabled=\"disabled\"");
if (SendOnChange)
fprintf (Gbl.F.Out," onchange=\"document.getElementById('%s').submit();\"",
Gbl.Form.Id);
fprintf (Gbl.F.Out," />");
fprintf (Gbl.F.Out,"%s",Txt_ROLES_PLURAL_abc[Role][Usr_SEX_UNKNOWN]); fprintf (Gbl.F.Out,"%s",Txt_ROLES_PLURAL_abc[Role][Usr_SEX_UNKNOWN]);
HTM_LABEL_End (); HTM_LABEL_End ();
fprintf (Gbl.F.Out,"<br />"); fprintf (Gbl.F.Out,"<br />");

View File

@ -2091,11 +2091,9 @@ static void Svy_ShowLstGrpsToEditSurvey (long SvyCod)
HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\""); HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\"");
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
fprintf (Gbl.F.Out,"<input type=\"checkbox\"" HTM_INPUT_CHECKBOX ("WholeCrs",false,
" id=\"WholeCrs\" name=\"WholeCrs\" value=\"Y\""); "id=\"WholeCrs\" value=\"Y\"%s onclick=\"uncheckChildren(this,'GrpCods')\"",
if (!Svy_CheckIfSvyIsAssociatedToGrps (SvyCod)) Svy_CheckIfSvyIsAssociatedToGrps (SvyCod) ? "" : " checked=\"checked\"");
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," onclick=\"uncheckChildren(this,'GrpCods')\" />");
fprintf (Gbl.F.Out,"%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName); fprintf (Gbl.F.Out,"%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();
@ -3404,6 +3402,7 @@ static void Svy_WriteAnswersOfAQst (struct Survey *Svy,
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumUsrsThisAnswer; unsigned NumUsrsThisAnswer;
char StrAns[32];
/***** Get answers of this question *****/ /***** Get answers of this question *****/
NumAnswers = Svy_GetAnswersQst (SvyQst->QstCod,&mysql_res); // Result: AnsInd,NumUsrs,Answer NumAnswers = Svy_GetAnswersQst (SvyQst->QstCod,&mysql_res); // Result: AnsInd,NumUsrs,Answer
@ -3445,16 +3444,20 @@ static void Svy_WriteAnswersOfAQst (struct Survey *Svy,
{ {
/* Write selector to choice this answer */ /* Write selector to choice this answer */
HTM_TD_Begin ("class=\"LT\""); HTM_TD_Begin ("class=\"LT\"");
fprintf (Gbl.F.Out,"<input type=\""); snprintf (StrAns,sizeof (StrAns),
"Ans%010u",
(unsigned) SvyQst->QstCod);
if (SvyQst->AnswerType == Svy_ANS_UNIQUE_CHOICE) if (SvyQst->AnswerType == Svy_ANS_UNIQUE_CHOICE)
fprintf (Gbl.F.Out,"radio\"" HTM_INPUT_RADIO (StrAns,false,
"id=\"Ans%010u_%010u\" value=\"%u\""
" onclick=\"selectUnselectRadio(this,this.form.Ans%010u,%u)\"", " onclick=\"selectUnselectRadio(this,this.form.Ans%010u,%u)\"",
(unsigned) SvyQst->QstCod,NumAns,NumAns,
NumAns,
(unsigned) SvyQst->QstCod,NumAnswers); (unsigned) SvyQst->QstCod,NumAnswers);
else // SvyQst->AnswerType == Svy_ANS_MULTIPLE_CHOICE else // SvyQst->AnswerType == Svy_ANS_MULTIPLE_CHOICE
fprintf (Gbl.F.Out,"checkbox\""); HTM_INPUT_CHECKBOX (StrAns,false,
fprintf (Gbl.F.Out," id=\"Ans%010u_%010u\" name=\"Ans%010u\"" "id=\"Ans%010u_%010u\" value=\"%u\"",
" value=\"%u\" />", (unsigned) SvyQst->QstCod,NumAns,NumAns,
(unsigned) SvyQst->QstCod,NumAns,(unsigned) SvyQst->QstCod,
NumAns); NumAns);
HTM_TD_End (); HTM_TD_End ();
} }

View File

@ -468,10 +468,9 @@ void Tst_ShowNewTest (void)
/***** Test result will be saved? *****/ /***** Test result will be saved? *****/
HTM_DIV_Begin ("class=\"CM\""); HTM_DIV_Begin ("class=\"CM\"");
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=\"checkbox\" name=\"Save\" value=\"Y\""); HTM_INPUT_CHECKBOX ("Save",false,
if (Gbl.Test.AllowTeachers) "value=\"Y\"%s",
fprintf (Gbl.F.Out," checked=\"checked\""); Gbl.Test.AllowTeachers ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," />");
fprintf (Gbl.F.Out,"&nbsp;%s",Txt_Allow_teachers_to_consult_this_test); fprintf (Gbl.F.Out,"&nbsp;%s",Txt_Allow_teachers_to_consult_this_test);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_DIV_End (); HTM_DIV_End ();
@ -1667,6 +1666,7 @@ static void Tst_ShowFormSelTags (unsigned long NumRows,MYSQL_RES *mysql_res,
unsigned long NumRow; unsigned long NumRow;
MYSQL_ROW row; MYSQL_ROW row;
bool TagHidden = false; bool TagHidden = false;
bool Checked;
const char *Ptr; const char *Ptr;
char TagText[Tst_MAX_BYTES_TAG + 1]; char TagText[Tst_MAX_BYTES_TAG + 1];
/* /*
@ -1694,10 +1694,9 @@ static void Tst_ShowFormSelTags (unsigned long NumRows,MYSQL_RES *mysql_res,
HTM_TD_Begin ("class=\"LM\""); HTM_TD_Begin ("class=\"LM\"");
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=\"checkbox\" name=\"AllTags\" value=\"Y\""); HTM_INPUT_CHECKBOX ("AllTags",false,
if (Gbl.Test.Tags.All) "value=\"Y\"%s onclick=\"togglecheckChildren(this,'ChkTag');\"",
fprintf (Gbl.F.Out," checked=\"checked\""); Gbl.Test.Tags.All ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," onclick=\"togglecheckChildren(this,'ChkTag');\" />");
fprintf (Gbl.F.Out,"&nbsp;%s",Txt_All_tags); fprintf (Gbl.F.Out,"&nbsp;%s",Txt_All_tags);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();
@ -1725,10 +1724,7 @@ static void Tst_ShowFormSelTags (unsigned long NumRows,MYSQL_RES *mysql_res,
HTM_TD_End (); HTM_TD_End ();
} }
HTM_TD_Begin ("class=\"LM\""); Checked = false;
HTM_LABEL_Begin ("class=\"DAT\"");
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"ChkTag\" value=\"%s\"",
row[1]);
if (Gbl.Test.Tags.List) if (Gbl.Test.Tags.List)
{ {
Ptr = Gbl.Test.Tags.List; Ptr = Gbl.Test.Tags.List;
@ -1736,10 +1732,19 @@ static void Tst_ShowFormSelTags (unsigned long NumRows,MYSQL_RES *mysql_res,
{ {
Par_GetNextStrUntilSeparParamMult (&Ptr,TagText,Tst_MAX_BYTES_TAG); Par_GetNextStrUntilSeparParamMult (&Ptr,TagText,Tst_MAX_BYTES_TAG);
if (!strcmp (row[1],TagText)) if (!strcmp (row[1],TagText))
fprintf (Gbl.F.Out," checked=\"checked\""); {
Checked = true;
break;
} }
} }
fprintf (Gbl.F.Out," onclick=\"checkParent(this,'AllTags');\" />"); }
HTM_TD_Begin ("class=\"LM\"");
HTM_LABEL_Begin ("class=\"DAT\"");
HTM_INPUT_CHECKBOX ("ChkTag",false,
"value=\"%s\"%s onclick=\"checkParent(this,'AllTags');\"",
row[1],
Checked ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out,"&nbsp;%s",row[1]); fprintf (Gbl.F.Out,"&nbsp;%s",row[1]);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();
@ -2297,6 +2302,7 @@ static void Tst_ShowFormAnswerTypes (unsigned NumCols)
extern const char *Txt_All_types_of_answers; extern const char *Txt_All_types_of_answers;
extern const char *Txt_TST_STR_ANSWER_TYPES[Tst_NUM_ANS_TYPES]; extern const char *Txt_TST_STR_ANSWER_TYPES[Tst_NUM_ANS_TYPES];
Tst_AnswerType_t AnsType; Tst_AnswerType_t AnsType;
bool Checked;
char UnsignedStr[10 + 1]; char UnsignedStr[10 + 1];
const char *Ptr; const char *Ptr;
@ -2318,10 +2324,9 @@ static void Tst_ShowFormAnswerTypes (unsigned NumCols)
HTM_TD_Begin ("class=\"LM\""); HTM_TD_Begin ("class=\"LM\"");
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=\"checkbox\" name=\"AllAnsTypes\" value=\"Y\""); HTM_INPUT_CHECKBOX ("AllAnsTypes",false,
if (Gbl.Test.AllAnsTypes) "value=\"Y\"%s onclick=\"togglecheckChildren(this,'AnswerType');\"",
fprintf (Gbl.F.Out," checked=\"checked\""); Gbl.Test.AllAnsTypes ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," onclick=\"togglecheckChildren(this,'AnswerType');\" />");
fprintf (Gbl.F.Out,"&nbsp;%s",Txt_All_types_of_answers); fprintf (Gbl.F.Out,"&nbsp;%s",Txt_All_types_of_answers);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();
@ -2335,18 +2340,23 @@ static void Tst_ShowFormAnswerTypes (unsigned NumCols)
{ {
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"LM\""); Checked = false;
HTM_LABEL_Begin ("class=\"DAT\"");
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"AnswerType\" value=\"%u\"",
(unsigned) AnsType);
Ptr = Gbl.Test.ListAnsTypes; Ptr = Gbl.Test.ListAnsTypes;
while (*Ptr) while (*Ptr)
{ {
Par_GetNextStrUntilSeparParamMult (&Ptr,UnsignedStr,10); Par_GetNextStrUntilSeparParamMult (&Ptr,UnsignedStr,10);
if (Tst_ConvertFromUnsignedStrToAnsTyp (UnsignedStr) == AnsType) if (Tst_ConvertFromUnsignedStrToAnsTyp (UnsignedStr) == AnsType)
fprintf (Gbl.F.Out," checked=\"checked\""); {
Checked = true;
break;
} }
fprintf (Gbl.F.Out," onclick=\"checkParent(this,'AllAnsTypes');\" />"); }
HTM_TD_Begin ("class=\"LM\"");
HTM_LABEL_Begin ("class=\"DAT\"");
HTM_INPUT_CHECKBOX ("AnswerType",false,
"value=\"%u\"%s onclick=\"checkParent(this,'AllAnsTypes');\"",
(unsigned) AnsType,
Checked ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out,"&nbsp;%s",Txt_TST_STR_ANSWER_TYPES[AnsType]); fprintf (Gbl.F.Out,"&nbsp;%s",Txt_TST_STR_ANSWER_TYPES[AnsType]);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();
@ -2931,11 +2941,9 @@ static void Tst_ListOneOrMoreQuestionsForEdition (unsigned long NumRows,
if (NumRows == 1) if (NumRows == 1)
Par_PutHiddenParamChar ("OnlyThisQst",'Y'); // If editing only one question, don't edit others Par_PutHiddenParamChar ("OnlyThisQst",'Y'); // If editing only one question, don't edit others
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Gbl.Test.SelectedOrder); Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Gbl.Test.SelectedOrder);
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"Shuffle\" value=\"Y\""); HTM_INPUT_CHECKBOX ("Shuffle",true,
if (row[3][0] == 'Y') "value=\"Y\"%s",
fprintf (Gbl.F.Out," checked=\"checked\""); row[3][0] == 'Y' ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />",
Gbl.Form.Id);
Frm_EndForm (); Frm_EndForm ();
} }
HTM_TD_End (); HTM_TD_End ();
@ -3099,8 +3107,8 @@ static void Tst_ListOneOrMoreQuestionsForSelection (unsigned long NumRows,
HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd);
/* Write checkbox to select the question */ /* Write checkbox to select the question */
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"QstCods\"" HTM_INPUT_CHECKBOX ("QstCods",false,
" value=\"%ld\" />", "value=\"%ld\"",
Gbl.Test.QstCod); Gbl.Test.QstCod);
/* Write number of question */ /* Write number of question */
@ -3138,12 +3146,9 @@ static void Tst_ListOneOrMoreQuestionsForSelection (unsigned long NumRows,
/* Write if shuffle is enabled (row[3]) */ /* Write if shuffle is enabled (row[3]) */
HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd); HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd);
HTM_INPUT_CHECKBOX ("Shuffle",false,
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"Shuffle\" value=\"Y\""); "value=\"Y\"%s disabled=\"disabled\"",
if (row[3][0] == 'Y') row[3][0] == 'Y' ? " checked=\"checked\"" : "");
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," disabled=\"disabled\" />");
HTM_TD_End (); HTM_TD_End ();
/* Write stem (row[4]) */ /* Write stem (row[4]) */
@ -3640,6 +3645,7 @@ static void Tst_WriteChoiceAnsViewTest (unsigned NumQst,long QstCod,bool Shuffle
unsigned Index; unsigned Index;
bool ErrorInIndex = false; bool ErrorInIndex = false;
char ParamName[3 + 6 + 1]; char ParamName[3 + 6 + 1];
char StrAns[32];
/***** Get answers of a question from database *****/ /***** Get answers of a question from database *****/
Gbl.Test.Answer.NumOptions = Tst_GetAnswersQst (QstCod,&mysql_res,Shuffle); Gbl.Test.Answer.NumOptions = Tst_GetAnswersQst (QstCod,&mysql_res,Shuffle);
@ -3698,16 +3704,21 @@ static void Tst_WriteChoiceAnsViewTest (unsigned NumQst,long QstCod,bool Shuffle
"Ind%06u", "Ind%06u",
NumQst); NumQst);
Par_PutHiddenParamUnsigned (NULL,ParamName,Index); Par_PutHiddenParamUnsigned (NULL,ParamName,Index);
fprintf (Gbl.F.Out,"<input type=\""); snprintf (StrAns,sizeof (StrAns),
"Ans%06u",
NumQst);
if (Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE) if (Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE)
fprintf (Gbl.F.Out,"radio\"" HTM_INPUT_RADIO (StrAns,false,
"id=\"Ans%06u_%u\" value=\"%u\""
" onclick=\"selectUnselectRadio(this,this.form.Ans%06u,%u);\"", " onclick=\"selectUnselectRadio(this,this.form.Ans%06u,%u);\"",
NumQst,NumOpt,
Index,
NumQst,Gbl.Test.Answer.NumOptions); NumQst,Gbl.Test.Answer.NumOptions);
else // Gbl.Test.AnswerType == Tst_ANS_MULTIPLE_CHOICE else // Gbl.Test.AnswerType == Tst_ANS_MULTIPLE_CHOICE
fprintf (Gbl.F.Out,"checkbox\""); HTM_INPUT_CHECKBOX (StrAns,false,
fprintf (Gbl.F.Out," id=\"Ans%06u_%u\" name=\"Ans%06u\" value=\"%u\" />", "id=\"Ans%06u_%u\" value=\"%u\"",
NumQst,NumOpt, NumQst,NumOpt,
NumQst,Index); Index);
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"LT\""); HTM_TD_Begin ("class=\"LT\"");
@ -5237,13 +5248,11 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
HTM_TD_Begin ("class=\"LT\""); HTM_TD_Begin ("class=\"LT\"");
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=\"checkbox\" name=\"Shuffle\" value=\"Y\""); HTM_INPUT_CHECKBOX ("Shuffle",false,
if (Gbl.Test.Shuffle) "value=\"Y\"%s%s",
fprintf (Gbl.F.Out," checked=\"checked\""); Gbl.Test.Shuffle ? " checked=\"checked\"" : "",
if (Gbl.Test.AnswerType != Tst_ANS_UNIQUE_CHOICE && Gbl.Test.AnswerType != Tst_ANS_UNIQUE_CHOICE &&
Gbl.Test.AnswerType != Tst_ANS_MULTIPLE_CHOICE) Gbl.Test.AnswerType != Tst_ANS_MULTIPLE_CHOICE ? " disabled=\"disabled\"" : "");
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," />");
fprintf (Gbl.F.Out,"%s",Txt_Shuffle); fprintf (Gbl.F.Out,"%s",Txt_Shuffle);
HTM_LABEL_End (); HTM_LABEL_End ();
HTM_TD_End (); HTM_TD_End ();
@ -5287,13 +5296,11 @@ static void Tst_PutFormEditOneQst (char Stem[Cns_MAX_BYTES_TEXT + 1],
Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE ? "" : " disabled=\"disabled\""); Gbl.Test.AnswerType == Tst_ANS_UNIQUE_CHOICE ? "" : " disabled=\"disabled\"");
/* Checkbox for multiple choice answers */ /* Checkbox for multiple choice answers */
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"AnsMulti\" value=\"%u\"", HTM_INPUT_CHECKBOX ("AnsMulti",false,
NumOpt); "value=\"%u\"%s%s",
if (Gbl.Test.AnswerType != Tst_ANS_MULTIPLE_CHOICE) NumOpt,
fprintf (Gbl.F.Out," disabled=\"disabled\""); Gbl.Test.Answer.Options[NumOpt].Correct ? " checked=\"checked\"" : "",
if (Gbl.Test.Answer.Options[NumOpt].Correct) Gbl.Test.AnswerType == Tst_ANS_MULTIPLE_CHOICE ? "" : " disabled=\"disabled\"");
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," />");
HTM_TD_End (); HTM_TD_End ();

View File

@ -6294,10 +6294,8 @@ void Usr_PutCheckboxToSelectAllUsers (Rol_Role_t Role)
HTM_LABEL_Begin (NULL); HTM_LABEL_Begin (NULL);
if (Usr_NameSelUnsel[Role] && Usr_ParamUsrCod[Role]) if (Usr_NameSelUnsel[Role] && Usr_ParamUsrCod[Role])
fprintf (Gbl.F.Out,"<input type=\"checkbox\"" HTM_INPUT_CHECKBOX (Usr_NameSelUnsel[Role],false,
" name=\"%s\" value=\"\"" "value=\"\" onclick=\"togglecheckChildren(this,'%s')\"",
" onclick=\"togglecheckChildren(this,'%s')\" />",
Usr_NameSelUnsel[Role],
Usr_ParamUsrCod[Role]); Usr_ParamUsrCod[Role]);
else else
Rol_WrongRoleExit (); Rol_WrongRoleExit ();
@ -6369,14 +6367,11 @@ static void Usr_PutCheckboxToSelectUser (Rol_Role_t Role,
CheckboxChecked = Usr_FindUsrCodInListOfSelectedUsrs (EncryptedUsrCod); CheckboxChecked = Usr_FindUsrCodInListOfSelectedUsrs (EncryptedUsrCod);
/***** Check box *****/ /***** Check box *****/
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"%s\" value=\"%s\"" HTM_INPUT_CHECKBOX (Usr_ParamUsrCod[Role],false,
" onclick=\"checkParent(this,'%s')\"", "value=\"%s\"%s onclick=\"checkParent(this,'%s')\"",
Usr_ParamUsrCod[Role],
EncryptedUsrCod, EncryptedUsrCod,
CheckboxChecked ? " checked=\"checked\"" : "",
Usr_NameSelUnsel[Role]); Usr_NameSelUnsel[Role]);
if (CheckboxChecked)
fprintf (Gbl.F.Out," checked=\"checked\"");
fprintf (Gbl.F.Out," />");
} }
else else
Rol_WrongRoleExit (); Rol_WrongRoleExit ();
@ -6395,12 +6390,9 @@ static void Usr_PutCheckboxListWithPhotos (void)
/***** Put checkbox to select whether list users with photos *****/ /***** Put checkbox to select whether list users with photos *****/
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=\"checkbox\" name=\"WithPhotos\"" HTM_INPUT_CHECKBOX ("WithPhotos",true,
" value=\"Y\""); "value=\"Y\"%s",
if (Gbl.Usrs.Listing.WithPhotos) Gbl.Usrs.Listing.WithPhotos ? " 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_Display_photos); fprintf (Gbl.F.Out,"%s",Txt_Display_photos);
HTM_LABEL_End (); HTM_LABEL_End ();
} }