mirror of https://github.com/acanas/swad-core.git
Version19.51.18
This commit is contained in:
parent
019285b91a
commit
023b977416
73
swad_HTML.c
73
swad_HTML.c
|
@ -833,6 +833,44 @@ void HTM_INPUT_TEXT (const char *Name,unsigned MaxLength,const char *Value,bool
|
|||
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,
|
||||
const char *fmt,...)
|
||||
{
|
||||
|
@ -1030,6 +1068,41 @@ void HTM_INPUT_RADIO (const char *Name,bool SubmitOnClick,
|
|||
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 ********************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -91,6 +91,8 @@ void HTM_LABEL_End (void);
|
|||
|
||||
void HTM_INPUT_TEXT (const char *Name,unsigned MaxLength,const char *Value,bool SubmitOnChange,
|
||||
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,
|
||||
const char *fmt,...);
|
||||
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_RADIO (const char *Name,bool SubmitOnClick,
|
||||
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_End (void);
|
||||
|
|
|
@ -1266,11 +1266,10 @@ static void Asg_ShowLstGrpsToEditAssignment (long AsgCod)
|
|||
|
||||
HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\"");
|
||||
HTM_LABEL_Begin (NULL);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" id=\"WholeCrs\""
|
||||
" name=\"WholeCrs\" value=\"Y\"");
|
||||
if (!Asg_CheckIfAsgIsAssociatedToGrps (AsgCod))
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," onclick=\"uncheckChildren(this,'GrpCods')\" />");
|
||||
HTM_INPUT_CHECKBOX ("WholeCrs",false,
|
||||
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||
Asg_CheckIfAsgIsAssociatedToGrps (AsgCod) ? "" : " checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out,"%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||
HTM_LABEL_End ();
|
||||
HTM_TD_End ();
|
||||
|
|
|
@ -1214,11 +1214,10 @@ static void Att_ShowLstGrpsToEditAttEvent (long AttCod)
|
|||
|
||||
HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\"");
|
||||
HTM_LABEL_Begin (NULL);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" id=\"WholeCrs\""
|
||||
" name=\"WholeCrs\" value=\"Y\"");
|
||||
if (!Att_CheckIfAttEventIsAssociatedToGrps (AttCod))
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," onclick=\"uncheckChildren(this,'GrpCods')\" />");
|
||||
HTM_INPUT_CHECKBOX ("WholeCrs",false,
|
||||
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||
Att_CheckIfAttEventIsAssociatedToGrps (AttCod) ? "" : " checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out,"%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||
HTM_LABEL_End ();
|
||||
HTM_TD_End ();
|
||||
|
@ -2089,14 +2088,11 @@ static void Att_WriteRowUsrToCallTheRoll (unsigned NumUsr,
|
|||
|
||||
/***** Checkbox to select user *****/
|
||||
HTM_TD_Begin ("class=\"CT COLOR%u\"",Gbl.RowEvenOdd);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\""
|
||||
" id=\"Std%u\" name=\"UsrCodStd\" value=\"%s\"",
|
||||
NumUsr,UsrDat->EncryptedUsrCod);
|
||||
if (Present) // This student has attended to the event?
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
if (!ICanChangeStdAttendance)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out," />");
|
||||
HTM_INPUT_CHECKBOX ("UsrCodStd",false,
|
||||
"id=\"Std%u\" value=\"%s\"%s%s",
|
||||
NumUsr,UsrDat->EncryptedUsrCod,
|
||||
Present ? " checked=\"checked\"" : "",
|
||||
ICanChangeStdAttendance ? "" : " disabled=\"disabled\"");
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Write number of student in the list *****/
|
||||
|
@ -3128,13 +3124,10 @@ static void Att_ListEventsToSelect (Att_TypeOfView_t TypeOfView)
|
|||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TD_Begin ("class=\"DAT CT COLOR%u\"",Gbl.RowEvenOdd);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\""
|
||||
" id=\"Att%u\" name=\"AttCods\" value=\"%ld\"",
|
||||
NumAttEvent,
|
||||
Gbl.AttEvents.Lst[NumAttEvent].AttCod);
|
||||
if (Gbl.AttEvents.Lst[NumAttEvent].Selected)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," />");
|
||||
HTM_INPUT_CHECKBOX ("AttCods",false,
|
||||
"id=\"Att%u\" value=\"%ld\"%s",
|
||||
NumAttEvent,Gbl.AttEvents.Lst[NumAttEvent].AttCod,
|
||||
Gbl.AttEvents.Lst[NumAttEvent].Selected ? " checked=\"checked\"" : "");
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TD_Begin ("class=\"DAT RT COLOR%u\"",Gbl.RowEvenOdd);
|
||||
|
|
|
@ -487,7 +487,7 @@ 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.17 (2019-11-04)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 19.51.18 (2019-11-04)"
|
||||
#define CSS_FILE "swad19.47.css"
|
||||
#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: 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.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)
|
||||
|
|
|
@ -81,13 +81,11 @@ void Coo_EditMyPrefsOnCookies (void)
|
|||
"DAT");
|
||||
/* Check box */
|
||||
HTM_LABEL_Begin (NULL);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\""
|
||||
" name=\"cookies\" value=\"Y\"");
|
||||
if (Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />",
|
||||
Gbl.Form.Id);
|
||||
fprintf (Gbl.F.Out,"%s",Txt_Accept_third_party_cookies_to_view_multimedia_content_from_other_websites);
|
||||
HTM_INPUT_CHECKBOX ("cookies",true,
|
||||
"value=\"Y\"%s",
|
||||
Gbl.Usrs.Me.UsrDat.Prefs.AcceptThirdPartyCookies ? " checked=\"checked\"" : "");
|
||||
fprintf (Gbl.F.Out,"%s",
|
||||
Txt_Accept_third_party_cookies_to_view_multimedia_content_from_other_websites);
|
||||
HTM_LABEL_End ();
|
||||
|
||||
/* End container */
|
||||
|
|
172
swad_group.c
172
swad_group.c
|
@ -454,18 +454,13 @@ static void Grp_PutCheckboxAllGrps (Grp_WhichGroups_t GroupsSelectableByStdsOrNE
|
|||
}
|
||||
|
||||
HTM_DIV_Begin ("class=\"CONTEXT_OPT\"");
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\""
|
||||
" id=\"AllGroups\" name=\"AllGroups\" value=\"Y\"");
|
||||
if (ICanSelUnselGroup)
|
||||
{
|
||||
if (Gbl.Usrs.ClassPhoto.AllGroups)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," onclick=\"togglecheckChildren(this,'GrpCods')\"");
|
||||
}
|
||||
else
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out," />");
|
||||
HTM_LABEL_Begin ("for=\"AllGroups\" class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||
HTM_INPUT_CHECKBOX ("AllGroups",false,
|
||||
"value=\"Y\"%s",
|
||||
ICanSelUnselGroup ? (Gbl.Usrs.ClassPhoto.AllGroups ? " checked=\"checked\""
|
||||
" onclick=\"togglecheckChildren(this,'GrpCods')\"" :
|
||||
" onclick=\"togglecheckChildren(this,'GrpCods')\"") :
|
||||
" disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out," %s",Txt_All_groups);
|
||||
HTM_LABEL_End ();
|
||||
HTM_DIV_End ();
|
||||
|
@ -1714,19 +1709,8 @@ void Grp_ListGrpsToEditAsgAttSvyMch (struct GroupType *GrpTyp,long Cod,
|
|||
Grp = &(GrpTyp->LstGrps[NumGrpThisType]);
|
||||
IBelongToThisGroup = Grp_CheckIfGrpIsInList (Grp->GrpCod,&LstGrpsIBelong);
|
||||
|
||||
/* Put checkbox to select the group */
|
||||
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);
|
||||
AssociatedToGrp = false;
|
||||
if (Cod > 0) // Cod == -1L means new assignment or survey
|
||||
{
|
||||
switch (Grp_AsgAttOrSvy)
|
||||
{
|
||||
case Grp_ASSIGNMENT:
|
||||
|
@ -1742,13 +1726,21 @@ void Grp_ListGrpsToEditAsgAttSvyMch (struct GroupType *GrpTyp,long Cod,
|
|||
AssociatedToGrp = Gam_CheckIfMatchIsAssociatedToGrp (Cod,Grp->GrpCod);
|
||||
break;
|
||||
}
|
||||
if (AssociatedToGrp)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
}
|
||||
if (!(IBelongToThisGroup ||
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM))
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out," onclick=\"uncheckParent(this,'WholeCrs')\" />");
|
||||
|
||||
/* Put checkbox to select the group */
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
if (IBelongToThisGroup)
|
||||
HTM_TD_Begin ("class=\"LM LIGHT_BLUE\"");
|
||||
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 ();
|
||||
|
||||
Grp_WriteRowGrp (Grp,IBelongToThisGroup);
|
||||
|
@ -2002,14 +1994,6 @@ static bool Grp_ListGrpsForChangeMySelection (struct GroupType *GrpTyp,
|
|||
Grp = &(GrpTyp->LstGrps[NumGrpThisType]);
|
||||
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? */
|
||||
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
|
||||
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),
|
||||
"GrpCod%ld",
|
||||
GrpTyp->GrpTypCod);
|
||||
|
@ -2057,22 +2049,14 @@ static bool Grp_ListGrpsForChangeMySelection (struct GroupType *GrpTyp,
|
|||
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," />");
|
||||
}
|
||||
HTM_INPUT_CHECKBOX (StrGrpCod,false,
|
||||
"id=\"Grp%ld\" value=\"%ld\"%s%s",
|
||||
Grp->GrpCod,Grp->GrpCod,
|
||||
IBelongToThisGroup ? " checked=\"checked\"" : "",
|
||||
ICanChangeMySelectionForThisGrp ? "" :
|
||||
IBelongToThisGroup ? " readonly" : // I can not unregister (disabled does not work because the value is not submitted)
|
||||
" disabled=\"disabled\""); // I can not register
|
||||
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -2132,6 +2116,7 @@ static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod)
|
|||
unsigned NumGrpThisType;
|
||||
bool UsrBelongsToThisGroup;
|
||||
struct Group *Grp;
|
||||
char StrGrpCod[32];
|
||||
|
||||
/***** Write heading *****/
|
||||
Grp_WriteGrpHead (GrpTyp);
|
||||
|
@ -2162,12 +2147,13 @@ static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod)
|
|||
/* Put checkbox to select the group */
|
||||
// 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
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\""
|
||||
" id=\"Grp%ld\" name=\"GrpCod%ld\" value=\"%ld\"",
|
||||
Grp->GrpCod,GrpTyp->GrpTypCod,Grp->GrpCod);
|
||||
if (UsrBelongsToThisGroup)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," />");
|
||||
snprintf (StrGrpCod,sizeof (StrGrpCod),
|
||||
"GrpCod%ld",
|
||||
GrpTyp->GrpTypCod);
|
||||
HTM_INPUT_CHECKBOX (StrGrpCod,false,
|
||||
"id=\"Grp%ld\" value=\"%ld\"%s%s",
|
||||
Grp->GrpCod,Grp->GrpCod,
|
||||
UsrBelongsToThisGroup ? " checked=\"checked\"" : ""); // I can not register
|
||||
|
||||
/* End cell for checkbox */
|
||||
HTM_TD_End ();
|
||||
|
@ -2197,6 +2183,7 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp,
|
|||
struct ListCodGrps LstGrpsIBelong;
|
||||
bool IBelongToThisGroup;
|
||||
bool ICanSelUnselGroup;
|
||||
bool Checked;
|
||||
struct Group *Grp;
|
||||
Rol_Role_t Role;
|
||||
|
||||
|
@ -2241,6 +2228,19 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp,
|
|||
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 */
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
|
@ -2248,26 +2248,12 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp,
|
|||
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 (Gbl.Usrs.ClassPhoto.AllGroups)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
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_INPUT_CHECKBOX ("GrpCods",false,
|
||||
"id=\"Grp%ld\" value=\"%ld\"%s%s",
|
||||
Grp->GrpCod,Grp->GrpCod,
|
||||
Checked ? " checked=\"checked\"" : "",
|
||||
ICanSelUnselGroup ? " onclick=\"checkParent(this,'AllGroups')\"" :
|
||||
" disabled=\"disabled\"");
|
||||
HTM_TD_End ();
|
||||
|
||||
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) */
|
||||
/* Write checkbox to select the group */
|
||||
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 (Gbl.Usrs.ClassPhoto.AllGroups)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
Checked = true;
|
||||
else
|
||||
for (NumGrpSel = 0;
|
||||
for (NumGrpSel = 0, Checked = false;
|
||||
NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps;
|
||||
NumGrpSel++)
|
||||
if (Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel] == -(GrpTyp->GrpTypCod))
|
||||
{
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
Checked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Checked = false;
|
||||
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 ();
|
||||
|
||||
/* Column closed/open */
|
||||
|
|
|
@ -667,14 +667,10 @@ static void Ind_ShowNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1
|
|||
if (PutForm)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"%s\"",Class);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\""
|
||||
" id=\"Indicators%u\" name=\"Indicators\""
|
||||
" value=\"%u\"",
|
||||
Ind,Ind);
|
||||
if (Gbl.Stat.IndicatorsSelected[Ind])
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Gbl.Form.Id);
|
||||
HTM_INPUT_CHECKBOX ("Indicators",true,
|
||||
"id=\"Indicators%u\" value=\"%u\"%s",
|
||||
Ind,Ind,
|
||||
Gbl.Stat.IndicatorsSelected[Ind] ? " checked=\"checked\"" : "");
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
|
|
|
@ -1269,16 +1269,10 @@ void Lay_PutContextualCheckbox (Act_Action_t NextAction,
|
|||
HTM_LABEL_Begin (NULL);
|
||||
|
||||
/****** Checkbox *****/
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"%s\" value=\"Y\"",
|
||||
CheckboxName);
|
||||
if (Checked)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
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," />");
|
||||
HTM_INPUT_CHECKBOX (CheckboxName,true,
|
||||
"value=\"Y\"%s%s",
|
||||
Checked ? " checked=\"checked\"" : "",
|
||||
Disabled ? " disabled=\"disabled\"" : "");
|
||||
|
||||
/***** Text *****/
|
||||
if (Text)
|
||||
|
|
|
@ -1263,10 +1263,9 @@ static void Mch_ShowLstGrpsToCreateMatch (void)
|
|||
HTM_TR_Begin (NULL);
|
||||
HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\"");
|
||||
HTM_LABEL_Begin (NULL);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\""
|
||||
" id=\"WholeCrs\" name=\"WholeCrs\" value=\"Y\""
|
||||
" checked=\"checked\""
|
||||
" onclick=\"uncheckChildren(this,'GrpCods')\" />");
|
||||
HTM_INPUT_CHECKBOX ("WholeCrs",true,
|
||||
"id=\"WholeCrs\" value=\"Y\" checked=\"checked\""
|
||||
" onclick=\"uncheckChildren(this,'GrpCods')\"");
|
||||
fprintf (Gbl.F.Out,"%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||
HTM_LABEL_End ();
|
||||
HTM_TD_End ();
|
||||
|
|
|
@ -2662,9 +2662,9 @@ void Msg_ShowFormToFilterMsgs (void)
|
|||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||
fprintf (Gbl.F.Out,"%s: ",TxtFromTo[Gbl.Msg.TypeOfMessages]);
|
||||
fprintf (Gbl.F.Out,"<input type=\"search\" name=\"FilterFromTo\""
|
||||
" size=\"20\" maxlength=\"%u\" value=\"%s\" />",
|
||||
Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME * 3,Gbl.Msg.FilterFromTo);
|
||||
HTM_INPUT_SEARCH ("FilterFromTo",Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME * 3,
|
||||
Gbl.Msg.FilterFromTo,false,
|
||||
"size=\"20\"");
|
||||
HTM_LABEL_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -2672,9 +2672,9 @@ void Msg_ShowFormToFilterMsgs (void)
|
|||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||
fprintf (Gbl.F.Out,"%s: ",Txt_MSG_Content);
|
||||
fprintf (Gbl.F.Out,"<input type=\"search\" name=\"FilterContent\""
|
||||
" size=\"20\" maxlength=\"%u\" value=\"%s\" />",
|
||||
Msg_MAX_CHARS_FILTER_CONTENT,Gbl.Msg.FilterContent);
|
||||
HTM_INPUT_SEARCH ("FilterContent",Msg_MAX_CHARS_FILTER_CONTENT,
|
||||
Gbl.Msg.FilterContent,false,
|
||||
"size=\"20\"");
|
||||
HTM_LABEL_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -2695,11 +2695,9 @@ static void Msg_ShowFormToShowOnlyUnreadMessages (void)
|
|||
|
||||
/***** Put checkbox to select whether to show only unread (received) messages *****/
|
||||
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"OnlyUnreadMsgs\""
|
||||
" value=\"Y\"");
|
||||
if (Gbl.Msg.ShowOnlyUnreadMsgs)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," />");
|
||||
HTM_INPUT_CHECKBOX ("OnlyUnreadMsgs",false,
|
||||
"value=\"Y\"%s",
|
||||
Gbl.Msg.ShowOnlyUnreadMsgs ? " checked=\"checked\"" : "");
|
||||
fprintf (Gbl.F.Out,"%s",Txt_only_unread_messages);
|
||||
HTM_LABEL_End ();
|
||||
}
|
||||
|
|
|
@ -1941,19 +1941,17 @@ void Ntf_PutFormChangeNotifSentByEMail (void)
|
|||
HTM_TD_End ();
|
||||
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"%s\" value=\"Y\"",
|
||||
Ntf_ParamNotifMeAboutNotifyEvents[NotifyEvent]);
|
||||
if ((Gbl.Usrs.Me.UsrDat.NtfEvents.CreateNotif & (1 << NotifyEvent)))
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," />");
|
||||
HTM_INPUT_CHECKBOX (Ntf_ParamNotifMeAboutNotifyEvents[NotifyEvent],false,
|
||||
"value=\"Y\"%s",
|
||||
(Gbl.Usrs.Me.UsrDat.NtfEvents.CreateNotif &
|
||||
(1 << NotifyEvent)) ? " checked=\"checked\"" : "");
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TD_Begin ("class=\"CM\"");
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"%s\" value=\"Y\"",
|
||||
Ntf_ParamEmailMeAboutNotifyEvents[NotifyEvent]);
|
||||
if ((Gbl.Usrs.Me.UsrDat.NtfEvents.SendEmail & (1 << NotifyEvent)))
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," />");
|
||||
HTM_INPUT_CHECKBOX (Ntf_ParamEmailMeAboutNotifyEvents[NotifyEvent],false,
|
||||
"value=\"Y\"%s",
|
||||
(Gbl.Usrs.Me.UsrDat.NtfEvents.SendEmail &
|
||||
(1 << NotifyEvent)) ? " checked=\"checked\"" : "");
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
|
|
@ -863,7 +863,8 @@ void Pwd_AskForConfirmationOnDangerousAction (void)
|
|||
|
||||
/***** Checkbox *****/
|
||||
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);
|
||||
HTM_LABEL_End ();
|
||||
|
||||
|
|
|
@ -3758,11 +3758,9 @@ void Prj_ShowFormConfig (void)
|
|||
|
||||
HTM_TD_Begin ("class=\"LT\"");
|
||||
HTM_LABEL_Begin (NULL);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" id=\"Editable\""
|
||||
" name=\"Editable\" value=\"Y\"");
|
||||
if (Gbl.Prjs.Config.Editable)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," />");
|
||||
HTM_INPUT_CHECKBOX ("Editable",false,
|
||||
"id=\"Editable\" value=\"Y\"%s",
|
||||
Gbl.Prjs.Config.Editable ? " checked=\"checked\"" : "");
|
||||
fprintf (Gbl.F.Out,"%s",Txt_Editable_by_non_editing_teachers);
|
||||
HTM_LABEL_End ();
|
||||
HTM_TD_End ();
|
||||
|
|
19
swad_role.c
19
swad_role.c
|
@ -547,20 +547,11 @@ void Rol_WriteSelectorRoles (unsigned RolesAllowed,unsigned RolesSelected,
|
|||
if ((RolesAllowed & (1 << Role)))
|
||||
{
|
||||
HTM_LABEL_Begin (NULL);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"Role\" value=\"%u\"",
|
||||
(unsigned) Role);
|
||||
|
||||
if ((RolesSelected & (1 << Role)))
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
|
||||
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," />");
|
||||
HTM_INPUT_CHECKBOX ("Role",SendOnChange,
|
||||
"value=\"%u\"%s%s",
|
||||
(unsigned) Role,
|
||||
(RolesSelected & (1 << Role)) ? " checked=\"checked\"" : "",
|
||||
Disabled ? " disabled=\"disabled\"" : "");
|
||||
fprintf (Gbl.F.Out,"%s",Txt_ROLES_PLURAL_abc[Role][Usr_SEX_UNKNOWN]);
|
||||
HTM_LABEL_End ();
|
||||
fprintf (Gbl.F.Out,"<br />");
|
||||
|
|
|
@ -2091,11 +2091,9 @@ static void Svy_ShowLstGrpsToEditSurvey (long SvyCod)
|
|||
|
||||
HTM_TD_Begin ("colspan=\"7\" class=\"DAT LM\"");
|
||||
HTM_LABEL_Begin (NULL);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\""
|
||||
" id=\"WholeCrs\" name=\"WholeCrs\" value=\"Y\"");
|
||||
if (!Svy_CheckIfSvyIsAssociatedToGrps (SvyCod))
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," onclick=\"uncheckChildren(this,'GrpCods')\" />");
|
||||
HTM_INPUT_CHECKBOX ("WholeCrs",false,
|
||||
"id=\"WholeCrs\" value=\"Y\"%s onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||
Svy_CheckIfSvyIsAssociatedToGrps (SvyCod) ? "" : " checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out,"%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||
HTM_LABEL_End ();
|
||||
HTM_TD_End ();
|
||||
|
@ -3404,6 +3402,7 @@ static void Svy_WriteAnswersOfAQst (struct Survey *Svy,
|
|||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
unsigned NumUsrsThisAnswer;
|
||||
char StrAns[32];
|
||||
|
||||
/***** Get answers of this question *****/
|
||||
NumAnswers = Svy_GetAnswersQst (SvyQst->QstCod,&mysql_res); // Result: AnsInd,NumUsrs,Answer
|
||||
|
@ -3445,17 +3444,21 @@ static void Svy_WriteAnswersOfAQst (struct Survey *Svy,
|
|||
{
|
||||
/* Write selector to choice this answer */
|
||||
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)
|
||||
fprintf (Gbl.F.Out,"radio\""
|
||||
" onclick=\"selectUnselectRadio(this,this.form.Ans%010u,%u)\"",
|
||||
(unsigned) SvyQst->QstCod,NumAnswers);
|
||||
HTM_INPUT_RADIO (StrAns,false,
|
||||
"id=\"Ans%010u_%010u\" value=\"%u\""
|
||||
" onclick=\"selectUnselectRadio(this,this.form.Ans%010u,%u)\"",
|
||||
(unsigned) SvyQst->QstCod,NumAns,NumAns,
|
||||
NumAns,
|
||||
(unsigned) SvyQst->QstCod,NumAnswers);
|
||||
else // SvyQst->AnswerType == Svy_ANS_MULTIPLE_CHOICE
|
||||
fprintf (Gbl.F.Out,"checkbox\"");
|
||||
fprintf (Gbl.F.Out," id=\"Ans%010u_%010u\" name=\"Ans%010u\""
|
||||
" value=\"%u\" />",
|
||||
(unsigned) SvyQst->QstCod,NumAns,(unsigned) SvyQst->QstCod,
|
||||
NumAns);
|
||||
HTM_INPUT_CHECKBOX (StrAns,false,
|
||||
"id=\"Ans%010u_%010u\" value=\"%u\"",
|
||||
(unsigned) SvyQst->QstCod,NumAns,NumAns,
|
||||
NumAns);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
|
|
127
swad_test.c
127
swad_test.c
|
@ -468,10 +468,9 @@ void Tst_ShowNewTest (void)
|
|||
/***** Test result will be saved? *****/
|
||||
HTM_DIV_Begin ("class=\"CM\"");
|
||||
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"Save\" value=\"Y\"");
|
||||
if (Gbl.Test.AllowTeachers)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," />");
|
||||
HTM_INPUT_CHECKBOX ("Save",false,
|
||||
"value=\"Y\"%s",
|
||||
Gbl.Test.AllowTeachers ? " checked=\"checked\"" : "");
|
||||
fprintf (Gbl.F.Out," %s",Txt_Allow_teachers_to_consult_this_test);
|
||||
HTM_LABEL_End ();
|
||||
HTM_DIV_End ();
|
||||
|
@ -1667,6 +1666,7 @@ static void Tst_ShowFormSelTags (unsigned long NumRows,MYSQL_RES *mysql_res,
|
|||
unsigned long NumRow;
|
||||
MYSQL_ROW row;
|
||||
bool TagHidden = false;
|
||||
bool Checked;
|
||||
const char *Ptr;
|
||||
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_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"AllTags\" value=\"Y\"");
|
||||
if (Gbl.Test.Tags.All)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," onclick=\"togglecheckChildren(this,'ChkTag');\" />");
|
||||
HTM_INPUT_CHECKBOX ("AllTags",false,
|
||||
"value=\"Y\"%s onclick=\"togglecheckChildren(this,'ChkTag');\"",
|
||||
Gbl.Test.Tags.All ? " checked=\"checked\"" : "");
|
||||
fprintf (Gbl.F.Out," %s",Txt_All_tags);
|
||||
HTM_LABEL_End ();
|
||||
HTM_TD_End ();
|
||||
|
@ -1725,10 +1724,7 @@ static void Tst_ShowFormSelTags (unsigned long NumRows,MYSQL_RES *mysql_res,
|
|||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_LABEL_Begin ("class=\"DAT\"");
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"ChkTag\" value=\"%s\"",
|
||||
row[1]);
|
||||
Checked = false;
|
||||
if (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);
|
||||
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," %s",row[1]);
|
||||
HTM_LABEL_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_TST_STR_ANSWER_TYPES[Tst_NUM_ANS_TYPES];
|
||||
Tst_AnswerType_t AnsType;
|
||||
bool Checked;
|
||||
char UnsignedStr[10 + 1];
|
||||
const char *Ptr;
|
||||
|
||||
|
@ -2318,10 +2324,9 @@ static void Tst_ShowFormAnswerTypes (unsigned NumCols)
|
|||
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"AllAnsTypes\" value=\"Y\"");
|
||||
if (Gbl.Test.AllAnsTypes)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," onclick=\"togglecheckChildren(this,'AnswerType');\" />");
|
||||
HTM_INPUT_CHECKBOX ("AllAnsTypes",false,
|
||||
"value=\"Y\"%s onclick=\"togglecheckChildren(this,'AnswerType');\"",
|
||||
Gbl.Test.AllAnsTypes ? " checked=\"checked\"" : "");
|
||||
fprintf (Gbl.F.Out," %s",Txt_All_types_of_answers);
|
||||
HTM_LABEL_End ();
|
||||
HTM_TD_End ();
|
||||
|
@ -2335,18 +2340,23 @@ static void Tst_ShowFormAnswerTypes (unsigned NumCols)
|
|||
{
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_LABEL_Begin ("class=\"DAT\"");
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"AnswerType\" value=\"%u\"",
|
||||
(unsigned) AnsType);
|
||||
Checked = false;
|
||||
Ptr = Gbl.Test.ListAnsTypes;
|
||||
while (*Ptr)
|
||||
{
|
||||
Par_GetNextStrUntilSeparParamMult (&Ptr,UnsignedStr,10);
|
||||
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," %s",Txt_TST_STR_ANSWER_TYPES[AnsType]);
|
||||
HTM_LABEL_End ();
|
||||
HTM_TD_End ();
|
||||
|
@ -2931,11 +2941,9 @@ static void Tst_ListOneOrMoreQuestionsForEdition (unsigned long NumRows,
|
|||
if (NumRows == 1)
|
||||
Par_PutHiddenParamChar ("OnlyThisQst",'Y'); // If editing only one question, don't edit others
|
||||
Par_PutHiddenParamUnsigned (NULL,"Order",(unsigned) Gbl.Test.SelectedOrder);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"Shuffle\" value=\"Y\"");
|
||||
if (row[3][0] == 'Y')
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />",
|
||||
Gbl.Form.Id);
|
||||
HTM_INPUT_CHECKBOX ("Shuffle",true,
|
||||
"value=\"Y\"%s",
|
||||
row[3][0] == 'Y' ? " checked=\"checked\"" : "");
|
||||
Frm_EndForm ();
|
||||
}
|
||||
HTM_TD_End ();
|
||||
|
@ -3099,9 +3107,9 @@ static void Tst_ListOneOrMoreQuestionsForSelection (unsigned long NumRows,
|
|||
HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd);
|
||||
|
||||
/* Write checkbox to select the question */
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"QstCods\""
|
||||
" value=\"%ld\" />",
|
||||
Gbl.Test.QstCod);
|
||||
HTM_INPUT_CHECKBOX ("QstCods",false,
|
||||
"value=\"%ld\"",
|
||||
Gbl.Test.QstCod);
|
||||
|
||||
/* Write number of question */
|
||||
HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd);
|
||||
|
@ -3138,12 +3146,9 @@ static void Tst_ListOneOrMoreQuestionsForSelection (unsigned long NumRows,
|
|||
|
||||
/* Write if shuffle is enabled (row[3]) */
|
||||
HTM_TD_Begin ("class=\"DAT_SMALL CT COLOR%u\"",Gbl.RowEvenOdd);
|
||||
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"Shuffle\" value=\"Y\"");
|
||||
if (row[3][0] == 'Y')
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\" />");
|
||||
|
||||
HTM_INPUT_CHECKBOX ("Shuffle",false,
|
||||
"value=\"Y\"%s disabled=\"disabled\"",
|
||||
row[3][0] == 'Y' ? " checked=\"checked\"" : "");
|
||||
HTM_TD_End ();
|
||||
|
||||
/* Write stem (row[4]) */
|
||||
|
@ -3640,6 +3645,7 @@ static void Tst_WriteChoiceAnsViewTest (unsigned NumQst,long QstCod,bool Shuffle
|
|||
unsigned Index;
|
||||
bool ErrorInIndex = false;
|
||||
char ParamName[3 + 6 + 1];
|
||||
char StrAns[32];
|
||||
|
||||
/***** Get answers of a question from database *****/
|
||||
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",
|
||||
NumQst);
|
||||
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)
|
||||
fprintf (Gbl.F.Out,"radio\""
|
||||
" onclick=\"selectUnselectRadio(this,this.form.Ans%06u,%u);\"",
|
||||
NumQst,Gbl.Test.Answer.NumOptions);
|
||||
HTM_INPUT_RADIO (StrAns,false,
|
||||
"id=\"Ans%06u_%u\" value=\"%u\""
|
||||
" onclick=\"selectUnselectRadio(this,this.form.Ans%06u,%u);\"",
|
||||
NumQst,NumOpt,
|
||||
Index,
|
||||
NumQst,Gbl.Test.Answer.NumOptions);
|
||||
else // Gbl.Test.AnswerType == Tst_ANS_MULTIPLE_CHOICE
|
||||
fprintf (Gbl.F.Out,"checkbox\"");
|
||||
fprintf (Gbl.F.Out," id=\"Ans%06u_%u\" name=\"Ans%06u\" value=\"%u\" />",
|
||||
NumQst,NumOpt,
|
||||
NumQst,Index);
|
||||
HTM_INPUT_CHECKBOX (StrAns,false,
|
||||
"id=\"Ans%06u_%u\" value=\"%u\"",
|
||||
NumQst,NumOpt,
|
||||
Index);
|
||||
HTM_TD_End ();
|
||||
|
||||
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_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"Shuffle\" value=\"Y\"");
|
||||
if (Gbl.Test.Shuffle)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
if (Gbl.Test.AnswerType != Tst_ANS_UNIQUE_CHOICE &&
|
||||
Gbl.Test.AnswerType != Tst_ANS_MULTIPLE_CHOICE)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out," />");
|
||||
HTM_INPUT_CHECKBOX ("Shuffle",false,
|
||||
"value=\"Y\"%s%s",
|
||||
Gbl.Test.Shuffle ? " checked=\"checked\"" : "",
|
||||
Gbl.Test.AnswerType != Tst_ANS_UNIQUE_CHOICE &&
|
||||
Gbl.Test.AnswerType != Tst_ANS_MULTIPLE_CHOICE ? " disabled=\"disabled\"" : "");
|
||||
fprintf (Gbl.F.Out,"%s",Txt_Shuffle);
|
||||
HTM_LABEL_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\"");
|
||||
|
||||
/* Checkbox for multiple choice answers */
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"AnsMulti\" value=\"%u\"",
|
||||
NumOpt);
|
||||
if (Gbl.Test.AnswerType != Tst_ANS_MULTIPLE_CHOICE)
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
if (Gbl.Test.Answer.Options[NumOpt].Correct)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," />");
|
||||
HTM_INPUT_CHECKBOX ("AnsMulti",false,
|
||||
"value=\"%u\"%s%s",
|
||||
NumOpt,
|
||||
Gbl.Test.Answer.Options[NumOpt].Correct ? " checked=\"checked\"" : "",
|
||||
Gbl.Test.AnswerType == Tst_ANS_MULTIPLE_CHOICE ? "" : " disabled=\"disabled\"");
|
||||
|
||||
HTM_TD_End ();
|
||||
|
||||
|
|
30
swad_user.c
30
swad_user.c
|
@ -6294,11 +6294,9 @@ void Usr_PutCheckboxToSelectAllUsers (Rol_Role_t Role)
|
|||
|
||||
HTM_LABEL_Begin (NULL);
|
||||
if (Usr_NameSelUnsel[Role] && Usr_ParamUsrCod[Role])
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\""
|
||||
" name=\"%s\" value=\"\""
|
||||
" onclick=\"togglecheckChildren(this,'%s')\" />",
|
||||
Usr_NameSelUnsel[Role],
|
||||
Usr_ParamUsrCod[Role]);
|
||||
HTM_INPUT_CHECKBOX (Usr_NameSelUnsel[Role],false,
|
||||
"value=\"\" onclick=\"togglecheckChildren(this,'%s')\"",
|
||||
Usr_ParamUsrCod[Role]);
|
||||
else
|
||||
Rol_WrongRoleExit ();
|
||||
Sex = Usr_GetSexOfUsrsLst (Role);
|
||||
|
@ -6369,14 +6367,11 @@ static void Usr_PutCheckboxToSelectUser (Rol_Role_t Role,
|
|||
CheckboxChecked = Usr_FindUsrCodInListOfSelectedUsrs (EncryptedUsrCod);
|
||||
|
||||
/***** Check box *****/
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"%s\" value=\"%s\""
|
||||
" onclick=\"checkParent(this,'%s')\"",
|
||||
Usr_ParamUsrCod[Role],
|
||||
EncryptedUsrCod,
|
||||
Usr_NameSelUnsel[Role]);
|
||||
if (CheckboxChecked)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," />");
|
||||
HTM_INPUT_CHECKBOX (Usr_ParamUsrCod[Role],false,
|
||||
"value=\"%s\"%s onclick=\"checkParent(this,'%s')\"",
|
||||
EncryptedUsrCod,
|
||||
CheckboxChecked ? " checked=\"checked\"" : "",
|
||||
Usr_NameSelUnsel[Role]);
|
||||
}
|
||||
else
|
||||
Rol_WrongRoleExit ();
|
||||
|
@ -6395,12 +6390,9 @@ static void Usr_PutCheckboxListWithPhotos (void)
|
|||
|
||||
/***** Put checkbox to select whether list users with photos *****/
|
||||
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||
fprintf (Gbl.F.Out,"<input type=\"checkbox\" name=\"WithPhotos\""
|
||||
" value=\"Y\"");
|
||||
if (Gbl.Usrs.Listing.WithPhotos)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />",
|
||||
Gbl.Form.Id);
|
||||
HTM_INPUT_CHECKBOX ("WithPhotos",true,
|
||||
"value=\"Y\"%s",
|
||||
Gbl.Usrs.Listing.WithPhotos ? " checked=\"checked\"" : "");
|
||||
fprintf (Gbl.F.Out,"%s",Txt_Display_photos);
|
||||
HTM_LABEL_End ();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue