diff --git a/swad_changelog.h b/swad_changelog.h index 11187a02c..74f43b933 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -98,11 +98,12 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 14.130.1 (2015/09/14)" +#define Log_PLATFORM_VERSION "SWAD 14.130.2 (2015/09/14)" // 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 sql/swad*.sql | tail -1 /* + Version 14.130.2: Sep 14, 2015 Changes in user enrollment. (184359 lines) Version 14.130.1: Sep 14, 2015 Changes and bug fixing in user enrollment. (184416 lines) 3 changes necessary in database: UPDATE actions SET Obsolete='Y' WHERE ActCod='799'; diff --git a/swad_enrollment.c b/swad_enrollment.c index 81f436517..26071ce1d 100644 --- a/swad_enrollment.c +++ b/swad_enrollment.c @@ -493,18 +493,18 @@ static void Enr_ReqAdminUsrs (Rol_Role_t Role) static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role) { extern const char *The_ClassTitle[The_NUM_THEMES]; - extern const char *Txt_Admin_several_users; + extern const char *Txt_Admin_several_students; + extern const char *Txt_Admin_several_teachers; extern const char *Txt_Step_1_Provide_a_list_of_users; extern const char *Txt_Option_a_Import_students_from_the_official_lists; extern const char *Txt_Select_the_groups_of_students_you_want_to_register_in_remove_from_this_course; extern const char *Txt_Option_b_Type_or_paste_a_list_of_users; extern const char *Txt_Type_or_paste_a_list_of_IDs_nicks_or_emails_; - extern const char *Txt_Step_2_Select_the_type_of_users_to_register_remove; - extern const char *Txt_Step_3_Select_the_desired_action; - extern const char *Txt_Step_4_Optionally_select_groups; + extern const char *Txt_Step_2_Select_the_desired_action; + extern const char *Txt_Step_3_Optionally_select_groups; extern const char *Txt_Select_the_groups_in_from_which_you_want_to_register_remove_users_; extern const char *Txt_No_groups_have_been_created_in_the_course_X_Therefore_; - extern const char *Txt_Step_5_Confirm_the_enrollment_removing; + extern const char *Txt_Step_4_Confirm_the_enrollment_removing; extern const char *Txt_Confirm; bool PutFormRemAllStdsThisCrs = (Role == Rol_STUDENT && Gbl.CurrentCrs.Crs.CrsCod > 0); // Course selected @@ -533,7 +533,8 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role) ActRcvFrmEnrSevTch); /***** Start frame *****/ - Lay_StartRoundFrame (NULL,Txt_Admin_several_users); + Lay_StartRoundFrame (NULL,Role == Rol_STUDENT ? Txt_Admin_several_students : + Txt_Admin_several_teachers); /***** Step 1: List of students to be enrolled / removed *****/ fprintf (Gbl.F.Out,"
" @@ -564,29 +565,20 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role) Lay_ShowAlert (Lay_INFO,Txt_Type_or_paste_a_list_of_IDs_nicks_or_emails_); Enr_PutAreaToEnterUsrsIDs (); - /***** Step 2: Select type of user to register/remove to/from current course *****/ + /***** Step 2: Put different actions to register/remove users to/from current course *****/ fprintf (Gbl.F.Out,"
" "%s" "
", The_ClassTitle[Gbl.Prefs.Theme], - Txt_Step_2_Select_the_type_of_users_to_register_remove); - if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected - Rol_PutAllRolesRegRemUsrsCrs (); - - /***** Step 3: Put different actions to register/remove students to/from current course *****/ - fprintf (Gbl.F.Out,"
" - "%s" - "
", - The_ClassTitle[Gbl.Prefs.Theme], - Txt_Step_3_Select_the_desired_action); + Txt_Step_2_Select_the_desired_action); Enr_PutActionsRegRemSeveralUsrs (); - /***** Step 4: Select groups in which register / remove students *****/ + /***** Step 3: Select groups in which register / remove users *****/ fprintf (Gbl.F.Out,"
" "%s" "
", The_ClassTitle[Gbl.Prefs.Theme], - Txt_Step_4_Optionally_select_groups); + Txt_Step_3_Optionally_select_groups); if (Gbl.CurrentCrs.Crs.CrsCod > 0) // Course selected { if (Gbl.CurrentCrs.Grps.NumGrps) // This course has groups? @@ -603,12 +595,12 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role) } } - /***** Step 5: Confirm register / remove students *****/ + /***** Step 4: Confirm register / remove students *****/ fprintf (Gbl.F.Out,"
" "%s" "
", The_ClassTitle[Gbl.Prefs.Theme], - Txt_Step_5_Confirm_the_enrollment_removing); + Txt_Step_4_Confirm_the_enrollment_removing); Pwd_AskForConfirmationOnDangerousAction (); /***** Send button and end frame *****/ @@ -1130,7 +1122,6 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) char UnsignedStr[10+1]; unsigned UnsignedNum; long LongNum; - Rol_Role_t RegRemRole = Rol_STUDENT; struct { bool RemoveUsrs; @@ -1154,33 +1145,25 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) Enr_RegRemUsrsAction_t RegRemUsrsAction; bool ErrorInForm = false; + /***** Check the role of users to register / remove *****/ + switch (Role) + { + case Rol_STUDENT: + break; + case Rol_TEACHER: + if (Gbl.Usrs.Me.LoggedRole < Rol_DEG_ADM) // Can I register/remove teachers? + // No, I can not (TODO: teachers should be able to register/remove existing teachers) + Lay_ShowErrorAndExit ("You are not allowed to perform this action."); + break; + default: + Lay_ShowErrorAndExit ("Wrong role."); + break; + } + /***** Get confirmation *****/ if (!Pwd_GetConfirmationOnDangerousAction ()) return; - /***** Get the type of user to register / remove *****/ - Par_GetParToText ("RegRemRole",UnsignedStr,1); - if (UnsignedStr[0]) - switch ((RegRemRole = Rol_ConvertUnsignedStrToRole (UnsignedStr))) - { - case Rol_STUDENT: - break; - case Rol_TEACHER: - switch (Gbl.Usrs.Me.LoggedRole) // Can I register/remove teachers? - { - case Rol_DEG_ADM: - case Rol_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 - break; - } - break; - default: - Lay_ShowErrorAndExit ("Wrong role."); // If user manipulated the form - break; - } - /***** Get the action to do *****/ WhatToDo.RemoveUsrs = false; WhatToDo.RemoveSpecifiedUsrs = false; @@ -1259,7 +1242,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) /***** A student can't belong to more than one group when the type of group only allows to register in one group *****/ if (WhatToDo.RegisterUsrs && - RegRemRole == Rol_STUDENT && + Role == Rol_STUDENT && LstGrps.NumGrps >= 2) /* Check if I have selected more than one group of single enrollment */ if (!Grp_CheckIfSelectionGrpsIsValid (&LstGrps)) @@ -1286,7 +1269,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) if (WhatToDo.RemoveUsrs) { /***** Get list of users in current course *****/ - switch (RegRemRole) + switch (Role) { case Rol_STUDENT: Usr_GetUsrsLst (Rol_STUDENT,Sco_SCOPE_CRS,NULL,false); @@ -1312,7 +1295,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) /***** Loop 1: go through form list setting if a student must be removed *****/ /* Step a: Get students from a list of official groups */ - if (RegRemRole == Rol_STUDENT) + if (Role == Rol_STUDENT) { Ptr = ListExternalGrpCods; while (*Ptr) @@ -1450,7 +1433,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) if (WhatToDo.RegisterUsrs) // TODO: !!!!! NO CAMBIAR EL ROL DE LOS USUARIOS QUE YA ESTÉN EN LA ASIGNATURA SI HAY MÁS DE UN USUARIO ENCONTRADO PARA EL MISMO DNI !!!!!! { /***** Step a: Get users from a list of official groups *****/ - if (RegRemRole == Rol_STUDENT) + if (Role == Rol_STUDENT) { Ptr = ListExternalGrpCods; while (*Ptr) @@ -1527,10 +1510,10 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) NumUsrFound++) { UsrDat.UsrCod = ListUsrCods.Lst[NumUsrFound]; - Enr_RegisterUsr (&UsrDat,RegRemRole,&LstGrps,&NumUsrsRegistered); + Enr_RegisterUsr (&UsrDat,Role,&LstGrps,&NumUsrsRegistered); } else if (ItLooksLikeAUsrID) // User not found. He/she is a new user. Register him/her using ID - Enr_RegisterUsr (&UsrDat,RegRemRole,&LstGrps,&NumUsrsRegistered); + Enr_RegisterUsr (&UsrDat,Role,&LstGrps,&NumUsrsRegistered); /* Free memory used for list of users' codes found for this ID */ Usr_FreeListUsrCods (&ListUsrCods); @@ -2583,11 +2566,14 @@ void Enr_PutLinkToAdminOneUsr (Act_Action_t NextAction) void Enr_PutLinkToAdminSeveralUsrs (Rol_Role_t Role) { - extern const char *Txt_Admin_several_users; + extern const char *Txt_Admin_several_students; + extern const char *Txt_Admin_several_teachers; Act_PutContextualLink (Role == Rol_STUDENT ? ActReqMdfSevStd : ActReqMdfSevTch, - NULL,"configtest",Txt_Admin_several_users); + NULL,"configtest", + Role == Rol_STUDENT ? Txt_Admin_several_students : + Txt_Admin_several_teachers); } /*****************************************************************************/ @@ -2668,17 +2654,12 @@ static void Enr_ReqAnotherUsrIDToRegisterRemove (Rol_Role_t Role) extern const char *Txt_Admin_one_user; /***** Put contextual links *****/ - if (Gbl.CurrentCrs.Crs.CrsCod > 0 || - Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) + if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) { fprintf (Gbl.F.Out,"
"); - if (Gbl.CurrentCrs.Crs.CrsCod > 0) - /* Put link to go to admin several users */ - Enr_PutLinkToAdminSeveralUsrs (Role); - else if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM) - /* Put link to remove old users */ - Enr_PutLinkToRemOldUsrs (); + /* Put link to remove old users */ + Enr_PutLinkToRemOldUsrs (); fprintf (Gbl.F.Out,"
"); } diff --git a/swad_role.c b/swad_role.c index 09f5a1c84..d9a2c3cfc 100644 --- a/swad_role.c +++ b/swad_role.c @@ -56,8 +56,6 @@ extern struct Globals Gbl; /***************************** Private prototypes ****************************/ /*****************************************************************************/ -static void Rol_PutOneRoleRegRemUsrsCrs (Rol_Role_t Role,bool Checked); - /*****************************************************************************/ /****************** Get number of available roles for me *********************/ /*****************************************************************************/ @@ -391,50 +389,6 @@ void Rol_GetSelectedRoles (unsigned *Roles) } } -/*****************************************************************************/ -/*** Select types of user to register/remove users to/from current course ****/ -/*****************************************************************************/ - -void Rol_PutAllRolesRegRemUsrsCrs (void) - { - extern const char *The_ClassForm[The_NUM_THEMES]; - - /***** Students or teachers *****/ - fprintf (Gbl.F.Out,"
" - "" - "
"); - } - -/*****************************************************************************/ -/*** Select types of user to register/remove users to/from current course ****/ -/*****************************************************************************/ - -static void Rol_PutOneRoleRegRemUsrsCrs (Rol_Role_t Role,bool Checked) - { - extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; - - fprintf (Gbl.F.Out,"
  • " - "%s
  • ", - Txt_ROLES_SINGUL_Abc[Role][Usr_SEX_UNKNOWN]); - } - /*****************************************************************************/ /************ Get requested role of a user in current course *****************/ /*****************************************************************************/ diff --git a/swad_role.h b/swad_role.h index 51019be5a..4d3623fb3 100644 --- a/swad_role.h +++ b/swad_role.h @@ -81,8 +81,6 @@ void Rol_ChangeMyRole (void); void Rol_WriteSelectorRoles (unsigned Roles); void Rol_GetSelectedRoles (unsigned *Roles); -void Rol_PutAllRolesRegRemUsrsCrs (void); - Rol_Role_t Rol_GetRequestedRole (long UsrCod); #endif diff --git a/swad_text.c b/swad_text.c index 75563a5da..bdc41ed91 100644 --- a/swad_text.c +++ b/swad_text.c @@ -1906,25 +1906,46 @@ const char *Txt_Admin_user = "Gerenciar utilizador"; #endif -const char *Txt_Admin_several_users = +const char *Txt_Admin_several_students = #if L==0 - "Administrar diversos usuaris"; + "Administrar diversos estudiants"; #elif L==1 - "Verwalten Sie mehrere Benutzer"; + "Verwalten Sie mehrere Studenten"; #elif L==2 - "Admin several users"; + "Admin several students"; #elif L==3 - "Administrar varios usuarios"; + "Administrar varios estudiantes"; #elif L==4 - "Gérer plusieurs utilisateurs"; + "Gérer plusieurs étudiants"; #elif L==5 - "Administrar varios usuarios"; // Okoteve traducción + "Administrar varios estudiantes"; // Okoteve traducción #elif L==6 - "Gestire più utenti"; + "Gestire più studenti"; #elif L==7 - "Zarządzaj wielu użytkowników"; + "Zarządzaj wielu studenci"; #elif L==8 - "Gerenciar vários utilizadores"; + "Gerenciar vários estudantes"; +#endif + +const char *Txt_Admin_several_teachers = +#if L==0 + "Administrar diversos professors"; +#elif L==1 + "Verwalten Sie mehrere Lehrkräfte"; +#elif L==2 + "Admin several teachers"; +#elif L==3 + "Administrar varios profesores"; +#elif L==4 + "Gérer plusieurs enseignants"; +#elif L==5 + "Administrar varios profesores"; // Okoteve traducción +#elif L==6 + "Gestire più professori"; +#elif L==7 + "Zarządzaj wielu nauczycieli"; +#elif L==8 + "Gerenciar vários professores"; #endif const char *Txt_All = @@ -36611,88 +36632,67 @@ const char *Txt_Step_1_Provide_a_list_of_users = "Step 1: Provide a list of users"; // Necessita de tradução #endif -const char *Txt_Step_2_Select_the_type_of_users_to_register_remove = +const char *Txt_Step_2_Select_the_desired_action = #if L==0 - "Paso 2: Seleccione el tipo de usuarios a inscribir / eliminar"; // Necessita traduccio + "Paso 2: Seleccione la acción que desea realizar"; // Necessita traduccio #elif L==1 - "Step 2: Select the type of users to register / remove"; // Need Übersetzung + "Step 2: Select the desired action"; // Need Übersetzung #elif L==2 - "Step 2: Select the type of users to register / remove"; + "Step 2: Select the desired action"; #elif L==3 - "Paso 2: Seleccione el tipo de usuarios a inscribir / eliminar"; + "Paso 2: Seleccione la acción que desea realizar"; #elif L==4 - "Step 2: Select the type of users to register / remove"; // Besoin de traduction + "Step 2: Select the desired action"; // Besoin de traduction #elif L==5 - "Paso 2: Seleccione el tipo de usuarios a inscribir / eliminar"; // Okoteve traducción + "Paso 2: Seleccione la acción que desea realizar"; // Okoteve traducción #elif L==6 - "Passo 2: Seleziona il tipo di utenti da registrare / rimuovere"; + "Passo 2: Seleziona l'azione desiderata"; #elif L==7 - "Step 2: Select the type of users to register / remove"; // Potrzebujesz tlumaczenie + "Step 2: Select the desired action"; // Potrzebujesz tlumaczenie #elif L==8 - "Step 2: Select the type of users to register / remove"; // Necessita de tradução + "Step 2: Select the desired action"; // Necessita de tradução #endif -const char *Txt_Step_3_Select_the_desired_action = +const char *Txt_Step_3_Optionally_select_groups = #if L==0 - "Paso 3: Seleccione la acción que desea realizar"; // Necessita traduccio + "Paso 3: Opcionalmente, seleccione grupos"; // Necessita traduccio #elif L==1 - "Step 3: Select the desired action"; // Need Übersetzung + "Step 3: Optionally, select groups"; // Need Übersetzung #elif L==2 - "Step 3: Select the desired action"; + "Step 3: Optionally, select groups"; #elif L==3 - "Paso 3: Seleccione la acción que desea realizar"; + "Paso 3: Opcionalmente, seleccione grupos"; #elif L==4 - "Step 3: Select the desired action"; // Besoin de traduction + "Step 3: Optionally, select groups"; // Besoin de traduction #elif L==5 - "Paso 3: Seleccione la acción que desea realizar"; // Okoteve traducción + "Paso 3: Opcionalmente, seleccione grupos"; // Okoteve traducción #elif L==6 - "Passo 3: Seleziona l'azione desiderata"; + "Passo 3: A scelta, seleziona i gruppi"; #elif L==7 - "Step 3: Select the desired action"; // Potrzebujesz tlumaczenie + "Step 3: Optionally, select groups"; // Potrzebujesz tlumaczenie #elif L==8 - "Step 3: Select the desired action"; // Necessita de tradução + "Step 3: Optionally, select groups"; // Necessita de tradução #endif -const char *Txt_Step_4_Optionally_select_groups = +const char *Txt_Step_4_Confirm_the_enrollment_removing = #if L==0 - "Paso 4: Opcionalmente, seleccione grupos"; // Necessita traduccio + "Paso 4: Confirme la inscripción / eliminación"; // Necessita traduccio #elif L==1 - "Step 4: Optionally, select groups"; // Need Übersetzung + "Step 4: Confirm the enrollment / removing"; // Need Übersetzung #elif L==2 - "Step 4: Optionally, select groups"; + "Step 4: Confirm the enrollment / removing"; #elif L==3 - "Paso 4: Opcionalmente, seleccione grupos"; + "Paso 4: Confirme la inscripción / eliminación"; #elif L==4 - "Step 4: Optionally, select groups"; // Besoin de traduction + "Step 4: Confirm the enrollment / removing"; // Besoin de traduction #elif L==5 - "Paso 4: Opcionalmente, seleccione grupos"; // Okoteve traducción + "Paso 4: Confirme la inscripción / eliminación"; // Okoteve traducción #elif L==6 - "Passo 4: A scelta, seleziona i gruppi"; + "Passo 4: Conferma la registrazione / rimozione"; #elif L==7 - "Step 4: Optionally, select groups"; // Potrzebujesz tlumaczenie + "Step 4: Confirm the enrollment / removing"; // Potrzebujesz tlumaczenie #elif L==8 - "Step 4: Optionally, select groups"; // Necessita de tradução -#endif - -const char *Txt_Step_5_Confirm_the_enrollment_removing = -#if L==0 - "Paso 5: Confirme la inscripción / eliminación"; // Necessita traduccio -#elif L==1 - "Step 5: Confirm the enrollment / removing"; // Need Übersetzung -#elif L==2 - "Step 5: Confirm the enrollment / removing"; -#elif L==3 - "Paso 5: Confirme la inscripción / eliminación"; -#elif L==4 - "Step 5: Confirm the enrollment / removing"; // Besoin de traduction -#elif L==5 - "Paso 5: Confirme la inscripción / eliminación"; // Okoteve traducción -#elif L==6 - "Passo 5: Conferma la registrazione / rimozione"; -#elif L==7 - "Step 5: Confirm the enrollment / removing"; // Potrzebujesz tlumaczenie -#elif L==8 - "Step 5: Confirm the enrollment / removing"; // Necessita de tradução + "Step 4: Confirm the enrollment / removing"; // Necessita de tradução #endif const char *Txt_Student_comment =