From 2ad7522b044b59727da7b1702346090345b6654a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Mon, 23 Dec 2019 22:13:02 +0100 Subject: [PATCH] Version19.97.6 --- swad_action.c | 20 +++++++------- swad_changelog.h | 6 ++-- swad_config.h | 4 +-- swad_country.c | 1 + swad_institution.c | 11 +++++++- swad_institution.h | 1 + swad_logo.c | 68 ++++++++++++++++++++++++++++++++-------------- swad_place.c | 2 +- 8 files changed, 75 insertions(+), 38 deletions(-) diff --git a/swad_action.c b/swad_action.c index 7989557e..5500b897 100644 --- a/swad_action.c +++ b/swad_action.c @@ -5389,11 +5389,11 @@ void Act_AdjustCurrentAction (void) Gbl.Usrs.Me.UsrDat.InsCod < 0 || (IAmATeacherInAnyCrs && (Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0 || Gbl.Usrs.Me.UsrDat.Tch.DptCod < 0))) - { - Gbl.Action.Act = ActReqEdiRecSha; - Tab_SetCurrentTab (); - return; - } + { + Gbl.Action.Act = ActReqEdiRecSha; + Tab_SetCurrentTab (); + return; + } /***** Adjustment 5: ------------- @@ -5403,11 +5403,11 @@ void Act_AdjustCurrentAction (void) if (Gbl.Usrs.Me.UsrDat.PhotoVisibility == Pri_VISIBILITY_UNKNOWN || Gbl.Usrs.Me.UsrDat.BaPrfVisibility == Pri_VISIBILITY_UNKNOWN || Gbl.Usrs.Me.UsrDat.ExPrfVisibility == Pri_VISIBILITY_UNKNOWN) - { - Gbl.Action.Act = ActReqEdiSet; - Tab_SetCurrentTab (); - return; - } + { + Gbl.Action.Act = ActReqEdiSet; + Tab_SetCurrentTab (); + return; + } /***** If I belong to current course *****/ if (Gbl.Usrs.Me.IBelongToCurrentCrs) diff --git a/swad_changelog.h b/swad_changelog.h index 0e112db7..daa38b89 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -492,16 +492,16 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.97.4 (2019-12-20)" +#define Log_PLATFORM_VERSION "SWAD 19.97.6 (2019-12-23)" #define CSS_FILE "swad19.97.css" #define JS_FILE "swad19.91.1.js" /* // TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.) // TODO: Impedir la creación y edición de proyectos si no son editables. // TODO: No se puede entrar con DNI '1' suponiendo que no tenga password ¿por qué? -// TODO: Sin identificar, pulsando en CENTRO > Información > Lugares/sedes NO deberíamos ir a Países. -// TODO: Icono de eliminar escudo de un centro --> ponerlo sólo en la esquina, contextual. Comprobar lo mismo con icono de titulación y de institución. + Version 19.97.6: Dec 23, 2019 Changes in forms to remove logos. (249199 lines) + Version 19.97.5: Dec 20, 2019 Fixed bug in places. (249180 lines) Version 19.97.4: Dec 20, 2019 Optimization on alerts related with empty form fields. (249171 lines) Version 19.97.3: Dec 19, 2019 In list of centres, show link to map. (249847 lines) Version 19.97.2: Dec 19, 2019 Don't show centre map when coordinates are 0. diff --git a/swad_config.h b/swad_config.h index aab84163..77e76c0a 100644 --- a/swad_config.h +++ b/swad_config.h @@ -28,8 +28,8 @@ /** Uncomment one of the following installations of SWAD or create your own **/ /*****************************************************************************/ -//#define LOCALHOST_UBUNTU // Comment this line if not applicable -#define OPENSWAD_ORG // Comment this line if not applicable +#define LOCALHOST_UBUNTU // Comment this line if not applicable +//#define OPENSWAD_ORG // Comment this line if not applicable //#define SWAD_UGR_ES // Comment this line if not applicable //#define SWADBERRY_UGR_ES // Comment this line if not applicable diff --git a/swad_country.c b/swad_country.c index 6b420540..6d376d2c 100644 --- a/swad_country.c +++ b/swad_country.c @@ -64,6 +64,7 @@ extern struct Globals Gbl; /*****************************************************************************/ static struct Country *Cty_EditingCty = NULL; // Static variable to keep the country being edited +long Cty_CurrentCtyCod = -1L; // Used as parameter in contextual links /*****************************************************************************/ /***************************** Private prototypes ****************************/ diff --git a/swad_institution.c b/swad_institution.c index 1f9967f4..bb50b8a1 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -467,7 +467,7 @@ static void Ins_Configuration (bool PrintView) else // I can not change institution WWW { HTM_DIV_Begin ("class=\"EXTERNAL_WWW_LONG\""); - HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT\">", + HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT\"", Gbl.Hierarchy.Ins.WWW); HTM_Txt (Gbl.Hierarchy.Ins.WWW); HTM_A_End (); @@ -1637,6 +1637,15 @@ static Ins_Status_t Ins_GetStatusBitsFromStatusTxt (Ins_StatusTxt_t StatusTxt) return (Ins_Status_t) 0; } +/*****************************************************************************/ +/************* Write parameter with code of current institution **************/ +/*****************************************************************************/ + +void Ins_PutParamCurrentInsCod (void) + { + Ins_PutParamInsCod (Gbl.Hierarchy.Ins.InsCod); + } + /*****************************************************************************/ /***************** Write parameter with code of institution ******************/ /*****************************************************************************/ diff --git a/swad_institution.h b/swad_institution.h index b0a43804..772ba7b6 100644 --- a/swad_institution.h +++ b/swad_institution.h @@ -118,6 +118,7 @@ void Ins_FlushCacheFullNameAndCtyOfInstitution (void); void Ins_FreeListInstitutions (void); void Ins_WriteSelectorOfInstitution (void); +void Ins_PutParamCurrentInsCod (void); void Ins_PutParamInsCod (long InsCod); long Ins_GetAndCheckParamOtherInsCod (long MinCodAllowed); void Ins_RemoveInstitution (void); diff --git a/swad_logo.c b/swad_logo.c index 656fa53e..080dcf65 100644 --- a/swad_logo.c +++ b/swad_logo.c @@ -64,6 +64,11 @@ extern struct Globals Gbl; /***************************** Private prototypes ****************************/ /*****************************************************************************/ +static void Lgo_PutIconToRemoveLogoIns (void); +static void Lgo_PutIconToRemoveLogoCtr (void); +static void Lgo_PutIconToRemoveLogoDeg (void); +static void Lgo_PutIconToRemoveLogo (Act_Action_t ActionRem); + /*****************************************************************************/ /****************************** Draw degree logo *****************************/ /*****************************************************************************/ @@ -250,14 +255,13 @@ void Lgo_PutIconToChangeLogo (Hie_Level_t Scope) void Lgo_RequestLogo (Hie_Level_t Scope) { extern const char *The_ClassFormInBox[The_NUM_THEMES]; - extern const char *Txt_Remove_logo; extern const char *Txt_Logo; extern const char *Txt_You_can_send_a_file_with_an_image_in_PNG_format_transparent_background_and_size_X_Y; extern const char *Txt_File_with_the_logo; long Cod; const char *Folder; Act_Action_t ActionRec; - Act_Action_t ActionRem; + void (*FunctionToDrawContextualIcons) (void); char PathLogo[PATH_MAX + 1]; /***** Set action depending on scope *****/ @@ -267,19 +271,19 @@ void Lgo_RequestLogo (Hie_Level_t Scope) Cod = Gbl.Hierarchy.Ins.InsCod; Folder = Cfg_FOLDER_INS; ActionRec = ActRecInsLog; - ActionRem = ActRemInsLog; + FunctionToDrawContextualIcons = Lgo_PutIconToRemoveLogoIns; break; case Hie_CTR: Cod = Gbl.Hierarchy.Ctr.CtrCod; Folder = Cfg_FOLDER_CTR; ActionRec = ActRecCtrLog; - ActionRem = ActRemCtrLog; + FunctionToDrawContextualIcons = Lgo_PutIconToRemoveLogoCtr; break; case Hie_DEG: Cod = Gbl.Hierarchy.Deg.DegCod; Folder = Cfg_FOLDER_DEG; ActionRec = ActRecDegLog; - ActionRem = ActRemDegLog; + FunctionToDrawContextualIcons = Lgo_PutIconToRemoveLogoDeg; break; default: return; // Nothing to do @@ -292,23 +296,16 @@ void Lgo_RequestLogo (Hie_Level_t Scope) (unsigned) (Cod % 100), (unsigned) Cod, (unsigned) Cod); - if (Fil_CheckIfPathExists (PathLogo)) - { - /***** Form to remove photo *****/ - HTM_DIV_Begin ("class=\"CM\""); - Lay_PutContextualLinkIconText (ActionRem,NULL,NULL, - "trash.svg", - Txt_Remove_logo); - HTM_DIV_End (); - } + if (!Fil_CheckIfPathExists (PathLogo)) + FunctionToDrawContextualIcons = NULL; + + /***** Begin box *****/ + Box_BoxBegin (NULL,Txt_Logo,FunctionToDrawContextualIcons, + NULL,Box_NOT_CLOSABLE); /***** Begin form to upload logo *****/ Frm_StartForm (ActionRec); - /***** Begin box *****/ - Box_BoxBegin (NULL,Txt_Logo,NULL, - NULL,Box_NOT_CLOSABLE); - /***** Write help message *****/ Ale_ShowAlert (Ale_INFO,Txt_You_can_send_a_file_with_an_image_in_PNG_format_transparent_background_and_size_X_Y, 64,64); @@ -319,11 +316,40 @@ void Lgo_RequestLogo (Hie_Level_t Scope) HTM_INPUT_FILE (Fil_NAME_OF_PARAM_FILENAME_ORG,"image/png",true,NULL); HTM_LABEL_End (); - /***** End box *****/ - Box_BoxEnd (); - /***** End form *****/ Frm_EndForm (); + + /***** End box *****/ + Box_BoxEnd (); + } + +/*****************************************************************************/ +/************** Put a link to request the removal of the logo ****************/ +/*****************************************************************************/ + +static void Lgo_PutIconToRemoveLogoIns (void) + { + Lgo_PutIconToRemoveLogo (ActRemInsLog); + } + +static void Lgo_PutIconToRemoveLogoCtr (void) + { + Lgo_PutIconToRemoveLogo (ActRemCtrLog); + } + +static void Lgo_PutIconToRemoveLogoDeg (void) + { + Lgo_PutIconToRemoveLogo (ActRemDegLog); + } + +static void Lgo_PutIconToRemoveLogo (Act_Action_t ActionRem) + { + extern const char *Txt_Remove_logo; + + /***** Link to request the removal of the logo *****/ + Lay_PutContextualLinkOnlyIcon (ActionRem,NULL,NULL, + "trash.svg", + Txt_Remove_logo); } /*****************************************************************************/ diff --git a/swad_place.c b/swad_place.c index 381cca3c..387bfd53 100644 --- a/swad_place.c +++ b/swad_place.c @@ -320,7 +320,7 @@ void Plc_PutIconToViewPlaces (void) { extern const char *Txt_Places; - Lay_PutContextualLinkOnlyIcon (ActSeePlc,NULL,NULL, + Lay_PutContextualLinkOnlyIcon (ActSeePlc,NULL,Ins_PutParamCurrentInsCod, "map-marker-alt.svg", Txt_Places); }