From 391ce458019e80bd1a4be34bc0a1e16e40c11661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Fri, 22 Sep 2017 14:12:05 +0200 Subject: [PATCH] Version 17.6 --- swad_changelog.h | 15 ++++++- swad_project.c | 77 ++++++++++++++++++++++++++------- swad_text.c | 108 +++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 170 insertions(+), 30 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index caa1415d9..e341552a3 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -252,14 +252,25 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 17.5.10 (2017-09-22)" +#define Log_PLATFORM_VERSION "SWAD 17.6 (2017-09-22)" #define CSS_FILE "swad17.0.css" #define JS_FILE "swad16.206.3.js" // 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 17.5.10: Sep 22, 2017 Actions to remove user from project. Not finished. (? lines) + Version 17.6: Sep 22, 2017 Actions to remove user from project. (230559 lines) + 6 changes necessary in database: +UPDATE actions SET Txt='Solicitar ID añadir evaluador a proyecto' WHERE ActCod='1686' AND Language='es'; +UPDATE actions SET Txt='Añadir evaluador a proyecto' WHERE ActCod='1689' AND Language='es'; +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1690','es','N','Solicitar ID eliminar estudiante de proyecto'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1691','es','N','Solicitar ID eliminar tutor de proyecto'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1692','es','N','Solicitar ID eliminar evaluador de proyecto'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1693','es','N','Eliminar estudiante de proyecto'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1694','es','N','Eliminar tutor de proyecto'); +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1695','es','N','Eliminar evaluador de proyecto'); + + Version 17.5.10: Sep 22, 2017 Actions to remove user from project. Not finished. (230429 lines) Version 17.5.9: Sep 22, 2017 Icon to remove user from project. (230350 lines) Version 17.5.8: Sep 22, 2017 Name of department in listing of projects. (230336 lines) Version 17.5.7: Sep 21, 2017 Selector for department in edition of a project. (230363 lines) diff --git a/swad_project.c b/swad_project.c index 282377995..9cc99cac2 100644 --- a/swad_project.c +++ b/swad_project.c @@ -99,6 +99,7 @@ static void Prj_WriteUsrs (long PrjCod,Prj_ProjectView_t ProjectView, static void Prj_ReqAnotherUsrID (Prj_RoleInProject_t RoleInProject); static void Prj_AddUsrToProject (Prj_RoleInProject_t RoleInProject); static void Prj_ReqRemUsrFromPrj (Prj_RoleInProject_t RoleInProject); +static bool Prj_CheckIfICanRemUsrFromPrj (void); static void Prj_GetParamPrjOrder (void); @@ -617,7 +618,6 @@ static void Prj_WriteUsrs (long PrjCod,Prj_ProjectView_t ProjectView, unsigned NumUsrsKnown; unsigned NumUsrsUnknown; unsigned NumUsrsToShow; - struct UsrData UsrDat; bool UsrValid; bool ShowPhoto; char PhotoURL[PATH_MAX + 1]; @@ -664,9 +664,6 @@ static void Prj_WriteUsrs (long PrjCod,Prj_ProjectView_t ProjectView, /***** How many users will be shown? *****/ NumUsrsToShow = NumUsrsKnown; - /***** Initialize structure with user's data *****/ - Usr_UsrDataConstructor (&UsrDat); - /***** Write known users *****/ for (NumUsr = 0; NumUsr < NumUsrsToShow; @@ -674,10 +671,10 @@ static void Prj_WriteUsrs (long PrjCod,Prj_ProjectView_t ProjectView, { /* Get user's code */ row = mysql_fetch_row (mysql_res); - UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]); + Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]); /* Get user's data */ - UsrValid = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat); + UsrValid = Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat); /* Start row for this user */ fprintf (Gbl.F.Out,""); @@ -695,17 +692,17 @@ static void Prj_WriteUsrs (long PrjCod,Prj_ProjectView_t ProjectView, /* Put user's photo */ fprintf (Gbl.F.Out,""); - ShowPhoto = (UsrValid ? Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL) : + ShowPhoto = (UsrValid ? Pho_ShowingUsrPhotoIsAllowed (&Gbl.Usrs.Other.UsrDat,PhotoURL) : false); - Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL : - NULL, + Pho_ShowUsrPhoto (&Gbl.Usrs.Other.UsrDat,ShowPhoto ? PhotoURL : + NULL, "PHOTO21x28",Pho_ZOOM,false); /* Write user's name */ fprintf (Gbl.F.Out,"" ""); if (UsrValid) - fprintf (Gbl.F.Out,"%s",UsrDat.FullName); + fprintf (Gbl.F.Out,"%s",Gbl.Usrs.Other.UsrDat.FullName); else fprintf (Gbl.F.Out,"[%s]", Txt_ROLES_SINGUL_abc[Rol_UNK][Usr_SEX_UNKNOWN]); // User not found, likely a user who has been removed @@ -725,9 +722,6 @@ static void Prj_WriteUsrs (long PrjCod,Prj_ProjectView_t ProjectView, (NumUsrsUnknown == 1) ? Txt_ROLES_SINGUL_abc[Rol_UNK][Usr_SEX_UNKNOWN] : Txt_ROLES_PLURAL_abc[Rol_UNK][Usr_SEX_UNKNOWN]); - - /***** Free memory used for user's data *****/ - Usr_UsrDataDestructor (&UsrDat); } /***** Row to add a new user *****/ @@ -886,21 +880,26 @@ static void Prj_AddUsrToProject (Prj_RoleInProject_t RoleInProject) void Prj_ReqRemStd (void) { - Prj_ReqAnotherUsrID (Prj_ROLE_STD); + Prj_ReqRemUsrFromPrj (Prj_ROLE_STD); } void Prj_ReqRemTut (void) { - Prj_ReqAnotherUsrID (Prj_ROLE_TUT); + Prj_ReqRemUsrFromPrj (Prj_ROLE_TUT); } void Prj_ReqRemEva (void) { - Prj_ReqAnotherUsrID (Prj_ROLE_EVA); + Prj_ReqRemUsrFromPrj (Prj_ROLE_EVA); } static void Prj_ReqRemUsrFromPrj (Prj_RoleInProject_t RoleInProject) { + extern const char *Txt_Do_you_really_want_to_be_removed_from_the_project_X; + extern const char *Txt_Do_you_really_want_to_remove_the_following_user_from_the_project_X; + extern const char *Txt_Remove_me_from_this_project; + extern const char *Txt_Remove_user_from_this_project; + extern const char *Txt_User_not_found_or_you_do_not_have_permission_; static Act_Action_t ActionRemUsr[Prj_NUM_ROLES_IN_PROJECT] = { ActUnk, // Prj_ROLE_UNK, Unknown @@ -908,6 +907,50 @@ static void Prj_ReqRemUsrFromPrj (Prj_RoleInProject_t RoleInProject) ActRemTutPrj, // Prj_ROLE_TUT, Tutor ActRemEvaPrj, // Prj_ROLE_EVA, Evaluator }; + bool ItsMe; + + /***** Get user to be removed *****/ + if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) + { + if (Prj_CheckIfICanRemUsrFromPrj ()) + { + ItsMe = (Gbl.Usrs.Me.UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod); + + /***** Show question and button to remove user as administrator *****/ + /* Start alert */ + sprintf (Gbl.Alert.Txt, + ItsMe ? Txt_Do_you_really_want_to_be_removed_from_the_project_X : + Txt_Do_you_really_want_to_remove_the_following_user_from_the_project_X, + Gbl.CurrentCrs.Crs.FullName); + Ale_ShowAlertAndButton1 (Ale_QUESTION,Gbl.Alert.Txt); + + /* Show user's record */ + Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); + + /* Show form to request confirmation */ + Act_FormStart (ActionRemUsr[RoleInProject]); + Usr_PutParamUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EncryptedUsrCod); + Btn_PutRemoveButton (ItsMe ? Txt_Remove_me_from_this_project : + Txt_Remove_user_from_this_project); + Act_FormEnd (); + + /* End alert */ + Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL); + } + else + Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + } + else + Ale_ShowAlert (Ale_WARNING,Txt_User_not_found_or_you_do_not_have_permission_); + } + +/*****************************************************************************/ +/*********** Check if I can remove another user in current course ************/ +/*****************************************************************************/ + +static bool Prj_CheckIfICanRemUsrFromPrj (void) + { + return true; // TODO: Rewrite this function } /*****************************************************************************/ @@ -995,6 +1038,8 @@ static void Prj_PutParams (void) Prj_PutParamPrjCod (Gbl.Prjs.PrjCodToEdit); Prj_PutHiddenParamPrjOrder (); Pag_PutHiddenParamPagNum (Pag_PROJECTS,Gbl.Prjs.CurrentPage); + if (Gbl.Usrs.Other.UsrDat.UsrCod > 0) + Usr_PutParamOtherUsrCodEncrypted (); } /*****************************************************************************/ diff --git a/swad_text.c b/swad_text.c index de7f00bc9..3c2e5a508 100644 --- a/swad_text.c +++ b/swad_text.c @@ -8999,6 +8999,27 @@ const char *Txt_Do_you_really_want_to_be_removed_from_the_course_X = // Warning: " (removing your works, enrolment in groups, etc.)?"; // Necessita de tradução #endif +const char *Txt_Do_you_really_want_to_be_removed_from_the_project_X = // Warning: it is very important to include %s in the following sentences +#if L==1 + "¿De veres voleu ser eliminat del projecte %s?"; +#elif L==2 + "Möchten Sie wirklich aus dem Projekt %s entfernt werden?"; +#elif L==3 + "Do you really want to be removed from the project %s"; +#elif L==4 + "¿Realmente desea ser eliminado del proyecto %s?"; +#elif L==5 + "Voulez-vous vraiment être retiré du projet %s?"; +#elif L==6 + "¿Realmente desea ser eliminado del proyecto %s?"; // Okoteve traducción +#elif L==7 + "Vuoi realmente rimuovere dal progetto %s?"; +#elif L==8 + "Czy naprawdę chcesz zostać usunięty z projektu %s?"; +#elif L==9 + "Você realmente quer ser removido do projeto %s?"; +#endif + const char *Txt_Do_you_really_want_to_completely_eliminate_the_following_user = #if L==1 "¿Realmente desea eliminar completamente la cuenta del siguiente usuario?"; // Necessita traduccio @@ -9578,16 +9599,16 @@ const char *Txt_Do_you_really_want_to_remove_the_following_user_as_an_administra " jako administratora %s?"; #elif L==9 "Do you really want to remove the following user" - " as an administrator of %s?"; // Necessita de tradução + " as an administrator of %s?"; // Necessita de tradução #endif const char *Txt_Do_you_really_want_to_remove_the_following_user_from_the_course_X = // Warning: it is very important to include %s in the following sentences #if L==1 - "¿Realmente desea eliminar el siguiente usuario de la asignatura %s" - " (eliminando sus trabajos, adscripción a grupos, etc.)?"; // Necessita traduccio + "¿De veres voleu eliminar el següent usuari de l'assignatura %s" + " (eliminant els seus treballs, adscripció a grups, etc.)?"; #elif L==2 - "Do you really want to remove the following user from the course %s" - " (removing her/his works, enrolment in groups, etc.)?"; // Need Übersetzung + "Möchten Sie den folgenden Benutzer wirklich aus dem Kurs %s entfernen" + " (Beseitigung ihrer Werke, Einschreibung in Gruppen usw.)?"; #elif L==3 "Do you really want to remove the following user from the course %s" " (removing her/his works, enrolment in groups, etc.)?"; @@ -9595,8 +9616,8 @@ const char *Txt_Do_you_really_want_to_remove_the_following_user_from_the_course_ "¿Realmente desea eliminar el siguiente usuario de la asignatura %s" " (eliminando sus trabajos, adscripción a grupos, etc.)?"; #elif L==5 - "Do you really want to remove the following user from the course %s" - " (removing her/his works, enrolment in groups, etc.)?"; // Besoin de traduction + "Voulez-vous vraiment supprimer l'utilisateur suivant de la matière %s" + " (éliminant ses travaux, inscription en groupes, etc.)?"; #elif L==6 "¿Realmente desea eliminar el siguiente usuario de la asignatura %s" " (eliminando sus trabajos, adscripción a grupos, etc.)?"; // Okoteve traducción @@ -9604,11 +9625,32 @@ const char *Txt_Do_you_really_want_to_remove_the_following_user_from_the_course_ "Vuoi realmente rimuovere il seguente utente dal corso %s" " (rimuovendo i suoi lavori, registrazione in gruppi, etc.)?"; #elif L==8 - "Do you really want to remove the following user z kursu %s" - " (removing her/his works, enrolment in groups, etc.)?"; + "Czy na pewno chcesz usunąć następujący użytkownik z kursu %s" + " (usunięcie jego utworów, zapisanie się w grupach itp.)?"; #elif L==9 - "Do you really want to remove the following user from the course %s" - " (removing her/his works, enrolment in groups, etc.)?"; // Necessita de tradução + "Você deseja realmente remover o seguinte usuário da disciplina %s" + " (removendo seus trabalhos, inscrição em grupos, etc.)?"; +#endif + +const char *Txt_Do_you_really_want_to_remove_the_following_user_from_the_project_X = // Warning: it is very important to include %s in the following sentences +#if L==1 + "¿De veres voleu eliminar el següent usuari del projecte %s?"; +#elif L==2 + "Möchten Sie den folgenden Benutzer wirklich aus dem Projekt %s entfernen?"; +#elif L==3 + "Do you really want to remove the following user from the project %s"; +#elif L==4 + "¿Realmente desea eliminar el siguiente usuario del proyecto %s?"; +#elif L==5 + "Voulez-vous vraiment supprimer l'utilisateur suivant du projet %s?"; +#elif L==6 + "¿Realmente desea eliminar el siguiente usuario del proyecto %s?"; // Okoteve traducción +#elif L==7 + "Vuoi realmente rimuovere il seguente utente dal progetto %s?"; +#elif L==8 + "Czy na pewno chcesz usunąć następujący użytkownik z projekt %s?"; +#elif L==9 + "Você deseja realmente remover o seguinte usuário do projeto %s?"; #endif const char *Txt_Do_you_really_want_to_remove_the_game_X = // Warning: it is very important to include %s in the following sentences @@ -32367,6 +32409,27 @@ const char *Txt_Remove_me_from_this_course = "Tirar me desta disciplina"; #endif +const char *Txt_Remove_me_from_this_project = +#if L==1 + "Eliminarme d'aquest projecte"; +#elif L==2 + "Entfernen Sie diesen Projekt"; +#elif L==3 + "Remove me from this project"; +#elif L==4 + "Eliminarme de este proyecto"; +#elif L==5 + "Enlever-moi de ce projet"; +#elif L==6 + "Eliminarme de este proyecto"; // Okoteve traducción +#elif L==7 + "Rimuovimi da questo progetto"; +#elif L==8 + "Usuñ z projekt"; +#elif L==9 + "Tirar me deste projeto"; +#endif + const char *Txt_Remove_me_from_the_course_X = // Warning: it is very important to include %s in the following sentences #if L==1 "Eliminarme de l'assignatura %s"; @@ -32619,6 +32682,27 @@ const char *Txt_Remove_user_from_this_course = "Tirar utilizador desta disciplina"; #endif +const char *Txt_Remove_user_from_this_project = +#if L==1 + "Eliminar usuari d'aquest projecte"; +#elif L==2 + "Entfernen Benutzer Sie diesen Projekt"; +#elif L==3 + "Remove user from this project"; +#elif L==4 + "Eliminar usuario de este proyecto"; +#elif L==5 + "Enlever utilisateur de ce projet"; +#elif L==6 + "Eliminar usuario de este proyecto"; // Okoteve traducción +#elif L==7 + "Rimuovi utente da questo progetto"; +#elif L==8 + "Usuñ użytkownika z projekt"; +#elif L==9 + "Tirar utilizador deste projeto"; +#endif + const char *Txt_Remove_USER_as_an_administrator = #if L==1 "Eliminar com a administrador/a"; @@ -46653,7 +46737,7 @@ const char *Txt_The_plugin_X_has_been_renamed_as_Y = // Warning: it is very impo const char *Txt_The_project_has_been_modified = #if L==1 - "L'activitat ha estat modificada."; + "El projecte ha estat modificada."; #elif L==2 "Die Projekt wurde geändert."; #elif L==3