mirror of https://github.com/acanas/swad-core.git
Version 15.93.8
This commit is contained in:
parent
8a44216c7c
commit
08cc0cf4a9
|
@ -117,14 +117,15 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.93.7 (2016-01-03)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.93.8 (2016-01-03)"
|
||||
#define CSS_FILE "swad15.88.1.css"
|
||||
#define JS_FILE "swad15.77.7.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 15.93.7: Jan 03, 2016 Social note is marked as unavailable when a forum post is removed. (190419 lines)
|
||||
Version 15.93.8: Jan 03, 2016 Social note is marked as unavailable when a public file is removed. (190486 lines)
|
||||
Version 15.93.7: Jan 03, 2016 Social note is marked as unavailable when a public forum post is removed. (190419 lines)
|
||||
Version 15.93.6: Jan 03, 2016 Social note is marked as unavailable when a exam announcement is removed. (190409 lines)
|
||||
Version 15.93.5: Jan 03, 2016 Social note is marked as unavailable when a notice is removed. (190406 lines)
|
||||
6 changes necessary in database:
|
||||
|
|
|
@ -9787,10 +9787,10 @@ static Brw_License_t Brw_GetParLicense (void)
|
|||
/*****************************************************************************/
|
||||
/*********************** Get file code using its path ************************/
|
||||
/*****************************************************************************/
|
||||
// Path if the full path in tree
|
||||
// Path is the full path in tree
|
||||
// Example: descarga/folder/file.pdf
|
||||
|
||||
long Brw_GetFilCodByPath (const char *Path)
|
||||
long Brw_GetFilCodByPath (const char *Path,bool OnlyIfPublic)
|
||||
{
|
||||
long Cod = Brw_GetCodForFiles ();
|
||||
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
|
||||
|
@ -9799,13 +9799,15 @@ long Brw_GetFilCodByPath (const char *Path)
|
|||
MYSQL_ROW row;
|
||||
long FilCod;
|
||||
|
||||
/***** Get metadata of a file from database *****/
|
||||
/***** Get code of a file from database *****/
|
||||
sprintf (Query,"SELECT FilCod FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'"
|
||||
" AND Path='%s'",
|
||||
" AND Path='%s'%s",
|
||||
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
|
||||
Cod,ZoneUsrCod,
|
||||
Path);
|
||||
Path,
|
||||
OnlyIfPublic ? " AND Public='Y'" :
|
||||
"");
|
||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get file code"))
|
||||
{
|
||||
/* Get row */
|
||||
|
@ -10625,8 +10627,10 @@ static void Brw_RemoveOneFileOrFolderFromDB (const char *Path)
|
|||
Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type];
|
||||
|
||||
/***** Set possible notifications as removed.
|
||||
Set possible social note as removed.
|
||||
Important: do this before removing from files *****/
|
||||
Ntf_SetNotifOneFileAsRemoved (FileBrowser,Cod,Path);
|
||||
Ntf_SetNotifOneFileAsRemoved (Path);
|
||||
Ntf_SetSocialNoteOneFileAsRemoved (Path);
|
||||
|
||||
/***** Remove from database the entries that store the marks properties *****/
|
||||
if (FileBrowser == Brw_ADMI_MARKS_CRS ||
|
||||
|
|
|
@ -185,7 +185,7 @@ void Brw_ShowFileMetadata (void);
|
|||
void Brw_DownloadFile (void);
|
||||
void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char *URL);
|
||||
void Brw_ChgFileMetadata (void);
|
||||
long Brw_GetFilCodByPath (const char *Path);
|
||||
long Brw_GetFilCodByPath (const char *Path,bool OnlyIfPublic);
|
||||
void Brw_GetFileMetadataByPath (struct FileMetadata *FileMetadata);
|
||||
void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata);
|
||||
bool Brw_GetFileTypeSizeAndDate (struct FileMetadata *FileMetadata);
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "swad_notice.h"
|
||||
#include "swad_notification.h"
|
||||
#include "swad_parameter.h"
|
||||
#include "swad_social.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** External global variables from others modules ****************/
|
||||
|
@ -906,33 +907,13 @@ void Ntf_SetNotifInCrsAsRemoved (long CrsCod,long ToUsrCod)
|
|||
/************ Set possible notifications of one file as removed **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ntf_SetNotifOneFileAsRemoved (Brw_FileBrowser_t FileBrowser,
|
||||
long Cod,const char *Path)
|
||||
void Ntf_SetNotifOneFileAsRemoved (const char *Path)
|
||||
{
|
||||
char Query[512];
|
||||
char SubQuery[256];
|
||||
extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
|
||||
Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type];
|
||||
long FilCod;
|
||||
Ntf_NotifyEvent_t NotifyEvent;
|
||||
|
||||
/***** Set notify event depending on browser zone *****/
|
||||
switch (FileBrowser)
|
||||
{
|
||||
case Brw_ADMI_DOCUM_CRS:
|
||||
case Brw_ADMI_DOCUM_GRP:
|
||||
NotifyEvent = Ntf_EVENT_DOCUMENT_FILE;
|
||||
break;
|
||||
case Brw_ADMI_SHARE_CRS:
|
||||
case Brw_ADMI_SHARE_GRP:
|
||||
NotifyEvent = Ntf_EVENT_SHARED_FILE;
|
||||
break;
|
||||
case Brw_ADMI_MARKS_CRS:
|
||||
case Brw_ADMI_MARKS_GRP:
|
||||
NotifyEvent = Ntf_EVENT_MARKS_FILE;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
/***** Set notification as removed *****/
|
||||
switch (FileBrowser)
|
||||
{
|
||||
case Brw_ADMI_DOCUM_CRS:
|
||||
|
@ -941,18 +922,101 @@ void Ntf_SetNotifOneFileAsRemoved (Brw_FileBrowser_t FileBrowser,
|
|||
case Brw_ADMI_SHARE_GRP:
|
||||
case Brw_ADMI_MARKS_CRS:
|
||||
case Brw_ADMI_MARKS_GRP:
|
||||
sprintf (SubQuery,"SELECT FilCod FROM files"
|
||||
" WHERE FileBrowser='%u' AND Cod='%ld' AND Path='%s'",
|
||||
(unsigned) FileBrowser,Cod,Path);
|
||||
/***** Get file code *****/
|
||||
FilCod = Brw_GetFilCodByPath (Path,false); // Any file, public or not
|
||||
if (FilCod > 0)
|
||||
{
|
||||
/***** Set notification as removed *****/
|
||||
switch (FileBrowser)
|
||||
{
|
||||
case Brw_ADMI_DOCUM_CRS:
|
||||
case Brw_ADMI_DOCUM_GRP:
|
||||
NotifyEvent = Ntf_EVENT_DOCUMENT_FILE;
|
||||
break;
|
||||
case Brw_ADMI_SHARE_CRS:
|
||||
case Brw_ADMI_SHARE_GRP:
|
||||
NotifyEvent = Ntf_EVENT_SHARED_FILE;
|
||||
break;
|
||||
case Brw_ADMI_MARKS_CRS:
|
||||
case Brw_ADMI_MARKS_GRP:
|
||||
NotifyEvent = Ntf_EVENT_MARKS_FILE;
|
||||
break;
|
||||
default:
|
||||
NotifyEvent = Ntf_EVENT_UNKNOWN; // Impossible
|
||||
break;
|
||||
}
|
||||
if (NotifyEvent != Ntf_EVENT_UNKNOWN) // Not necessary
|
||||
Ntf_SetNotifAsRemoved (NotifyEvent,FilCod);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Set possible notifications of one file as removed **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ntf_SetSocialNoteOneFileAsRemoved (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 FilCod;
|
||||
Soc_NoteType_t NoteType;
|
||||
|
||||
switch (FileBrowser)
|
||||
{
|
||||
case Brw_ADMI_DOCUM_INS:
|
||||
case Brw_ADMI_SHARE_INS:
|
||||
case Brw_ADMI_DOCUM_CTR:
|
||||
case Brw_ADMI_SHARE_CTR:
|
||||
case Brw_ADMI_DOCUM_DEG:
|
||||
case Brw_ADMI_SHARE_DEG:
|
||||
case Brw_ADMI_DOCUM_CRS:
|
||||
case Brw_ADMI_SHARE_CRS:
|
||||
/***** Get file code *****/
|
||||
FilCod = Brw_GetFilCodByPath (Path,true); // Only if file is public
|
||||
if (FilCod > 0)
|
||||
{
|
||||
/***** Mark possible social note as unavailable *****/
|
||||
switch (FileBrowser)
|
||||
{
|
||||
case Brw_ADMI_DOCUM_INS:
|
||||
NoteType = Soc_NOTE_INS_DOC_PUB_FILE;
|
||||
break;
|
||||
case Brw_ADMI_SHARE_INS:
|
||||
NoteType = Soc_NOTE_INS_SHA_PUB_FILE;
|
||||
break;
|
||||
case Brw_ADMI_DOCUM_CTR:
|
||||
NoteType = Soc_NOTE_CTR_DOC_PUB_FILE;
|
||||
break;
|
||||
case Brw_ADMI_SHARE_CTR:
|
||||
NoteType = Soc_NOTE_CTR_SHA_PUB_FILE;
|
||||
break;
|
||||
case Brw_ADMI_DOCUM_DEG:
|
||||
NoteType = Soc_NOTE_DEG_DOC_PUB_FILE;
|
||||
break;
|
||||
case Brw_ADMI_SHARE_DEG:
|
||||
NoteType = Soc_NOTE_DEG_SHA_PUB_FILE;
|
||||
break;
|
||||
case Brw_ADMI_DOCUM_CRS:
|
||||
NoteType = Soc_NOTE_CRS_DOC_PUB_FILE;
|
||||
break;
|
||||
case Brw_ADMI_SHARE_CRS:
|
||||
NoteType = Soc_NOTE_CRS_SHA_PUB_FILE;
|
||||
break;
|
||||
default:
|
||||
NoteType = Soc_NOTE_UNKNOWN; // Impossible
|
||||
break;
|
||||
}
|
||||
if (NoteType != Soc_NOTE_UNKNOWN) // Not necessary
|
||||
Soc_MarkSocialNoteAsUnavailableUsingNoteTypeAndCod (NoteType,FilCod);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sprintf (Query,"UPDATE notif SET Status=(Status | %u)"
|
||||
" WHERE NotifyEvent='%u' AND Cod IN (%s)",
|
||||
(unsigned) Ntf_STATUS_BIT_REMOVED,
|
||||
(unsigned) NotifyEvent,SubQuery);
|
||||
DB_QueryUPDATE (Query,"can not set notification(s) as removed");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -107,8 +107,8 @@ void Ntf_SetNotifAsSeen (Ntf_NotifyEvent_t NotifyEvent,long Cod,long ToUsrCod);
|
|||
void Ntf_SetNotifAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod);
|
||||
void Ntf_SetNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long ToUsrCod);
|
||||
void Ntf_SetNotifInCrsAsRemoved (long CrsCod,long ToUsrCod);
|
||||
void Ntf_SetNotifOneFileAsRemoved (Brw_FileBrowser_t FileBrowser,
|
||||
long Cod,const char *Path);
|
||||
void Ntf_SetNotifOneFileAsRemoved (const char *Path);
|
||||
void Ntf_SetSocialNoteOneFileAsRemoved (const char *Path);
|
||||
void Ntf_SetNotifChildrenOfFolderAsRemoved (Brw_FileBrowser_t FileBrowser,
|
||||
long Cod,const char *Path);
|
||||
void Ntf_SetNotifFilesInGroupAsRemoved (long GrpCod);
|
||||
|
|
|
@ -540,7 +540,7 @@ static unsigned long long ZIP_CloneDir (const char *Path,const char *PathClone,c
|
|||
Lay_ShowErrorAndExit ("Can not create temporary link for compression.");
|
||||
|
||||
/***** Update number of my views of this file *****/
|
||||
Brw_UpdateMyFileViews (Brw_GetFilCodByPath (PathFileInTree));
|
||||
Brw_UpdateMyFileViews (Brw_GetFilCodByPath (PathFileInTree,false)); // Any file, public or not
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue