From 49c9c2abad62db0ee5bd26f50c0114ebfa045840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Wed, 4 Mar 2020 01:26:49 +0100 Subject: [PATCH] Version19.141.7 --- swad_changelog.h | 5 ++- swad_program.c | 90 +++++++++++++++++++++--------------------------- swad_text.c | 21 ----------- 3 files changed, 43 insertions(+), 73 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index e7e616c07..2ed33ea6d 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -497,7 +497,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.141.6 (2020-03-04)" +#define Log_PLATFORM_VERSION "SWAD 19.141.7 (2020-03-04)" #define CSS_FILE "swad19.141.6.css" #define JS_FILE "swad19.91.1.js" /* @@ -523,7 +523,10 @@ Param // TODO: Miguel Damas: por defecto, marcar "Permitir que los profesores..." en los test (que ya esté marcado en lugar de desmarcado) // TODO: Miguel Damas: al principio de los exámenes tendría que poner cuánto resta cada pregunta // TODO: Si el alumno ha marcado "Permitir que los profesores...", entonces pedir confirmación al pulsar el botón azul, para evitar que se envíe por error antes de tiempo +// TODO: Oresti Baños: cambiar ojos por candados en descriptores para prohibir/permitir y dejar los ojos para poder elegir descriptores +// TODO: Hide/show items should hide/show subtrees + Version 19.141.7: Mar 04, 2020 Create item at the end of course program. (282202 lines) Version 19.141.6: Mar 04, 2020 Changes in edition of course program. (282230 lines) Version 19.141.5: Mar 03, 2020 Fixed bug in edition of course program. (282224 lines) Version 19.141.4: Mar 03, 2020 Remove subtree in course program. (282214 lines) diff --git a/swad_program.c b/swad_program.c index 1ad63779a..5af066687 100644 --- a/swad_program.c +++ b/swad_program.c @@ -101,8 +101,7 @@ static void Prg_WriteNumItem (unsigned Level); static void Prg_WriteNumNewItem (unsigned Level); static void Prg_PutFormsToRemEditOnePrgItem (unsigned NumItem, - const struct ProgramItem *Item, - const char *Anchor); + const struct ProgramItem *Item); static bool Prg_CheckIfMoveUpIsAllowed (unsigned NumItem); static bool Prg_CheckIfMoveDownIsAllowed (unsigned NumItem); static bool Prg_CheckIfMoveLeftIsAllowed (unsigned NumItem); @@ -171,7 +170,6 @@ static void Prg_ShowAllItems (Prg_CreateOrChangeItem_t CreateOrChangeItem, { extern const char *Hlp_COURSE_Program; extern const char *Txt_Course_program; - extern const char *Txt_No_items; unsigned NumItem; struct ProgramItem Item; @@ -184,47 +182,46 @@ static void Prg_ShowAllItems (Prg_CreateOrChangeItem_t CreateOrChangeItem, Box_BoxBegin ("100%",Txt_Course_program,Prg_PutIconsListItems, Hlp_COURSE_Program,Box_NOT_CLOSABLE); - if (Gbl.Prg.Num) + /***** Table head *****/ + HTM_TABLE_BeginWideMarginPadding (2); + + /***** Write all the program items *****/ + for (NumItem = 0; + NumItem < Gbl.Prg.Num; + NumItem++) { - /***** Table head *****/ - HTM_TABLE_BeginWideMarginPadding (2); + /* Get data of this program item */ + Item.Hierarchy.ItmCod = Gbl.Prg.LstItems[NumItem].ItmCod; + Prg_GetDataOfItemByCod (&Item); - /***** Write all the program items *****/ - for (NumItem = 0; - NumItem < Gbl.Prg.Num; - NumItem++) - { - /* Get data of this program item */ - Item.Hierarchy.ItmCod = Gbl.Prg.LstItems[NumItem].ItmCod; - Prg_GetDataOfItemByCod (&Item); + /* Show item */ + Prg_ShowOneItem (NumItem,&Item, + HighlightItmCod, + false); // Not print view - /* Show item */ - Prg_ShowOneItem (NumItem,&Item, - HighlightItmCod, - false); // Not print view + /* Show form to create/change item */ + if (ItmCodBeforeForm == Item.Hierarchy.ItmCod) + switch (CreateOrChangeItem) + { + case Prg_DONT_PUT_FORM_ITEM: + break; + case Prg_PUT_FORM_CREATE_ITEM: + Prg_ShowItemForm (Prg_PUT_FORM_CREATE_ITEM,ParentItmCod,FormLevel); + break; + case Prg_PUT_FORM_CHANGE_ITEM: + Prg_ShowItemForm (Prg_PUT_FORM_CHANGE_ITEM,ItmCodBeforeForm,FormLevel); + break; + } - /* Show form to create/change item */ - if (ItmCodBeforeForm == Item.Hierarchy.ItmCod) - switch (CreateOrChangeItem) - { - case Prg_DONT_PUT_FORM_ITEM: - break; - case Prg_PUT_FORM_CREATE_ITEM: - Prg_ShowItemForm (Prg_PUT_FORM_CREATE_ITEM,ParentItmCod,FormLevel); - break; - case Prg_PUT_FORM_CHANGE_ITEM: - Prg_ShowItemForm (Prg_PUT_FORM_CHANGE_ITEM,ItmCodBeforeForm,FormLevel); - break; - } - - Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd; - } - - /***** End table *****/ - HTM_TABLE_End (); + Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd; } - else // No program items created - Ale_ShowAlert (Ale_INFO,Txt_No_items); + + /***** Create item at the end? *****/ + if (ItmCodBeforeForm <= 0 && CreateOrChangeItem == Prg_PUT_FORM_CREATE_ITEM) + Prg_ShowItemForm (Prg_PUT_FORM_CREATE_ITEM,-1L,1); + + /***** End table *****/ + HTM_TABLE_End (); /***** Button to create a new program item *****/ if (Prg_CheckIfICanCreateItems ()) @@ -301,7 +298,6 @@ static void Prg_PutButtonToCreateNewItem (void) static void Prg_ShowOneItem (unsigned NumItem,const struct ProgramItem *Item, long HighlightItmCod,bool PrintView) { - char *Anchor = NULL; static unsigned UniqueId = 0; char *Id; unsigned ColSpan; @@ -312,9 +308,6 @@ static void Prg_ShowOneItem (unsigned NumItem,const struct ProgramItem *Item, /***** Increase number of item *****/ Prg_IncreaseNumItem (Item->Hierarchy.Level); - /***** Set anchor string *****/ - Frm_SetAnchorStr (Item->Hierarchy.ItmCod,&Anchor); - /***** Start row *****/ if (Item->Hierarchy.ItmCod == HighlightItmCod) HTM_TR_Begin ("class=\"PRG_HIGHLIGHTED_ITEM\""); @@ -325,7 +318,7 @@ static void Prg_ShowOneItem (unsigned NumItem,const struct ProgramItem *Item, if (!PrintView) { HTM_TD_Begin ("class=\"PRG_COL1 LT COLOR%u\"",Gbl.RowEvenOdd); - Prg_PutFormsToRemEditOnePrgItem (NumItem,Item,Anchor); + Prg_PutFormsToRemEditOnePrgItem (NumItem,Item); HTM_TD_End (); } @@ -358,7 +351,6 @@ static void Prg_ShowOneItem (unsigned NumItem,const struct ProgramItem *Item, ColSpan,Gbl.RowEvenOdd); if (Item->Hierarchy.ItmCod == HighlightItmCod) HTM_SECTION_Begin ("highlighted_item"); - HTM_ARTICLE_Begin (Anchor); /* Title */ HTM_DIV_Begin ("class=\"%s\"", @@ -378,7 +370,6 @@ static void Prg_ShowOneItem (unsigned NumItem,const struct ProgramItem *Item, HTM_DIV_End (); /* End title and text */ - HTM_ARTICLE_End (); if (Item->Hierarchy.ItmCod == HighlightItmCod) HTM_SECTION_End (); HTM_TD_End (); @@ -416,9 +407,6 @@ static void Prg_ShowOneItem (unsigned NumItem,const struct ProgramItem *Item, /***** End row *****/ HTM_TR_End (); - - /***** Free anchor string *****/ - Frm_FreeAnchorStr (Anchor); } /*****************************************************************************/ @@ -590,8 +578,7 @@ static void Prg_WriteNumNewItem (unsigned Level) /*****************************************************************************/ static void Prg_PutFormsToRemEditOnePrgItem (unsigned NumItem, - const struct ProgramItem *Item, - const char *Anchor) + const struct ProgramItem *Item) { extern const char *Txt_New_item; extern const char *Txt_Move_up_X; @@ -1614,6 +1601,7 @@ void Prg_RequestCreatePrgItem (void) } else { + ParentItmCod = -1L; ItmCodBeforeForm = -1L; FormLevel = 0; } diff --git a/swad_text.c b/swad_text.c index 477cedd36..e0c909a92 100644 --- a/swad_text.c +++ b/swad_text.c @@ -25720,27 +25720,6 @@ const char *Txt_No_institutions = "Não há instituções."; #endif -const char *Txt_No_items = -#if L==1 // ca - "No hi ha items"; -#elif L==2 // de - "Keine Programmelement"; -#elif L==3 // en - "No items"; -#elif L==4 // es - "No hay items"; -#elif L==5 // fr - "Il n'y a pas d'éléments"; -#elif L==6 // gn - "No hay items"; // Okoteve traducción -#elif L==7 // it - "Non ci sono elementi"; -#elif L==8 // pl - "Brak przedmiotów"; -#elif L==9 // pt - "Não há itens"; -#endif - const char *Txt_No_links = #if L==1 // ca "No hi ha enllaços.";