diff --git a/swad_HTML.c b/swad_HTML.c index 99cfbaeb..1ade7213 100644 --- a/swad_HTML.c +++ b/swad_HTML.c @@ -1213,6 +1213,56 @@ void HTM_SELECT_End (void) HTM_SELECT_NestingLevel--; } +void HTM_OPTION (HTM_Type_t Type,void *ValuePtr,bool Selected,bool Disabled, + const char *fmt,...) + { + va_list ap; + int NumBytesPrinted; + char *Content; + + fprintf (Gbl.F.Out,""); + } + /*****************************************************************************/ /********************************** Images ***********************************/ /*****************************************************************************/ diff --git a/swad_HTML.h b/swad_HTML.h index 626a8228..71579e9c 100644 --- a/swad_HTML.h +++ b/swad_HTML.h @@ -35,6 +35,13 @@ /********************************* Public types ******************************/ /*****************************************************************************/ +typedef enum + { + HTM_Type_UNSIGNED, + HTM_Type_LONG, + HTM_Type_STRING, + } HTM_Type_t; + /*****************************************************************************/ /****************************** Public prototypes ****************************/ /*****************************************************************************/ @@ -116,6 +123,8 @@ void HTM_TEXTAREA_End (void); void HTM_SELECT_Begin (bool SubmitOnChange, const char *fmt,...); void HTM_SELECT_End (void); +void HTM_OPTION (HTM_Type_t Type,void *ValuePtr,bool Selected,bool Disabled, + const char *fmt,...); void HTM_IMG (const char *URL,const char *Icon,const char *Title, const char *fmt,...); diff --git a/swad_assignment.c b/swad_assignment.c index 7fae5f68..49b5d9c1 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -354,9 +354,9 @@ static void Asg_ShowOneAssignment (long AsgCod,bool PrintView) Frm_SetAnchorStr (Asg.AsgCod,&Anchor); /***** Write first row of data of this assignment *****/ - /* Forms to remove/edit this assignment */ HTM_TR_Begin (NULL); + /* Forms to remove/edit this assignment */ if (PrintView) HTM_TD_Begin ("rowspan=\"2\" class=\"CONTEXT_COL\""); else @@ -414,11 +414,12 @@ static void Asg_ShowOneAssignment (long AsgCod,bool PrintView) /* Assignment folder */ if (PrintView) - HTM_TD_Begin ("class=\"DAT LT"); + HTM_TD_Begin ("class=\"DAT LT\""); else - HTM_TD_Begin ("class=\"DAT LT COLOR%u",Gbl.RowEvenOdd); + HTM_TD_Begin ("class=\"DAT LT COLOR%u\"",Gbl.RowEvenOdd); if (Asg.SendWork == Asg_SEND_WORK) Asg_WriteAssignmentFolder (&Asg,PrintView); + HTM_TD_End (); HTM_TR_End (); diff --git a/swad_attendance.c b/swad_attendance.c index 62322bfa..423c02e8 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -1131,19 +1131,10 @@ void Att_RequestCreatOrEditAttEvent (void) HTM_TD_Begin ("class=\"LT\""); HTM_SELECT_Begin (false, "id=\"ComTchVisible\" name=\"ComTchVisible\""); - - fprintf (Gbl.F.Out,"", - Txt_Hidden_MALE_PLURAL); - - fprintf (Gbl.F.Out,"", - Txt_Visible_MALE_PLURAL); - + HTM_OPTION (HTM_Type_STRING,(void *) "N",!Att.CommentTchVisible,false, + "%s",Txt_Hidden_MALE_PLURAL); + HTM_OPTION (HTM_Type_STRING,(void *) "Y",Att.CommentTchVisible,false, + "%s",Txt_Visible_MALE_PLURAL); HTM_SELECT_End (); HTM_TD_End (); HTM_TR_End (); diff --git a/swad_centre.c b/swad_centre.c index e4473e40..aaafe1ff 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -434,11 +434,9 @@ static void Ctr_Configuration (bool PrintView) for (NumIns = 0; NumIns < Gbl.Hierarchy.Cty.Inss.Num; NumIns++) - fprintf (Gbl.F.Out,"", - Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod, - Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod == Gbl.Hierarchy.Ins.InsCod ? " selected=\"selected\"" : - "", - Gbl.Hierarchy.Cty.Inss.Lst[NumIns].ShrtName); + HTM_OPTION (HTM_Type_LONG,(void *) &Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod, + Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod == Gbl.Hierarchy.Ins.InsCod,false, + "%s",Gbl.Hierarchy.Cty.Inss.Lst[NumIns].ShrtName); HTM_SELECT_End (); Frm_EndForm (); @@ -526,18 +524,15 @@ static void Ctr_Configuration (bool PrintView) Frm_StartForm (ActChgCtrPlcCfg); HTM_SELECT_Begin (true, "name=\"PlcCod\" class=\"INPUT_SHORT_NAME\""); - fprintf (Gbl.F.Out,"",Txt_Another_place); + HTM_OPTION (HTM_Type_STRING,(void *) "0", + Gbl.Hierarchy.Ctr.PlcCod == 0,false, + "%s",Txt_Another_place); for (NumPlc = 0; NumPlc < Gbl.Plcs.Num; NumPlc++) - fprintf (Gbl.F.Out,"", - Gbl.Plcs.Lst[NumPlc].PlcCod, - (Gbl.Plcs.Lst[NumPlc].PlcCod == Gbl.Hierarchy.Ctr.PlcCod) ? " selected=\"selected\"" : - "", - Gbl.Plcs.Lst[NumPlc].ShrtName); + HTM_OPTION (HTM_Type_LONG,(void *) &Gbl.Plcs.Lst[NumPlc].PlcCod, + Gbl.Plcs.Lst[NumPlc].PlcCod == Gbl.Hierarchy.Ctr.PlcCod,false, + "%s",Gbl.Plcs.Lst[NumPlc].ShrtName); HTM_SELECT_End (); Frm_EndForm (); diff --git a/swad_changelog.h b/swad_changelog.h index 67030702..52e3e4d0 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -490,7 +490,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.53.3 (2019-11-05)" +#define Log_PLATFORM_VERSION "SWAD 19.54.1 (2019-11-05)" #define CSS_FILE "swad19.47.css" #define JS_FILE "swad19.39.js" /* @@ -498,6 +498,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.54.1: Nov 05, 2019 Fixed bug in assignments, reported by Eva Martínez Ortigosa. (246054 lines) Version 19.54: Nov 05, 2019 Code refactoring in HTML select options. (? lines) Version 19.53.3: Nov 05, 2019 Fixed bug in HTML form to upload files, reported by Eva Martínez Ortigosa. (246013 lines) Version 19.53.2: Nov 05, 2019 Fixed bug in HTML input search. (246011 lines)