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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -848,7 +848,7 @@ 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
|
||||
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
|
||||
|
|
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)
|
||||
|
|
16
swad_tab.c
16
swad_tab.c
|
@ -140,23 +140,19 @@ 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
|
||||
|
|
Loading…
Reference in New Issue