diff --git a/swad_changelog.h b/swad_changelog.h index 998e70660..34509acd4 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -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.6 (2019-11-03)" +#define Log_PLATFORM_VERSION "SWAD 19.51.7 (2019-11-03)" #define CSS_FILE "swad19.47.css" #define JS_FILE "swad19.39.js" /* @@ -496,6 +496,7 @@ ps2pdf source.ps destination.pdf // TODO: Importante: filtrar proyectos por usuarios (igual que en trabajos o en asistencia) // TODO: Seguir cambiando input text * + Version 19.51.7: Nov 03, 2019 Code refactoring in HTML inputs. (246051 lines) Version 19.51.6: Nov 03, 2019 Code refactoring in HTML inputs. (246125 lines) Version 19.51.5: Nov 03, 2019 Code refactoring in HTML inputs. (246132 lines) Version 19.51.4: Nov 03, 2019 Code refactoring in HTML labels. diff --git a/swad_course.c b/swad_course.c index 6ee31aab7..b1bc762a3 100644 --- a/swad_course.c +++ b/swad_course.c @@ -294,14 +294,10 @@ static void Crs_Configuration (bool PrintView) { /* Form to change course full name */ Frm_StartForm (ActRenCrsFulCfg); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_FULL_NAME, - Gbl.Hierarchy.Crs.FullName, - Gbl.Form.Id); + HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Gbl.Hierarchy.Crs.FullName, + "class=\"INPUT_FULL_NAME\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); } else // I can not edit course full name @@ -326,14 +322,10 @@ static void Crs_Configuration (bool PrintView) { /* Form to change course short name */ Frm_StartForm (ActRenCrsShoCfg); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_SHRT_NAME, - Gbl.Hierarchy.Crs.ShrtName, - Gbl.Form.Id); + HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Gbl.Hierarchy.Crs.ShrtName, + "class=\"INPUT_SHORT_NAME\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); } else // I can not edit course short name @@ -393,14 +385,11 @@ static void Crs_Configuration (bool PrintView) if (IsForm) { Frm_StartForm (ActChgInsCrsCodCfg); - fprintf (Gbl.F.Out,"", - Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD, - Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD, - Gbl.Hierarchy.Crs.InstitutionalCrsCod, - Gbl.Form.Id); + HTM_INPUT_TEXT ("InsCrsCod",Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD,Gbl.Hierarchy.Crs.InstitutionalCrsCod, + "size=\"%u\"" + " onchange=\"document.getElementById('%s').submit();\"", + Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD, + Gbl.Form.Id); Frm_EndForm (); } else @@ -1484,13 +1473,10 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year) { Frm_StartForm (ActChgInsCrsCod); Crs_PutParamOtherCrsCod (Crs->CrsCod); - fprintf (Gbl.F.Out,"", - Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD, - Crs->InstitutionalCrsCod, - Gbl.Form.Id); + HTM_INPUT_TEXT ("InsCrsCod",Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD,Crs->InstitutionalCrsCod, + " class=\"INPUT_INS_CODE\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); } else @@ -1527,12 +1513,10 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year) { Frm_StartForm (ActRenCrsSho); Crs_PutParamOtherCrsCod (Crs->CrsCod); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_SHRT_NAME,Crs->ShrtName, - Gbl.Form.Id); + HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Crs->ShrtName, + " class=\"INPUT_SHORT_NAME\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); } else @@ -1545,12 +1529,10 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year) { Frm_StartForm (ActRenCrsFul); Crs_PutParamOtherCrsCod (Crs->CrsCod); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_FULL_NAME,Crs->FullName, - Gbl.Form.Id); + HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Crs->FullName, + " class=\"INPUT_FULL_NAME\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); } else @@ -1698,11 +1680,8 @@ static void Crs_PutFormToCreateCourse (void) /***** Institutional code of the course *****/ HTM_TD_Begin ("class=\"CM\""); - fprintf (Gbl.F.Out,"", - Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD, - Crs_EditingCrs->InstitutionalCrsCod); + HTM_INPUT_TEXT ("InsCrsCod",Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD,Crs_EditingCrs->InstitutionalCrsCod, + " class=\"INPUT_INS_CODE\""); HTM_TD_End (); /***** Year *****/ @@ -1721,20 +1700,14 @@ static void Crs_PutFormToCreateCourse (void) /***** Course short name *****/ HTM_TD_Begin ("class=\"LM\""); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_SHRT_NAME,Crs_EditingCrs->ShrtName); + HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Crs_EditingCrs->ShrtName, + " class=\"INPUT_SHORT_NAME\" required=\"required\""); HTM_TD_End (); /***** Course full name *****/ HTM_TD_Begin ("class=\"LM\""); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_FULL_NAME,Crs_EditingCrs->FullName); + HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Crs_EditingCrs->FullName, + " class=\"INPUT_FULL_NAME\" required=\"required\""); HTM_TD_End (); /***** Current number of teachers in this course *****/ diff --git a/swad_degree.c b/swad_degree.c index ca91cbc13..f35451707 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -397,14 +397,10 @@ static void Deg_Configuration (bool PrintView) { /* Form to change degree full name */ Frm_StartForm (ActRenDegFulCfg); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_FULL_NAME, - Gbl.Hierarchy.Deg.FullName, - Gbl.Form.Id); + HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Gbl.Hierarchy.Deg.FullName, + " class=\"INPUT_FULL_NAME\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); } else // I can not edit degree full name @@ -429,14 +425,10 @@ static void Deg_Configuration (bool PrintView) { /* Form to change degree short name */ Frm_StartForm (ActRenDegShoCfg); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_SHRT_NAME, - Gbl.Hierarchy.Deg.ShrtName, - Gbl.Form.Id); + HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Gbl.Hierarchy.Deg.ShrtName, + " class=\"INPUT_SHORT_NAME\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); } else // I can not edit degree short name @@ -758,11 +750,10 @@ static void Deg_ListDegreesForEdition (void) { Frm_StartForm (ActRenDegSho); Deg_PutParamOtherDegCod (Deg->DegCod); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_SHRT_NAME,Deg->ShrtName,Gbl.Form.Id); + HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Deg->ShrtName, + " class=\"INPUT_SHORT_NAME\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); } else @@ -775,11 +766,10 @@ static void Deg_ListDegreesForEdition (void) { Frm_StartForm (ActRenDegFul); Deg_PutParamOtherDegCod (Deg->DegCod); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_FULL_NAME,Deg->FullName,Gbl.Form.Id); + HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Deg->FullName, + " class=\"INPUT_FULL_NAME\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); } else @@ -984,20 +974,14 @@ static void Deg_PutFormToCreateDegree (void) /***** Degree short name *****/ HTM_TD_Begin ("class=\"LM\""); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_SHRT_NAME,Deg_EditingDeg->ShrtName); + HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Deg_EditingDeg->ShrtName, + " class=\"INPUT_SHORT_NAME\" required=\"required\""); HTM_TD_End (); /***** Degree full name *****/ HTM_TD_Begin ("class=\"LM\""); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_FULL_NAME,Deg_EditingDeg->FullName); + HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Deg_EditingDeg->FullName, + " class=\"INPUT_FULL_NAME\" required=\"required\""); HTM_TD_End (); /***** Degree type *****/ diff --git a/swad_degree_type.c b/swad_degree_type.c index a62c3a2a4..fe6cb4f71 100644 --- a/swad_degree_type.c +++ b/swad_degree_type.c @@ -422,13 +422,10 @@ static void DT_ListDegreeTypesForEdition (void) HTM_TD_Begin ("class=\"LM\""); Frm_StartForm (ActRenDegTyp); DT_PutParamOtherDegTypCod (Gbl.DegTypes.Lst[NumDegTyp].DegTypCod); - fprintf (Gbl.F.Out,"", - Deg_MAX_CHARS_DEGREE_TYPE_NAME, - Gbl.DegTypes.Lst[NumDegTyp].DegTypName, - Gbl.Form.Id); + HTM_INPUT_TEXT ("DegTypName",Deg_MAX_CHARS_DEGREE_TYPE_NAME,Gbl.DegTypes.Lst[NumDegTyp].DegTypName, + " size=\"25\" required=\"required\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); HTM_TD_End (); @@ -484,10 +481,9 @@ static void DT_PutFormToCreateDegreeType (void) /***** Degree type name *****/ HTM_TD_Begin ("class=\"LM\""); - fprintf (Gbl.F.Out,"", - Deg_MAX_CHARS_DEGREE_TYPE_NAME,DT_EditingDegTyp->DegTypName); + HTM_INPUT_TEXT ("DegTypName",Deg_MAX_CHARS_DEGREE_TYPE_NAME,DT_EditingDegTyp->DegTypName, + " size=\"25\" required=\"required\"", + Gbl.Form.Id); HTM_TD_End (); /***** Number of degrees of this degree type ****/ diff --git a/swad_department.c b/swad_department.c index 71c1c06e7..ece2849ec 100644 --- a/swad_department.c +++ b/swad_department.c @@ -562,11 +562,10 @@ static void Dpt_ListDepartmentsForEdition (void) HTM_TD_Begin ("class=\"CM\""); Frm_StartForm (ActRenDptSho); Dpt_PutParamDptCod (Dpt->DptCod); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_SHRT_NAME,Dpt->ShrtName,Gbl.Form.Id); + HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Dpt->ShrtName, + " class=\"INPUT_SHORT_NAME\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); HTM_TD_End (); @@ -574,11 +573,10 @@ static void Dpt_ListDepartmentsForEdition (void) HTM_TD_Begin ("class=\"CM\""); Frm_StartForm (ActRenDptFul); Dpt_PutParamDptCod (Dpt->DptCod); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_FULL_NAME,Dpt->FullName,Gbl.Form.Id); + HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Dpt->FullName, + " class=\"INPUT_FULL_NAME\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); HTM_TD_End (); @@ -945,20 +943,14 @@ static void Dpt_PutFormToCreateDepartment (void) /***** Department short name *****/ HTM_TD_Begin ("class=\"CM\""); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_SHRT_NAME,Dpt_EditingDpt->ShrtName); + HTM_INPUT_TEXT ("ShortName",Hie_MAX_CHARS_SHRT_NAME,Dpt_EditingDpt->ShrtName, + " class=\"INPUT_SHORT_NAME\" required=\"required\""); HTM_TD_End (); /***** Department full name *****/ HTM_TD_Begin ("class=\"CM\""); - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_FULL_NAME,Dpt_EditingDpt->FullName); + HTM_INPUT_TEXT ("FullName",Hie_MAX_CHARS_FULL_NAME,Dpt_EditingDpt->FullName, + " class=\"INPUT_FULL_NAME\" required=\"required\""); HTM_TD_End (); /***** Department WWW *****/ diff --git a/swad_enrolment.c b/swad_enrolment.c index 264731d13..b1a934392 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -381,10 +381,8 @@ void Enr_WriteFormToReqAnotherUsrID (Act_Action_t NextAction,void (*FuncParams) The_ClassFormInBox[Gbl.Prefs.Theme]); fprintf (Gbl.F.Out,"%s: ",Txt_nick_email_or_ID); HTM_LABEL_End (); - fprintf (Gbl.F.Out,"", - Cns_MAX_CHARS_EMAIL_ADDRESS); + HTM_INPUT_TEXT ("OtherUsrIDNickOrEMail",Cns_MAX_CHARS_EMAIL_ADDRESS,"", + " size=\"18\" required=\"required\""); /***** Send button*****/ Btn_PutConfirmButton (Txt_Continue); diff --git a/swad_exam.c b/swad_exam.c index d12effefd..13f83d034 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -1099,14 +1099,10 @@ static void Exa_ShowExamAnnouncement (long ExaCod, HTM_TD_Begin ("class=\"%s LT\"",StyleNormal); if (TypeViewExamAnnouncement == Exa_FORM_VIEW) - { - fprintf (Gbl.F.Out,"", - Hie_MAX_CHARS_FULL_NAME,Gbl.ExamAnns.ExaDat.CrsFullName); - } + HTM_INPUT_TEXT ("CrsName",Hie_MAX_CHARS_FULL_NAME,Gbl.ExamAnns.ExaDat.CrsFullName, + " size=\"30\""); else - fprintf (Gbl.F.Out,"%s", - Gbl.ExamAnns.ExaDat.CrsFullName); + fprintf (Gbl.F.Out,"%s",Gbl.ExamAnns.ExaDat.CrsFullName); HTM_TD_End (); HTM_TR_End (); @@ -1156,10 +1152,8 @@ static void Exa_ShowExamAnnouncement (long ExaCod, HTM_TD_Begin ("class=\"%s LT\"",StyleNormal); if (TypeViewExamAnnouncement == Exa_FORM_VIEW) - fprintf (Gbl.F.Out,"", - Exa_MAX_CHARS_SESSION,Gbl.ExamAnns.ExaDat.Session); + HTM_INPUT_TEXT ("ExamSession",Exa_MAX_CHARS_SESSION,Gbl.ExamAnns.ExaDat.Session, + " size=\"30\""); else fprintf (Gbl.F.Out,"%s",Gbl.ExamAnns.ExaDat.Session); HTM_TD_End (); diff --git a/swad_file_browser.c b/swad_file_browser.c index 2ad440359..a9bd3781b 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -6262,15 +6262,13 @@ static void Brw_WriteFileName (unsigned Level,bool IsPublic) fprintf (Gbl.F.Out," "); if (Gbl.FileBrowser.ICanEditFileOrFolder) // Can I rename this folder? { - fprintf (Gbl.F.Out,"", - Brw_MAX_CHARS_FOLDER,Gbl.FileBrowser.FilFolLnk.Name, - Gbl.FileBrowser.InputStyle, - Gbl.FileBrowser.Clipboard.IsThisFile ? "LIGHT_GREEN" : - Gbl.ColorRows[Gbl.RowEvenOdd], - Gbl.Form.Id); + HTM_INPUT_TEXT ("NewFolderName",Brw_MAX_CHARS_FOLDER,Gbl.FileBrowser.FilFolLnk.Name, + " class=\"%s %s\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.FileBrowser.InputStyle, + Gbl.FileBrowser.Clipboard.IsThisFile ? "LIGHT_GREEN" : + Gbl.ColorRows[Gbl.RowEvenOdd], + Gbl.Form.Id); Frm_EndForm (); } else @@ -8344,10 +8342,8 @@ static void Brw_PutFormToCreateAFolder (const char FileNameToShow[NAME_MAX + 1]) /***** Folder *****/ HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]); fprintf (Gbl.F.Out,"%s: ",Txt_Folder); - fprintf (Gbl.F.Out,"", - Brw_MAX_CHARS_FOLDER); + HTM_INPUT_TEXT ("NewFolderName",Brw_MAX_CHARS_FOLDER,"", + " size=\"30\" required=\"required\""); HTM_LABEL_End (); /***** Send button and end box *****/ @@ -8534,10 +8530,8 @@ static void Brw_PutFormToCreateALink (const char *FileNameToShow) HTM_TD_End (); HTM_TD_Begin ("class=\"LM\""); - fprintf (Gbl.F.Out,"", - Brw_MAX_CHARS_FOLDER); + HTM_INPUT_TEXT ("NewLinkName",Brw_MAX_CHARS_FOLDER,"", + " size=\"30\""); HTM_TD_End (); HTM_TR_End (); diff --git a/swad_forum.c b/swad_forum.c index 38efe8820..13af7c95d 100644 --- a/swad_forum.c +++ b/swad_forum.c @@ -3911,13 +3911,9 @@ static void For_WriteFormForumPst (bool IsReply,const char *Subject) HTM_TD_End (); HTM_TD_Begin ("class=\"LM\""); - fprintf (Gbl.F.Out,"", - Cns_MAX_CHARS_SUBJECT, - IsReply ? Subject : - ""); + HTM_INPUT_TEXT ("Subject",Cns_MAX_CHARS_SUBJECT,IsReply ? Subject : + "", + " class=\"MSG_SUBJECT\" required=\"required\""); HTM_TD_End (); HTM_TR_End (); diff --git a/swad_game.c b/swad_game.c index 3645c9f49..ec4c306c4 100644 --- a/swad_game.c +++ b/swad_game.c @@ -1145,10 +1145,8 @@ static void Gam_PutFormsEditionGame (struct Game *Game,bool ItsANewGame) HTM_TD_End (); HTM_TD_Begin ("class=\"LM\""); - fprintf (Gbl.F.Out,"", - Gam_MAX_CHARS_TITLE,Game->Title); + HTM_INPUT_TEXT ("Title",Gam_MAX_CHARS_TITLE,Game->Title, + " size=\"45\" required=\"required\""); HTM_TD_End (); HTM_TR_End (); diff --git a/swad_group.c b/swad_group.c index d6c436c37..de06dd45a 100644 --- a/swad_group.c +++ b/swad_group.c @@ -151,7 +151,7 @@ static void Grp_PutParamRemGrp (void); static void Grp_RemoveGroupTypeCompletely (void); static void Grp_RemoveGroupCompletely (void); -static void Grp_WriteMaxStds (unsigned MaxStudents); +static void Grp_WriteMaxStds (char Str[10 + 1],unsigned MaxStudents); static long Grp_GetParamGrpTypCod (void); static long Grp_GetParamGrpCod (void); static void Grp_PutParamGrpTypCod (long GrpTypCod); @@ -1318,12 +1318,10 @@ static void Grp_ListGroupTypesForEdition (void) HTM_TD_Begin ("class=\"LM\""); Frm_StartFormAnchor (ActRenGrpTyp,Grp_GROUP_TYPES_SECTION_ID); Grp_PutParamGrpTypCod (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); - fprintf (Gbl.F.Out,"", - Grp_MAX_CHARS_GROUP_TYPE_NAME, - Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName, - Gbl.Form.Id); + HTM_INPUT_TEXT ("GrpTypName",Grp_MAX_CHARS_GROUP_TYPE_NAME,Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName, + " size=\"12\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); HTM_TD_End (); @@ -1491,6 +1489,7 @@ static void Grp_ListGroupsForEdition (void) struct GroupType *GrpTypAux; struct Group *Grp; Rol_Role_t Role; + char StrMaxStudents[10 + 1]; /***** Write heading *****/ HTM_TABLE_BeginWidePadding (2); @@ -1580,10 +1579,10 @@ static void Grp_ListGroupsForEdition (void) HTM_TD_Begin ("class=\"CM\""); Frm_StartFormAnchor (ActRenGrp,Grp_GROUPS_SECTION_ID); Grp_PutParamGrpCod (Grp->GrpCod); - fprintf (Gbl.F.Out,"", - Grp_MAX_CHARS_GROUP_NAME,Grp->GrpName,Gbl.Form.Id); + HTM_INPUT_TEXT ("GrpName",Grp_MAX_CHARS_GROUP_NAME,Grp->GrpName, + " size=\"20\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); HTM_TD_End (); @@ -1642,11 +1641,11 @@ static void Grp_ListGroupsForEdition (void) HTM_TD_Begin ("class=\"CM\""); Frm_StartFormAnchor (ActChgMaxStdGrp,Grp_GROUPS_SECTION_ID); Grp_PutParamGrpCod (Grp->GrpCod); - fprintf (Gbl.F.Out,"MaxStudents); - fprintf (Gbl.F.Out,"\" onchange=\"document.getElementById('%s').submit();\" />", - Gbl.Form.Id); + Grp_WriteMaxStds (StrMaxStudents,Grp->MaxStudents); + HTM_INPUT_TEXT ("MaxStudents",10,StrMaxStudents, + " size=\"3\"" + " onchange=\"document.getElementById('%s').submit();\"", + Gbl.Form.Id); Frm_EndForm (); HTM_TD_End (); @@ -2389,6 +2388,7 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight) extern const char *Txt_Group_X_closed; int Vacant; Rol_Role_t Role; + char StrMaxStudents[10 + 1]; /***** Write icon to show if group is open or closed *****/ snprintf (Gbl.Title,sizeof (Gbl.Title), @@ -2440,8 +2440,8 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight) HTM_TD_Begin ("class=\"DAT CM LIGHT_BLUE\""); else HTM_TD_Begin ("class=\"DAT CM\""); - Grp_WriteMaxStds (Grp->MaxStudents); - fprintf (Gbl.F.Out," "); + Grp_WriteMaxStds (StrMaxStudents,Grp->MaxStudents); + fprintf (Gbl.F.Out,"%s ",StrMaxStudents); HTM_TD_End (); /***** Vacants in this group *****/ @@ -2493,10 +2493,8 @@ static void Grp_PutFormToCreateGroupType (void) /***** Name of group type *****/ HTM_TD_Begin ("class=\"LM\""); - fprintf (Gbl.F.Out,"", - Grp_MAX_CHARS_GROUP_TYPE_NAME,Gbl.Crs.Grps.GrpTyp.GrpTypName); + HTM_INPUT_TEXT ("GrpTypName",Grp_MAX_CHARS_GROUP_TYPE_NAME,Gbl.Crs.Grps.GrpTyp.GrpTypName, + " size=\"12\" required=\"required\""); HTM_TD_End (); /***** Is it mandatory to register in any groups of this type? *****/ @@ -2591,6 +2589,7 @@ static void Grp_PutFormToCreateGroup (void) unsigned NumGrpTyp; unsigned NumCla; Rol_Role_t Role; + char StrMaxStudents[10 + 1]; /***** Begin form *****/ HTM_SECTION_Begin (Grp_NEW_GROUP_SECTION_ID); @@ -2644,10 +2643,8 @@ static void Grp_PutFormToCreateGroup (void) /***** Group name *****/ HTM_TD_Begin ("class=\"CM\""); - fprintf (Gbl.F.Out,"", - Grp_MAX_CHARS_GROUP_NAME,Gbl.Crs.Grps.GrpName); + HTM_INPUT_TEXT ("GrpName",Grp_MAX_CHARS_GROUP_NAME,Gbl.Crs.Grps.GrpName, + " size=\"20\" required=\"required\""); HTM_TD_End (); /***** Classroom *****/ @@ -2698,10 +2695,9 @@ static void Grp_PutFormToCreateGroup (void) /***** Maximum number of students *****/ HTM_TD_Begin ("class=\"CM\""); - fprintf (Gbl.F.Out,""); + Grp_WriteMaxStds (StrMaxStudents,Gbl.Crs.Grps.MaxStudents); + HTM_INPUT_TEXT ("MaxStudents",10,StrMaxStudents, + " size=\"3\""); HTM_TD_End (); HTM_TR_End (); @@ -4656,10 +4652,14 @@ void Grp_ChangeMaxStdsGrp (void) /************* Write the maximum number of students in a group ***************/ /*****************************************************************************/ -static void Grp_WriteMaxStds (unsigned MaxStudents) +static void Grp_WriteMaxStds (char Str[10 + 1],unsigned MaxStudents) { if (MaxStudents <= Grp_MAX_STUDENTS_IN_A_GROUP) - fprintf (Gbl.F.Out,"%u",MaxStudents); + snprintf (Str,10 + 1, + "%u", + MaxStudents); + else + Str[0] = '\0'; } /*****************************************************************************/