mirror of https://github.com/acanas/swad-core.git
Version 23.9.1: Sep 19, 2023 Code refactoring in hierarchy and admins.
This commit is contained in:
parent
dcb020c9af
commit
95df356512
153
swad_admin.c
153
swad_admin.c
|
@ -58,62 +58,19 @@ extern struct Globals Gbl;
|
|||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Adm_ReqAddAdm (HieLvl_Level_t Level,long Cod,
|
||||
const char *InsCtrDegName);
|
||||
static void Adm_AddAdm (HieLvl_Level_t Level,long Cod,
|
||||
const char *InsCtrDegName);
|
||||
static void Adm_RegisterAdmin (struct Usr_Data *UsrDat,
|
||||
HieLvl_Level_t Level,long Cod,
|
||||
const char *InsCtrDegName);
|
||||
static void Adm_AddAdm (HieLvl_Level_t Level);
|
||||
static void Adm_RegisterAdmin (struct Usr_Data *UsrDat,HieLvl_Level_t Level);
|
||||
|
||||
static void Adm_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,
|
||||
HieLvl_Level_t Level,long Cod,
|
||||
const char *InsCtrDegName);
|
||||
static void Adm_AskIfRemAdm (Usr_MeOrOther_t MeOrOther,HieLvl_Level_t Level,
|
||||
const char *InsCtrDegName);
|
||||
static void Adm_EffectivelyRemAdm (struct Usr_Data *UsrDat,
|
||||
HieLvl_Level_t Level,long Cod,
|
||||
const char *InsCtrDegName);
|
||||
HieLvl_Level_t Level);
|
||||
static void Adm_AskIfRemAdm (Usr_MeOrOther_t MeOrOther,HieLvl_Level_t Level);
|
||||
static void Adm_EffectivelyRemAdm (struct Usr_Data *UsrDat,HieLvl_Level_t Level);
|
||||
|
||||
/*****************************************************************************/
|
||||
/**** Ask if really wanted to add an administrator to current institution ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Adm_ReqAddAdmOfIns (void)
|
||||
{
|
||||
Adm_ReqAddAdm (HieLvl_INS,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].FullName);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****** Ask if really wanted to add an administrator to current center *******/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Adm_ReqAddAdmOfCtr (void)
|
||||
{
|
||||
Adm_ReqAddAdm (HieLvl_CTR,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].FullName);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****** Ask if really wanted to add an administrator to current degree *******/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Adm_ReqAddAdmOfDeg (void)
|
||||
{
|
||||
Adm_ReqAddAdm (HieLvl_DEG,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].FullName);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**** Ask if really wanted to add an administrator to current institution ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Adm_ReqAddAdm (HieLvl_Level_t Level,long Cod,
|
||||
const char *InsCtrDegName)
|
||||
void Adm_ReqAddAdm (HieLvl_Level_t Level)
|
||||
{
|
||||
extern const char *Txt_THE_USER_X_is_already_an_administrator_of_Y;
|
||||
extern const char *Txt_Do_you_really_want_to_register_the_following_user_as_an_administrator_of_X;
|
||||
|
@ -130,7 +87,7 @@ static void Adm_ReqAddAdm (HieLvl_Level_t Level,long Cod,
|
|||
};
|
||||
bool ICanRegister;
|
||||
|
||||
if (Cod > 0)
|
||||
if (Gbl.Hierarchy.Node[Level].Cod > 0)
|
||||
{
|
||||
/***** Get user's identificator of the user to register as admin *****/
|
||||
if (Usr_GetParOtherUsrCodEncryptedAndGetUsrData ())
|
||||
|
@ -141,10 +98,11 @@ static void Adm_ReqAddAdm (HieLvl_Level_t Level,long Cod,
|
|||
(Level == HieLvl_INS && Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM));
|
||||
if (ICanRegister)
|
||||
{
|
||||
if (Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Level,Cod)) // User is already an administrator of current institution/center/degree
|
||||
if (Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Level)) // User is already an administrator of current institution/center/degree
|
||||
{
|
||||
Ale_ShowAlert (Ale_INFO,Txt_THE_USER_X_is_already_an_administrator_of_Y,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,InsCtrDegName);
|
||||
Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Gbl.Hierarchy.Node[Level].FullName);
|
||||
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
}
|
||||
else
|
||||
|
@ -152,7 +110,7 @@ static void Adm_ReqAddAdm (HieLvl_Level_t Level,long Cod,
|
|||
/***** Show question and button to register user as administrator *****/
|
||||
/* Begin alert */
|
||||
Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_register_the_following_user_as_an_administrator_of_X,
|
||||
InsCtrDegName);
|
||||
Gbl.Hierarchy.Node[Level].FullName);
|
||||
|
||||
/* Show user's record */
|
||||
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
|
@ -177,9 +135,7 @@ static void Adm_ReqAddAdm (HieLvl_Level_t Level,long Cod,
|
|||
|
||||
void Adm_AddAdmToIns (void)
|
||||
{
|
||||
Adm_AddAdm (HieLvl_INS,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].FullName);
|
||||
Adm_AddAdm (HieLvl_INS);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -188,9 +144,7 @@ void Adm_AddAdmToIns (void)
|
|||
|
||||
void Adm_AddAdmToCtr (void)
|
||||
{
|
||||
Adm_AddAdm (HieLvl_CTR,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].FullName);
|
||||
Adm_AddAdm (HieLvl_CTR);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -199,9 +153,7 @@ void Adm_AddAdmToCtr (void)
|
|||
|
||||
void Adm_AddAdmToDeg (void)
|
||||
{
|
||||
Adm_AddAdm (HieLvl_DEG,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].FullName);
|
||||
Adm_AddAdm (HieLvl_DEG);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -226,12 +178,11 @@ void Adm_GetAdmsLst (HieLvl_Level_t Level)
|
|||
/******************* Add an administrator in a given level *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Adm_AddAdm (HieLvl_Level_t Level,long Cod,
|
||||
const char *InsCtrDegName)
|
||||
static void Adm_AddAdm (HieLvl_Level_t Level)
|
||||
{
|
||||
bool ICanRegister;
|
||||
|
||||
if (Cod > 0)
|
||||
if (Gbl.Hierarchy.Node[Level].Cod > 0)
|
||||
{
|
||||
/***** Get plain user's ID of the user to add/modify *****/
|
||||
if (Usr_GetParOtherUsrCodEncryptedAndGetUsrData ())
|
||||
|
@ -243,8 +194,7 @@ static void Adm_AddAdm (HieLvl_Level_t Level,long Cod,
|
|||
if (ICanRegister)
|
||||
{
|
||||
/***** Register administrator in current institution/center/degree in database *****/
|
||||
Adm_RegisterAdmin (&Gbl.Usrs.Other.UsrDat,Level,
|
||||
Cod,InsCtrDegName);
|
||||
Adm_RegisterAdmin (&Gbl.Usrs.Other.UsrDat,Level);
|
||||
|
||||
/***** Show user's record *****/
|
||||
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
|
@ -261,24 +211,22 @@ static void Adm_AddAdm (HieLvl_Level_t Level,long Cod,
|
|||
/**************** Register administrator in current institution **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Adm_RegisterAdmin (struct Usr_Data *UsrDat,
|
||||
HieLvl_Level_t Level,long Cod,
|
||||
const char *InsCtrDegName)
|
||||
static void Adm_RegisterAdmin (struct Usr_Data *UsrDat,HieLvl_Level_t Level)
|
||||
{
|
||||
extern const char *Txt_THE_USER_X_is_already_an_administrator_of_Y;
|
||||
extern const char *Txt_THE_USER_X_has_been_enroled_as_administrator_of_Y;
|
||||
|
||||
/***** Check if user was and administrator of current institution/center/degree *****/
|
||||
if (Adm_DB_CheckIfUsrIsAdm (UsrDat->UsrCod,Level,Cod))
|
||||
if (Adm_DB_CheckIfUsrIsAdm (UsrDat->UsrCod,Level))
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_is_already_an_administrator_of_Y,
|
||||
UsrDat->FullName,InsCtrDegName);
|
||||
UsrDat->FullName,Gbl.Hierarchy.Node[Level].FullName);
|
||||
else // User was not administrator of current institution/center/degree
|
||||
{
|
||||
/***** Insert or replace administrator in current institution/center/degree *****/
|
||||
Adm_DB_InsertAdmin (UsrDat->UsrCod,Level,Cod);
|
||||
Adm_DB_InsertAdmin (UsrDat->UsrCod,Level);
|
||||
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_enroled_as_administrator_of_Y,
|
||||
UsrDat->FullName,InsCtrDegName);
|
||||
UsrDat->FullName,Gbl.Hierarchy.Node[Level].FullName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,9 +236,7 @@ static void Adm_RegisterAdmin (struct Usr_Data *UsrDat,
|
|||
|
||||
void Adm_ReqRemAdmOfIns (void)
|
||||
{
|
||||
Adm_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,HieLvl_INS,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].FullName);
|
||||
Adm_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,HieLvl_INS);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -299,9 +245,7 @@ void Adm_ReqRemAdmOfIns (void)
|
|||
|
||||
void Adm_ReqRemAdmOfCtr (void)
|
||||
{
|
||||
Adm_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,HieLvl_CTR,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].FullName);
|
||||
Adm_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,HieLvl_CTR);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -310,9 +254,7 @@ void Adm_ReqRemAdmOfCtr (void)
|
|||
|
||||
void Adm_ReqRemAdmOfDeg (void)
|
||||
{
|
||||
Adm_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,HieLvl_DEG,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].FullName);
|
||||
Adm_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,HieLvl_DEG);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -321,9 +263,7 @@ void Adm_ReqRemAdmOfDeg (void)
|
|||
|
||||
void Adm_RemAdmIns (void)
|
||||
{
|
||||
Adm_ReqRemOrRemAdm (Enr_REMOVE_USR,HieLvl_INS,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].FullName);
|
||||
Adm_ReqRemOrRemAdm (Enr_REMOVE_USR,HieLvl_INS);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -332,9 +272,7 @@ void Adm_RemAdmIns (void)
|
|||
|
||||
void Adm_RemAdmCtr (void)
|
||||
{
|
||||
Adm_ReqRemOrRemAdm (Enr_REMOVE_USR,HieLvl_CTR,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].FullName);
|
||||
Adm_ReqRemOrRemAdm (Enr_REMOVE_USR,HieLvl_CTR);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -343,9 +281,7 @@ void Adm_RemAdmCtr (void)
|
|||
|
||||
void Adm_RemAdmDeg (void)
|
||||
{
|
||||
Adm_ReqRemOrRemAdm (Enr_REMOVE_USR,HieLvl_DEG,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].FullName);
|
||||
Adm_ReqRemOrRemAdm (Enr_REMOVE_USR,HieLvl_DEG);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -353,14 +289,13 @@ void Adm_RemAdmDeg (void)
|
|||
/*****************************************************************************/
|
||||
|
||||
static void Adm_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,
|
||||
HieLvl_Level_t Level,long Cod,
|
||||
const char *InsCtrDegName)
|
||||
HieLvl_Level_t Level)
|
||||
{
|
||||
extern const char *Txt_THE_USER_X_is_not_an_administrator_of_Y;
|
||||
Usr_MeOrOther_t MeOrOther;
|
||||
bool ICanRemove;
|
||||
|
||||
if (Cod > 0)
|
||||
if (Gbl.Hierarchy.Node[Level].Cod > 0)
|
||||
{
|
||||
/***** Get user to be removed *****/
|
||||
if (Usr_GetParOtherUsrCodEncryptedAndGetUsrData ())
|
||||
|
@ -374,22 +309,22 @@ static void Adm_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,
|
|||
if (ICanRemove)
|
||||
{
|
||||
/* Check if the other user is an admin of the current institution/center/degree */
|
||||
if (Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Level,Cod))
|
||||
if (Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Level))
|
||||
{ // The other user is an administrator of current institution/center/degree ==> ask for removing or remove her/him
|
||||
switch (ReqDelOrDelUsr)
|
||||
{
|
||||
case Enr_REQUEST_REMOVE_USR: // Ask if remove administrator from current institution
|
||||
Adm_AskIfRemAdm (MeOrOther,Level,InsCtrDegName);
|
||||
Adm_AskIfRemAdm (MeOrOther,Level);
|
||||
break;
|
||||
case Enr_REMOVE_USR: // Remove administrator from current institution
|
||||
Adm_EffectivelyRemAdm (&Gbl.Usrs.Other.UsrDat,Level,
|
||||
Cod,InsCtrDegName);
|
||||
Adm_EffectivelyRemAdm (&Gbl.Usrs.Other.UsrDat,Level);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // The other user is not an administrator of current institution
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_THE_USER_X_is_not_an_administrator_of_Y,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,InsCtrDegName);
|
||||
Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Gbl.Hierarchy.Node[Level].FullName);
|
||||
}
|
||||
else
|
||||
Ale_ShowAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
|
@ -403,8 +338,7 @@ static void Adm_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,
|
|||
/** Ask if really wanted to remove an administrator from current institution */
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Adm_AskIfRemAdm (Usr_MeOrOther_t MeOrOther,HieLvl_Level_t Level,
|
||||
const char *InsCtrDegName)
|
||||
static void Adm_AskIfRemAdm (Usr_MeOrOther_t MeOrOther,HieLvl_Level_t Level)
|
||||
{
|
||||
extern const char *Txt_Do_you_really_want_to_be_removed_as_an_administrator_of_X;
|
||||
extern const char *Txt_Do_you_really_want_to_remove_the_following_user_as_an_administrator_of_X;
|
||||
|
@ -435,7 +369,8 @@ static void Adm_AskIfRemAdm (Usr_MeOrOther_t MeOrOther,HieLvl_Level_t Level,
|
|||
{
|
||||
/***** Show question and button to remove user as administrator *****/
|
||||
/* Begin alert */
|
||||
Ale_ShowAlertAndButton1 (Ale_QUESTION,Question[MeOrOther],InsCtrDegName);
|
||||
Ale_ShowAlertAndButton1 (Ale_QUESTION,Question[MeOrOther],
|
||||
Gbl.Hierarchy.Node[Level].FullName);
|
||||
|
||||
/* Show user's record */
|
||||
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
|
@ -453,22 +388,20 @@ static void Adm_AskIfRemAdm (Usr_MeOrOther_t MeOrOther,HieLvl_Level_t Level,
|
|||
/**** Remove an administrator from current institution, center or degree *****/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Adm_EffectivelyRemAdm (struct Usr_Data *UsrDat,
|
||||
HieLvl_Level_t Level,long Cod,
|
||||
const char *InsCtrDegName)
|
||||
static void Adm_EffectivelyRemAdm (struct Usr_Data *UsrDat,HieLvl_Level_t Level)
|
||||
{
|
||||
extern const char *Txt_THE_USER_X_has_been_removed_as_administrator_of_Y;
|
||||
extern const char *Txt_THE_USER_X_is_not_an_administrator_of_Y;
|
||||
|
||||
if (Adm_DB_CheckIfUsrIsAdm (UsrDat->UsrCod,Level,Cod)) // User is administrator of current institution/center/degree
|
||||
if (Adm_DB_CheckIfUsrIsAdm (UsrDat->UsrCod,Level)) // User is administrator of current institution/center/degree
|
||||
{
|
||||
/***** Remove user as administrator of institution, center or degree *****/
|
||||
Adm_DB_RemAdmin (UsrDat->UsrCod,Level,Cod);
|
||||
Adm_DB_RemAdmin (UsrDat->UsrCod,Level);
|
||||
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_removed_as_administrator_of_Y,
|
||||
UsrDat->FullName,InsCtrDegName);
|
||||
UsrDat->FullName,Gbl.Hierarchy.Node[Level].FullName);
|
||||
}
|
||||
else // User is not an administrator of the current institution/center/degree
|
||||
Ale_ShowAlert (Ale_ERROR,Txt_THE_USER_X_is_not_an_administrator_of_Y,
|
||||
UsrDat->FullName,InsCtrDegName);
|
||||
UsrDat->FullName,Gbl.Hierarchy.Node[Level].FullName);
|
||||
}
|
||||
|
|
|
@ -35,9 +35,7 @@
|
|||
/****************************** Public prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Adm_ReqAddAdmOfIns (void);
|
||||
void Adm_ReqAddAdmOfCtr (void);
|
||||
void Adm_ReqAddAdmOfDeg (void);
|
||||
void Adm_ReqAddAdm (HieLvl_Level_t Level);
|
||||
|
||||
void Adm_AddAdmToIns (void);
|
||||
void Adm_AddAdmToCtr (void);
|
||||
|
|
|
@ -41,7 +41,7 @@ extern struct Globals Gbl;
|
|||
/** Insert/replace user as administrator of an institution, center or degree */
|
||||
/*****************************************************************************/
|
||||
|
||||
void Adm_DB_InsertAdmin (long UsrCod,HieLvl_Level_t Level,long Cod)
|
||||
void Adm_DB_InsertAdmin (long UsrCod,HieLvl_Level_t Level)
|
||||
{
|
||||
DB_QueryREPLACE ("can not create administrator",
|
||||
"REPLACE INTO usr_admins"
|
||||
|
@ -50,7 +50,7 @@ void Adm_DB_InsertAdmin (long UsrCod,HieLvl_Level_t Level,long Cod)
|
|||
" (%ld,'%s',%ld)",
|
||||
UsrCod,
|
||||
Hie_GetDBStrFromLevel (Level),
|
||||
Cod);
|
||||
Gbl.Hierarchy.Node[Level].Cod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -79,7 +79,7 @@ unsigned Adm_DB_GetAdmsCurrentScopeExceptMe (MYSQL_RES **mysql_res)
|
|||
/***** Check if a user is an administrator of a degree/center/institution ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Adm_DB_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Level,long Cod)
|
||||
bool Adm_DB_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Level)
|
||||
{
|
||||
return
|
||||
DB_QueryEXISTS ("can not check if a user is administrator",
|
||||
|
@ -91,7 +91,7 @@ bool Adm_DB_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Level,long Cod)
|
|||
" AND Cod=%ld)",
|
||||
UsrCod,
|
||||
Hie_GetDBStrFromLevel (Level),
|
||||
Cod);
|
||||
Gbl.Hierarchy.Node[Level].Cod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -115,7 +115,7 @@ bool Adm_DB_CheckIfUsrIsSuperuser (long UsrCod)
|
|||
/***** Remove user as administrator of an institution, center or degree ******/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Adm_DB_RemAdmin (long UsrCod,HieLvl_Level_t Level,long Cod)
|
||||
void Adm_DB_RemAdmin (long UsrCod,HieLvl_Level_t Level)
|
||||
{
|
||||
DB_QueryDELETE ("can not remove an administrator",
|
||||
"DELETE FROM usr_admins"
|
||||
|
@ -124,7 +124,7 @@ void Adm_DB_RemAdmin (long UsrCod,HieLvl_Level_t Level,long Cod)
|
|||
" AND Cod=%ld",
|
||||
UsrCod,
|
||||
Hie_GetDBStrFromLevel (Level),
|
||||
Cod);
|
||||
Gbl.Hierarchy.Node[Level].Cod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -143,12 +143,12 @@ void Adm_DB_RemUsrAsAdmin (long UsrCod)
|
|||
/********* Remove administrators of an institution, center or degree *********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Adm_DB_RemAdmins (HieLvl_Level_t Level,long Cod)
|
||||
void Adm_DB_RemAdmins (HieLvl_Level_t Level)
|
||||
{
|
||||
DB_QueryDELETE ("can not remove administrators",
|
||||
"DELETE FROM usr_admins"
|
||||
" WHERE Scope='%s'"
|
||||
" AND Cod=%ld",
|
||||
Hie_GetDBStrFromLevel (Level),
|
||||
Cod);
|
||||
Gbl.Hierarchy.Node[Level].Cod);
|
||||
}
|
||||
|
|
|
@ -33,14 +33,14 @@
|
|||
/****************************** Public prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Adm_DB_InsertAdmin (long UsrCod,HieLvl_Level_t Level,long Cod);
|
||||
void Adm_DB_InsertAdmin (long UsrCod,HieLvl_Level_t Level);
|
||||
|
||||
unsigned Adm_DB_GetAdmsCurrentScopeExceptMe (MYSQL_RES **mysql_res);
|
||||
bool Adm_DB_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Level,long Cod);
|
||||
bool Adm_DB_CheckIfUsrIsAdm (long UsrCod,HieLvl_Level_t Level);
|
||||
bool Adm_DB_CheckIfUsrIsSuperuser (long UsrCod);
|
||||
|
||||
void Adm_DB_RemAdmin (long UsrCod,HieLvl_Level_t Level,long Cod);
|
||||
void Adm_DB_RemAdmin (long UsrCod,HieLvl_Level_t Level);
|
||||
void Adm_DB_RemUsrAsAdmin (long UsrCod);
|
||||
void Adm_DB_RemAdmins (HieLvl_Level_t Level,long Cod);
|
||||
void Adm_DB_RemAdmins (HieLvl_Level_t Level);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -632,10 +632,12 @@ TODO: Francisco Javier Fern
|
|||
Me sale este error, no sé 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')
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.8 (2023-09-18)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.9.1 (2023-09-19)"
|
||||
#define CSS_FILE "swad22.120.4.css"
|
||||
#define JS_FILE "swad22.49.js"
|
||||
/*
|
||||
Version 23.9.1: Sep 19, 2023 Code refactoring in hierarchy and admins. (337521 lines)
|
||||
Version 23.9: Sep 19, 2023 Code refactoring in hierarchy. (337589 lines)
|
||||
Version 23.8: Sep 18, 2023 Code refactoring in hierarchy. (337625 lines)
|
||||
Version 23.7: Sep 18, 2023 Code refactoring in hierarchy. (337610 lines)
|
||||
Version 23.6.1: Sep 18, 2023 Code refactoring in hierarchy. (337727 lines)
|
||||
|
|
|
@ -643,7 +643,7 @@ void Crs_WriteSelectorOfCourse (void)
|
|||
/***** Initial disabled option *****/
|
||||
HTM_OPTION (HTM_Type_STRING,"",
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].Cod < 0 ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_DISABLED,
|
||||
"[%s]",Txt_Course);
|
||||
|
||||
|
@ -666,7 +666,7 @@ void Crs_WriteSelectorOfCourse (void)
|
|||
HTM_OPTION (HTM_Type_LONG,&CrsCod,
|
||||
Gbl.Hierarchy.Level == HieLvl_CRS && // Course selected
|
||||
CrsCod == Gbl.Hierarchy.Node[HieLvl_CRS].Cod ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s",row[1]); // Short name (row[1])
|
||||
}
|
||||
|
@ -807,7 +807,7 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void)
|
|||
|
||||
HTM_OPTION (HTM_Type_LONG,&CrsCod,
|
||||
CrsCod == Gbl.Hierarchy.Node[HieLvl_CRS].Cod ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s",CrsShortName);
|
||||
}
|
||||
|
@ -1043,7 +1043,8 @@ static void Crs_EditCoursesInternal (void)
|
|||
Hie_WriteMenuHierarchy ();
|
||||
|
||||
/***** Begin box *****/
|
||||
if (asprintf (&Title,Txt_Courses_of_DEGREE_X,Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName) < 0)
|
||||
if (asprintf (&Title,Txt_Courses_of_DEGREE_X,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
Box_BoxBegin (NULL,Title,Crs_PutIconsEditingCourses,NULL,
|
||||
Hlp_DEGREE_Courses,Box_NOT_CLOSABLE);
|
||||
|
@ -2385,7 +2386,7 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
|
|||
ClassTxt = NumUsrs ? "DAT_STRONG" :
|
||||
"DAT";
|
||||
BgColor = (CrsCod == Gbl.Hierarchy.Node[HieLvl_CRS].Cod) ? "BG_HIGHLIGHT" :
|
||||
The_GetColorRows ();
|
||||
The_GetColorRows ();
|
||||
|
||||
/***** Begin row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
|
|
@ -197,8 +197,8 @@ void CrsCfg_PrintConfiguration (void)
|
|||
static void CrsCfg_Title (bool PutLink)
|
||||
{
|
||||
HieCfg_Title (PutLink,
|
||||
HieLvl_DEG, // Logo scope
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod, // Logo code
|
||||
HieLvl_DEG, // Logo scope
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod, // Logo code
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName, // Logo short name
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].FullName, // Logo full name
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].WWW, // Logo www
|
||||
|
@ -244,7 +244,7 @@ static void CrsCfg_Degree (bool PrintView,bool PutForm)
|
|||
DegInLst = &Gbl.Hierarchy.List[HieLvl_CTR].Lst[NumDeg];
|
||||
HTM_OPTION (HTM_Type_LONG,&DegInLst->Cod,
|
||||
DegInLst->Cod == Gbl.Hierarchy.Node[HieLvl_DEG].Cod ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s",DegInLst->ShrtName);
|
||||
}
|
||||
|
@ -264,7 +264,9 @@ static void CrsCfg_Degree (bool PrintView,bool PutForm)
|
|||
"class=\"LT BT_LINK\"");
|
||||
Str_FreeGoToTitle ();
|
||||
}
|
||||
Lgo_DrawLogo (HieLvl_DEG,Gbl.Hierarchy.Node[HieLvl_DEG].Cod,Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName,
|
||||
Lgo_DrawLogo (HieLvl_DEG,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName,
|
||||
20,"LM");
|
||||
HTM_NBSP ();
|
||||
HTM_Txt (Gbl.Hierarchy.Node[HieLvl_DEG].FullName);
|
||||
|
@ -297,7 +299,8 @@ static void CrsCfg_FullName (bool PutForm)
|
|||
|
||||
static void CrsCfg_ShrtName (bool PutForm)
|
||||
{
|
||||
HieCfg_ShrtName (PutForm,ActRenCrsShoCfg,Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
|
||||
HieCfg_ShrtName (PutForm,ActRenCrsShoCfg,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -333,7 +336,7 @@ static void CrsCfg_Year (bool PutForm)
|
|||
Year++)
|
||||
HTM_OPTION (HTM_Type_UNSIGNED,&Year,
|
||||
Year == Gbl.Hierarchy.Node[HieLvl_CRS].Specific.Year ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s",Txt_YEAR_OF_DEGREE[Year]);
|
||||
HTM_SELECT_End ();
|
||||
|
@ -341,7 +344,7 @@ static void CrsCfg_Year (bool PutForm)
|
|||
}
|
||||
else
|
||||
HTM_Txt (Gbl.Hierarchy.Node[HieLvl_CRS].Specific.Year ? Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Node[HieLvl_CRS].Specific.Year] :
|
||||
Txt_Not_applicable);
|
||||
Txt_Not_applicable);
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
|
|
@ -152,7 +152,7 @@ void Deg_SeeDegWithPendingCrss (void)
|
|||
/* Get degree code (row[0]) */
|
||||
Deg.Cod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
BgColor = (Deg.Cod == Gbl.Hierarchy.Node[HieLvl_DEG].Cod) ? "BG_HIGHLIGHT" :
|
||||
The_GetColorRows ();
|
||||
The_GetColorRows ();
|
||||
|
||||
/* Get data of degree */
|
||||
Deg_GetDegreeDataByCod (&Deg);
|
||||
|
@ -241,7 +241,7 @@ void Deg_WriteSelectorOfDegree (void)
|
|||
The_GetSuffix ());
|
||||
HTM_OPTION (HTM_Type_STRING,"",
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod <= 0 ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_DISABLED,
|
||||
"[%s]",Txt_Degree);
|
||||
|
||||
|
@ -266,7 +266,7 @@ void Deg_WriteSelectorOfDegree (void)
|
|||
HTM_OPTION (HTM_Type_LONG,&DegCod,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod > 0 &&
|
||||
DegCod == Gbl.Hierarchy.Node[HieLvl_DEG].Cod ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s",row[1]);
|
||||
}
|
||||
|
@ -715,7 +715,8 @@ static void Deg_ListDegrees (void)
|
|||
unsigned NumDeg;
|
||||
|
||||
/***** Begin box *****/
|
||||
if (asprintf (&Title,Txt_Degrees_of_CENTER_X,Gbl.Hierarchy.Node[HieLvl_CTR].ShrtName) < 0)
|
||||
if (asprintf (&Title,Txt_Degrees_of_CENTER_X,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].ShrtName) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
Box_BoxBegin (NULL,Title,Deg_PutIconsListingDegrees,NULL,
|
||||
Hlp_CENTER_Degrees,Box_NOT_CLOSABLE);
|
||||
|
@ -804,7 +805,7 @@ static void Deg_ListOneDegreeForSeeing (struct Hie_Node *Deg,unsigned NumDeg)
|
|||
TxtClassStrong = "DAT_STRONG";
|
||||
}
|
||||
BgColor = (Deg->Cod == Gbl.Hierarchy.Node[HieLvl_DEG].Cod) ? "BG_HIGHLIGHT" :
|
||||
The_GetColorRows ();
|
||||
The_GetColorRows ();
|
||||
|
||||
/***** Begin table row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
@ -892,7 +893,8 @@ static void Deg_EditDegreesInternal (void)
|
|||
Hie_WriteMenuHierarchy ();
|
||||
|
||||
/***** Begin box *****/
|
||||
if (asprintf (&Title,Txt_Degrees_of_CENTER_X,Gbl.Hierarchy.Node[HieLvl_CTR].ShrtName) < 0)
|
||||
if (asprintf (&Title,Txt_Degrees_of_CENTER_X,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].ShrtName) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
Box_BoxBegin (NULL,Title,Deg_PutIconsEditingDegrees,NULL,
|
||||
Hlp_CENTER_Degrees,Box_NOT_CLOSABLE);
|
||||
|
|
|
@ -192,10 +192,10 @@ static void DegCfg_PutIconsToPrintAndUpload (__attribute__((unused)) void *Args)
|
|||
static void DegCfg_Title (bool PutLink)
|
||||
{
|
||||
HieCfg_Title (PutLink,
|
||||
HieLvl_DEG, // Logo scope
|
||||
HieLvl_DEG, // Logo scope
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod, // Logo code
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName, // Logo short name
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].FullName, // Logo full name
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName, // Logo short name
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].FullName, // Logo full name
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].WWW, // Logo www
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].FullName); // Text full name
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ static void DegCfg_Center (bool PrintView,bool PutForm)
|
|||
CtrInLst = &Gbl.Hierarchy.List[HieLvl_INS].Lst[NumCtr];
|
||||
HTM_OPTION (HTM_Type_LONG,&CtrInLst->Cod,
|
||||
CtrInLst->Cod == Gbl.Hierarchy.Node[HieLvl_CTR].Cod ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s",CtrInLst->ShrtName);
|
||||
}
|
||||
|
@ -259,7 +259,9 @@ static void DegCfg_Center (bool PrintView,bool PutForm)
|
|||
"class=\"LB BT_LINK\"");
|
||||
Str_FreeGoToTitle ();
|
||||
}
|
||||
Lgo_DrawLogo (HieLvl_CTR,Gbl.Hierarchy.Node[HieLvl_CTR].Cod,Gbl.Hierarchy.Node[HieLvl_CTR].ShrtName,
|
||||
Lgo_DrawLogo (HieLvl_CTR,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].ShrtName,
|
||||
20,"LM");
|
||||
HTM_NBSP ();
|
||||
HTM_Txt (Gbl.Hierarchy.Node[HieLvl_CTR].FullName);
|
||||
|
@ -292,7 +294,8 @@ static void DegCfg_FullName (bool PutForm)
|
|||
|
||||
static void DegCfg_ShrtName (bool PutForm)
|
||||
{
|
||||
HieCfg_ShrtName (PutForm,ActRenDegShoCfg,Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName);
|
||||
HieCfg_ShrtName (PutForm,ActRenDegShoCfg,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -343,7 +346,8 @@ static void DegCfg_NumCrss (void)
|
|||
HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ());
|
||||
Frm_BeginFormGoTo (ActSeeCrs);
|
||||
ParCod_PutPar (ParCod_Deg,Gbl.Hierarchy.Node[HieLvl_DEG].Cod);
|
||||
if (asprintf (&Title,Txt_Courses_of_DEGREE_X,Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName) < 0)
|
||||
if (asprintf (&Title,Txt_Courses_of_DEGREE_X,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
HTM_BUTTON_Submit_Begin (Title,"class=\"LB BT_LINK\"");
|
||||
free (Title);
|
||||
|
@ -435,7 +439,8 @@ void DegCfg_ChangeDegWWW (void)
|
|||
{
|
||||
/***** Update the table changing old WWW by new WWW *****/
|
||||
Deg_DB_UpdateDegWWW (Gbl.Hierarchy.Node[HieLvl_DEG].Cod,NewWWW);
|
||||
Str_Copy (Gbl.Hierarchy.Node[HieLvl_DEG].WWW,NewWWW,sizeof (Gbl.Hierarchy.Node[HieLvl_DEG].WWW) - 1);
|
||||
Str_Copy (Gbl.Hierarchy.Node[HieLvl_DEG].WWW,NewWWW,
|
||||
sizeof (Gbl.Hierarchy.Node[HieLvl_DEG].WWW) - 1);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_new_web_address_is_X,
|
||||
|
|
|
@ -325,7 +325,7 @@ static void DegTyp_ListDegreeTypesForSeeing (const struct DegTyp_DegTypes *DegTy
|
|||
{
|
||||
BgColor = (DegTypes->Lst[NumDegTyp].DegTypCod ==
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Specific.TypCod) ? "BG_HIGHLIGHT" :
|
||||
The_GetColorRows ();
|
||||
The_GetColorRows ();
|
||||
|
||||
/* Begin table row */
|
||||
HTM_TR_Begin (NULL);
|
||||
|
|
|
@ -1325,21 +1325,18 @@ bool Enr_PutActionsRegRemOneUsr (Usr_MeOrOther_t MeOrOther)
|
|||
{
|
||||
/***** Check if the other user is administrator of the current institution *****/
|
||||
UsrIsInsAdmin = Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
HieLvl_INS,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod);
|
||||
HieLvl_INS);
|
||||
|
||||
if (Gbl.Hierarchy.Node[HieLvl_CTR].Cod > 0)
|
||||
{
|
||||
/***** Check if the other user is administrator of the current center *****/
|
||||
UsrIsCtrAdmin = Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
HieLvl_CTR,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].Cod);
|
||||
HieLvl_CTR);
|
||||
|
||||
if (Gbl.Hierarchy.Node[HieLvl_DEG].Cod > 0)
|
||||
/***** Check if the other user is administrator of the current degree *****/
|
||||
UsrIsDegAdmin = Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
HieLvl_DEG,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod);
|
||||
HieLvl_DEG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1471,7 +1468,7 @@ static void Enr_PutActionRegOneDegAdm (bool *OptionChecked)
|
|||
{
|
||||
extern const char *Txt_Register_USER_as_an_administrator_of_the_degree_X;
|
||||
|
||||
Enr_RegRemOneUsrActionBegin (Enr_REGISTER_ONE_DEGREE_ADMIN,OptionChecked);
|
||||
Enr_RegRemOneUsrActionBegin (Enr_REGISTER_ONE_DEG_ADMIN,OptionChecked);
|
||||
HTM_TxtF (Txt_Register_USER_as_an_administrator_of_the_degree_X,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName);
|
||||
Enr_RegRemOneUsrActionEnd ();
|
||||
|
@ -1485,7 +1482,7 @@ static void Enr_PutActionRegOneCtrAdm (bool *OptionChecked)
|
|||
{
|
||||
extern const char *Txt_Register_USER_as_an_administrator_of_the_center_X;
|
||||
|
||||
Enr_RegRemOneUsrActionBegin (Enr_REGISTER_ONE_CENTER_ADMIN,OptionChecked);
|
||||
Enr_RegRemOneUsrActionBegin (Enr_REGISTER_ONE_CTR_ADMIN,OptionChecked);
|
||||
HTM_TxtF (Txt_Register_USER_as_an_administrator_of_the_center_X,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].ShrtName);
|
||||
Enr_RegRemOneUsrActionEnd ();
|
||||
|
@ -1499,7 +1496,7 @@ static void Enr_PutActionRegOneInsAdm (bool *OptionChecked)
|
|||
{
|
||||
extern const char *Txt_Register_USER_as_an_administrator_of_the_institution_X;
|
||||
|
||||
Enr_RegRemOneUsrActionBegin (Enr_REGISTER_ONE_INSTITUTION_ADMIN,OptionChecked);
|
||||
Enr_RegRemOneUsrActionBegin (Enr_REGISTER_ONE_INS_ADMIN,OptionChecked);
|
||||
HTM_TxtF (Txt_Register_USER_as_an_administrator_of_the_institution_X,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].ShrtName);
|
||||
Enr_RegRemOneUsrActionEnd ();
|
||||
|
@ -1551,7 +1548,7 @@ static void Enr_PutActionRemUsrAsDegAdm (bool *OptionChecked,Usr_MeOrOther_t MeO
|
|||
[Usr_OTHER] = Txt_Remove_USER_as_an_administrator_of_the_degree_X,
|
||||
};
|
||||
|
||||
Enr_RegRemOneUsrActionBegin (Enr_REMOVE_ONE_DEGREE_ADMIN,OptionChecked);
|
||||
Enr_RegRemOneUsrActionBegin (Enr_REMOVE_ONE_DEG_ADMIN,OptionChecked);
|
||||
HTM_TxtF (Txt[MeOrOther],Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName);
|
||||
Enr_RegRemOneUsrActionEnd ();
|
||||
}
|
||||
|
@ -1570,7 +1567,7 @@ static void Enr_PutActionRemUsrAsCtrAdm (bool *OptionChecked,Usr_MeOrOther_t MeO
|
|||
[Usr_OTHER] = Txt_Remove_USER_as_an_administrator_of_the_center_X,
|
||||
};
|
||||
|
||||
Enr_RegRemOneUsrActionBegin (Enr_REMOVE_ONE_CENTER_ADMIN,OptionChecked);
|
||||
Enr_RegRemOneUsrActionBegin (Enr_REMOVE_ONE_CTR_ADMIN,OptionChecked);
|
||||
HTM_TxtF (Txt[MeOrOther],Gbl.Hierarchy.Node[HieLvl_CTR].ShrtName);
|
||||
Enr_RegRemOneUsrActionEnd ();
|
||||
}
|
||||
|
@ -1589,7 +1586,7 @@ static void Enr_PutActionRemUsrAsInsAdm (bool *OptionChecked,Usr_MeOrOther_t MeO
|
|||
[Usr_OTHER] = Txt_Remove_USER_as_an_administrator_of_the_institution_X,
|
||||
};
|
||||
|
||||
Enr_RegRemOneUsrActionBegin (Enr_REMOVE_ONE_INSTITUTION_ADMIN,OptionChecked);
|
||||
Enr_RegRemOneUsrActionBegin (Enr_REMOVE_ONE_INS_ADMIN,OptionChecked);
|
||||
HTM_TxtF (Txt[MeOrOther],Gbl.Hierarchy.Node[HieLvl_INS].ShrtName);
|
||||
Enr_RegRemOneUsrActionEnd ();
|
||||
}
|
||||
|
@ -2019,13 +2016,14 @@ void Enr_RejectSignUp (void)
|
|||
{
|
||||
/* User already belongs to this course */
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_THE_USER_X_is_already_enroled_in_the_course_Y,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,Gbl.Hierarchy.Node[HieLvl_CRS].FullName);
|
||||
Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].FullName);
|
||||
Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat);
|
||||
}
|
||||
|
||||
/* Remove inscription request */
|
||||
Enr_RemUsrEnrolmentRequestInCrs (Gbl.Usrs.Other.UsrDat.UsrCod,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
|
||||
|
||||
/* Confirmation message */
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Enrolment_of_X_rejected,
|
||||
|
@ -2623,10 +2621,12 @@ static void Enr_ShowFormToEditOtherUsr (void)
|
|||
Gbl.Usrs.Other.UsrDat.Accepted = Enr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
||||
if (Gbl.Usrs.Other.UsrDat.Accepted)
|
||||
Ale_ShowAlert (Ale_INFO,Txt_THE_USER_X_is_already_enroled_in_the_course_Y,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,Gbl.Hierarchy.Node[HieLvl_CRS].FullName);
|
||||
Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].FullName);
|
||||
else // Enrolment not yet accepted
|
||||
Ale_ShowAlert (Ale_INFO,Txt_THE_USER_X_is_in_the_course_Y_but_has_not_yet_accepted_the_enrolment,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,Gbl.Hierarchy.Node[HieLvl_CRS].FullName);
|
||||
Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].FullName);
|
||||
|
||||
Rec_ShowOtherSharedRecordEditable ();
|
||||
}
|
||||
|
@ -2634,7 +2634,8 @@ static void Enr_ShowFormToEditOtherUsr (void)
|
|||
{
|
||||
Ale_ShowAlert (Ale_INFO,Txt_THE_USER_X_exists_in_Y_but_is_not_enroled_in_the_course_Z,
|
||||
Gbl.Usrs.Other.UsrDat.FullName,
|
||||
Cfg_PLATFORM_SHORT_NAME,Gbl.Hierarchy.Node[HieLvl_CRS].FullName);
|
||||
Cfg_PLATFORM_SHORT_NAME,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].FullName);
|
||||
|
||||
Rec_ShowOtherSharedRecordEditable ();
|
||||
}
|
||||
|
@ -2969,15 +2970,15 @@ void Enr_ModifyUsr1 (void)
|
|||
else
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REGISTER_ONE_DEGREE_ADMIN:
|
||||
case Enr_REGISTER_ONE_DEG_ADMIN:
|
||||
if (Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REGISTER_ONE_CENTER_ADMIN:
|
||||
case Enr_REGISTER_ONE_CTR_ADMIN:
|
||||
if (Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REGISTER_ONE_INSTITUTION_ADMIN:
|
||||
case Enr_REGISTER_ONE_INS_ADMIN:
|
||||
if (Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
|
@ -2989,15 +2990,15 @@ void Enr_ModifyUsr1 (void)
|
|||
if (MeOrOther == Usr_OTHER && Gbl.Usrs.Me.Role.Logged < Rol_TCH)
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REMOVE_ONE_DEGREE_ADMIN:
|
||||
case Enr_REMOVE_ONE_DEG_ADMIN:
|
||||
if (MeOrOther == Usr_OTHER && Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REMOVE_ONE_CENTER_ADMIN:
|
||||
case Enr_REMOVE_ONE_CTR_ADMIN:
|
||||
if (MeOrOther == Usr_OTHER && Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
case Enr_REMOVE_ONE_INSTITUTION_ADMIN:
|
||||
case Enr_REMOVE_ONE_INS_ADMIN:
|
||||
if (MeOrOther == Usr_OTHER && Gbl.Usrs.Me.Role.Logged != Rol_SYS_ADM)
|
||||
Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission ();
|
||||
break;
|
||||
|
@ -3034,14 +3035,14 @@ void Enr_ModifyUsr2 (void)
|
|||
/***** Show form to edit user again *****/
|
||||
Enr_ShowFormToEditOtherUsr ();
|
||||
break;
|
||||
case Enr_REGISTER_ONE_DEGREE_ADMIN:
|
||||
Adm_ReqAddAdmOfDeg ();
|
||||
case Enr_REGISTER_ONE_DEG_ADMIN:
|
||||
Adm_ReqAddAdm (HieLvl_DEG);
|
||||
break;
|
||||
case Enr_REGISTER_ONE_CENTER_ADMIN:
|
||||
Adm_ReqAddAdmOfCtr ();
|
||||
case Enr_REGISTER_ONE_CTR_ADMIN:
|
||||
Adm_ReqAddAdm (HieLvl_CTR);
|
||||
break;
|
||||
case Enr_REGISTER_ONE_INSTITUTION_ADMIN:
|
||||
Adm_ReqAddAdmOfIns ();
|
||||
case Enr_REGISTER_ONE_INS_ADMIN:
|
||||
Adm_ReqAddAdm (HieLvl_INS);
|
||||
break;
|
||||
case Enr_REPORT_USR_AS_POSSIBLE_DUPLICATE:
|
||||
Dup_ReportUsrAsPossibleDuplicate ();
|
||||
|
@ -3049,13 +3050,13 @@ void Enr_ModifyUsr2 (void)
|
|||
case Enr_REMOVE_ONE_USR_FROM_CRS:
|
||||
Enr_ReqRemUsrFromCrs ();
|
||||
break;
|
||||
case Enr_REMOVE_ONE_DEGREE_ADMIN:
|
||||
case Enr_REMOVE_ONE_DEG_ADMIN:
|
||||
Adm_ReqRemAdmOfDeg ();
|
||||
break;
|
||||
case Enr_REMOVE_ONE_CENTER_ADMIN:
|
||||
case Enr_REMOVE_ONE_CTR_ADMIN:
|
||||
Adm_ReqRemAdmOfCtr ();
|
||||
break;
|
||||
case Enr_REMOVE_ONE_INSTITUTION_ADMIN:
|
||||
case Enr_REMOVE_ONE_INS_ADMIN:
|
||||
Adm_ReqRemAdmOfIns ();
|
||||
break;
|
||||
case Enr_ELIMINATE_ONE_USR_FROM_PLATFORM:
|
||||
|
@ -3100,7 +3101,8 @@ static void Enr_AskIfRemoveUsrFromCrs (struct Usr_Data *UsrDat)
|
|||
|
||||
/***** Show question and button to remove user as administrator *****/
|
||||
/* Begin alert */
|
||||
Ale_ShowAlertAndButton1 (Ale_QUESTION,Question[MeOrOther],Gbl.Hierarchy.Node[HieLvl_CRS].FullName);
|
||||
Ale_ShowAlertAndButton1 (Ale_QUESTION,Question[MeOrOther],
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].FullName);
|
||||
|
||||
/* Show user's record */
|
||||
Rec_ShowSharedRecordUnmodifiable (UsrDat);
|
||||
|
|
|
@ -52,14 +52,14 @@ typedef enum
|
|||
{
|
||||
Enr_REG_REM_ONE_USR_UNKNOWN_ACTION = 0,
|
||||
Enr_REGISTER_MODIFY_ONE_USR_IN_CRS = 1,
|
||||
Enr_REGISTER_ONE_DEGREE_ADMIN = 2,
|
||||
Enr_REGISTER_ONE_CENTER_ADMIN = 3,
|
||||
Enr_REGISTER_ONE_INSTITUTION_ADMIN = 4,
|
||||
Enr_REGISTER_ONE_DEG_ADMIN = 2,
|
||||
Enr_REGISTER_ONE_CTR_ADMIN = 3,
|
||||
Enr_REGISTER_ONE_INS_ADMIN = 4,
|
||||
Enr_REPORT_USR_AS_POSSIBLE_DUPLICATE = 5,
|
||||
Enr_REMOVE_ONE_USR_FROM_CRS = 6,
|
||||
Enr_REMOVE_ONE_DEGREE_ADMIN = 7,
|
||||
Enr_REMOVE_ONE_CENTER_ADMIN = 8,
|
||||
Enr_REMOVE_ONE_INSTITUTION_ADMIN = 9,
|
||||
Enr_REMOVE_ONE_DEG_ADMIN = 7,
|
||||
Enr_REMOVE_ONE_CTR_ADMIN = 8,
|
||||
Enr_REMOVE_ONE_INS_ADMIN = 9,
|
||||
Enr_ELIMINATE_ONE_USR_FROM_PLATFORM = 10,
|
||||
} Enr_RegRemOneUsrAction_t;
|
||||
|
||||
|
|
|
@ -603,7 +603,8 @@ static void ExaSes_GetAndWriteNamesOfGrpsAssociatedToSession (const struct ExaSe
|
|||
}
|
||||
}
|
||||
else
|
||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
|
||||
HTM_TxtF ("%s %s",Txt_The_whole_course,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
|
||||
|
||||
HTM_DIV_End ();
|
||||
|
||||
|
@ -1037,7 +1038,8 @@ static void ExaSes_ShowLstGrpsToCreateSession (long SesCod)
|
|||
"SesCod",
|
||||
SesCod) ? "" :
|
||||
" checked=\"checked\"");
|
||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
|
||||
HTM_TxtF ("%s %s",Txt_The_whole_course,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
|
||||
HTM_LABEL_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
|
|
53
swad_form.c
53
swad_form.c
|
@ -172,9 +172,18 @@ void Frm_BeginFormNoAction (void)
|
|||
}
|
||||
}
|
||||
|
||||
void Frm_SetParsForm (char ParsStr[Frm_MAX_BYTES_PARAMS_STR + 1],Act_Action_t NextAction,
|
||||
void Frm_SetParsForm (char ParsStr[Frm_MAX_BYTES_PARAMS_STR + 1],
|
||||
Act_Action_t NextAction,
|
||||
bool PutParLocationIfNoSession)
|
||||
{
|
||||
static const char *ParName[HieLvl_NUM_LEVELS] =
|
||||
{
|
||||
[HieLvl_CTY] = "cty",
|
||||
[HieLvl_INS] = "ins",
|
||||
[HieLvl_CTR] = "ctr",
|
||||
[HieLvl_DEG] = "deg",
|
||||
[HieLvl_CRS] = "crs",
|
||||
};
|
||||
char ParAction[Frm_MAX_BYTES_PARAM_ACTION + 1];
|
||||
char ParSession[Frm_MAX_BYTES_PARAM_SESSION + 1];
|
||||
char ParLocation[Frm_MAX_BYTES_PARAM_LOCATION + 1];
|
||||
|
@ -193,43 +202,15 @@ void Frm_SetParsForm (char ParsStr[Frm_MAX_BYTES_PARAMS_STR + 1],Act_Action_t Ne
|
|||
snprintf (ParSession,sizeof (ParSession),
|
||||
"<input type=\"hidden\" name=\"ses\" value=\"%s\" />",
|
||||
Gbl.Session.Id);
|
||||
else if (PutParLocationIfNoSession)
|
||||
else if (PutParLocationIfNoSession && Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].Cod > 0)
|
||||
// Extra parameters necessary when there's no open session
|
||||
{
|
||||
/* If session is open, course code will be get from session data,
|
||||
/* If session is open, course/degree/... code will be get from session data,
|
||||
but if there is not an open session, and next action is known,
|
||||
it is necessary to send a parameter with course code */
|
||||
switch (Gbl.Hierarchy.Level)
|
||||
{
|
||||
case HieLvl_CTY: // Country
|
||||
snprintf (ParLocation,sizeof (ParLocation),
|
||||
"<input type=\"hidden\" name=\"cty\" value=\"%ld\" />",
|
||||
Gbl.Hierarchy.Node[HieLvl_CTY].Cod);
|
||||
break;
|
||||
case HieLvl_INS: // Institution
|
||||
snprintf (ParLocation,sizeof (ParLocation),
|
||||
"<input type=\"hidden\" name=\"ins\" value=\"%ld\" />",
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod);
|
||||
break;
|
||||
case HieLvl_CTR: // Center
|
||||
snprintf (ParLocation,sizeof (ParLocation),
|
||||
"<input type=\"hidden\" name=\"ctr\" value=\"%ld\" />",
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].Cod);
|
||||
break;
|
||||
case HieLvl_DEG: // Degree
|
||||
snprintf (ParLocation,sizeof (ParLocation),
|
||||
"<input type=\"hidden\" name=\"deg\" value=\"%ld\" />",
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod);
|
||||
break;
|
||||
case HieLvl_CRS: // Course
|
||||
snprintf (ParLocation,sizeof (ParLocation),
|
||||
"<input type=\"hidden\" name=\"crs\" value=\"%ld\" />",
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
it is necessary to send a parameter with course/degree/... code */
|
||||
snprintf (ParLocation,sizeof (ParLocation),
|
||||
"<input type=\"hidden\" name=\"%s\" value=\"%ld\" />",
|
||||
ParName[Gbl.Hierarchy.Level],
|
||||
Gbl.Hierarchy.Node[Gbl.Hierarchy.Level].Cod);
|
||||
}
|
||||
|
||||
snprintf (ParsStr,Frm_MAX_BYTES_PARAMS_STR + 1,"%s%s%s",
|
||||
|
|
|
@ -62,7 +62,8 @@ void Frm_BeginFormAnchorOnSubmit (Act_Action_t NextAction,const char *Anchor,con
|
|||
void Frm_BeginFormId (Act_Action_t NextAction,const char *Id);
|
||||
void Frm_BeginFormAnchor (Act_Action_t NextAction,const char *Anchor);
|
||||
void Frm_BeginFormNoAction (void);
|
||||
void Frm_SetParsForm (char ParsStr[Frm_MAX_BYTES_PARAMS_STR + 1],Act_Action_t NextAction,
|
||||
void Frm_SetParsForm (char ParsStr[Frm_MAX_BYTES_PARAMS_STR + 1],
|
||||
Act_Action_t NextAction,
|
||||
bool PutParLocationIfNoSession);
|
||||
void Frm_EndForm (void);
|
||||
|
||||
|
|
51
swad_forum.c
51
swad_forum.c
|
@ -2455,39 +2455,34 @@ void For_ShowThreadPosts (void)
|
|||
|
||||
void For_GetParsForums (struct For_Forums *Forums)
|
||||
{
|
||||
static HieLvl_Level_t Level[For_NUM_TYPES_FORUM] =
|
||||
{
|
||||
[For_FORUM_COURSE_USRS] = HieLvl_CRS,
|
||||
[For_FORUM_COURSE_TCHS] = HieLvl_CRS,
|
||||
[For_FORUM_DEGREE_USRS] = HieLvl_DEG,
|
||||
[For_FORUM_DEGREE_TCHS] = HieLvl_DEG,
|
||||
[For_FORUM_CENTER_USRS] = HieLvl_CTR,
|
||||
[For_FORUM_CENTER_TCHS] = HieLvl_CTR,
|
||||
[For_FORUM_INSTIT_USRS] = HieLvl_INS,
|
||||
[For_FORUM_INSTIT_TCHS] = HieLvl_INS,
|
||||
[For_FORUM_GLOBAL_USRS] = HieLvl_SYS,
|
||||
[For_FORUM_GLOBAL_TCHS] = HieLvl_SYS,
|
||||
[For_FORUM__SWAD__USRS] = HieLvl_SYS,
|
||||
[For_FORUM__SWAD__TCHS] = HieLvl_SYS,
|
||||
[For_FORUM_UNKNOWN ] = HieLvl_SYS,
|
||||
};
|
||||
|
||||
/***** Set forum type *****/
|
||||
For_SetForumType (Forums);
|
||||
|
||||
/***** Get parameter with code of institution, center, degree or course *****/
|
||||
switch (Forums->Forum.Type)
|
||||
if (Level[Forums->Forum.Type] == HieLvl_SYS)
|
||||
Forums->Forum.HieCod = -1L;
|
||||
else
|
||||
{
|
||||
case For_FORUM_INSTIT_USRS:
|
||||
case For_FORUM_INSTIT_TCHS:
|
||||
if ((Forums->Forum.HieCod = ParCod_GetPar (ParCod_OthHie)) <= 0)
|
||||
// If no institution specified ==> go to current institution forum
|
||||
Forums->Forum.HieCod = Gbl.Hierarchy.Node[HieLvl_INS].Cod;
|
||||
break;
|
||||
case For_FORUM_CENTER_USRS:
|
||||
case For_FORUM_CENTER_TCHS:
|
||||
if ((Forums->Forum.HieCod = ParCod_GetPar (ParCod_OthHie)) <= 0)
|
||||
// If no center specified ==> go to current center forum
|
||||
Forums->Forum.HieCod = Gbl.Hierarchy.Node[HieLvl_CTR].Cod;
|
||||
break;
|
||||
case For_FORUM_DEGREE_USRS:
|
||||
case For_FORUM_DEGREE_TCHS:
|
||||
if ((Forums->Forum.HieCod = ParCod_GetPar (ParCod_OthHie)) <= 0)
|
||||
// If no degree specified ==> go to current degree forum
|
||||
Forums->Forum.HieCod = Gbl.Hierarchy.Node[HieLvl_DEG].Cod;
|
||||
break;
|
||||
case For_FORUM_COURSE_USRS:
|
||||
case For_FORUM_COURSE_TCHS:
|
||||
if ((Forums->Forum.HieCod = ParCod_GetPar (ParCod_OthHie)) <= 0)
|
||||
// If no course specified ==> go to current course forum
|
||||
Forums->Forum.HieCod = Gbl.Hierarchy.Node[HieLvl_CRS].Cod;
|
||||
break;
|
||||
default:
|
||||
Forums->Forum.HieCod = -1L;
|
||||
break;
|
||||
if ((Forums->Forum.HieCod = ParCod_GetPar (ParCod_OthHie)) <= 0)
|
||||
// If no institution specified ==> go to current institution forum
|
||||
Forums->Forum.HieCod = Gbl.Hierarchy.Node[Level[Forums->Forum.Type]].Cod;
|
||||
}
|
||||
|
||||
/***** Get which forums I want to see *****/
|
||||
|
|
|
@ -164,34 +164,6 @@ void Gbl_InitializeGlobals (void)
|
|||
/***** Reset current hierarchy *****/
|
||||
Hie_ResetHierarchy ();
|
||||
|
||||
Gbl.Hierarchy.List[HieLvl_SYS].Num = 0;
|
||||
Gbl.Hierarchy.List[HieLvl_SYS].Lst = NULL;
|
||||
Gbl.Hierarchy.List[HieLvl_SYS].SelectedOrder = Hie_ORDER_DEFAULT;
|
||||
|
||||
Gbl.Hierarchy.List[HieLvl_CTY].Num = 0;
|
||||
Gbl.Hierarchy.List[HieLvl_CTY].Lst = NULL;
|
||||
Gbl.Hierarchy.List[HieLvl_CTY].SelectedOrder = Hie_ORDER_DEFAULT;
|
||||
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].ShrtName[0] = '\0';
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].FullName[0] = '\0';
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].WWW[0] = '\0';
|
||||
|
||||
Gbl.Hierarchy.List[HieLvl_INS].Num = 0;
|
||||
Gbl.Hierarchy.List[HieLvl_INS].Lst = NULL;
|
||||
Gbl.Hierarchy.List[HieLvl_INS].SelectedOrder = Hie_ORDER_DEFAULT;
|
||||
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].ShrtName[0] = '\0';
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].FullName[0] = '\0';
|
||||
|
||||
Gbl.Hierarchy.List[HieLvl_CTR].Num = 0;
|
||||
Gbl.Hierarchy.List[HieLvl_CTR].Lst = NULL;
|
||||
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].ShrtName[0] =
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].FullName[0] = '\0';
|
||||
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName[0] =
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].FullName[0] = '\0';
|
||||
|
||||
Gbl.Crs.Info.ShowMsgMustBeRead = 0;
|
||||
|
||||
Gbl.Crs.Notices.HighlightNotCod = -1L; // No notice highlighted
|
||||
|
|
|
@ -197,7 +197,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
{
|
||||
/* Select a degree */
|
||||
if (asprintf (&Description,Gbl.Hierarchy.Node[HieLvl_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.Node[HieLvl_CTR].ShrtName) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Description,
|
||||
|
@ -209,7 +209,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
{
|
||||
/* Select a center */
|
||||
if (asprintf (&Description,Gbl.Hierarchy.Node[HieLvl_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.Node[HieLvl_INS].ShrtName) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Description,
|
||||
|
@ -221,7 +221,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
{
|
||||
/* Select an institution */
|
||||
if (asprintf (&Description,Gbl.Hierarchy.Node[HieLvl_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.Node[HieLvl_CTY].FullName) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Description,
|
||||
|
@ -232,7 +232,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
else
|
||||
/* Select a country */
|
||||
Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Hierarchy.Node[HieLvl_CTY].Cod > 0 ? Txt_Select_another_country :
|
||||
Txt_Select_one_country,
|
||||
Txt_Select_one_country,
|
||||
ActSeeCty,
|
||||
Btn_CONFIRM_BUTTON,Txt_Countries);
|
||||
|
||||
|
|
|
@ -402,7 +402,7 @@ void Hie_WriteHierarchyInBreadcrumb (void)
|
|||
HTM_DIV_Begin ("class=\"BC%s BC_%s\"",
|
||||
(Gbl.Hierarchy.Level == HieLvl_CRS) ? "" :
|
||||
((Gbl.Hierarchy.Node[HieLvl_DEG].Cod > 0) ? " BC_SEMIOFF" :
|
||||
" BC_OFF"),
|
||||
" BC_OFF"),
|
||||
The_GetSuffix ());
|
||||
|
||||
/***** Separator *****/
|
||||
|
@ -522,27 +522,8 @@ void Hie_SetHierarchyFromUsrLastHierarchy (void)
|
|||
/***** Initialize all codes to -1 *****/
|
||||
Hie_ResetHierarchy ();
|
||||
|
||||
/***** Copy last hierarchy scope and code to current hierarchy *****/
|
||||
switch (Gbl.Usrs.Me.UsrLast.LastHie.Level)
|
||||
{
|
||||
case HieLvl_CTY: // Country
|
||||
Gbl.Hierarchy.Node[HieLvl_CTY].Cod = Gbl.Usrs.Me.UsrLast.LastHie.HieCod;
|
||||
break;
|
||||
case HieLvl_INS: // Institution
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod = Gbl.Usrs.Me.UsrLast.LastHie.HieCod;
|
||||
break;
|
||||
case HieLvl_CTR: // Center
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].Cod = Gbl.Usrs.Me.UsrLast.LastHie.HieCod;
|
||||
break;
|
||||
case HieLvl_DEG: // Degree
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod = Gbl.Usrs.Me.UsrLast.LastHie.HieCod;
|
||||
break;
|
||||
case HieLvl_CRS: // Course
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].Cod = Gbl.Usrs.Me.UsrLast.LastHie.HieCod;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/***** Copy last hierarchy code to current hierarchy *****/
|
||||
Gbl.Hierarchy.Node[Gbl.Usrs.Me.UsrLast.LastHie.Level].Cod = Gbl.Usrs.Me.UsrLast.LastHie.HieCod;
|
||||
|
||||
/****** Initialize again current course, degree, center... ******/
|
||||
Hie_InitHierarchy ();
|
||||
|
@ -660,26 +641,28 @@ void Hie_InitHierarchy (void)
|
|||
|
||||
void Hie_ResetHierarchy (void)
|
||||
{
|
||||
/***** Country *****/
|
||||
Gbl.Hierarchy.Node[HieLvl_CTY].Cod = -1L;
|
||||
|
||||
/***** Institution *****/
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod = -1L;
|
||||
|
||||
/***** Center *****/
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].Cod = -1L;
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].PrtCod = -1L;
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].Specific.PlcCod = -1L;
|
||||
|
||||
/***** Degree *****/
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod = -1L;
|
||||
|
||||
/***** Course *****/
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].Cod = -1L;
|
||||
HieLvl_Level_t Level;
|
||||
|
||||
/***** Hierarchy level and code *****/
|
||||
Gbl.Hierarchy.Level = HieLvl_UNK;
|
||||
Gbl.Hierarchy.Cod = -1L;
|
||||
|
||||
for (Level = (HieLvl_Level_t) 0;
|
||||
Level <= (HieLvl_Level_t) HieLvl_NUM_LEVELS - 1;
|
||||
Level++)
|
||||
{
|
||||
Gbl.Hierarchy.List[Level].Num = 0;
|
||||
Gbl.Hierarchy.List[Level].Lst = NULL;
|
||||
Gbl.Hierarchy.List[Level].SelectedOrder = Hie_ORDER_DEFAULT;
|
||||
Gbl.Hierarchy.Node[Level].Cod = -1L;
|
||||
Gbl.Hierarchy.Node[Level].PrtCod = -1L;
|
||||
Gbl.Hierarchy.Node[Level].ShrtName[0] =
|
||||
Gbl.Hierarchy.Node[Level].FullName[0] = '\0';
|
||||
Gbl.Hierarchy.Node[Level].WWW[0] = '\0';
|
||||
}
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].Specific.PlcCod = -1L;
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Specific.TypCod = -1L;
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].Specific.Year = 0;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -73,7 +73,7 @@ struct Hie_Node
|
|||
{
|
||||
long Cod; // Course/degree/center/institution/country code
|
||||
long PrtCod; // Parent code
|
||||
union
|
||||
struct
|
||||
{
|
||||
long PlcCod; // Center place code
|
||||
long TypCod; // Degree type code
|
||||
|
|
|
@ -169,11 +169,11 @@ void Ind_ReqIndicatorsCourses (void)
|
|||
The_GetSuffix ()) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
Dpt_WriteSelectorDepartment (Gbl.Hierarchy.Node[HieLvl_INS].Cod, // Departments in current insitution
|
||||
Indicators.DptCod, // Selected department
|
||||
Par_CodeStr[ParCod_Dpt], // Parameter name
|
||||
SelectClass, // Selector class
|
||||
-1L, // First option
|
||||
Txt_Any_department, // Text when no department selected
|
||||
Indicators.DptCod, // Selected department
|
||||
Par_CodeStr[ParCod_Dpt], // Parameter name
|
||||
SelectClass, // Selector class
|
||||
-1L, // First option
|
||||
Txt_Any_department, // Text when no department selected
|
||||
HTM_SUBMIT_ON_CHANGE);
|
||||
free (SelectClass);
|
||||
HTM_TD_End ();
|
||||
|
|
20
swad_info.c
20
swad_info.c
|
@ -1437,7 +1437,10 @@ static bool Inf_CheckAndShowPlainTxt (void)
|
|||
|
||||
if (Gbl.Crs.Info.Type == Inf_INTRODUCTION ||
|
||||
Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE)
|
||||
Lay_WriteHeaderClassPhoto (false,false,Gbl.Hierarchy.Node[HieLvl_INS].Cod,Gbl.Hierarchy.Node[HieLvl_DEG].Cod,Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
|
||||
Lay_WriteHeaderClassPhoto (false,false,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
|
||||
|
||||
HTM_DIV_Begin ("class=\"LM DAT_%s\"",The_GetSuffix ());
|
||||
|
||||
|
@ -1527,7 +1530,10 @@ static bool Inf_CheckAndShowRichTxt (void)
|
|||
|
||||
if (Gbl.Crs.Info.Type == Inf_INTRODUCTION ||
|
||||
Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE)
|
||||
Lay_WriteHeaderClassPhoto (false,false,Gbl.Hierarchy.Node[HieLvl_INS].Cod,Gbl.Hierarchy.Node[HieLvl_DEG].Cod,Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
|
||||
Lay_WriteHeaderClassPhoto (false,false,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
|
||||
|
||||
HTM_DIV_Begin ("id=\"crs_info\" class=\"LM CRS_INFO_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -1660,7 +1666,10 @@ void Inf_EditPlainTxtInfo (void)
|
|||
|
||||
if (Gbl.Crs.Info.Type == Inf_INTRODUCTION ||
|
||||
Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE)
|
||||
Lay_WriteHeaderClassPhoto (false,false,Gbl.Hierarchy.Node[HieLvl_INS].Cod,Gbl.Hierarchy.Node[HieLvl_DEG].Cod,Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
|
||||
Lay_WriteHeaderClassPhoto (false,false,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
|
||||
|
||||
/***** Get info text from database *****/
|
||||
Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Node[HieLvl_CRS].Cod,Gbl.Crs.Info.Type,
|
||||
|
@ -1728,7 +1737,10 @@ void Inf_EditRichTxtInfo (void)
|
|||
|
||||
if (Gbl.Crs.Info.Type == Inf_INTRODUCTION ||
|
||||
Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE)
|
||||
Lay_WriteHeaderClassPhoto (false,false,Gbl.Hierarchy.Node[HieLvl_INS].Cod,Gbl.Hierarchy.Node[HieLvl_DEG].Cod,Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
|
||||
Lay_WriteHeaderClassPhoto (false,false,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
|
||||
|
||||
/***** Get info text from database *****/
|
||||
Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Node[HieLvl_CRS].Cod,Gbl.Crs.Info.Type,
|
||||
|
|
|
@ -169,7 +169,7 @@ void Ins_SeeInsWithPendingCtrs (void)
|
|||
/* Get institution code (row[0]) */
|
||||
Ins.Cod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
BgColor = (Ins.Cod == Gbl.Hierarchy.Node[HieLvl_INS].Cod) ? "BG_HIGHLIGHT" :
|
||||
The_GetColorRows ();
|
||||
The_GetColorRows ();
|
||||
|
||||
/* Get data of institution */
|
||||
Ins_GetInstitDataByCod (&Ins);
|
||||
|
@ -366,7 +366,7 @@ static void Ins_ListOneInstitutionForSeeing (struct Hie_Node *Ins,unsigned NumIn
|
|||
TxtClassStrong = "DAT_STRONG";
|
||||
}
|
||||
BgColor = (Ins->Cod == Gbl.Hierarchy.Node[HieLvl_INS].Cod) ? "BG_HIGHLIGHT" :
|
||||
The_GetColorRows ();
|
||||
The_GetColorRows ();
|
||||
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
|
@ -567,7 +567,7 @@ void Ins_GetBasicListOfInstitutions (long CtyCod)
|
|||
{
|
||||
/***** Create list with institutions *****/
|
||||
if ((Gbl.Hierarchy.List[HieLvl_CTY].Lst = calloc ((size_t) Gbl.Hierarchy.List[HieLvl_CTY].Num,
|
||||
sizeof (*Gbl.Hierarchy.List[HieLvl_CTY].Lst))) == NULL)
|
||||
sizeof (*Gbl.Hierarchy.List[HieLvl_CTY].Lst))) == NULL)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
|
||||
/***** Get the institutions *****/
|
||||
|
@ -600,7 +600,7 @@ void Ins_GetFullListOfInstitutions (long CtyCod)
|
|||
{
|
||||
/***** Create list with institutions *****/
|
||||
if ((Gbl.Hierarchy.List[HieLvl_CTY].Lst = calloc ((size_t) Gbl.Hierarchy.List[HieLvl_CTY].Num,
|
||||
sizeof (*Gbl.Hierarchy.List[HieLvl_CTY].Lst))) == NULL)
|
||||
sizeof (*Gbl.Hierarchy.List[HieLvl_CTY].Lst))) == NULL)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
|
||||
/***** Get the institutions *****/
|
||||
|
@ -832,7 +832,7 @@ void Ins_WriteSelectorOfInstitution (void)
|
|||
|
||||
HTM_OPTION (HTM_Type_STRING,"",
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod < 0 ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_DISABLED,
|
||||
"[%s]",Txt_Institution);
|
||||
|
||||
|
@ -857,7 +857,7 @@ void Ins_WriteSelectorOfInstitution (void)
|
|||
HTM_OPTION (HTM_Type_LONG,&InsCod,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod > 0 &&
|
||||
InsCod == Gbl.Hierarchy.Node[HieLvl_INS].Cod ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s",row[1]);
|
||||
}
|
||||
|
@ -1531,12 +1531,12 @@ static void Ins_ReceiveFormRequestOrCreateIns (Hie_Status_t Status)
|
|||
{
|
||||
/***** If name of institution was in database... *****/
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty ("ShortName",Ins_EditingIns->ShrtName,
|
||||
-1L,Gbl.Hierarchy.Node[HieLvl_CTY].Cod))
|
||||
-1L,Gbl.Hierarchy.Node[HieLvl_CTY].Cod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Ins_EditingIns->ShrtName);
|
||||
else if (Ins_DB_CheckIfInsNameExistsInCty ("FullName",Ins_EditingIns->FullName,
|
||||
-1L,Gbl.Hierarchy.Node[HieLvl_CTY].Cod))
|
||||
-1L,Gbl.Hierarchy.Node[HieLvl_CTY].Cod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Ins_EditingIns->FullName);
|
||||
|
|
|
@ -229,10 +229,10 @@ static void InsCfg_PutIconsToPrintAndUpload (__attribute__((unused)) void *Args)
|
|||
static void InsCfg_Title (bool PutLink)
|
||||
{
|
||||
HieCfg_Title (PutLink,
|
||||
HieLvl_INS, // Logo scope
|
||||
HieLvl_INS, // Logo scope
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod, // Logo code
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].ShrtName, // Logo short name
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].FullName, // Logo full name
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].ShrtName, // Logo short name
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].FullName, // Logo full name
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].WWW, // Logo www
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].FullName); // Text full name
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ static void InsCfg_Country (bool PrintView,bool PutForm)
|
|||
CtyInLst = &Gbl.Hierarchy.List[HieLvl_SYS].Lst[NumCty];
|
||||
HTM_OPTION (HTM_Type_LONG,&CtyInLst->Cod,
|
||||
CtyInLst->Cod == Gbl.Hierarchy.Node[HieLvl_CTY].Cod ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s",CtyInLst->FullName);
|
||||
}
|
||||
|
|
|
@ -822,22 +822,22 @@ static Act_Action_t Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
|||
if (CrsCod > 0) // Course specified
|
||||
{
|
||||
if (CrsCod != Gbl.Hierarchy.Node[HieLvl_CRS].Cod) // Not the current course
|
||||
ParCod_PutPar (ParCod_Crs,CrsCod); // Go to another course
|
||||
ParCod_PutPar (ParCod_Crs,CrsCod); // Go to another course
|
||||
}
|
||||
else if (DegCod > 0) // Degree specified
|
||||
{
|
||||
if (DegCod != Gbl.Hierarchy.Node[HieLvl_DEG].Cod) // Not the current degree
|
||||
ParCod_PutPar (ParCod_Deg,DegCod); // Go to another degree
|
||||
ParCod_PutPar (ParCod_Deg,DegCod); // Go to another degree
|
||||
}
|
||||
else if (CtrCod > 0) // Center specified
|
||||
{
|
||||
if (CtrCod != Gbl.Hierarchy.Node[HieLvl_CTR].Cod) // Not the current center
|
||||
ParCod_PutPar (ParCod_Ctr,CtrCod); // Go to another center
|
||||
ParCod_PutPar (ParCod_Ctr,CtrCod); // Go to another center
|
||||
}
|
||||
else if (InsCod > 0) // Institution specified
|
||||
{
|
||||
if (InsCod != Gbl.Hierarchy.Node[HieLvl_INS].Cod) // Not the current institution
|
||||
ParCod_PutPar (ParCod_Ins,InsCod); // Go to another institution
|
||||
ParCod_PutPar (ParCod_Ins,InsCod); // Go to another institution
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,8 @@ void Prg_ShowAllItems (Prg_ListingType_t ListingType,
|
|||
}
|
||||
|
||||
/***** Begin box *****/
|
||||
if (asprintf (&Title,Txt_COURSE_program,Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName) < 0)
|
||||
if (asprintf (&Title,Txt_COURSE_program,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
Box_BoxBegin ("100%",Title,
|
||||
FunctionToDrawContextualIcons[ListingType],NULL,
|
||||
|
|
|
@ -3771,9 +3771,9 @@ static void Prj_PutFormProject (struct Prj_Projects *Projects,
|
|||
The_GetSuffix ()) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
Dpt_WriteSelectorDepartment (Gbl.Hierarchy.Node[HieLvl_INS].Cod, // Departments in current institution
|
||||
Projects->Prj.DptCod, // Selected department
|
||||
Projects->Prj.DptCod, // Selected department
|
||||
Par_CodeStr[ParCod_Dpt], // Parameter name
|
||||
SelectClass, // Selector class
|
||||
SelectClass, // Selector class
|
||||
0, // First option
|
||||
Txt_Another_department, // Text when no department selected
|
||||
HTM_DONT_SUBMIT_ON_CHANGE);
|
||||
|
|
|
@ -109,19 +109,16 @@ void Rol_SetMyRoles (void)
|
|||
{
|
||||
/* Check if I am and administrator of current institution */
|
||||
ICanBeAdm[HieLvl_INS] = Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
HieLvl_INS,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod);
|
||||
HieLvl_INS);
|
||||
if (Gbl.Hierarchy.Node[HieLvl_CTR].Cod > 0)
|
||||
{
|
||||
/* Check if I am and administrator of current center */
|
||||
ICanBeAdm[HieLvl_CTR] = Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
HieLvl_CTR,
|
||||
Gbl.Hierarchy.Node[HieLvl_CTR].Cod);
|
||||
HieLvl_CTR);
|
||||
if (Gbl.Hierarchy.Node[HieLvl_DEG].Cod > 0)
|
||||
/* Check if I am and administrator of current degree */
|
||||
ICanBeAdm[HieLvl_DEG] = Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
HieLvl_DEG,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod);
|
||||
HieLvl_DEG);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -332,17 +332,12 @@ long Hie_GetCurrentCod (void)
|
|||
switch (Gbl.Scope.Current)
|
||||
{
|
||||
case HieLvl_SYS:
|
||||
return -1L;
|
||||
case HieLvl_CTY:
|
||||
return Gbl.Hierarchy.Node[HieLvl_CTY].Cod;
|
||||
case HieLvl_INS:
|
||||
return Gbl.Hierarchy.Node[HieLvl_INS].Cod;
|
||||
case HieLvl_CTR:
|
||||
return Gbl.Hierarchy.Node[HieLvl_CTR].Cod;
|
||||
case HieLvl_DEG:
|
||||
return Gbl.Hierarchy.Node[HieLvl_DEG].Cod;
|
||||
case HieLvl_CRS:
|
||||
return Gbl.Hierarchy.Node[HieLvl_CRS].Cod;
|
||||
return Gbl.Hierarchy.Node[Gbl.Scope.Current].Cod;
|
||||
default:
|
||||
Err_WrongHierarchyLevelExit ();
|
||||
return -1L; // Not reached
|
||||
|
|
|
@ -2164,7 +2164,8 @@ static void Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (struct Svy_Survey *Svy)
|
|||
}
|
||||
}
|
||||
else
|
||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
|
||||
HTM_TxtF ("%s %s",Txt_The_whole_course,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].ShrtName);
|
||||
|
||||
HTM_DIV_End ();
|
||||
|
||||
|
|
|
@ -156,18 +156,9 @@ unsigned Svy_DB_GetListSurveys (MYSQL_RES **mysql_res,
|
|||
"Title DESC",
|
||||
};
|
||||
unsigned NumSvys;
|
||||
long Cods[HieLvl_NUM_LEVELS];
|
||||
HieLvl_Level_t Level;
|
||||
bool SubQueryFilled = false;
|
||||
|
||||
/***** Set hierarchy codes *****/
|
||||
Cods[HieLvl_SYS] = -1L; // System
|
||||
Cods[HieLvl_CTY] = Gbl.Hierarchy.Node[HieLvl_CTY].Cod; // Country
|
||||
Cods[HieLvl_INS] = Gbl.Hierarchy.Node[HieLvl_INS].Cod; // Institution
|
||||
Cods[HieLvl_CTR] = Gbl.Hierarchy.Node[HieLvl_CTR].Cod; // Center
|
||||
Cods[HieLvl_DEG] = Gbl.Hierarchy.Node[HieLvl_DEG].Cod; // Degree
|
||||
Cods[HieLvl_CRS] = Gbl.Hierarchy.Node[HieLvl_CRS].Cod; // Course
|
||||
|
||||
/***** Fill subqueries for system, country, institution, center and degree *****/
|
||||
for (Level = HieLvl_SYS;
|
||||
Level <= HieLvl_DEG;
|
||||
|
@ -177,7 +168,7 @@ unsigned Svy_DB_GetListSurveys (MYSQL_RES **mysql_res,
|
|||
if (asprintf (&SubQuery[Level],"%s(Scope='%s' AND Cod=%ld%s)",
|
||||
SubQueryFilled ? " OR " :
|
||||
"",
|
||||
Hie_GetDBStrFromLevel (Level),Cods[Level],
|
||||
Hie_GetDBStrFromLevel (Level),Gbl.Hierarchy.Node[Level].Cod,
|
||||
(HiddenAllowed & 1 << Level) ? "" :
|
||||
" AND Hidden='N'") < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
|
@ -211,9 +202,9 @@ unsigned Svy_DB_GetListSurveys (MYSQL_RES **mysql_res,
|
|||
")",
|
||||
SubQueryFilled ? " OR " :
|
||||
"",
|
||||
Hie_GetDBStrFromLevel (HieLvl_CRS),Cods[HieLvl_CRS],
|
||||
Hie_GetDBStrFromLevel (HieLvl_CRS),Gbl.Hierarchy.Node[HieLvl_CRS].Cod,
|
||||
(HiddenAllowed & 1 << HieLvl_CRS) ? "" :
|
||||
" AND Hidden='N'",
|
||||
" AND Hidden='N'",
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
}
|
||||
|
@ -222,9 +213,9 @@ unsigned Svy_DB_GetListSurveys (MYSQL_RES **mysql_res,
|
|||
if (asprintf (&SubQuery[HieLvl_CRS],"%s(Scope='%s' AND Cod=%ld%s)",
|
||||
SubQueryFilled ? " OR " :
|
||||
"",
|
||||
Hie_GetDBStrFromLevel (HieLvl_CRS),Cods[HieLvl_CRS],
|
||||
Hie_GetDBStrFromLevel (HieLvl_CRS),Gbl.Hierarchy.Node[HieLvl_CRS].Cod,
|
||||
(HiddenAllowed & 1 << HieLvl_CRS) ? "" :
|
||||
" AND Hidden='N'") < 0)
|
||||
" AND Hidden='N'") < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
}
|
||||
SubQueryFilled = true;
|
||||
|
|
|
@ -371,7 +371,9 @@ void Tmt_ShowClassTimeTable (void)
|
|||
/***** Begin time table drawing *****/
|
||||
if (Timetable.Type == Tmt_COURSE_TIMETABLE)
|
||||
Lay_WriteHeaderClassPhoto (PrintView,false,
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod,Gbl.Hierarchy.Node[HieLvl_DEG].Cod,Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
|
||||
Gbl.Hierarchy.Node[HieLvl_INS].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_DEG].Cod,
|
||||
Gbl.Hierarchy.Node[HieLvl_CRS].Cod);
|
||||
|
||||
if (PrintView)
|
||||
/***** Show whether only my groups or all groups are selected *****/
|
||||
|
|
|
@ -5243,12 +5243,12 @@ void Usr_SeeStudents (void)
|
|||
Gbl.Scope.Current == HieLvl_DEG ||
|
||||
Gbl.Scope.Current == HieLvl_CTR ||
|
||||
Gbl.Scope.Current == HieLvl_INS) ? Gbl.Hierarchy.Node[HieLvl_INS].Cod :
|
||||
-1L,
|
||||
-1L,
|
||||
(Gbl.Scope.Current == HieLvl_CRS ||
|
||||
Gbl.Scope.Current == HieLvl_DEG) ? Gbl.Hierarchy.Node[HieLvl_DEG].Cod :
|
||||
-1L,
|
||||
-1L,
|
||||
Gbl.Scope.Current == HieLvl_CRS ? Gbl.Hierarchy.Node[HieLvl_CRS].Cod :
|
||||
-1L);
|
||||
-1L);
|
||||
|
||||
/* Set options allowed */
|
||||
PutForm = Usr_SetOptionsListUsrsAllowed (Rol_STD,ICanChooseOption);
|
||||
|
|
Loading…
Reference in New Issue