diff --git a/swad_changelog.h b/swad_changelog.h index dacf0fea4..60a4d82e5 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -553,7 +553,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 20.36.8 (2021-02-07)" +#define Log_PLATFORM_VERSION "SWAD 20.36.9 (2021-02-07)" #define CSS_FILE "swad20.33.9.css" #define JS_FILE "swad20.6.2.js" /* @@ -601,6 +601,7 @@ TODO: DNI de un estudiante sale err TODO: BUG: Cuando un tipo de grupo sólo tiene un grupo, inscribirse es voluntario, el estudiante sólo puede pertenecer a un grupo, y se inscribe en él, debería poder desapuntarse. Ahora no puede. TODO: Salvador Romero Cortés: @acanas opción para editar posts + Version 20.36.9: Feb 27, 2021 Query moved to module swad_timeline_database. (305233 lines) Version 20.36.8: Feb 27, 2021 Function moved to module swad_timeline_database. (305215 lines) Version 20.36.7: Feb 27, 2021 Query moved to module swad_timeline_database. (305212 lines) Version 20.36.6: Feb 27, 2021 Queries moved to module swad_timeline_database. (305195 lines) diff --git a/swad_timeline_database.c b/swad_timeline_database.c index 746b35853..93816b58b 100644 --- a/swad_timeline_database.c +++ b/swad_timeline_database.c @@ -76,13 +76,34 @@ long TL_DB_CreateNewNote (TL_Not_NoteType_t NoteType,long Cod, void TL_DB_MarkNoteAsUnavailable (TL_Not_NoteType_t NoteType,long Cod) { - /***** Mark the note as unavailable *****/ + /***** Mark note as unavailable *****/ DB_QueryUPDATE ("can not mark note as unavailable", "UPDATE tl_notes SET Unavailable='Y'" " WHERE NoteType=%u AND Cod=%ld", (unsigned) NoteType,Cod); } +/*****************************************************************************/ +/***** Mark possible notes involving children of a folder as unavailable *****/ +/*****************************************************************************/ + +void TL_DB_MarkNotesChildrenOfFolderAsUnavailable (TL_Not_NoteType_t NoteType, + Brw_FileBrowser_t FileBrowser, + long Cod, + const char *Path) + { + /***** Mark notes as unavailable *****/ + DB_QueryUPDATE ("can not mark notes as unavailable", + "UPDATE tl_notes SET Unavailable='Y'" + " WHERE NoteType=%u AND Cod IN" + " (SELECT FilCod FROM files" + " WHERE FileBrowser=%u AND Cod=%ld" + " AND Path LIKE '%s/%%' AND Public='Y')", // Only public files + (unsigned) NoteType, + (unsigned) FileBrowser,Cod, + Path); + } + /*****************************************************************************/ /**** Insert note in temporary tables used to not get notes already shown ****/ /*****************************************************************************/ diff --git a/swad_timeline_database.h b/swad_timeline_database.h index 0a952d3ac..26ce65382 100644 --- a/swad_timeline_database.h +++ b/swad_timeline_database.h @@ -28,6 +28,7 @@ /*****************************************************************************/ #include "swad_database.h" +#include "swad_file_browser.h" #include "swad_timeline_note.h" #include "swad_timeline_post.h" @@ -47,6 +48,10 @@ long TL_DB_CreateNewNote (TL_Not_NoteType_t NoteType,long Cod, long PublisherCod,long HieCod); void TL_DB_MarkNoteAsUnavailable (TL_Not_NoteType_t NoteType,long Cod); +void TL_DB_MarkNotesChildrenOfFolderAsUnavailable (TL_Not_NoteType_t NoteType, + Brw_FileBrowser_t FileBrowser, + long Cod, + const char *Path); void TL_DB_InsertNoteInJustRetrievedNotes (long NotCod); void TL_DB_InsertNoteInVisibleTimeline (long NotCod); diff --git a/swad_timeline_note.c b/swad_timeline_note.c index c78d04b61..1c929b383 100644 --- a/swad_timeline_note.c +++ b/swad_timeline_note.c @@ -951,7 +951,6 @@ void TL_Not_MarkNotesChildrenOfFolderAsUnavailable (const char *Path) { extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER]; Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type]; - long Cod = Brw_GetCodForFiles (); TL_Not_NoteType_t NoteType; switch (FileBrowser) @@ -994,15 +993,9 @@ void TL_Not_MarkNotesChildrenOfFolderAsUnavailable (const char *Path) default: return; } - DB_QueryUPDATE ("can not mark notes as unavailable", - "UPDATE tl_notes SET Unavailable='Y'" - " WHERE NoteType=%u AND Cod IN" - " (SELECT FilCod FROM files" - " WHERE FileBrowser=%u AND Cod=%ld" - " AND Path LIKE '%s/%%' AND Public='Y')", // Only public files - (unsigned) NoteType, - (unsigned) FileBrowser,Cod, - Path); + TL_DB_MarkNotesChildrenOfFolderAsUnavailable (NoteType, + FileBrowser,Brw_GetCodForFiles (), + Path); break; default: break;