mirror of https://github.com/acanas/swad-core.git
Version 23.25.3: Oct 03, 2023 Code refactoring in user's hierarchy.
This commit is contained in:
parent
859c488098
commit
5015773a40
|
@ -2617,7 +2617,7 @@ table.CELLS_PAD_10 > tbody > tr > td {padding:10px;}
|
|||
.LIST_TREE li
|
||||
{
|
||||
box-sizing:border-box;
|
||||
max-width:500px;
|
||||
/* max-width:500px; */
|
||||
height:25px;
|
||||
text-align:left;
|
||||
vertical-align:middle;
|
|
@ -124,7 +124,7 @@ bool Act_CheckIfIHavePermissionToExecuteAction (Act_Action_t Action)
|
|||
Permission = ActLst_Actions[Action].PermissionDeg;
|
||||
break;
|
||||
case Hie_CRS: // Course selected
|
||||
Permission = Gbl.Usrs.Me.IBelongToCurrentCrs ? ActLst_Actions[Action].PermissionCrsIfIBelong :
|
||||
Permission = Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS] ? ActLst_Actions[Action].PermissionCrsIfIBelong :
|
||||
ActLst_Actions[Action].PermissionCrsIfIDontBelong;
|
||||
break;
|
||||
default:
|
||||
|
@ -358,7 +358,7 @@ void Act_AdjustCurrentAction (void)
|
|||
}
|
||||
|
||||
/***** If I belong to current course *****/
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
{
|
||||
/***** Adjustment 6:
|
||||
-------------
|
||||
|
|
|
@ -1988,22 +1988,22 @@ void Brw_GetParAndInitFileBrowser (void)
|
|||
case Brw_SHOW_DOC_INS:
|
||||
case Brw_ADMI_DOC_INS:
|
||||
case Brw_ADMI_SHR_INS:
|
||||
Gbl.FileBrowser.ShowOnlyPublicFiles = !Gbl.Usrs.Me.IBelongToCurrentIns;
|
||||
Gbl.FileBrowser.ShowOnlyPublicFiles = !Gbl.Usrs.Me.IBelongToCurrent[Hie_INS];
|
||||
break;
|
||||
case Brw_SHOW_DOC_CTR:
|
||||
case Brw_ADMI_DOC_CTR:
|
||||
case Brw_ADMI_SHR_CTR:
|
||||
Gbl.FileBrowser.ShowOnlyPublicFiles = !Gbl.Usrs.Me.IBelongToCurrentCtr;
|
||||
Gbl.FileBrowser.ShowOnlyPublicFiles = !Gbl.Usrs.Me.IBelongToCurrent[Hie_CTR];
|
||||
break;
|
||||
case Brw_SHOW_DOC_DEG:
|
||||
case Brw_ADMI_DOC_DEG:
|
||||
case Brw_ADMI_SHR_DEG:
|
||||
Gbl.FileBrowser.ShowOnlyPublicFiles = !Gbl.Usrs.Me.IBelongToCurrentDeg;
|
||||
Gbl.FileBrowser.ShowOnlyPublicFiles = !Gbl.Usrs.Me.IBelongToCurrent[Hie_DEG];
|
||||
break;
|
||||
case Brw_SHOW_DOC_CRS:
|
||||
case Brw_ADMI_DOC_CRS:
|
||||
case Brw_ADMI_SHR_CRS:
|
||||
Gbl.FileBrowser.ShowOnlyPublicFiles = !Gbl.Usrs.Me.IBelongToCurrentCrs;
|
||||
Gbl.FileBrowser.ShowOnlyPublicFiles = !Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -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.25.1 (2023-10-03)"
|
||||
#define CSS_FILE "swad23.16.1.css"
|
||||
#define Log_PLATFORM_VERSION "SWAD 23.25.3 (2023-10-03)"
|
||||
#define CSS_FILE "swad23.25.2.css"
|
||||
#define JS_FILE "swad22.49.js"
|
||||
/*
|
||||
Version 23.25.3: Oct 03, 2023 Code refactoring in user's hierarchy. (336222 lines)
|
||||
Version 23.25.2: Oct 03, 2023 Changes in my courses. (336230 lines)
|
||||
Version 23.25.1: Oct 03, 2023 Fixed recent bug in user's roles. (336225 lines)
|
||||
Version 23.25: Oct 03, 2023 Code refactoring in user's roles. (336224 lines)
|
||||
Version 23.24: Oct 03, 2023 Code refactoring in user's hierarchy. (336276 lines)
|
||||
|
|
|
@ -137,7 +137,7 @@ void Cht_ShowListOfAvailableChatRooms (void)
|
|||
HTM_UL_Begin ("class=\"LIST_TREE\"");
|
||||
|
||||
/***** Link to chat available for all users *****/
|
||||
IsLastItemInLevel[1] = (!Gbl.Usrs.Me.IBelongToCurrentCrs &&
|
||||
IsLastItemInLevel[1] = (!Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS] &&
|
||||
!Gbl.Usrs.Me.Hierarchy[Hie_DEG].Num);
|
||||
snprintf (ThisRoomFullName,sizeof (ThisRoomFullName),"%s (%s)",
|
||||
Txt_General,Txt_SEX_PLURAL_abc[Usr_SEX_ALL]);
|
||||
|
|
|
@ -233,7 +233,7 @@ void Con_ComputeConnectedUsrsBelongingToCurrentCrs (void)
|
|||
{
|
||||
if ((Gbl.Prefs.SideCols & Lay_SHOW_RIGHT_COLUMN) && // Right column visible
|
||||
Gbl.Hierarchy.Level == Hie_CRS && // Course selected
|
||||
(Gbl.Usrs.Me.IBelongToCurrentCrs || // I can view users
|
||||
(Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS] || // I can view users
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM))
|
||||
{
|
||||
Gbl.Usrs.Connected.NumUsrs =
|
||||
|
|
|
@ -151,6 +151,7 @@ void Crs_ShowIntroduction (void)
|
|||
static void Crs_WriteListMyCoursesToSelectOne (void)
|
||||
{
|
||||
extern const char *Hlp_PROFILE_Courses;
|
||||
extern const char *Par_CodeStr[];
|
||||
extern const char *Txt_My_courses;
|
||||
extern const char *Txt_System;
|
||||
struct Hie_Node Hie[Hie_NUM_LEVELS];
|
||||
|
@ -188,7 +189,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
|
|||
IsLastItemInLevel[1] = true;
|
||||
Lay_IndentDependingOnLevel (1,IsLastItemInLevel);
|
||||
Frm_BeginForm (ActMyCrs);
|
||||
// Cty_PutParCtyCod (-1L);
|
||||
Par_PutParLong (NULL,Par_CodeStr[ParCod_Cty],-1L);
|
||||
HTM_BUTTON_Submit_Begin (Txt_System,
|
||||
"class=\"BT_LINK FORM_IN_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
@ -622,7 +623,7 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void)
|
|||
/***** Write an option with the current course
|
||||
when I don't belong to it *****/
|
||||
if (Gbl.Hierarchy.Level == Hie_CRS && // Course selected
|
||||
!Gbl.Usrs.Me.IBelongToCurrentCrs) // I do not belong to it
|
||||
!Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS]) // I do not belong to it
|
||||
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Node[Hie_CRS].HieCod,
|
||||
HTM_OPTION_SELECTED,
|
||||
HTM_OPTION_DISABLED,
|
||||
|
|
|
@ -176,7 +176,8 @@ void Enr_PutButtonInlineToRegisterStds (long CrsCod)
|
|||
{
|
||||
extern const char *Txt_Register_students;
|
||||
|
||||
if (Gbl.Usrs.Me.Role.Logged == Rol_TCH) // Course selected and I am logged as teacher
|
||||
// if (Gbl.Usrs.Me.Role.Logged == Rol_TCH) // Course selected and I am logged as teacher
|
||||
if (Rol_GetMyRoleInCrs (CrsCod) == Rol_TCH) // I am a teacher in the given course
|
||||
if (!Enr_GetNumUsrsInCrss (Hie_CRS,CrsCod,
|
||||
1 << Rol_STD)) // No students in course
|
||||
{
|
||||
|
@ -3184,7 +3185,7 @@ static void Enr_EffectivelyRemUsrFromCrs (struct Usr_Data *UsrDat,
|
|||
{
|
||||
case Usr_ME:
|
||||
/* Now I don't belong to current course */
|
||||
Gbl.Usrs.Me.IBelongToCurrentCrs =
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS] =
|
||||
Gbl.Usrs.Me.UsrDat.Accepted = false;
|
||||
|
||||
/* Fill the list with the courses I belong to */
|
||||
|
@ -3324,7 +3325,7 @@ bool Enr_CheckIfUsrSharesAnyOfMyCrs (struct Usr_Data *UsrDat)
|
|||
return Gbl.Cache.UsrSharesAnyOfMyCrs.SharesAnyOfMyCrs;
|
||||
|
||||
/***** 5. Fast check: Is course selected and we both belong to it? *****/
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
if (Enr_CheckIfUsrBelongsToCurrentCrs (UsrDat)) // Course selected and we both belong to it
|
||||
{
|
||||
Gbl.Cache.UsrSharesAnyOfMyCrs.UsrCod = UsrDat->UsrCod;
|
||||
|
|
|
@ -1298,7 +1298,7 @@ void For_ShowForumList (struct For_Forums *Forums)
|
|||
Gbl.Hierarchy.Node[Hie_DEG].HieCod,
|
||||
true,
|
||||
IsLastItemInLevel) > 0)
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs ||
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS] ||
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
|
||||
/***** Links to forums of current degree *****/
|
||||
For_WriteLinksToCrsForums (Forums,
|
||||
|
|
|
@ -124,10 +124,6 @@ void Gbl_InitializeGlobals (void)
|
|||
Gbl.Usrs.Me.Role.LoggedBeforeCloseSession =
|
||||
Gbl.Usrs.Me.Role.Max = Rol_UNK;
|
||||
Gbl.Usrs.Me.Role.HasChanged = false;
|
||||
Gbl.Usrs.Me.IBelongToCurrentIns = false;
|
||||
Gbl.Usrs.Me.IBelongToCurrentCtr = false;
|
||||
Gbl.Usrs.Me.IBelongToCurrentDeg = false;
|
||||
Gbl.Usrs.Me.IBelongToCurrentCrs = false;
|
||||
Gbl.Usrs.Me.MyPhotoExists = false;
|
||||
Gbl.Usrs.Me.NumAccWithoutPhoto = 0;
|
||||
Gbl.Usrs.Me.TimeLastAccToThisFileBrowser = LONG_MAX; // Initialized to a big value, so by default files are not shown as recent or new
|
||||
|
|
|
@ -124,10 +124,7 @@ struct Globals
|
|||
char PendingPassword[Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
|
||||
char PathDir[PATH_MAX + 1];
|
||||
bool Logged;
|
||||
bool IBelongToCurrentIns;
|
||||
bool IBelongToCurrentCtr;
|
||||
bool IBelongToCurrentDeg;
|
||||
bool IBelongToCurrentCrs;
|
||||
bool IBelongToCurrent[Hie_NUM_LEVELS];
|
||||
bool MyPhotoExists;
|
||||
unsigned NumAccWithoutPhoto;
|
||||
char PhotoURL[Cns_MAX_BYTES_WWW + 1];
|
||||
|
|
|
@ -3045,7 +3045,7 @@ bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct Usr_Data *UsrDat)
|
|||
return false;
|
||||
|
||||
/***** 4. Fast check: Do I belong to the current course? *****/
|
||||
if (!Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
if (!Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
return false;
|
||||
|
||||
/***** 5. Fast check: It's me? *****/
|
||||
|
@ -4331,7 +4331,7 @@ Grp_WhichGroups_t Grp_GetParWhichGroups (void)
|
|||
If I belong to this course ==> see only my groups
|
||||
If I don't belong to this course ==> see all groups
|
||||
*/
|
||||
WhichGroupsDefault = Gbl.Usrs.Me.IBelongToCurrentCrs ? Grp_MY_GROUPS :
|
||||
WhichGroupsDefault = Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS] ? Grp_MY_GROUPS :
|
||||
Grp_ALL_GROUPS;
|
||||
break;
|
||||
case ActSeeMyTT: // Show my timetable
|
||||
|
|
|
@ -127,7 +127,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
|
|||
{
|
||||
if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected
|
||||
{
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs) // I belong to this course
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS]) // I belong to this course
|
||||
{
|
||||
if (Gbl.Action.Act != ActLogIn &&
|
||||
Gbl.Action.Act != ActLogInNew &&
|
||||
|
|
|
@ -635,6 +635,8 @@ void Hie_ResetHierarchy (void)
|
|||
Gbl.Hierarchy.Node[Level].ShrtName[0] =
|
||||
Gbl.Hierarchy.Node[Level].FullName[0] = '\0';
|
||||
Gbl.Hierarchy.Node[Level].WWW[0] = '\0';
|
||||
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Level] = false;
|
||||
}
|
||||
Gbl.Hierarchy.Node[Hie_CTR].Specific.PlcCod = -1L;
|
||||
Gbl.Hierarchy.Node[Hie_DEG].Specific.TypCod = -1L;
|
||||
|
@ -934,6 +936,7 @@ void Hie_ResetMyHierarchy (void)
|
|||
Gbl.Usrs.Me.Hierarchy[Level].Nodes = NULL;
|
||||
Gbl.Usrs.Me.Hierarchy[Level].Num = 0;
|
||||
Gbl.Usrs.Me.Hierarchy[Level].Filled = false;
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Level] = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1612,8 +1612,11 @@ void Lay_IndentDependingOnLevel (unsigned Level,bool IsLastItemInLevel[])
|
|||
{
|
||||
unsigned i;
|
||||
|
||||
if (Level <= 1)
|
||||
return;
|
||||
|
||||
/***** Indent (from 1 to Level-1) *****/
|
||||
for (i = 1;
|
||||
for (i = 2;
|
||||
i < Level;
|
||||
i++)
|
||||
Ico_PutIcon (IsLastItemInLevel[i] ? "tr20x20.gif" :
|
||||
|
@ -1622,7 +1625,6 @@ void Lay_IndentDependingOnLevel (unsigned Level,bool IsLastItemInLevel[])
|
|||
"","ICO25x25");
|
||||
|
||||
/***** Level *****/
|
||||
if (Level)
|
||||
Ico_PutIcon (IsLastItemInLevel[Level] ? "subend20x20.gif" :
|
||||
"submid20x20.gif",
|
||||
Ico_BLACK,
|
||||
|
|
|
@ -246,7 +246,7 @@ static void Msg_PutFormMsgUsrs (struct Msg_Messages *Messages,
|
|||
Messages->ShowOnlyOneRecipient = false;
|
||||
|
||||
GetUsrsInCrs = !Messages->ShowOnlyOneRecipient && // Show list of potential recipients
|
||||
(Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it
|
||||
(Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS] || // If there is a course selected and I belong to it
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
|
||||
if (GetUsrsInCrs)
|
||||
{
|
||||
|
@ -528,7 +528,7 @@ static void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (void)
|
|||
char Nickname[Nck_MAX_BYTES_NICK_WITHOUT_ARROBA + 1];
|
||||
unsigned ColSpan;
|
||||
bool StdsAndTchsWritten = Gbl.Hierarchy.Level == Hie_CRS && // Course selected
|
||||
(Gbl.Usrs.Me.IBelongToCurrentCrs || // I belong to it
|
||||
(Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS] || // I belong to it
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM);
|
||||
|
||||
/***** How many columns? *****/
|
||||
|
|
|
@ -2257,7 +2257,7 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
|
|||
{
|
||||
case Usr_ME:
|
||||
// Don't show groups if I don't belong to course
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
Grp_ShowLstGrpsToChgMyGrps ();
|
||||
break;
|
||||
case Usr_OTHER:
|
||||
|
|
32
swad_role.c
32
swad_role.c
|
@ -125,55 +125,55 @@ void Rol_SetMyRoles (void)
|
|||
/***** Check if I belong to current course *****/
|
||||
if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected
|
||||
{
|
||||
Gbl.Usrs.Me.IBelongToCurrentCrs = Enr_CheckIfUsrBelongsToCurrentCrs (&Gbl.Usrs.Me.UsrDat);
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS] = Enr_CheckIfUsrBelongsToCurrentCrs (&Gbl.Usrs.Me.UsrDat);
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
Gbl.Usrs.Me.UsrDat.Accepted = Enr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Me.UsrDat);
|
||||
else
|
||||
Gbl.Usrs.Me.UsrDat.Accepted = false;
|
||||
}
|
||||
else // No course selected
|
||||
{
|
||||
Gbl.Usrs.Me.IBelongToCurrentCrs = false;
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS] = false;
|
||||
Gbl.Usrs.Me.UsrDat.Accepted = false;
|
||||
}
|
||||
|
||||
/***** Check if I belong to current degree *****/
|
||||
if (Gbl.Hierarchy.Node[Hie_DEG].HieCod > 0)
|
||||
{
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
Gbl.Usrs.Me.IBelongToCurrentDeg = true;
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Hie_DEG] = true;
|
||||
else
|
||||
Gbl.Usrs.Me.IBelongToCurrentDeg = Hie_CheckIfIBelongTo (Hie_DEG,Gbl.Hierarchy.Node[Hie_DEG].HieCod);
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Hie_DEG] = Hie_CheckIfIBelongTo (Hie_DEG,Gbl.Hierarchy.Node[Hie_DEG].HieCod);
|
||||
}
|
||||
else
|
||||
Gbl.Usrs.Me.IBelongToCurrentDeg = false;
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Hie_DEG] = false;
|
||||
|
||||
/***** Check if I belong to current center *****/
|
||||
if (Gbl.Hierarchy.Node[Hie_CTR].HieCod > 0)
|
||||
{
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentDeg)
|
||||
Gbl.Usrs.Me.IBelongToCurrentCtr = true;
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_DEG])
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Hie_CTR] = true;
|
||||
else
|
||||
Gbl.Usrs.Me.IBelongToCurrentCtr = Hie_CheckIfIBelongTo (Hie_CTR,Gbl.Hierarchy.Node[Hie_CTR].HieCod);
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Hie_CTR] = Hie_CheckIfIBelongTo (Hie_CTR,Gbl.Hierarchy.Node[Hie_CTR].HieCod);
|
||||
}
|
||||
else
|
||||
Gbl.Usrs.Me.IBelongToCurrentCtr = false;
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Hie_CTR] = false;
|
||||
|
||||
/***** Check if I belong to current institution *****/
|
||||
if (Gbl.Hierarchy.Node[Hie_INS].HieCod > 0)
|
||||
{
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCtr)
|
||||
Gbl.Usrs.Me.IBelongToCurrentIns = true;
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CTR])
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Hie_INS] = true;
|
||||
else
|
||||
Gbl.Usrs.Me.IBelongToCurrentIns = Hie_CheckIfIBelongTo (Hie_INS,Gbl.Hierarchy.Node[Hie_INS].HieCod);
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Hie_INS] = Hie_CheckIfIBelongTo (Hie_INS,Gbl.Hierarchy.Node[Hie_INS].HieCod);
|
||||
}
|
||||
else
|
||||
Gbl.Usrs.Me.IBelongToCurrentIns = false;
|
||||
Gbl.Usrs.Me.IBelongToCurrent[Hie_INS] = false;
|
||||
|
||||
/***** Build my list of available roles for current course *****/
|
||||
if (Gbl.Hierarchy.Level == Hie_CRS)
|
||||
{
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
Gbl.Usrs.Me.Role.Available = (1 << Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs);
|
||||
else if (Gbl.Usrs.Me.Role.Max >= Rol_STD)
|
||||
Gbl.Usrs.Me.Role.Available = (1 << Rol_USR);
|
||||
|
|
|
@ -123,13 +123,10 @@ void Ses_CloseSession (void)
|
|||
/***** Now, user is not logged in *****/
|
||||
Gbl.Usrs.Me.Role.LoggedBeforeCloseSession = Gbl.Usrs.Me.Role.Logged;
|
||||
Gbl.Usrs.Me.Logged = false;
|
||||
Gbl.Usrs.Me.IBelongToCurrentIns = false;
|
||||
Gbl.Usrs.Me.IBelongToCurrentCtr = false;
|
||||
Gbl.Usrs.Me.IBelongToCurrentDeg = false;
|
||||
Gbl.Usrs.Me.IBelongToCurrentCrs = false;
|
||||
Gbl.Usrs.Me.Role.Logged = Rol_UNK; // Don't uncomment this line. Don't change the role to unknown. Keep user's role in order to log the access
|
||||
Gbl.Usrs.Me.Hierarchy[Hie_CRS].Filled = false;
|
||||
Gbl.Usrs.Me.Hierarchy[Hie_CRS].Num = 0;
|
||||
Gbl.Usrs.Me.Role.Logged = Rol_UNK; // TODO: Keep user's role in order to log the access?
|
||||
Hie_FreeMyHierarchy ();
|
||||
// Gbl.Usrs.Me.Hierarchy[Hie_CRS].Filled = false;
|
||||
// Gbl.Usrs.Me.Hierarchy[Hie_CRS].Num = 0;
|
||||
|
||||
/***** Update number of open sessions in order to show them properly *****/
|
||||
Ses_GetNumSessions ();
|
||||
|
|
|
@ -995,7 +995,7 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
|
|||
if (Hie_CheckIfIBelongTo (Hie_DEG,Gbl.Hierarchy.Node[Hie_DEG].HieCod))
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_DEG;
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
*ScopesAllowed |= 1 << Hie_CRS;
|
||||
}
|
||||
}
|
||||
|
@ -1018,7 +1018,7 @@ static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed,
|
|||
if (Hie_CheckIfIBelongTo (Hie_DEG,Gbl.Hierarchy.Node[Hie_DEG].HieCod))
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_DEG;
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
{
|
||||
*ScopesAllowed |= 1 << Hie_CRS;
|
||||
*HiddenAllowed |= 1 << Hie_CRS; // A non-editing teacher or teacher can view hidden course surveys
|
||||
|
|
|
@ -350,7 +350,7 @@ void Tst_AssessTest (void)
|
|||
Lay_WriteHeaderClassPhoto (false,false);
|
||||
|
||||
/***** Header *****/
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
{
|
||||
HTM_DIV_Begin ("class=\"Tst_SUBTITLE DAT_%s\"",
|
||||
The_GetSuffix ());
|
||||
|
|
|
@ -57,8 +57,8 @@ extern struct Globals Gbl;
|
|||
|
||||
void Tst_DB_IncreaseNumMyPrints (void)
|
||||
{
|
||||
/***** Trivial check *****/
|
||||
if (!Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
/***** Trivial check: do I belong to current course? *****/
|
||||
if (!Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
return;
|
||||
|
||||
/***** Update my number of accesses to test in this course *****/
|
||||
|
|
|
@ -2645,7 +2645,7 @@ unsigned TstPrn_GetNumPrintsGeneratedByMe (void)
|
|||
unsigned NumRows;
|
||||
unsigned NumPrintsGeneratedByMe = 0;
|
||||
|
||||
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
if (Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
{
|
||||
/***** Get number of test prints generated by me from database *****/
|
||||
NumRows = Tst_DB_GetNumPrintsGeneratedByMe (&mysql_res);
|
||||
|
|
|
@ -874,7 +874,7 @@ bool Usr_CheckIfICanViewRecordStd (const struct Usr_Data *UsrDat)
|
|||
return true;
|
||||
|
||||
/***** 6. Fast check: Do I belong to the current course? *****/
|
||||
if (!Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
if (!Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
return false;
|
||||
|
||||
/***** 7. Fast check: It's me? *****/
|
||||
|
@ -947,7 +947,7 @@ bool Usr_CheckIfICanViewTstExaMchResult (const struct Usr_Data *UsrDat)
|
|||
return true;
|
||||
|
||||
/***** 5. Fast check: Do I belong to the current course? *****/
|
||||
if (!Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
if (!Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
return false;
|
||||
|
||||
/***** 6. Fast check: It's me? *****/
|
||||
|
@ -998,7 +998,7 @@ bool Usr_CheckIfICanViewAsgWrk (const struct Usr_Data *UsrDat)
|
|||
return true;
|
||||
|
||||
/***** 6. Fast check: Do I belong to the current course? *****/
|
||||
if (!Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
if (!Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
return false;
|
||||
|
||||
/***** 7. Fast check: It's me? *****/
|
||||
|
@ -1040,7 +1040,7 @@ bool Usr_CheckIfICanViewAtt (const struct Usr_Data *UsrDat)
|
|||
return true;
|
||||
|
||||
/***** 5. Fast check: Do I belong to the current course? *****/
|
||||
if (!Gbl.Usrs.Me.IBelongToCurrentCrs)
|
||||
if (!Gbl.Usrs.Me.IBelongToCurrent[Hie_CRS])
|
||||
return false;
|
||||
|
||||
/***** 6. Fast check: It's me? *****/
|
||||
|
|
Loading…
Reference in New Issue