diff --git a/swad_changelog.h b/swad_changelog.h
index d5ca98ea..21c87748 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -39,11 +39,12 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
-#define Log_PLATFORM_VERSION "SWAD 14.55.4 (2015/01/16)"
+#define Log_PLATFORM_VERSION "SWAD 14.55.5 (2015/01/16)"
// 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.55.5: Jan 16, 2015 Code refactoring related to maps of countries. (173573 lines)
Version 14.55.4: Jan 16, 2015 Fixed bugs in enrollment.
New MIME type, reported by Francisco Ocaņa Lara. (173576 lines)
Version 14.55.3: Jan 16, 2015 Link in course information to request registration in course.
diff --git a/swad_country.c b/swad_country.c
index dc083389..4bf6aad6 100644
--- a/swad_country.c
+++ b/swad_country.c
@@ -148,12 +148,16 @@ void Cty_SeeCtyWithPendingInss (void)
/* Country map */
fprintf (Gbl.F.Out,"
"
""
- "",
- BgColor,Cty.WWW[Gbl.Prefs.Language]);
- Cty_DrawCountryMap (&Cty,"COUNTRY_MAP_SMALL");
- fprintf (Gbl.F.Out,""
- " | ");
+ " vertical-align:middle; background-color:%s;\">",
+ BgColor);
+ if (Cty_CheckIfCountryMapExists (&Cty))
+ {
+ fprintf (Gbl.F.Out,"",
+ Cty.WWW[Gbl.Prefs.Language]);
+ Cty_DrawCountryMap (&Cty,"COUNTRY_MAP_SMALL");
+ fprintf (Gbl.F.Out,"");
+ }
+ fprintf (Gbl.F.Out,"");
/* Country name */
fprintf (Gbl.F.Out,"");
/***** Country map (and link to WWW if exists) *****/
- sprintf (PathMap,"%s/%s/%s/%s/%s.png",
- Cfg_PATH_SWAD_PUBLIC,
- Cfg_FOLDER_PUBLIC_ICON,
- Cfg_ICON_FOLDER_COUNTRIES,
- Gbl.CurrentCty.Cty.Alpha2,
- Gbl.CurrentCty.Cty.Alpha2);
- if (Fil_CheckIfPathExists (PathMap))
+ if (Cty_CheckIfCountryMapExists (&Gbl.CurrentCty.Cty))
{
/* Get map attribution */
Cty_GetMapAttribution (Gbl.CurrentCty.Cty.CtyCod,&MapAttribution);
@@ -495,7 +492,6 @@ void Cty_ListCountries2 (void)
extern const char *Txt_Country_unspecified;
Cty_CtysOrderType_t Order;
unsigned NumCty;
- char PathMap[PATH_MAX+1];
unsigned NumUsrs;
unsigned NumStds;
unsigned NumTchs;
@@ -560,13 +556,7 @@ void Cty_ListCountries2 (void)
" | ",
BgColor);
- sprintf (PathMap,"%s/%s/%s/%s/%s.png",
- Cfg_PATH_SWAD_PUBLIC,
- Cfg_FOLDER_PUBLIC_ICON,
- Cfg_ICON_FOLDER_COUNTRIES,
- Gbl.Ctys.Lst[NumCty].Alpha2,
- Gbl.Ctys.Lst[NumCty].Alpha2);
- if (Fil_CheckIfPathExists (PathMap))
+ if (Cty_CheckIfCountryMapExists (&Gbl.Ctys.Lst[NumCty]))
{
/* Map image */
Act_FormGoToStart (ActSeeIns);
@@ -707,7 +697,24 @@ void Cty_ListCountries2 (void)
}
/*****************************************************************************/
-/**************************** Draw institution logo **************************/
+/*********************** Check if country map exists *************************/
+/*****************************************************************************/
+
+bool Cty_CheckIfCountryMapExists (struct Country *Cty)
+ {
+ char PathMap[PATH_MAX+1];
+
+ sprintf (PathMap,"%s/%s/%s/%s/%s.png",
+ Cfg_PATH_SWAD_PUBLIC,
+ Cfg_FOLDER_PUBLIC_ICON,
+ Cfg_ICON_FOLDER_COUNTRIES,
+ Cty->Alpha2,
+ Cty->Alpha2);
+ return Fil_CheckIfPathExists (PathMap);
+ }
+
+/*****************************************************************************/
+/***************************** Draw country map ******************************/
/*****************************************************************************/
void Cty_DrawCountryMap (struct Country *Cty,const char *Class)
diff --git a/swad_country.h b/swad_country.h
index 4f407aee..92f581ae 100644
--- a/swad_country.h
+++ b/swad_country.h
@@ -78,6 +78,7 @@ void Cty_PrintConfiguration (void);
void Cty_ListCountries (void);
void Cty_ListCountries1 (void);
void Cty_ListCountries2 (void);
+bool Cty_CheckIfCountryMapExists (struct Country *Cty);
void Cty_DrawCountryMap (struct Country *Cty,const char *Class);
void Cty_WriteScriptGoogleGeochart (void);
void Cty_PutHiddenParamCtyOrderType (void);
diff --git a/swad_degree.c b/swad_degree.c
index 74451b15..d552b655 100644
--- a/swad_degree.c
+++ b/swad_degree.c
@@ -726,7 +726,6 @@ void Deg_WriteBigNameCtyInsCtrDegCrs (void)
{
extern const char *The_ClassCourse[The_NUM_THEMES];
char FullName[Deg_MAX_LENGTH_FULL_NAME+1]; // Full name of course / degree
- char PathMap[PATH_MAX+1];
if (Gbl.CurrentCty.Cty.CtyCod > 0 ||
Gbl.CurrentIns.Ins.InsCod > 0 ||
@@ -758,16 +757,8 @@ void Deg_WriteBigNameCtyInsCtrDegCrs (void)
Ins_DrawInstitutionLogo (Gbl.CurrentIns.Ins.Logo,Gbl.CurrentIns.Ins.ShortName,32,
"vertical-align:top; margin-right:8px;");
else if (Gbl.CurrentCty.Cty.CtyCod > 0)
- {
- sprintf (PathMap,"%s/%s/%s/%s/%s.png",
- Cfg_PATH_SWAD_PUBLIC,
- Cfg_FOLDER_PUBLIC_ICON,
- Cfg_ICON_FOLDER_COUNTRIES,
- Gbl.CurrentCty.Cty.Alpha2,
- Gbl.CurrentCty.Cty.Alpha2);
- if (Fil_CheckIfPathExists (PathMap))
+ if (Cty_CheckIfCountryMapExists (&Gbl.CurrentCty.Cty))
Cty_DrawCountryMap (&Gbl.CurrentCty.Cty,"COUNTRY_MAP_TITLE");
- }
}
fprintf (Gbl.F.Out,"%s"
"",
|