Version 15.93.8

This commit is contained in:
Antonio Cañas Vargas 2016-01-04 01:02:07 +01:00
parent 8a44216c7c
commit 08cc0cf4a9
6 changed files with 113 additions and 44 deletions

View File

@ -117,14 +117,15 @@
/****************************** Public constants *****************************/ /****************************** 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 CSS_FILE "swad15.88.1.css"
#define JS_FILE "swad15.77.7.js" #define JS_FILE "swad15.77.7.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // 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.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) 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: 6 changes necessary in database:

View File

@ -9787,10 +9787,10 @@ static Brw_License_t Brw_GetParLicense (void)
/*****************************************************************************/ /*****************************************************************************/
/*********************** Get file code using its path ************************/ /*********************** 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 // Example: descarga/folder/file.pdf
long Brw_GetFilCodByPath (const char *Path) long Brw_GetFilCodByPath (const char *Path,bool OnlyIfPublic)
{ {
long Cod = Brw_GetCodForFiles (); long Cod = Brw_GetCodForFiles ();
long ZoneUsrCod = Brw_GetZoneUsrCodForFiles (); long ZoneUsrCod = Brw_GetZoneUsrCodForFiles ();
@ -9799,13 +9799,15 @@ long Brw_GetFilCodByPath (const char *Path)
MYSQL_ROW row; MYSQL_ROW row;
long FilCod; long FilCod;
/***** Get metadata of a file from database *****/ /***** Get code of a file from database *****/
sprintf (Query,"SELECT FilCod FROM files" sprintf (Query,"SELECT FilCod FROM files"
" WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'" " WHERE FileBrowser='%u' AND Cod='%ld' AND ZoneUsrCod='%ld'"
" AND Path='%s'", " AND Path='%s'%s",
(unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type], (unsigned) Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type],
Cod,ZoneUsrCod, Cod,ZoneUsrCod,
Path); Path,
OnlyIfPublic ? " AND Public='Y'" :
"");
if (DB_QuerySELECT (Query,&mysql_res,"can not get file code")) if (DB_QuerySELECT (Query,&mysql_res,"can not get file code"))
{ {
/* Get row */ /* Get row */
@ -10625,8 +10627,10 @@ static void Brw_RemoveOneFileOrFolderFromDB (const char *Path)
Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type]; Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type];
/***** Set possible notifications as removed. /***** Set possible notifications as removed.
Set possible social note as removed.
Important: do this before removing from files *****/ 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 *****/ /***** Remove from database the entries that store the marks properties *****/
if (FileBrowser == Brw_ADMI_MARKS_CRS || if (FileBrowser == Brw_ADMI_MARKS_CRS ||

View File

@ -185,7 +185,7 @@ void Brw_ShowFileMetadata (void);
void Brw_DownloadFile (void); void Brw_DownloadFile (void);
void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char *URL); void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char *URL);
void Brw_ChgFileMetadata (void); 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_GetFileMetadataByPath (struct FileMetadata *FileMetadata);
void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata); void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata);
bool Brw_GetFileTypeSizeAndDate (struct FileMetadata *FileMetadata); bool Brw_GetFileTypeSizeAndDate (struct FileMetadata *FileMetadata);

View File

@ -43,6 +43,7 @@
#include "swad_notice.h" #include "swad_notice.h"
#include "swad_notification.h" #include "swad_notification.h"
#include "swad_parameter.h" #include "swad_parameter.h"
#include "swad_social.h"
/*****************************************************************************/ /*****************************************************************************/
/************** External global variables from others modules ****************/ /************** External global variables from others modules ****************/
@ -906,14 +907,26 @@ void Ntf_SetNotifInCrsAsRemoved (long CrsCod,long ToUsrCod)
/************ Set possible notifications of one file as removed **************/ /************ Set possible notifications of one file as removed **************/
/*****************************************************************************/ /*****************************************************************************/
void Ntf_SetNotifOneFileAsRemoved (Brw_FileBrowser_t FileBrowser, void Ntf_SetNotifOneFileAsRemoved (const char *Path)
long Cod,const char *Path)
{ {
char Query[512]; extern const Brw_FileBrowser_t Brw_FileBrowserForDB_files[Brw_NUM_TYPES_FILE_BROWSER];
char SubQuery[256]; Brw_FileBrowser_t FileBrowser = Brw_FileBrowserForDB_files[Gbl.FileBrowser.Type];
long FilCod;
Ntf_NotifyEvent_t NotifyEvent; Ntf_NotifyEvent_t NotifyEvent;
/***** Set notify event depending on browser zone *****/ switch (FileBrowser)
{
case Brw_ADMI_DOCUM_CRS:
case Brw_ADMI_DOCUM_GRP:
case Brw_ADMI_SHARE_CRS:
case Brw_ADMI_SHARE_GRP:
case Brw_ADMI_MARKS_CRS:
case Brw_ADMI_MARKS_GRP:
/***** Get file code *****/
FilCod = Brw_GetFilCodByPath (Path,false); // Any file, public or not
if (FilCod > 0)
{
/***** Set notification as removed *****/
switch (FileBrowser) switch (FileBrowser)
{ {
case Brw_ADMI_DOCUM_CRS: case Brw_ADMI_DOCUM_CRS:
@ -929,30 +942,81 @@ void Ntf_SetNotifOneFileAsRemoved (Brw_FileBrowser_t FileBrowser,
NotifyEvent = Ntf_EVENT_MARKS_FILE; NotifyEvent = Ntf_EVENT_MARKS_FILE;
break; break;
default: default:
return; 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);
} }
/***** Set notification as removed *****/
switch (FileBrowser)
{
case Brw_ADMI_DOCUM_CRS:
case Brw_ADMI_DOCUM_GRP:
case Brw_ADMI_SHARE_CRS:
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);
break; break;
default: default:
break; 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");
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -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_SetNotifAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod);
void Ntf_SetNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long ToUsrCod); void Ntf_SetNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long ToUsrCod);
void Ntf_SetNotifInCrsAsRemoved (long CrsCod,long ToUsrCod); void Ntf_SetNotifInCrsAsRemoved (long CrsCod,long ToUsrCod);
void Ntf_SetNotifOneFileAsRemoved (Brw_FileBrowser_t FileBrowser, void Ntf_SetNotifOneFileAsRemoved (const char *Path);
long Cod,const char *Path); void Ntf_SetSocialNoteOneFileAsRemoved (const char *Path);
void Ntf_SetNotifChildrenOfFolderAsRemoved (Brw_FileBrowser_t FileBrowser, void Ntf_SetNotifChildrenOfFolderAsRemoved (Brw_FileBrowser_t FileBrowser,
long Cod,const char *Path); long Cod,const char *Path);
void Ntf_SetNotifFilesInGroupAsRemoved (long GrpCod); void Ntf_SetNotifFilesInGroupAsRemoved (long GrpCod);

View File

@ -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."); Lay_ShowErrorAndExit ("Can not create temporary link for compression.");
/***** Update number of my views of this file *****/ /***** Update number of my views of this file *****/
Brw_UpdateMyFileViews (Brw_GetFilCodByPath (PathFileInTree)); Brw_UpdateMyFileViews (Brw_GetFilCodByPath (PathFileInTree,false)); // Any file, public or not
} }
} }
} }