diff --git a/swad_changelog.h b/swad_changelog.h index a38249a1..0bc407b0 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -629,10 +629,11 @@ TODO: Emilce Barrera Mesa: Podr TODO: Emilce Barrera Mesa: Mis estudiantes presentan muchas dificultades a la hora de poner la foto porque la plataforma es muy exigente respecto al fondo de la imagen. */ -#define Log_PLATFORM_VERSION "SWAD 22.86 (2023-03-29)" +#define Log_PLATFORM_VERSION "SWAD 22.86.1 (2023-03-29)" #define CSS_FILE "swad22.86.css" #define JS_FILE "swad22.49.js" /* + Version 22.86.1: Mar 29, 2023 Icon to remove resource clipboard only if there are resources. (338596 lines) Version 22.86: Mar 29, 2023 New actions to see and remove the resource clipboard in rubrics. (338578 lines) Version 22.85.1: Mar 29, 2023 Code refactoring in links to update sections. (338447 lines) Version 22.85: Mar 29, 2023 New action to remove the resource clipboard in program. (338449 lines) diff --git a/swad_program_resource.c b/swad_program_resource.c index 93c40abf..640e66bb 100644 --- a/swad_program_resource.c +++ b/swad_program_resource.c @@ -872,8 +872,9 @@ static void PrgRsc_PutIconsClipboard (__attribute__((unused)) void *Args) { /***** Put icon to remove resource clipboard in program *****/ if (Prg_CheckIfICanEditProgram ()) - Ico_PutContextualIconToRemove (ActRemRscCli_InPrg,NULL, - NULL,NULL); + if (Rsc_DB_GetNumResourcesInClipboard ()) // Only if there are resources + Ico_PutContextualIconToRemove (ActRemRscCli_InPrg,NULL, + NULL,NULL); } /*****************************************************************************/ diff --git a/swad_resource_database.c b/swad_resource_database.c index d52db413..b096595d 100644 --- a/swad_resource_database.c +++ b/swad_resource_database.c @@ -54,6 +54,22 @@ void Rsc_DB_CopyToClipboard (Rsc_Type_t Type,long Cod) Cod); } +/*****************************************************************************/ +/******************** Get number of resources in clipboard *******************/ +/*****************************************************************************/ + +unsigned Rsc_DB_GetNumResourcesInClipboard (void) + { + return (unsigned) + DB_QueryCOUNT ("can not get resources", + "SELECT COUNT(*)" + " FROM rsc_clipboards" + " WHERE UsrCod=%ld" + " AND CrsCod=%ld", + Gbl.Usrs.Me.UsrDat.UsrCod, + Gbl.Hierarchy.Crs.CrsCod); + } + /*****************************************************************************/ /****************** Get all resources from resource clipboard ****************/ /*****************************************************************************/ diff --git a/swad_resource_database.h b/swad_resource_database.h index 9383e873..7efa9ffa 100644 --- a/swad_resource_database.h +++ b/swad_resource_database.h @@ -34,6 +34,8 @@ /*****************************************************************************/ void Rsc_DB_CopyToClipboard (Rsc_Type_t Type,long Cod); + +unsigned Rsc_DB_GetNumResourcesInClipboard (void); unsigned Rsc_DB_GetClipboard (MYSQL_RES **mysql_res); void Rsc_DB_RemoveClipboard (void); diff --git a/swad_rubric_resource.c b/swad_rubric_resource.c index 51bbc06b..4b5a84d9 100644 --- a/swad_rubric_resource.c +++ b/swad_rubric_resource.c @@ -175,8 +175,9 @@ static void RubRsc_PutIconsClipboard (__attribute__((unused)) void *Args) { /***** Put icon to remove resource clipboard in rubrics *****/ if (Rub_CheckIfICanEditRubrics ()) - Ico_PutContextualIconToRemove (ActRemRscCli_InRub,NULL, - NULL,NULL); + if (Rsc_DB_GetNumResourcesInClipboard ()) // Only if there are resources + Ico_PutContextualIconToRemove (ActRemRscCli_InRub,NULL, + NULL,NULL); } /*****************************************************************************/