Version19.78.2

This commit is contained in:
Antonio Cañas Vargas 2019-11-27 01:01:27 +01:00
parent 9fac82d1d8
commit 9974f5ea4d
9 changed files with 83 additions and 29 deletions

View File

@ -1189,8 +1189,8 @@ void HTM_INPUT_PASSWORD (const char *Name,const char *PlaceHolder,
fprintf (Gbl.F.Out," />");
}
void HTM_INPUT_NUMBER (const char *Name,long Min,long Max,long Value,bool Disabled,
const char *fmt,...)
void HTM_INPUT_LONG (const char *Name,long Min,long Max,long Value,bool Disabled,
const char *fmt,...)
{
va_list ap;
int NumBytesPrinted;
@ -1223,6 +1223,42 @@ void HTM_INPUT_NUMBER (const char *Name,long Min,long Max,long Value,bool Disabl
fprintf (Gbl.F.Out," />");
}
void HTM_INPUT_FLOAT (const char *Name,double Min,double Max,double Step,double Value,bool Disabled,
const char *fmt,...)
{
va_list ap;
int NumBytesPrinted;
char *Attr;
Str_SetDecimalPointToUS (); // To print the floating point as a dot
fprintf (Gbl.F.Out,"<input type=\"number\" name=\"%s\""
" min=\"%lg\" max=\"%lg\" step=\"%lg\" value=\"%lg\"",
Name,
Min,Max,Step,Value);
Str_SetDecimalPointToLocal (); // Return to local system
if (Disabled)
fprintf (Gbl.F.Out," disabled=\"disabled\"");
if (fmt)
{
if (fmt[0])
{
va_start (ap,fmt);
NumBytesPrinted = vasprintf (&Attr,fmt,ap);
va_end (ap);
if (NumBytesPrinted < 0) // -1 if no memory or any other error
Lay_NotEnoughMemoryExit ();
/***** Print attributes *****/
fprintf (Gbl.F.Out," %s",Attr);
free (Attr);
}
}
fprintf (Gbl.F.Out," />");
}
void HTM_INPUT_RADIO (const char *Name,bool SubmitOnClick,
const char *fmt,...)
{

View File

@ -127,8 +127,10 @@ void HTM_INPUT_IMAGE (const char *URL,const char *Icon,const char *Title,const c
void HTM_INPUT_PASSWORD (const char *Name,const char *PlaceHolder,
const char *AutoComplete,bool Required,
const char *fmt,...);
void HTM_INPUT_NUMBER (const char *Name,long Min,long Max,long Value,bool Disabled,
const char *fmt,...);
void HTM_INPUT_LONG (const char *Name,long Min,long Max,long Value,bool Disabled,
const char *fmt,...);
void HTM_INPUT_FLOAT (const char *Name,double Min,double Max,double Step,double Value,bool Disabled,
const char *fmt,...);
void HTM_INPUT_RADIO (const char *Name,bool SubmitOnClick,
const char *fmt,...);
void HTM_INPUT_CHECKBOX (const char *Name,bool SubmitOnChange,

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.78.1 (2019-11-27)"
#define Log_PLATFORM_VERSION "SWAD 19.78.2 (2019-11-27)"
#define CSS_FILE "swad19.78.1.css"
#define JS_FILE "swad19.70.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: En cada juego, poder listar los resultados en una tabla como la de resultados globales
Version 19.78.2: Nov 27, 2019 New field maximum grade in game form. Not finished. (247168 lines)
Version 19.78.1: Nov 27, 2019 Changes in edition of games, attendance, events, assignments. (247123 lines)
Version 19.78: Nov 25, 2019 Filtering of match results by games. (247106 lines)
1 change necessary in database:

View File

@ -26,6 +26,7 @@
/*****************************************************************************/
#define _GNU_SOURCE // For asprintf
#include <float.h> // For DBL_MAX
#include <linux/limits.h> // For PATH_MAX
#include <linux/stddef.h> // For NULL
#include <stdio.h> // For asprintf
@ -1162,6 +1163,7 @@ static void Gam_PutFormsEditionGame (struct Game *Game,bool ItsANewGame)
extern const char *Txt_New_game;
extern const char *Txt_Edit_game;
extern const char *Txt_Title;
extern const char *Txt_Maximum_grade;
extern const char *Txt_Description;
extern const char *Txt_Create_game;
extern const char *Txt_Save_changes;
@ -1212,6 +1214,20 @@ static void Gam_PutFormsEditionGame (struct Game *Game,bool ItsANewGame)
HTM_TR_End ();
/***** Maximum grade *****/
HTM_TR_Begin (NULL);
HTM_TD_Begin ("class=\"%s RM\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
HTM_TxtF ("%s:",Txt_Maximum_grade);
HTM_TD_End ();
HTM_TD_Begin ("class=\"LM\"");
HTM_INPUT_FLOAT ("MaxGrade",(double) 0.0,(double) DBL_MAX,(double) 0.01,(double) 10.0,false,
NULL);
HTM_TD_End ();
HTM_TR_End ();
/***** Game text *****/
HTM_TR_Begin (NULL);

View File

@ -3534,7 +3534,7 @@ static void Prj_PutFormProject (struct Project *Prj,bool ItsANewProject)
HTM_TD_End ();
HTM_TD_Begin ("class=\"LM\"");
HTM_INPUT_NUMBER ("NumStds",(long) 0,(long) UINT_MAX,(long) Prj->NumStds,false,
HTM_INPUT_LONG ("NumStds",(long) 0,(long) UINT_MAX,(long) Prj->NumStds,false,
NULL);
HTM_TD_End ();

View File

@ -680,27 +680,6 @@ static unsigned Str_FindHTMLEntity (const char *Ptr)
0; // No HTML entity found
}
/*****************************************************************************/
/**************** Check if a URL adreess looks as** valid ********************/
/*****************************************************************************/
/*
bool Str_URLLooksValid (const char *URL)
{
***** If it's a NULL pointer *****
if (!URL)
return false;
***** If it's the empty string *****
if (!URL[0])
return false;
***** Check if start by http:// or https:// *****
if (!strncasecmp (URL,"http://",7) || !strncasecmp (URL,"https://",8))
return (bool) (strchr (URL,(int) '.') != NULL); // There is any . in the URL
else // There's no http:// nor https://
return false;
}
*/
/*****************************************************************************/
/***** Convert a string to title: first uppercase and the rest lowercase *****/
/*****************************************************************************/

View File

@ -84,7 +84,6 @@ typedef enum
void Str_InsertLinks (char *Txt,unsigned long MaxLength,size_t MaxCharsURLOnScreen);
size_t Str_LimitLengthHTMLStr (char *Str,size_t MaxCharsOnScreen);
// bool Str_URLLooksValid (const char *URL);
void Str_ConvertToTitleType (char *Str);
void Str_ConvertToComparable (char *Str);
char *Str_ConvertToUpperText (char *Str);

View File

@ -361,7 +361,7 @@ void Tst_ShowFormAskTst (void)
HTM_TD_End ();
HTM_TD_Begin ("class=\"LM\"");
HTM_INPUT_NUMBER ("NumQst",
HTM_INPUT_LONG ("NumQst",
(long) Gbl.Test.Config.Min,
(long) Gbl.Test.Config.Max,
(long) Gbl.Test.Config.Def,

View File

@ -18224,6 +18224,27 @@ const char *Txt_maximum =
"m&aacute;ximo";
#endif
const char *Txt_Maximum_grade =
#if L==1 // ca
"Nota m&agrave;xima";
#elif L==2 // de
"H&ouml;chstnote";
#elif L==3 // en
"Maximum grade";
#elif L==4 // es
"Nota m&aacute;xima";
#elif L==5 // fr
"Note maximale";
#elif L==6 // gn
"Nota m&aacute;xima"; // Okoteve traducción
#elif L==7 // it
"Voto massimo";
#elif L==8 // pl
"Maksymalna ocena";
#elif L==9 // pt
"Nota m&aacute;xima";
#endif
const char *Txt_Members = // Project members
#if L==1 // ca
"Membres";