mirror of https://github.com/acanas/swad-core.git
Version 23.17.4: Sep 26, 2023 Code refactoring in hierarchy.
This commit is contained in:
parent
3e8a90afbc
commit
c7591e9849
|
@ -632,10 +632,11 @@ 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.17.3 (2023-09-25)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.17.4 (2023-09-26)"
|
||||
#define CSS_FILE "swad23.16.1.css"
|
||||
#define JS_FILE "swad22.49.js"
|
||||
/*
|
||||
Version 23.17.4: Sep 26, 2023 Code refactoring in hierarchy. (336661 lines)
|
||||
Version 23.17.3: Sep 25, 2023 Code refactoring in hierarchy. (336679 lines)
|
||||
Version 23.17.2: Sep 25, 2023 Fixed bug in hierarchy. (336673 lines)
|
||||
Version 23.17.1: Sep 25, 2023 Fixed bug in hierarchy. (336654 lines)
|
||||
|
|
|
@ -169,7 +169,7 @@ void Ins_SeeInsWithPendingCtrs (void)
|
|||
/* Get institution code (row[0]) */
|
||||
Ins.HieCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
BgColor = (Ins.HieCod == Gbl.Hierarchy.Node[Hie_INS].HieCod) ? "BG_HIGHLIGHT" :
|
||||
The_GetColorRows ();
|
||||
The_GetColorRows ();
|
||||
|
||||
/* Get data of institution */
|
||||
Ins_GetInstitDataByCod (&Ins);
|
||||
|
@ -372,7 +372,7 @@ static void Ins_ListOneInstitutionForSeeing (struct Hie_Node *Ins,unsigned NumIn
|
|||
TxtClassStrong = "DAT_STRONG";
|
||||
}
|
||||
BgColor = (Ins->HieCod == Gbl.Hierarchy.Node[Hie_INS].HieCod) ? "BG_HIGHLIGHT" :
|
||||
The_GetColorRows ();
|
||||
The_GetColorRows ();
|
||||
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
|
@ -579,7 +579,7 @@ void Ins_GetBasicListOfInstitutions (long CtyCod)
|
|||
{
|
||||
/***** Create list with institutions *****/
|
||||
if ((Gbl.Hierarchy.List[Hie_CTY].Lst = calloc ((size_t) Gbl.Hierarchy.List[Hie_CTY].Num,
|
||||
sizeof (*Gbl.Hierarchy.List[Hie_CTY].Lst))) == NULL)
|
||||
sizeof (*Gbl.Hierarchy.List[Hie_CTY].Lst))) == NULL)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
|
||||
/***** Get the institutions *****/
|
||||
|
@ -612,7 +612,7 @@ void Ins_GetFullListOfInstitutions (long CtyCod)
|
|||
{
|
||||
/***** Create list with institutions *****/
|
||||
if ((Gbl.Hierarchy.List[Hie_CTY].Lst = calloc ((size_t) Gbl.Hierarchy.List[Hie_CTY].Num,
|
||||
sizeof (*Gbl.Hierarchy.List[Hie_CTY].Lst))) == NULL)
|
||||
sizeof (*Gbl.Hierarchy.List[Hie_CTY].Lst))) == NULL)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
|
||||
/***** Get the institutions *****/
|
||||
|
@ -829,7 +829,7 @@ void Ins_WriteSelectorOfInstitution (void)
|
|||
|
||||
HTM_OPTION (HTM_Type_STRING,"",
|
||||
Gbl.Hierarchy.Node[Hie_INS].HieCod < 0 ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_DISABLED,
|
||||
"[%s]",Txt_Institution);
|
||||
|
||||
|
@ -854,7 +854,7 @@ void Ins_WriteSelectorOfInstitution (void)
|
|||
HTM_OPTION (HTM_Type_LONG,&InsCod,
|
||||
Gbl.Hierarchy.Node[Hie_INS].HieCod > 0 &&
|
||||
InsCod == Gbl.Hierarchy.Node[Hie_INS].HieCod ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s",row[1]);
|
||||
}
|
||||
|
@ -1200,7 +1200,7 @@ void Ins_RenameInstitution (struct Hie_Node *Ins,Cns_ShrtOrFullName_t ShrtOrFull
|
|||
{
|
||||
/***** If institution was in database... *****/
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty (ParName,NewInsName,Ins->HieCod,
|
||||
Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
||||
Gbl.Hierarchy.Node[Hie_CTY].HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
NewInsName);
|
||||
|
|
|
@ -329,7 +329,7 @@ static void InsCfg_Country (bool PrintView,bool PutForm)
|
|||
CtyInLst = &Gbl.Hierarchy.List[Hie_SYS].Lst[NumCty];
|
||||
HTM_OPTION (HTM_Type_LONG,&CtyInLst->HieCod,
|
||||
CtyInLst->HieCod == Gbl.Hierarchy.Node[Hie_CTY].HieCod ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s",CtyInLst->FullName);
|
||||
}
|
||||
|
@ -388,8 +388,7 @@ static void InsCfg_ShrtName (bool PutForm)
|
|||
|
||||
static void InsCfg_WWW (bool PrintView,bool PutForm)
|
||||
{
|
||||
HieCfg_WWW (PrintView,PutForm,ActChgInsWWWCfg,
|
||||
Gbl.Hierarchy.Node[Hie_INS].WWW);
|
||||
HieCfg_WWW (PrintView,PutForm,ActChgInsWWWCfg,Gbl.Hierarchy.Node[Hie_INS].WWW);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -550,11 +549,13 @@ void InsCfg_ChangeInsCty (void)
|
|||
Cty_GetBasicCountryDataByCod (&NewCty);
|
||||
|
||||
/***** Check if it already exists an institution with the same name in the new country *****/
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty ("ShortName",Gbl.Hierarchy.Node[Hie_INS].ShrtName,-1L,NewCty.HieCod))
|
||||
if (Ins_DB_CheckIfInsNameExistsInCty ("ShortName",Gbl.Hierarchy.Node[Hie_INS].ShrtName,
|
||||
-1L,NewCty.HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Gbl.Hierarchy.Node[Hie_INS].ShrtName);
|
||||
else if (Ins_DB_CheckIfInsNameExistsInCty ("FullName",Gbl.Hierarchy.Node[Hie_INS].FullName,-1L,NewCty.HieCod))
|
||||
else if (Ins_DB_CheckIfInsNameExistsInCty ("FullName",Gbl.Hierarchy.Node[Hie_INS].FullName,
|
||||
-1L,NewCty.HieCod))
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_institution_X_already_exists,
|
||||
Gbl.Hierarchy.Node[Hie_INS].FullName);
|
||||
|
@ -563,7 +564,7 @@ void InsCfg_ChangeInsCty (void)
|
|||
/***** Update the table changing the country of the institution *****/
|
||||
Ins_DB_UpdateInsCty (Gbl.Hierarchy.Node[Hie_INS].HieCod,NewCty.HieCod);
|
||||
Gbl.Hierarchy.Node[Hie_INS].PrtCod =
|
||||
Gbl.Hierarchy.Node[Hie_CTY].HieCod = NewCty.HieCod;
|
||||
Gbl.Hierarchy.Node[Hie_CTY].HieCod = NewCty.HieCod;
|
||||
|
||||
/***** Initialize again current course, degree, center... *****/
|
||||
Hie_InitHierarchy ();
|
||||
|
|
|
@ -1468,15 +1468,15 @@ void Lay_WriteHeaderClassPhoto (bool PrintView,bool DrawingClassPhoto)
|
|||
|
||||
/***** Initialize institution, degree and course to show in header *****/
|
||||
Hie[Hie_INS].HieCod = (Gbl.Scope.Current == Hie_CRS ||
|
||||
Gbl.Scope.Current == Hie_DEG ||
|
||||
Gbl.Scope.Current == Hie_CTR ||
|
||||
Gbl.Scope.Current == Hie_INS) ? Gbl.Hierarchy.Node[Hie_INS].HieCod :
|
||||
-1L;
|
||||
Gbl.Scope.Current == Hie_DEG ||
|
||||
Gbl.Scope.Current == Hie_CTR ||
|
||||
Gbl.Scope.Current == Hie_INS) ? Gbl.Hierarchy.Node[Hie_INS].HieCod :
|
||||
-1L;
|
||||
Hie[Hie_DEG].HieCod = (Gbl.Scope.Current == Hie_CRS ||
|
||||
Gbl.Scope.Current == Hie_DEG) ? Gbl.Hierarchy.Node[Hie_DEG].HieCod :
|
||||
-1L;
|
||||
Gbl.Scope.Current == Hie_DEG) ? Gbl.Hierarchy.Node[Hie_DEG].HieCod :
|
||||
-1L;
|
||||
Hie[Hie_CRS].HieCod = (Gbl.Scope.Current == Hie_CRS) ? Gbl.Hierarchy.Node[Hie_CRS].HieCod :
|
||||
-1L;
|
||||
-1L;
|
||||
|
||||
/***** Get data of institution, degree and course *****/
|
||||
Ins_GetInstitDataByCod (&Hie[Hie_INS]);
|
||||
|
|
|
@ -527,7 +527,7 @@ static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void)
|
|||
extern const char *Txt_nicks_emails_or_IDs_separated_by_commas;
|
||||
char Nickname[Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1];
|
||||
unsigned ColSpan;
|
||||
bool StdsAndTchsWritten = Gbl.Hierarchy.Level == Hie_CRS && // Course selected
|
||||
bool StdsAndTchsWritten = Gbl.Hierarchy.Level == Hie_CRS && // Course selected
|
||||
(Gbl.Usrs.Me.IBelongToCurrentCrs || // I belong to it
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
|
||||
|
||||
|
|
|
@ -848,12 +848,12 @@ static void Prj_ShowFormToFilterByDpt (const struct Prj_Projects *Projects)
|
|||
if (asprintf (&SelectClass,"TITLE_DESCRIPTION_WIDTH INPUT_%s",
|
||||
The_GetSuffix ()) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
Dpt_WriteSelectorDepartment (Gbl.Hierarchy.Node[Hie_INS].HieCod, // Departments in current insitution
|
||||
Projects->Filter.DptCod, // Selected department
|
||||
Prj_PAR_FILTER_DPT_COD_NAME, // Parameter name
|
||||
SelectClass, // Selector class
|
||||
-1L, // First option
|
||||
Txt_Any_department, // Text when no department selected
|
||||
Dpt_WriteSelectorDepartment (Gbl.Hierarchy.Node[Hie_INS].HieCod, // Departments in current institution
|
||||
Projects->Filter.DptCod, // Selected department
|
||||
Prj_PAR_FILTER_DPT_COD_NAME, // Parameter name
|
||||
SelectClass, // Selector class
|
||||
-1L, // First option
|
||||
Txt_Any_department, // Text when no department selected
|
||||
HTM_SUBMIT_ON_CHANGE);
|
||||
free (SelectClass);
|
||||
|
||||
|
@ -3769,11 +3769,11 @@ static void Prj_PutFormProject (struct Prj_Projects *Projects,
|
|||
The_GetSuffix ()) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
Dpt_WriteSelectorDepartment (Gbl.Hierarchy.Node[Hie_INS].HieCod, // Departments in current institution
|
||||
Projects->Prj.DptCod, // Selected department
|
||||
Par_CodeStr[ParCod_Dpt], // Parameter name
|
||||
SelectClass, // Selector class
|
||||
0, // First option
|
||||
Txt_Another_department, // Text when no department selected
|
||||
Projects->Prj.DptCod, // Selected department
|
||||
Par_CodeStr[ParCod_Dpt], // Parameter name
|
||||
SelectClass, // Selector class
|
||||
0, // First option
|
||||
Txt_Another_department, // Text when no department selected
|
||||
HTM_DONT_SUBMIT_ON_CHANGE);
|
||||
free (SelectClass);
|
||||
HTM_TD_End ();
|
||||
|
|
|
@ -1936,7 +1936,7 @@ void Rec_ShowFormOtherNewSharedRecord (struct Usr_Data *UsrDat,Rol_Role_t Defaul
|
|||
is not the current role in current course.
|
||||
Instead it is initialized with the preferred role. */
|
||||
UsrDat->Roles.InCurrentCrs = (Gbl.Hierarchy.Level == Hie_CRS) ? DefaultRole : // Course selected
|
||||
Rol_UNK; // No course selected
|
||||
Rol_UNK; // No course selected
|
||||
Rec_ShowSharedUsrRecord (Rec_SHA_OTHER_NEW_USR_FORM,UsrDat,NULL);
|
||||
}
|
||||
|
||||
|
@ -3203,7 +3203,7 @@ static void Rec_ShowCountry (struct Usr_Data *UsrDat,bool PutForm)
|
|||
CtyInLst = &Gbl.Hierarchy.List[Hie_SYS].Lst[NumCty];
|
||||
HTM_OPTION (HTM_Type_LONG,&CtyInLst->HieCod,
|
||||
CtyInLst->HieCod == UsrDat->CtyCod ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s",CtyInLst->FullName);
|
||||
}
|
||||
|
@ -3835,7 +3835,7 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher)
|
|||
CtyInLst = &Gbl.Hierarchy.List[Hie_SYS].Lst[NumCty];
|
||||
HTM_OPTION (HTM_Type_LONG,&CtyInLst->HieCod,
|
||||
CtyInLst->HieCod == Gbl.Usrs.Me.UsrDat.InsCtyCod ? HTM_OPTION_SELECTED :
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_UNSELECTED,
|
||||
HTM_OPTION_ENABLED,
|
||||
"%s",CtyInLst->FullName);
|
||||
}
|
||||
|
|
|
@ -109,16 +109,16 @@ void Rol_SetMyRoles (void)
|
|||
{
|
||||
/* Check if I am and administrator of current institution */
|
||||
ICanBeAdm[Hie_INS] = Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Hie_INS);
|
||||
Hie_INS);
|
||||
if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0)
|
||||
{
|
||||
/* Check if I am and administrator of current center */
|
||||
ICanBeAdm[Hie_CTR] = Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Hie_CTR);
|
||||
Hie_CTR);
|
||||
if (Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0)
|
||||
/* Check if I am and administrator of current degree */
|
||||
ICanBeAdm[Hie_DEG] = Adm_DB_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Hie_DEG);
|
||||
Hie_DEG);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
35
swad_scope.c
35
swad_scope.c
|
@ -82,23 +82,11 @@ void Sco_PutSelectorScope (const char *ParName,HTM_SubmitOnChange_t SubmitOnChan
|
|||
WriteScope = true;
|
||||
break;
|
||||
case Hie_CTY:
|
||||
if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0)
|
||||
WriteScope = true;
|
||||
break;
|
||||
case Hie_INS:
|
||||
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0)
|
||||
WriteScope = true;
|
||||
break;
|
||||
case Hie_CTR:
|
||||
if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0)
|
||||
WriteScope = true;
|
||||
break;
|
||||
case Hie_DEG:
|
||||
if (Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0)
|
||||
WriteScope = true;
|
||||
break;
|
||||
case Hie_CRS:
|
||||
if (Gbl.Hierarchy.Level == Hie_CRS)
|
||||
if (Gbl.Hierarchy.Node[Level].HieCod > 0)
|
||||
WriteScope = true;
|
||||
break;
|
||||
default:
|
||||
|
@ -160,25 +148,18 @@ void Sco_GetScope (const char *ParName)
|
|||
|
||||
void Sco_AdjustScope (void)
|
||||
{
|
||||
Hie_Level_t Level;
|
||||
|
||||
/***** Is scope is unknow, use default scope *****/
|
||||
if (Gbl.Scope.Current == Hie_UNK)
|
||||
Gbl.Scope.Current = Gbl.Scope.Default;
|
||||
|
||||
/***** Avoid impossible scopes *****/
|
||||
if (Gbl.Scope.Current == Hie_CRS && Gbl.Hierarchy.Node[Hie_CRS].HieCod <= 0)
|
||||
Gbl.Scope.Current = Hie_DEG;
|
||||
|
||||
if (Gbl.Scope.Current == Hie_DEG && Gbl.Hierarchy.Node[Hie_DEG].HieCod <= 0)
|
||||
Gbl.Scope.Current = Hie_CTR;
|
||||
|
||||
if (Gbl.Scope.Current == Hie_CTR && Gbl.Hierarchy.Node[Hie_CTR].HieCod <= 0)
|
||||
Gbl.Scope.Current = Hie_INS;
|
||||
|
||||
if (Gbl.Scope.Current == Hie_INS && Gbl.Hierarchy.Node[Hie_INS].HieCod <= 0)
|
||||
Gbl.Scope.Current = Hie_CTY;
|
||||
|
||||
if (Gbl.Scope.Current == Hie_CTY && Gbl.Hierarchy.Node[Hie_CTY].HieCod <= 0)
|
||||
Gbl.Scope.Current = Hie_SYS;
|
||||
for (Level = Hie_CRS;
|
||||
Level >= Hie_CTY;
|
||||
Level--)
|
||||
if (Gbl.Scope.Current == Level && Gbl.Hierarchy.Node[Level].HieCod <= 0)
|
||||
Gbl.Scope.Current = Level - 1; // Go up to parent level
|
||||
|
||||
/***** Avoid forbidden scopes *****/
|
||||
if ((Gbl.Scope.Allowed & (1 << Gbl.Scope.Current)) == 0)
|
||||
|
|
|
@ -1031,16 +1031,16 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
|
|||
case Rol_DEG_ADM: // Degree administrator *******************************
|
||||
*ScopesAllowed = 1 << Hie_SYS;
|
||||
*HiddenAllowed = 0;
|
||||
if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0) // Country selected
|
||||
if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0) // Country selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_CTY;
|
||||
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0) // Institution selected
|
||||
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0) // Institution selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_INS;
|
||||
if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0) // Center selected
|
||||
if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0) // Center selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_CTR;
|
||||
if (Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0) // Degree selected
|
||||
if (Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0) // Degree selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_DEG;
|
||||
*HiddenAllowed |= 1 << Hie_DEG; // A degree admin can view hidden degree surveys
|
||||
|
@ -1052,16 +1052,16 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
|
|||
case Rol_CTR_ADM: // Center administrator *******************************
|
||||
*ScopesAllowed = 1 << Hie_SYS;
|
||||
*HiddenAllowed = 0;
|
||||
if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0) // Country selected
|
||||
if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0) // Country selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_CTY;
|
||||
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0) // Institution selected
|
||||
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0) // Institution selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_INS;
|
||||
if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0) // Center selected
|
||||
if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0) // Center selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_CTR;
|
||||
*HiddenAllowed |= 1 << Hie_CTR; // A center admin can view hidden center surveys
|
||||
*HiddenAllowed |= 1 << Hie_CTR; // A center admin can view hidden center surveys
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1069,10 +1069,10 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
|
|||
case Rol_INS_ADM: // Institution administrator **************************
|
||||
*ScopesAllowed = 1 << Hie_SYS;
|
||||
*HiddenAllowed = 0;
|
||||
if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0) // Country selected
|
||||
if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0) // Country selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_CTY;
|
||||
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0) // Institution selected
|
||||
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0) // Institution selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_INS;
|
||||
*HiddenAllowed |= 1 << Hie_INS; // An institution admin can view hidden institution surveys
|
||||
|
@ -1082,22 +1082,22 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
|
|||
case Rol_SYS_ADM: // System administrator (superuser) *******************
|
||||
*ScopesAllowed = 1 << Hie_SYS;
|
||||
*HiddenAllowed = 1 << Hie_SYS; // A system admin can view hidden system surveys
|
||||
if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0) // Country selected
|
||||
if (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0) // Country selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_CTY;
|
||||
*HiddenAllowed |= 1 << Hie_CTY; // A system admin can view hidden country surveys
|
||||
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0) // Institution selected
|
||||
*HiddenAllowed |= 1 << Hie_CTY; // A system admin can view hidden country surveys
|
||||
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0) // Institution selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_INS;
|
||||
*HiddenAllowed |= 1 << Hie_INS; // A system admin can view hidden institution surveys
|
||||
if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0) // Center selected
|
||||
if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0) // Center selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_CTR;
|
||||
*HiddenAllowed |= 1 << Hie_CTR; // A system admin can view hidden center surveys
|
||||
if (Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0) // Degree selected
|
||||
*HiddenAllowed |= 1 << Hie_CTR; // A system admin can view hidden center surveys
|
||||
if (Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0) // Degree selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_DEG;
|
||||
*HiddenAllowed |= 1 << Hie_DEG; // A system admin can view hidden degree surveys
|
||||
*HiddenAllowed |= 1 << Hie_DEG; // A system admin can view hidden degree surveys
|
||||
if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_CRS;
|
||||
|
|
18
swad_tab.c
18
swad_tab.c
|
@ -140,27 +140,23 @@ static bool Tab_CheckIfICanViewTab (Tab_Tab_t Tab)
|
|||
case TabUnk:
|
||||
return false;
|
||||
case TabSys:
|
||||
return (Gbl.Hierarchy.Node[Hie_CTY].HieCod <= 0); // No country selected
|
||||
return (Gbl.Hierarchy.Level == Hie_SYS); // Institution selected
|
||||
case TabCty:
|
||||
return (Gbl.Hierarchy.Node[Hie_CTY].HieCod > 0 && // Country selected
|
||||
Gbl.Hierarchy.Node[Hie_INS].HieCod <= 0); // No institution selected
|
||||
return (Gbl.Hierarchy.Level == Hie_CTY); // Institution selected
|
||||
case TabIns:
|
||||
return (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0 && // Institution selected
|
||||
Gbl.Hierarchy.Node[Hie_CTR].HieCod <= 0); // No center selected
|
||||
return (Gbl.Hierarchy.Level == Hie_INS); // Institution selected
|
||||
case TabCtr:
|
||||
return (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0 && // Center selected
|
||||
Gbl.Hierarchy.Node[Hie_DEG].HieCod <= 0); // No degree selected
|
||||
return (Gbl.Hierarchy.Level == Hie_CTR); // Center selected
|
||||
case TabDeg:
|
||||
return (Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0 && // Degree selected
|
||||
Gbl.Hierarchy.Node[Hie_CRS].HieCod <= 0); // No course selected
|
||||
return (Gbl.Hierarchy.Level == Hie_DEG); // Degree selected
|
||||
case TabCrs:
|
||||
return (Gbl.Hierarchy.Level == Hie_CRS); // Course selected
|
||||
case TabAss:
|
||||
return (Gbl.Hierarchy.Level == Hie_CRS || // Course selected
|
||||
return (Gbl.Hierarchy.Level == Hie_CRS && // Course selected
|
||||
Gbl.Usrs.Me.Role.Logged >= Rol_STD); // I belong to course or I am an admin
|
||||
case TabFil:
|
||||
return (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0 || // Institution selected
|
||||
Gbl.Usrs.Me.Logged); // I'm logged
|
||||
Gbl.Usrs.Me.Logged); // I'm logged
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4658,7 +4658,7 @@ void Usr_ListAllDataTchs (void)
|
|||
(Gbl.Scope.Current == Hie_CTR ? Gbl.Hierarchy.Node[Hie_CTR].HieCod :
|
||||
(Gbl.Scope.Current == Hie_DEG ? Gbl.Hierarchy.Node[Hie_DEG].HieCod :
|
||||
(Gbl.Scope.Current == Hie_CRS ? Gbl.Hierarchy.Node[Hie_CRS].HieCod :
|
||||
-1L))))),
|
||||
-1L))))),
|
||||
1 << Rol_NET |
|
||||
1 << Rol_TCH);
|
||||
|
||||
|
@ -5368,7 +5368,7 @@ void Usr_SeeTeachers (void)
|
|||
(Gbl.Scope.Current == Hie_CTR ? Gbl.Hierarchy.Node[Hie_CTR].HieCod :
|
||||
(Gbl.Scope.Current == Hie_DEG ? Gbl.Hierarchy.Node[Hie_DEG].HieCod :
|
||||
(Gbl.Scope.Current == Hie_CRS ? Gbl.Hierarchy.Node[Hie_CRS].HieCod :
|
||||
-1L))))),
|
||||
-1L))))),
|
||||
1 << Rol_NET |
|
||||
1 << Rol_TCH);
|
||||
|
||||
|
@ -6032,7 +6032,7 @@ void Usr_SeeTchClassPhotoPrn (void)
|
|||
(Gbl.Scope.Current == Hie_CTR ? Gbl.Hierarchy.Node[Hie_CTR].HieCod :
|
||||
(Gbl.Scope.Current == Hie_DEG ? Gbl.Hierarchy.Node[Hie_DEG].HieCod :
|
||||
(Gbl.Scope.Current == Hie_CRS ? Gbl.Hierarchy.Node[Hie_CRS].HieCod :
|
||||
-1L))))),
|
||||
-1L))))),
|
||||
1 << Rol_NET |
|
||||
1 << Rol_TCH);
|
||||
|
||||
|
@ -6297,7 +6297,7 @@ unsigned Usr_GetTotalNumberOfUsers (void)
|
|||
(Gbl.Scope.Current == Hie_INS ? Gbl.Hierarchy.Node[Hie_INS].HieCod :
|
||||
(Gbl.Scope.Current == Hie_CTR ? Gbl.Hierarchy.Node[Hie_CTR].HieCod :
|
||||
(Gbl.Scope.Current == Hie_DEG ? Gbl.Hierarchy.Node[Hie_DEG].HieCod :
|
||||
Gbl.Hierarchy.Node[Hie_CRS].HieCod))));
|
||||
Gbl.Hierarchy.Node[Hie_CRS].HieCod))));
|
||||
Roles = (1 << Rol_STD) |
|
||||
(1 << Rol_NET) |
|
||||
(1 << Rol_TCH);
|
||||
|
|
Loading…
Reference in New Issue