From e294717aacf021a78f7d1490bb3446e04ff06fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 18 Apr 2019 11:10:39 +0200 Subject: [PATCH] Version18.114.3 --- swad_changelog.h | 5 ++--- swad_project.c | 29 ++++++++++++++++------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/swad_changelog.h b/swad_changelog.h index a816554ef..683edbe21 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -432,9 +432,7 @@ Lo de mutear anuncios, en principio prefiero hacer una opci // TODO: Ver cómo recibir un fichero desde el cliente (SWADroid) en gsoap // TODO: Pedro Villar Castro: -// Bloquear individualmente la edición con una casilla de configuración para cada TFG, sólo el profesor de la asignatura (Perico) podría bloquear/desbloquear // Que haya una opción general que los bloquee todos y que los desbloquee todos -// Para bloquear/desbloquear se usará un icono candado /*****************************************************************************/ /****************************** Public constants *****************************/ @@ -455,10 +453,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.114.2 (2019-04-18)" +#define Log_PLATFORM_VERSION "SWAD 18.114.3 (2019-04-18)" #define CSS_FILE "swad18.112.1.css" #define JS_FILE "swad18.114.js" /* + Version 18.114.3: Apr 18, 2019 Locked edition of a project. (243025 lines) Version 18.114.2: Apr 18, 2019 Icons to inform about locked/unlocked project edition. (243023 lines) Version 18.114.1: Apr 18, 2019 Changes in translation of title related to project locking/unlocking. (243024 lines) Version 18.114: Apr 17, 2019 Project locking/unlocking is made via AJAX. (243023 lines) diff --git a/swad_project.c b/swad_project.c index 685162270..aa1eaa4a2 100644 --- a/swad_project.c +++ b/swad_project.c @@ -184,7 +184,7 @@ static void Prj_GetParamPrjOrder (void); static void Prj_PutFormsToRemEditOnePrj (const struct Project *Prj, bool ICanViewProjectFiles); -static bool Prj_CheckIfICanEditProject (long PrjCod); +static bool Prj_CheckIfICanEditProject (const struct Project *Prj); static bool Prj_CheckIfICanLockProject (void); static void Prj_FormLockUnlock (const struct Project *Prj); static void Prj_PutIconOffLockedUnlocked (const struct Project *Prj); @@ -2061,7 +2061,7 @@ static void Prj_ReqRemUsrFromPrj (Prj_RoleInProject_t RoleInProject) /***** Get user to be removed *****/ if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) { - if (Prj_CheckIfICanEditProject (Prj.PrjCod)) + if (Prj_CheckIfICanEditProject (&Prj)) { ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod); @@ -2141,7 +2141,7 @@ static void Prj_RemUsrFromPrj (Prj_RoleInProject_t RoleInProject) /***** Get user to be removed *****/ if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) { - if (Prj_CheckIfICanEditProject (Prj.PrjCod)) + if (Prj_CheckIfICanEditProject (&Prj)) { /***** Remove user from the table of project-users *****/ DB_QueryDELETE ("can not remove a user from a project", @@ -2207,7 +2207,7 @@ static void Prj_PutFormsToRemEditOnePrj (const struct Project *Prj, { Gbl.Prjs.PrjCod = Prj->PrjCod; // Used as parameter in contextual links - if (Prj_CheckIfICanEditProject (Prj->PrjCod)) + if (Prj_CheckIfICanEditProject (Prj)) { /***** Put form to remove project *****/ Ico_PutContextualIconToRemove (ActReqRemPrj,Prj_PutCurrentParams); @@ -2270,12 +2270,15 @@ bool Prj_CheckIfICanViewProjectFiles (unsigned MyRolesInProject) /************************ Can I edit a given project? ************************/ /*****************************************************************************/ -static bool Prj_CheckIfICanEditProject (long PrjCod) +static bool Prj_CheckIfICanEditProject (const struct Project *Prj) { switch (Gbl.Usrs.Me.Role.Logged) { case Rol_NET: - return ((Prj_GetMyRolesInProject (PrjCod) & (1 << Prj_ROLE_TUT)) != 0); // Am I tutor? + if (Prj->Locked == Prj_LOCKED) // Locked edition + return false; + return (Prj_GetMyRolesInProject (Prj->PrjCod) & + (1 << Prj_ROLE_TUT)) != 0; // Am I a tutor? case Rol_TCH: case Rol_SYS_ADM: return true; @@ -2781,7 +2784,7 @@ void Prj_ReqRemProject (void) /***** Get data of the project from database *****/ Prj_GetDataOfProjectByCod (&Prj); - if (Prj_CheckIfICanEditProject (Prj.PrjCod)) + if (Prj_CheckIfICanEditProject (&Prj)) { /***** Show question and button to remove the project *****/ Gbl.Prjs.PrjCod = Prj.PrjCod; @@ -2821,7 +2824,7 @@ void Prj_RemoveProject (void) /***** Get data of the project from database *****/ Prj_GetDataOfProjectByCod (&Prj); // Inside this function, the course is checked to be the current one - if (Prj_CheckIfICanEditProject (Prj.PrjCod)) + if (Prj_CheckIfICanEditProject (&Prj)) { /***** Remove users in project *****/ DB_QueryDELETE ("can not remove project", @@ -2883,7 +2886,7 @@ void Prj_HideProject (void) /***** Get data of the project from database *****/ Prj_GetDataOfProjectByCod (&Prj); - if (Prj_CheckIfICanEditProject (Prj.PrjCod)) + if (Prj_CheckIfICanEditProject (&Prj)) { /***** Hide project *****/ DB_QueryUPDATE ("can not hide project", @@ -2925,7 +2928,7 @@ void Prj_ShowProject (void) /***** Get data of the project from database *****/ Prj_GetDataOfProjectByCod (&Prj); - if (Prj_CheckIfICanEditProject (Prj.PrjCod)) + if (Prj_CheckIfICanEditProject (&Prj)) { /***** Show project *****/ DB_QueryUPDATE ("can not show project", @@ -2966,7 +2969,7 @@ void Prj_LockProjectEdition (void) /***** Get data of the project from database *****/ Prj_GetDataOfProjectByCod (&Prj); - if (Prj_CheckIfICanEditProject (Prj.PrjCod)) + if (Prj_CheckIfICanEditProject (&Prj)) { /***** Lock project edition *****/ DB_QueryUPDATE ("can not lock project edition", @@ -3007,7 +3010,7 @@ void Prj_UnlockProjectEdition (void) /***** Get data of the project from database *****/ Prj_GetDataOfProjectByCod (&Prj); - if (Prj_CheckIfICanEditProject (Prj.PrjCod)) + if (Prj_CheckIfICanEditProject (&Prj)) { /***** Unlock project edition *****/ DB_QueryUPDATE ("can not unlock project edition", @@ -3382,7 +3385,7 @@ void Prj_RecFormProject (void) /* Get data of the project from database */ Prj_GetDataOfProjectByCod (&Prj); - ICanEditProject = Prj_CheckIfICanEditProject (Prj.PrjCod); + ICanEditProject = Prj_CheckIfICanEditProject (&Prj); } if (ICanEditProject)