mirror of https://github.com/acanas/swad-core.git
Version 14.72.6
This commit is contained in:
parent
965a877598
commit
19bbabdef1
|
@ -944,6 +944,36 @@ bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr)
|
||||||
return CtrFound;
|
return CtrFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*********** Get the institution code of a centre from its code **************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
long Ctr_GetInsCodOfCentreByCod (long CtrCod)
|
||||||
|
{
|
||||||
|
char Query[128];
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
MYSQL_ROW row;
|
||||||
|
long InsCod = -1L;
|
||||||
|
|
||||||
|
if (CtrCod > 0)
|
||||||
|
{
|
||||||
|
/***** Get the institution code of a centre from database *****/
|
||||||
|
sprintf (Query,"SELECT InsCod FROM centres WHERE CtrCod ='%ld'",
|
||||||
|
CtrCod);
|
||||||
|
if (DB_QuerySELECT (Query,&mysql_res,"can not get the institution of a centre") == 1)
|
||||||
|
{
|
||||||
|
/***** Get the institution code of this centre *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
CtrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Free structure that stores the query result *****/
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
}
|
||||||
|
|
||||||
|
return InsCod;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/******************* Get photo attribution from database *********************/
|
/******************* Get photo attribution from database *********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -92,6 +92,7 @@ void Ctr_ShowCtrsOfCurrentIns (void);
|
||||||
void Ctr_EditCentres (void);
|
void Ctr_EditCentres (void);
|
||||||
void Ctr_GetListCentres (long InsCod);
|
void Ctr_GetListCentres (long InsCod);
|
||||||
bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr);
|
bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr);
|
||||||
|
long Ctr_GetInsCodOfCentreByCod (long CtrCod);
|
||||||
void Ctr_FreeListCentres (void);
|
void Ctr_FreeListCentres (void);
|
||||||
void Ctr_WriteSelectorOfCentre (Act_Action_t NextAction);
|
void Ctr_WriteSelectorOfCentre (Act_Action_t NextAction);
|
||||||
void Ctr_PutParamCtrCod (long CtrCod);
|
void Ctr_PutParamCtrCod (long CtrCod);
|
||||||
|
|
|
@ -39,11 +39,12 @@
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 14.72.5 (2015/02/01)"
|
#define Log_PLATFORM_VERSION "SWAD 14.72.6 (2015/02/03)"
|
||||||
|
|
||||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
// 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
|
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h | tail -1
|
||||||
/*
|
/*
|
||||||
|
Version 14.72.6: Feb 03, 2015 Changes in icons for degrees and centres. (176883 lines)
|
||||||
Version 14.72.5: Feb 01, 2015 Changed related to administrators. (176805 lines)
|
Version 14.72.5: Feb 01, 2015 Changed related to administrators. (176805 lines)
|
||||||
Version 14.72.4: Feb 01, 2015 Refactoring of registering and removing admins. (176787 lines)
|
Version 14.72.4: Feb 01, 2015 Refactoring of registering and removing admins. (176787 lines)
|
||||||
Version 14.72.3: Feb 01, 2015 Refactoring of registering and removing admins. (177139 lines)
|
Version 14.72.3: Feb 01, 2015 Refactoring of registering and removing admins. (177139 lines)
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
/** Uncomment one of the following installations of SWAD or create your own **/
|
/** Uncomment one of the following installations of SWAD or create your own **/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define LOCALHOST_UBUNTU // 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 OPENSWAD_ORG // Comment this line if not applicable
|
||||||
//#define SWAD_UGR_ES // Comment this line if not applicable
|
//#define SWAD_UGR_ES // Comment this line if not applicable
|
||||||
//#define WWW_CEVUNA_UNA_PY // Comment this line if not applicable
|
//#define WWW_CEVUNA_UNA_PY // Comment this line if not applicable
|
||||||
|
|
||||||
|
|
|
@ -3053,26 +3053,56 @@ void Deg_GetShortNameOfDegreeByCod (struct Degree *Deg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/************* Get the centre code of a degree from its code *****************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
long Deg_GetCtrCodOfDegreeByCod (long DegCod)
|
||||||
|
{
|
||||||
|
char Query[128];
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
MYSQL_ROW row;
|
||||||
|
long CtrCod = -1L;
|
||||||
|
|
||||||
|
if (DegCod > 0)
|
||||||
|
{
|
||||||
|
/***** Get the centre code of a degree from database *****/
|
||||||
|
sprintf (Query,"SELECT CtrCod FROM degrees WHERE DegCod ='%ld'",
|
||||||
|
DegCod);
|
||||||
|
if (DB_QuerySELECT (Query,&mysql_res,"can not get the centre of a degree") == 1)
|
||||||
|
{
|
||||||
|
/***** Get the centre code of this degree *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
CtrCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** Free structure that stores the query result *****/
|
||||||
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CtrCod;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********** Get the institution code of a degree from its code ***************/
|
/********** Get the institution code of a degree from its code ***************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
long Deg_GetInsCodOfDegreeByCod (long DegCod)
|
long Deg_GetInsCodOfDegreeByCod (long DegCod)
|
||||||
{
|
{
|
||||||
char Query[512];
|
char Query[256];
|
||||||
MYSQL_RES *mysql_res;
|
MYSQL_RES *mysql_res;
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
long InsCod = -1L;
|
long InsCod = -1L;
|
||||||
|
|
||||||
if (DegCod > 0)
|
if (DegCod > 0)
|
||||||
{
|
{
|
||||||
/***** Get the short name of a degree from database *****/
|
/***** Get the institution code of a degree from database *****/
|
||||||
sprintf (Query,"SELECT centres.InsCod FROM degrees,centres"
|
sprintf (Query,"SELECT centres.InsCod FROM degrees,centres"
|
||||||
" WHERE degrees.DegCod ='%ld' AND degrees.CtrCod=centres.CtrCod",
|
" WHERE degrees.DegCod ='%ld' AND degrees.CtrCod=centres.CtrCod",
|
||||||
DegCod);
|
DegCod);
|
||||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get the institution of a degree") == 1)
|
if (DB_QuerySELECT (Query,&mysql_res,"can not get the institution of a degree") == 1)
|
||||||
{
|
{
|
||||||
/***** Get the institution of this degree *****/
|
/***** Get the institution code of this degree *****/
|
||||||
row = mysql_fetch_row (mysql_res);
|
row = mysql_fetch_row (mysql_res);
|
||||||
InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,7 @@ unsigned Deg_CountNumDegsInCtr (long CtrCod);
|
||||||
bool Deg_GetDataOfDegreeTypeByCod (struct DegreeType *DegTyp);
|
bool Deg_GetDataOfDegreeTypeByCod (struct DegreeType *DegTyp);
|
||||||
bool Deg_GetDataOfDegreeByCod (struct Degree *Deg);
|
bool Deg_GetDataOfDegreeByCod (struct Degree *Deg);
|
||||||
void Deg_GetShortNameOfDegreeByCod (struct Degree *Deg);
|
void Deg_GetShortNameOfDegreeByCod (struct Degree *Deg);
|
||||||
|
long Deg_GetCtrCodOfDegreeByCod (long DegCod);
|
||||||
long Deg_GetInsCodOfDegreeByCod (long DegCod);
|
long Deg_GetInsCodOfDegreeByCod (long DegCod);
|
||||||
void Deg_RenameDegreeType (void);
|
void Deg_RenameDegreeType (void);
|
||||||
void Deg_RenameDegreeShort (void);
|
void Deg_RenameDegreeShort (void);
|
||||||
|
|
91
swad_logo.c
91
swad_logo.c
|
@ -65,56 +65,81 @@ extern struct Globals Gbl;
|
||||||
void Log_DrawLogo (Sco_Scope_t Scope,long Cod,const char *AltText,
|
void Log_DrawLogo (Sco_Scope_t Scope,long Cod,const char *AltText,
|
||||||
unsigned Size,const char *Style,bool PutIconIfNotExists)
|
unsigned Size,const char *Style,bool PutIconIfNotExists)
|
||||||
{
|
{
|
||||||
const char *Folder;
|
static const char *Icon[Sco_NUM_SCOPES] =
|
||||||
const char *Icon;
|
|
||||||
char PathLogo[PATH_MAX+1];
|
|
||||||
bool LogoExists;
|
|
||||||
|
|
||||||
/***** Set variables depending on scope *****/
|
|
||||||
switch (Scope)
|
|
||||||
{
|
{
|
||||||
case Sco_SCOPE_INS:
|
NULL, // Sco_SCOPE_UNK
|
||||||
Folder = Cfg_FOLDER_INS;
|
NULL, // Sco_SCOPE_SYS
|
||||||
Icon = "ins";
|
NULL, // Sco_SCOPE_CTY
|
||||||
break;
|
Cfg_FOLDER_INS, // Sco_SCOPE_INS
|
||||||
case Sco_SCOPE_CTR:
|
Cfg_FOLDER_CTR, // Sco_SCOPE_CTR
|
||||||
Folder = Cfg_FOLDER_CTR;
|
Cfg_FOLDER_DEG, // Sco_SCOPE_DEG
|
||||||
Icon = "ctr";
|
NULL, // Sco_SCOPE_CRS
|
||||||
break;
|
};
|
||||||
case Sco_SCOPE_DEG:
|
const char *Folder;
|
||||||
Folder = Cfg_FOLDER_DEG;
|
char PathLogo[PATH_MAX+1];
|
||||||
Icon = "deg";
|
bool LogoFound = false;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return; // Nothing to do
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Path to logo *****/
|
/***** Path to logo *****/
|
||||||
if (Cod > 0)
|
if (Cod > 0)
|
||||||
{
|
{
|
||||||
sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png",
|
/* Degree */
|
||||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
if (Scope == Sco_SCOPE_DEG)
|
||||||
(unsigned) (Cod % 100),
|
{
|
||||||
(unsigned) Cod,
|
Folder = Cfg_FOLDER_DEG;
|
||||||
(unsigned) Cod);
|
sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png",
|
||||||
LogoExists = Fil_CheckIfPathExists (PathLogo);
|
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;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Institution */
|
||||||
|
if (!LogoFound || Scope == Sco_SCOPE_INS)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LogoExists = false;
|
LogoFound = false;
|
||||||
|
|
||||||
if (LogoExists || PutIconIfNotExists)
|
if (LogoFound || PutIconIfNotExists)
|
||||||
{
|
{
|
||||||
/***** Draw logo *****/
|
/***** Draw logo *****/
|
||||||
fprintf (Gbl.F.Out,"<img src=\"");
|
fprintf (Gbl.F.Out,"<img src=\"");
|
||||||
if (LogoExists)
|
if (LogoFound)
|
||||||
fprintf (Gbl.F.Out,"%s/%s/%02u/%u/logo/%u.png",
|
fprintf (Gbl.F.Out,"%s/%s/%02u/%u/logo/%u.png",
|
||||||
Cfg_HTTPS_URL_SWAD_PUBLIC,Folder,
|
Cfg_HTTPS_URL_SWAD_PUBLIC,Folder,
|
||||||
(unsigned) (Cod % 100),
|
(unsigned) (Cod % 100),
|
||||||
(unsigned) Cod,
|
(unsigned) Cod,
|
||||||
(unsigned) Cod);
|
(unsigned) Cod);
|
||||||
else
|
else if (Icon[Scope])
|
||||||
fprintf (Gbl.F.Out,"%s/%s64x64.gif",
|
fprintf (Gbl.F.Out,"%s/%s64x64.gif",
|
||||||
Gbl.Prefs.IconsURL,Icon);
|
Gbl.Prefs.IconsURL,Icon[Scope]);
|
||||||
fprintf (Gbl.F.Out,"\" alt=\"%s\" class=\"ICON%ux%u\"",
|
fprintf (Gbl.F.Out,"\" alt=\"%s\" class=\"ICON%ux%u\"",
|
||||||
AltText,Size,Size);
|
AltText,Size,Size);
|
||||||
if (Style)
|
if (Style)
|
||||||
|
|
Loading…
Reference in New Issue