From 9974f5ea4db98f226f8b036022ae4d95a0a10dfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Wed, 27 Nov 2019 01:01:27 +0100 Subject: [PATCH] Version19.78.2 --- swad_HTML.c | 40 ++++++++++++++++++++++++++++++++++++++-- swad_HTML.h | 6 ++++-- swad_changelog.h | 3 ++- swad_game.c | 16 ++++++++++++++++ swad_project.c | 2 +- swad_string.c | 21 --------------------- swad_string.h | 1 - swad_test.c | 2 +- swad_text.c | 21 +++++++++++++++++++++ 9 files changed, 83 insertions(+), 29 deletions(-) diff --git a/swad_HTML.c b/swad_HTML.c index 9d17d809..f08a072b 100644 --- a/swad_HTML.c +++ b/swad_HTML.c @@ -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,""); + } + void HTM_INPUT_RADIO (const char *Name,bool SubmitOnClick, const char *fmt,...) { diff --git a/swad_HTML.h b/swad_HTML.h index 9b0400b6..5c151148 100644 --- a/swad_HTML.h +++ b/swad_HTML.h @@ -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, diff --git a/swad_changelog.h b/swad_changelog.h index 2d5a2317..43cef249 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.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: diff --git a/swad_game.c b/swad_game.c index 5460d04d..dc531eed 100644 --- a/swad_game.c +++ b/swad_game.c @@ -26,6 +26,7 @@ /*****************************************************************************/ #define _GNU_SOURCE // For asprintf +#include // For DBL_MAX #include // For PATH_MAX #include // For NULL #include // 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); diff --git a/swad_project.c b/swad_project.c index e8be0b72..a99492e2 100644 --- a/swad_project.c +++ b/swad_project.c @@ -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 (); diff --git a/swad_string.c b/swad_string.c index 30dd724a..670ddabc 100644 --- a/swad_string.c +++ b/swad_string.c @@ -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 *****/ /*****************************************************************************/ diff --git a/swad_string.h b/swad_string.h index af9f1e96..886b681f 100644 --- a/swad_string.h +++ b/swad_string.h @@ -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); diff --git a/swad_test.c b/swad_test.c index 12d5a83e..2e768952 100644 --- a/swad_test.c +++ b/swad_test.c @@ -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, diff --git a/swad_text.c b/swad_text.c index e17bac3b..9e82243b 100644 --- a/swad_text.c +++ b/swad_text.c @@ -18224,6 +18224,27 @@ const char *Txt_maximum = "máximo"; #endif +const char *Txt_Maximum_grade = +#if L==1 // ca + "Nota màxima"; +#elif L==2 // de + "Höchstnote"; +#elif L==3 // en + "Maximum grade"; +#elif L==4 // es + "Nota máxima"; +#elif L==5 // fr + "Note maximale"; +#elif L==6 // gn + "Nota máxima"; // Okoteve traducción +#elif L==7 // it + "Voto massimo"; +#elif L==8 // pl + "Maksymalna ocena"; +#elif L==9 // pt + "Nota máxima"; +#endif + const char *Txt_Members = // Project members #if L==1 // ca "Membres";