From 03b97e1ba6542f95346fa5e886149cd3ba8c43fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 4 Jul 2019 10:13:51 +0200 Subject: [PATCH] Version18.129 --- .settings/language.settings.xml | 2 +- swad_account.c | 6 ++++- swad_box.c | 43 ++++++++++++++++++++++++--------- swad_box.h | 2 ++ swad_button.c | 13 ++++++++-- swad_button.h | 3 ++- swad_changelog.h | 5 +++- swad_game.c | 2 +- swad_global.c | 2 ++ swad_global.h | 6 +++++ swad_text.c | 21 ++++++++++++++++ 11 files changed, 87 insertions(+), 18 deletions(-) diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 81abd5c37..e6e036f11 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -11,7 +11,7 @@ - + diff --git a/swad_account.c b/swad_account.c index c6399665a..8af8493aa 100644 --- a/swad_account.c +++ b/swad_account.c @@ -139,6 +139,7 @@ static void Acc_ShowFormCheckIfIHaveAccount (const char *Title) extern const char *Txt_If_you_think_you_may_have_been_registered_; extern const char *Txt_ID; extern const char *Txt_Check; + extern const char *Txt_Skip_this_step; /***** Start box *****/ Box_StartBox (NULL,Title,NULL, @@ -157,9 +158,12 @@ static void Acc_ShowFormCheckIfIHaveAccount (const char *Title) "", The_ClassFormInBox[Gbl.Prefs.Theme],Txt_ID, ID_MAX_CHARS_USR_ID); - Btn_PutConfirmButton (Txt_Check); + Btn_PutConfirmButtonInline (Txt_Check); Frm_EndForm (); + /***** Form to skip this step *****/ + Btn_PutCloseBoxButtonInline (Txt_Skip_this_step); + /***** End box *****/ Box_EndBox (); } diff --git a/swad_box.c b/swad_box.c index b38a8a81d..66b03f58b 100644 --- a/swad_box.c +++ b/swad_box.c @@ -54,11 +54,9 @@ extern struct Globals Gbl; /*****************************************************************************/ /*****************************************************************************/ -/***************************** Private variabled *****************************/ +/***************************** Private variables *****************************/ /*****************************************************************************/ -static unsigned Box_Nested = 0; - /*****************************************************************************/ /***************************** Private prototypes ****************************/ /*****************************************************************************/ @@ -114,6 +112,7 @@ void Box_StartBoxShadow (const char *Width,const char *Title, "FRAME_SHADOW"); } +// Return pointer to box id string static void Box_StartBoxInternal (const char *Width,const char *Title, void (*FunctionToDrawContextualIcons) (void), const char *HelpLink,Box_Closable_t Closable, @@ -121,15 +120,30 @@ static void Box_StartBoxInternal (const char *Width,const char *Title, { extern const char *Txt_Help; extern const char *Txt_Close; - char IdFrame[Frm_MAX_BYTES_ID + 1]; + + /***** Check level of nesting *****/ + if (Gbl.Box.Nested >= Box_MAX_NESTED - 1) // Can not nest a new box + Lay_ShowErrorAndExit ("Box nesting limit reached."); + + /***** Increase level of nesting *****/ + Gbl.Box.Nested++; + + /***** Create unique identifier for this box *****/ + if (Closable == Box_CLOSABLE) + { + if ((Gbl.Box.Ids[Gbl.Box.Nested] = (char *) malloc (Frm_MAX_BYTES_ID + 1)) == NULL) + Lay_ShowErrorAndExit ("Error allocating memory for box id."); + } + else + Gbl.Box.Ids[Gbl.Box.Nested] = NULL; /***** Start box container *****/ fprintf (Gbl.F.Out,"
"); @@ -166,7 +180,7 @@ static void Box_StartBoxInternal (const char *Width,const char *Title, { fprintf (Gbl.F.Out,"", - IdFrame); + Gbl.Box.Ids[Gbl.Box.Nested]); Ico_PutDivIcon ("CONTEXT_OPT HLP_HIGHLIGHT", "close.svg",Txt_Close); fprintf (Gbl.F.Out,""); @@ -182,11 +196,9 @@ static void Box_StartBoxInternal (const char *Width,const char *Title, fprintf (Gbl.F.Out,"
" "%s" "
", - Box_Nested ? "FRAME_TITLE_SMALL" : + Gbl.Box.Nested ? "FRAME_TITLE_SMALL" : "FRAME_TITLE_BIG", Title); - - Box_Nested++; } void Box_EndBoxTable (void) @@ -209,9 +221,18 @@ void Box_EndBoxWithButton (Btn_Button_t Button,const char *TxtButton) void Box_EndBox (void) { - Box_Nested--; + /***** Check level of nesting *****/ + if (Gbl.Box.Nested < 0) + Lay_ShowErrorAndExit ("Trying to end a box not open."); + + /***** Free memory allocated for box id string *****/ + if (Gbl.Box.Ids[Gbl.Box.Nested]) + free (Gbl.Box.Ids[Gbl.Box.Nested]); /***** End box and box container *****/ fprintf (Gbl.F.Out,"
" ""); + + /***** Decrease level of nesting *****/ + Gbl.Box.Nested--; } diff --git a/swad_box.h b/swad_box.h index b697a05f7..c31e00347 100644 --- a/swad_box.h +++ b/swad_box.h @@ -35,6 +35,8 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ +#define Box_MAX_NESTED 10 + /*****************************************************************************/ /********************************* Public types ******************************/ /*****************************************************************************/ diff --git a/swad_button.c b/swad_button.c index 683e95cc2..278665a96 100644 --- a/swad_button.c +++ b/swad_button.c @@ -150,10 +150,19 @@ void Btn_PutRemoveButtonInline (const char *TxtButton) TxtButton); } -void Btn_PutCloseButton (const char *TxtButton) +void Btn_PutCloseBoxButtonInline (const char *TxtButton) + { + fprintf (Gbl.F.Out,"", + Gbl.Box.Ids[Gbl.Box.Nested],TxtButton); + } + +void Btn_PutCloseTabButton (const char *TxtButton) { fprintf (Gbl.F.Out,"
" - "" diff --git a/swad_button.h b/swad_button.h index dd9270354..4c36aea01 100644 --- a/swad_button.h +++ b/swad_button.h @@ -55,6 +55,7 @@ void Btn_PutConfirmButton (const char *TxtButton); void Btn_PutConfirmButtonInline (const char *TxtButton); void Btn_PutRemoveButton (const char *TxtButton); void Btn_PutRemoveButtonInline (const char *TxtButton); -void Btn_PutCloseButton (const char *TxtButton); +void Btn_PutCloseBoxButtonInline (const char *TxtButton); +void Btn_PutCloseTabButton (const char *TxtButton); #endif diff --git a/swad_changelog.h b/swad_changelog.h index 6998f1211..928074d32 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -437,6 +437,8 @@ Lo de mutear anuncios, en principio prefiero hacer una opci // TODO: Probar qué ocurre si se está jugando una partida en una pestaña y se reanuda la misma en otra pestaña (da igual otra pestaña que otro navegador u ordenador) // TODO: ¿Puede un profesor reanudar una partida comenzada por otro profesor? +// TODO: Perico: bloquear la subida de archivos por parte de estudiantes (no tiene que ver con el bloqueo de la edición de proyectos) + /*****************************************************************************/ /****************************** Public constants *****************************/ /*****************************************************************************/ @@ -456,10 +458,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.128 (2019-06-13)" +#define Log_PLATFORM_VERSION "SWAD 18.129 (2019-07-04)" #define CSS_FILE "swad18.123.css" #define JS_FILE "swad18.123.js" /* + Version 18.129: Jul 04, 2019 Button to skip step in creation of a new account. (243425 lines) Version 18.128: Jun 13, 2019 Fixed bug in creation of degrees. (243365 lines) Version 18.127.3: May 31, 2019 Code refactoring and cleaning in games. (243346 lines) Version 18.127.2: May 31, 2019 Question index is shown in match status. diff --git a/swad_game.c b/swad_game.c index b4d0e7165..da805d73a 100644 --- a/swad_game.c +++ b/swad_game.c @@ -3509,7 +3509,7 @@ static void Gam_ShowAlertFinishedMatch (void) Ale_ShowAlert (Ale_WARNING,Txt_Finished_match); /***** Button to close browser tab *****/ - Btn_PutCloseButton ("Cerrar"); // TODO: Need translation!!!!! + Btn_PutCloseTabButton ("Cerrar"); // TODO: Need translation!!!!! } /*****************************************************************************/ diff --git a/swad_global.c b/swad_global.c index 73ffcdb82..c2551783f 100644 --- a/swad_global.c +++ b/swad_global.c @@ -124,6 +124,8 @@ void Gbl_InitializeGlobals (void) Gbl.Form.Num = -1; // Number of form. It's increased by 1 at the begin of each form Gbl.Form.Inside = false; // Set to true inside a form to avoid nested forms + Gbl.Box.Nested = -1; // -1 means no box open + Gbl.Alerts.Num = 0; // No pending alerts to be shown Gbl.DB.DatabaseIsOpen = false; diff --git a/swad_global.h b/swad_global.h index a769e5d90..47780df7d 100644 --- a/swad_global.h +++ b/swad_global.h @@ -38,6 +38,7 @@ #include "swad_assignment.h" #include "swad_attendance.h" #include "swad_banner.h" +#include "swad_box.h" #include "swad_centre.h" #include "swad_classroom.h" #include "swad_connected.h" @@ -106,6 +107,11 @@ struct Globals char UniqueId[32 + Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 10 + 1]; // Unique identifier string used in forms bool Inside; // Set to true inside a form to avoid nested forms } Form; + struct + { + int Nested; // Index of top open box + char *Ids[Box_MAX_NESTED]; // 0 <= box index < Box_MAX_NESTED + } Box; struct { size_t Num; // Number of alert diff --git a/swad_text.c b/swad_text.c index 067ac1e74..2fe01e005 100644 --- a/swad_text.c +++ b/swad_text.c @@ -39257,6 +39257,27 @@ const char *Txt_Size_of_photos = "Tamanho das fotos"; #endif +const char *Txt_Skip_this_step = +#if L==1 // ca + "Saltar aquest pas"; +#elif L==2 // de + "Überspringen Sie diesen Schritt"; +#elif L==3 // en + "Skip this step"; +#elif L==4 // es + "Saltar este paso"; +#elif L==5 // fr + "Passer cette étape"; +#elif L==6 // gn + "Saltar este paso"; // Okoteve traducción +#elif L==7 // it + "Salta questo passaggio"; +#elif L==8 // pl + "Pomiń ten krok"; +#elif L==9 // pt + "Pule esta etapa"; +#endif + const char *Txt_Sort_degrees_by = #if L==1 // ca "Ordenar titulacions per";