Version 14.72.5

This commit is contained in:
Antonio Cañas Vargas 2015-02-01 20:17:24 +01:00
parent 4e431a9be9
commit 965a877598
49 changed files with 1260 additions and 1242 deletions

View File

@ -836,8 +836,8 @@ void ID_ConfirmUsrID (long UsrCod,const char *UsrID)
bool ID_ICanSeeTeacherID (struct UsrData *UsrDat)
{
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM)
// If I am an administrator of current degree, I only can see the users' IDs from current degree
return Usr_CheckIfUsrBelongsToDeg (UsrDat->UsrCod,Gbl.CurrentDeg.Deg.DegCod);
return (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER);
return (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
}

View File

@ -587,10 +587,10 @@ bool Acc_CheckIfICanEliminateAccount (bool ItsMe)
// A user logged as superuser can eliminate any user except her/him
// Other users only can eliminate themselves
return (( ItsMe && // It's me
(Gbl.Usrs.Me.AvailableRoles & (1 << Rol_ROLE_SUPERUSER)) == 0) // I can not be superuser
(Gbl.Usrs.Me.AvailableRoles & (1 << Rol_ROLE_SYS_ADM)) == 0) // I can not be superuser
||
(!ItsMe && // It's not me
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)); // I am logged as superuser
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)); // I am logged as superuser
}
/*****************************************************************************/

View File

@ -2163,10 +2163,10 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
/* ActNewAdmIns */{1337,-1,TabUsr,ActReqMdfSevUsr ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AddAdmToIns ,NULL},
/* ActRemAdmIns */{1338,-1,TabUsr,ActReqMdfSevUsr ,0x180,0x180,0x180,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_RemAdmIns ,NULL},
/* ActNewAdmCtr */{1339,-1,TabUsr,ActReqMdfSevUsr ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AddAdmToCtr ,NULL},
/* ActNewAdmCtr */{1339,-1,TabUsr,ActReqMdfSevUsr ,0x180,0x180,0x180,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AddAdmToCtr ,NULL},
/* ActRemAdmCtr */{1340,-1,TabUsr,ActReqMdfSevUsr ,0x1C0,0x1C0,0x1C0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_RemAdmCtr ,NULL},
/* ActNewAdmDeg */{ 586,-1,TabUsr,ActReqMdfSevUsr ,0x100,0x100,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AddAdmToDeg ,NULL},
/* ActNewAdmDeg */{ 586,-1,TabUsr,ActReqMdfSevUsr ,0x1C0,0x1C0,0x1C0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_AddAdmToDeg ,NULL},
/* ActRemAdmDeg */{ 584,-1,TabUsr,ActReqMdfSevUsr ,0x1E0,0x1E0,0x1E0,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_RemAdmDeg ,NULL},
/* ActRcvFrmMdfUsrCrs*/{ 799,-1,TabUsr,ActReqMdfSevUsr ,0x1F0,0x1E0,0x100,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Enr_ReceiveFormUsrsCrs ,NULL},

View File

@ -77,7 +77,7 @@ void Ann_ShowAllAnnouncements (void)
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">");
/***** Put link (form) to create a new announcement *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
{
Act_FormStart (ActWriAnn);
Act_LinkFormSubmit (Txt_New_announcement,The_ClassFormul[Gbl.Prefs.Theme]);

View File

@ -99,7 +99,7 @@ void Asg_SeeAssignments (void)
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
Asg_PutFormToCreateNewAsg ();
break;
default:
@ -317,7 +317,7 @@ static void Asg_ShowOneAssignment (long AsgCod)
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
Asg_PutFormsToRemEditOneAsg (Asg.AsgCod,Asg.Hidden);
break;
default:
@ -578,7 +578,7 @@ void Asg_GetListAssignments (void)
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
HiddenSubQuery[0] = '\0';
break;
default:
@ -1785,12 +1785,12 @@ unsigned Asg_GetNumCoursesWithAssignments (Sco_Scope_t Scope)
/***** Get number of courses with assignments from database *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(DISTINCT (CrsCod))"
" FROM assignments"
" WHERE CrsCod>'0'");
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(DISTINCT (assignments.CrsCod))"
" FROM centres,degrees,courses,assignments"
" WHERE centres.InsCod='%ld'"
@ -1800,7 +1800,7 @@ unsigned Asg_GetNumCoursesWithAssignments (Sco_Scope_t Scope)
" AND courses.CrsCod=assignments.CrsCod",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(DISTINCT (assignments.CrsCod))"
" FROM degrees,courses,assignments"
" WHERE degrees.CtrCod='%ld'"
@ -1809,7 +1809,7 @@ unsigned Asg_GetNumCoursesWithAssignments (Sco_Scope_t Scope)
" AND courses.CrsCod=assignments.CrsCod",
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(DISTINCT (assignments.CrsCod))"
" FROM courses,assignments"
" WHERE courses.DegCod='%ld'"
@ -1817,7 +1817,7 @@ unsigned Asg_GetNumCoursesWithAssignments (Sco_Scope_t Scope)
" AND courses.CrsCod=assignments.CrsCod",
Gbl.CurrentDeg.Deg.DegCod);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(DISTINCT (CrsCod))"
" FROM assignments"
" WHERE CrsCod='%ld'",
@ -1856,12 +1856,12 @@ unsigned Asg_GetNumAssignments (Sco_Scope_t Scope,unsigned *NumNotif)
/***** Get number of assignments from database *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
" FROM assignments"
" WHERE CrsCod>'0'");
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(*),SUM(assignments.NumNotif)"
" FROM centres,degrees,courses,assignments"
" WHERE centres.InsCod='%ld'"
@ -1870,7 +1870,7 @@ unsigned Asg_GetNumAssignments (Sco_Scope_t Scope,unsigned *NumNotif)
" AND courses.CrsCod=assignments.CrsCod",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(*),SUM(assignments.NumNotif)"
" FROM degrees,courses,assignments"
" WHERE degrees.CtrCod='%ld'"
@ -1878,14 +1878,14 @@ unsigned Asg_GetNumAssignments (Sco_Scope_t Scope,unsigned *NumNotif)
" AND courses.CrsCod=assignments.CrsCod",
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(*),SUM(assignments.NumNotif)"
" FROM courses,assignments"
" WHERE courses.DegCod='%ld'"
" AND courses.CrsCod=assignments.CrsCod",
Gbl.CurrentDeg.Deg.DegCod);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
" FROM assignments"
" WHERE CrsCod='%ld'",

View File

@ -123,7 +123,7 @@ void Att_SeeAttEvents (void)
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
Att_PutFormToCreateNewAttEvent ();
Att_PutFormToListStds ();
break;
@ -335,7 +335,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
Att_PutFormsToRemEditOneAttEvent (Att->AttCod,Att->Hidden);
break;
default:
@ -563,7 +563,7 @@ static void Att_GetListAttEvents (Att_OrderTime_t Order)
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
HiddenSubQuery[0] = '\0';
break;
default:
@ -1714,12 +1714,12 @@ unsigned Att_GetNumCoursesWithAttEvents (Sco_Scope_t Scope)
/***** Get number of courses with attendance events from database *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(DISTINCT (CrsCod))"
" FROM att_events"
" WHERE CrsCod>'0'");
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(DISTINCT (att_events.CrsCod))"
" FROM centres,degrees,courses,att_events"
" WHERE centres.InsCod='%ld'"
@ -1729,7 +1729,7 @@ unsigned Att_GetNumCoursesWithAttEvents (Sco_Scope_t Scope)
" AND courses.CrsCod=att_events.CrsCod",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(DISTINCT (att_events.CrsCod))"
" FROM degrees,courses,att_events"
" WHERE degrees.CtrCod='%ld'"
@ -1738,7 +1738,7 @@ unsigned Att_GetNumCoursesWithAttEvents (Sco_Scope_t Scope)
" AND courses.CrsCod=att_events.CrsCod",
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(DISTINCT (att_events.CrsCod))"
" FROM courses,att_events"
" WHERE courses.DegCod='%ld'"
@ -1746,7 +1746,7 @@ unsigned Att_GetNumCoursesWithAttEvents (Sco_Scope_t Scope)
" AND courses.CrsCod=att_events.CrsCod",
Gbl.CurrentDeg.Deg.DegCod);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(DISTINCT (CrsCod))"
" FROM att_events"
" WHERE CrsCod='%ld'",
@ -1785,12 +1785,12 @@ unsigned Att_GetNumAttEvents (Sco_Scope_t Scope,unsigned *NumNotif)
/***** Get number of attendance events from database *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
" FROM att_events"
" WHERE CrsCod>'0'");
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(*),SUM(att_events.NumNotif)"
" FROM centres,degrees,courses,att_events"
" WHERE centres.InsCod='%ld'"
@ -1799,7 +1799,7 @@ unsigned Att_GetNumAttEvents (Sco_Scope_t Scope,unsigned *NumNotif)
" AND courses.CrsCod=att_events.CrsCod",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(*),SUM(att_events.NumNotif)"
" FROM degrees,courses,att_events"
" WHERE degrees.CtrCod='%ld'"
@ -1807,14 +1807,14 @@ unsigned Att_GetNumAttEvents (Sco_Scope_t Scope,unsigned *NumNotif)
" AND courses.CrsCod=att_events.CrsCod",
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(*),SUM(att_events.NumNotif)"
" FROM courses,att_events"
" WHERE courses.DegCod='%ld'"
" AND courses.CrsCod=att_events.CrsCod",
Gbl.CurrentDeg.Deg.DegCod);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
" FROM att_events"
" WHERE CrsCod='%ld'",
@ -1876,7 +1876,7 @@ void Att_SeeOneAttEvent (void)
Att_ListAttOnlyMeAsStudent (&Att);
break;
case Rol_ROLE_TEACHER:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
/***** Show list of students *****/
Att_ListAttStudents (&Att);
break;
@ -1963,7 +1963,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att)
Grp_ShowFormToSelectSeveralGroups (ActSeeOneAtt);
/***** Get and order list of students in this course *****/
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
if (Gbl.Usrs.LstStds.NumUsrs)
{
@ -2294,7 +2294,7 @@ void Att_RegisterStudentsInAttEvent (void)
/***** 1. Get list of students in the groups selected: Gbl.Usrs.LstStds *****/
/* Get list of students in the groups selected */
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
if (Gbl.Usrs.LstStds.NumUsrs) // If there are students in the groups selected...
{
@ -2637,7 +2637,7 @@ void Usr_ReqListAttendanceStdsCrs (void)
Usr_ShowFormsToSelectUsrListType (ActReqLstAttStd);
/***** Get and order lists of users from current course *****/
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
if (Gbl.Usrs.LstStds.NumUsrs)
{

View File

@ -86,7 +86,7 @@ void Ban_SeeBanners (void)
" ORDER BY ShortName");
/***** Put banner (form) to edit banners *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Ban_PutFormToEditBanners ();
/***** Table head *****/

View File

@ -113,7 +113,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
/***** Get centres with pending degrees *****/
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_CTR_ADMIN:
case Rol_ROLE_CTR_ADM:
sprintf (Query,"SELECT degrees.CtrCod,COUNT(*)"
" FROM degrees,ctr_admin,centres"
" WHERE (degrees.Status & %u)<>0"
@ -122,7 +122,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
" GROUP BY degrees.CtrCod ORDER BY centres.ShortName",
(unsigned) Deg_STATUS_BIT_PENDING,Gbl.Usrs.Me.UsrDat.UsrCod);
break;
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
sprintf (Query,"SELECT degrees.CtrCod,COUNT(*)"
" FROM degrees,centres"
" WHERE (degrees.Status & %u)<>0"
@ -173,7 +173,7 @@ void Ctr_SeeCtrWithPendingDegs (void)
" vertical-align:middle; background-color:%s;\">"
"<a href=\"%s\" title=\"%s\" class=\"DAT\" target=\"_blank\">",
BgColor,Ctr.WWW,Ctr.FullName);
Log_DrawLogo (Sco_SCOPE_CENTRE,Ctr.CtrCod,Ctr.ShortName,
Log_DrawLogo (Sco_SCOPE_CTR,Ctr.CtrCod,Ctr.ShortName,
16,"vertical-align:top;",true);
fprintf (Gbl.F.Out,"</a>"
"</td>");
@ -276,9 +276,9 @@ static void Ctr_Configuration (bool PrintView)
Lay_PutLinkToPrintView2 ();
/* Links to upload logo and photo */
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
{
Log_PutFormToChangeLogo (Sco_SCOPE_CENTRE);
Log_PutFormToChangeLogo (Sco_SCOPE_CTR);
Ctr_PutFormToChangeCtrPhoto (PhotoExists);
}
}
@ -297,7 +297,7 @@ static void Ctr_Configuration (bool PrintView)
" class=\"TITLE_LOCATION\" title=\"%s\">",
Gbl.CurrentCtr.Ctr.WWW,
Gbl.CurrentCtr.Ctr.FullName);
Log_DrawLogo (Sco_SCOPE_CENTRE,Gbl.CurrentCtr.Ctr.CtrCod,
Log_DrawLogo (Sco_SCOPE_CTR,Gbl.CurrentCtr.Ctr.CtrCod,
Gbl.CurrentCtr.Ctr.ShortName,64,NULL,true);
fprintf (Gbl.F.Out,"<br />%s",Gbl.CurrentCtr.Ctr.FullName);
if (PutLink)
@ -331,7 +331,7 @@ static void Ctr_Configuration (bool PrintView)
"</tr>");
/* Photo attribution */
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER && !PrintView)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM && !PrintView)
{
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"2\""
@ -514,7 +514,7 @@ void Ctr_ShowCtrsOfCurrentIns (void)
Deg_WriteMenuAllCourses (ActSeeIns,ActSeeCtr,ActUnk,ActUnk);
/***** Put link (form) to edit centres in current institution *****/
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST__)
Lay_PutFormToEdit (ActEdiCtr);
/***** List centres *****/
@ -602,7 +602,7 @@ static void Ctr_ListOneCentreForSeeing (struct Centre *Ctr,unsigned NumCtr)
"<a href=\"%s\" title=\"%s\" class=\"DAT\" target=\"_blank\">",
TxtClass,BgColor,
Ctr->WWW,Ctr->FullName);
Log_DrawLogo (Sco_SCOPE_CENTRE,Ctr->CtrCod,Ctr->ShortName,
Log_DrawLogo (Sco_SCOPE_CTR,Ctr->CtrCod,Ctr->ShortName,
16,"vertical-align:top;",true);
fprintf (Gbl.F.Out,"</a>"
"</td>");
@ -1149,13 +1149,13 @@ static void Ctr_ListCentresForEdition (void)
fprintf (Gbl.F.Out,"<td title=\"%s\""
" style=\"width:20px; text-align:left;\">",
Ctr->FullName);
Log_DrawLogo (Sco_SCOPE_CENTRE,Ctr->CtrCod,Ctr->ShortName,16,NULL,true);
Log_DrawLogo (Sco_SCOPE_CTR,Ctr->CtrCod,Ctr->ShortName,16,NULL,true);
fprintf (Gbl.F.Out,"</td>");
/* Institution */
fprintf (Gbl.F.Out,"<td class=\"DAT\""
" style=\"text-align:left; vertical-align:middle;\">");
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) // I can select institution
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) // I can select institution
{
Act_FormStart (ActChgCtrIns);
Ctr_PutParamOtherCtrCod (Ctr->CtrCod);
@ -1283,7 +1283,7 @@ static void Ctr_ListCentresForEdition (void)
/* Centre status */
StatusTxt = Ctr_GetStatusTxtFromStatusBits (Ctr->Status);
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left; vertical-align:middle;\">");
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN &&
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM &&
StatusTxt == Ctr_STATUS_PENDING)
{
Act_FormStart (ActChgCtrSta);
@ -1331,7 +1331,7 @@ static void Ctr_ListCentresForEdition (void)
static bool Ctr_CheckIfICanEdit (struct Centre *Ctr)
{
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN || // I am an institution administrator or higher
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM || // I am an institution administrator or higher
((Ctr->Status & Ctr_STATUS_BIT_PENDING) != 0 && // Centre is not yet activated
Gbl.Usrs.Me.UsrDat.UsrCod == Ctr->RequesterUsrCod)); // I am the requester
}
@ -1745,7 +1745,7 @@ void Ctr_ChangeCtrStatus (void)
void Ctr_RequestLogo (void)
{
Log_RequestLogo (Sco_SCOPE_CENTRE);
Log_RequestLogo (Sco_SCOPE_CTR);
}
/*****************************************************************************/
@ -1754,7 +1754,7 @@ void Ctr_RequestLogo (void)
void Ctr_ReceiveLogo (void)
{
Log_ReceiveLogo (Sco_SCOPE_CENTRE);
Log_ReceiveLogo (Sco_SCOPE_CTR);
}
/*****************************************************************************/
@ -1918,9 +1918,9 @@ static void Ctr_PutFormToCreateCentre (void)
Ctr = &Gbl.Ctrs.EditingCtr;
/***** Start form *****/
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
Act_FormStart (ActNewCtr);
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST)
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST__)
Act_FormStart (ActReqCtr);
else
Lay_ShowErrorAndExit ("You can not edit centres.");
@ -1946,7 +1946,7 @@ static void Ctr_PutFormToCreateCentre (void)
/***** Centre logo *****/
fprintf (Gbl.F.Out,"<td style=\"width:20px; text-align:left;\">");
Log_DrawLogo (Sco_SCOPE_CENTRE,-1L,"",16,NULL,true);
Log_DrawLogo (Sco_SCOPE_CTR,-1L,"",16,NULL,true);
fprintf (Gbl.F.Out,"</td>");
/***** Institution *****/

View File

@ -39,11 +39,12 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 14.72.4 (2015/02/01)"
#define Log_PLATFORM_VERSION "SWAD 14.72.5 (2015/02/01)"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h | tail -1
/*
Version 14.72.5: Feb 01, 2015 Changed related to administrators. (176805 lines)
Version 14.72.4: Feb 01, 2015 Refactoring of registering and removing admins. (176787 lines)
Version 14.72.3: Feb 01, 2015 Refactoring of registering and removing admins. (177139 lines)
Version 14.72.2: Feb 01, 2015 Refactoring of registering and removing admins. (177496 lines)

View File

@ -81,7 +81,7 @@ void Cht_ShowChatRooms (void)
/***** List available chat rooms *****/
Cht_ShowListOfAvailableChatRooms ();
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Cht_ShowListOfChatRoomsWithUsrs ();
}
@ -185,7 +185,7 @@ void Cht_ShowListOfAvailableChatRooms (void)
sprintf (ThisRoomShortName,"%s",Deg.ShortName);
sprintf (ThisRoomFullName,"%s %s",Txt_Degree,Deg.ShortName);
Cht_WriteLinkToChat1 (ThisRoomCode,ThisRoomShortName,ThisRoomFullName,1,IsLastItemInLevel);
Log_DrawLogo (Sco_SCOPE_DEGREE,Deg.DegCod,Deg.ShortName,16,NULL,true);
Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName,16,NULL,true);
Cht_WriteLinkToChat2 (ThisRoomCode,ThisRoomFullName);
/* Get my courses in this degree from database */

View File

@ -81,8 +81,8 @@ void Con_ShowConnectedUsrs (void)
/***** Put form to update connected users *****/
Act_FormStart (ActLstCon);
/* Users connected belonging to the platform, current degree or current course */
Gbl.Scope.Current = Sco_SCOPE_COURSE;
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Gbl.Scope.Current = Sco_SCOPE_CRS;
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
{
fprintf (Gbl.F.Out,"<div class=\"%s\">%s: ",
The_ClassFormul[Gbl.Prefs.Theme],Txt_Scope);
@ -335,8 +335,8 @@ void Con_ShowGlobalConnectedUsrs (void)
"</td>"
"</tr>",
WithoutCoursesTotal,
(WithoutCoursesTotal == 1) ? Txt_ROLES_SINGULAR_abc[Rol_ROLE_GUEST][Usr_SEX_UNKNOWN] :
Txt_ROLES_PLURAL_abc [Rol_ROLE_GUEST][Usr_SEX_UNKNOWN]);
(WithoutCoursesTotal == 1) ? Txt_ROLES_SINGULAR_abc[Rol_ROLE_GUEST__][Usr_SEX_UNKNOWN] :
Txt_ROLES_PLURAL_abc [Rol_ROLE_GUEST__][Usr_SEX_UNKNOWN]);
/***** End table *****/
fprintf (Gbl.F.Out,"</table>"
@ -372,21 +372,21 @@ void Con_ShowConnectedUsrsBelongingToScope (void)
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM: // Show connected users in the whole platform
case Sco_SCOPE_SYS: // Show connected users in the whole platform
break;
case Sco_SCOPE_INSTITUTION: // Show connected users in the current institution
case Sco_SCOPE_INS: // Show connected users in the current institution
if (Gbl.CurrentIns.Ins.InsCod <= 0) // There is no institution selected
return;
break;
case Sco_SCOPE_CENTRE: // Show connected users in the current centre
case Sco_SCOPE_CTR: // Show connected users in the current centre
if (Gbl.CurrentCtr.Ctr.CtrCod <= 0) // There is no centre selected
return;
break;
case Sco_SCOPE_DEGREE: // Show connected users in the current degree
case Sco_SCOPE_DEG: // Show connected users in the current degree
if (Gbl.CurrentDeg.Deg.DegCod <= 0) // There is no degree selected
return;
break;
case Sco_SCOPE_COURSE: // Show connected users in the current course
case Sco_SCOPE_CRS: // Show connected users in the current course
if (Gbl.CurrentCrs.Crs.CrsCod <= 0) // There is no course selected
return;
break;
@ -398,19 +398,19 @@ void Con_ShowConnectedUsrsBelongingToScope (void)
/***** Number of connected users who belong to current course *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM: // Show connected users in the whole platform
case Sco_SCOPE_SYS: // Show connected users in the whole platform
strcpy (LocationName,Cfg_PLATFORM_SHORT_NAME);
break;
case Sco_SCOPE_INSTITUTION: // Show connected users in the current institution
case Sco_SCOPE_INS: // Show connected users in the current institution
strcpy (LocationName,Gbl.CurrentIns.Ins.ShortName);
break;
case Sco_SCOPE_CENTRE: // Show connected users in the current centre
case Sco_SCOPE_CTR: // Show connected users in the current centre
strcpy (LocationName,Gbl.CurrentCtr.Ctr.ShortName);
break;
case Sco_SCOPE_DEGREE: // Show connected users in the current degree
case Sco_SCOPE_DEG: // Show connected users in the current degree
strcpy (LocationName,Gbl.CurrentDeg.Deg.ShortName);
break;
case Sco_SCOPE_COURSE: // Show connected users in the current course
case Sco_SCOPE_CRS: // Show connected users in the current course
strcpy (LocationName,Gbl.CurrentCrs.Crs.ShortName);
break;
default:
@ -472,7 +472,7 @@ void Con_ShowConnectedUsrsBelongingToScope (void)
static void Con_ComputeConnectedUsrsOfTypeBelongingToCurrentCrs (Rol_Role_t Role)
{
Gbl.Scope.Current = Sco_SCOPE_COURSE;
Gbl.Scope.Current = Sco_SCOPE_CRS;
/***** Get number of connected users who belong to current course *****/
switch (Role)
@ -489,7 +489,7 @@ static void Con_ComputeConnectedUsrsOfTypeBelongingToCurrentCrs (Rol_Role_t Role
/***** List connected users belonging to this course *****/
if (Gbl.Usrs.Me.IBelongToCurrentCrs ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Con_ComputeConnectedUsrsWithARoleCurrentCrsOneByOne (Role);
}
@ -519,28 +519,28 @@ static void Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnMainZone (
/***** List connected users belonging to this location *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM: // Show connected users in the whole platform
if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SUPERUSER)
case Sco_SCOPE_SYS: // Show connected users in the whole platform
if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SYS_ADM)
return;
break;
case Sco_SCOPE_INSTITUTION: // Show connected users in the current institution
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
case Sco_SCOPE_INS: // Show connected users in the current institution
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
return;
break;
case Sco_SCOPE_CENTRE: // Show connected users in the current centre
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
case Sco_SCOPE_CTR: // Show connected users in the current centre
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
return;
break;
case Sco_SCOPE_DEGREE: // Show connected users in the current degree
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
case Sco_SCOPE_DEG: // Show connected users in the current degree
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
return;
break;
case Sco_SCOPE_COURSE: // Show connected users in the current course
case Sco_SCOPE_CRS: // Show connected users in the current course
if (!(Gbl.Usrs.Me.IBelongToCurrentCrs ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
return;
break;
default:
@ -596,28 +596,28 @@ static void Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnRightColum
/***** List connected users belonging to this location *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM: // Show connected users in the whole platform
if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SUPERUSER)
case Sco_SCOPE_SYS: // Show connected users in the whole platform
if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SYS_ADM)
return;
break;
case Sco_SCOPE_INSTITUTION: // Show connected users in the current institution
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
case Sco_SCOPE_INS: // Show connected users in the current institution
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
return;
break;
case Sco_SCOPE_CENTRE: // Show connected users in the current centre
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
case Sco_SCOPE_CTR: // Show connected users in the current centre
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
return;
break;
case Sco_SCOPE_DEGREE: // Show connected users in the current degree
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
case Sco_SCOPE_DEG: // Show connected users in the current degree
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
return;
break;
case Sco_SCOPE_COURSE: // Show connected users in the current course
case Sco_SCOPE_CRS: // Show connected users in the current course
if (!(Gbl.Usrs.Me.IBelongToCurrentCrs ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
return;
break;
default:
@ -635,7 +635,7 @@ static void Con_ShowConnectedUsrsWithARoleBelongingToCurrentLocationOnRightColum
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"3\" style=\"text-align:center;\">");
Act_FormStartId (ActLstCon,Gbl.FormId);
Sco_PutParamScope (Sco_SCOPE_COURSE);
Sco_PutParamScope (Sco_SCOPE_CRS);
Act_LinkFormSubmitId (Txt_Connected_users,The_ClassConnected[Gbl.Prefs.Theme],Gbl.FormId);
fprintf (Gbl.F.Out,"<img src=\"%s/ellipsis32x32.gif\""
" alt=\"%s\" class=\"ICON32x32\" /></a>"
@ -696,7 +696,7 @@ static unsigned Con_GetConnectedGuestsTotal (void)
/***** Get number of connected users not belonging to any course *****/
sprintf (Query,"SELECT COUNT(*) FROM connected"
" WHERE RoleInLastCrs='%u'",
(unsigned) Rol_ROLE_GUEST);
(unsigned) Rol_ROLE_GUEST__);
return (unsigned) DB_QueryCOUNT (Query,"can not get number of connected users who not belong to any course");
}
@ -752,7 +752,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro
/***** Get number of connected users who belong to current course from database *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM: // Show connected users in the whole platform
case Sco_SCOPE_SYS: // Show connected users in the whole platform
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
" FROM connected,usr_data"
@ -765,7 +765,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro
" AND connected.UsrCod=usr_data.UsrCod",
(unsigned) Role);
break;
case Sco_SCOPE_INSTITUTION: // Show connected users in the current institution
case Sco_SCOPE_INS: // Show connected users in the current institution
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
" FROM centres,degrees,courses,crs_usr,connected,usr_data"
@ -789,7 +789,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro
Gbl.CurrentIns.Ins.InsCod,
(unsigned) Role);
break;
case Sco_SCOPE_CENTRE: // Show connected users in the current centre
case Sco_SCOPE_CTR: // Show connected users in the current centre
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
" FROM degrees,courses,crs_usr,connected,usr_data"
@ -811,7 +811,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro
Gbl.CurrentCtr.Ctr.CtrCod,
(unsigned) Role);
break;
case Sco_SCOPE_DEGREE: // Show connected users in the current degree
case Sco_SCOPE_DEG: // Show connected users in the current degree
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
" FROM courses,crs_usr,connected,usr_data"
@ -831,7 +831,7 @@ static unsigned Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Ro
Gbl.CurrentDeg.Deg.DegCod,
(unsigned) Role);
break;
case Sco_SCOPE_COURSE: // Show connected users in the current course
case Sco_SCOPE_CRS: // Show connected users in the current course
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "any role"
sprintf (Query,"SELECT COUNT(DISTINCT connected.UsrCod),COUNT(DISTINCT usr_data.Sex),MIN(usr_data.Sex)"
" FROM crs_usr,connected,usr_data"
@ -1058,12 +1058,12 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
unsigned Minutes;
unsigned Seconds;
bool PutLinkToRecord = (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
Gbl.Scope.Current == Sco_SCOPE_COURSE);
Gbl.Scope.Current == Sco_SCOPE_CRS);
/***** Get connected users who belong to current location from database *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM: // Show connected users in the whole platform
case Sco_SCOPE_SYS: // Show connected users in the whole platform
sprintf (Query,"SELECT DISTINCTROW connected.UsrCod,connected.LastCrsCod,"
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif"
" FROM connected,crs_usr,usr_data"
@ -1072,7 +1072,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
" AND connected.UsrCod=usr_data.UsrCod ORDER BY Dif",
(unsigned) Role);
break;
case Sco_SCOPE_INSTITUTION: // Show connected users in the current institution
case Sco_SCOPE_INS: // Show connected users in the current institution
sprintf (Query,"SELECT DISTINCTROW connected.UsrCod,connected.LastCrsCod,"
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif"
" FROM centres,degrees,courses,crs_usr,connected,usr_data"
@ -1086,7 +1086,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
Gbl.CurrentIns.Ins.InsCod,
(unsigned) Role);
break;
case Sco_SCOPE_CENTRE: // Show connected users in the current centre
case Sco_SCOPE_CTR: // Show connected users in the current centre
sprintf (Query,"SELECT DISTINCTROW connected.UsrCod,connected.LastCrsCod,"
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif"
" FROM degrees,courses,crs_usr,connected,usr_data"
@ -1099,7 +1099,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
Gbl.CurrentCtr.Ctr.CtrCod,
(unsigned) Role);
break;
case Sco_SCOPE_DEGREE: // Show connected users in the current degree
case Sco_SCOPE_DEG: // Show connected users in the current degree
sprintf (Query,"SELECT DISTINCTROW connected.UsrCod,connected.LastCrsCod,"
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif"
" FROM courses,crs_usr,connected,usr_data"
@ -1111,7 +1111,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R
Gbl.CurrentDeg.Deg.DegCod,
(unsigned) Role);
break;
case Sco_SCOPE_COURSE: // Show connected users in the current course
case Sco_SCOPE_CRS: // Show connected users in the current course
sprintf (Query,"SELECT connected.UsrCod,connected.LastCrsCod,"
"UNIX_TIMESTAMP()-UNIX_TIMESTAMP(connected.LastTime) AS Dif"
" FROM crs_usr,connected,usr_data"

View File

@ -99,7 +99,7 @@ void Cty_SeeCtyWithPendingInss (void)
/***** Get countries with pending institutions *****/
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
sprintf (Query,"SELECT institutions.CtyCod,COUNT(*)"
" FROM institutions,countries"
" WHERE (institutions.Status & %u)<>0"
@ -287,7 +287,7 @@ static void Cty_Configuration (bool PrintView)
"</tr>");
/* Map attribution */
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER && !PrintView)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM && !PrintView)
{
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"2\""
@ -513,7 +513,7 @@ void Cty_ListCountries2 (void)
const char *BgColor;
/***** Put link (form) to edit countries *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Lay_PutFormToEdit (ActEdiCty);
/***** Table head *****/
@ -665,9 +665,9 @@ void Cty_ListCountries2 (void)
NumInssWithCountry += NumInssInOtherCtys;
/***** Write institutions with no country *****/
NumStds = Sta_GetTotalNumberOfUsers (Sco_SCOPE_PLATFORM,Rol_ROLE_STUDENT);
NumTchs = Sta_GetTotalNumberOfUsers (Sco_SCOPE_PLATFORM,Rol_ROLE_TEACHER);
NumUsrs = Sta_GetTotalNumberOfUsers (Sco_SCOPE_PLATFORM,Rol_ROLE_UNKNOWN); // NumUsrs >= NumStds + NumTchs
NumStds = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_ROLE_STUDENT);
NumTchs = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_ROLE_TEACHER);
NumUsrs = Sta_GetTotalNumberOfUsers (Sco_SCOPE_SYS,Rol_ROLE_UNKNOWN); // NumUsrs >= NumStds + NumTchs
fprintf (Gbl.F.Out,"<tr>"
"<td></td>"
"<td class=\"DAT\" style=\"text-align:left;\">"

View File

@ -189,7 +189,7 @@ static void Crs_Configuration (bool PrintView)
Lay_PutLinkToPrintView2 ();
/* Link to request enrollment in the current course */
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_GUEST ||
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_GUEST__ ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_VISITOR)
Enr_PutLinkToRequestSignUp ();
@ -212,7 +212,7 @@ static void Crs_Configuration (bool PrintView)
" class=\"TITLE_LOCATION\" title=\"%s\">",
Gbl.CurrentDeg.Deg.WWW,
Gbl.CurrentDeg.Deg.FullName);
Log_DrawLogo (Sco_SCOPE_DEGREE,Gbl.CurrentDeg.Deg.DegCod,
Log_DrawLogo (Sco_SCOPE_DEG,Gbl.CurrentDeg.Deg.DegCod,
Gbl.CurrentDeg.Deg.ShortName,64,NULL,true);
if (PutLink)
fprintf (Gbl.F.Out,"</a>");
@ -670,7 +670,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
Ins_PutParamInsCod (Ins.InsCod);
Act_LinkFormSubmit (Act_GetActionTextFromDB (Act_Actions[ActSeeInsInf].ActCod,ActTxt),
The_ClassFormul[Gbl.Prefs.Theme]);
Log_DrawLogo (Sco_SCOPE_INSTITUTION,Ins.InsCod,Ins.ShortName,
Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.ShortName,
16,NULL,true);
Highlight = (Gbl.CurrentCtr.Ctr.CtrCod <= 0 &&
Gbl.CurrentIns.Ins.InsCod == Ins.InsCod);
@ -708,7 +708,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
Ctr_PutParamCtrCod (Ctr.CtrCod);
Act_LinkFormSubmit (Act_GetActionTextFromDB (Act_Actions[ActSeeCtrInf].ActCod,ActTxt),
The_ClassFormul[Gbl.Prefs.Theme]);
Log_DrawLogo (Sco_SCOPE_CENTRE,Ctr.CtrCod,Ctr.ShortName,
Log_DrawLogo (Sco_SCOPE_CTR,Ctr.CtrCod,Ctr.ShortName,
16,NULL,true);
Highlight = (Gbl.CurrentDeg.Deg.DegCod <= 0 &&
Gbl.CurrentCtr.Ctr.CtrCod == Ctr.CtrCod);
@ -746,7 +746,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
Deg_PutParamDegCod (Deg.DegCod);
Act_LinkFormSubmit (Act_GetActionTextFromDB (Act_Actions[ActSeeDegInf].ActCod,ActTxt),
The_ClassFormul[Gbl.Prefs.Theme]);
Log_DrawLogo (Sco_SCOPE_DEGREE,Deg.DegCod,Deg.ShortName,
Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName,
16,NULL,true);
Highlight = (Gbl.CurrentCrs.Crs.CrsCod <= 0 &&
Gbl.CurrentDeg.Deg.DegCod == Deg.DegCod);
@ -957,7 +957,7 @@ void Crs_ShowCrssOfCurrentDeg (void)
Deg_WriteMenuAllCourses (ActSeeIns,ActSeeCtr,ActSeeDeg,ActSeeCrs);
/***** Put link (form) to edit courses in current degree *****/
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST__)
Lay_PutFormToEdit (ActEdiCrs);
/***** Show list of courses *****/
@ -1415,7 +1415,7 @@ static void Crs_ListCoursesForEdition (void)
/* Degree */
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
" vertical-align:middle;\">");
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
{
Act_FormStart (ActChgCrsDeg);
Crs_PutParamOtherCrsCod (Crs->CrsCod);
@ -1539,7 +1539,7 @@ static void Crs_ListCoursesForEdition (void)
StatusTxt = Crs_GetStatusTxtFromStatusBits (Crs->Status);
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
" vertical-align:middle;\">");
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN &&
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM &&
StatusTxt == Crs_STATUS_PENDING)
{
Act_FormStart (ActChgCrsSta);
@ -1588,7 +1588,7 @@ static void Crs_ListCoursesForEdition (void)
static bool Crs_CheckIfICanEdit (struct Course *Crs)
{
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN || // I am a degree administrator or higher
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM || // I am a degree administrator or higher
((Crs->Status & Crs_STATUS_BIT_PENDING) != 0 && // Course is not yet activated
Gbl.Usrs.Me.UsrDat.UsrCod == Crs->RequesterUsrCod)); // I am the requester
}
@ -1651,9 +1651,9 @@ static void Crs_PutFormToCreateCourse (void)
unsigned Semester;
/***** Start form *****/
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
Act_FormStart (ActNewCrs);
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST)
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST__)
Act_FormStart (ActReqCrs);
else
Lay_ShowErrorAndExit ("You can not edit courses.");
@ -2520,11 +2520,11 @@ void Crs_ChangeCrsDegree (void)
Lay_ShowErrorAndExit ("Code of degree is missing.");
/* Check if I have permission to change course to this degree */
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
ICanChangeCrsToNewDeg = true;
else if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN)
else if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM)
ICanChangeCrsToNewDeg = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_SCOPE_DEGREE,
Sco_SCOPE_DEG,
NewDeg.DegCod);
else
ICanChangeCrsToNewDeg = false;
@ -2996,7 +2996,7 @@ static void Crs_PutLinkToSearchCourses (void)
(Gbl.CurrentIns.Ins.InsCod > 0 ? ActInsReqSch :
(Gbl.CurrentCty.Cty.CtyCod > 0 ? ActCtyReqSch :
ActSysReqSch)))));
Sco_PutParamScope (Sco_SCOPE_PLATFORM);
Sco_PutParamScope (Sco_SCOPE_SYS);
Par_PutHiddenParamUnsigned ("WhatToSearch",(unsigned) Sch_SEARCH_COURSES);
Act_LinkFormSubmit (Txt_Search_courses,The_ClassFormul[Gbl.Prefs.Theme]);
Lay_PutSendIcon ("search",Txt_Search_courses,Txt_Search_courses);
@ -3313,7 +3313,7 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
Deg_PutParamDegCod (Deg.DegCod);
sprintf (Gbl.Title,Txt_Go_to_X,row[2]);
Act_LinkFormSubmit (Gbl.Title,StyleNoBR);
Log_DrawLogo (Sco_SCOPE_DEGREE,Deg.DegCod,Deg.ShortName,
Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName,
16,"vertical-align:top;",true);
fprintf (Gbl.F.Out," %s (%s)"
"</a>"

View File

@ -162,7 +162,7 @@ void Deg_SeeDegWithPendingCrss (void)
/***** Get degrees with pending courses *****/
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_DEG_ADM:
sprintf (Query,"SELECT courses.DegCod,COUNT(*)"
" FROM admin,courses,degrees"
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
@ -172,7 +172,7 @@ void Deg_SeeDegWithPendingCrss (void)
" GROUP BY courses.DegCod ORDER BY degrees.ShortName",
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Crs_STATUS_BIT_PENDING);
break;
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
sprintf (Query,"SELECT courses.DegCod,COUNT(*)"
" FROM courses,degrees"
" WHERE (courses.Status & %u)<>0"
@ -224,7 +224,7 @@ void Deg_SeeDegWithPendingCrss (void)
"<a href=\"%s\" title=\"%s\" class=\"DAT\""
" target=\"_blank\">",
BgColor,Deg.WWW,Deg.FullName);
Log_DrawLogo (Sco_SCOPE_DEGREE,Deg.DegCod,Deg.ShortName,
Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName,
16,"vertical-align:top;",true);
fprintf (Gbl.F.Out,"</a>"
"</td>");
@ -314,8 +314,8 @@ static void Deg_Configuration (bool PrintView)
Lay_PutLinkToPrintView2 ();
/* Link to upload logo */
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN)
Log_PutFormToChangeLogo (Sco_SCOPE_DEGREE);
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
Log_PutFormToChangeLogo (Sco_SCOPE_DEG);
}
fprintf (Gbl.F.Out,"</div>");
@ -332,7 +332,7 @@ static void Deg_Configuration (bool PrintView)
" class=\"TITLE_LOCATION\" title=\"%s\">",
Gbl.CurrentDeg.Deg.WWW,
Gbl.CurrentDeg.Deg.FullName);
Log_DrawLogo (Sco_SCOPE_DEGREE,Gbl.CurrentDeg.Deg.DegCod,
Log_DrawLogo (Sco_SCOPE_DEG,Gbl.CurrentDeg.Deg.DegCod,
Gbl.CurrentDeg.Deg.ShortName,64,NULL,true);
fprintf (Gbl.F.Out,"<br />%s",
Gbl.CurrentDeg.Deg.FullName);
@ -739,15 +739,15 @@ void Deg_WriteBigNameCtyInsCtrDegCrs (void)
if (Gbl.CurrentCrs.Crs.CrsCod <= 0)
{
if (Gbl.CurrentDeg.Deg.DegCod > 0)
Log_DrawLogo (Sco_SCOPE_DEGREE,Gbl.CurrentDeg.Deg.DegCod,
Log_DrawLogo (Sco_SCOPE_DEG,Gbl.CurrentDeg.Deg.DegCod,
Gbl.CurrentDeg.Deg.ShortName,32,
"vertical-align:top; margin-right:8px;",false);
else if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
Log_DrawLogo (Sco_SCOPE_CENTRE,Gbl.CurrentCtr.Ctr.CtrCod,
Log_DrawLogo (Sco_SCOPE_CTR,Gbl.CurrentCtr.Ctr.CtrCod,
Gbl.CurrentCtr.Ctr.ShortName,32,
"vertical-align:top; margin-right:8px;",false);
else if (Gbl.CurrentIns.Ins.InsCod > 0)
Log_DrawLogo (Sco_SCOPE_INSTITUTION,Gbl.CurrentIns.Ins.InsCod,
Log_DrawLogo (Sco_SCOPE_INS,Gbl.CurrentIns.Ins.InsCod,
Gbl.CurrentIns.Ins.ShortName,32,
"vertical-align:top; margin-right:8px;",false);
else if (Gbl.CurrentCty.Cty.CtyCod > 0)
@ -949,7 +949,7 @@ void Deg_WriteSelectorDegTypes (void)
void Deg_SeeDegTypes (void)
{
/***** Put link (form) to edit degree types *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Lay_PutFormToEdit (ActEdiDegTyp);
/***** Get list of degree types *****/
@ -994,7 +994,7 @@ void Deg_ShowDegsOfCurrentCtr (void)
Deg_WriteMenuAllCourses (ActSeeIns,ActSeeCtr,ActSeeDeg,ActUnk);
/***** Put link (form) to edit degrees of the current centre *****/
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST__)
Lay_PutFormToEdit (ActEdiDeg);
/***** Show list of degrees *****/
@ -1280,7 +1280,7 @@ static void Deg_ListOneDegreeForSeeing (struct Degree *Deg,unsigned NumDeg)
"<a href=\"%s\" title=\"%s\" class=\"DAT\" target=\"_blank\">",
TxtClass,BgColor,
Deg->WWW,Deg->FullName);
Log_DrawLogo (Sco_SCOPE_DEGREE,Deg->DegCod,Deg->ShortName,
Log_DrawLogo (Sco_SCOPE_DEG,Deg->DegCod,Deg->ShortName,
16,"vertical-align:top;",true);
fprintf (Gbl.F.Out,"</a>"
"</td>");
@ -1424,13 +1424,13 @@ static void Deg_ListDegreesForEdition (void)
fprintf (Gbl.F.Out,"<td title=\"%s\""
" style=\"width:20px; text-align:left;\">",
Deg->FullName);
Log_DrawLogo (Sco_SCOPE_DEGREE,Deg->DegCod,Deg->ShortName,16,NULL,true);
Log_DrawLogo (Sco_SCOPE_DEG,Deg->DegCod,Deg->ShortName,16,NULL,true);
fprintf (Gbl.F.Out,"</td>");
/* Centre */
fprintf (Gbl.F.Out,"<td class=\"DAT\""
" style=\"text-align:left; vertical-align:middle;\">");
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN) // I can select centre
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) // I can select centre
{
Act_FormStart (ActChgDegCtr);
Deg_PutParamOtherDegCod (Deg->DegCod);
@ -1627,7 +1627,7 @@ static void Deg_ListDegreesForEdition (void)
StatusTxt = Deg_GetStatusTxtFromStatusBits (Deg->Status);
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
" vertical-align:middle;\">");
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN &&
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM &&
StatusTxt == Deg_STATUS_PENDING)
{
Act_FormStart (ActChgDegSta);
@ -1675,7 +1675,7 @@ static void Deg_ListDegreesForEdition (void)
static bool Deg_CheckIfICanEdit (struct Degree *Deg)
{
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN || // I am a centre administrator or higher
return (bool) (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM || // I am a centre administrator or higher
((Deg->Status & Deg_STATUS_BIT_PENDING) != 0 && // Degree is not yet activated
Gbl.Usrs.Me.UsrDat.UsrCod == Deg->RequesterUsrCod)); // I am the requester
}
@ -1798,9 +1798,9 @@ static void Deg_PutFormToCreateDegree (void)
unsigned Year;
/***** Start form *****/
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
Act_FormStart (ActNewDeg);
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST)
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST__)
Act_FormStart (ActReqDeg);
else
Lay_ShowErrorAndExit ("You can not edit degrees.");
@ -1831,7 +1831,7 @@ static void Deg_PutFormToCreateDegree (void)
/***** Degree logo *****/
fprintf (Gbl.F.Out,"<td style=\"width:20px; text-align:left;\">");
Log_DrawLogo (Sco_SCOPE_DEGREE,-1L,"",16,NULL,true);
Log_DrawLogo (Sco_SCOPE_DEG,-1L,"",16,NULL,true);
fprintf (Gbl.F.Out,"</td>");
/***** Centre *****/
@ -2497,7 +2497,7 @@ void Deg_GetListDegsAdminByMe (void)
unsigned NumDeg;
/***** Get degrees admin by me from database *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
sprintf (Query,"SELECT DegCod,CtrCod,DegTypCod,Status,RequesterUsrCod,"
"ShortName,FullName,FirstYear,LastYear,OptYear,WWW"
" FROM degrees"
@ -2505,7 +2505,7 @@ void Deg_GetListDegsAdminByMe (void)
" ORDER BY ShortName",
Gbl.CurrentCtr.Ctr.CtrCod);
// TODO: put an if to select all degrees for admins of all degrees !!!!!!!!!!!!!
else // Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN
else // Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM
sprintf (Query,"SELECT degrees.DegCod,degrees.CtrCod,degrees.DegTypCod,degrees.Status,degrees.RequesterUsrCod,"
"degrees.ShortName,degrees.FullName,degrees.FirstYear,degrees.LastYear,degrees.OptYear,degrees.WWW"
" FROM admin,degrees"
@ -3770,7 +3770,7 @@ void Deg_ChangeDegStatus (void)
void Deg_RequestLogo (void)
{
Log_RequestLogo (Sco_SCOPE_DEGREE);
Log_RequestLogo (Sco_SCOPE_DEG);
}
/*****************************************************************************/
@ -3779,7 +3779,7 @@ void Deg_RequestLogo (void)
void Deg_ReceiveLogo (void)
{
Log_ReceiveLogo (Sco_SCOPE_DEGREE);
Log_ReceiveLogo (Sco_SCOPE_DEG);
}
/*****************************************************************************/
@ -3951,7 +3951,7 @@ void Deg_GetAndWriteDegreesAdminBy (long UsrCod,unsigned ColSpan)
Deg_PutParamDegCod (DegCod);
sprintf (Gbl.Title,Txt_Go_to_X,row[2]);
Act_LinkFormSubmit (Gbl.Title,"DAT_SMALL_NOBR");
Log_DrawLogo (Sco_SCOPE_DEGREE,DegCod,row[1],
Log_DrawLogo (Sco_SCOPE_DEG,DegCod,row[1],
16,"vertical-align:top;",true);
fprintf (Gbl.F.Out,"&nbsp;%s</a>"
"</form>",

View File

@ -96,7 +96,7 @@ void Dpt_SeeDepts (void)
Dpt_GetListDepartments (Gbl.CurrentIns.Ins.InsCod);
/***** Put link (form) to edit departments *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Dpt_PutFormToEditDpts ();
/***** Table head *****/
@ -178,7 +178,7 @@ void Dpt_SeeDepts (void)
"</td>"
"</tr>",
Txt_Department_unspecified,
Sta_GetTotalNumberOfUsers (Sco_SCOPE_INSTITUTION,
Sta_GetTotalNumberOfUsers (Sco_SCOPE_INS,
Rol_ROLE_TEACHER) - NumTchsInsWithDpt);
/***** Table end *****/

View File

@ -452,7 +452,7 @@ void Enr_ReqAdminUsrs (void)
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_GUEST:
case Rol_ROLE_GUEST__:
case Rol_ROLE_VISITOR:
case Rol_ROLE_STUDENT:
Enr_AskIfRegRemMe ();
@ -463,25 +463,25 @@ void Enr_ReqAdminUsrs (void)
else
Enr_AskIfRegRemMe ();
break;
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_DEG_ADM:
if (Gbl.CurrentDeg.Deg.DegCod > 0)
Enr_ReqAnotherUsrIDToRegisterRemove ();
else
Enr_AskIfRegRemMe ();
break;
case Rol_ROLE_CTR_ADMIN:
case Rol_ROLE_CTR_ADM:
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
Enr_ReqAnotherUsrIDToRegisterRemove ();
else
Enr_AskIfRegRemMe ();
break;
case Rol_ROLE_INS_ADMIN:
case Rol_ROLE_INS_ADM:
if (Gbl.CurrentIns.Ins.InsCod > 0)
Enr_ReqAnotherUsrIDToRegisterRemove ();
else
Enr_AskIfRegRemMe ();
break;
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
Enr_ShowFormRegRemSeveralUsrs ();
else
@ -524,7 +524,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (void)
Enr_PutFormToRemAllStdsThisCrs ();
/***** Put link to remove old users *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Enr_PutFormToRemOldUsrs ();
/***** Form to send students to be enrolled / removed *****/
@ -818,28 +818,22 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
if (Gbl.CurrentIns.Ins.InsCod > 0)
{
/***** Check if the other user is administrator of the current institution *****/
if ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADMIN && ItsMe) ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
UsrIsInsAdmin = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
Sco_SCOPE_INSTITUTION,
Gbl.CurrentIns.Ins.InsCod);
UsrIsInsAdmin = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
Sco_SCOPE_INS,
Gbl.CurrentIns.Ins.InsCod);
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
{
/***** Check if the other user is administrator of the current centre *****/
if ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADMIN && ItsMe) ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
UsrIsCtrAdmin = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
Sco_SCOPE_CENTRE,
Gbl.CurrentCtr.Ctr.CtrCod);
UsrIsCtrAdmin = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
Sco_SCOPE_CTR,
Gbl.CurrentCtr.Ctr.CtrCod);
if (Gbl.CurrentDeg.Deg.DegCod > 0)
/***** Check if the other user is administrator of the current degree *****/
if ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN && ItsMe) ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
UsrIsDegAdmin = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
Sco_SCOPE_DEGREE,
Gbl.CurrentDeg.Deg.DegCod);
UsrIsDegAdmin = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,
Sco_SCOPE_DEG,
Gbl.CurrentDeg.Deg.DegCod);
}
}
@ -851,9 +845,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Register user in course / Modify user's data *****/
if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER)
{
sprintf (Gbl.Message,UsrBelongsToCrs ? (ItsMe ? Txt_Modify_me_in_the_course_X :
Txt_Modify_user_in_the_course_X) :
@ -880,7 +872,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
if (Gbl.CurrentDeg.Deg.DegCod > 0)
/***** Register user as administrator of degree *****/
if (!UsrIsDegAdmin &&
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
{
sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_degree_X,
Gbl.CurrentDeg.Deg.ShortName);
@ -899,7 +891,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Register user as administrator of centre *****/
if (!UsrIsCtrAdmin &&
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
{
sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_centre_X,
Gbl.CurrentCtr.Ctr.ShortName);
@ -919,7 +911,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Register user as administrator of institution *****/
if (!UsrIsInsAdmin &&
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
{
sprintf (Gbl.Message,Txt_Register_user_as_an_administrator_of_the_institution_X,
Gbl.CurrentIns.Ins.ShortName);
@ -964,8 +956,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
if (Gbl.CurrentIns.Ins.InsCod > 0)
/***** Remove user as an administrator of the degree *****/
if (UsrIsDegAdmin &&
((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN && ItsMe) ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
(ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM))
{
sprintf (Gbl.Message,
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_degree_X :
@ -986,8 +977,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Remove user as an administrator of the centre *****/
if (UsrIsCtrAdmin &&
((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADMIN && ItsMe) ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
(ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM))
{
sprintf (Gbl.Message,
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_centre_X :
@ -1009,8 +999,7 @@ static bool Enr_PutActionsRegRemOneUsr (bool ItsMe)
/***** Remove user as an administrator of the institution *****/
if (UsrIsInsAdmin &&
((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADMIN && ItsMe) ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
(ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
{
sprintf (Gbl.Message,
ItsMe ? Txt_Remove_me_as_an_administrator_of_the_institution_X :
@ -1096,7 +1085,7 @@ static void Enr_PutActionsRegRemSeveralUsrs (void)
Txt_Register_the_users_indicated_in_step_1_and_remove_the_users_not_indicated);
/***** Only for superusers *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
fprintf (Gbl.F.Out,"<li>"
"<input type=\"radio\" name=\"RegRemAction\" value=\"%u\" />"
"%s</li>",
@ -1169,8 +1158,8 @@ void Enr_ReceiveFormUsrsCrs (void)
case Rol_ROLE_TEACHER:
switch (Gbl.Usrs.Me.LoggedRole) // Can I register/remove teachers?
{
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_SUPERUSER: // Yes, I can
case Rol_ROLE_DEG_ADM:
case Rol_ROLE_SYS_ADM: // Yes, I can
break;
default: // No, I can not (TODO: teachers should be able to register/remove existing teachers)
Lay_ShowErrorAndExit ("You are not allowed to perform this action."); // If user manipulated the form
@ -1218,7 +1207,7 @@ void Enr_ReceiveFormUsrsCrs (void)
WhatToDo.RegisterUsrs = true;
break;
case Enr_ELIMINATE_USRS_FROM_PLATFORM:
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
{
WhatToDo.RemoveUsrs = true;
WhatToDo.RemoveSpecifiedUsrs = true;
@ -1290,11 +1279,11 @@ void Enr_ReceiveFormUsrsCrs (void)
switch (RegRemRole)
{
case Rol_ROLE_STUDENT:
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
LstCurrentUsrs = &Gbl.Usrs.LstStds;
break;
case Rol_ROLE_TEACHER:
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_CRS,NULL,false);
LstCurrentUsrs = &Gbl.Usrs.LstTchs;
break;
default:
@ -1796,7 +1785,7 @@ unsigned Enr_RemAllStdsInCrs (struct Course *Crs)
/***** Get list of students in current course *****/
Gbl.Usrs.ClassPhoto.AllGroups = true; // Get all the students of the current course
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
NumStdsInCrs = Gbl.Usrs.LstStds.NumUsrs;
/***** Remove all the students *****/
@ -1832,7 +1821,7 @@ void Enr_ReqSignUpInCrs (void)
Gbl.CurrentCrs.Crs.FullName);
Lay_ShowAlert (Lay_WARNING,Gbl.Message);
}
else if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_GUEST ||
else if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_GUEST__ ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_VISITOR)
/***** Show form to modify only the user's role or the user's data *****/
Rec_ShowFormSignUpWithMyCommonRecord ();
@ -2139,13 +2128,13 @@ void Enr_ShowEnrollmentRequests (void)
"</td>"
"<td style=\"text-align:left; vertical-align:middle;\">",
The_ClassFormul[Gbl.Prefs.Theme],Txt_Scope);
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
1 << Sco_SCOPE_COUNTRY |
1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE |
1 << Sco_SCOPE_DEGREE |
1 << Sco_SCOPE_COURSE;
Gbl.Scope.Default = Sco_SCOPE_COURSE;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
1 << Sco_SCOPE_CTY |
1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR |
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_CRS;
Sco_GetScope ();
Sco_PutSelectorScope (false);
fprintf (Gbl.F.Out,"</td>"
@ -2168,8 +2157,8 @@ void Enr_ShowEnrollmentRequests (void)
case Rol_ROLE_TEACHER:
Roles = (1 << Rol_ROLE_STUDENT) | (1 << Rol_ROLE_TEACHER);
break;
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_DEG_ADM:
case Rol_ROLE_SYS_ADM:
Roles = (1 << Rol_ROLE_TEACHER);
break;
default:
@ -2187,7 +2176,7 @@ void Enr_ShowEnrollmentRequests (void)
/***** Build query *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM: // Show requesters for the whole platform
case Sco_SCOPE_SYS: // Show requesters for the whole platform
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
@ -2200,7 +2189,7 @@ void Enr_ShowEnrollmentRequests (void)
Gbl.Usrs.Me.UsrDat.UsrCod,
Roles);
break;
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_DEG_ADM:
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
" FROM admin,courses,crs_usr_requests"
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
@ -2211,7 +2200,7 @@ void Enr_ShowEnrollmentRequests (void)
Gbl.Usrs.Me.UsrDat.UsrCod,
Roles);
break;
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
sprintf (Query,"SELECT ReqCod,CrsCod,UsrCod,Role,DATE_FORMAT(RequestTime,'%%Y%%m%%d%%H%%i%%S')"
" FROM crs_usr_requests WHERE ((1<<Role)&%u)<>0"
" ORDER BY RequestTime DESC",
@ -2222,7 +2211,7 @@ void Enr_ShowEnrollmentRequests (void)
break;
}
break;
case Sco_SCOPE_INSTITUTION: // Show requesters for the current institution
case Sco_SCOPE_INS: // Show requesters for the current institution
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
@ -2240,7 +2229,7 @@ void Enr_ShowEnrollmentRequests (void)
Gbl.CurrentIns.Ins.InsCod,
Roles);
break;
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_DEG_ADM:
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
" FROM admin,centres,degrees,courses,crs_usr_requests"
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
@ -2255,7 +2244,7 @@ void Enr_ShowEnrollmentRequests (void)
Gbl.CurrentIns.Ins.InsCod,
Roles);
break;
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
" FROM centres,degrees,courses,crs_usr_requests"
" WHERE centres.InsCod='%ld'"
@ -2272,7 +2261,7 @@ void Enr_ShowEnrollmentRequests (void)
break;
}
break;
case Sco_SCOPE_CENTRE: // Show requesters for the current centre
case Sco_SCOPE_CTR: // Show requesters for the current centre
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
@ -2289,7 +2278,7 @@ void Enr_ShowEnrollmentRequests (void)
Gbl.CurrentCtr.Ctr.CtrCod,
Roles);
break;
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_DEG_ADM:
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
" FROM admin,degrees,courses,crs_usr_requests"
" WHERE admin.UsrCod='%ld' AND admin.Scope='Deg'"
@ -2303,7 +2292,7 @@ void Enr_ShowEnrollmentRequests (void)
Gbl.CurrentCtr.Ctr.CtrCod,
Roles);
break;
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
" FROM degrees,courses,crs_usr_requests"
" WHERE degrees.CtrCod='%ld'"
@ -2319,7 +2308,7 @@ void Enr_ShowEnrollmentRequests (void)
break;
}
break;
case Sco_SCOPE_DEGREE: // Show requesters for the current degree
case Sco_SCOPE_DEG: // Show requesters for the current degree
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
@ -2335,8 +2324,8 @@ void Enr_ShowEnrollmentRequests (void)
Gbl.CurrentDeg.Deg.DegCod,
Roles);
break;
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_DEG_ADM:
case Rol_ROLE_SYS_ADM:
sprintf (Query,"SELECT crs_usr_requests.ReqCod,crs_usr_requests.CrsCod,crs_usr_requests.UsrCod,crs_usr_requests.Role,DATE_FORMAT(crs_usr_requests.RequestTime,'%%Y%%m%%d%%H%%i%%S')"
" FROM courses,crs_usr_requests"
" WHERE courses.DegCod='%ld'"
@ -2351,12 +2340,12 @@ void Enr_ShowEnrollmentRequests (void)
break;
}
break;
case Sco_SCOPE_COURSE: // Show requesters for the current course
case Sco_SCOPE_CRS: // Show requesters for the current course
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_DEG_ADM:
case Rol_ROLE_SYS_ADM:
sprintf (Query,"SELECT ReqCod,CrsCod,UsrCod,Role,DATE_FORMAT(RequestTime,'%%Y%%m%%d%%H%%i%%S')"
" FROM crs_usr_requests"
" WHERE CrsCod='%ld'"
@ -2597,7 +2586,7 @@ void Enr_ReqRegRemUsr (void)
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_GUEST:
case Rol_ROLE_GUEST__:
case Rol_ROLE_VISITOR:
case Rol_ROLE_STUDENT:
Enr_AskIfRegRemMe ();
@ -2608,25 +2597,25 @@ void Enr_ReqRegRemUsr (void)
else
Enr_AskIfRegRemMe ();
break;
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_DEG_ADM:
if (Gbl.CurrentDeg.Deg.DegCod > 0)
Enr_ReqAnotherUsrIDToRegisterRemove ();
else
Enr_AskIfRegRemMe ();
break;
case Rol_ROLE_CTR_ADMIN:
case Rol_ROLE_CTR_ADM:
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
Enr_ReqAnotherUsrIDToRegisterRemove ();
else
Enr_AskIfRegRemMe ();
break;
case Rol_ROLE_INS_ADMIN:
case Rol_ROLE_INS_ADM:
if (Gbl.CurrentIns.Ins.InsCod > 0)
Enr_ReqAnotherUsrIDToRegisterRemove ();
else
Enr_AskIfRegRemMe ();
break;
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
Enr_ReqAnotherUsrIDToRegisterRemove ();
break;
default:
@ -2846,7 +2835,7 @@ static void Enr_ShowFormToEditOtherUsr (void)
void Enr_AddAdmToIns (void)
{
Enr_AddAdm (Sco_SCOPE_INSTITUTION,Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentIns.Ins.FullName);
Enr_AddAdm (Sco_SCOPE_INS,Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentIns.Ins.FullName);
}
/*****************************************************************************/
@ -2855,7 +2844,7 @@ void Enr_AddAdmToIns (void)
void Enr_AddAdmToCtr (void)
{
Enr_AddAdm (Sco_SCOPE_CENTRE,Gbl.CurrentCtr.Ctr.CtrCod,Gbl.CurrentCtr.Ctr.FullName);
Enr_AddAdm (Sco_SCOPE_CTR,Gbl.CurrentCtr.Ctr.CtrCod,Gbl.CurrentCtr.Ctr.FullName);
}
/*****************************************************************************/
@ -2864,7 +2853,7 @@ void Enr_AddAdmToCtr (void)
void Enr_AddAdmToDeg (void)
{
Enr_AddAdm (Sco_SCOPE_DEGREE,Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentDeg.Deg.FullName);
Enr_AddAdm (Sco_SCOPE_DEG,Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentDeg.Deg.FullName);
}
/*****************************************************************************/
@ -2874,16 +2863,20 @@ void Enr_AddAdmToDeg (void)
static void Enr_AddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName)
{
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
bool ICanRegister;
if (Cod > 0)
{
/***** Get plain user's ID of the user to add/modify *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{
/* Check if it's allowed to register this administrator in degree */
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
/* Check if I am allowed to register user as administrator in institution/centre/degree */
ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) ||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) ||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM));
if (ICanRegister)
{
/***** Register administrator in current degree in database *****/
/***** Register administrator in current institution/centre/degree in database *****/
Enr_RegisterAdmin (&Gbl.Usrs.Other.UsrDat,Scope,
Cod,InsCtrDegName);
@ -2998,7 +2991,7 @@ static void Enr_ReqRemOrRemUsrFromCrs (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr)
static void Enr_ReqRemAdmOfIns (void)
{
Enr_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,Sco_SCOPE_INSTITUTION,
Enr_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,Sco_SCOPE_INS,
Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentIns.Ins.FullName);
}
@ -3008,7 +3001,7 @@ static void Enr_ReqRemAdmOfIns (void)
static void Enr_ReqRemAdmOfCtr (void)
{
Enr_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,Sco_SCOPE_CENTRE,
Enr_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,Sco_SCOPE_CTR,
Gbl.CurrentCtr.Ctr.CtrCod,Gbl.CurrentCtr.Ctr.FullName);
}
@ -3018,7 +3011,7 @@ static void Enr_ReqRemAdmOfCtr (void)
static void Enr_ReqRemAdmOfDeg (void)
{
Enr_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,Sco_SCOPE_DEGREE,
Enr_ReqRemOrRemAdm (Enr_REQUEST_REMOVE_USR,Sco_SCOPE_DEG,
Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentDeg.Deg.FullName);
}
@ -3028,7 +3021,7 @@ static void Enr_ReqRemAdmOfDeg (void)
void Enr_RemAdmIns (void)
{
Enr_ReqRemOrRemAdm (Enr_REMOVE_USR,Sco_SCOPE_INSTITUTION,
Enr_ReqRemOrRemAdm (Enr_REMOVE_USR,Sco_SCOPE_INS,
Gbl.CurrentIns.Ins.InsCod,Gbl.CurrentIns.Ins.FullName);
}
@ -3038,7 +3031,7 @@ void Enr_RemAdmIns (void)
void Enr_RemAdmCtr (void)
{
Enr_ReqRemOrRemAdm (Enr_REMOVE_USR,Sco_SCOPE_CENTRE,
Enr_ReqRemOrRemAdm (Enr_REMOVE_USR,Sco_SCOPE_CTR,
Gbl.CurrentCtr.Ctr.CtrCod,Gbl.CurrentCtr.Ctr.FullName);
}
@ -3048,7 +3041,7 @@ void Enr_RemAdmCtr (void)
void Enr_RemAdmDeg (void)
{
Enr_ReqRemOrRemAdm (Enr_REMOVE_USR,Sco_SCOPE_DEGREE,
Enr_ReqRemOrRemAdm (Enr_REMOVE_USR,Sco_SCOPE_DEG,
Gbl.CurrentDeg.Deg.DegCod,Gbl.CurrentDeg.Deg.FullName);
}
@ -3069,16 +3062,17 @@ static void Enr_ReqRemOrRemAdm (Enr_ReqDelOrDelUsr_t ReqDelOrDelUsr,Sco_Scope_t
/***** Get user to be removed *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{
/* Check if it's forbidden remove that administrator */
// A superuser can remove any administrator
// An administrator only can remove itself
/* Check if it's forbidden to remove an administrator */
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod);
ICanRemove = (ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER);
ICanRemove = (ItsMe ||
(Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) ||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) ||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM));
if (ICanRemove)
{
/* Check if the other user is and admin of the current institution */
/* Check if the other user is an admin of the current institution/centre/degree */
if (Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod))
{ // The other user is an administrator of current degree ==> ask for removing or remove him
{ // The other user is an administrator of current institution/centre/degree ==> ask for removing or remove her/him
switch (ReqDelOrDelUsr)
{
case Enr_REQUEST_REMOVE_USR: // Ask if remove administrator from current institution
@ -3117,22 +3111,26 @@ static void Enr_ReqAddAdm (Sco_Scope_t Scope,long Cod,const char *InsCtrDegName)
extern const char *Txt_User_not_found_or_you_do_not_have_permission_;
static const Act_Action_t Enr_ActNewAdm[Sco_NUM_SCOPES] =
{
ActUnk, // Sco_SCOPE_NONE
ActUnk, // Sco_SCOPE_PLATFORM,
ActUnk, // Sco_SCOPE_COUNTRY,
ActNewAdmIns, // Sco_SCOPE_INSTITUTION,
ActNewAdmCtr, // Sco_SCOPE_CENTRE,
ActNewAdmDeg, // Sco_SCOPE_DEGREE,
ActUnk, // Sco_SCOPE_COURSE,
ActUnk, // Sco_SCOPE_UNK
ActUnk, // Sco_SCOPE_SYS,
ActUnk, // Sco_SCOPE_CTY,
ActNewAdmIns, // Sco_SCOPE_INS,
ActNewAdmCtr, // Sco_SCOPE_CTR,
ActNewAdmDeg, // Sco_SCOPE_DEG,
ActUnk, // Sco_SCOPE_CRS,
};
bool ICanRegister;
if (Cod > 0)
{
/***** Get user's identificator of the user to register as admin *****/
if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ())
{
/* Check if it's allowed to register this administrator in institution/centre/degree */
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
/* Check if I am allowed to register user as administrator in institution/centre/degree */
ICanRegister = ((Scope == Sco_SCOPE_DEG && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM) ||
(Scope == Sco_SCOPE_CTR && Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM) ||
(Scope == Sco_SCOPE_INS && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM));
if (ICanRegister)
{
if (Usr_CheckIfUsrIsAdm (Gbl.Usrs.Other.UsrDat.UsrCod,Scope,Cod)) // User is yet an administrator of current institution/centre/degree
{
@ -3266,7 +3264,7 @@ void Enr_ModifAndShowUsrCardAndRegInCrsAndGrps (void)
switch ((RegRemAction = (Enr_RegRemOneUsrAction_t) UnsignedNum))
{
case Enr_REGISTER_MODIFY_ONE_USR_IN_CRS:
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER || ItsMe)
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER)
{
IAmTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER); // I am logged as teacher
HeIsTeacher = (Gbl.Usrs.Other.UsrDat.Roles & (1 << Rol_ROLE_TEACHER)); // He/she is already a teacher in any course
@ -3309,49 +3307,46 @@ void Enr_ModifAndShowUsrCardAndRegInCrsAndGrps (void)
Error = true;
break;
case Enr_REGISTER_ONE_DEGREE_ADMIN:
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Enr_ReqAddAdm (Sco_SCOPE_DEGREE,Gbl.CurrentDeg.Deg.DegCod,
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
Enr_ReqAddAdm (Sco_SCOPE_DEG,Gbl.CurrentDeg.Deg.DegCod,
Gbl.CurrentDeg.Deg.FullName);
else
Error = true;
break;
case Enr_REGISTER_ONE_CENTRE_ADMIN:
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Enr_ReqAddAdm (Sco_SCOPE_CENTRE,Gbl.CurrentCtr.Ctr.CtrCod,
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
Enr_ReqAddAdm (Sco_SCOPE_CTR,Gbl.CurrentCtr.Ctr.CtrCod,
Gbl.CurrentCtr.Ctr.FullName);
else
Error = true;
break;
case Enr_REGISTER_ONE_INSTITUTION_ADMIN:
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Enr_ReqAddAdm (Sco_SCOPE_INSTITUTION,Gbl.CurrentIns.Ins.InsCod,
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Enr_ReqAddAdm (Sco_SCOPE_INS,Gbl.CurrentIns.Ins.InsCod,
Gbl.CurrentIns.Ins.FullName);
else
Error = true;
break;
case Enr_REMOVE_ONE_USR_FROM_CRS:
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER || ItsMe)
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_TEACHER)
Enr_ReqRemUsrFromCrs ();
else
Error = true;
break;
case Enr_REMOVE_ONE_DEGREE_ADMIN:
if ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN && ItsMe) ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
Enr_ReqRemAdmOfDeg ();
else
Error = true;
break;
case Enr_REMOVE_ONE_CENTRE_ADMIN:
if ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_CTR_ADMIN && ItsMe) ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (ItsMe || Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
Enr_ReqRemAdmOfCtr ();
else
Error = true;
break;
case Enr_REMOVE_ONE_INSTITUTION_ADMIN:
if ((Gbl.Usrs.Me.LoggedRole == Rol_ROLE_INS_ADMIN && ItsMe) ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (ItsMe || Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Enr_ReqRemAdmOfIns ();
else
Error = true;
@ -3498,13 +3493,13 @@ static void Enr_AskIfRemAdm (bool ItsMe,Sco_Scope_t Scope,const char *InsCtrDegN
extern const char *Txt_Remove_user_as_an_administrator;
static const Act_Action_t Enr_ActRemAdm[Sco_NUM_SCOPES] =
{
ActUnk, // Sco_SCOPE_NONE
ActUnk, // Sco_SCOPE_PLATFORM,
ActUnk, // Sco_SCOPE_COUNTRY,
ActRemAdmIns, // Sco_SCOPE_INSTITUTION,
ActRemAdmCtr, // Sco_SCOPE_CENTRE,
ActRemAdmDeg, // Sco_SCOPE_DEGREE,
ActUnk, // Sco_SCOPE_COURSE,
ActUnk, // Sco_SCOPE_UNK
ActUnk, // Sco_SCOPE_SYS,
ActUnk, // Sco_SCOPE_CTY,
ActRemAdmIns, // Sco_SCOPE_INS,
ActRemAdmCtr, // Sco_SCOPE_CTR,
ActRemAdmDeg, // Sco_SCOPE_DEG,
ActUnk, // Sco_SCOPE_CRS,
};
if (Usr_ChkIfUsrCodExists (Gbl.Usrs.Other.UsrDat.UsrCod))

View File

@ -442,8 +442,8 @@ static void Exa_ListExamAnnouncements (Exa_tTypeViewExamAnnouncement_t TypeViewE
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_DEG_ADM:
case Rol_ROLE_SYS_ADM:
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">");
Act_FormStart (ActEdiExaAnn);
Act_LinkFormSubmit (Txt_New_announcement_of_exam,The_ClassFormul[Gbl.Prefs.Theme]);
@ -791,7 +791,7 @@ static void Exa_ShowExamAnnouncement (long ExaCod,Exa_tTypeViewExamAnnouncement_
else
fprintf (Gbl.F.Out,"<a href=\"%s\" target=\"_blank\" class=\"%s\">",
Ins.WWW,StyleTitle);
Log_DrawLogo (Sco_SCOPE_INSTITUTION,Ins.InsCod,Ins.FullName,64,NULL,true);
Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.FullName,64,NULL,true);
fprintf (Gbl.F.Out,"<br />%s%s" \
"</td>" \
"</tr>",
@ -1197,8 +1197,8 @@ static void Exa_ShowExamAnnouncement (long ExaCod,Exa_tTypeViewExamAnnouncement_
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_DEG_ADM:
case Rol_ROLE_SYS_ADM:
/***** Create link to edit this exam announcement *****/
fprintf (Gbl.F.Out,"<tr>" \
"<td style=\"text-align:left;\">");

View File

@ -882,14 +882,14 @@ static const Act_Action_t Brw_ActRecDatFile[Brw_NUM_TYPES_FILE_BROWSER] =
const unsigned long long Brw_MAX_QUOTA_BRIEF[Rol_NUM_ROLES] = // MaxRole is used
{
0, // Rol_ROLE_UNKNOWN
0, // Rol_ROLE_GUEST
0, // Rol_ROLE_GUEST__
0, // Rol_ROLE_VISITOR
32ULL*Brw_GiB, // Rol_ROLE_STUDENT
64ULL*Brw_GiB, // Rol_ROLE_TEACHER
0, // Rol_ROLE_DEG_ADMIN
0, // Rol_ROLE_CTR_ADMIN
0, // Rol_ROLE_INS_ADMIN
0, // Rol_ROLE_SUPERUSER
0, // Rol_ROLE_DEG_ADM
0, // Rol_ROLE_CTR_ADM
0, // Rol_ROLE_INS_ADM
0, // Rol_ROLE_SYS_ADM
};
#define Brw_MAX_FILES_BRIEF 5000
#define Brw_MAX_FOLDS_BRIEF 1000
@ -1362,7 +1362,7 @@ void Brw_GetParAndInitFileBrowser (void)
{
/***** Documents of institution *****/
case ActSeeAdmDocIns: // Access to a documents zone from menu
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
/* These roles can edit documents of institution */
Gbl.FileBrowser.Type = Brw_ADMI_DOCUM_INS;
else
@ -1405,7 +1405,7 @@ void Brw_GetParAndInitFileBrowser (void)
/***** Documents of centre *****/
case ActSeeAdmDocCtr: // Access to a documents zone from menu
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
/* These roles can edit documents of centre */
Gbl.FileBrowser.Type = Brw_ADMI_DOCUM_CTR;
else
@ -1448,7 +1448,7 @@ void Brw_GetParAndInitFileBrowser (void)
/***** Documents of degree *****/
case ActSeeAdmDocDeg: // Access to a documents zone from menu
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
/* These roles can edit documents of degree */
Gbl.FileBrowser.Type = Brw_ADMI_DOCUM_DEG;
else
@ -1495,7 +1495,7 @@ void Brw_GetParAndInitFileBrowser (void)
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
/* These roles can edit documents of course/groups */
Gbl.FileBrowser.Type = (Gbl.CurrentCrs.Grps.GrpCod > 0) ? Brw_ADMI_DOCUM_GRP :
Brw_ADMI_DOCUM_CRS;
@ -1892,7 +1892,7 @@ void Brw_GetParAndInitFileBrowser (void)
// If I belong to the current course or I am superuser, or file browser is briefcase ==> get whether show full tree from form
// Else ==> show full tree (only public files)
Gbl.FileBrowser.ShowOnlyPublicFiles = false;
if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SYS_ADM)
switch (Gbl.FileBrowser.Type)
{
case Brw_SHOW_DOCUM_INS:
@ -2643,8 +2643,8 @@ void Brw_AskEditWorksCrs (void)
Usr_ShowFormsToSelectUsrListType (ActReqAsgWrkCrs);
/***** Get and order lists of users from this course *****/
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_CRS,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
if (Gbl.Usrs.LstTchs.NumUsrs ||
Gbl.Usrs.LstStds.NumUsrs)
@ -3123,7 +3123,7 @@ static void Brw_ShowFileBrowser (void)
static void Brw_WriteTopBeforeShowingFileBrowser (void)
{
bool IAmTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER );
bool IAmSuperuser = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER);
bool IAmSuperuser = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
/***** Update last access to this file browser *****/
Brw_UpdateLastAccess ();
@ -3132,27 +3132,27 @@ static void Brw_WriteTopBeforeShowingFileBrowser (void)
switch (Gbl.FileBrowser.Type)
{
case Brw_SHOW_DOCUM_INS:
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
Brw_PutFormToShowOrAdmin (Brw_ADMIN,ActAdmDocIns);
break;
case Brw_ADMI_DOCUM_INS:
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
Brw_PutFormToShowOrAdmin (Brw_SHOW,ActSeeDocIns);
break;
case Brw_SHOW_DOCUM_CTR:
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
Brw_PutFormToShowOrAdmin (Brw_ADMIN,ActAdmDocCtr);
break;
case Brw_ADMI_DOCUM_CTR:
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_CTR_ADM)
Brw_PutFormToShowOrAdmin (Brw_SHOW,ActSeeDocCtr);
break;
case Brw_SHOW_DOCUM_DEG:
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
Brw_PutFormToShowOrAdmin (Brw_ADMIN,ActAdmDocDeg);
break;
case Brw_ADMI_DOCUM_DEG:
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
Brw_PutFormToShowOrAdmin (Brw_SHOW,ActSeeDocDeg);
break;
case Brw_SHOW_DOCUM_CRS:
@ -8463,15 +8463,15 @@ void Brw_ShowFileMetadata (void)
switch (Gbl.FileBrowser.Type)
{
case Brw_SHOW_DOCUM_INS:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_INS_ADMIN)
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_INS_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_SHOW_DOCUM_CTR:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_CTR_ADMIN)
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_CTR_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_SHOW_DOCUM_DEG:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_DEG_ADMIN)
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_DEG_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_SHOW_DOCUM_CRS:
@ -8880,15 +8880,15 @@ void Brw_DownloadFile (void)
switch (Gbl.FileBrowser.Type)
{
case Brw_SHOW_DOCUM_INS:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_INS_ADMIN)
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_INS_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_SHOW_DOCUM_CTR:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_CTR_ADMIN)
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_CTR_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_SHOW_DOCUM_DEG:
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_DEG_ADMIN)
if (Gbl.Usrs.Me.LoggedRole < Rol_ROLE_DEG_ADM)
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
break;
case Brw_SHOW_DOCUM_CRS:
@ -9026,7 +9026,7 @@ static bool Brw_CheckIfICanEditFileMetadata (long PublisherUsrCod)
else // The file has no publisher
{
ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
if ((ZoneUsrCod <= 0 && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER) || // It's a zone without owner and I am a superuser (I may be the future owner)
if ((ZoneUsrCod <= 0 && Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM) || // It's a zone without owner and I am a superuser (I may be the future owner)
ZoneUsrCod == Gbl.Usrs.Me.UsrDat.UsrCod) // I am the owner
return true;
}
@ -10209,8 +10209,8 @@ static bool Brw_CheckIfIHavePermissionFileOrFolderCommon (void)
return (Gbl.Usrs.Me.UsrDat.UsrCod == PublisherUsrCod); // Am I the publisher of subtree?
case Rol_ROLE_TEACHER:
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_DEG_ADM:
case Rol_ROLE_SYS_ADM:
return true;
default:
return false;
@ -10604,7 +10604,7 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
Deg_PutParamDegCod (InsCod);
sprintf (Gbl.Title,Txt_Go_to_X,InsShortName);
Act_LinkFormSubmit (Gbl.Title,"DAT");
Log_DrawLogo (Sco_SCOPE_INSTITUTION,InsCod,InsShortName,
Log_DrawLogo (Sco_SCOPE_INS,InsCod,InsShortName,
16,"vertical-align:top;",true);
fprintf (Gbl.F.Out,"&nbsp;%s</a>"
"</form>",
@ -10622,7 +10622,7 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
Deg_PutParamDegCod (CtrCod);
sprintf (Gbl.Title,Txt_Go_to_X,CtrShortName);
Act_LinkFormSubmit (Gbl.Title,"DAT");
Log_DrawLogo (Sco_SCOPE_CENTRE,CtrCod,CtrShortName,
Log_DrawLogo (Sco_SCOPE_CTR,CtrCod,CtrShortName,
16,"vertical-align:top;",true);
fprintf (Gbl.F.Out,"&nbsp;%s</a>"
"</form>",
@ -10640,7 +10640,7 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
Deg_PutParamDegCod (DegCod);
sprintf (Gbl.Title,Txt_Go_to_X,DegShortName);
Act_LinkFormSubmit (Gbl.Title,"DAT");
Log_DrawLogo (Sco_SCOPE_DEGREE,DegCod,DegShortName,
Log_DrawLogo (Sco_SCOPE_DEG,DegCod,DegShortName,
16,"vertical-align:top;",true);
fprintf (Gbl.F.Out,"&nbsp;%s</a>"
"</form>",

View File

@ -859,7 +859,7 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject)
long PstCod;
bool NewPst = false;
bool ICanModerateForum = false;
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); // If I have permission to move threads...
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // If I have permission to move threads...
/***** Get data of the thread *****/
Thr.ThrCod = ThrCod;
@ -937,20 +937,20 @@ static void For_ShowThreadPosts (long ThrCod,char *LastSubject)
case For_FORUM_SWAD_USRS: case For_FORUM_SWAD_TCHS:
case For_FORUM_GLOBAL_USRS: case For_FORUM_GLOBAL_TCHS:
case For_FORUM_CENTRE_USRS: case For_FORUM_CENTRE_TCHS:
ICanModerateForum = Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER;
ICanModerateForum = Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM;
break;
case For_FORUM_INSTITUTION_USRS: case For_FORUM_INSTITUTION_TCHS:
ICanModerateForum = Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER;
ICanModerateForum = Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM;
break;
case For_FORUM_DEGREE_USRS: case For_FORUM_DEGREE_TCHS:
case For_FORUM_COURSE_TCHS:
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER);
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
break;
case For_FORUM_COURSE_USRS:
ICanModerateForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER);
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
break;
}
@ -1519,35 +1519,35 @@ void For_SetForumTypeAndRestrictAccess (void)
switch (Gbl.Forum.ForumType)
{
case For_FORUM_COURSE_USRS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
Rol_GetMyRoleInCrs (Gbl.Forum.Crs.CrsCod) >= Rol_ROLE_STUDENT);
break;
case For_FORUM_COURSE_TCHS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
Rol_GetMyRoleInCrs (Gbl.Forum.Crs.CrsCod) >= Rol_ROLE_TEACHER);
break;
case For_FORUM_DEGREE_USRS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
Rol_GetMyMaxRoleInDeg (Gbl.Forum.Deg.DegCod) >= Rol_ROLE_STUDENT);
break;
case For_FORUM_DEGREE_TCHS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
Rol_GetMyMaxRoleInDeg (Gbl.Forum.Deg.DegCod) >= Rol_ROLE_TEACHER);
break;
case For_FORUM_CENTRE_USRS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
Rol_GetMyMaxRoleInCtr (Gbl.Forum.Ctr.CtrCod) >= Rol_ROLE_STUDENT);
break;
case For_FORUM_CENTRE_TCHS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
Rol_GetMyMaxRoleInCtr (Gbl.Forum.Ctr.CtrCod) >= Rol_ROLE_TEACHER);
break;
case For_FORUM_INSTITUTION_USRS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
Rol_GetMyMaxRoleInIns (Gbl.Forum.Ins.InsCod) >= Rol_ROLE_STUDENT);
break;
case For_FORUM_INSTITUTION_TCHS:
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
ICanSeeForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
Rol_GetMyMaxRoleInIns (Gbl.Forum.Ins.InsCod) >= Rol_ROLE_TEACHER);
break;
case For_FORUM_GLOBAL_USRS:
@ -1571,7 +1571,7 @@ void For_ShowForumList (void)
{
extern const char *The_ClassFormul[The_NUM_THEMES];
extern const char *Txt_Forums;
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); // If I have permission to move threads...
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // If I have permission to move threads...
bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS];
unsigned NumMyIns;
MYSQL_RES *mysql_resCtr;
@ -1616,7 +1616,7 @@ void For_ShowForumList (void)
switch (Gbl.Forum.WhichForums)
{
case For_ONLY_CURRENT_FORUMS:
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
ICanSeeInsForum = true;
else
ICanSeeInsForum = Usr_CheckIfIBelongToIns (Gbl.CurrentIns.Ins.InsCod);
@ -1626,7 +1626,7 @@ void For_ShowForumList (void)
if (ICanSeeInsForum)
{
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
ICanSeeCtrForum = true;
else
ICanSeeCtrForum = Usr_CheckIfIBelongToCtr (Gbl.CurrentCtr.Ctr.CtrCod);
@ -1635,7 +1635,7 @@ void For_ShowForumList (void)
if (For_WriteLinksToInsForums (Gbl.CurrentIns.Ins.InsCod,true,IsLastItemInLevel) > 0)
if (ICanSeeCtrForum)
{
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
ICanSeeDegForum = true;
else
ICanSeeDegForum = Usr_CheckIfIBelongToDeg (Gbl.CurrentDeg.Deg.DegCod);
@ -1646,7 +1646,7 @@ void For_ShowForumList (void)
/***** Links to forums of current degree *****/
if (For_WriteLinksToDegForums (Gbl.CurrentDeg.Deg.DegCod,true,IsLastItemInLevel) > 0)
if (Gbl.Usrs.Me.IBelongToCurrentCrs ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
/***** Links to forums of current degree *****/
For_WriteLinksToCrsForums (Gbl.CurrentCrs.Crs.CrsCod,true,IsLastItemInLevel);
}
@ -1817,7 +1817,7 @@ static void For_WriteLinksToGblForums (bool IsLastItemInLevel[1+For_FORUM_MAX_LE
static void For_WriteLinksToPlatformForums (bool IsLastForum,bool IsLastItemInLevel[1+For_FORUM_MAX_LEVELS])
{
bool ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
bool ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
Gbl.Usrs.Me.UsrDat.Roles >= (1 << Rol_ROLE_TEACHER));
/***** Link to forum of users about the platform *****/
@ -1843,7 +1843,7 @@ static long For_WriteLinksToInsForums (long InsCod,bool IsLastIns,bool IsLastIte
if (InsCod > 0)
{
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
Rol_GetMyMaxRoleInIns (InsCod) >= Rol_ROLE_TEACHER);
/***** Get data of this institution *****/
@ -1876,7 +1876,7 @@ static long For_WriteLinksToCtrForums (long CtrCod,bool IsLastCtr,bool IsLastIte
if (CtrCod > 0)
{
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
Rol_GetMyMaxRoleInCtr (CtrCod) >= Rol_ROLE_TEACHER);
/***** Get data of this centre *****/
@ -1909,7 +1909,7 @@ static long For_WriteLinksToDegForums (long DegCod,bool IsLastDeg,bool IsLastIte
if (DegCod > 0)
{
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
Rol_GetMyMaxRoleInDeg (DegCod) >= Rol_ROLE_TEACHER);
/***** Get data of this degree *****/
@ -1942,7 +1942,7 @@ static long For_WriteLinksToCrsForums (long CrsCod,bool IsLastCrs,bool IsLastIte
if (CrsCod > 0)
{
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
ICanSeeTeacherForum = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
Rol_GetMyRoleInCrs (CrsCod) >= Rol_ROLE_TEACHER);
/***** Get data of this course *****/
@ -2148,17 +2148,17 @@ static void For_WriteLinkToForum (For_ForumType_t ForumType,Act_Action_t NextAct
{
case For_FORUM_INSTITUTION_USRS:
case For_FORUM_INSTITUTION_TCHS:
Log_DrawLogo (Sco_SCOPE_INSTITUTION,Gbl.Forum.Ins.InsCod,ForumName,
Log_DrawLogo (Sco_SCOPE_INS,Gbl.Forum.Ins.InsCod,ForumName,
16,NULL,true);
break;
case For_FORUM_CENTRE_USRS:
case For_FORUM_CENTRE_TCHS:
Log_DrawLogo (Sco_SCOPE_CENTRE,Gbl.Forum.Ctr.CtrCod,ForumName,
Log_DrawLogo (Sco_SCOPE_CTR,Gbl.Forum.Ctr.CtrCod,ForumName,
16,NULL,true);
break;
case For_FORUM_DEGREE_USRS:
case For_FORUM_DEGREE_TCHS:
Log_DrawLogo (Sco_SCOPE_DEGREE,Gbl.Forum.Deg.DegCod,ForumName,
Log_DrawLogo (Sco_SCOPE_DEG,Gbl.Forum.Deg.DegCod,ForumName,
16,NULL,true);
break;
default:
@ -2360,7 +2360,7 @@ void For_ShowForumThrs (void)
For_ForumOrderType_t Order;
long ThrCods[Pag_ITEMS_PER_PAGE];
struct Pagination PaginationThrs;
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); // If I have permission to move threads...
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // If I have permission to move threads...
/***** Get if there is a thread ready to be moved *****/
if (ICanMoveThreads)
@ -3110,7 +3110,7 @@ void For_ListForumThrs (long ThrCods[Pag_ITEMS_PER_PAGE],struct Pagination *Pagi
const char *DateTime;
struct Pagination PaginationPsts;
const char *Style;
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); // If I have permission to move threads...
bool ICanMoveThreads = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // If I have permission to move threads...
long ThreadInMyClipboard = -1L;
bool ThisThreadIsInMyClipboard;
unsigned Column;

View File

@ -403,7 +403,7 @@ void Gbl_InitializeGlobals (void)
Gbl.Stat.RowsPerPage = 50;
Gbl.Stat.UseStatType = Sta_DEGREES_AND_COURSES;
Gbl.Scope.Current = Sco_SCOPE_COURSE;
Gbl.Scope.Current = Sco_SCOPE_CRS;
Gbl.Usrs.Connected.TimeToRefreshInMs = Con_MAX_TIME_TO_REFRESH_CONNECTED_IN_MS;

View File

@ -1519,7 +1519,7 @@ void Grp_ListGrpsToEditAsgAttOrSvy (struct GroupType *GrpTyp,long Cod,Grp_AsgOrS
fprintf (Gbl.F.Out," checked=\"checked\"");
}
if (!(IBelongToThisGroup ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," onclick=\"uncheckParent(this,'WholeCrs')\" /></td>");
@ -1545,7 +1545,7 @@ void Grp_ReqRegisterInGrps (void)
/***** Put link (form) to edit groups *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Lay_PutFormToEdit (ActReqEdiGrp);
/***** Check if this course has groups *****/
@ -1799,7 +1799,7 @@ static void Grp_ListGrpsToAddOrRemUsrs (struct GroupType *GrpTyp,long UsrCod)
if (UsrBelongsToThisGroup)
fprintf (Gbl.F.Out," checked=\"checked\"");
if (!(IBelongToThisGroup ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
fprintf (Gbl.F.Out," disabled=\"disabled\"");
fprintf (Gbl.F.Out," /></td>");

View File

@ -92,7 +92,7 @@ void Hld_SeeHolidays (void)
Hld_GetListHolidays ();
/***** Put link (form) to edit holidays *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Hld_PutFormToEditHlds ();
/***** Table head *****/

View File

@ -101,13 +101,13 @@ void Ind_ReqIndicatorsCourses (void)
"</td>"
"<td style=\"text-align:left; vertical-align:middle;\">",
The_ClassFormul[Gbl.Prefs.Theme],Txt_Scope);
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
1 << Sco_SCOPE_COUNTRY |
1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE |
1 << Sco_SCOPE_DEGREE |
1 << Sco_SCOPE_COURSE;
Gbl.Scope.Default = Sco_SCOPE_COURSE;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
1 << Sco_SCOPE_CTY |
1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR |
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_CRS;
Sco_GetScope ();
Sco_PutSelectorScope (false);
fprintf (Gbl.F.Out,"</td>"
@ -213,17 +213,17 @@ void Ind_ShowIndicatorsCourses (void)
unsigned NumCrss;
/***** Get users range for statistics of courses *****/
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
1 << Sco_SCOPE_COUNTRY |
1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE |
1 << Sco_SCOPE_DEGREE |
1 << Sco_SCOPE_COURSE;
Gbl.Scope.Default = Sco_SCOPE_COURSE;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
1 << Sco_SCOPE_CTY |
1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR |
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_CRS;
Sco_GetScope ();
/***** Get degree type code *****/
Gbl.Stat.DegTypCod = (Gbl.Scope.Current == Sco_SCOPE_PLATFORM) ? Deg_GetParamOtherDegTypCod () :
Gbl.Stat.DegTypCod = (Gbl.Scope.Current == Sco_SCOPE_SYS) ? Deg_GetParamOtherDegTypCod () :
-1L;
/***** Get department code *****/
@ -266,7 +266,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
if (Gbl.Stat.DptCod > 0)
{
if (Gbl.Stat.DegTypCod > 0)
@ -310,7 +310,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
" ORDER BY degrees.FullName,courses.FullName");
}
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
if (Gbl.Stat.DptCod > 0)
sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM centres,degrees,courses,crs_usr,usr_data"
@ -334,7 +334,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
" ORDER BY degrees.FullName,courses.FullName",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
if (Gbl.Stat.DptCod > 0)
sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM degrees,courses,crs_usr,usr_data"
@ -356,7 +356,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
" ORDER BY degrees.FullName,courses.FullName",
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
if (Gbl.Stat.DptCod > 0)
sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM degrees,courses,crs_usr,usr_data"
@ -378,7 +378,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res)
" ORDER BY degrees.FullName,courses.FullName",
Gbl.CurrentDeg.Deg.DegCod);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
if (Gbl.Stat.DptCod > 0)
sprintf (Query,"SELECT DISTINCTROW degrees.FullName,courses.FullName,courses.CrsCod,courses.InsCrsCod"
" FROM degrees,courses,crs_usr,usr_data"

View File

@ -325,7 +325,7 @@ void Inf_ShowInfo (void)
Inf_PutFormToConfirmIHaveReadInfo (InfoType);
break;
case Rol_ROLE_TEACHER:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
/* Put link (form) to edit this course info */
Inf_PutFormToEditInfo (InfoType);
@ -351,7 +351,7 @@ void Inf_ShowInfo (void)
// TODO: Remove the following lines, here only for debug purposes
/*
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
{
char QueryDebug[512*1024];
char *HTMLBuffer;
@ -382,7 +382,7 @@ void Inf_ShowInfo (void)
// TODO: Remove the following lines, here only for debug purposes
/*
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
{
char QueryDebug[512*1024];
char *HTMLBuffer;

View File

@ -103,7 +103,7 @@ void Ins_SeeInsWithPendingCtrs (void)
/***** Get institutions with pending centres *****/
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_INS_ADMIN:
case Rol_ROLE_INS_ADM:
sprintf (Query,"SELECT centres.InsCod,COUNT(*)"
" FROM centres,ins_admin,institutions"
" WHERE (centres.Status & %u)<>0"
@ -112,7 +112,7 @@ void Ins_SeeInsWithPendingCtrs (void)
" GROUP BY centres.InsCod ORDER BY institutions.ShortName",
(unsigned) Ctr_STATUS_BIT_PENDING,Gbl.Usrs.Me.UsrDat.UsrCod);
break;
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
sprintf (Query,"SELECT centres.InsCod,COUNT(*)"
" FROM centres,institutions"
" WHERE (centres.Status & %u)<>0"
@ -163,7 +163,7 @@ void Ins_SeeInsWithPendingCtrs (void)
" vertical-align:middle; background-color:%s;\">"
"<a href=\"%s\" title=\"%s\" class=\"DAT\" target=\"_blank\">",
BgColor,Ins.WWW,Ins.FullName);
Log_DrawLogo (Sco_SCOPE_INSTITUTION,Ins.InsCod,Ins.ShortName,
Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.ShortName,
16,"vertical-align:top;",true);
fprintf (Gbl.F.Out,"</a>"
"</td>");
@ -255,8 +255,8 @@ static void Ins_Configuration (bool PrintView)
Lay_PutLinkToPrintView2 ();
/* Link to upload logo */
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADMIN)
Log_PutFormToChangeLogo (Sco_SCOPE_INSTITUTION);
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_INS_ADM)
Log_PutFormToChangeLogo (Sco_SCOPE_INS);
}
fprintf (Gbl.F.Out,"</div>");
@ -273,7 +273,7 @@ static void Ins_Configuration (bool PrintView)
" class=\"TITLE_LOCATION\" title=\"%s\">",
Gbl.CurrentIns.Ins.WWW,
Gbl.CurrentIns.Ins.FullName);
Log_DrawLogo (Sco_SCOPE_INSTITUTION,Gbl.CurrentIns.Ins.InsCod,
Log_DrawLogo (Sco_SCOPE_INS,Gbl.CurrentIns.Ins.InsCod,
Gbl.CurrentIns.Ins.ShortName,64,NULL,true);
fprintf (Gbl.F.Out,"<br />%s",Gbl.CurrentIns.Ins.FullName);
if (PutLink)
@ -468,7 +468,7 @@ void Ins_ShowInssOfCurrentCty (void)
Deg_WriteMenuAllCourses (ActSeeIns,ActUnk,ActUnk,ActUnk);
/***** Put link (form) to edit institutions *****/
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST)
if (Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_GUEST__)
Lay_PutFormToEdit (ActEdiIns);
/***** List institutions *****/
@ -536,7 +536,7 @@ static void Ins_ListOneInstitutionForSeeing (struct Institution *Ins,unsigned Nu
"<a href=\"%s\" target=\"_blank\" title=\"%s\">",
BgColor,
Ins->WWW,Ins->FullName);
Log_DrawLogo (Sco_SCOPE_INSTITUTION,Ins->InsCod,Ins->ShortName,
Log_DrawLogo (Sco_SCOPE_INS,Ins->InsCod,Ins->ShortName,
16,NULL,true);
fprintf (Gbl.F.Out,"</a>"
"</td>");
@ -1124,14 +1124,14 @@ static void Ins_ListInstitutionsForEdition (void)
fprintf (Gbl.F.Out,"<td title=\"%s\""
" style=\"width:20px; text-align:left;\">",
Ins->FullName);
Log_DrawLogo (Sco_SCOPE_INSTITUTION,Ins->InsCod,Ins->ShortName,
Log_DrawLogo (Sco_SCOPE_INS,Ins->InsCod,Ins->ShortName,
16,NULL,true);
fprintf (Gbl.F.Out,"</td>");
/* Country */
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
" vertical-align:middle;\">");
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
{
Act_FormStart (ActChgInsCty);
Ins_PutParamOtherInsCod (Ins->InsCod);
@ -1235,7 +1235,7 @@ static void Ins_ListInstitutionsForEdition (void)
StatusTxt = Ins_GetStatusTxtFromStatusBits (Ins->Status);
fprintf (Gbl.F.Out,"<td class=\"DAT\" style=\"text-align:left;"
" vertical-align:middle;\">");
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER &&
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM &&
StatusTxt == Ins_STATUS_PENDING)
{
Act_FormStart (ActChgInsSta);
@ -1285,7 +1285,7 @@ static void Ins_ListInstitutionsForEdition (void)
static bool Ins_CheckIfICanEdit (struct Institution *Ins)
{
return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER || // I am a superuser
return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM || // I am a superuser
((Ins->Status & Ins_STATUS_BIT_PENDING) != 0 && // Institution is not yet activated
Gbl.Usrs.Me.UsrDat.UsrCod == Ins->RequesterUsrCod)); // I am the requester
}
@ -1698,7 +1698,7 @@ void Ins_ChangeInsStatus (void)
void Ins_RequestLogo (void)
{
Log_RequestLogo (Sco_SCOPE_INSTITUTION);
Log_RequestLogo (Sco_SCOPE_INS);
}
/*****************************************************************************/
@ -1707,7 +1707,7 @@ void Ins_RequestLogo (void)
void Ins_ReceiveLogo (void)
{
Log_ReceiveLogo (Sco_SCOPE_INSTITUTION);
Log_ReceiveLogo (Sco_SCOPE_INS);
}
/*****************************************************************************/
@ -1728,9 +1728,9 @@ static void Ins_PutFormToCreateInstitution (void)
Cty_GetListCountries (Cty_GET_ONLY_COUNTRIES);
/***** Start form *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Act_FormStart (ActNewIns);
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST)
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_GUEST__)
Act_FormStart (ActReqIns);
else
Lay_ShowErrorAndExit ("You can not edit institutions.");
@ -1756,7 +1756,7 @@ static void Ins_PutFormToCreateInstitution (void)
/***** Institution logo *****/
fprintf (Gbl.F.Out,"<td style=\"width:20px; text-align:left;\">");
Log_DrawLogo (Sco_SCOPE_INSTITUTION,-1L,"",16,NULL,true);
Log_DrawLogo (Sco_SCOPE_INS,-1L,"",16,NULL,true);
fprintf (Gbl.F.Out,"</td>");
/***** Country *****/

View File

@ -619,7 +619,7 @@ static void Lay_WritePageTopHeading (void)
(Gbl.CurrentIns.Ins.InsCod > 0 ? ActInsSch :
(Gbl.CurrentCty.Cty.CtyCod > 0 ? ActCtySch :
ActSysSch)))));
Sco_PutParamScope (Sco_SCOPE_PLATFORM);
Sco_PutParamScope (Sco_SCOPE_SYS);
Sch_PutFormToSearch (Gbl.Prefs.PathTheme);
fprintf (Gbl.F.Out,"</form>"
"</td>");
@ -875,7 +875,7 @@ static void Lay_ShowRightColumn (void)
fprintf (Gbl.F.Out,"<div id=\"courseconnected\">"); // Used for AJAX based refresh
if (Gbl.CurrentCrs.Crs.CrsCod > 0) // There is a course selected
{
Gbl.Scope.Current = Sco_SCOPE_COURSE;
Gbl.Scope.Current = Sco_SCOPE_CRS;
Con_ShowConnectedUsrsBelongingToScope ();
}
fprintf (Gbl.F.Out,"</div>"); // Used for AJAX based refresh
@ -1163,7 +1163,7 @@ void Lay_RefreshNotifsAndConnected (void)
fprintf (Gbl.F.Out,"|");
if (ShowConnected)
{
Gbl.Scope.Current = Sco_SCOPE_COURSE;
Gbl.Scope.Current = Sco_SCOPE_CRS;
Con_ShowConnectedUsrsBelongingToScope ();
}
fprintf (Gbl.F.Out,"|");
@ -1305,7 +1305,7 @@ void Lay_WriteHeaderClassPhoto (unsigned NumColumns,bool PrintView,bool DrawingC
{
if (!PrintView)
fprintf (Gbl.F.Out,"<a href=\"%s\" target=\"_blank\">",Ins.WWW);
Log_DrawLogo (Sco_SCOPE_INSTITUTION,Ins.InsCod,Ins.ShortName,
Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.ShortName,
Size,NULL,true);
if (!PrintView)
fprintf (Gbl.F.Out,"</a>");
@ -1355,7 +1355,7 @@ void Lay_WriteHeaderClassPhoto (unsigned NumColumns,bool PrintView,bool DrawingC
if (!PrintView)
fprintf (Gbl.F.Out,"<a href=\"%s\" target=\"_blank\" class=\"TIT_CLASSPHOTO\">",
Deg.WWW);
Log_DrawLogo (Sco_SCOPE_DEGREE,Deg.DegCod,Deg.ShortName,Size,NULL,true);
Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName,Size,NULL,true);
if (!PrintView)
fprintf (Gbl.F.Out,"</a>");
}

View File

@ -80,7 +80,7 @@ void Lnk_SeeLinks (void)
Lnk_GetListLinks ();
/***** Put link (form) to edit links *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Lnk_PutFormToEditLinks ();
/***** Table head *****/

View File

@ -73,15 +73,15 @@ void Log_DrawLogo (Sco_Scope_t Scope,long Cod,const char *AltText,
/***** Set variables depending on scope *****/
switch (Scope)
{
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
Folder = Cfg_FOLDER_INS;
Icon = "ins";
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
Folder = Cfg_FOLDER_CTR;
Icon = "ctr";
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
Folder = Cfg_FOLDER_DEG;
Icon = "deg";
break;
@ -145,19 +145,19 @@ void Log_PutFormToChangeLogo (Sco_Scope_t Scope)
/***** Set variables depending on scope *****/
switch (Scope)
{
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
Action = ActReqInsLog;
Cod = Gbl.CurrentIns.Ins.InsCod;
Folder = Cfg_FOLDER_INS;
Icon = "ins";
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
Action = ActReqCtrLog;
Cod = Gbl.CurrentCtr.Ctr.CtrCod;
Folder = Cfg_FOLDER_CTR;
Icon = "ctr";
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
Action = ActReqDegLog;
Cod = Gbl.CurrentDeg.Deg.DegCod;
Folder = Cfg_FOLDER_DEG;
@ -199,13 +199,13 @@ void Log_RequestLogo (Sco_Scope_t Scope)
/***** Set action depending on scope *****/
switch (Scope)
{
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
Action = ActRecInsLog;
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
Action = ActRecCtrLog;
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
Action = ActRecDegLog;
break;
default:
@ -260,17 +260,17 @@ void Log_ReceiveLogo (Sco_Scope_t Scope)
/***** Set variables depending on scope *****/
switch (Scope)
{
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
Cod = Gbl.CurrentIns.Ins.InsCod;
Folder = Cfg_FOLDER_INS;
FunctionConfiguration = Ins_ShowConfiguration;
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
Cod = Gbl.CurrentCtr.Ctr.CtrCod;
Folder = Cfg_FOLDER_CTR;
FunctionConfiguration = Ctr_ShowConfiguration;
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
Cod = Gbl.CurrentDeg.Deg.DegCod;
Folder = Cfg_FOLDER_DEG;
FunctionConfiguration = Deg_ShowConfiguration;

View File

@ -97,7 +97,7 @@ void Mai_SeeMailDomains (void)
Mai_GetListMailDomainsAllowedForNotif ();
/***** Put link (form) to edit mail domains *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Mai_PutFormToEditMailDomains ();
/***** Table head *****/

View File

@ -135,7 +135,7 @@ void Msg_ListEMails (void)
Grp_ShowFormToSelectSeveralGroups (ActMaiStd);
/***** Get and order list of students in this course *****/
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
if (Gbl.Usrs.LstStds.NumUsrs)
{
@ -270,7 +270,7 @@ static void Msg_PutFormMsgUsrs (const char *Content)
/***** Get list of users belonging to the current course *****/
if (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
{
/***** Get and update type of list, number of columns in class photo
and preference about view photos *****/
@ -283,8 +283,8 @@ static void Msg_PutFormMsgUsrs (const char *Content)
Usr_ShowFormsToSelectUsrListType (ActReqMsgUsr);
/***** Get and order lists of users from this course *****/
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_CRS,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
if (Gbl.Usrs.LstTchs.NumUsrs ||
Gbl.Usrs.LstStds.NumUsrs)
@ -374,7 +374,7 @@ void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (bool IsReply)
" background-color:%s;\"",
VERY_LIGHT_BLUE);
if (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
fprintf (Gbl.F.Out," colspan=\"%u\">%s:",
Colspan,Txt_Other_recipients);
else
@ -387,7 +387,7 @@ void Msg_WriteFormUsrsIDsOrNicksOtherRecipients (bool IsReply)
"<td",
Txt_nicks_emails_or_IDs_separated_by_commas);
if (Gbl.Usrs.Me.IBelongToCurrentCrs || // If there is a course selected and I belong to it
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
fprintf (Gbl.F.Out," colspan=\"%u\"",Colspan);
fprintf (Gbl.F.Out," style=\"text-align:left;\">"
"<textarea name=\"OtherRecipients\" cols=\"72\" rows=\"2\">");
@ -1795,11 +1795,11 @@ unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
}
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*) FROM %s",
Table);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(*)"
" FROM centres,degrees,courses,%s"
" WHERE centres.InsCod='%ld'"
@ -1810,7 +1810,7 @@ unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
Gbl.CurrentIns.Ins.InsCod,
Table);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(*)"
" FROM degrees,courses,%s"
" WHERE degrees.CtrCod='%ld'"
@ -1820,7 +1820,7 @@ unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
Gbl.CurrentCtr.Ctr.CtrCod,
Table);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(*)"
" FROM courses,%s"
" WHERE courses.DegCod='%ld'"
@ -1829,7 +1829,7 @@ unsigned Msg_GetNumMsgsSent (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
Gbl.CurrentDeg.Deg.DegCod,
Table);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(*)"
" FROM %s"
" WHERE CrsCod='%ld'",
@ -1863,11 +1863,11 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
"msg_rcv_deleted";
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*) FROM %s",
Table);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(*)"
" FROM centres,degrees,courses,%s,msg_snt"
" WHERE centres.InsCod='%ld'"
@ -1879,7 +1879,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
Gbl.CurrentIns.Ins.InsCod,
Table);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(*)"
" FROM degrees,courses,%s,msg_snt"
" WHERE degrees.CtrCod='%ld'"
@ -1890,7 +1890,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
Gbl.CurrentCtr.Ctr.CtrCod,
Table);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(*)"
" FROM courses,%s,msg_snt"
" WHERE courses.DegCod='%ld'"
@ -1900,7 +1900,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
Gbl.CurrentDeg.Deg.DegCod,
Table);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(*)"
" FROM msg_snt,%s"
" WHERE msg_snt.CrsCod='%ld'"
@ -1917,7 +1917,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
case Msg_STATUS_NOTIFIED:
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT "
"(SELECT COUNT(*)"
" FROM msg_rcv"
@ -1927,7 +1927,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
" FROM msg_rcv_deleted"
" WHERE Notified='Y')");
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT "
"(SELECT COUNT(*)"
" FROM centres,degrees,courses,msg_snt,msg_rcv"
@ -1949,7 +1949,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
Gbl.CurrentIns.Ins.InsCod,
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT "
"(SELECT COUNT(*)"
" FROM degrees,courses,msg_snt,msg_rcv"
@ -1969,7 +1969,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
Gbl.CurrentCtr.Ctr.CtrCod,
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT "
"(SELECT COUNT(*)"
" FROM courses,msg_snt,msg_rcv"
@ -1987,7 +1987,7 @@ unsigned Msg_GetNumMsgsReceived (Sco_Scope_t Scope,Msg_Status_t MsgStatus)
Gbl.CurrentDeg.Deg.DegCod,
Gbl.CurrentDeg.Deg.DegCod);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT "
"(SELECT COUNT(*)"
" FROM msg_snt,msg_rcv"

View File

@ -332,13 +332,13 @@ void Net_ShowWebAndSocialNetworksStats (void)
/***** Get number of users with a web / social network *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT Web,COUNT(*) AS N"
" FROM usr_webs"
" GROUP BY Web"
" ORDER BY N DESC,Web");
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT usr_webs.Web,COUNT(DISTINCT usr_webs.UsrCod) AS N"
" FROM centres,degrees,courses,crs_usr,usr_webs"
" WHERE centres.InsCod='%ld'"
@ -350,7 +350,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
" ORDER BY N DESC,usr_webs.Web",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT usr_webs.Web,COUNT(DISTINCT usr_webs.UsrCod) AS N"
" FROM degrees,courses,crs_usr,usr_webs"
" WHERE degrees.CtrCod='%ld'"
@ -361,7 +361,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
" ORDER BY N DESC,usr_webs.Web",
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT usr_webs.Web,COUNT(DISTINCT usr_webs.UsrCod) AS N"
" FROM courses,crs_usr,usr_webs"
" WHERE courses.DegCod='%ld'"
@ -371,7 +371,7 @@ void Net_ShowWebAndSocialNetworksStats (void)
" ORDER BY N DESC,usr_webs.Web",
Gbl.CurrentDeg.Deg.DegCod);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT usr_webs.Web,COUNT(DISTINCT usr_webs.UsrCod) AS N"
" FROM crs_usr,usr_webs"
" WHERE crs_usr.CrsCod='%ld'"

View File

@ -307,7 +307,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing)
ICanEditNotices = (
TypeNoticesListing == Not_LIST_FULL_NOTICES &&
(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
);
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">");
@ -670,13 +670,13 @@ unsigned Not_GetNumNotices (Sco_Scope_t Scope,Not_Status_t NoticeStatus,unsigned
/***** Get number of notices from database *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
" FROM notices"
" WHERE Status='%u'",
NoticeStatus);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(*),SUM(notices.NumNotif)"
" FROM centres,degrees,courses,notices"
" WHERE centres.InsCod='%ld'"
@ -687,7 +687,7 @@ unsigned Not_GetNumNotices (Sco_Scope_t Scope,Not_Status_t NoticeStatus,unsigned
Gbl.CurrentIns.Ins.InsCod,
NoticeStatus);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(*),SUM(notices.NumNotif)"
" FROM degrees,courses,notices"
" WHERE degrees.CtrCod='%ld'"
@ -697,7 +697,7 @@ unsigned Not_GetNumNotices (Sco_Scope_t Scope,Not_Status_t NoticeStatus,unsigned
Gbl.CurrentCtr.Ctr.CtrCod,
NoticeStatus);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(*),SUM(notices.NumNotif)"
" FROM courses,notices"
" WHERE courses.DegCod='%ld'"
@ -706,7 +706,7 @@ unsigned Not_GetNumNotices (Sco_Scope_t Scope,Not_Status_t NoticeStatus,unsigned
Gbl.CurrentDeg.Deg.DegCod,
NoticeStatus);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
" FROM notices"
" WHERE CrsCod='%ld'"
@ -756,11 +756,11 @@ unsigned Not_GetNumNoticesDeleted (Sco_Scope_t Scope,unsigned *NumNotif)
/***** Get number of notices from database *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
" FROM notices_deleted");
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(*),SUM(notices_deleted.NumNotif)"
" FROM centres,degrees,courses,notices_deleted"
" WHERE centres.InsCod='%ld'"
@ -769,7 +769,7 @@ unsigned Not_GetNumNoticesDeleted (Sco_Scope_t Scope,unsigned *NumNotif)
" AND courses.CrsCod=notices_deleted.CrsCod",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(*),SUM(notices_deleted.NumNotif)"
" FROM degrees,courses,notices_deleted"
" WHERE degrees.CtrCod='%ld'"
@ -777,14 +777,14 @@ unsigned Not_GetNumNoticesDeleted (Sco_Scope_t Scope,unsigned *NumNotif)
" AND courses.CrsCod=notices_deleted.CrsCod",
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(*),SUM(notices_deleted.NumNotif)"
" FROM courses,notices_deleted"
" WHERE courses.DegCod='%ld'"
" AND courses.CrsCod=notices_deleted.CrsCod",
Gbl.CurrentDeg.Deg.DegCod);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
" FROM notices_deleted"
" WHERE CrsCod='%ld'",

View File

@ -810,11 +810,11 @@ bool Pwd_CheckIfICanChangeOtherUsrPassword (long UsrCod)
/* Check if I have permission to change user's password */
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_DEG_ADM:
/* If I am an administrator of current degree,
I only can change the password of users from current degree */
return Usr_CheckIfUsrBelongsToDeg (UsrCod,Gbl.CurrentDeg.Deg.DegCod);
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
return true;
default:
return false;

View File

@ -124,11 +124,11 @@ bool Pho_CheckIfICanChangeOtherUsrPhoto (long UsrCod)
{
case Rol_ROLE_TEACHER:
return Usr_CheckIfUsrBelongsToCrs (UsrCod,Gbl.CurrentCrs.Crs.CrsCod);
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_DEG_ADM:
/* If I am an administrator of current degree,
I only can change the photo of users from current degree */
return Usr_CheckIfUsrBelongsToDeg (UsrCod,Gbl.CurrentDeg.Deg.DegCod);
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
return true;
default:
return false;
@ -777,13 +777,13 @@ bool Pho_ShowUsrPhotoIsAllowed (struct UsrData *UsrDat,char *PhotoURL)
/***** Check if I can see the other's photo *****/
if (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod || // It's me
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
// I always can see my photo
// A superuser always can see any user's photo
ICanSeePhoto = true;
else if (Gbl.Usrs.Me.MaxRole == Rol_ROLE_STUDENT ||
Gbl.Usrs.Me.MaxRole == Rol_ROLE_TEACHER ||
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADMIN)
Gbl.Usrs.Me.LoggedRole >= Rol_ROLE_DEG_ADM)
{
// If the maximum role of both users is student
if (Gbl.Usrs.Me.MaxRole == Rol_ROLE_STUDENT && // My maximum role is student
@ -1982,7 +1982,7 @@ static void Pho_ShowOrPrintListDegrees (Pho_AvgPhotoSeeOrPrint_t SeeOrPrint)
if (SeeOrPrint == Pho_DEGREES_SEE)
fprintf (Gbl.F.Out,"<a href=\"%s\" title=\"%s\" class=\"DAT\" target=\"_blank\">",
Deg.WWW,Deg.FullName);
Log_DrawLogo (Sco_SCOPE_DEGREE,Deg.DegCod,Deg.ShortName,
Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName,
16,"vertical-align:top;",true);
fprintf (Gbl.F.Out,"&nbsp;%s&nbsp;",
Deg.ShortName);

View File

@ -93,7 +93,7 @@ void Plc_SeePlaces (void)
Plc_GetListPlaces ();
/***** Put link (form) to edit places *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Plc_PutFormToEditPlcs ();
/***** Table head *****/

View File

@ -81,7 +81,7 @@ void Plg_ListPlugins (void)
struct Plugin *Plg;
char URL[Cns_MAX_LENGTH_WWW+Ses_LENGTH_SESSION_ID+1];
if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_SYS_ADM)
{
Lay_ShowAlert (Lay_WARNING,Txt_Option_under_development);
return;
@ -91,7 +91,7 @@ void Plg_ListPlugins (void)
Plg_GetListPlugins ();
/***** Put link (form) to edit plugins *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Plg_PutFormToEditPlugins ();
/***** Table start *****/

View File

@ -1530,7 +1530,7 @@ void Rec_ShowCrsRecord (Rec_RecordViewType_t TypeOfView,struct UsrData *UsrDat)
"<tr>"
"<td style=\"width:%upx; text-align:left;\">",
Rec_DEGREE_LOGO_SIZE);
Log_DrawLogo (Sco_SCOPE_DEGREE,Gbl.CurrentDeg.Deg.DegCod,
Log_DrawLogo (Sco_SCOPE_DEG,Gbl.CurrentDeg.Deg.DegCod,
Gbl.CurrentDeg.Deg.ShortName,Rec_DEGREE_LOGO_SIZE,NULL,true);
fprintf (Gbl.F.Out,"</td>"
"<td class=\"%s\" style=\"text-align:center;\">"
@ -2024,8 +2024,8 @@ void Rec_ShowCommonRecord (Rec_RecordViewType_t TypeOfView,
char PhotoURL[PATH_MAX+1];
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
bool IAmTeacher = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER); // My current role is teacher
bool IAmDegAdmin = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN); // My current role is degree administrator
bool IAmSuperuser = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER); // My current role is superuser
bool IAmDegAdmin = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM); // My current role is degree administrator
bool IAmSuperuser = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM); // My current role is superuser
bool HeIsTeacher = (UsrDat->Roles & (1 << Rol_ROLE_TEACHER)); // He/she already is a teacher in any course
bool RoleForm = (TypeOfView == Rec_FORM_SIGN_UP ||
TypeOfView == Rec_FORM_MY_SHARE_RECORD ||
@ -2143,7 +2143,7 @@ void Rec_ShowCommonRecord (Rec_RecordViewType_t TypeOfView,
{
Ins.InsCod = UsrDat->InsCod;
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_MINIMAL_DATA);
Log_DrawLogo (Sco_SCOPE_INSTITUTION,Ins.InsCod,Ins.ShortName,
Log_DrawLogo (Sco_SCOPE_INS,Ins.InsCod,Ins.ShortName,
Rec_INSTITUTION_LOGO_SIZE,NULL,true);
fprintf (Gbl.F.Out,"</td>"
"<td class=\"%s\" style=\"text-align:left;"
@ -2389,7 +2389,7 @@ void Rec_ShowCommonRecord (Rec_RecordViewType_t TypeOfView,
fprintf (Gbl.F.Out,"<select name=\"Role\">");
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_GUEST:
case Rol_ROLE_GUEST__:
case Rol_ROLE_VISITOR:
case Rol_ROLE_STUDENT:
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\" disabled=\"disabled\">%s</option>",
@ -2410,8 +2410,8 @@ void Rec_ShowCommonRecord (Rec_RecordViewType_t TypeOfView,
Txt_ROLES_SINGULAR_Abc[Role][UsrDat->Sex]);
}
break;
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_DEG_ADM:
case Rol_ROLE_SYS_ADM:
for (Role = Rol_ROLE_STUDENT;
Role <= Rol_ROLE_TEACHER;
Role++)
@ -2436,8 +2436,8 @@ void Rec_ShowCommonRecord (Rec_RecordViewType_t TypeOfView,
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\">%s</option>",
(unsigned) Rol_ROLE_STUDENT,Txt_ROLES_SINGULAR_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN]);
break;
case Rol_ROLE_DEG_ADMIN: // An administrator or a superuser can create students and teachers
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_DEG_ADM: // An administrator or a superuser can create students and teachers
case Rol_ROLE_SYS_ADM:
fprintf (Gbl.F.Out,"<option value=\"%u\" selected=\"selected\">%s</option>"
"<option value=\"%u\">%s</option>",
(unsigned) Rol_ROLE_STUDENT,Txt_ROLES_SINGULAR_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN],
@ -2538,7 +2538,7 @@ void Rec_ShowCommonRecord (Rec_RecordViewType_t TypeOfView,
((TypeOfView == Rec_RECORD_LIST ||
TypeOfView == Rec_RECORD_PRINT) &&
(IAmTeacher || IAmSuperuser) &&
(UsrDat->RoleInCurrentCrsDB == Rol_ROLE_GUEST ||
(UsrDat->RoleInCurrentCrsDB == Rol_ROLE_GUEST__ ||
UsrDat->RoleInCurrentCrsDB == Rol_ROLE_STUDENT)))
{
/* Country */
@ -2761,7 +2761,7 @@ void Rec_ShowCommonRecord (Rec_RecordViewType_t TypeOfView,
(UsrDat->Roles & (1 << Rol_ROLE_TEACHER))) || // He/she (me, really) is a teacher in any course
((TypeOfView == Rec_RECORD_LIST ||
TypeOfView == Rec_RECORD_PRINT) &&
(UsrDat->RoleInCurrentCrsDB == Rol_ROLE_GUEST ||
(UsrDat->RoleInCurrentCrsDB == Rol_ROLE_GUEST__ ||
UsrDat->RoleInCurrentCrsDB == Rol_ROLE_TEACHER))) // He/she is a teacher in the current course
{
/* Institution */

View File

@ -67,7 +67,7 @@ unsigned Rol_GetNumAvailableRoles (void)
Rol_Role_t Role;
unsigned NumAvailableRoles = 0;
for (Role = Rol_ROLE_GUEST;
for (Role = Rol_ROLE_GUEST__;
Role < Rol_NUM_ROLES;
Role++)
if (Gbl.Usrs.Me.AvailableRoles & (1 << Role))
@ -86,7 +86,7 @@ Rol_Role_t Rol_GetMaxRole (unsigned Roles)
return Rol_ROLE_TEACHER;
if (Roles & (1 << Rol_ROLE_STUDENT))
return Rol_ROLE_STUDENT;
return Rol_ROLE_GUEST;
return Rol_ROLE_GUEST__;
}
/*****************************************************************************/
@ -108,7 +108,7 @@ Rol_Role_t Rol_GetMyMaxRoleInIns (long InsCod)
NumMyIns++)
if (Gbl.Usrs.Me.MyInstitutions.Inss[NumMyIns].InsCod == InsCod)
return Gbl.Usrs.Me.MyInstitutions.Inss[NumMyIns].MaxRole;
return Rol_ROLE_GUEST;
return Rol_ROLE_GUEST__;
}
return Rol_ROLE_UNKNOWN; // No degree
}
@ -132,7 +132,7 @@ Rol_Role_t Rol_GetMyMaxRoleInCtr (long CtrCod)
NumMyCtr++)
if (Gbl.Usrs.Me.MyCentres.Ctrs[NumMyCtr].CtrCod == CtrCod)
return Gbl.Usrs.Me.MyCentres.Ctrs[NumMyCtr].MaxRole;
return Rol_ROLE_GUEST;
return Rol_ROLE_GUEST__;
}
return Rol_ROLE_UNKNOWN; // No centre
}
@ -156,7 +156,7 @@ Rol_Role_t Rol_GetMyMaxRoleInDeg (long DegCod)
NumMyDeg++)
if (Gbl.Usrs.Me.MyDegrees.Degs[NumMyDeg].DegCod == DegCod)
return Gbl.Usrs.Me.MyDegrees.Degs[NumMyDeg].MaxRole;
return Rol_ROLE_GUEST;
return Rol_ROLE_GUEST__;
}
return Rol_ROLE_UNKNOWN; // No degree
}
@ -180,7 +180,7 @@ Rol_Role_t Rol_GetMyRoleInCrs (long CrsCod)
NumMyCrs++)
if (Gbl.Usrs.Me.MyCourses.Crss[NumMyCrs].CrsCod == CrsCod)
return Gbl.Usrs.Me.MyCourses.Crss[NumMyCrs].Role;
return Rol_ROLE_GUEST;
return Rol_ROLE_GUEST__;
}
return Rol_ROLE_UNKNOWN; // No course
}
@ -301,7 +301,7 @@ void Rol_PutFormToChangeMyRole (bool FormInHead)
fprintf (Gbl.F.Out," style=\"width:%upx;\"",SelectorWidth[Gbl.Prefs.Layout]);
fprintf (Gbl.F.Out," onchange=\"javascript:document.getElementById('%s').submit();\">",
Gbl.FormId);
for (Role = Rol_ROLE_GUEST;
for (Role = Rol_ROLE_GUEST__;
Role < Rol_NUM_ROLES;
Role++)
if (Gbl.Usrs.Me.AvailableRoles & (1 << Role))
@ -423,8 +423,8 @@ static void Rol_PutOneRoleRegRemUsrsCrs (Rol_Role_t Role,bool Checked)
fprintf (Gbl.F.Out," checked=\"checked\"");
switch (Gbl.Usrs.Me.LoggedRole) // Can I select type of user?
{
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_SUPERUSER: // Yes, I can
case Rol_ROLE_DEG_ADM:
case Rol_ROLE_SYS_ADM: // Yes, I can
break;
default: // No, I can not
fprintf (Gbl.F.Out," disabled=\"disabled\"");

View File

@ -47,16 +47,16 @@
#define Rol_NUM_ROLES 9
typedef enum
{
Rol_ROLE_UNKNOWN = 0, // User not logged in
Rol_ROLE_GUEST = 1, // User not belonging to any course
Rol_ROLE_VISITOR = 2, // Student or teacher in other courses...
Rol_ROLE_UNKNOWN = 0, // User not logged in
Rol_ROLE_GUEST__ = 1, // User not belonging to any course
Rol_ROLE_VISITOR = 2, // Student or teacher in other courses...
// ...but not belonging to the current course
Rol_ROLE_STUDENT = 3, // Student in current course
Rol_ROLE_TEACHER = 4, // Teacher in current course
Rol_ROLE_DEG_ADMIN = 5, // Degree administrator
Rol_ROLE_CTR_ADMIN = 6, // Centre administrator
Rol_ROLE_INS_ADMIN = 7, // Institution administrator
Rol_ROLE_SUPERUSER = 8, // Superuser
Rol_ROLE_STUDENT = 3, // Student in current course
Rol_ROLE_TEACHER = 4, // Teacher in current course
Rol_ROLE_DEG_ADM = 5, // Degree administrator
Rol_ROLE_CTR_ADM = 6, // Centre administrator
Rol_ROLE_INS_ADM = 7, // Institution administrator
Rol_ROLE_SYS_ADM = 8, // System administrator (superuser)
} Rol_Role_t;
/*****************************************************************************/

View File

@ -36,13 +36,13 @@
const char *Sco_ScopeAdminDB[Sco_NUM_SCOPES] =
{
NULL, // Sco_SCOPE_NONE
NULL, // Sco_SCOPE_PLATFORM,
NULL, // Sco_SCOPE_COUNTRY,
"Ins", // Sco_SCOPE_INSTITUTION,
"Ctr", // Sco_SCOPE_CENTRE,
"Deg", // Sco_SCOPE_DEGREE,
NULL, // Sco_SCOPE_COURSE,
NULL, // Sco_SCOPE_UNK
NULL, // Sco_SCOPE_SYS,
NULL, // Sco_SCOPE_CTY,
"Ins", // Sco_SCOPE_INS,
"Ctr", // Sco_SCOPE_CTR,
"Deg", // Sco_SCOPE_DEG,
NULL, // Sco_SCOPE_CRS,
};
/*****************************************************************************/
@ -97,26 +97,26 @@ void Sco_PutSelectorScope (bool SendOnChange)
WriteScope = false;
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
WriteScope = true;
break;
case Sco_SCOPE_COUNTRY:
case Sco_SCOPE_CTY:
if (Gbl.CurrentCty.Cty.CtyCod > 0)
WriteScope = true;
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
if (Gbl.CurrentIns.Ins.InsCod > 0)
WriteScope = true;
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
WriteScope = true;
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
if (Gbl.CurrentDeg.Deg.DegCod > 0)
WriteScope = true;
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
WriteScope = true;
break;
@ -134,31 +134,31 @@ void Sco_PutSelectorScope (bool SendOnChange)
fprintf (Gbl.F.Out,">");
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
fprintf (Gbl.F.Out,"%s: %s",
Txt_System,Cfg_PLATFORM_PAGE_TITLE);
break;
case Sco_SCOPE_COUNTRY:
case Sco_SCOPE_CTY:
fprintf (Gbl.F.Out,"%s: %s",
Txt_Country,
Gbl.CurrentCty.Cty.Name[Gbl.Prefs.Language]);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
fprintf (Gbl.F.Out,"%s: %s",
Txt_Institution,
Gbl.CurrentIns.Ins.ShortName);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
fprintf (Gbl.F.Out,"%s: %s",
Txt_Centre,
Gbl.CurrentCtr.Ctr.ShortName);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
fprintf (Gbl.F.Out,"%s: %s",
Txt_Degree,
Gbl.CurrentDeg.Deg.ShortName);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
fprintf (Gbl.F.Out,"%s: %s",
Txt_Course,
Gbl.CurrentCrs.Crs.ShortName);
@ -201,24 +201,24 @@ void Sco_GetScope (void)
Gbl.Scope.Current = (Sco_Scope_t) UnsignedNum;
/***** Avoid impossible scopes *****/
if (Gbl.Scope.Current == Sco_SCOPE_COURSE && Gbl.CurrentCrs.Crs.CrsCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_DEGREE;
if (Gbl.Scope.Current == Sco_SCOPE_CRS && Gbl.CurrentCrs.Crs.CrsCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_DEG;
if (Gbl.Scope.Current == Sco_SCOPE_DEGREE && Gbl.CurrentDeg.Deg.DegCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_CENTRE;
if (Gbl.Scope.Current == Sco_SCOPE_DEG && Gbl.CurrentDeg.Deg.DegCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_CTR;
if (Gbl.Scope.Current == Sco_SCOPE_CENTRE && Gbl.CurrentCtr.Ctr.CtrCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_INSTITUTION;
if (Gbl.Scope.Current == Sco_SCOPE_CTR && Gbl.CurrentCtr.Ctr.CtrCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_INS;
if (Gbl.Scope.Current == Sco_SCOPE_INSTITUTION && Gbl.CurrentIns.Ins.InsCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_COUNTRY;
if (Gbl.Scope.Current == Sco_SCOPE_INS && Gbl.CurrentIns.Ins.InsCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_CTY;
if (Gbl.Scope.Current == Sco_SCOPE_COUNTRY && Gbl.CurrentCty.Cty.CtyCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_PLATFORM;
if (Gbl.Scope.Current == Sco_SCOPE_CTY && Gbl.CurrentCty.Cty.CtyCod <= 0)
Gbl.Scope.Current = Sco_SCOPE_SYS;
/***** Avoid forbidden scopes *****/
if ((Gbl.Scope.Allowed & (1 << Gbl.Scope.Current)) == 0)
Gbl.Scope.Current = Sco_SCOPE_NONE;
Gbl.Scope.Current = Sco_SCOPE_UNK;
}
/*****************************************************************************/
@ -229,25 +229,25 @@ void Sco_SetScopesForListingGuests (void)
{
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_CTR_ADMIN:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_CENTRE;
Gbl.Scope.Default = Sco_SCOPE_CENTRE;
case Rol_ROLE_CTR_ADM:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_CTR;
Gbl.Scope.Default = Sco_SCOPE_CTR;
break;
case Rol_ROLE_INS_ADMIN:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE;
Gbl.Scope.Default = Sco_SCOPE_INSTITUTION;
case Rol_ROLE_INS_ADM:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR;
Gbl.Scope.Default = Sco_SCOPE_INS;
break;
case Rol_ROLE_SUPERUSER:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
1 << Sco_SCOPE_COUNTRY |
1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE;
Gbl.Scope.Default = Sco_SCOPE_INSTITUTION;
case Rol_ROLE_SYS_ADM:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
1 << Sco_SCOPE_CTY |
1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR;
Gbl.Scope.Default = Sco_SCOPE_INS;
break;
default:
Gbl.Scope.Allowed = 0;
Gbl.Scope.Default = Sco_SCOPE_NONE;
Gbl.Scope.Default = Sco_SCOPE_UNK;
break;
}
}
@ -262,25 +262,25 @@ void Sco_SetScopesForListingStudents (void)
{
case Rol_ROLE_STUDENT:
case Rol_ROLE_TEACHER:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_COURSE;
Gbl.Scope.Default = Sco_SCOPE_COURSE;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_CRS;
break;
case Rol_ROLE_DEG_ADMIN:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_DEGREE;
Gbl.Scope.Default = Sco_SCOPE_DEGREE;
case Rol_ROLE_DEG_ADM:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_DEG;
Gbl.Scope.Default = Sco_SCOPE_DEG;
break;
case Rol_ROLE_SUPERUSER:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
1 << Sco_SCOPE_COUNTRY |
1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE |
1 << Sco_SCOPE_DEGREE |
1 << Sco_SCOPE_COURSE;
Gbl.Scope.Default = Sco_SCOPE_COURSE;
case Rol_ROLE_SYS_ADM:
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
1 << Sco_SCOPE_CTY |
1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR |
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_CRS;
break;
default:
Gbl.Scope.Allowed = 0;
Gbl.Scope.Default = Sco_SCOPE_NONE;
Gbl.Scope.Default = Sco_SCOPE_UNK;
break;
}
}

View File

@ -41,13 +41,13 @@
#define Sco_NUM_SCOPES 7
typedef enum
{
Sco_SCOPE_NONE,
Sco_SCOPE_PLATFORM,
Sco_SCOPE_COUNTRY,
Sco_SCOPE_INSTITUTION,
Sco_SCOPE_CENTRE,
Sco_SCOPE_DEGREE,
Sco_SCOPE_COURSE,
Sco_SCOPE_UNK, // Unknown
Sco_SCOPE_SYS, // System
Sco_SCOPE_CTY, // Country
Sco_SCOPE_INS, // Institution
Sco_SCOPE_CTR, // Centre
Sco_SCOPE_DEG, // Degree
Sco_SCOPE_CRS, // Course
} Sco_Scope_t;
/*****************************************************************************/

View File

@ -97,7 +97,7 @@ void Sch_ReqSysSearch (void)
/***** Search courses, teachers, documents... *****/
Sch_GetParamWhatToSearch ();
Sch_PutFormToSearchWithWhatToSearchAndScope (ActSysSch,Sco_SCOPE_PLATFORM);
Sch_PutFormToSearchWithWhatToSearchAndScope (ActSysSch,Sco_SCOPE_SYS);
}
/*****************************************************************************/
@ -116,7 +116,7 @@ void Sch_ReqCtySearch (void)
/***** Search courses, teachers, documents... *****/
Sch_GetParamWhatToSearch ();
Sch_PutFormToSearchWithWhatToSearchAndScope (ActCtySch,Sco_SCOPE_COUNTRY);
Sch_PutFormToSearchWithWhatToSearchAndScope (ActCtySch,Sco_SCOPE_CTY);
}
/*****************************************************************************/
@ -135,7 +135,7 @@ void Sch_ReqInsSearch (void)
/***** Search courses, teachers, documents... *****/
Sch_GetParamWhatToSearch ();
Sch_PutFormToSearchWithWhatToSearchAndScope (ActInsSch,Sco_SCOPE_INSTITUTION);
Sch_PutFormToSearchWithWhatToSearchAndScope (ActInsSch,Sco_SCOPE_INS);
}
/*****************************************************************************/
@ -154,7 +154,7 @@ void Sch_ReqCtrSearch (void)
/***** Search courses, teachers, documents... *****/
Sch_GetParamWhatToSearch ();
Sch_PutFormToSearchWithWhatToSearchAndScope (ActCtrSch,Sco_SCOPE_CENTRE);
Sch_PutFormToSearchWithWhatToSearchAndScope (ActCtrSch,Sco_SCOPE_CTR);
}
/*****************************************************************************/
@ -173,7 +173,7 @@ void Sch_ReqDegSearch (void)
/***** Search courses, teachers, documents... *****/
Sch_GetParamWhatToSearch ();
Sch_PutFormToSearchWithWhatToSearchAndScope (ActDegSch,Sco_SCOPE_DEGREE);
Sch_PutFormToSearchWithWhatToSearchAndScope (ActDegSch,Sco_SCOPE_DEG);
}
/*****************************************************************************/
@ -192,7 +192,7 @@ void Sch_ReqCrsSearch (void)
/***** Search courses, teachers, documents... *****/
Sch_GetParamWhatToSearch ();
Sch_PutFormToSearchWithWhatToSearchAndScope (ActCrsSch,Sco_SCOPE_COURSE);
Sch_PutFormToSearchWithWhatToSearchAndScope (ActCrsSch,Sco_SCOPE_CRS);
}
/*****************************************************************************/
@ -222,7 +222,7 @@ static void Sch_PutFormToSearchWithWhatToSearchAndScope (Act_Action_t Action,Sco
Txt_Courses, // Sch_SEARCH_COURSES
Txt_ROLES_PLURAL_Abc[Rol_ROLE_TEACHER][Usr_SEX_UNKNOWN],// Sch_SEARCH_TEACHERS
Txt_ROLES_PLURAL_Abc[Rol_ROLE_STUDENT][Usr_SEX_UNKNOWN],// Sch_SEARCH_STUDENTS
Txt_ROLES_PLURAL_Abc[Rol_ROLE_GUEST ][Usr_SEX_UNKNOWN],// Sch_SEARCH_GUESTS
Txt_ROLES_PLURAL_Abc[Rol_ROLE_GUEST__ ][Usr_SEX_UNKNOWN],// Sch_SEARCH_GUESTS
Txt_Open_documents, // Sch_SEARCH_OPEN_DOCUMENTS
Txt_DOCUM_in_my_courses, // Sch_SEARCH_DOCUM_IN_MY_COURSES
Txt_My_documents, // Sch_SEARCH_MY_DOCUMENTS
@ -240,12 +240,12 @@ static void Sch_PutFormToSearchWithWhatToSearchAndScope (Act_Action_t Action,Sco
fprintf (Gbl.F.Out,"<div class=\"%s\" style=\"text-align:center;\">"
"%s: ",
The_ClassFormul[Gbl.Prefs.Theme],Txt_Scope);
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
1 << Sco_SCOPE_COUNTRY |
1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE |
1 << Sco_SCOPE_DEGREE |
1 << Sco_SCOPE_COURSE;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
1 << Sco_SCOPE_CTY |
1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR |
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = DefaultScope;
Sco_GetScope ();
Sco_PutSelectorScope (false);
@ -387,7 +387,7 @@ void Sch_SysSearch (void)
if (Gbl.Search.Str[0])
{
/***** Show search form again *****/
Sch_PutFormToSearchWithWhatToSearchAndScope (ActSysSch,Sco_SCOPE_PLATFORM);
Sch_PutFormToSearchWithWhatToSearchAndScope (ActSysSch,Sco_SCOPE_SYS);
/***** Show results of search *****/
Sch_SearchInDB ();
@ -406,7 +406,7 @@ void Sch_CtySearch (void)
if (Gbl.Search.Str[0])
{
/***** Show search form again *****/
Sch_PutFormToSearchWithWhatToSearchAndScope (ActCtySch,Sco_SCOPE_COUNTRY);
Sch_PutFormToSearchWithWhatToSearchAndScope (ActCtySch,Sco_SCOPE_CTY);
/***** Show results of search *****/
Sch_SearchInDB ();
@ -425,7 +425,7 @@ void Sch_InsSearch (void)
if (Gbl.Search.Str[0])
{
/***** Show search form again *****/
Sch_PutFormToSearchWithWhatToSearchAndScope (ActInsSch,Sco_SCOPE_INSTITUTION);
Sch_PutFormToSearchWithWhatToSearchAndScope (ActInsSch,Sco_SCOPE_INS);
/***** Show results of search *****/
Sch_SearchInDB ();
@ -444,7 +444,7 @@ void Sch_CtrSearch (void)
if (Gbl.Search.Str[0])
{
/***** Show search form again *****/
Sch_PutFormToSearchWithWhatToSearchAndScope (ActCtrSch,Sco_SCOPE_CENTRE);
Sch_PutFormToSearchWithWhatToSearchAndScope (ActCtrSch,Sco_SCOPE_CTR);
/***** Show results of search *****/
Sch_SearchInDB ();
@ -464,7 +464,7 @@ void Sch_DegSearch (void)
if (Gbl.Search.Str[0])
{
/***** Show search form again *****/
Sch_PutFormToSearchWithWhatToSearchAndScope (ActDegSch,Sco_SCOPE_DEGREE);
Sch_PutFormToSearchWithWhatToSearchAndScope (ActDegSch,Sco_SCOPE_DEG);
/***** Show results of search *****/
Sch_SearchInDB ();
@ -483,7 +483,7 @@ void Sch_CrsSearch (void)
if (Gbl.Search.Str[0])
{
/***** Show search form again *****/
Sch_PutFormToSearchWithWhatToSearchAndScope (ActCrsSch,Sco_SCOPE_COURSE);
Sch_PutFormToSearchWithWhatToSearchAndScope (ActCrsSch,Sco_SCOPE_CRS);
/***** Show results of search *****/
Sch_SearchInDB ();
@ -506,28 +506,28 @@ static void Sch_SearchInDB (void)
/***** Select courses in all the degrees or in current degree *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_NONE:
case Sco_SCOPE_UNK:
// Not aplicable
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
RangeQuery[0] = '\0';
break;
case Sco_SCOPE_COUNTRY:
case Sco_SCOPE_CTY:
sprintf (RangeQuery," AND institutions.CtyCod='%ld'",
Gbl.CurrentCty.Cty.CtyCod);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (RangeQuery," AND institutions.InsCod='%ld'",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (RangeQuery," AND centres.CtrCod='%ld'",
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (RangeQuery," AND degrees.DegCod='%ld'",
Gbl.CurrentDeg.Deg.DegCod);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (RangeQuery," AND courses.CrsCod='%ld'",
Gbl.CurrentCrs.Crs.CrsCod);
break;
@ -542,7 +542,7 @@ static void Sch_SearchInDB (void)
NumResults += Sch_SearchCoursesInDB (RangeQuery);
NumResults += Sch_SearchUsrsInDB (Rol_ROLE_TEACHER);
NumResults += Sch_SearchUsrsInDB (Rol_ROLE_STUDENT);
NumResults += Sch_SearchUsrsInDB (Rol_ROLE_GUEST);
NumResults += Sch_SearchUsrsInDB (Rol_ROLE_GUEST__);
NumResults += Sch_SearchOpenDocumentsInDB (RangeQuery);
NumResults += Sch_SearchDocumentsInMyCoursesInDB (RangeQuery);
NumResults += Sch_SearchMyDocumentsInDB (RangeQuery);
@ -566,7 +566,7 @@ static void Sch_SearchInDB (void)
NumResults = Sch_SearchUsrsInDB (Rol_ROLE_STUDENT);
break;
case Sch_SEARCH_GUESTS:
NumResults = Sch_SearchUsrsInDB (Rol_ROLE_GUEST);
NumResults = Sch_SearchUsrsInDB (Rol_ROLE_GUEST__);
break;
case Sch_SEARCH_OPEN_DOCUMENTS:
NumResults = Sch_SearchOpenDocumentsInDB (RangeQuery);
@ -595,9 +595,9 @@ static unsigned Sch_SearchInstitutionsInDB (const char *RangeQuery)
char Query[1024+Sch_MAX_LENGTH_SEARCH_QUERY*2];
/***** Check scope *****/
if (Gbl.Scope.Current != Sco_SCOPE_CENTRE &&
Gbl.Scope.Current != Sco_SCOPE_DEGREE &&
Gbl.Scope.Current != Sco_SCOPE_COURSE)
if (Gbl.Scope.Current != Sco_SCOPE_CTR &&
Gbl.Scope.Current != Sco_SCOPE_DEG &&
Gbl.Scope.Current != Sco_SCOPE_CRS)
/***** Check user's permission *****/
if (Sch_CheckIfIHavePermissionToSearch (Sch_SEARCH_INSTITUTIONS))
/***** Split institutions string into words *****/
@ -629,8 +629,8 @@ static unsigned Sch_SearchCentresInDB (const char *RangeQuery)
char Query[1024+Sch_MAX_LENGTH_SEARCH_QUERY*2];
/***** Check scope *****/
if (Gbl.Scope.Current != Sco_SCOPE_DEGREE &&
Gbl.Scope.Current != Sco_SCOPE_COURSE)
if (Gbl.Scope.Current != Sco_SCOPE_DEG &&
Gbl.Scope.Current != Sco_SCOPE_CRS)
/***** Check user's permission *****/
if (Sch_CheckIfIHavePermissionToSearch (Sch_SEARCH_CENTRES))
/***** Split centre string into words *****/
@ -662,7 +662,7 @@ static unsigned Sch_SearchDegreesInDB (const char *RangeQuery)
char Query[1024+Sch_MAX_LENGTH_SEARCH_QUERY*2];
/***** Check scope *****/
if (Gbl.Scope.Current != Sco_SCOPE_COURSE)
if (Gbl.Scope.Current != Sco_SCOPE_CRS)
/***** Check user's permission *****/
if (Sch_CheckIfIHavePermissionToSearch (Sch_SEARCH_DEGREES))
/***** Split degree string into words *****/
@ -839,7 +839,7 @@ static unsigned Sch_SearchOpenDocumentsInDB (const char *RangeQuery)
RangeQuery);
/***** Query database and list documents found *****/
/* if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
/* if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query); */
return Brw_ListDocsFound (Query,Txt_Open_documents);
}
@ -886,7 +886,7 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
(unsigned) Brw_ADMI_DOCUM_GRP,
(unsigned) Brw_ADMI_SHARE_GRP,
(unsigned) Brw_ADMI_MARKS_GRP);
/* if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
/* if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query); */
if (mysql_query (&Gbl.mysql,Query))
DB_ExitOnMySQLError ("can not create temporary table");
@ -944,7 +944,7 @@ static unsigned Sch_SearchDocumentsInMyCoursesInDB (const char *RangeQuery)
RangeQuery);
/***** Query database and list documents found *****/
/* if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
/* if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query); */
NumDocs = Brw_ListDocsFound (Query,Txt_DOCUM_in_my_courses);
@ -1095,7 +1095,7 @@ static unsigned Sch_SearchMyDocumentsInDB (const char *RangeQuery)
(unsigned) Brw_ADMI_BRIEF_USR);
/***** Query database and list documents found *****/
/* if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
/* if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query); */
return Brw_ListDocsFound (Query,Txt_My_documents);
}

View File

@ -399,8 +399,8 @@ void Sta_AskSeeCrsAccesses (void)
Usr_ShowFormsToSelectUsrListType (ActReqAccCrs);
/***** Get and order the lists of users of this course *****/
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_CRS,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
if (Gbl.Usrs.LstTchs.NumUsrs ||
Gbl.Usrs.LstStds.NumUsrs)
@ -539,7 +539,7 @@ void Sta_AskSeeGblAccesses (void)
/***** Put form to go to test edition and configuration *****/
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER))
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM))
{
fprintf (Gbl.F.Out,"<div style=\"padding-bottom:10px; text-align:center;\">");
Sta_PutFormToRequestAccessesCrs ();
@ -586,13 +586,13 @@ void Sta_AskSeeGblAccesses (void)
"</td>"
"<td style=\"text-align:left; vertical-align:middle;\">",
The_ClassFormul[Gbl.Prefs.Theme],Txt_Scope);
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
1 << Sco_SCOPE_COUNTRY |
1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE |
1 << Sco_SCOPE_DEGREE |
1 << Sco_SCOPE_COURSE;
Gbl.Scope.Default = Sco_SCOPE_PLATFORM;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
1 << Sco_SCOPE_CTY |
1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR |
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_SYS;
Sco_GetScope ();
Sco_PutSelectorScope (false);
fprintf (Gbl.F.Out,"</td>"
@ -929,19 +929,19 @@ static bool Sta_SeeAccesses (void)
}
/***** Get users range for access statistics *****/
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
1 << Sco_SCOPE_COUNTRY |
1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE |
1 << Sco_SCOPE_DEGREE |
1 << Sco_SCOPE_COURSE;
Gbl.Scope.Default = Sco_SCOPE_PLATFORM;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
1 << Sco_SCOPE_CTY |
1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR |
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_SYS;
Sco_GetScope ();
}
/***** Check if range of dates is forbidden for me *****/
NumDays = Dat_GetNumDaysBetweenDates (&Gbl.DateRange.DateIni,&Gbl.DateRange.DateEnd);
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER ||
if (!(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM ||
(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER && StatsGlobalOrCourse == STAT_COURSE)))
if (NumDays > Cfg_DAYS_IN_RECENT_LOG)
{
@ -1056,7 +1056,7 @@ static bool Sta_SeeAccesses (void)
{
case STAT_GLOBAL:
/* Scope */
if (Gbl.Scope.Current == Sco_SCOPE_INSTITUTION &&
if (Gbl.Scope.Current == Sco_SCOPE_INS &&
Gbl.CurrentIns.Ins.InsCod > 0)
{
sprintf (QueryAux," AND %s.DegCod IN"
@ -1067,7 +1067,7 @@ static bool Sta_SeeAccesses (void)
LogTable,Gbl.CurrentIns.Ins.InsCod);
strcat (Query,QueryAux);
}
else if (Gbl.Scope.Current == Sco_SCOPE_CENTRE &&
else if (Gbl.Scope.Current == Sco_SCOPE_CTR &&
Gbl.CurrentCtr.Ctr.CtrCod > 0)
{
sprintf (QueryAux," AND %s.DegCod"
@ -1077,14 +1077,14 @@ static bool Sta_SeeAccesses (void)
LogTable,Gbl.CurrentCtr.Ctr.CtrCod);
strcat (Query,QueryAux);
}
else if (Gbl.Scope.Current == Sco_SCOPE_DEGREE &&
else if (Gbl.Scope.Current == Sco_SCOPE_DEG &&
Gbl.CurrentDeg.Deg.DegCod > 0)
{
sprintf (QueryAux," AND %s.DegCod='%ld'",
LogTable,Gbl.CurrentDeg.Deg.DegCod);
strcat (Query,QueryAux);
}
else if (Gbl.Scope.Current == Sco_SCOPE_COURSE &&
else if (Gbl.Scope.Current == Sco_SCOPE_CRS &&
Gbl.CurrentCrs.Crs.CrsCod > 0)
{
sprintf (QueryAux," AND %s.CrsCod='%ld'",
@ -1115,15 +1115,15 @@ static bool Sta_SeeAccesses (void)
break;
case Sta_INS_ADMINS:
sprintf (StrRole," AND %s.Role='%u'",
LogTable,(unsigned) Rol_ROLE_INS_ADMIN);
LogTable,(unsigned) Rol_ROLE_INS_ADM);
break;
case Sta_CTR_ADMINS:
sprintf (StrRole," AND %s.Role='%u'",
LogTable,(unsigned) Rol_ROLE_CTR_ADMIN);
LogTable,(unsigned) Rol_ROLE_CTR_ADM);
break;
case Sta_DEG_ADMINS:
sprintf (StrRole," AND %s.Role='%u'",
LogTable,(unsigned) Rol_ROLE_DEG_ADMIN);
LogTable,(unsigned) Rol_ROLE_DEG_ADM);
break;
case Sta_TEACHERS:
sprintf (StrRole," AND %s.Role='%u'",
@ -1139,7 +1139,7 @@ static bool Sta_SeeAccesses (void)
break;
case Sta_GUESTS:
sprintf (StrRole," AND %s.Role='%u'",
LogTable,(unsigned) Rol_ROLE_GUEST);
LogTable,(unsigned) Rol_ROLE_GUEST__);
break;
case Sta_UNKNOWN_USRS:
sprintf (StrRole," AND %s.Role='%u'",
@ -1264,7 +1264,7 @@ static bool Sta_SeeAccesses (void)
}
/***** Write query for debug *****/
/*
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query);
*/
/***** Make the query *****/
@ -1302,22 +1302,22 @@ static bool Sta_SeeAccesses (void)
default:
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
strcpy (Gbl.Message,Txt_Statistics_of_all_visits);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Gbl.Message,Txt_Statistics_of_visits_to_the_institution_X,
Gbl.CurrentIns.Ins.ShortName);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Gbl.Message,Txt_Statistics_of_visits_to_the_centre_X,
Gbl.CurrentCtr.Ctr.ShortName);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Gbl.Message,Txt_Statistics_of_visits_to_the_degree_X,
Gbl.CurrentDeg.Deg.ShortName);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Gbl.Message,Txt_Statistics_of_visits_to_the_course_X,
Gbl.CurrentCrs.Crs.ShortName);
break;
@ -3490,7 +3490,7 @@ static void Sta_WriteDegree (long DegCod)
fprintf (Gbl.F.Out,"%s\">"
"<a href=\"%s\" class=\"LOG\" target=\"_blank\">",
Deg.FullName,Deg.WWW);
Log_DrawLogo (Sco_SCOPE_DEGREE,Deg.DegCod,Deg.ShortName,
Log_DrawLogo (Sco_SCOPE_DEG,Deg.DegCod,Deg.ShortName,
16,"vertical-align:top;",true);
fprintf (Gbl.F.Out,"&nbsp;%s&nbsp;</a>",
Deg.ShortName);
@ -3637,13 +3637,13 @@ void Sta_ReqUseOfPlatform (void)
fprintf (Gbl.F.Out,"<div class=\"%s\">"
"%s: ",
The_ClassFormul[Gbl.Prefs.Theme],Txt_Scope);
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
1 << Sco_SCOPE_COUNTRY |
1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE |
1 << Sco_SCOPE_DEGREE |
1 << Sco_SCOPE_COURSE;
Gbl.Scope.Default = Sco_SCOPE_PLATFORM;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
1 << Sco_SCOPE_CTY |
1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR |
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_SYS;
Sco_GetScope ();
Sco_PutSelectorScope (false);
@ -3859,7 +3859,7 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
/***** Get number of countries *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
NumCtysTotal = Cty_GetNumCtysTotal ();
NumCtysWithInss = Cty_GetNumCtysWithInss ("");
NumCtysWithCtrs = Cty_GetNumCtysWithCtrs ("");
@ -3869,7 +3869,7 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_ROLE_STUDENT,"");
SubQuery[0] = '\0';
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
NumCtysTotal = 1;
NumCtysWithInss = 1;
sprintf (SubQuery,"institutions.InsCod='%ld' AND ",
@ -3880,7 +3880,7 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
NumCtysTotal = 1;
NumCtysWithInss = 1;
NumCtysWithCtrs = 1;
@ -3891,7 +3891,7 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
NumCtysTotal = 1;
NumCtysWithInss = 1;
NumCtysWithCtrs = 1;
@ -3902,7 +3902,7 @@ static void Sta_GetAndShowNumCtysInSWAD (void)
NumCtysWithTchs = Cty_GetNumCtysWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumCtysWithStds = Cty_GetNumCtysWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
NumCtysTotal = 1;
NumCtysWithInss = 1;
NumCtysWithCtrs = 1;
@ -3973,7 +3973,7 @@ static void Sta_GetAndShowNumInssInSWAD (void)
/***** Get number of institutions *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
NumInssTotal = Ins_GetNumInssTotal ();
NumInssWithCtrs = Ins_GetNumInssWithCtrs ("");
NumInssWithDegs = Ins_GetNumInssWithDegs ("");
@ -3982,7 +3982,7 @@ static void Sta_GetAndShowNumInssInSWAD (void)
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_ROLE_STUDENT,"");
SubQuery[0] = '\0';
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
NumInssTotal = 1;
sprintf (SubQuery,"institutions.InsCod='%ld' AND ",
Gbl.CurrentIns.Ins.InsCod);
@ -3992,7 +3992,7 @@ static void Sta_GetAndShowNumInssInSWAD (void)
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
NumInssTotal = 1;
NumInssWithCtrs = 1;
sprintf (SubQuery,"centres.CtrCod='%ld' AND ",
@ -4002,7 +4002,7 @@ static void Sta_GetAndShowNumInssInSWAD (void)
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
NumInssTotal = 1;
NumInssWithCtrs = 1;
NumInssWithDegs = 1;
@ -4012,7 +4012,7 @@ static void Sta_GetAndShowNumInssInSWAD (void)
NumInssWithTchs = Ins_GetNumInssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumInssWithStds = Ins_GetNumInssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
NumInssTotal = 1;
NumInssWithCtrs = 1;
NumInssWithDegs = 1;
@ -4078,7 +4078,7 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
/***** Get number of centres *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
NumCtrsTotal = Ctr_GetNumCtrsTotal ();
NumCtrsWithDegs = Ctr_GetNumCtrsWithDegs ("");
NumCtrsWithCrss = Ctr_GetNumCtrsWithCrss ("");
@ -4086,7 +4086,7 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_STUDENT,"");
SubQuery[0] = '\0';
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
NumCtrsTotal = Ctr_GetNumCtrsInIns (Gbl.CurrentIns.Ins.InsCod);
sprintf (SubQuery,"institutions.InsCod='%ld' AND ",
Gbl.CurrentIns.Ins.InsCod);
@ -4095,7 +4095,7 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
NumCtrsTotal = 1;
sprintf (SubQuery,"centres.CtrCod='%ld' AND ",
Gbl.CurrentCtr.Ctr.CtrCod);
@ -4104,7 +4104,7 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
NumCtrsTotal = 1;
NumCtrsWithDegs = 1;
sprintf (SubQuery,"degrees.DegCod='%ld' AND ",
@ -4113,7 +4113,7 @@ static void Sta_GetAndShowNumCtrsInSWAD (void)
NumCtrsWithTchs = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumCtrsWithStds = Ctr_GetNumCtrsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
NumCtrsTotal = 1;
NumCtrsWithDegs = 1;
NumCtrsWithCrss = 1;
@ -4174,14 +4174,14 @@ static void Sta_GetAndShowNumDegsInSWAD (void)
/***** Get number of degrees *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
NumDegsTotal = Deg_GetNumDegsTotal ();
NumDegsWithCrss = Deg_GetNumDegsWithCrss ("");
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_ROLE_TEACHER,"");
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_ROLE_STUDENT,"");
SubQuery[0] = '\0';
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
NumDegsTotal = Deg_GetNumDegsInIns (Gbl.CurrentIns.Ins.InsCod);
sprintf (SubQuery,"institutions.InsCod='%ld' AND ",
Gbl.CurrentIns.Ins.InsCod);
@ -4189,7 +4189,7 @@ static void Sta_GetAndShowNumDegsInSWAD (void)
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
NumDegsTotal = Deg_GetNumDegsInCtr (Gbl.CurrentCtr.Ctr.CtrCod);
sprintf (SubQuery,"centres.CtrCod='%ld' AND ",
Gbl.CurrentCtr.Ctr.CtrCod);
@ -4197,7 +4197,7 @@ static void Sta_GetAndShowNumDegsInSWAD (void)
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
NumDegsTotal = 1;
sprintf (SubQuery,"degrees.DegCod='%ld' AND ",
Gbl.CurrentDeg.Deg.DegCod);
@ -4205,7 +4205,7 @@ static void Sta_GetAndShowNumDegsInSWAD (void)
NumDegsWithTchs = Deg_GetNumDegsWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumDegsWithStds = Deg_GetNumDegsWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
NumDegsTotal = 1;
NumDegsWithCrss = 1;
sprintf (SubQuery,"courses.CrsCod='%ld' AND ",
@ -4261,34 +4261,34 @@ static void Sta_GetAndShowNumCrssInSWAD (void)
/***** Get number of degrees *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
NumCrssTotal = Crs_GetNumCrssTotal ();
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_ROLE_TEACHER,"");
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_ROLE_STUDENT,"");
SubQuery[0] = '\0';
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
NumCrssTotal = Crs_GetNumCrssInIns (Gbl.CurrentIns.Ins.InsCod);
sprintf (SubQuery,"institutions.InsCod='%ld' AND ",
Gbl.CurrentIns.Ins.InsCod);
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
NumCrssTotal = Crs_GetNumCrssInCtr (Gbl.CurrentCtr.Ctr.CtrCod);
sprintf (SubQuery,"centres.CtrCod='%ld' AND ",
Gbl.CurrentCtr.Ctr.CtrCod);
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
NumCrssTotal = Crs_GetNumCrssInDeg (Gbl.CurrentDeg.Deg.DegCod);
sprintf (SubQuery,"degrees.DegCod='%ld' AND ",
Gbl.CurrentDeg.Deg.DegCod);
NumCrssWithTchs = Crs_GetNumCrssWithUsrs (Rol_ROLE_TEACHER,SubQuery);
NumCrssWithStds = Crs_GetNumCrssWithUsrs (Rol_ROLE_STUDENT,SubQuery);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
NumCrssTotal = 1;
sprintf (SubQuery,"courses.CrsCod='%ld' AND ",
Gbl.CurrentCrs.Crs.CrsCod);
@ -4336,7 +4336,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
/***** Get number of users from database *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
sprintf (Query,"SELECT COUNT(*) FROM usr_data");
else
@ -4344,7 +4344,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
" FROM crs_usr WHERE Role='%u'",
(unsigned) Role);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM centres,degrees,courses,crs_usr"
@ -4363,7 +4363,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
" AND crs_usr.Role='%u'",
Gbl.CurrentIns.Ins.InsCod,(unsigned) Role);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM degrees,courses,crs_usr"
@ -4380,7 +4380,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
" AND crs_usr.Role='%u'",
Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) Role);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM courses,crs_usr"
@ -4395,7 +4395,7 @@ unsigned Sta_GetTotalNumberOfUsers (Sco_Scope_t Scope,Rol_Role_t Role)
" AND crs_usr.Role='%u'",
Gbl.CurrentDeg.Deg.DegCod,(unsigned) Role);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
if (Role == Rol_ROLE_UNKNOWN) // Here Rol_ROLE_UNKNOWN means "all users"
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod) FROM crs_usr"
" WHERE CrsCod='%ld'",
@ -4448,7 +4448,7 @@ static void Sta_GetAndShowUsersStats (void)
Txt_Average_number_of_users_belonging_to_a_course);
Usr_GetAndShowNumUsrsInPlatform (Rol_ROLE_STUDENT);
Usr_GetAndShowNumUsrsInPlatform (Rol_ROLE_TEACHER);
Usr_GetAndShowNumUsrsInPlatform (Rol_ROLE_GUEST); // Users not beloging to any course
Usr_GetAndShowNumUsrsInPlatform (Rol_ROLE_GUEST__); // Users not beloging to any course
Lay_EndRoundFrameTable10 ();
}
@ -4726,7 +4726,7 @@ static void Sta_GetSizeOfFileZoneFromDB (Sco_Scope_t Scope,
switch (Scope)
{
/* Scope = the whole platform */
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
switch (FileBrowser)
{
case Brw_UNKNOWN:
@ -4796,7 +4796,7 @@ static void Sta_GetSizeOfFileZoneFromDB (Sco_Scope_t Scope,
}
break;
/* Scope = the current country */
case Sco_SCOPE_COUNTRY:
case Sco_SCOPE_CTY:
switch (FileBrowser)
{
case Brw_UNKNOWN:
@ -4899,7 +4899,7 @@ static void Sta_GetSizeOfFileZoneFromDB (Sco_Scope_t Scope,
}
break;
/* Scope = the current institution */
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
switch (FileBrowser)
{
case Brw_UNKNOWN:
@ -4996,7 +4996,7 @@ static void Sta_GetSizeOfFileZoneFromDB (Sco_Scope_t Scope,
}
break;
/* Scope = the current centre */
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
switch (FileBrowser)
{
case Brw_UNKNOWN:
@ -5087,7 +5087,7 @@ static void Sta_GetSizeOfFileZoneFromDB (Sco_Scope_t Scope,
}
break;
/* Scope = the current degree */
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
switch (FileBrowser)
{
case Brw_UNKNOWN:
@ -5172,7 +5172,7 @@ static void Sta_GetSizeOfFileZoneFromDB (Sco_Scope_t Scope,
}
break;
/* Scope = the current course */
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
switch (FileBrowser)
{
case Brw_UNKNOWN:
@ -5376,14 +5376,14 @@ static void Sta_GetNumberOfOERsFromDB (Sco_Scope_t Scope,Brw_License_t License,u
/***** Get the size of a file browser *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT Public,COUNT(*)"
" FROM files"
" WHERE License='%u'"
" GROUP BY Public",
(unsigned) License);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT files.Public,COUNT(*)"
" FROM centres,degrees,courses,files"
" WHERE centres.InsCod='%ld'"
@ -5398,7 +5398,7 @@ static void Sta_GetNumberOfOERsFromDB (Sco_Scope_t Scope,Brw_License_t License,u
(unsigned) Brw_ADMI_SHARE_CRS,
(unsigned) License);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT files.Public,COUNT(*)"
" FROM degrees,courses,files"
" WHERE degrees.CtrCod='%ld'"
@ -5412,7 +5412,7 @@ static void Sta_GetNumberOfOERsFromDB (Sco_Scope_t Scope,Brw_License_t License,u
(unsigned) Brw_ADMI_SHARE_CRS,
(unsigned) License);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT files.Public,COUNT(*)"
" FROM courses,files"
" WHERE courses.DegCod='%ld'"
@ -5425,7 +5425,7 @@ static void Sta_GetNumberOfOERsFromDB (Sco_Scope_t Scope,Brw_License_t License,u
(unsigned) Brw_ADMI_SHARE_CRS,
(unsigned) License);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT Public,COUNT(*)"
" FROM files"
" WHERE CrsCod='%ld'"
@ -5970,7 +5970,7 @@ static void Sta_GetAndShowForumStats (void)
/***** Write a row for each type of forum *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
Sta_ShowStatOfAForumType (For_FORUM_GLOBAL_USRS ,-1L,-1L,-1L,-1L,&StatsForum);
Sta_ShowStatOfAForumType (For_FORUM_GLOBAL_TCHS ,-1L,-1L,-1L,-1L,&StatsForum);
Sta_ShowStatOfAForumType (For_FORUM_SWAD_USRS ,-1L,-1L,-1L,-1L,&StatsForum);
@ -5984,7 +5984,7 @@ static void Sta_GetAndShowForumStats (void)
Sta_ShowStatOfAForumType (For_FORUM_COURSE_USRS ,-1L,-1L,-1L,-1L,&StatsForum);
Sta_ShowStatOfAForumType (For_FORUM_COURSE_TCHS ,-1L,-1L,-1L,-1L,&StatsForum);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
Sta_ShowStatOfAForumType (For_FORUM_INSTITUTION_USRS,Gbl.CurrentIns.Ins.InsCod,-1L,-1L,-1L,&StatsForum);
Sta_ShowStatOfAForumType (For_FORUM_INSTITUTION_TCHS,Gbl.CurrentIns.Ins.InsCod,-1L,-1L,-1L,&StatsForum);
Sta_ShowStatOfAForumType (For_FORUM_CENTRE_USRS ,Gbl.CurrentIns.Ins.InsCod,-1L,-1L,-1L,&StatsForum);
@ -5994,7 +5994,7 @@ static void Sta_GetAndShowForumStats (void)
Sta_ShowStatOfAForumType (For_FORUM_COURSE_USRS ,Gbl.CurrentIns.Ins.InsCod,-1L,-1L,-1L,&StatsForum);
Sta_ShowStatOfAForumType (For_FORUM_COURSE_TCHS ,Gbl.CurrentIns.Ins.InsCod,-1L,-1L,-1L,&StatsForum);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
Sta_ShowStatOfAForumType (For_FORUM_CENTRE_USRS,-1L,Gbl.CurrentCtr.Ctr.CtrCod,-1L,-1L,&StatsForum);
Sta_ShowStatOfAForumType (For_FORUM_CENTRE_TCHS,-1L,Gbl.CurrentCtr.Ctr.CtrCod,-1L,-1L,&StatsForum);
Sta_ShowStatOfAForumType (For_FORUM_DEGREE_USRS,-1L,Gbl.CurrentCtr.Ctr.CtrCod,-1L,-1L,&StatsForum);
@ -6002,13 +6002,13 @@ static void Sta_GetAndShowForumStats (void)
Sta_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,Gbl.CurrentCtr.Ctr.CtrCod,-1L,-1L,&StatsForum);
Sta_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,Gbl.CurrentCtr.Ctr.CtrCod,-1L,-1L,&StatsForum);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
Sta_ShowStatOfAForumType (For_FORUM_DEGREE_USRS,-1L,-1L,Gbl.CurrentDeg.Deg.DegCod,-1L,&StatsForum);
Sta_ShowStatOfAForumType (For_FORUM_DEGREE_TCHS,-1L,-1L,Gbl.CurrentDeg.Deg.DegCod,-1L,&StatsForum);
Sta_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,-1L,Gbl.CurrentDeg.Deg.DegCod,-1L,&StatsForum);
Sta_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,Gbl.CurrentDeg.Deg.DegCod,-1L,&StatsForum);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
Sta_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,Gbl.CurrentCrs.Crs.CrsCod,&StatsForum);
Sta_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,-1L,Gbl.CurrentCrs.Crs.CrsCod,&StatsForum);
break;
@ -6370,12 +6370,12 @@ static void Sta_GetAndShowNumUsrsPerLanguage (void)
/***** Get the number of users who have chosen this language from database *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*)"
" FROM usr_data WHERE Language='%s'",
Txt_STR_LANG_ID[Lan]);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM centres,degrees,courses,crs_usr,usr_data"
" WHERE centres.InsCod='%ld'"
@ -6387,7 +6387,7 @@ static void Sta_GetAndShowNumUsrsPerLanguage (void)
Gbl.CurrentIns.Ins.InsCod,
Txt_STR_LANG_ID[Lan]);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM degrees,courses,crs_usr,usr_data"
" WHERE degrees.CtrCod='%ld'"
@ -6398,7 +6398,7 @@ static void Sta_GetAndShowNumUsrsPerLanguage (void)
Gbl.CurrentCtr.Ctr.CtrCod,
Txt_STR_LANG_ID[Lan]);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM courses,crs_usr,usr_data"
" WHERE courses.DegCod='%ld'"
@ -6408,7 +6408,7 @@ static void Sta_GetAndShowNumUsrsPerLanguage (void)
Gbl.CurrentDeg.Deg.DegCod,
Txt_STR_LANG_ID[Lan]);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM crs_usr,usr_data"
" WHERE crs_usr.CrsCod='%ld'"
@ -6493,12 +6493,12 @@ static void Sta_GetAndShowNumUsrsPerLayout (void)
/***** Get number of users who have chosen this layout from database *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
" WHERE Layout='%u'",
(unsigned) Layout);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM centres,degrees,courses,crs_usr,usr_data"
" WHERE centres.InsCod='%ld'"
@ -6509,7 +6509,7 @@ static void Sta_GetAndShowNumUsrsPerLayout (void)
" AND usr_data.Layout='%u'",
Gbl.CurrentIns.Ins.InsCod,(unsigned) Layout);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM degrees,courses,crs_usr,usr_data"
" WHERE degrees.CtrCod='%ld'"
@ -6519,7 +6519,7 @@ static void Sta_GetAndShowNumUsrsPerLayout (void)
" AND usr_data.Layout='%u'",
Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) Layout);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM courses,crs_usr,usr_data"
" WHERE courses.DegCod='%ld'"
@ -6528,7 +6528,7 @@ static void Sta_GetAndShowNumUsrsPerLayout (void)
" AND usr_data.Layout='%u'",
Gbl.CurrentDeg.Deg.DegCod,(unsigned) Layout);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM crs_usr,usr_data"
" WHERE crs_usr.CrsCod='%ld'"
@ -6613,12 +6613,12 @@ static void Sta_GetAndShowNumUsrsPerTheme (void)
/***** Get number of users who have chosen this theme from database *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
" WHERE Theme='%s'",
The_ThemeId[Theme]);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM centres,degrees,courses,crs_usr,usr_data"
" WHERE centres.InsCod='%ld'"
@ -6629,7 +6629,7 @@ static void Sta_GetAndShowNumUsrsPerTheme (void)
" AND usr_data.Theme='%s'",
Gbl.CurrentIns.Ins.InsCod,The_ThemeId[Theme]);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM degrees,courses,crs_usr,usr_data"
" WHERE degrees.CtrCod='%ld'"
@ -6639,7 +6639,7 @@ static void Sta_GetAndShowNumUsrsPerTheme (void)
" AND usr_data.Theme='%s'",
Gbl.CurrentCtr.Ctr.CtrCod,The_ThemeId[Theme]);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM courses,crs_usr,usr_data"
" WHERE courses.DegCod='%ld'"
@ -6648,7 +6648,7 @@ static void Sta_GetAndShowNumUsrsPerTheme (void)
" AND usr_data.Theme='%s'",
Gbl.CurrentDeg.Deg.DegCod,The_ThemeId[Theme]);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM crs_usr,usr_data"
" WHERE crs_usr.CrsCod='%ld'"
@ -6734,11 +6734,11 @@ static void Sta_GetAndShowNumUsrsPerIconSet (void)
/***** Get the number of users who have chosen this icon set from database *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*) FROM usr_data WHERE IconSet='%s'",
Ico_IconSetId[IconSet]);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM centres,degrees,courses,crs_usr,usr_data"
" WHERE centres.InsCod='%ld'"
@ -6749,7 +6749,7 @@ static void Sta_GetAndShowNumUsrsPerIconSet (void)
" AND usr_data.IconSet='%s'",
Gbl.CurrentIns.Ins.InsCod,Ico_IconSetId[IconSet]);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM degrees,courses,crs_usr,usr_data"
" WHERE degrees.CtrCod='%ld'"
@ -6759,7 +6759,7 @@ static void Sta_GetAndShowNumUsrsPerIconSet (void)
" AND usr_data.IconSet='%s'",
Gbl.CurrentCtr.Ctr.CtrCod,Ico_IconSetId[IconSet]);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM courses,crs_usr,usr_data"
" WHERE courses.DegCod='%ld'"
@ -6768,7 +6768,7 @@ static void Sta_GetAndShowNumUsrsPerIconSet (void)
" AND usr_data.IconSet='%s'",
Gbl.CurrentDeg.Deg.DegCod,Ico_IconSetId[IconSet]);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM crs_usr,usr_data"
" WHERE crs_usr.CrsCod='%ld'"
@ -6858,12 +6858,12 @@ static void Sta_GetAndShowNumUsrsPerMenu (void)
/***** Get number of users who have chosen this menu from database *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*) FROM usr_data"
" WHERE Menu='%u'",
(unsigned) Menu);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM centres,degrees,courses,crs_usr,usr_data"
" WHERE centres.InsCod='%ld'"
@ -6874,7 +6874,7 @@ static void Sta_GetAndShowNumUsrsPerMenu (void)
" AND usr_data.Menu='%u'",
Gbl.CurrentIns.Ins.InsCod,(unsigned) Menu);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM degrees,courses,crs_usr,usr_data"
" WHERE degrees.CtrCod='%ld'"
@ -6884,7 +6884,7 @@ static void Sta_GetAndShowNumUsrsPerMenu (void)
" AND usr_data.Menu='%u'",
Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) Menu);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM courses,crs_usr,usr_data"
" WHERE courses.DegCod='%ld'"
@ -6893,7 +6893,7 @@ static void Sta_GetAndShowNumUsrsPerMenu (void)
" AND usr_data.Menu='%u'",
Gbl.CurrentDeg.Deg.DegCod,(unsigned) Menu);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM crs_usr,usr_data"
" WHERE crs_usr.CrsCod='%ld'"
@ -6977,11 +6977,11 @@ static void Sta_GetAndShowNumUsrsPerSideColumns (void)
/***** Get the number of users who have chosen this layout of columns from database *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*) FROM usr_data WHERE SideCols='%u'",
SideCols);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM centres,degrees,courses,crs_usr,usr_data"
" WHERE centres.InsCod='%ld'"
@ -6992,7 +6992,7 @@ static void Sta_GetAndShowNumUsrsPerSideColumns (void)
" AND usr_data.SideCols='%u'",
Gbl.CurrentIns.Ins.InsCod,SideCols);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM degrees,courses,crs_usr,usr_data"
" WHERE degrees.CtrCod='%ld'"
@ -7002,7 +7002,7 @@ static void Sta_GetAndShowNumUsrsPerSideColumns (void)
" AND usr_data.SideCols='%u'",
Gbl.CurrentCtr.Ctr.CtrCod,SideCols);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM courses,crs_usr,usr_data"
" WHERE courses.DegCod='%ld'"
@ -7011,7 +7011,7 @@ static void Sta_GetAndShowNumUsrsPerSideColumns (void)
" AND usr_data.SideCols='%u'",
Gbl.CurrentDeg.Deg.DegCod,SideCols);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM crs_usr,usr_data"
" WHERE crs_usr.CrsCod='%ld'"
@ -7115,10 +7115,10 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
/***** Get total number of users who want to be notified by e-mail on some event, from database *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*) FROM usr_data WHERE EmailNtfEvents<>0");
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM centres,degrees,courses,crs_usr,usr_data"
" WHERE centres.InsCod='%ld'"
@ -7129,7 +7129,7 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
" AND usr_data.EmailNtfEvents<>0",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM degrees,courses,crs_usr,usr_data"
" WHERE degrees.CtrCod='%ld'"
@ -7139,7 +7139,7 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
" AND usr_data.EmailNtfEvents<>0",
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM courses,crs_usr,usr_data"
" WHERE courses.DegCod='%ld'"
@ -7148,7 +7148,7 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
" AND usr_data.EmailNtfEvents<>0",
Gbl.CurrentDeg.Deg.DegCod);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM crs_usr,usr_data"
" WHERE crs_usr.CrsCod='%ld'"
@ -7170,11 +7170,11 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
/***** Get the number of users who want to be notified by e-mail on this event, from database *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*) FROM usr_data WHERE ((EmailNtfEvents & %u)<>0)",
(1 << NotifyEvent));
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM centres,degrees,courses,crs_usr,usr_data"
" WHERE centres.InsCod='%ld'"
@ -7185,7 +7185,7 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
" AND ((usr_data.EmailNtfEvents & %u)<>0)",
Gbl.CurrentIns.Ins.InsCod,(1 << NotifyEvent));
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM degrees,courses,crs_usr,usr_data"
" WHERE degrees.CtrCod='%ld'"
@ -7195,7 +7195,7 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
" AND ((usr_data.EmailNtfEvents & %u)<>0)",
Gbl.CurrentCtr.Ctr.CtrCod,(1 << NotifyEvent));
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM courses,crs_usr,usr_data"
" WHERE courses.DegCod='%ld'"
@ -7204,7 +7204,7 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
" AND ((usr_data.EmailNtfEvents & %u)<>0)",
Gbl.CurrentDeg.Deg.DegCod,(1 << NotifyEvent));
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(DISTINCT usr_data.UsrCod)"
" FROM crs_usr,usr_data"
" WHERE crs_usr.CrsCod='%ld'"
@ -7221,13 +7221,13 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
/***** Get number of notifications by e-mail from database *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT SUM(NumEvents),SUM(NumMails)"
" FROM sta_notif"
" WHERE NotifyEvent='%u'",
(unsigned) NotifyEvent);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT SUM(sta_notif.NumEvents),SUM(sta_notif.NumMails)"
" FROM centres,degrees,sta_notif"
" WHERE centres.InsCod='%ld'"
@ -7236,7 +7236,7 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
" AND sta_notif.NotifyEvent='%u'",
Gbl.CurrentIns.Ins.InsCod,(unsigned) NotifyEvent);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT SUM(sta_notif.NumEvents),SUM(sta_notif.NumMails)"
" FROM degrees,sta_notif"
" WHERE degrees.CtrCod='%ld'"
@ -7244,14 +7244,14 @@ static void Sta_GetAndShowNumUsrsPerNotifyEvent (void)
" AND sta_notif.NotifyEvent='%u'",
Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) NotifyEvent);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT SUM(NumEvents),SUM(NumMails)"
" FROM sta_notif"
" WHERE DegCod='%ld'"
" AND NotifyEvent='%u'",
Gbl.CurrentDeg.Deg.DegCod,(unsigned) NotifyEvent);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT SUM(NumEvents),SUM(NumMails)"
" FROM sta_notif"
" WHERE CrsCod='%ld'"

View File

@ -703,7 +703,7 @@ void Str_ChangeFormat (Str_ChangeFrom_t ChangeFrom,Str_ChangeTo_t ChangeTo,
char StrSpecialChar[256];
/*
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
{
sprintf (Gbl.Message,"Str_ChangeFormat (&quot;%s&quot;)",Str);
Lay_ShowAlert (Lay_INFO,Gbl.Message);

View File

@ -265,9 +265,9 @@ static bool Svy_CheckIfICanCreateSvy (void)
{
case Rol_ROLE_TEACHER:
return (Gbl.CurrentCrs.Crs.CrsCod > 0);
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_DEG_ADM:
return (Gbl.CurrentDeg.Deg.DegCod > 0);
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
return true;
default:
return false;
@ -825,7 +825,7 @@ void Svy_GetListSurveys (void)
{
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
HiddenSubQuery[0] = '\0'; // Show all surveys, visible or hidden
break;
default:
@ -840,12 +840,12 @@ void Svy_GetListSurveys (void)
OrderBySubQuery);
}
else if ((Gbl.CurrentDeg.Deg.DegCod > 0 && Gbl.CurrentCrs.Crs.CrsCod < 0) || // If degree selected, but no course selected
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN) // or if I am a degree administrator
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM) // or if I am a degree administrator
{
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_DEG_ADM:
case Rol_ROLE_SYS_ADM:
HiddenSubQuery[0] = '\0'; // Show all surveys, visible or hidden
break;
default:
@ -862,12 +862,12 @@ void Svy_GetListSurveys (void)
OrderBySubQuery);
}
else if (Gbl.CurrentCrs.Crs.CrsCod > 0 &&
Gbl.Usrs.Me.LoggedRole != Rol_ROLE_DEG_ADMIN)
Gbl.Usrs.Me.LoggedRole != Rol_ROLE_DEG_ADM)
{
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_TEACHER:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
HiddenSubQuery[0] = '\0'; // Show all surveys, visible or hidden
break;
default:
@ -1048,13 +1048,13 @@ void Svy_GetDataOfSurveyByCod (struct Survey *Svy)
Svy->Status.ICanEdit = Svy->CrsCod > 0 &&
Svy->Status.IBelongToDegCrsGrps;
break;
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_DEG_ADM:
Svy->Status.ICanViewResults = false;
Svy->Status.ICanEdit = Svy->DegCod > 0 &&
Svy->CrsCod < 0 &&
Svy->Status.IBelongToDegCrsGrps;
break;
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_SYS_ADM:
Svy->Status.ICanViewResults = (Svy->NumQsts != 0);
Svy->Status.ICanEdit = true;
break;
@ -1721,7 +1721,7 @@ void Svy_RequestCreatOrEditSvy (void)
static bool Svy_SetDefaultAndAllowedForEdition (void)
{
Gbl.Scope.Default = Sco_SCOPE_NONE;
Gbl.Scope.Default = Sco_SCOPE_UNK;
Gbl.Scope.Allowed = 0;
switch (Gbl.Usrs.Me.LoggedRole)
@ -1729,27 +1729,27 @@ static bool Svy_SetDefaultAndAllowedForEdition (void)
case Rol_ROLE_TEACHER:
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
{
Gbl.Scope.Default = Sco_SCOPE_COURSE;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_COURSE;
Gbl.Scope.Default = Sco_SCOPE_CRS;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_CRS;
return true;
}
return false;
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_DEG_ADM:
if (Gbl.CurrentDeg.Deg.DegCod > 0)
{
Gbl.Scope.Default = Sco_SCOPE_DEGREE;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_DEGREE;
Gbl.Scope.Default = Sco_SCOPE_DEG;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_DEG;
return true;
}
return false;
case Rol_ROLE_SUPERUSER:
Gbl.Scope.Default = Sco_SCOPE_PLATFORM;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
// 1 << Sco_SCOPE_COUNTRY | // TODO: Add this scope
// 1 << Sco_SCOPE_INSTITUTION | // TODO: Add this scope
// 1 << Sco_SCOPE_CENTRE | // TODO: Add this scope
1 << Sco_SCOPE_DEGREE |
1 << Sco_SCOPE_COURSE;
case Rol_ROLE_SYS_ADM:
Gbl.Scope.Default = Sco_SCOPE_SYS;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
// 1 << Sco_SCOPE_CTY | // TODO: Add this scope
// 1 << Sco_SCOPE_INS | // TODO: Add this scope
// 1 << Sco_SCOPE_CTR | // TODO: Add this scope
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
return true;
default:
return false;
@ -1837,22 +1837,22 @@ void Svy_RecFormSurvey (void)
}
/***** Get scope *****/
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
// 1 << Sco_SCOPE_COUNTRY | // TODO: Add this scope
// 1 << Sco_SCOPE_INSTITUTION | // TODO: Add this scope
// 1 << Sco_SCOPE_CENTRE | // TODO: Add this scope
1 << Sco_SCOPE_DEGREE |
1 << Sco_SCOPE_COURSE;
Gbl.Scope.Default = Sco_SCOPE_PLATFORM;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
// 1 << Sco_SCOPE_CTY | // TODO: Add this scope
// 1 << Sco_SCOPE_INS | // TODO: Add this scope
// 1 << Sco_SCOPE_CTR | // TODO: Add this scope
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_SYS;
Sco_GetScope ();
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
NewSvy.DegCod = -1L;
NewSvy.CrsCod = -1L;
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
if (Gbl.CurrentDeg.Deg.DegCod > 0)
{
NewSvy.DegCod = Gbl.CurrentDeg.Deg.DegCod;
@ -1861,7 +1861,7 @@ void Svy_RecFormSurvey (void)
else
Lay_ShowErrorAndExit ("Wrong survey location.");
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
if (Gbl.CurrentCrs.Crs.CrsCod > 0)
{
NewSvy.DegCod = -1L; // DegCod doen't mind when CrsCod > 0
@ -3508,12 +3508,12 @@ unsigned Svy_GetNumCoursesWithSurveys (Sco_Scope_t Scope)
/***** Get number of courses with surveys from database *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(DISTINCT (CrsCod))"
" FROM surveys"
" WHERE CrsCod>'0'");
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(DISTINCT (surveys.CrsCod))"
" FROM centres,degrees,courses,surveys"
" WHERE centres.InsCod='%ld'"
@ -3522,7 +3522,7 @@ unsigned Svy_GetNumCoursesWithSurveys (Sco_Scope_t Scope)
" AND courses.CrsCod=surveys.CrsCod",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(DISTINCT (surveys.CrsCod))"
" FROM degrees,courses,surveys"
" WHERE degrees.CtrCod='%ld'"
@ -3530,14 +3530,14 @@ unsigned Svy_GetNumCoursesWithSurveys (Sco_Scope_t Scope)
" AND courses.CrsCod=surveys.CrsCod",
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(DISTINCT (surveys.CrsCod))"
" FROM courses,surveys"
" WHERE courses.DegCod='%ld'"
" AND courses.CrsCod=surveys.CrsCod",
Gbl.CurrentDeg.Deg.DegCod);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(DISTINCT (CrsCod))"
" FROM surveys"
" WHERE CrsCod='%ld'",
@ -3576,12 +3576,12 @@ unsigned Svy_GetNumSurveys (Sco_Scope_t Scope,unsigned *NumNotif)
/***** Get number of surveys from database *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
" FROM surveys"
" WHERE CrsCod>'0'");
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(*),SUM(surveys.NumNotif)"
" FROM centres,degrees,courses,surveys"
" WHERE centres.InsCod='%ld'"
@ -3590,7 +3590,7 @@ unsigned Svy_GetNumSurveys (Sco_Scope_t Scope,unsigned *NumNotif)
" AND courses.CrsCod=surveys.CrsCod",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(*),SUM(surveys.NumNotif)"
" FROM degrees,courses,surveys"
" WHERE degrees.CtrCod='%ld'"
@ -3598,14 +3598,14 @@ unsigned Svy_GetNumSurveys (Sco_Scope_t Scope,unsigned *NumNotif)
" AND courses.CrsCod=surveys.CrsCod",
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(*),SUM(surveys.NumNotif)"
" FROM courses,surveys"
" WHERE courses.DegCod='%ld'"
" AND courses.CrsCod=surveys.CrsCod",
Gbl.CurrentDeg.Deg.DegCod);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(*),SUM(NumNotif)"
" FROM surveys"
" WHERE CrsCod='%ld'",
@ -3651,7 +3651,7 @@ float Svy_GetNumQstsPerSurvey (Sco_Scope_t Scope)
/***** Get number of courses per user from database *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT AVG(NumQsts) FROM"
" (SELECT COUNT(svy_questions.QstCod) AS NumQsts"
" FROM surveys,svy_questions"
@ -3659,7 +3659,7 @@ float Svy_GetNumQstsPerSurvey (Sco_Scope_t Scope)
" AND surveys.SvyCod=svy_questions.SvyCod"
" GROUP BY svy_questions.SvyCod) AS NumQstsTable");
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT AVG(NumQsts) FROM"
" (SELECT COUNT(svy_questions.QstCod) AS NumQsts"
" FROM centres,degrees,courses,surveys,svy_questions"
@ -3671,7 +3671,7 @@ float Svy_GetNumQstsPerSurvey (Sco_Scope_t Scope)
" GROUP BY svy_questions.SvyCod) AS NumQstsTable",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT AVG(NumQsts) FROM"
" (SELECT COUNT(svy_questions.QstCod) AS NumQsts"
" FROM degrees,courses,surveys,svy_questions"
@ -3682,7 +3682,7 @@ float Svy_GetNumQstsPerSurvey (Sco_Scope_t Scope)
" GROUP BY svy_questions.SvyCod) AS NumQstsTable",
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT AVG(NumQsts) FROM"
" (SELECT COUNT(svy_questions.QstCod) AS NumQsts"
" FROM courses,surveys,svy_questions"
@ -3692,7 +3692,7 @@ float Svy_GetNumQstsPerSurvey (Sco_Scope_t Scope)
" GROUP BY svy_questions.SvyCod) AS NumQstsTable",
Gbl.CurrentDeg.Deg.DegCod);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT AVG(NumQsts) FROM"
" (SELECT COUNT(svy_questions.QstCod) AS NumQsts"
" FROM surveys,svy_questions"

View File

@ -254,7 +254,7 @@ void Tst_ShowFormAskTst (void)
/***** Put form to go to test edition and configuration *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
{
fprintf (Gbl.F.Out,"<div style=\"text-align:center;\">");
Tst_PutFormToSeeResultsOfUsersTests ();
@ -581,7 +581,7 @@ static bool Tst_CheckIfNextTstAllowed (void)
unsigned Year,Month,Day,Hour,Minute,Second;
/***** Superusers are allowed to do all test they want *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
return true;
/***** Get date of next allowed access to test from database *****/
@ -2335,7 +2335,7 @@ static unsigned long Tst_GetQuestionsForExam (MYSQL_RES **mysql_res)
sprintf (StrNumQsts,"%u",Gbl.Test.NumQsts);
strcat (Query,StrNumQsts);
/*
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query);
*/
/* Make the query */
@ -5510,7 +5510,7 @@ static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsTy
/***** Get number of test questions from database *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
" FROM tst_questions");
@ -5520,7 +5520,7 @@ static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsTy
" WHERE AnsType='%s'",
Tst_StrAnswerTypesDB[AnsType]);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
" FROM centres,degrees,courses,tst_questions"
@ -5540,7 +5540,7 @@ static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsTy
Gbl.CurrentIns.Ins.InsCod,
Tst_StrAnswerTypesDB[AnsType]);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
" FROM degrees,courses,tst_questions"
@ -5558,7 +5558,7 @@ static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsTy
Gbl.CurrentCtr.Ctr.CtrCod,
Tst_StrAnswerTypesDB[AnsType]);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
" FROM courses,tst_questions"
@ -5574,7 +5574,7 @@ static unsigned Tst_GetNumTstQuestions (Sco_Scope_t Scope,Tst_AnswerType_t AnsTy
Gbl.CurrentDeg.Deg.DegCod,
Tst_StrAnswerTypesDB[AnsType]);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(*),SUM(NumHits),SUM(Score)"
" FROM tst_questions"
@ -5636,7 +5636,7 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Sco_Scope_t Scope,Tst_AnswerT
/***** Get number of courses with test questions from database *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(DISTINCT (CrsCod))"
" FROM tst_questions");
@ -5646,7 +5646,7 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Sco_Scope_t Scope,Tst_AnswerT
" WHERE AnsType='%s'",
Tst_StrAnswerTypesDB[AnsType]);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(DISTINCT (tst_questions.CrsCod))"
" FROM centres,degrees,courses,tst_questions"
@ -5666,7 +5666,7 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Sco_Scope_t Scope,Tst_AnswerT
Gbl.CurrentIns.Ins.InsCod,
Tst_StrAnswerTypesDB[AnsType]);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(DISTINCT (tst_questions.CrsCod))"
" FROM degrees,courses,tst_questions"
@ -5684,7 +5684,7 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Sco_Scope_t Scope,Tst_AnswerT
Gbl.CurrentCtr.Ctr.CtrCod,
Tst_StrAnswerTypesDB[AnsType]);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(DISTINCT (tst_questions.CrsCod))"
" FROM courses,tst_questions"
@ -5700,7 +5700,7 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Sco_Scope_t Scope,Tst_AnswerT
Gbl.CurrentDeg.Deg.DegCod,
Tst_StrAnswerTypesDB[AnsType]);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(DISTINCT (CrsCod))"
" FROM tst_questions"
@ -5747,7 +5747,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
/***** Get number of courses with test questions from database *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
" FROM tst_questions,tst_config"
@ -5763,7 +5763,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
Tst_StrAnswerTypesDB[AnsType],
Tst_PluggableDB[Tst_PLUGGABLE_YES]);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(DISTINCT (tst_questions.CrsCod))"
" FROM centres,degrees,courses,tst_questions,tst_config"
@ -5789,7 +5789,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
Tst_StrAnswerTypesDB[AnsType],
Tst_PluggableDB[Tst_PLUGGABLE_YES]);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(DISTINCT (tst_questions.CrsCod))"
" FROM degrees,courses,tst_questions,tst_config"
@ -5813,7 +5813,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
Tst_StrAnswerTypesDB[AnsType],
Tst_PluggableDB[Tst_PLUGGABLE_YES]);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(DISTINCT (tst_questions.CrsCod))"
" FROM courses,tst_questions,tst_config"
@ -5835,7 +5835,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Sco_Scope_t Scope,Ts
Tst_StrAnswerTypesDB[AnsType],
Tst_PluggableDB[Tst_PLUGGABLE_YES]);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
if (AnsType == Tst_ANS_ALL)
sprintf (Query,"SELECT COUNT(DISTINCT tst_questions.CrsCod)"
" FROM tst_questions,tst_config"
@ -5891,8 +5891,8 @@ void Tst_SelUsrsToSeeUsrsTstExams (void)
Usr_ShowFormsToSelectUsrListType (ActReqSeeUsrTstExa);
/***** Get and order lists of users from this course *****/
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_COURSE,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_TEACHER,Sco_SCOPE_CRS,NULL,false);
Usr_GetUsrsLst (Rol_ROLE_STUDENT,Sco_SCOPE_CRS,NULL,false);
if (Gbl.Usrs.LstTchs.NumUsrs ||
Gbl.Usrs.LstStds.NumUsrs)

File diff suppressed because it is too large Load Diff

View File

@ -417,7 +417,7 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat)
UsrDat->Roles = Rol_GetRolesInAllCrss (UsrDat->UsrCod);
if (UsrDat->RoleInCurrentCrsDB == Rol_ROLE_UNKNOWN)
UsrDat->RoleInCurrentCrsDB = (UsrDat->Roles < (1 << Rol_ROLE_STUDENT)) ?
Rol_ROLE_GUEST : // User does not belong to any course
Rol_ROLE_GUEST__ : // User does not belong to any course
Rol_ROLE_VISITOR; // User belongs to some courses
/* Get name */
@ -707,6 +707,7 @@ bool Usr_CheckIfUsrIsAdm (long UsrCod,Sco_Scope_t Scope,long Cod)
UsrCod,Sco_ScopeAdminDB[Scope],Cod);
return (DB_QueryCOUNT (Query,"can not check if a user is administrator") != 0);
}
return false;
}
/*****************************************************************************/
@ -2169,9 +2170,11 @@ static void Usr_SetUsrRoleAndPrefs (void)
{
extern const char *The_ThemeId[The_NUM_THEMES];
extern const char *Ico_IconSetId[Ico_NUM_ICON_SETS];
bool ICanBeAdmin = false;
bool ICanBeInsAdm = false;
bool ICanBeCtrAdm = false;
bool ICanBeDegAdm = false;
// User is logged
// In this point I am logged
/***** Set preferences from my preferences *****/
Gbl.Prefs.Theme = Gbl.Usrs.Me.UsrDat.Prefs.Theme;
@ -2222,12 +2225,26 @@ static void Usr_SetUsrRoleAndPrefs (void)
/***** Check if my photo exists and create a link to it ****/
Gbl.Usrs.Me.MyPhotoExists = Pho_BuildLinkToPhoto (&Gbl.Usrs.Me.UsrDat,Gbl.Usrs.Me.PhotoURL,true);
/***** Check if I belong to current degree and if I am administrator of current degree *****/
if (Gbl.CurrentDeg.Deg.DegCod > 0)
/* Check if I am and administrator of current degree */
ICanBeAdmin = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_SCOPE_DEGREE,
Gbl.CurrentDeg.Deg.DegCod);
/***** Check if I am administrator of current institution/centre/degree *****/
if (Gbl.CurrentIns.Ins.InsCod > 0)
{
/* Check if I am and administrator of current institution */
ICanBeInsAdm = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_SCOPE_INS,
Gbl.CurrentIns.Ins.InsCod);
if (Gbl.CurrentCtr.Ctr.CtrCod > 0)
{
/* Check if I am and administrator of current centre */
ICanBeCtrAdm = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_SCOPE_CTR,
Gbl.CurrentCtr.Ctr.CtrCod);
if (Gbl.CurrentDeg.Deg.DegCod > 0)
/* Check if I am and administrator of current degree */
ICanBeDegAdm = Usr_CheckIfUsrIsAdm (Gbl.Usrs.Me.UsrDat.UsrCod,
Sco_SCOPE_DEG,
Gbl.CurrentDeg.Deg.DegCod);
}
}
/***** Check if I belong to current course *****/
@ -2287,14 +2304,18 @@ static void Usr_SetUsrRoleAndPrefs (void)
else if (Gbl.Usrs.Me.MaxRole >= Rol_ROLE_STUDENT)
Gbl.Usrs.Me.AvailableRoles = (1 << Rol_ROLE_VISITOR);
else
Gbl.Usrs.Me.AvailableRoles = (1 << Rol_ROLE_GUEST);
Gbl.Usrs.Me.AvailableRoles = (1 << Rol_ROLE_GUEST__);
}
else // No course selected
Gbl.Usrs.Me.AvailableRoles = (1 << Gbl.Usrs.Me.MaxRole);
if (ICanBeAdmin)
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_ROLE_DEG_ADMIN);
if (ICanBeInsAdm)
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_ROLE_INS_ADM);
if (ICanBeCtrAdm)
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_ROLE_CTR_ADM);
if (ICanBeDegAdm)
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_ROLE_DEG_ADM);
if (Usr_CheckIfUsrIsSuperuser (Gbl.Usrs.Me.UsrDat.UsrCod))
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_ROLE_SUPERUSER);
Gbl.Usrs.Me.AvailableRoles |= (1 << Rol_ROLE_SYS_ADM);
/***** Check if the role I am logged is now available for me *****/
if (!(Gbl.Usrs.Me.AvailableRoles & (1 << Gbl.Usrs.Me.LoggedRole))) // Current type I am logged is not available for me
@ -2495,7 +2516,7 @@ static void Usr_WriteRowGstMainData (unsigned NumUsr,struct UsrData *UsrDat)
fprintf (Gbl.F.Out,"<td style=\"text-align:center; vertical-align:middle;"
" background-color:%s;\">",
BgColor);
Usr_PutCheckboxToSelectUser (Rol_ROLE_GUEST,UsrDat->EncryptedUsrCod,false);
Usr_PutCheckboxToSelectUser (Rol_ROLE_GUEST__,UsrDat->EncryptedUsrCod,false);
fprintf (Gbl.F.Out,"</td>");
/***** Student has accepted enrollment in current course? *****/
@ -2569,8 +2590,8 @@ void Usr_WriteRowStdMainData (unsigned NumUsr,struct UsrData *UsrDat,bool PutChe
char MailLink[7+Cns_MAX_BYTES_STRING+1]; // mailto:mail_address
struct Institution Ins;
bool ShowEmail = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER && UsrDat->Accepted) ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER;
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM;
/***** Start row *****/
fprintf (Gbl.F.Out,"<tr>");
@ -2772,8 +2793,8 @@ void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
char Text[Cns_MAX_BYTES_TEXT+1];
struct Institution Ins;
bool ShowData = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER && UsrDat->Accepted) ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER;
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM;
/***** Start row *****/
BgColor = Gbl.ColorRows[Gbl.RowEvenOdd]; // Two colors are used alternatively to better distinguish the rows
@ -2838,7 +2859,7 @@ void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
"&nbsp;",
NULL,true,UsrDat->Accepted);
if (Gbl.Scope.Current == Sco_SCOPE_COURSE)
if (Gbl.Scope.Current == Sco_SCOPE_CRS)
{
/***** Write the groups a the que pertenece the student *****/
for (NumGrpTyp = 0;
@ -2893,8 +2914,8 @@ static void Usr_WriteRowTchMainData (unsigned NumUsr,struct UsrData *UsrDat,bool
char MailLink[7+Cns_MAX_BYTES_STRING+1]; // mailto:mail_address
struct Institution Ins;
bool ShowEmail = UsrDat->Accepted ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER;
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM;
/***** Start row *****/
fprintf (Gbl.F.Out,"<tr>");
@ -2988,8 +3009,8 @@ void Usr_WriteRowTchAllData (struct UsrData *UsrDat)
struct Institution Ins;
bool ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat->UsrCod);
bool ShowData = (ItsMe || UsrDat->Accepted ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER);
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
struct Centre Ctr;
struct Department Dpt;
@ -3101,7 +3122,7 @@ void Usr_WriteRowAdmData (unsigned NumUsr,struct UsrData *UsrDat)
UsrDat->Accepted ? "DAT_SMALL_N" :
"DAT_SMALL",
BgColor);
ID_WriteUsrIDs (UsrDat,(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER));
ID_WriteUsrIDs (UsrDat,(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM));
fprintf (Gbl.F.Out,"&nbsp;</td>");
/***** Write rest of main administrator's data *****/
@ -3576,7 +3597,7 @@ void Usr_GetUsrsLst (Rol_Role_t Role,Sco_Scope_t Scope,const char *UsrQuery,bool
char Query[Usr_MAX_LENGTH_QUERY_LIST_USERS+1];
/***** Build query *****/
if (Search && Role == Rol_ROLE_GUEST) // Special case
if (Search && Role == Rol_ROLE_GUEST__) // Special case
{
/* Select users with no courses */
sprintf (Query,"SELECT UsrCod,'N',Sex"
@ -3589,7 +3610,7 @@ void Usr_GetUsrsLst (Rol_Role_t Role,Sco_Scope_t Scope,const char *UsrQuery,bool
else // Rest of cases
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
if (Search)
/* Select users with any of their courses not accepted +
users with all their courses accepted */
@ -3635,7 +3656,7 @@ void Usr_GetUsrsLst (Rol_Role_t Role,Sco_Scope_t Scope,const char *UsrQuery,bool
(unsigned) Role,
(unsigned) Role);
break;
case Sco_SCOPE_COUNTRY:
case Sco_SCOPE_CTY:
if (Search)
/* Select users of degrees in current country with any courses in those degrees not accepted +
users of degrees in current country with all their courses in those degrees accepted */
@ -3716,7 +3737,7 @@ void Usr_GetUsrsLst (Rol_Role_t Role,Sco_Scope_t Scope,const char *UsrQuery,bool
Gbl.CurrentCty.Cty.CtyCod,(unsigned) Role,
Gbl.CurrentCty.Cty.CtyCod,(unsigned) Role);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
if (Search)
/* Select users of degrees in current institution with any courses in those degrees not accepted +
users of degrees in current institution with all their courses in those degrees accepted */
@ -3791,7 +3812,7 @@ void Usr_GetUsrsLst (Rol_Role_t Role,Sco_Scope_t Scope,const char *UsrQuery,bool
Gbl.CurrentIns.Ins.InsCod,(unsigned) Role,
Gbl.CurrentIns.Ins.InsCod,(unsigned) Role);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
if (Search)
/* Select users of degrees in current centre with any courses in those degrees not accepted +
users of degrees in current centre with all their courses in those degrees accepted */
@ -3860,7 +3881,7 @@ void Usr_GetUsrsLst (Rol_Role_t Role,Sco_Scope_t Scope,const char *UsrQuery,bool
Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) Role,
Gbl.CurrentCtr.Ctr.CtrCod,(unsigned) Role);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
if (Search)
/* Select users of current degree with any courses in current degree not accepted +
users of current degree with all their courses in current degree accepted */
@ -3920,7 +3941,7 @@ void Usr_GetUsrsLst (Rol_Role_t Role,Sco_Scope_t Scope,const char *UsrQuery,bool
Gbl.CurrentDeg.Deg.DegCod,(unsigned) Role,
Gbl.CurrentDeg.Deg.DegCod,(unsigned) Role);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
Usr_BuildQueryToGetUsrsLstCrs (Role,UsrQuery,Search,Query);
break;
default:
@ -3928,7 +3949,7 @@ void Usr_GetUsrsLst (Rol_Role_t Role,Sco_Scope_t Scope,const char *UsrQuery,bool
break;
}
/*
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
Lay_ShowAlert (Lay_INFO,Query);
*/
/***** Get list of users from database *****/
@ -3949,7 +3970,7 @@ static void Usr_GetAdmsLst (Sco_Scope_t Scope)
/***** Build query *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
strcpy (Query,"SELECT DISTINCT admin.UsrCod,'Y',usr_data.Sex"
" FROM admin,usr_data"
" WHERE (admin.Scope='Deg'"
@ -3958,7 +3979,7 @@ static void Usr_GetAdmsLst (Sco_Scope_t Scope)
" ORDER BY usr_data.Surname1,usr_data.Surname2,"
"usr_data.FirstName,usr_data.UsrCod");
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT DISTINCT admin.UsrCod,'Y',usr_data.Sex"
" FROM centres,degrees,admin,usr_data"
" WHERE ((centres.InsCod='%ld'"
@ -3971,7 +3992,7 @@ static void Usr_GetAdmsLst (Sco_Scope_t Scope)
"usr_data.FirstName,usr_data.UsrCod",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT DISTINCT admin.UsrCod,'Y',usr_data.Sex"
" FROM degrees,admin,usr_data"
" WHERE ((degrees.CtrCod='%ld'"
@ -3983,7 +4004,7 @@ static void Usr_GetAdmsLst (Sco_Scope_t Scope)
"usr_data.FirstName,usr_data.UsrCod",
Gbl.CurrentCtr.Ctr.CtrCod);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT DISTINCT admin.UsrCod,'Y',usr_data.Sex"
" FROM admin,usr_data"
" WHERE ((admin.Scope='Deg' AND admin.Cod='%ld')"
@ -4012,13 +4033,13 @@ static void Usr_GetGstsLst (Sco_Scope_t Scope)
/***** Build query *****/
switch (Scope)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
strcpy (Query,"SELECT DISTINCT UsrCod,'N',Sex"
" FROM usr_data"
" WHERE UsrCod NOT IN (SELECT UsrCod FROM crs_usr)"
" ORDER BY Surname1,Surname2,FirstName,UsrCod");
break;
case Sco_SCOPE_COUNTRY:
case Sco_SCOPE_CTY:
sprintf (Query,"SELECT DISTINCT UsrCod,'Y',Sex"
" FROM usr_data"
" WHERE (CtyCod='%ld' OR InsCtyCod='%ld')"
@ -4027,7 +4048,7 @@ static void Usr_GetGstsLst (Sco_Scope_t Scope)
Gbl.CurrentCty.Cty.CtyCod,
Gbl.CurrentCty.Cty.CtyCod);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT DISTINCT UsrCod,'Y',Sex"
" FROM usr_data"
" WHERE InsCod='%ld'"
@ -4035,7 +4056,7 @@ static void Usr_GetGstsLst (Sco_Scope_t Scope)
" ORDER BY Surname1,Surname2,FirstName,UsrCod",
Gbl.CurrentIns.Ins.InsCod);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT DISTINCT UsrCod,'Y',Sex"
" FROM usr_data"
" WHERE CtrCod='%ld'"
@ -4141,7 +4162,7 @@ static void Usr_GetListUsrs (const char *Query,struct ListUsers *LstUsrs)
static void Usr_AllocateUsrsList (struct ListUsers *LstUsrs)
{
/*
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)
if (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)
{
sprintf (Gbl.Message,"Memory used by list = %lu",(long) sizeof (struct UsrInList) * NumUsrs);
Lay_ShowAlert (Lay_INFO,Gbl.Message);
@ -4959,7 +4980,7 @@ static void Usr_ListMainDataGsts (bool PutCheckBoxToSelectUsr)
Usr_UsrDataDestructor (&UsrDat);
}
else // Gbl.Usrs.LstGsts.NumUsrs == 0
Usr_ShowWarningNoUsersFound (Rol_ROLE_GUEST);
Usr_ShowWarningNoUsersFound (Rol_ROLE_GUEST__);
/***** Free memory for students list *****/
Usr_FreeUsrsList (&Gbl.Usrs.LstGsts);
@ -5233,7 +5254,7 @@ void Usr_ListAllDataGsts (void)
fprintf (Gbl.F.Out,"</table>");
}
else // Gbl.Usrs.LstGsts.NumUsrs == 0
Usr_ShowWarningNoUsersFound (Rol_ROLE_GUEST);
Usr_ShowWarningNoUsersFound (Rol_ROLE_GUEST__);
/***** Free memory for guests' list *****/
Usr_FreeUsrsList (&Gbl.Usrs.LstGsts);
@ -5306,13 +5327,13 @@ void Usr_ListAllDataStds (void)
if (Gbl.Usrs.LstStds.NumUsrs)
{
if (Gbl.Scope.Current == Sco_SCOPE_COURSE)
if (Gbl.Scope.Current == Sco_SCOPE_CRS)
/***** Get list of record fields in current course *****/
Rec_GetListRecordFieldsInCurrentCrs ();
/***** Set number of columns *****/
NumColumnsCommonCard = Usr_NUM_ALL_FIELDS_DATA_STD;
if (Gbl.Scope.Current == Sco_SCOPE_COURSE)
if (Gbl.Scope.Current == Sco_SCOPE_CRS)
{
NumColumnsCardAndGroups = NumColumnsCommonCard + Gbl.CurrentCrs.Grps.GrpTypes.Num;
NumColumnsTotal = NumColumnsCardAndGroups + Gbl.CurrentCrs.Records.LstFields.Num;
@ -5321,7 +5342,7 @@ void Usr_ListAllDataStds (void)
NumColumnsTotal = NumColumnsCardAndGroups = NumColumnsCommonCard;
/***** Allocate memory for the string with the list of group names where student belongs to *****/
if (Gbl.Scope.Current == Sco_SCOPE_COURSE)
if (Gbl.Scope.Current == Sco_SCOPE_CRS)
if ((GroupNames = (char *) malloc ((MAX_LENGTH_GROUP_NAME+3)*Gbl.CurrentCrs.Grps.GrpTypes.NumGrpsTotal)) == NULL)
Lay_ShowErrorAndExit ("Not enough memory to store names of groups.");
@ -5354,7 +5375,7 @@ void Usr_ListAllDataStds (void)
VERY_LIGHT_BLUE,FieldNames[NumCol]);
/* 2. Columns for the groups */
if (Gbl.Scope.Current == Sco_SCOPE_COURSE)
if (Gbl.Scope.Current == Sco_SCOPE_CRS)
{
if (Gbl.CurrentCrs.Grps.GrpTypes.Num)
for (NumGrpTyp = 0;
@ -5428,7 +5449,7 @@ void Usr_ListAllDataStds (void)
fprintf (Gbl.F.Out,"</table>");
/***** Free memory used by the string with the list of group names where student belongs to *****/
if (Gbl.Scope.Current == Sco_SCOPE_COURSE)
if (Gbl.Scope.Current == Sco_SCOPE_CRS)
free ((void *) GroupNames);
}
else // Gbl.Usrs.LstStds.NumUsrs == 0
@ -5559,13 +5580,13 @@ void Usr_ListAllDataTchs (void)
Usr_GetAndUpdatePrefsAboutUsrList ();
/***** Get scope *****/
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
1 << Sco_SCOPE_COUNTRY |
1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE |
1 << Sco_SCOPE_DEGREE |
1 << Sco_SCOPE_COURSE;
Gbl.Scope.Default = Sco_SCOPE_COURSE;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
1 << Sco_SCOPE_CTY |
1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR |
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_CRS;
Sco_GetScope ();
/***** Get and order list of teachers *****/
@ -5705,7 +5726,7 @@ unsigned Usr_ListUsrsFound (Rol_Role_t Role,const char *UsrQuery)
Usr_WriteRowTchMainData (NumUsr + 1,&UsrDat,false);
/* Write all the courses this user belongs to */
if (Role != Rol_ROLE_GUEST)
if (Role != Rol_ROLE_GUEST__)
{
fprintf (Gbl.F.Out,"<tr>"
"<td colspan=\"3\"></td>"
@ -5772,12 +5793,12 @@ void Usr_ListDataAdms (void)
Usr_GetAndUpdatePrefsAboutUsrList ();
/***** Get scope *****/
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
1 << Sco_SCOPE_COUNTRY |
1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE |
1 << Sco_SCOPE_DEGREE;
Gbl.Scope.Default = Sco_SCOPE_DEGREE;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
1 << Sco_SCOPE_CTY |
1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR |
1 << Sco_SCOPE_DEG;
Gbl.Scope.Default = Sco_SCOPE_DEG;
Sco_GetScope ();
/***** Form to select range of administrators *****/
@ -5847,7 +5868,7 @@ void Usr_ListDataAdms (void)
Lay_EndRoundFrameTable10 ();
}
else // Gbl.Usrs.LstAdms.NumUsrs == 0
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_ROLE_DEG_ADMIN]);
Lay_ShowAlert (Lay_INFO,Txt_No_users_found[Rol_ROLE_DEG_ADM]);
/***** Free memory for teachers list *****/
Usr_FreeUsrsList (&Gbl.Usrs.LstAdms);
@ -6205,9 +6226,9 @@ void Usr_SeeGuests (void)
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_CTR_ADMIN:
case Rol_ROLE_INS_ADMIN:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_CTR_ADM:
case Rol_ROLE_INS_ADM:
case Rol_ROLE_SYS_ADM:
/***** Form to select range of guests *****/
fprintf (Gbl.F.Out,"<div class=\"%s\" style=\"text-align:center;\">",
The_ClassFormul[Gbl.Prefs.Theme]);
@ -6271,21 +6292,21 @@ void Usr_SeeGuests (void)
if (Gbl.Usrs.Me.ListType == Usr_CLASS_PHOTO)
Lay_WriteHeaderClassPhoto (Gbl.Usrs.ClassPhoto.Cols,false,true,
(Gbl.Scope.Current == Sco_SCOPE_CENTRE ||
Gbl.Scope.Current == Sco_SCOPE_INSTITUTION) ? Gbl.CurrentIns.Ins.InsCod :
(Gbl.Scope.Current == Sco_SCOPE_CTR ||
Gbl.Scope.Current == Sco_SCOPE_INS) ? Gbl.CurrentIns.Ins.InsCod :
-1L,
-1L,
-1L);
/* Put a row to select all users */
Usr_PutCheckboxToSelectAllTheUsers (Rol_ROLE_GUEST);
Usr_PutCheckboxToSelectAllTheUsers (Rol_ROLE_GUEST__);
/* Draw the classphoto/list */
switch (Gbl.Usrs.Me.ListType)
{
case Usr_CLASS_PHOTO:
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_SEL_SEE,
Rol_ROLE_GUEST);
Rol_ROLE_GUEST__);
break;
case Usr_LIST:
Usr_ListMainDataGsts (true);
@ -6301,7 +6322,7 @@ void Usr_SeeGuests (void)
}
}
else
Usr_ShowWarningNoUsersFound (Rol_ROLE_GUEST);
Usr_ShowWarningNoUsersFound (Rol_ROLE_GUEST__);
/***** Free memory for students list *****/
Usr_FreeUsrsList (&Gbl.Usrs.LstGsts);
@ -6321,7 +6342,7 @@ void Usr_SeeStudents (void)
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER || // My role in current course is teacher...
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER)) // ...or superuser
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM)) // ...or superuser
{
fprintf (Gbl.F.Out,"<div style=\"text-align:center;"
" margin-bottom:10px;\">");
@ -6343,16 +6364,16 @@ void Usr_SeeStudents (void)
/***** Get scope *****/
Sco_SetScopesForListingStudents ();
Sco_GetScope ();
ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_COURSE &&
ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_CRS &&
(Gbl.Usrs.Me.LoggedRole == Rol_ROLE_STUDENT ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER));
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM));
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_DEG_ADMIN:
case Rol_ROLE_SUPERUSER:
case Rol_ROLE_DEG_ADM:
case Rol_ROLE_SYS_ADM:
/***** Form to select range of students *****/
fprintf (Gbl.F.Out,"<div class=\"%s\" style=\"text-align:center;\">",
The_ClassFormul[Gbl.Prefs.Theme]);
@ -6370,7 +6391,7 @@ void Usr_SeeStudents (void)
}
/***** Form to select groups *****/
if (Gbl.Scope.Current == Sco_SCOPE_COURSE)
if (Gbl.Scope.Current == Sco_SCOPE_CRS)
Grp_ShowFormToSelectSeveralGroups (ActLstStd);
/***** Form to select type of list of users *****/
@ -6428,15 +6449,15 @@ void Usr_SeeStudents (void)
if (Gbl.Usrs.Me.ListType == Usr_CLASS_PHOTO)
Lay_WriteHeaderClassPhoto (Gbl.Usrs.ClassPhoto.Cols,false,true,
(Gbl.Scope.Current == Sco_SCOPE_COURSE ||
Gbl.Scope.Current == Sco_SCOPE_DEGREE ||
Gbl.Scope.Current == Sco_SCOPE_CENTRE ||
Gbl.Scope.Current == Sco_SCOPE_INSTITUTION) ? Gbl.CurrentIns.Ins.InsCod :
(Gbl.Scope.Current == Sco_SCOPE_CRS ||
Gbl.Scope.Current == Sco_SCOPE_DEG ||
Gbl.Scope.Current == Sco_SCOPE_CTR ||
Gbl.Scope.Current == Sco_SCOPE_INS) ? Gbl.CurrentIns.Ins.InsCod :
-1L,
(Gbl.Scope.Current == Sco_SCOPE_COURSE ||
Gbl.Scope.Current == Sco_SCOPE_DEGREE) ? Gbl.CurrentDeg.Deg.DegCod :
(Gbl.Scope.Current == Sco_SCOPE_CRS ||
Gbl.Scope.Current == Sco_SCOPE_DEG) ? Gbl.CurrentDeg.Deg.DegCod :
-1L,
Gbl.Scope.Current == Sco_SCOPE_COURSE ? Gbl.CurrentCrs.Crs.CrsCod :
Gbl.Scope.Current == Sco_SCOPE_CRS ? Gbl.CurrentCrs.Crs.CrsCod :
-1L);
/* Put a row to select all users */
@ -6497,15 +6518,15 @@ void Usr_SeeTeachers (void)
Usr_GetAndUpdatePrefsAboutUsrList ();
/***** Get scope *****/
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
1 << Sco_SCOPE_COUNTRY |
1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE |
1 << Sco_SCOPE_DEGREE |
1 << Sco_SCOPE_COURSE;
Gbl.Scope.Default = Sco_SCOPE_COURSE;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
1 << Sco_SCOPE_CTY |
1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR |
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_CRS;
Sco_GetScope ();
ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_COURSE);
ICanViewRecords = (Gbl.Scope.Current == Sco_SCOPE_CRS);
/***** Form to select scope *****/
fprintf (Gbl.F.Out,"<div class=\"%s\" style=\"text-align:center;\">",
@ -6567,15 +6588,15 @@ void Usr_SeeTeachers (void)
if (Gbl.Usrs.Me.ListType == Usr_CLASS_PHOTO)
Lay_WriteHeaderClassPhoto (Gbl.Usrs.ClassPhoto.Cols,false,true,
(Gbl.Scope.Current == Sco_SCOPE_COURSE ||
Gbl.Scope.Current == Sco_SCOPE_DEGREE ||
Gbl.Scope.Current == Sco_SCOPE_CENTRE ||
Gbl.Scope.Current == Sco_SCOPE_INSTITUTION) ? Gbl.CurrentIns.Ins.InsCod :
(Gbl.Scope.Current == Sco_SCOPE_CRS ||
Gbl.Scope.Current == Sco_SCOPE_DEG ||
Gbl.Scope.Current == Sco_SCOPE_CTR ||
Gbl.Scope.Current == Sco_SCOPE_INS) ? Gbl.CurrentIns.Ins.InsCod :
-1L,
(Gbl.Scope.Current == Sco_SCOPE_COURSE ||
Gbl.Scope.Current == Sco_SCOPE_DEGREE) ? Gbl.CurrentDeg.Deg.DegCod :
(Gbl.Scope.Current == Sco_SCOPE_CRS ||
Gbl.Scope.Current == Sco_SCOPE_DEG) ? Gbl.CurrentDeg.Deg.DegCod :
-1L,
Gbl.Scope.Current == Sco_SCOPE_COURSE ? Gbl.CurrentCrs.Crs.CrsCod :
Gbl.Scope.Current == Sco_SCOPE_CRS ? Gbl.CurrentCrs.Crs.CrsCod :
-1L);
/* Put a row to select all users */
@ -6659,15 +6680,15 @@ void Usr_SeeGstClassPhotoPrn (void)
/***** Draw the guests' class photo *****/
Lay_StartRoundFrameTable10 (NULL,0,NULL);
Lay_WriteHeaderClassPhoto (Gbl.Usrs.ClassPhoto.Cols,true,true,
(Gbl.Scope.Current == Sco_SCOPE_CENTRE ||
Gbl.Scope.Current == Sco_SCOPE_INSTITUTION) ? Gbl.CurrentIns.Ins.InsCod :
(Gbl.Scope.Current == Sco_SCOPE_CTR ||
Gbl.Scope.Current == Sco_SCOPE_INS) ? Gbl.CurrentIns.Ins.InsCod :
-1L,
-1L,-1L);
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,Rol_ROLE_GUEST);
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,Rol_ROLE_GUEST__);
Lay_EndRoundFrameTable10 ();
}
else
Usr_ShowWarningNoUsersFound (Rol_ROLE_GUEST);
Usr_ShowWarningNoUsersFound (Rol_ROLE_GUEST__);
/***** Free memory for students list *****/
Usr_FreeUsrsList (&Gbl.Usrs.LstGsts);
@ -6699,15 +6720,15 @@ void Usr_SeeStdClassPhotoPrn (void)
/***** Draw the students' class photo *****/
Lay_StartRoundFrameTable10 (NULL,0,NULL);
Lay_WriteHeaderClassPhoto (Gbl.Usrs.ClassPhoto.Cols,true,true,
(Gbl.Scope.Current == Sco_SCOPE_COURSE ||
Gbl.Scope.Current == Sco_SCOPE_DEGREE ||
Gbl.Scope.Current == Sco_SCOPE_CENTRE ||
Gbl.Scope.Current == Sco_SCOPE_INSTITUTION) ? Gbl.CurrentIns.Ins.InsCod :
(Gbl.Scope.Current == Sco_SCOPE_CRS ||
Gbl.Scope.Current == Sco_SCOPE_DEG ||
Gbl.Scope.Current == Sco_SCOPE_CTR ||
Gbl.Scope.Current == Sco_SCOPE_INS) ? Gbl.CurrentIns.Ins.InsCod :
-1L,
(Gbl.Scope.Current == Sco_SCOPE_COURSE ||
Gbl.Scope.Current == Sco_SCOPE_DEGREE) ? Gbl.CurrentDeg.Deg.DegCod :
(Gbl.Scope.Current == Sco_SCOPE_CRS ||
Gbl.Scope.Current == Sco_SCOPE_DEG) ? Gbl.CurrentDeg.Deg.DegCod :
-1L,
Gbl.Scope.Current == Sco_SCOPE_COURSE ? Gbl.CurrentCrs.Crs.CrsCod :
Gbl.Scope.Current == Sco_SCOPE_CRS ? Gbl.CurrentCrs.Crs.CrsCod :
-1L);
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,Rol_ROLE_STUDENT);
Lay_EndRoundFrameTable10 ();
@ -6736,13 +6757,13 @@ void Usr_SeeTchClassPhotoPrn (void)
Usr_GetAndUpdatePrefsAboutUsrList ();
/***** Get scope *****/
Gbl.Scope.Allowed = 1 << Sco_SCOPE_PLATFORM |
1 << Sco_SCOPE_COUNTRY |
1 << Sco_SCOPE_INSTITUTION |
1 << Sco_SCOPE_CENTRE |
1 << Sco_SCOPE_DEGREE |
1 << Sco_SCOPE_COURSE;
Gbl.Scope.Default = Sco_SCOPE_COURSE;
Gbl.Scope.Allowed = 1 << Sco_SCOPE_SYS |
1 << Sco_SCOPE_CTY |
1 << Sco_SCOPE_INS |
1 << Sco_SCOPE_CTR |
1 << Sco_SCOPE_DEG |
1 << Sco_SCOPE_CRS;
Gbl.Scope.Default = Sco_SCOPE_CRS;
Sco_GetScope ();
/***** Get and order list of teachers *****/
@ -6753,15 +6774,15 @@ void Usr_SeeTchClassPhotoPrn (void)
/***** Draw the teachers' class photo *****/
Lay_StartRoundFrameTable10 (NULL,0,NULL);
Lay_WriteHeaderClassPhoto (Gbl.Usrs.ClassPhoto.Cols,true,true,
(Gbl.Scope.Current == Sco_SCOPE_COURSE ||
Gbl.Scope.Current == Sco_SCOPE_DEGREE ||
Gbl.Scope.Current == Sco_SCOPE_CENTRE ||
Gbl.Scope.Current == Sco_SCOPE_INSTITUTION) ? Gbl.CurrentIns.Ins.InsCod :
(Gbl.Scope.Current == Sco_SCOPE_CRS ||
Gbl.Scope.Current == Sco_SCOPE_DEG ||
Gbl.Scope.Current == Sco_SCOPE_CTR ||
Gbl.Scope.Current == Sco_SCOPE_INS) ? Gbl.CurrentIns.Ins.InsCod :
-1L,
(Gbl.Scope.Current == Sco_SCOPE_COURSE ||
Gbl.Scope.Current == Sco_SCOPE_DEGREE) ? Gbl.CurrentDeg.Deg.DegCod :
(Gbl.Scope.Current == Sco_SCOPE_CRS ||
Gbl.Scope.Current == Sco_SCOPE_DEG) ? Gbl.CurrentDeg.Deg.DegCod :
-1L,
Gbl.Scope.Current == Sco_SCOPE_COURSE ? Gbl.CurrentCrs.Crs.CrsCod :
Gbl.Scope.Current == Sco_SCOPE_CRS ? Gbl.CurrentCrs.Crs.CrsCod :
-1L);
Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN,Rol_ROLE_TEACHER);
Lay_EndRoundFrameTable10 ();
@ -6786,8 +6807,8 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
unsigned NumUsr;
bool TRIsOpen = false;
bool IAmLoggedAsTeacherOrAbove = (Gbl.Usrs.Me.LoggedRole == Rol_ROLE_TEACHER ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER);
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
bool ICanSeePhotos = (IAmLoggedAsTeacherOrAbove ||
(Gbl.Usrs.Me.MyPhotoExists &&
Gbl.Usrs.Me.UsrDat.PublicPhoto));
@ -6859,8 +6880,8 @@ static void Usr_DrawClassPhoto (Usr_ClassPhotoType_t ClassPhotoType,
ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == UsrDat.UsrCod);
ShowData = (ItsMe || UsrDat.Accepted ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADMIN ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SUPERUSER);
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_DEG_ADM ||
Gbl.Usrs.Me.LoggedRole == Rol_ROLE_SYS_ADM);
/***** Begin user's cell *****/
fprintf (Gbl.F.Out,"<td class=\"CLASSPHOTO\""
@ -7071,17 +7092,17 @@ void Usr_GetAndShowNumUsrsInPlatform (Rol_Role_t Role)
float NumUsrsPerCrs;
/***** Get the number of users belonging to any course *****/
if (Role == Rol_ROLE_GUEST) // Users not beloging to any course
if (Role == Rol_ROLE_GUEST__) // Users not beloging to any course
NumUsrs = Usr_GetNumUsrsNotBelongingToAnyCrs ();
else
NumUsrs = Usr_GetNumUsrsBelongingToAnyCrs (Role);
/***** Get average number of courses per user *****/
NumCrssPerUsr = (Role == Rol_ROLE_GUEST) ? 0 :
NumCrssPerUsr = (Role == Rol_ROLE_GUEST__) ? 0 :
Usr_GetNumCrssPerUsr (Role);
/***** Query the number of users per course *****/
NumUsrsPerCrs = (Role == Rol_ROLE_GUEST) ? 0 :
NumUsrsPerCrs = (Role == Rol_ROLE_GUEST__) ? 0 :
Usr_GetNumUsrsPerCrs (Role);
/***** Write the total number of users *****/
@ -7135,13 +7156,13 @@ static unsigned Usr_GetNumUsrsBelongingToAnyCrs (Rol_Role_t Role)
/***** Get number of users who belong to any course *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT COUNT(DISTINCT UsrCod)"
" FROM crs_usr"
" WHERE Role='%u'",
(unsigned) Role);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM centres,degrees,courses,crs_usr"
" WHERE centres.InsCod='%ld'"
@ -7152,7 +7173,7 @@ static unsigned Usr_GetNumUsrsBelongingToAnyCrs (Rol_Role_t Role)
Gbl.CurrentIns.Ins.InsCod,
(unsigned) Role);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM degrees,courses,crs_usr"
" WHERE degrees.CtrCod='%ld'"
@ -7162,7 +7183,7 @@ static unsigned Usr_GetNumUsrsBelongingToAnyCrs (Rol_Role_t Role)
Gbl.CurrentCtr.Ctr.CtrCod,
(unsigned) Role);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM courses,crs_usr"
" WHERE courses.DegCod='%ld'"
@ -7171,7 +7192,7 @@ static unsigned Usr_GetNumUsrsBelongingToAnyCrs (Rol_Role_t Role)
Gbl.CurrentDeg.Deg.DegCod,
(unsigned) Role);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
sprintf (Query,"SELECT COUNT(DISTINCT crs_usr.UsrCod)"
" FROM crs_usr"
" WHERE crs_usr.CrsCod='%ld'"
@ -7200,14 +7221,14 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
/***** Get number of courses per user from database *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT AVG(NumCrss) FROM "
"(SELECT COUNT(CrsCod) AS NumCrss"
" FROM crs_usr"
" WHERE Role='%u' GROUP BY UsrCod) AS NumCrssTable",
(unsigned) Role);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT AVG(NumCrss) FROM "
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
" FROM centres,degrees,courses,crs_usr"
@ -7220,7 +7241,7 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
Gbl.CurrentIns.Ins.InsCod,
(unsigned) Role);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT AVG(NumCrss) FROM "
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
" FROM degrees,courses,crs_usr"
@ -7232,7 +7253,7 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
Gbl.CurrentCtr.Ctr.CtrCod,
(unsigned) Role);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT AVG(NumCrss) FROM "
"(SELECT COUNT(crs_usr.CrsCod) AS NumCrss"
" FROM courses,crs_usr"
@ -7243,7 +7264,7 @@ static float Usr_GetNumCrssPerUsr (Rol_Role_t Role)
Gbl.CurrentDeg.Deg.DegCod,
(unsigned) Role);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
return 1.0;
default:
Lay_ShowErrorAndExit ("Wrong scope.");
@ -7275,14 +7296,14 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
/***** Get number of users per course from database *****/
switch (Gbl.Scope.Current)
{
case Sco_SCOPE_PLATFORM:
case Sco_SCOPE_SYS:
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
"(SELECT COUNT(UsrCod) AS NumUsrs"
" FROM crs_usr"
" WHERE Role='%u' GROUP BY CrsCod) AS NumUsrsTable",
(unsigned) Role);
break;
case Sco_SCOPE_INSTITUTION:
case Sco_SCOPE_INS:
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
" FROM centres,degrees,courses,crs_usr"
@ -7295,7 +7316,7 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
Gbl.CurrentIns.Ins.InsCod,
(unsigned) Role);
break;
case Sco_SCOPE_CENTRE:
case Sco_SCOPE_CTR:
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
" FROM degrees,courses,crs_usr"
@ -7307,7 +7328,7 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
Gbl.CurrentCtr.Ctr.CtrCod,
(unsigned) Role);
break;
case Sco_SCOPE_DEGREE:
case Sco_SCOPE_DEG:
sprintf (Query,"SELECT AVG(NumUsrs) FROM "
"(SELECT COUNT(crs_usr.UsrCod) AS NumUsrs"
" FROM courses,crs_usr"
@ -7318,7 +7339,7 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
Gbl.CurrentDeg.Deg.DegCod,
(unsigned) Role);
break;
case Sco_SCOPE_COURSE:
case Sco_SCOPE_CRS:
return (float) ((Role == Rol_ROLE_TEACHER) ? Gbl.CurrentCrs.Crs.NumTchs :
Gbl.CurrentCrs.Crs.NumStds);
default:

View File

@ -574,7 +574,7 @@ static int Svc_GetSomeUsrDataFromUsrCod (struct UsrData *UsrDat,long CrsCod)
UsrDat->RoleInCurrentCrsDB = Rol_ROLE_UNKNOWN;
}
else
UsrDat->RoleInCurrentCrsDB = Rol_ROLE_GUEST;
UsrDat->RoleInCurrentCrsDB = Rol_ROLE_GUEST__;
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_res);
@ -590,7 +590,7 @@ static int Svc_GetRoleFromInternalRole (Rol_Role_t Role)
{
switch (Role)
{
case Rol_ROLE_GUEST:
case Rol_ROLE_GUEST__:
case Rol_ROLE_VISITOR:
return 1; // guest or visitor
case Rol_ROLE_STUDENT: