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;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** 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 *********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -92,6 +92,7 @@ void Ctr_ShowCtrsOfCurrentIns (void);
|
|||
void Ctr_EditCentres (void);
|
||||
void Ctr_GetListCentres (long InsCod);
|
||||
bool Ctr_GetDataOfCentreByCod (struct Centre *Ctr);
|
||||
long Ctr_GetInsCodOfCentreByCod (long CtrCod);
|
||||
void Ctr_FreeListCentres (void);
|
||||
void Ctr_WriteSelectorOfCentre (Act_Action_t NextAction);
|
||||
void Ctr_PutParamCtrCod (long CtrCod);
|
||||
|
|
|
@ -39,11 +39,12 @@
|
|||
/****************************** 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:
|
||||
// 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.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)
|
||||
|
|
|
@ -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 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 ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
long Deg_GetInsCodOfDegreeByCod (long DegCod)
|
||||
{
|
||||
char Query[512];
|
||||
char Query[256];
|
||||
MYSQL_RES *mysql_res;
|
||||
MYSQL_ROW row;
|
||||
long InsCod = -1L;
|
||||
|
||||
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"
|
||||
" WHERE degrees.DegCod ='%ld' AND degrees.CtrCod=centres.CtrCod",
|
||||
DegCod);
|
||||
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);
|
||||
InsCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
}
|
||||
|
|
|
@ -139,6 +139,7 @@ unsigned Deg_CountNumDegsInCtr (long CtrCod);
|
|||
bool Deg_GetDataOfDegreeTypeByCod (struct DegreeType *DegTyp);
|
||||
bool Deg_GetDataOfDegreeByCod (struct Degree *Deg);
|
||||
void Deg_GetShortNameOfDegreeByCod (struct Degree *Deg);
|
||||
long Deg_GetCtrCodOfDegreeByCod (long DegCod);
|
||||
long Deg_GetInsCodOfDegreeByCod (long DegCod);
|
||||
void Deg_RenameDegreeType (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,
|
||||
unsigned Size,const char *Style,bool PutIconIfNotExists)
|
||||
{
|
||||
const char *Folder;
|
||||
const char *Icon;
|
||||
char PathLogo[PATH_MAX+1];
|
||||
bool LogoExists;
|
||||
|
||||
/***** Set variables depending on scope *****/
|
||||
switch (Scope)
|
||||
static const char *Icon[Sco_NUM_SCOPES] =
|
||||
{
|
||||
case Sco_SCOPE_INS:
|
||||
Folder = Cfg_FOLDER_INS;
|
||||
Icon = "ins";
|
||||
break;
|
||||
case Sco_SCOPE_CTR:
|
||||
Folder = Cfg_FOLDER_CTR;
|
||||
Icon = "ctr";
|
||||
break;
|
||||
case Sco_SCOPE_DEG:
|
||||
Folder = Cfg_FOLDER_DEG;
|
||||
Icon = "deg";
|
||||
break;
|
||||
default:
|
||||
return; // Nothing to do
|
||||
}
|
||||
NULL, // Sco_SCOPE_UNK
|
||||
NULL, // Sco_SCOPE_SYS
|
||||
NULL, // Sco_SCOPE_CTY
|
||||
Cfg_FOLDER_INS, // Sco_SCOPE_INS
|
||||
Cfg_FOLDER_CTR, // Sco_SCOPE_CTR
|
||||
Cfg_FOLDER_DEG, // Sco_SCOPE_DEG
|
||||
NULL, // Sco_SCOPE_CRS
|
||||
};
|
||||
const char *Folder;
|
||||
char PathLogo[PATH_MAX+1];
|
||||
bool LogoFound = false;
|
||||
|
||||
/***** Path to logo *****/
|
||||
if (Cod > 0)
|
||||
{
|
||||
sprintf (PathLogo,"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_PATH_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod,
|
||||
(unsigned) Cod);
|
||||
LogoExists = Fil_CheckIfPathExists (PathLogo);
|
||||
/* Degree */
|
||||
if (Scope == Sco_SCOPE_DEG)
|
||||
{
|
||||
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;
|
||||
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
|
||||
LogoExists = false;
|
||||
LogoFound = false;
|
||||
|
||||
if (LogoExists || PutIconIfNotExists)
|
||||
if (LogoFound || PutIconIfNotExists)
|
||||
{
|
||||
/***** Draw logo *****/
|
||||
fprintf (Gbl.F.Out,"<img src=\"");
|
||||
if (LogoExists)
|
||||
if (LogoFound)
|
||||
fprintf (Gbl.F.Out,"%s/%s/%02u/%u/logo/%u.png",
|
||||
Cfg_HTTPS_URL_SWAD_PUBLIC,Folder,
|
||||
(unsigned) (Cod % 100),
|
||||
(unsigned) Cod,
|
||||
(unsigned) Cod);
|
||||
else
|
||||
else if (Icon[Scope])
|
||||
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\"",
|
||||
AltText,Size,Size);
|
||||
if (Style)
|
||||
|
|
Loading…
Reference in New Issue