From 6ec1b707611aaadfd8ad5a22f347f02b7b689317 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Tue, 10 Feb 2015 14:58:50 +0100 Subject: [PATCH] Version 14.74.8 --- swad_changelog.h | 3 +- swad_logo.c | 127 +++++++++++++++++++++++++---------------------- 2 files changed, 70 insertions(+), 60 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index 630946d06..c94d2a477 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -41,11 +41,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.74.7 (2015/02/08)" +#define Log_PLATFORM_VERSION "SWAD 14.74.8 (2015/02/10)" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h | tail -1 /* + Version 14.74.8: Feb 10, 2015 Fixed bug in degree logo. (178039 lines) Version 14.74.7: Feb 08, 2015 Link to register/remove several users. (178029 lines) Version 14.74.6: Feb 08, 2015 Changes in layout of form to register/remove one user. (178009 lines) Version 14.74.5: Feb 08, 2015 Changes in layout of form to register/remove users. (178038 lines) diff --git a/swad_logo.c b/swad_logo.c index 9a91c9b1f..bef626fba 100644 --- a/swad_logo.c +++ b/swad_logo.c @@ -80,75 +80,84 @@ void Log_DrawLogo (Sco_Scope_t Scope,long Cod,const char *AltText, const char *Folder = NULL; // To avoid warning char PathLogo[PATH_MAX+1]; bool LogoFound = false; + long InsCod; + long CtrCod; + long DegCod; /***** Path to logo *****/ - if (Cod > 0) + if (Icon[Scope]) // Scope is correct { - /* Degree */ - if (Scope == Sco_SCOPE_DEG) + if (Cod > 0) // Institution, centre or degree exists { - Folder = Cfg_FOLDER_DEG; - sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png", - Cfg_PATH_SWAD_PUBLIC,Folder, - (unsigned) (Cod % 100), - (unsigned) Cod, - (unsigned) Cod); - LogoFound = Fil_CheckIfPathExists (PathLogo); - } - - /* Centre */ - if (!LogoFound || Scope == Sco_SCOPE_CTR) - { - Folder = Cfg_FOLDER_CTR; + /* Degree */ if (Scope == Sco_SCOPE_DEG) - Cod = Deg_GetCtrCodOfDegreeByCod (Cod); - sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png", - Cfg_PATH_SWAD_PUBLIC,Folder, - (unsigned) (Cod % 100), - (unsigned) Cod, - (unsigned) Cod); - LogoFound = Fil_CheckIfPathExists (PathLogo); + { + Folder = Cfg_FOLDER_DEG; + DegCod = Cod; + sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png", + Cfg_PATH_SWAD_PUBLIC,Folder, + (unsigned) (DegCod % 100), + (unsigned) DegCod, + (unsigned) DegCod); + LogoFound = Fil_CheckIfPathExists (PathLogo); + } + + /* Centre */ + if (!LogoFound && Scope != Sco_SCOPE_INS) + { + Folder = Cfg_FOLDER_CTR; + if (Scope == Sco_SCOPE_DEG) // && !LogoFound + CtrCod = Deg_GetCtrCodOfDegreeByCod (Cod); + else + CtrCod = Cod; + sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png", + Cfg_PATH_SWAD_PUBLIC,Folder, + (unsigned) (CtrCod % 100), + (unsigned) CtrCod, + (unsigned) CtrCod); + LogoFound = Fil_CheckIfPathExists (PathLogo); + } + + /* Institution */ + if (!LogoFound) + { + Folder = Cfg_FOLDER_INS; + if (Scope == Sco_SCOPE_DEG) // && !LogoFound + InsCod = Deg_GetInsCodOfDegreeByCod (Cod); + else if (Scope == Sco_SCOPE_CTR) // && !LogoFound + InsCod = Ctr_GetInsCodOfCentreByCod (Cod); + else + InsCod = Cod; + sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png", + Cfg_PATH_SWAD_PUBLIC,Folder, + (unsigned) (InsCod % 100), + (unsigned) InsCod, + (unsigned) InsCod); + LogoFound = Fil_CheckIfPathExists (PathLogo); + } } - /* Institution */ - if (!LogoFound || Scope == Sco_SCOPE_INS) + if (LogoFound || PutIconIfNotExists) { - Folder = Cfg_FOLDER_INS; - if (Scope == Sco_SCOPE_DEG) - Cod = Deg_GetInsCodOfDegreeByCod (Cod); - else if (Scope == Sco_SCOPE_CTR) - Cod = Ctr_GetInsCodOfCentreByCod (Cod); - sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png", - Cfg_PATH_SWAD_PUBLIC,Folder, - (unsigned) (Cod % 100), - (unsigned) Cod, - (unsigned) Cod); - LogoFound = Fil_CheckIfPathExists (PathLogo); + /***** Draw logo *****/ + fprintf (Gbl.F.Out,"\"%s\""); } } - else - LogoFound = false; - - if (LogoFound || PutIconIfNotExists) - { - /***** Draw logo *****/ - fprintf (Gbl.F.Out,"\"%s\""); - } } /*****************************************************************************/