Version19.54.1

This commit is contained in:
Antonio Cañas Vargas 2019-11-05 23:11:31 +01:00
parent 6ef4da55f2
commit 91e0df18c3
6 changed files with 78 additions and 31 deletions

View File

@ -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,"<option value=\"");
switch (Type)
{
case HTM_Type_UNSIGNED:
fprintf (Gbl.F.Out,"%u",*((unsigned *) ValuePtr));
break;
case HTM_Type_LONG:
fprintf (Gbl.F.Out,"%ld",*((long *) ValuePtr));
break;
case HTM_Type_STRING:
fprintf (Gbl.F.Out,"%s",(char *) ValuePtr);
break;
}
fprintf (Gbl.F.Out,"\"");
if (Selected)
fprintf (Gbl.F.Out," selected=\"selected\"");
if (Disabled)
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out,">");
if (fmt)
{
if (fmt[0])
{
va_start (ap,fmt);
NumBytesPrinted = vasprintf (&Content,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 HTML *****/
fprintf (Gbl.F.Out,"%s",Content);
free ((void *) Content);
}
}
fprintf (Gbl.F.Out,"</option>");
}
/*****************************************************************************/
/********************************** Images ***********************************/
/*****************************************************************************/

View File

@ -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,...);

View File

@ -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 ();

View File

@ -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,"<option value=\"N\"");
if (!Att.CommentTchVisible)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",
Txt_Hidden_MALE_PLURAL);
fprintf (Gbl.F.Out,"<option value=\"Y\"");
if (Att.CommentTchVisible)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",
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 ();

View File

@ -434,11 +434,9 @@ static void Ctr_Configuration (bool PrintView)
for (NumIns = 0;
NumIns < Gbl.Hierarchy.Cty.Inss.Num;
NumIns++)
fprintf (Gbl.F.Out,"<option value=\"%ld\"%s>%s</option>",
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,"<option value=\"0\"");
if (Gbl.Hierarchy.Ctr.PlcCod == 0)
fprintf (Gbl.F.Out," selected=\"selected\"");
fprintf (Gbl.F.Out,">%s</option>",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,"<option value=\"%ld\"%s>%s</option>",
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 ();

View File

@ -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)