From 489c687c77776df381b5596c80a656ca1a0dcaab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 18 May 2017 19:13:41 +0200 Subject: [PATCH] Version 16.216 --- swad_ID.c | 20 +- swad_account.c | 4 +- swad_action.c | 10 +- swad_announcement.c | 22 +- swad_assignment.c | 16 +- swad_attendance.c | 98 ++++---- swad_centre.c | 22 +- swad_changelog.h | 3 +- swad_chat.c | 20 +- swad_connected.c | 40 +-- swad_country.c | 20 +- swad_course.c | 38 +-- swad_degree.c | 14 +- swad_department.c | 14 +- swad_duplicate.c | 10 +- swad_enrolment.c | 188 +++++++------- swad_exam.c | 4 +- swad_file_browser.c | 76 +++--- swad_forum.c | 32 +-- swad_global.c | 8 +- swad_group.c | 28 +-- swad_help.c | 2 +- swad_indicator.c | 18 +- swad_info.c | 12 +- swad_institution.c | 22 +- swad_mail.c | 48 ++-- swad_mark.c | 6 +- swad_message.c | 28 +-- swad_network.c | 2 +- swad_notice.c | 2 +- swad_notification.c | 8 +- swad_password.c | 8 +- swad_photo.c | 36 +-- swad_profile.c | 16 +- swad_record.c | 136 +++++------ swad_report.c | 28 +-- swad_role.c | 48 ++-- swad_role_type.h | 26 +- swad_scope.c | 4 +- swad_search.c | 28 +-- swad_session.c | 4 +- swad_statistic.c | 186 +++++++------- swad_string.c | 2 +- swad_survey.c | 30 +-- swad_survey.h | 2 +- swad_syllabus.c | 2 +- swad_tab.c | 2 +- swad_test.c | 44 ++-- swad_text.c | 580 ++++++++++++++++++++++---------------------- swad_timetable.c | 4 +- swad_user.c | 348 +++++++++++++------------- swad_web_service.c | 96 ++++---- 52 files changed, 1232 insertions(+), 1233 deletions(-) diff --git a/swad_ID.c b/swad_ID.c index e4756429..569108d1 100644 --- a/swad_ID.c +++ b/swad_ID.c @@ -406,13 +406,13 @@ bool ID_ICanSeeOtherUsrIDs (const struct UsrData *UsrDat) /***** Check if I have permission to see another user's IDs *****/ switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_TEACHER: + case Rol_TCH: /* Check 1: I can see the IDs of users who do not exist in database */ if (UsrDat->UsrCod <= 0) // User does not exist (when creating a new user) return true; /* Check 2: I can see the IDs of confirmed students */ - if (UsrDat->RoleInCurrentCrsDB == Rol_STUDENT && // A student + if (UsrDat->RoleInCurrentCrsDB == Rol_STD && // A student UsrDat->Accepted) // who accepted registration return true; @@ -450,8 +450,8 @@ static void ID_PutLinkToConfirmID (struct UsrData *UsrDat,unsigned NumID, extern const char *Txt_Confirm_ID; /***** Start form *****/ - Act_FormStartAnchor ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActCnfID_Std : - (UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActCnfID_Tch : + Act_FormStartAnchor ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActCnfID_Std : + (UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActCnfID_Tch : ActCnfID_Oth), Anchor); if (Gbl.Action.Original != ActUnk) @@ -498,8 +498,8 @@ void ID_PutLinkToChangeUsrIDs (void) Txt_Change_IDs,Txt_Change_IDs, NULL); else // Not me - Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT ? ActFrmIDsStd : - (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TEACHER ? ActFrmIDsTch : + Lay_PutContextualLink ( Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_STD ? ActFrmIDsStd : + (Gbl.Usrs.Other.UsrDat.RoleInCurrentCrsDB == Rol_TCH ? ActFrmIDsTch : ActFrmIDsOth), // Guest, visitor or admin NULL,Usr_PutParamOtherUsrCodEncrypted, "arroba64x64.gif", @@ -587,8 +587,8 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe) Act_FormStart (ActRemID_Me); else { - Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActRemID_Std : - (UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActRemID_Tch : + Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActRemID_Std : + (UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActRemID_Tch : ActRemID_Oth)); // Guest, visitor or admin Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); } @@ -641,8 +641,8 @@ void ID_ShowFormChangeUsrID (const struct UsrData *UsrDat,bool ItsMe) Act_FormStart (ActNewIDMe); else { - Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STUDENT ? ActNewID_Std : - (UsrDat->RoleInCurrentCrsDB == Rol_TEACHER ? ActNewID_Tch : + Act_FormStart ( UsrDat->RoleInCurrentCrsDB == Rol_STD ? ActNewID_Std : + (UsrDat->RoleInCurrentCrsDB == Rol_TCH ? ActNewID_Tch : ActNewID_Oth)); // Guest, visitor or admin Usr_PutParamUsrCodEncrypted (UsrDat->EncryptedUsrCod); } diff --git a/swad_account.c b/swad_account.c index 8d39f11e..196cd609 100644 --- a/swad_account.c +++ b/swad_account.c @@ -312,8 +312,8 @@ static void Acc_WriteRowEmptyAccount (unsigned NumUsr,const char *ID,struct UsrD "", Gbl.RowEvenOdd); UsrDat->Sex = Usr_SEX_UNKNOWN; - Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_TEACHER); - Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_STUDENT); + Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_TCH); + Crs_GetAndWriteCrssOfAUsr (UsrDat,Rol_STD); fprintf (Gbl.F.Out,"" ""); } diff --git a/swad_action.c b/swad_action.c index 25c1c165..e6ff72a4 100644 --- a/swad_action.c +++ b/swad_action.c @@ -5073,7 +5073,7 @@ void Act_AdjustCurrentAction (void) or if I'm a teacher and I haven't filled my centre or department, the only action possible is to show a form to change my common record *****/ Rol_GetRolesInAllCrssIfNotYetGot (&Gbl.Usrs.Me.UsrDat); - IAmATeacher = (Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_TEACHER)); + IAmATeacher = (Gbl.Usrs.Me.UsrDat.Roles & (1 << Rol_TCH)); if (Gbl.Usrs.Me.UsrDat.InsCod < 0 || (IAmATeacher && (Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0 || Gbl.Usrs.Me.UsrDat.Tch.DptCod < 0))) @@ -5111,7 +5111,7 @@ void Act_AdjustCurrentAction (void) the only action possible is show a form to ask for enrolment *****/ if (!Gbl.Usrs.Me.UsrDat.Accepted && Gbl.Action.Act != ActLogOut) { - Gbl.Action.Act = (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STUDENT) ? ActReqAccEnrStd : + Gbl.Action.Act = (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_STD) ? ActReqAccEnrStd : ActReqAccEnrTch; Tab_SetCurrentTab (); return; @@ -5120,7 +5120,7 @@ void Act_AdjustCurrentAction (void) /***** Depending on the role I am logged... *****/ switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_STUDENT: + case Rol_STD: switch (Gbl.Action.Act) { case ActLogIn: @@ -5154,7 +5154,7 @@ void Act_AdjustCurrentAction (void) /* If I have no photo, and current action is not available for unknown users, then update number of clicks without photo */ if (!Gbl.Usrs.Me.MyPhotoExists) - if (!(Act_Actions[Gbl.Action.Act].PermissionCrsIfIBelong & (1 << Rol_UNKNOWN)) && // If current action is not available for unknown users... + if (!(Act_Actions[Gbl.Action.Act].PermissionCrsIfIBelong & (1 << Rol_UNK)) && // If current action is not available for unknown users... Gbl.Action.Act != ActReqMyPho) // ...and current action is not ActReqMyPho... if ((Gbl.Usrs.Me.NumAccWithoutPhoto = Pho_UpdateMyClicksWithoutPhoto ()) > Pho_MAX_CLICKS_WITHOUT_PHOTO) { @@ -5171,7 +5171,7 @@ void Act_AdjustCurrentAction (void) if (Gbl.Action.Act == ActMnu) // Do the following check sometimes, for example when the user changes the current tab Gbl.CurrentCrs.Info.ShowMsgMustBeRead = Inf_GetIfIMustReadAnyCrsInfoInThisCrs (); break; - case Rol_TEACHER: + case Rol_TCH: if (Gbl.Action.Act == ActReqTst || Gbl.Action.Act == ActEdiTstQst) /***** If current course has tests and pluggable is unknown, diff --git a/swad_announcement.c b/swad_announcement.c index d8357bb0..06dc970d 100644 --- a/swad_announcement.c +++ b/swad_announcement.c @@ -115,7 +115,7 @@ void Ann_ShowAllAnnouncements (void) " WHERE Status=%u AND (Roles&%u)<>0 " " ORDER BY AnnCod DESC", (unsigned) Ann_ACTIVE_ANNOUNCEMENT, - (unsigned) (1 << Rol_UNKNOWN)); + (unsigned) (1 << Rol_UNK)); NumAnnouncements = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get announcements"); /***** Start frame *****/ @@ -343,8 +343,8 @@ static void Ann_DrawAnAnnouncement (long AnnCod,Ann_Status_t Status, /* Users' roles who can view this announcement */ fprintf (Gbl.F.Out,"

%s:", UsersClass[Status],Txt_Users); - for (Role = Rol_UNKNOWN, SomeRolesAreSelected = false; - Role <= Rol_TEACHER; + for (Role = Rol_UNK, SomeRolesAreSelected = false; + Role <= Rol_TCH; Role++) if (Roles & (1 << Role)) { @@ -425,14 +425,14 @@ void Ann_ShowFormAnnouncement (void) "", The_ClassForm[Gbl.Prefs.Theme], Txt_Users); - Rol_WriteSelectorRoles (1 << Rol_UNKNOWN | - 1 << Rol__GUEST_ | - 1 << Rol_STUDENT | - 1 << Rol_TEACHER, - 1 << Rol_UNKNOWN | - 1 << Rol__GUEST_ | - 1 << Rol_STUDENT | - 1 << Rol_TEACHER, + Rol_WriteSelectorRoles (1 << Rol_UNK | + 1 << Rol_GST | + 1 << Rol_STD | + 1 << Rol_TCH, + 1 << Rol_UNK | + 1 << Rol_GST | + 1 << Rol_STD | + 1 << Rol_TCH, false,false); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_assignment.c b/swad_assignment.c index 898849fe..e4684d9b 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -241,7 +241,7 @@ static void Asg_PutHeadForSeeing (bool PrintView) static bool Asg_CheckIfICanCreateAssignments (void) { - return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || + return (bool) (Gbl.Usrs.Me.LoggedRole == Rol_TCH || Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); } @@ -508,7 +508,7 @@ static void Asg_WriteAssignmentFolder (struct Assignment *Asg,bool PrintView) bool ICanSendFiles = !Asg->Hidden && // It's visible (not hidden) Asg->Open && // It's open (inside dates) Asg->IBelongToCrsOrGrps && // I belong to course or groups - Gbl.Usrs.Me.LoggedRole == Rol_STUDENT; // I am a student + Gbl.Usrs.Me.LoggedRole == Rol_STD; // I am a student /***** Folder icon *****/ if (!PrintView && // Not print view @@ -574,7 +574,7 @@ static void Asg_PutFormsToRemEditOneAsg (long AsgCod,bool Hidden) switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_TEACHER: + case Rol_TCH: case Rol_SYS_ADM: /***** Put form to remove assignment *****/ Lay_PutContextualIconToRemove (ActReqRemAsg,Asg_PutParams); @@ -588,7 +588,7 @@ static void Asg_PutFormsToRemEditOneAsg (long AsgCod,bool Hidden) /***** Put form to edit assignment *****/ Lay_PutContextualIconToEdit (ActEdiOneAsg,Asg_PutParams); // no break - case Rol_STUDENT: + case Rol_STD: /***** Put form to print assignment *****/ Lay_PutContextualIconToPrint (ActPrnOneAsg,Asg_PutParams); break; @@ -630,7 +630,7 @@ void Asg_GetListAssignments (void) /***** Get list of assignments from database *****/ switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_TEACHER: + case Rol_TCH: case Rol_SYS_ADM: HiddenSubQuery[0] = '\0'; break; @@ -1713,8 +1713,8 @@ static bool Asg_CheckIfIBelongToCrsOrGrpsThisAssignment (long AsgCod) { char Query[512]; - if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT || - Gbl.Usrs.Me.LoggedRole == Rol_TEACHER) + if (Gbl.Usrs.Me.LoggedRole == Rol_STD || + Gbl.Usrs.Me.LoggedRole == Rol_TCH) { // Students and teachers can edit assignments depending on groups /***** Get if I can edit an assignment from database *****/ @@ -1733,7 +1733,7 @@ static bool Asg_CheckIfIBelongToCrsOrGrpsThisAssignment (long AsgCod) return (DB_QueryCOUNT (Query,"can not check if I can do an assignment") != 0); } else - return (Gbl.Usrs.Me.LoggedRole > Rol_TEACHER); // Admins can edit assignments + return (Gbl.Usrs.Me.LoggedRole > Rol_TCH); // Admins can edit assignments } /*****************************************************************************/ diff --git a/swad_attendance.c b/swad_attendance.c index 77ef4377..262fa85d 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -163,10 +163,10 @@ void Att_SeeAttEvents (void) if (Gbl.AttEvents.Num) switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_STUDENT: + case Rol_STD: Att_PutFormToListMyAttendance (); break; - case Rol_TEACHER: + case Rol_TCH: case Rol_SYS_ADM: Att_PutFormToListStdsAttendance (); break; @@ -203,7 +203,7 @@ static void Att_ShowAllAttEvents (void) Dat_StartEndTime_t Order; struct Pagination Pagination; unsigned NumAttEvent; - bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TEACHER || + bool ICanEdit = (Gbl.Usrs.Me.LoggedRole == Rol_TCH || Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM); /***** Compute variables related to pagination *****/ @@ -261,7 +261,7 @@ static void Att_ShowAllAttEvents (void) "" "", Txt_Event, - Txt_ROLES_PLURAL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN]); + Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN]); /***** Write all the attendance events *****/ for (NumAttEvent = Pagination.FirstItemVisible, Gbl.RowEvenOdd = 0; @@ -372,7 +372,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt Gbl.RowEvenOdd); switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_TEACHER: + case Rol_TCH: case Rol_SYS_ADM: Att_PutFormsToRemEditOneAttEvent (Att->AttCod,Att->Hidden); break; @@ -597,7 +597,7 @@ static void Att_GetListAttEvents (Att_OrderTime_t Order) /***** Get list of attendance events from database *****/ switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_TEACHER: + case Rol_TCH: case Rol_SYS_ADM: HiddenSubQuery[0] = '\0'; break; @@ -1819,10 +1819,10 @@ void Att_SeeOneAttEvent (void) switch (Gbl.Usrs.Me.LoggedRole) { - case Rol_STUDENT: + case Rol_STD: Att_ListAttOnlyMeAsStudent (&Att); break; - case Rol_TEACHER: + case Rol_TCH: case Rol_SYS_ADM: /***** Show list of students *****/ Att_ListAttStudents (&Att); @@ -1874,7 +1874,7 @@ static void Att_ListAttOnlyMeAsStudent (struct AttendanceEvent *Att) "%s" "" "", - Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], + Txt_ROLES_SINGUL_Abc[Rol_STD][Usr_SEX_UNKNOWN], Txt_Student_comment, Txt_Teachers_comment); @@ -1912,7 +1912,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att) Grp_GetParCodsSeveralGrpsToShowUsrs (); /***** Get and order list of students in this course *****/ - Usr_GetListUsrs (Rol_STUDENT,Sco_SCOPE_CRS); + Usr_GetListUsrs (Rol_STD,Sco_SCOPE_CRS); /***** Start frame *****/ Lay_StartRoundFrame (NULL,Txt_Attendance,NULL,Hlp_USERS_Attendance); @@ -1920,7 +1920,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att) /***** Form to select groups *****/ Grp_ShowFormToSelectSeveralGroups (ActSeeOneAtt); - if (Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs) + if (Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs) { /***** Get my preference about photos in users' list for current course *****/ Usr_GetMyPrefAboutListWithPhotosFromDB (); @@ -1952,17 +1952,17 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att) "%s" "" "", - Txt_ROLES_SINGUL_Abc[Rol_STUDENT][Usr_SEX_UNKNOWN], + Txt_ROLES_SINGUL_Abc[Rol_STD][Usr_SEX_UNKNOWN], Txt_Student_comment, Txt_Teachers_comment); /* List of students */ for (NumStd = 0, Gbl.RowEvenOdd = 0; - NumStd < Gbl.Usrs.LstUsrs[Rol_STUDENT].NumUsrs; + NumStd < Gbl.Usrs.LstUsrs[Rol_STD].NumUsrs; NumStd++) { /* Copy user's basic data from list */ - Usr_CopyBasicUsrDataFromList (&UsrDat,&Gbl.Usrs.LstUsrs[Rol_STUDENT].Lst[NumStd]); + Usr_CopyBasicUsrDataFromList (&UsrDat,&Gbl.Usrs.LstUsrs[Rol_STD].Lst[NumStd]); /* Get list of user's IDs */ ID_GetListIDsFromUsrCod (&UsrDat); @@ -1982,13 +1982,13 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att) Usr_UsrDataDestructor (&UsrDat); } else - Usr_ShowWarningNoUsersFound (Rol_STUDENT); + Usr_ShowWarningNoUsersFound (Rol_STD); /***** End frame *****/ Lay_EndRoundFrame (); /***** Free memory for students list *****/ - Usr_FreeUsrsList (Rol_STUDENT); + Usr_FreeUsrsList (Rol_STD); /***** Free memory for list of selected groups *****/ Grp_FreeListCodSelectedGrps (); @@ -2036,7 +2036,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat UsrDat->EncryptedUsrCod); if (Present) // This student has attended to the event? fprintf (Gbl.F.Out," checked=\"checked\""); - if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT) // A student can not change his attendance + if (Gbl.Usrs.Me.LoggedRole == Rol_STD) // A student can not change his attendance fprintf (Gbl.F.Out," disabled=\"disabled\""); fprintf (Gbl.F.Out," />" ""); @@ -2084,7 +2084,7 @@ static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat /***** Student's comment: write form or text */ fprintf (Gbl.F.Out,"", Gbl.RowEvenOdd); - if (Gbl.Usrs.Me.LoggedRole == Rol_STUDENT && Att->Open) // Show with form + if (Gbl.Usrs.Me.LoggedRole == Rol_STD && Att->Open) // Show with form fprintf (Gbl.F.Out,"