Version 23.5: Sep 15, 2023 Code refactoring in edition of countries.

This commit is contained in:
acanas 2023-09-15 12:51:50 +02:00
parent 8e6628061f
commit 51b5f81cb8
18 changed files with 228 additions and 182 deletions

View File

@ -632,10 +632,11 @@ TODO: Francisco Javier Fern
Me sale este error, no si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así? Me sale este error, no si por no recordar yo la sintaxis apropiada para mandar a varios destinatarios. ¿No era así?
"can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod') "can npt create received message (duplicated entry '243218-2160773' for key 'UsrCod_MsgCod')
*/ */
#define Log_PLATFORM_VERSION "SWAD 23.4.1 (2023-09-15)" #define Log_PLATFORM_VERSION "SWAD 23.5 (2023-09-15)"
#define CSS_FILE "swad22.120.4.css" #define CSS_FILE "swad22.120.4.css"
#define JS_FILE "swad22.49.js" #define JS_FILE "swad22.49.js"
/* /*
Version 23.5: Sep 15, 2023 Code refactoring in edition of countries. (337658 lines)
Version 23.4.1: Sep 15, 2023 Changes in listing and edition of courses. (337619 lines) Version 23.4.1: Sep 15, 2023 Changes in listing and edition of courses. (337619 lines)
Version 23.4: Sep 15, 2023 Code refactoring in hierarchy. (337618 lines) Version 23.4: Sep 15, 2023 Code refactoring in hierarchy. (337618 lines)
Version 23.3: Sep 14, 2023 Buttons to close browser tab in matches are replaced because they no longer work in Firefox. (337618 lines) Version 23.3: Sep 14, 2023 Buttons to close browser tab in matches are replaced because they no longer work in Firefox. (337618 lines)

View File

@ -78,6 +78,8 @@ static void Cty_GetParCtyOrder (void);
static void Cty_EditCountriesInternal (void); static void Cty_EditCountriesInternal (void);
static void Cty_PutIconsEditingCountries (__attribute__((unused)) void *Args); static void Cty_PutIconsEditingCountries (__attribute__((unused)) void *Args);
static void Cty_GetFullListOfCountries (void);
static void Cty_ListCountriesForEdition (void); static void Cty_ListCountriesForEdition (void);
static void Cty_PutParOthCtyCod (void *CtyCod); static void Cty_PutParOthCtyCod (void *CtyCod);
@ -149,7 +151,7 @@ void Cty_SeeCtyWithPendingInss (void)
The_GetColorRows (); The_GetColorRows ();
/* Get data of country */ /* Get data of country */
Cty_GetCountryDataByCod (&Cty); Cty_GetBasicCountryDataByCod (&Cty);
/* Begin row for this country */ /* Begin row for this country */
HTM_TR_Begin (NULL); HTM_TR_Begin (NULL);
@ -518,7 +520,7 @@ void Cty_DrawCountryMapAndNameWithLink (struct Cty_Countr *Cty,Act_Action_t Acti
HTM_DIV_Begin ("class=\"%s\"",ClassContainer); HTM_DIV_Begin ("class=\"%s\"",ClassContainer);
/***** Link to action *****/ /***** Link to action *****/
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Cty->Name[Gbl.Prefs.Language]), HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Cty->FullName),
"class=\"BT_LINK\""); "class=\"BT_LINK\"");
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
@ -526,7 +528,7 @@ void Cty_DrawCountryMapAndNameWithLink (struct Cty_Countr *Cty,Act_Action_t Acti
Cty_DrawCountryMap (Cty,ClassMap); Cty_DrawCountryMap (Cty,ClassMap);
/***** Write country name *****/ /***** Write country name *****/
Str_Copy (CountryName,Cty->Name[Gbl.Prefs.Language],sizeof (CountryName) - 1); Str_Copy (CountryName,Cty->FullName,sizeof (CountryName) - 1);
HTM_TxtF (" %s ",CountryName); HTM_TxtF (" %s ",CountryName);
HTM_TxtF ("(%s)",Cty->Alpha2); HTM_TxtF ("(%s)",Cty->Alpha2);
@ -559,13 +561,13 @@ void Cty_DrawCountryMap (struct Cty_Countr *Cty,const char *Class)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
if (asprintf (&Icon,"%s.png",Cty->Alpha2) < 0) if (asprintf (&Icon,"%s.png",Cty->Alpha2) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
HTM_IMG (URL,Icon,Cty->Name[Gbl.Prefs.Language],"class=\"%s\"",Class); HTM_IMG (URL,Icon,Cty->FullName,"class=\"%s\"",Class);
free (Icon); free (Icon);
free (URL); free (URL);
} }
else else
Ico_PutIcon ("tr16x16.gif",Ico_UNCHANGED, Ico_PutIcon ("tr16x16.gif",Ico_UNCHANGED,
Cty->Name[Gbl.Prefs.Language],Class); Cty->FullName,Class);
} }
/*****************************************************************************/ /*****************************************************************************/
@ -734,7 +736,7 @@ void Cty_GetBasicListOfCountries (void)
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumCty; unsigned NumCty;
struct Cty_Countr *Cty; struct Cty_Countr *Cty;
Lan_Language_t Lan; // Lan_Language_t Lan;
/***** Trivial check: if list is already got, nothing to do *****/ /***** Trivial check: if list is already got, nothing to do *****/
if (Gbl.Hierarchy.Ctys.Num) if (Gbl.Hierarchy.Ctys.Num)
@ -762,18 +764,8 @@ void Cty_GetBasicListOfCountries (void)
if ((Cty->Cod = Str_ConvertStrCodToLongCod (row[0])) <= 0) if ((Cty->Cod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
Err_WrongCountrExit (); Err_WrongCountrExit ();
/* Reset names and webs */
for (Lan = (Lan_Language_t) 1;
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
Lan++)
{
Cty->Name[Lan][0] = '\0';
Cty->WWW[Lan][0] = '\0';
}
/* Get the name of the country in current language */ /* Get the name of the country in current language */
Str_Copy (Cty->Name[Gbl.Prefs.Language],row[1], Str_Copy (Cty->FullName,row[1],sizeof (Cty->FullName) - 1);
sizeof (Cty->Name[Gbl.Prefs.Language]) - 1);
/* Reset number of users who claim to belong to country */ /* Reset number of users who claim to belong to country */
Cty->NumUsrsWhoClaimToBelong.Valid = false; Cty->NumUsrsWhoClaimToBelong.Valid = false;
@ -789,13 +781,12 @@ void Cty_GetBasicListOfCountries (void)
/********** and number of users who claim to belong to them ***********/ /********** and number of users who claim to belong to them ***********/
/*****************************************************************************/ /*****************************************************************************/
void Cty_GetFullListOfCountries (void) static void Cty_GetFullListOfCountries (void)
{ {
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
unsigned NumCty; unsigned NumCty;
struct Cty_Countr *Cty; struct Cty_Countr *Cty;
Lan_Language_t Lan;
/***** Trivial check: if list is already got, nothing to do *****/ /***** Trivial check: if list is already got, nothing to do *****/
if (Gbl.Hierarchy.Ctys.Num) if (Gbl.Hierarchy.Ctys.Num)
@ -826,20 +817,13 @@ void Cty_GetFullListOfCountries (void)
/* Get Alpha-2 country code (row[1]) */ /* Get Alpha-2 country code (row[1]) */
Str_Copy (Cty->Alpha2,row[1],sizeof (Cty->Alpha2) - 1); Str_Copy (Cty->Alpha2,row[1],sizeof (Cty->Alpha2) - 1);
/* Get the name of the country in several languages */ /* Get the name and the web of the country in the current language */
for (Lan = (Lan_Language_t) 1; Str_Copy (Cty->FullName,row[2],sizeof (Cty->FullName) - 1);
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES; Str_Copy (Cty->WWW ,row[3],sizeof (Cty->WWW ) - 1);
Lan++)
{
Str_Copy (Cty->Name[Lan],row[1 + Lan],
sizeof (Cty->Name[Lan]) - 1);
Str_Copy (Cty->WWW[Lan],row[1 + Lan_NUM_LANGUAGES + Lan],
sizeof (Cty->WWW[Lan]) - 1);
}
/* Get number of users who claim to belong to this country */ /* Get number of users who claim to belong to this country */
Cty->NumUsrsWhoClaimToBelong.Valid = false; Cty->NumUsrsWhoClaimToBelong.Valid = false;
if (sscanf (row[1 + Lan_NUM_LANGUAGES * 2 + 1],"%u", if (sscanf (row[4],"%u",
&(Cty->NumUsrsWhoClaimToBelong.NumUsrs)) == 1) &(Cty->NumUsrsWhoClaimToBelong.NumUsrs)) == 1)
Cty->NumUsrsWhoClaimToBelong.Valid = true; Cty->NumUsrsWhoClaimToBelong.Valid = true;
} }
@ -887,7 +871,7 @@ void Cty_WriteSelectorOfCountry (void)
CtyInLst->Cod == Gbl.Hierarchy.Cty.Cod ? HTM_OPTION_SELECTED : CtyInLst->Cod == Gbl.Hierarchy.Cty.Cod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED, HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED, HTM_OPTION_ENABLED,
"%s",CtyInLst->Name[Gbl.Prefs.Language]); "%s",CtyInLst->FullName);
} }
/***** End selector of country *****/ /***** End selector of country *****/
@ -911,7 +895,7 @@ void Cty_WriteCountryName (long CtyCod)
Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB; // Only in main browser tab Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB; // Only in main browser tab
/***** Get country name *****/ /***** Get country name *****/
Cty_GetCountryName (CtyCod,Gbl.Prefs.Language,CtyName); Cty_GetCountryNameInLanguage (CtyCod,Gbl.Prefs.Language,CtyName);
if (PutForm) if (PutForm)
{ {
@ -933,45 +917,34 @@ void Cty_WriteCountryName (long CtyCod)
/***************** Get basic data of country given its code ******************/ /***************** Get basic data of country given its code ******************/
/*****************************************************************************/ /*****************************************************************************/
bool Cty_GetCountryDataByCod (struct Cty_Countr *Cty) bool Cty_GetBasicCountryDataByCod (struct Cty_Countr *Cty)
{ {
extern const char *Txt_Another_country; extern const char *Txt_Another_country;
MYSQL_RES *mysql_res; MYSQL_RES *mysql_res;
MYSQL_ROW row; MYSQL_ROW row;
Lan_Language_t Lan;
bool CtyFound; bool CtyFound;
if (Cty->Cod < 0) if (Cty->Cod < 0)
return false; return false;
/***** Clear data *****/ /***** Clear data *****/
for (Lan = (Lan_Language_t) 1; Cty->ShrtName[0] = '\0';
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES; Cty->FullName[0] = '\0';
Lan++) Cty->WWW[0] = '\0';
{
Cty->Name[Lan][0] = '\0';
Cty->WWW[Lan][0] = '\0';
}
Cty->NumUsrsWhoClaimToBelong.Valid = false; Cty->NumUsrsWhoClaimToBelong.Valid = false;
/***** Check if country code is correct *****/ /***** If another country *****/
if (Cty->Cod == 0) if (Cty->Cod == 0)
{ {
for (Lan = (Lan_Language_t) 1; Str_Copy (Cty->FullName,Txt_Another_country,
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES; sizeof (Cty->FullName) - 1);
Lan++)
if (Lan == Gbl.Prefs.Language)
Str_Copy (Cty->Name[Lan],Txt_Another_country,
sizeof (Cty->Name[Lan]) - 1);
else
Cty->Name[Lan][0] = '\0';
return false; return false;
} }
// Here Cty->CtyCod > 0 // Here Cty->CtyCod > 0
/***** Get data of a country from database *****/ /***** Get data of a country from database *****/
CtyFound = (Cty_DB_GetCountryDataByCod (&mysql_res,Cty->Cod) != 0); CtyFound = (Cty_DB_GetBasicCountryDataByCod (&mysql_res,Cty->Cod) != 0);
if (CtyFound) // Country found... if (CtyFound) // Country found...
{ {
/* Get row */ /* Get row */
@ -981,10 +954,8 @@ bool Cty_GetCountryDataByCod (struct Cty_Countr *Cty)
Str_Copy (Cty->Alpha2,row[0],sizeof (Cty->Alpha2) - 1); Str_Copy (Cty->Alpha2,row[0],sizeof (Cty->Alpha2) - 1);
/* Get name and WWW of the country in current language */ /* Get name and WWW of the country in current language */
Str_Copy (Cty->Name[Gbl.Prefs.Language],row[1], Str_Copy (Cty->FullName,row[1],sizeof (Cty->FullName) - 1);
sizeof (Cty->Name[Gbl.Prefs.Language]) - 1); Str_Copy (Cty->WWW ,row[2],sizeof (Cty->WWW ) - 1);
Str_Copy (Cty->WWW[Gbl.Prefs.Language],row[2],
sizeof (Cty->WWW[Gbl.Prefs.Language]) - 1);
} }
/***** Free structure that stores the query result *****/ /***** Free structure that stores the query result *****/
@ -993,6 +964,48 @@ bool Cty_GetCountryDataByCod (struct Cty_Countr *Cty)
return CtyFound; return CtyFound;
} }
/*****************************************************************************/
/*********** Get all names and WWWs of a country given its code **************/
/*****************************************************************************/
void Cty_GetNamesAndWWWsByCod (struct Cty_Countr *Cty,
char NameInSeveralLanguages[1 + Lan_NUM_LANGUAGES][Cty_MAX_BYTES_NAME + 1],
char WWWInSeveralLanguages [1 + Lan_NUM_LANGUAGES][Cns_MAX_BYTES_WWW + 1])
{
MYSQL_RES *mysql_res;
MYSQL_ROW row;
Lan_Language_t Lan;
/***** Get data of a country from database *****/
if (Cty_DB_GetNamesAndWWWsByCod (&mysql_res,Cty->Cod) != 0) // Country found...
{
/* Get row */
row = mysql_fetch_row (mysql_res);
/* Get names and webs of the country in several languages */
for (Lan = (Lan_Language_t) 1;
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
Lan++)
{
Str_Copy (NameInSeveralLanguages[Lan],row[Lan - 1],
Cty_MAX_BYTES_NAME);
Str_Copy (WWWInSeveralLanguages[Lan],row[Lan_NUM_LANGUAGES + Lan - 1],
Cns_MAX_BYTES_WWW - 1);
}
}
else
for (Lan = (Lan_Language_t) 1;
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
Lan++)
{
NameInSeveralLanguages[Lan][0] = '\0';
WWWInSeveralLanguages[Lan][0] = '\0';
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
/*****************************************************************************/ /*****************************************************************************/
/***************************** Get country name ******************************/ /***************************** Get country name ******************************/
/*****************************************************************************/ /*****************************************************************************/
@ -1004,8 +1017,8 @@ void Cty_FlushCacheCountryName (void)
Gbl.Cache.CountryName.CtyName[0] = '\0'; Gbl.Cache.CountryName.CtyName[0] = '\0';
} }
void Cty_GetCountryName (long CtyCod,Lan_Language_t Language, void Cty_GetCountryNameInLanguage (long CtyCod,Lan_Language_t Language,
char CtyName[Cty_MAX_BYTES_NAME + 1]) char CtyName[Cty_MAX_BYTES_NAME + 1])
{ {
/***** 1. Fast check: Trivial case *****/ /***** 1. Fast check: Trivial case *****/
if (CtyCod <= 0) if (CtyCod <= 0)
@ -1056,6 +1069,8 @@ static void Cty_ListCountriesForEdition (void)
unsigned NumInss; unsigned NumInss;
unsigned NumUsrsCty; unsigned NumUsrsCty;
Lan_Language_t Lan; Lan_Language_t Lan;
char NameInSeveralLanguages[1 + Lan_NUM_LANGUAGES][Cty_MAX_BYTES_NAME + 1];
char WWWInSeveralLanguages [1 + Lan_NUM_LANGUAGES][Cns_MAX_BYTES_WWW + 1];
/***** Begin table *****/ /***** Begin table *****/
HTM_TABLE_BeginWidePadding (2); HTM_TABLE_BeginWidePadding (2);
@ -1120,6 +1135,9 @@ static void Cty_ListCountriesForEdition (void)
HTM_TR_End (); HTM_TR_End ();
/* Country name in several languages */ /* Country name in several languages */
Cty_GetNamesAndWWWsByCod (Cty,
NameInSeveralLanguages,
WWWInSeveralLanguages);
for (Lan = (Lan_Language_t) 1; for (Lan = (Lan_Language_t) 1;
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES; Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
Lan++) Lan++)
@ -1136,7 +1154,7 @@ static void Cty_ListCountriesForEdition (void)
Frm_BeginForm (ActRenCty); Frm_BeginForm (ActRenCty);
ParCod_PutPar (ParCod_OthCty,Cty->Cod); ParCod_PutPar (ParCod_OthCty,Cty->Cod);
Par_PutParUnsigned (NULL,"Lan",(unsigned) Lan); Par_PutParUnsigned (NULL,"Lan",(unsigned) Lan);
HTM_INPUT_TEXT ("Name",Cty_MAX_CHARS_NAME,Cty->Name[Lan], HTM_INPUT_TEXT ("Name",Cty_MAX_CHARS_NAME,NameInSeveralLanguages[Lan],
HTM_SUBMIT_ON_CHANGE, HTM_SUBMIT_ON_CHANGE,
"size=\"15\" class=\"INPUT_%s\"", "size=\"15\" class=\"INPUT_%s\"",
The_GetSuffix ()); The_GetSuffix ());
@ -1148,7 +1166,7 @@ static void Cty_ListCountriesForEdition (void)
Frm_BeginForm (ActChgCtyWWW); Frm_BeginForm (ActChgCtyWWW);
ParCod_PutPar (ParCod_OthCty,Cty->Cod); ParCod_PutPar (ParCod_OthCty,Cty->Cod);
Par_PutParUnsigned (NULL,"Lan",(unsigned) Lan); Par_PutParUnsigned (NULL,"Lan",(unsigned) Lan);
HTM_INPUT_URL ("WWW",Cty->WWW[Lan],HTM_SUBMIT_ON_CHANGE, HTM_INPUT_URL ("WWW",WWWInSeveralLanguages[Lan],HTM_SUBMIT_ON_CHANGE,
"class=\"INPUT_WWW_NARROW INPUT_%s\"" "class=\"INPUT_WWW_NARROW INPUT_%s\""
" required=\"required\"", " required=\"required\"",
The_GetSuffix ()); The_GetSuffix ());
@ -1189,7 +1207,7 @@ void Cty_RemoveCountry (void)
Cty_EditingCty->Cod = ParCod_GetAndCheckPar (ParCod_OthCty); Cty_EditingCty->Cod = ParCod_GetAndCheckPar (ParCod_OthCty);
/***** Get data of the country from database *****/ /***** Get data of the country from database *****/
Cty_GetCountryDataByCod (Cty_EditingCty); Cty_GetBasicCountryDataByCod (Cty_EditingCty);
/***** Check if this country has users *****/ /***** Check if this country has users *****/
if (Ins_GetNumInssInCty (Cty_EditingCty->Cod)) // Country has institutions ==> don't remove if (Ins_GetNumInssInCty (Cty_EditingCty->Cod)) // Country has institutions ==> don't remove
@ -1223,7 +1241,7 @@ void Cty_RemoveCountry (void)
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
Ale_CreateAlert (Ale_SUCCESS,NULL, Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_Country_X_removed, Txt_Country_X_removed,
Cty_EditingCty->Name[Gbl.Prefs.Language]); Cty_EditingCty->FullName);
Cty_EditingCty->Cod = -1L; // To not showing button to go to country Cty_EditingCty->Cod = -1L; // To not showing button to go to country
} }
@ -1239,6 +1257,7 @@ void Cty_RenameCountry (void)
extern const char *Txt_The_country_X_has_been_renamed_as_Y; extern const char *Txt_The_country_X_has_been_renamed_as_Y;
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
extern const char *Txt_The_name_X_has_not_changed; extern const char *Txt_The_name_X_has_not_changed;
char OldCtyName[Cty_MAX_BYTES_NAME + 1];
char NewCtyName[Cty_MAX_BYTES_NAME + 1]; char NewCtyName[Cty_MAX_BYTES_NAME + 1];
Lan_Language_t Language; Lan_Language_t Language;
char FldName[4 + 1 + 2 + 1]; // Example: "Name_en" char FldName[4 + 1 + 2 + 1]; // Example: "Name_en"
@ -1256,16 +1275,15 @@ void Cty_RenameCountry (void)
Par_GetParText ("Name",NewCtyName,Cty_MAX_BYTES_NAME); Par_GetParText ("Name",NewCtyName,Cty_MAX_BYTES_NAME);
/***** Get from the database the data of the country *****/ /***** Get from the database the data of the country *****/
Cty_GetCountryDataByCod (Cty_EditingCty); Cty_GetBasicCountryDataByCod (Cty_EditingCty);
/***** Check if new name is empty *****/ /***** Check if new name is empty *****/
if (NewCtyName[0]) if (NewCtyName[0])
{ {
/***** Check if old and new names are the same /***** Check if old and new names are the same
(this happens when return is pressed without changes) *****/ (this happens when return is pressed without changes) *****/
Cty_GetCountryName (Cty_EditingCty->Cod,Language, Cty_GetCountryNameInLanguage (Cty_EditingCty->Cod,Language,OldCtyName);
Cty_EditingCty->Name[Language]); if (strcmp (OldCtyName,NewCtyName)) // Different names
if (strcmp (Cty_EditingCty->Name[Language],NewCtyName)) // Different names
{ {
/***** If country was in database... *****/ /***** If country was in database... *****/
if (Cty_DB_CheckIfCountryNameExists (Language,NewCtyName,Cty_EditingCty->Cod)) if (Cty_DB_CheckIfCountryNameExists (Language,NewCtyName,Cty_EditingCty->Cod))
@ -1282,16 +1300,13 @@ void Cty_RenameCountry (void)
/* Write message to show the change made */ /* Write message to show the change made */
Ale_CreateAlert (Ale_SUCCESS,NULL, Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_country_X_has_been_renamed_as_Y, Txt_The_country_X_has_been_renamed_as_Y,
Cty_EditingCty->Name[Language],NewCtyName); OldCtyName,NewCtyName);
/* Update country name */
Str_Copy (Cty_EditingCty->Name[Language],NewCtyName,
sizeof (Cty_EditingCty->Name[Language]) - 1);
} }
} }
else // The same name else // The same name
Ale_CreateAlert (Ale_INFO,NULL, Ale_CreateAlert (Ale_INFO,NULL,
Txt_The_name_X_has_not_changed,Cty_EditingCty->Name[Language]); Txt_The_name_X_has_not_changed,
OldCtyName);
} }
else else
Ale_CreateAlertYouCanNotLeaveFieldEmpty (); Ale_CreateAlertYouCanNotLeaveFieldEmpty ();
@ -1335,14 +1350,12 @@ void Cty_ChangeCtyWWW (void)
Par_GetParText ("WWW",NewWWW,Cns_MAX_BYTES_WWW); Par_GetParText ("WWW",NewWWW,Cns_MAX_BYTES_WWW);
/***** Get from the database the data of the country *****/ /***** Get from the database the data of the country *****/
Cty_GetCountryDataByCod (Cty_EditingCty); Cty_GetBasicCountryDataByCod (Cty_EditingCty);
/***** Update the table changing old WWW by new WWW *****/ /***** Update the table changing old WWW by new WWW *****/
snprintf (FldName,sizeof (FldName),"Name_%s", snprintf (FldName,sizeof (FldName),"WWW_%s",
Lan_STR_LANG_ID[Language]); Lan_STR_LANG_ID[Language]);
Cty_DB_UpdateCtyField (Cty_EditingCty->Cod,FldName,NewWWW); Cty_DB_UpdateCtyField (Cty_EditingCty->Cod,FldName,NewWWW);
Str_Copy (Cty_EditingCty->WWW[Language],NewWWW,
sizeof (Cty_EditingCty->WWW[Language]) - 1);
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
Ale_CreateAlert (Ale_SUCCESS,NULL, Ale_CreateAlert (Ale_SUCCESS,NULL,
@ -1381,7 +1394,7 @@ static void Cty_ShowAlertAndButtonToGoToCty (void)
Ale_ShowLastAlertAndButton (ActSeeIns,NULL,NULL, Ale_ShowLastAlertAndButton (ActSeeIns,NULL,NULL,
Cty_PutParGoToCty,&Cty_EditingCty->Cod, Cty_PutParGoToCty,&Cty_EditingCty->Cod,
Btn_CONFIRM_BUTTON, Btn_CONFIRM_BUTTON,
Str_BuildGoToTitle (Cty_EditingCty->Name[Gbl.Prefs.Language])); Str_BuildGoToTitle (Cty_EditingCty->FullName));
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
} }
else else
@ -1471,7 +1484,7 @@ static void Cty_PutFormToCreateCountry (void)
/* Name */ /* Name */
HTM_TD_Begin ("class=\"LM\""); HTM_TD_Begin ("class=\"LM\"");
snprintf (StrName,sizeof (StrName),"Name_%s",Lan_STR_LANG_ID[Lan]); snprintf (StrName,sizeof (StrName),"Name_%s",Lan_STR_LANG_ID[Lan]);
HTM_INPUT_TEXT (StrName,Cty_MAX_CHARS_NAME,Cty_EditingCty->Name[Lan], HTM_INPUT_TEXT (StrName,Cty_MAX_CHARS_NAME,"",
HTM_DONT_SUBMIT_ON_CHANGE, HTM_DONT_SUBMIT_ON_CHANGE,
"size=\"15\" class=\"INPUT_%s\"" "size=\"15\" class=\"INPUT_%s\""
" required=\"required\"", " required=\"required\"",
@ -1481,7 +1494,7 @@ static void Cty_PutFormToCreateCountry (void)
/* WWW */ /* WWW */
HTM_TD_Begin ("class=\"LM\""); HTM_TD_Begin ("class=\"LM\"");
snprintf (StrName,sizeof (StrName),"WWW_%s",Lan_STR_LANG_ID[Lan]); snprintf (StrName,sizeof (StrName),"WWW_%s",Lan_STR_LANG_ID[Lan]);
HTM_INPUT_URL (StrName,Cty_EditingCty->WWW[Lan],HTM_DONT_SUBMIT_ON_CHANGE, HTM_INPUT_URL (StrName,"",HTM_DONT_SUBMIT_ON_CHANGE,
"class=\"INPUT_WWW_NARROW INPUT_%s\"" "class=\"INPUT_WWW_NARROW INPUT_%s\""
" required=\"required\"", " required=\"required\"",
The_GetSuffix ()); The_GetSuffix ());
@ -1538,10 +1551,19 @@ void Cty_ReceiveFormNewCountry (void)
char ParName[32]; char ParName[32];
bool CreateCountry = true; bool CreateCountry = true;
Lan_Language_t Lan; Lan_Language_t Lan;
char NameInSeveralLanguages[1 + Lan_NUM_LANGUAGES][Cty_MAX_BYTES_NAME + 1];
char WWWInSeveralLanguages [1 + Lan_NUM_LANGUAGES][Cns_MAX_BYTES_WWW + 1];
unsigned i; unsigned i;
/***** Country constructoor *****/ /***** Country constructoor *****/
Cty_EditingCountryConstructor (); Cty_EditingCountryConstructor ();
for (Lan = (Lan_Language_t) 1;
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
Lan++)
{
NameInSeveralLanguages[Lan][0] = '\0';
WWWInSeveralLanguages [Lan][0] = '\0';
}
/***** Get parameters from form *****/ /***** Get parameters from form *****/
/* Get numeric country code */ /* Get numeric country code */
@ -1591,16 +1613,16 @@ void Cty_ReceiveFormNewCountry (void)
Lan++) Lan++)
{ {
snprintf (ParName,sizeof (ParName),"Name_%s",Lan_STR_LANG_ID[Lan]); snprintf (ParName,sizeof (ParName),"Name_%s",Lan_STR_LANG_ID[Lan]);
Par_GetParText (ParName,Cty_EditingCty->Name[Lan],Cty_MAX_BYTES_NAME); Par_GetParText (ParName,NameInSeveralLanguages[Lan],Cty_MAX_BYTES_NAME);
if (Cty_EditingCty->Name[Lan][0]) // If there's a country name if (NameInSeveralLanguages[Lan][0]) // If there's a country name
{ {
/***** If name of country was in database... *****/ /***** If name of country was in database... *****/
if (Cty_DB_CheckIfCountryNameExists (Lan,Cty_EditingCty->Name[Lan],-1L)) if (Cty_DB_CheckIfCountryNameExists (Lan,NameInSeveralLanguages[Lan],-1L))
{ {
Ale_CreateAlert (Ale_WARNING,NULL, Ale_CreateAlert (Ale_WARNING,NULL,
Txt_The_country_X_already_exists, Txt_The_country_X_already_exists,
Cty_EditingCty->Name[Lan]); NameInSeveralLanguages[Lan]);
CreateCountry = false; CreateCountry = false;
break; break;
} }
@ -1614,7 +1636,7 @@ void Cty_ReceiveFormNewCountry (void)
} }
snprintf (ParName,sizeof (ParName),"WWW_%s",Lan_STR_LANG_ID[Lan]); snprintf (ParName,sizeof (ParName),"WWW_%s",Lan_STR_LANG_ID[Lan]);
Par_GetParText (ParName,Cty_EditingCty->WWW[Lan],Cns_MAX_BYTES_WWW); Par_GetParText (ParName,WWWInSeveralLanguages[Lan],Cns_MAX_BYTES_WWW);
} }
} }
} }
@ -1622,9 +1644,12 @@ void Cty_ReceiveFormNewCountry (void)
if (CreateCountry) if (CreateCountry)
{ {
Cty_DB_CreateCountry (Cty_EditingCty); // Add new country to database Cty_DB_CreateCountry (Cty_EditingCty, // Add new country to database
NameInSeveralLanguages,
WWWInSeveralLanguages);
Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_country_X, Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_country_X,
Cty_EditingCty->Name); Cty_EditingCty->FullName);
} }
} }
@ -1799,7 +1824,7 @@ void Cty_ListCtysFound (MYSQL_RES **mysql_res,unsigned NumCtys)
Cty.Cod = DB_GetNextCode (*mysql_res); Cty.Cod = DB_GetNextCode (*mysql_res);
/* Get data of country */ /* Get data of country */
Cty_GetCountryDataByCod (&Cty); Cty_GetBasicCountryDataByCod (&Cty);
/* Write data of this country */ /* Write data of this country */
Cty_ListOneCountryForSeeing (&Cty,NumCty); Cty_ListOneCountryForSeeing (&Cty,NumCty);
@ -1819,8 +1844,6 @@ void Cty_ListCtysFound (MYSQL_RES **mysql_res,unsigned NumCtys)
static void Cty_EditingCountryConstructor (void) static void Cty_EditingCountryConstructor (void)
{ {
Lan_Language_t Lan;
/***** Pointer must be NULL *****/ /***** Pointer must be NULL *****/
if (Cty_EditingCty != NULL) if (Cty_EditingCty != NULL)
Err_WrongCountrExit (); Err_WrongCountrExit ();
@ -1830,15 +1853,11 @@ static void Cty_EditingCountryConstructor (void)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
/***** Reset country *****/ /***** Reset country *****/
Cty_EditingCty->Cod = -1L; Cty_EditingCty->Cod = -1L;
Cty_EditingCty->Alpha2[0] = '\0'; Cty_EditingCty->Alpha2[0] = '\0';
for (Lan = (Lan_Language_t) 1; Cty_EditingCty->ShrtName[0] = '\0';
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES; Cty_EditingCty->FullName[0] = '\0';
Lan++) Cty_EditingCty->WWW[0] = '\0';
{
Cty_EditingCty->Name[Lan][0] = '\0';
Cty_EditingCty->WWW [Lan][0] = '\0';
}
Cty_EditingCty->NumUsrsWhoClaimToBelong.Valid = false; Cty_EditingCty->NumUsrsWhoClaimToBelong.Valid = false;
} }

View File

@ -49,8 +49,9 @@ struct Cty_Countr
{ {
long Cod; // Country code long Cod; // Country code
char Alpha2[2 + 1]; char Alpha2[2 + 1];
char Name[1 + Lan_NUM_LANGUAGES][Cty_MAX_BYTES_NAME + 1]; char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1];
char WWW [1 + Lan_NUM_LANGUAGES][Cns_MAX_BYTES_WWW + 1]; char FullName[Cns_HIERARCHY_MAX_BYTES_FULL_NAME + 1];
char WWW[Cns_MAX_BYTES_WWW + 1];
struct struct
{ {
bool Valid; bool Valid;
@ -95,14 +96,16 @@ void Cty_WriteScriptGoogleGeochart (void);
void Cty_PutParCtyOrder (void); void Cty_PutParCtyOrder (void);
void Cty_EditCountries (void); void Cty_EditCountries (void);
void Cty_GetBasicListOfCountries (void); void Cty_GetBasicListOfCountries (void);
void Cty_GetFullListOfCountries (void);
void Cty_FreeListCountries (void); void Cty_FreeListCountries (void);
void Cty_WriteSelectorOfCountry (void); void Cty_WriteSelectorOfCountry (void);
void Cty_WriteCountryName (long CtyCod); void Cty_WriteCountryName (long CtyCod);
bool Cty_GetCountryDataByCod (struct Cty_Countr *Cty); bool Cty_GetBasicCountryDataByCod (struct Cty_Countr *Cty);
void Cty_GetNamesAndWWWsByCod (struct Cty_Countr *Cty,
char NameInSeveralLanguages[1 + Lan_NUM_LANGUAGES][Cty_MAX_BYTES_NAME + 1],
char WWWInSeveralLanguages [1 + Lan_NUM_LANGUAGES][Cns_MAX_BYTES_WWW + 1]);
void Cty_FlushCacheCountryName (void); void Cty_FlushCacheCountryName (void);
void Cty_GetCountryName (long CtyCod,Lan_Language_t Language, void Cty_GetCountryNameInLanguage (long CtyCod,Lan_Language_t Language,
char CtyName[Cty_MAX_BYTES_NAME + 1]); char CtyName[Cty_MAX_BYTES_NAME + 1]);
void Cty_RemoveCountry (void); void Cty_RemoveCountry (void);
void Cty_RenameCountry (void); void Cty_RenameCountry (void);
void Cty_ChangeCtyWWW (void); void Cty_ChangeCtyWWW (void);

View File

@ -113,7 +113,7 @@ static void CtyCfg_Configuration (bool PrintView)
return; return;
/***** Initializations *****/ /***** Initializations *****/
PutLink = !PrintView && Gbl.Hierarchy.Cty.WWW[Gbl.Prefs.Language][0]; PutLink = !PrintView && Gbl.Hierarchy.Cty.WWW[0];
/***** Begin box *****/ /***** Begin box *****/
if (PrintView) if (PrintView)
@ -226,12 +226,12 @@ static void CtyCfg_Title (bool PutLink)
if (PutLink) if (PutLink)
HTM_A_Begin ("href=\"%s\" target=\"_blank\" title=\"%s\"" HTM_A_Begin ("href=\"%s\" target=\"_blank\" title=\"%s\""
" class=\"FRAME_TITLE_BIG FRAME_TITLE_%s\"", " class=\"FRAME_TITLE_BIG FRAME_TITLE_%s\"",
Gbl.Hierarchy.Cty.WWW[Gbl.Prefs.Language], Gbl.Hierarchy.Cty.WWW,
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language], Gbl.Hierarchy.Cty.FullName,
The_GetSuffix ()); The_GetSuffix ());
/* Country name */ /* Country name */
HTM_Txt (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]); HTM_Txt (Gbl.Hierarchy.Cty.FullName);
/* End link */ /* End link */
if (PutLink) if (PutLink)
@ -324,7 +324,7 @@ static void CtyCfg_MapImage (bool PrintView,bool PutLink)
HTM_DIV_Begin ("class=\"CM\""); HTM_DIV_Begin ("class=\"CM\"");
if (PutLink) if (PutLink)
HTM_A_Begin ("href=\"%s\" target=\"_blank\"", HTM_A_Begin ("href=\"%s\" target=\"_blank\"",
Gbl.Hierarchy.Cty.WWW[Gbl.Prefs.Language]); Gbl.Hierarchy.Cty.WWW);
Cty_DrawCountryMap (&Gbl.Hierarchy.Cty,PrintView ? "COUNTRY_MAP_PRINT" : Cty_DrawCountryMap (&Gbl.Hierarchy.Cty,PrintView ? "COUNTRY_MAP_PRINT" :
"COUNTRY_MAP_SHOW"); "COUNTRY_MAP_SHOW");
if (PutLink) if (PutLink)
@ -409,9 +409,9 @@ static void CtyCfg_Name (bool PutLink)
HTM_TD_Begin ("class=\"LB DAT_STRONG_%s\"",The_GetSuffix ()); HTM_TD_Begin ("class=\"LB DAT_STRONG_%s\"",The_GetSuffix ());
if (PutLink) if (PutLink)
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT_STRONG_%s\"", HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT_STRONG_%s\"",
Gbl.Hierarchy.Cty.WWW[Gbl.Prefs.Language], Gbl.Hierarchy.Cty.WWW,
The_GetSuffix ()); The_GetSuffix ());
HTM_Txt (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]); HTM_Txt (Gbl.Hierarchy.Cty.FullName);
if (PutLink) if (PutLink)
HTM_A_End (); HTM_A_End ();
HTM_TD_End (); HTM_TD_End ();
@ -480,7 +480,7 @@ static void CtyCfg_NumInss (void)
Frm_BeginFormGoTo (ActSeeIns); Frm_BeginFormGoTo (ActSeeIns);
ParCod_PutPar (ParCod_Cty,Gbl.Hierarchy.Cty.Cod); ParCod_PutPar (ParCod_Cty,Gbl.Hierarchy.Cty.Cod);
if (asprintf (&Title,Txt_Institutions_of_COUNTRY_X, if (asprintf (&Title,Txt_Institutions_of_COUNTRY_X,
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]) < 0) Gbl.Hierarchy.Cty.FullName) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
HTM_BUTTON_Submit_Begin (Title,"class=\"LT BT_LINK\""); HTM_BUTTON_Submit_Begin (Title,"class=\"LT BT_LINK\"");
free (Title); free (Title);

View File

@ -55,7 +55,9 @@ extern struct Globals Gbl;
/**************************** Create a new country ***************************/ /**************************** Create a new country ***************************/
/*****************************************************************************/ /*****************************************************************************/
void Cty_DB_CreateCountry (const struct Cty_Countr *Cty) void Cty_DB_CreateCountry (const struct Cty_Countr *Cty,
char NameInSeveralLanguages[1 + Lan_NUM_LANGUAGES][Cty_MAX_BYTES_NAME + 1],
char WWWInSeveralLanguages [1 + Lan_NUM_LANGUAGES][Cns_MAX_BYTES_WWW + 1])
{ {
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
Lan_Language_t Lan; Lan_Language_t Lan;
@ -78,14 +80,14 @@ void Cty_DB_CreateCountry (const struct Cty_Countr *Cty)
Str_Concat (SubQueryNam1,StrField,sizeof (SubQueryNam1) - 1); Str_Concat (SubQueryNam1,StrField,sizeof (SubQueryNam1) - 1);
Str_Concat (SubQueryNam2,",'",sizeof (SubQueryNam2) - 1); Str_Concat (SubQueryNam2,",'",sizeof (SubQueryNam2) - 1);
Str_Concat (SubQueryNam2,Cty->Name[Lan],sizeof (SubQueryNam2) - 1); Str_Concat (SubQueryNam2,NameInSeveralLanguages[Lan],sizeof (SubQueryNam2) - 1);
Str_Concat (SubQueryNam2,"'",sizeof (SubQueryNam2) - 1); Str_Concat (SubQueryNam2,"'",sizeof (SubQueryNam2) - 1);
snprintf (StrField,sizeof (StrField),",WWW_%s",Lan_STR_LANG_ID[Lan]); snprintf (StrField,sizeof (StrField),",WWW_%s",Lan_STR_LANG_ID[Lan]);
Str_Concat (SubQueryWWW1,StrField,sizeof (SubQueryWWW1) - 1); Str_Concat (SubQueryWWW1,StrField,sizeof (SubQueryWWW1) - 1);
Str_Concat (SubQueryWWW2,",'",sizeof (SubQueryWWW2) - 1); Str_Concat (SubQueryWWW2,",'",sizeof (SubQueryWWW2) - 1);
Str_Concat (SubQueryWWW2,Cty->WWW[Lan],sizeof (SubQueryWWW2) - 1); Str_Concat (SubQueryWWW2,WWWInSeveralLanguages[Lan],sizeof (SubQueryWWW2) - 1);
Str_Concat (SubQueryWWW2,"'",sizeof (SubQueryWWW2) - 1); Str_Concat (SubQueryWWW2,"'",sizeof (SubQueryWWW2) - 1);
} }
DB_QueryINSERT ("can not create country", DB_QueryINSERT ("can not create country",
@ -150,11 +152,6 @@ unsigned Cty_DB_GetCtysWithPendingInss (MYSQL_RES **mysql_res)
unsigned Cty_DB_GetCtysFull (MYSQL_RES **mysql_res) unsigned Cty_DB_GetCtysFull (MYSQL_RES **mysql_res)
{ {
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
char StrField[32];
char SubQueryNam1[Cty_DB_MAX_BYTES_SUBQUERY_CTYS + 1];
char SubQueryNam2[Cty_DB_MAX_BYTES_SUBQUERY_CTYS + 1];
char SubQueryWWW1[Cty_DB_MAX_BYTES_SUBQUERY_CTYS + 1];
char SubQueryWWW2[Cty_DB_MAX_BYTES_SUBQUERY_CTYS + 1];
char *OrderBySubQuery = NULL; char *OrderBySubQuery = NULL;
static const char *OrderBySubQueryFmt[Cty_NUM_ORDERS] = static const char *OrderBySubQueryFmt[Cty_NUM_ORDERS] =
{ {
@ -163,28 +160,8 @@ unsigned Cty_DB_GetCtysFull (MYSQL_RES **mysql_res)
"Name_%s", "Name_%s",
}; };
unsigned NumCtys; unsigned NumCtys;
Lan_Language_t Lan;
/***** Get countries from database *****/ /***** Get countries from database *****/
SubQueryNam1[0] = '\0';
SubQueryNam2[0] = '\0';
SubQueryWWW1[0] = '\0';
SubQueryWWW2[0] = '\0';
for (Lan = (Lan_Language_t) 1;
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
Lan++)
{
snprintf (StrField,sizeof (StrField),"cty_countrs.Name_%s,",Lan_STR_LANG_ID[Lan]);
Str_Concat (SubQueryNam1,StrField,sizeof (SubQueryNam1) - 1);
snprintf (StrField,sizeof (StrField),"Name_%s,",Lan_STR_LANG_ID[Lan]);
Str_Concat (SubQueryNam2,StrField,sizeof (SubQueryNam2) - 1);
snprintf (StrField,sizeof (StrField),"cty_countrs.WWW_%s,",Lan_STR_LANG_ID[Lan]);
Str_Concat (SubQueryWWW1,StrField,sizeof (SubQueryWWW1) - 1);
snprintf (StrField,sizeof (StrField),"WWW_%s,",Lan_STR_LANG_ID[Lan]);
Str_Concat (SubQueryWWW2,StrField,sizeof (SubQueryWWW2) - 1);
}
/* Build order subquery */ /* Build order subquery */
if (asprintf (&OrderBySubQuery,OrderBySubQueryFmt[Gbl.Hierarchy.Ctys.SelectedOrder], if (asprintf (&OrderBySubQuery,OrderBySubQueryFmt[Gbl.Hierarchy.Ctys.SelectedOrder],
Lan_STR_LANG_ID[Gbl.Prefs.Language]) < 0) Lan_STR_LANG_ID[Gbl.Prefs.Language]) < 0)
@ -195,9 +172,9 @@ unsigned Cty_DB_GetCtysFull (MYSQL_RES **mysql_res)
DB_QuerySELECT (mysql_res,"can not get countries", DB_QuerySELECT (mysql_res,"can not get countries",
"(SELECT cty_countrs.CtyCod," // row[0] "(SELECT cty_countrs.CtyCod," // row[0]
"cty_countrs.Alpha2," // row[1] "cty_countrs.Alpha2," // row[1]
"%s" // row[...] "cty_countrs.Name_%s," // row[2]
"%s" // row[...] "cty_countrs.WWW_%s," // row[3]
"COUNT(*) AS NumUsrs" // row[...] "COUNT(*) AS NumUsrs" // row[4]
" FROM cty_countrs," " FROM cty_countrs,"
"usr_data" "usr_data"
" WHERE cty_countrs.CtyCod=usr_data.CtyCod" " WHERE cty_countrs.CtyCod=usr_data.CtyCod"
@ -205,17 +182,20 @@ unsigned Cty_DB_GetCtysFull (MYSQL_RES **mysql_res)
" UNION " " UNION "
"(SELECT CtyCod," // row[0] "(SELECT CtyCod," // row[0]
"Alpha2," // row[1] "Alpha2," // row[1]
"%s" // row[...] "cty_countrs.Name_%s," // row[2]
"%s" // row[...] "cty_countrs.WWW_%s," // row[3]
"0 AS NumUsrs" // row[...] "0 AS NumUsrs" // row[4]
" FROM cty_countrs" " FROM cty_countrs"
" WHERE CtyCod NOT IN" " WHERE CtyCod NOT IN"
" (SELECT DISTINCT " " (SELECT DISTINCT "
"CtyCod" "CtyCod"
" FROM usr_data))" " FROM usr_data))"
" ORDER BY %s", " ORDER BY %s",
SubQueryNam1,SubQueryWWW1, Lan_STR_LANG_ID[Gbl.Prefs.Language],
SubQueryNam2,SubQueryWWW2,OrderBySubQuery); Lan_STR_LANG_ID[Gbl.Prefs.Language],
Lan_STR_LANG_ID[Gbl.Prefs.Language],
Lan_STR_LANG_ID[Gbl.Prefs.Language],
OrderBySubQuery);
/* Free memory for subquery */ /* Free memory for subquery */
free (OrderBySubQuery); free (OrderBySubQuery);
@ -227,7 +207,7 @@ unsigned Cty_DB_GetCtysFull (MYSQL_RES **mysql_res)
/***************** Get basic data of country given its code ******************/ /***************** Get basic data of country given its code ******************/
/*****************************************************************************/ /*****************************************************************************/
unsigned Cty_DB_GetCountryDataByCod (MYSQL_RES **mysql_res,long CtyCod) unsigned Cty_DB_GetBasicCountryDataByCod (MYSQL_RES **mysql_res,long CtyCod)
{ {
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES]; extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
@ -243,6 +223,46 @@ unsigned Cty_DB_GetCountryDataByCod (MYSQL_RES **mysql_res,long CtyCod)
CtyCod); CtyCod);
} }
/*****************************************************************************/
/*********** Get all names and WWWs of a country given its code **************/
/*****************************************************************************/
unsigned Cty_DB_GetNamesAndWWWsByCod (MYSQL_RES **mysql_res,long CtyCod)
{
extern const char *Lan_STR_LANG_ID[1 + Lan_NUM_LANGUAGES];
char StrField[32];
char SubQueryNam[Cty_DB_MAX_BYTES_SUBQUERY_CTYS + 1];
char SubQueryWWW[Cty_DB_MAX_BYTES_SUBQUERY_CTYS + 1];
Lan_Language_t Lan;
/***** Get countries from database *****/
SubQueryNam[0] = '\0';
SubQueryWWW[0] = '\0';
for (Lan = (Lan_Language_t) 1;
Lan <= (Lan_Language_t) Lan_NUM_LANGUAGES;
Lan++)
{
snprintf (StrField,sizeof (StrField),"Name_%s,",Lan_STR_LANG_ID[Lan]);
Str_Concat (SubQueryNam,StrField,sizeof (SubQueryNam) - 1);
snprintf (StrField,sizeof (StrField),
Lan == Lan_NUM_LANGUAGES ? "WWW_%s" :
"WWW_%s,",
Lan_STR_LANG_ID[Lan]);
Str_Concat (SubQueryWWW,StrField,sizeof (SubQueryWWW) - 1);
}
/* Query database */
return (unsigned)
DB_QuerySELECT (mysql_res,"can not get countries",
"SELECT %s" // row[...]
"%s" // row[...]
" FROM cty_countrs"
" WHERE CtyCod='%03ld'",
SubQueryNam,SubQueryWWW,
CtyCod);
}
/*****************************************************************************/ /*****************************************************************************/
/******************* Get name of a country in a language *********************/ /******************* Get name of a country in a language *********************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -38,12 +38,15 @@
/***************************** Public prototypes *****************************/ /***************************** Public prototypes *****************************/
/*****************************************************************************/ /*****************************************************************************/
void Cty_DB_CreateCountry (const struct Cty_Countr *Cty); void Cty_DB_CreateCountry (const struct Cty_Countr *Cty,
char NameInSeveralLanguages[1 + Lan_NUM_LANGUAGES][Cty_MAX_BYTES_NAME + 1],
char WWWInSeveralLanguages [1 + Lan_NUM_LANGUAGES][Cns_MAX_BYTES_WWW + 1]);
unsigned Cty_DB_GetCtysBasic (MYSQL_RES **mysql_res); unsigned Cty_DB_GetCtysBasic (MYSQL_RES **mysql_res);
unsigned Cty_DB_GetCtysWithPendingInss (MYSQL_RES **mysql_res); unsigned Cty_DB_GetCtysWithPendingInss (MYSQL_RES **mysql_res);
unsigned Cty_DB_GetCtysFull (MYSQL_RES **mysql_res); unsigned Cty_DB_GetCtysFull (MYSQL_RES **mysql_res);
unsigned Cty_DB_GetCountryDataByCod (MYSQL_RES **mysql_res,long CtyCod); unsigned Cty_DB_GetBasicCountryDataByCod (MYSQL_RES **mysql_res,long CtyCod);
unsigned Cty_DB_GetNamesAndWWWsByCod (MYSQL_RES **mysql_res,long CtyCod);
void Cty_DB_GetCountryName (long CtyCod,Lan_Language_t Language, void Cty_DB_GetCountryName (long CtyCod,Lan_Language_t Language,
char CtyName[Cty_MAX_BYTES_NAME + 1]); char CtyName[Cty_MAX_BYTES_NAME + 1]);

View File

@ -209,7 +209,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
/***** Get data of this institution *****/ /***** Get data of this institution *****/
Hie.Cty.Cod = Str_ConvertStrCodToLongCod (row[0]); Hie.Cty.Cod = Str_ConvertStrCodToLongCod (row[0]);
if (!Cty_GetCountryDataByCod (&Hie.Cty)) if (!Cty_GetBasicCountryDataByCod (&Hie.Cty))
Err_WrongCountrExit (); Err_WrongCountrExit ();
/***** Write link to country *****/ /***** Write link to country *****/
@ -225,7 +225,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
"class=\"BT_LINK FORM_IN_%s\"", "class=\"BT_LINK FORM_IN_%s\"",
The_GetSuffix ()); The_GetSuffix ());
Cty_DrawCountryMap (&Hie.Cty,"ICO16x16"); Cty_DrawCountryMap (&Hie.Cty,"ICO16x16");
HTM_TxtF ("&nbsp;%s",Hie.Cty.Name[Gbl.Prefs.Language]); HTM_TxtF ("&nbsp;%s",Hie.Cty.FullName);
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();
HTM_LI_End (); HTM_LI_End ();

View File

@ -197,7 +197,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
{ {
/* Select a degree */ /* Select a degree */
if (asprintf (&Description,Gbl.Hierarchy.Deg.Cod > 0 ? Txt_Select_or_create_another_degree_in_X : if (asprintf (&Description,Gbl.Hierarchy.Deg.Cod > 0 ? Txt_Select_or_create_another_degree_in_X :
Txt_Select_or_create_one_degree_in_X, Txt_Select_or_create_one_degree_in_X,
Gbl.Hierarchy.Ctr.ShrtName) < 0) Gbl.Hierarchy.Ctr.ShrtName) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Description, Hlp_ShowRowHelpWhatWouldYouLikeToDo (Description,
@ -209,7 +209,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
{ {
/* Select a center */ /* Select a center */
if (asprintf (&Description,Gbl.Hierarchy.Ctr.Cod > 0 ? Txt_Select_or_create_another_center_in_X : if (asprintf (&Description,Gbl.Hierarchy.Ctr.Cod > 0 ? Txt_Select_or_create_another_center_in_X :
Txt_Select_or_create_one_center_in_X, Txt_Select_or_create_one_center_in_X,
Gbl.Hierarchy.Ins.ShrtName) < 0) Gbl.Hierarchy.Ins.ShrtName) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Description, Hlp_ShowRowHelpWhatWouldYouLikeToDo (Description,
@ -221,8 +221,8 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
{ {
/* Select an institution */ /* Select an institution */
if (asprintf (&Description,Gbl.Hierarchy.Ins.Cod > 0 ? Txt_Select_or_create_another_institution_in_X : if (asprintf (&Description,Gbl.Hierarchy.Ins.Cod > 0 ? Txt_Select_or_create_another_institution_in_X :
Txt_Select_or_create_one_institution_in_X, Txt_Select_or_create_one_institution_in_X,
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]) < 0) Gbl.Hierarchy.Cty.FullName) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Description, Hlp_ShowRowHelpWhatWouldYouLikeToDo (Description,
ActSeeIns, ActSeeIns,
@ -232,7 +232,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
else else
/* Select a country */ /* Select a country */
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Hierarchy.Cty.Cod > 0 ? Txt_Select_another_country : Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Hierarchy.Cty.Cod > 0 ? Txt_Select_another_country :
Txt_Select_one_country, Txt_Select_one_country,
ActSeeCty, ActSeeCty,
Btn_CONFIRM_BUTTON,Txt_Countries); Btn_CONFIRM_BUTTON,Txt_Countries);

View File

@ -233,9 +233,9 @@ void Hie_WriteHierarchyInBreadcrumb (void)
/***** Form to go to see institutions of this country *****/ /***** Form to go to see institutions of this country *****/
Frm_BeginFormGoTo (ActSeeIns); Frm_BeginFormGoTo (ActSeeIns);
ParCod_PutPar (ParCod_Cty,Gbl.Hierarchy.Cty.Cod); ParCod_PutPar (ParCod_Cty,Gbl.Hierarchy.Cty.Cod);
HTM_BUTTON_Submit_Begin (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language], HTM_BUTTON_Submit_Begin (Gbl.Hierarchy.Cty.FullName,
"class=\"BT_LINK\""); "class=\"BT_LINK\"");
HTM_Txt (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]); HTM_Txt (Gbl.Hierarchy.Cty.FullName);
HTM_BUTTON_End (); HTM_BUTTON_End ();
Frm_EndForm (); Frm_EndForm ();
@ -430,7 +430,7 @@ void Hie_WriteBigNameCtyInsCtrDegCrs (void)
const char *FullText[HieLvl_NUM_LEVELS] = const char *FullText[HieLvl_NUM_LEVELS] =
{ {
[HieLvl_SYS] = Cfg_PLATFORM_SHORT_NAME, [HieLvl_SYS] = Cfg_PLATFORM_SHORT_NAME,
[HieLvl_CTY] = Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language], [HieLvl_CTY] = Gbl.Hierarchy.Cty.FullName,
[HieLvl_INS] = Gbl.Hierarchy.Ins.FullName, [HieLvl_INS] = Gbl.Hierarchy.Ins.FullName,
[HieLvl_CTR] = Gbl.Hierarchy.Ctr.FullName, [HieLvl_CTR] = Gbl.Hierarchy.Ctr.FullName,
[HieLvl_DEG] = Gbl.Hierarchy.Deg.FullName, [HieLvl_DEG] = Gbl.Hierarchy.Deg.FullName,
@ -439,7 +439,7 @@ void Hie_WriteBigNameCtyInsCtrDegCrs (void)
const char *ShrtText[HieLvl_NUM_LEVELS] = const char *ShrtText[HieLvl_NUM_LEVELS] =
{ {
[HieLvl_SYS] = Cfg_PLATFORM_SHORT_NAME, [HieLvl_SYS] = Cfg_PLATFORM_SHORT_NAME,
[HieLvl_CTY] = Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language], [HieLvl_CTY] = Gbl.Hierarchy.Cty.FullName,
[HieLvl_INS] = Gbl.Hierarchy.Ins.ShrtName, [HieLvl_INS] = Gbl.Hierarchy.Ins.ShrtName,
[HieLvl_CTR] = Gbl.Hierarchy.Ctr.ShrtName, [HieLvl_CTR] = Gbl.Hierarchy.Ctr.ShrtName,
[HieLvl_DEG] = Gbl.Hierarchy.Deg.ShrtName, [HieLvl_DEG] = Gbl.Hierarchy.Deg.ShrtName,
@ -595,7 +595,7 @@ void Hie_InitHierarchy (void)
/***** If country code is available, get country data *****/ /***** If country code is available, get country data *****/
if (Gbl.Hierarchy.Cty.Cod > 0) if (Gbl.Hierarchy.Cty.Cod > 0)
if (!Cty_GetCountryDataByCod (&Gbl.Hierarchy.Cty)) // Country not found if (!Cty_GetBasicCountryDataByCod (&Gbl.Hierarchy.Cty)) // Country not found
Hie_ResetHierarchy (); Hie_ResetHierarchy ();
/***** Set current hierarchy level and code /***** Set current hierarchy level and code

View File

@ -293,7 +293,7 @@ static void Ins_ListInstitutions (void)
/***** Begin box *****/ /***** Begin box *****/
if (asprintf (&Title,Txt_Institutions_of_COUNTRY_X, if (asprintf (&Title,Txt_Institutions_of_COUNTRY_X,
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]) < 0) Gbl.Hierarchy.Cty.FullName) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
Box_BoxBegin (NULL,Title,Ins_PutIconsListingInstitutions,NULL, Box_BoxBegin (NULL,Title,Ins_PutIconsListingInstitutions,NULL,
Hlp_COUNTRY_Institutions,Box_NOT_CLOSABLE); Hlp_COUNTRY_Institutions,Box_NOT_CLOSABLE);
@ -533,7 +533,7 @@ static void Ins_EditInstitutionsInternal (void)
/***** Begin box *****/ /***** Begin box *****/
if (asprintf (&Title,Txt_Institutions_of_COUNTRY_X, if (asprintf (&Title,Txt_Institutions_of_COUNTRY_X,
Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]) < 0) Gbl.Hierarchy.Cty.FullName) < 0)
Err_NotEnoughMemoryExit (); Err_NotEnoughMemoryExit ();
Box_BoxBegin (NULL,Title,Ins_PutIconsEditingInstitutions,NULL, Box_BoxBegin (NULL,Title,Ins_PutIconsEditingInstitutions,NULL,
Hlp_COUNTRY_Institutions,Box_NOT_CLOSABLE); Hlp_COUNTRY_Institutions,Box_NOT_CLOSABLE);

View File

@ -341,7 +341,7 @@ static void InsCfg_Country (bool PrintView,bool PutForm)
CtyInLst->Cod == Gbl.Hierarchy.Cty.Cod ? HTM_OPTION_SELECTED : CtyInLst->Cod == Gbl.Hierarchy.Cty.Cod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED, HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED, HTM_OPTION_ENABLED,
"%s",CtyInLst->Name[Gbl.Prefs.Language]); "%s",CtyInLst->FullName);
} }
HTM_SELECT_End (); HTM_SELECT_End ();
Frm_EndForm (); Frm_EndForm ();
@ -352,13 +352,13 @@ static void InsCfg_Country (bool PrintView,bool PutForm)
{ {
Frm_BeginFormGoTo (ActSeeCtyInf); Frm_BeginFormGoTo (ActSeeCtyInf);
ParCod_PutPar (ParCod_Cty,Gbl.Hierarchy.Cty.Cod); ParCod_PutPar (ParCod_Cty,Gbl.Hierarchy.Cty.Cod);
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]), HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Gbl.Hierarchy.Cty.FullName),
"class=\"BT_LINK\""); "class=\"BT_LINK\"");
Str_FreeGoToTitle (); Str_FreeGoToTitle ();
} }
Cty_DrawCountryMap (&Gbl.Hierarchy.Cty,"COUNTRY_MAP_TINY"); Cty_DrawCountryMap (&Gbl.Hierarchy.Cty,"COUNTRY_MAP_TINY");
HTM_NBSP (); HTM_NBSP ();
HTM_Txt (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]); HTM_Txt (Gbl.Hierarchy.Cty.FullName);
if (!PrintView) if (!PrintView)
{ {
HTM_BUTTON_End (); HTM_BUTTON_End ();
@ -552,7 +552,7 @@ void InsCfg_ChangeInsCty (void)
if (NewCty.Cod != Gbl.Hierarchy.Ins.PrtCod) if (NewCty.Cod != Gbl.Hierarchy.Ins.PrtCod)
{ {
/***** Get data of the country from database *****/ /***** Get data of the country from database *****/
Cty_GetCountryDataByCod (&NewCty); Cty_GetBasicCountryDataByCod (&NewCty);
/***** Check if it already exists an institution with the same name in the new country *****/ /***** Check if it already exists an institution with the same name in the new country *****/
if (Ins_DB_CheckIfInsNameExistsInCty ("ShortName",Gbl.Hierarchy.Ins.ShrtName,-1L,NewCty.Cod)) if (Ins_DB_CheckIfInsNameExistsInCty ("ShortName",Gbl.Hierarchy.Ins.ShrtName,-1L,NewCty.Cod))
@ -576,7 +576,7 @@ void InsCfg_ChangeInsCty (void)
/***** Write message to show the change made *****/ /***** Write message to show the change made *****/
Ale_CreateAlert (Ale_SUCCESS,NULL, Ale_CreateAlert (Ale_SUCCESS,NULL,
Txt_The_country_of_the_institution_X_has_changed_to_Y, Txt_The_country_of_the_institution_X_has_changed_to_Y,
Gbl.Hierarchy.Ins.FullName,NewCty.Name[Gbl.Prefs.Language]); Gbl.Hierarchy.Ins.FullName,NewCty.FullName);
} }
} }
} }

View File

@ -248,8 +248,8 @@ void Log_GetAndShowLastClicks (void)
/* Get country code (row[4]) */ /* Get country code (row[4]) */
Hie.Cty.Cod = Str_ConvertStrCodToLongCod (row[4]); Hie.Cty.Cod = Str_ConvertStrCodToLongCod (row[4]);
Cty_GetCountryName (Hie.Cty.Cod,Gbl.Prefs.Language, Cty_GetCountryNameInLanguage (Hie.Cty.Cod,Gbl.Prefs.Language,
Hie.Cty.Name[Gbl.Prefs.Language]); Hie.Cty.FullName);
/* Get institution code (row[5]), /* Get institution code (row[5]),
center code (row[6]) center code (row[6])
@ -281,7 +281,7 @@ void Log_GetAndShowLastClicks (void)
HTM_TD_Begin ("class=\"LC_CTY %s_%s\"", HTM_TD_Begin ("class=\"LC_CTY %s_%s\"",
ClassRow,The_GetSuffix ()); ClassRow,The_GetSuffix ());
HTM_Txt (Hie.Cty.Name[Gbl.Prefs.Language]); // Country HTM_Txt (Hie.Cty.FullName); // Country
HTM_TD_End (); HTM_TD_End ();
HTM_TD_Begin ("class=\"LC_INS %s_%s\"", HTM_TD_Begin ("class=\"LC_INS %s_%s\"",

View File

@ -1133,7 +1133,7 @@ void Pho_BuildHTMLUsrPhoto (const struct Usr_Data *UsrDat,const char *PhotoURL,
else if (UsrDat->CtyCod > 0) else if (UsrDat->CtyCod > 0)
{ {
/* Get country name */ /* Get country name */
Cty_GetCountryName (UsrDat->CtyCod,Gbl.Prefs.Language,CtyName); Cty_GetCountryNameInLanguage (UsrDat->CtyCod,Gbl.Prefs.Language,CtyName);
/* Write country name */ /* Write country name */
if (asprintf (&Caption.InsCty,"<div class=\"ZOOM_TXT DAT_SMALL_%s\">" if (asprintf (&Caption.InsCty,"<div class=\"ZOOM_TXT DAT_SMALL_%s\">"

View File

@ -3199,9 +3199,9 @@ static void Rec_ShowCountry (struct Usr_Data *UsrDat,bool PutForm)
CtyInLst = &Gbl.Hierarchy.Ctys.Lst[NumCty]; CtyInLst = &Gbl.Hierarchy.Ctys.Lst[NumCty];
HTM_OPTION (HTM_Type_LONG,&CtyInLst->Cod, HTM_OPTION (HTM_Type_LONG,&CtyInLst->Cod,
CtyInLst->Cod == UsrDat->CtyCod ? HTM_OPTION_SELECTED : CtyInLst->Cod == UsrDat->CtyCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED, HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED, HTM_OPTION_ENABLED,
"%s",CtyInLst->Name[Gbl.Prefs.Language]); "%s",CtyInLst->FullName);
} }
HTM_SELECT_End (); HTM_SELECT_End ();
HTM_TD_End (); HTM_TD_End ();
@ -3831,9 +3831,9 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher)
CtyInLst = &Gbl.Hierarchy.Ctys.Lst[NumCty]; CtyInLst = &Gbl.Hierarchy.Ctys.Lst[NumCty];
HTM_OPTION (HTM_Type_LONG,&CtyInLst->Cod, HTM_OPTION (HTM_Type_LONG,&CtyInLst->Cod,
CtyInLst->Cod == Gbl.Usrs.Me.UsrDat.InsCtyCod ? HTM_OPTION_SELECTED : CtyInLst->Cod == Gbl.Usrs.Me.UsrDat.InsCtyCod ? HTM_OPTION_SELECTED :
HTM_OPTION_UNSELECTED, HTM_OPTION_UNSELECTED,
HTM_OPTION_ENABLED, HTM_OPTION_ENABLED,
"%s",CtyInLst->Name[Gbl.Prefs.Language]); "%s",CtyInLst->FullName);
} }
HTM_SELECT_End (); HTM_SELECT_End ();
Frm_EndForm (); Frm_EndForm ();

View File

@ -504,7 +504,7 @@ static void Rep_WriteSectionUsrInfo (void)
Gbl.Usrs.Me.UsrDat.Email); Gbl.Usrs.Me.UsrDat.Email);
/***** User's country *****/ /***** User's country *****/
Cty_GetCountryName (Gbl.Usrs.Me.UsrDat.CtyCod,Gbl.Prefs.Language,CtyName); Cty_GetCountryNameInLanguage (Gbl.Usrs.Me.UsrDat.CtyCod,Gbl.Prefs.Language,CtyName);
fprintf (Rep_File,"<li>%s: %s</li>", fprintf (Rep_File,"<li>%s: %s</li>",
Txt_Country, Txt_Country,
CtyName); CtyName);

View File

@ -67,7 +67,7 @@ void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChan
const char *TxtName[HieLvl_NUM_LEVELS] = const char *TxtName[HieLvl_NUM_LEVELS] =
{ {
[HieLvl_SYS] = Cfg_PLATFORM_SHORT_NAME, [HieLvl_SYS] = Cfg_PLATFORM_SHORT_NAME,
[HieLvl_CTY] = Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language], [HieLvl_CTY] = Gbl.Hierarchy.Cty.FullName,
[HieLvl_INS] = Gbl.Hierarchy.Ins.ShrtName, [HieLvl_INS] = Gbl.Hierarchy.Ins.ShrtName,
[HieLvl_CTR] = Gbl.Hierarchy.Ctr.ShrtName, [HieLvl_CTR] = Gbl.Hierarchy.Ctr.ShrtName,
[HieLvl_DEG] = Gbl.Hierarchy.Deg.ShrtName, [HieLvl_DEG] = Gbl.Hierarchy.Deg.ShrtName,

View File

@ -2968,7 +2968,7 @@ static void Sta_WriteCountry (long CtyCod)
{ {
/***** Get data of country *****/ /***** Get data of country *****/
Cty.Cod = CtyCod; Cty.Cod = CtyCod;
Cty_GetCountryDataByCod (&Cty); Cty_GetBasicCountryDataByCod (&Cty);
/***** Form to go to country *****/ /***** Form to go to country *****/
Cty_DrawCountryMapAndNameWithLink (&Cty,ActSeeCtyInf, Cty_DrawCountryMapAndNameWithLink (&Cty,ActSeeCtyInf,

View File

@ -605,7 +605,7 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys,
HTM_Txt (Cfg_PLATFORM_SHORT_NAME); HTM_Txt (Cfg_PLATFORM_SHORT_NAME);
break; break;
case HieLvl_CTY: // Country case HieLvl_CTY: // Country
HTM_TxtF ("%s&nbsp;%s",Txt_Country,Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]); HTM_TxtF ("%s&nbsp;%s",Txt_Country,Gbl.Hierarchy.Cty.FullName);
break; break;
case HieLvl_INS: // Institution case HieLvl_INS: // Institution
HTM_TxtF ("%s&nbsp;%s",Txt_Institution,Gbl.Hierarchy.Ins.ShrtName); HTM_TxtF ("%s&nbsp;%s",Txt_Institution,Gbl.Hierarchy.Ins.ShrtName);