mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-01 14:25:27 +02:00
Version 15.93
This commit is contained in:
parent
3da5bfb06c
commit
611deb2e7a
|
@ -111,19 +111,21 @@
|
||||||
// TODO: Reply to all
|
// TODO: Reply to all
|
||||||
// TODO: Hour in exam announcement should start at six a.m.
|
// TODO: Hour in exam announcement should start at six a.m.
|
||||||
// TODO: When a file, notice, etc. is removed, it should be removed from social events?
|
// TODO: When a file, notice, etc. is removed, it should be removed from social events?
|
||||||
// TODO: Cange "Actividad pública" to "Actividad de Antonio" in user's profile
|
// TODO: Change "Actividad pública" to "Actividad de Antonio" in user's profile
|
||||||
|
// TODO: Put parameter FilCod instead of Path to go to a file in Notifications and Social?
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************************** Public constants *****************************/
|
/****************************** Public constants *****************************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 15.92 (2016-01-02)"
|
#define Log_PLATFORM_VERSION "SWAD 15.93 (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: Jan 03, 2016 Fixing bugs in file metadata of files in institution, centre and degree zones. (190335 lines)
|
||||||
Version 15.92: Jan 02, 2016 Fixing bugs in file metadata of files in institution, centre and degree zones. Not finished. (190365 lines)
|
Version 15.92: Jan 02, 2016 Fixing bugs in file metadata of files in institution, centre and degree zones. Not finished. (190365 lines)
|
||||||
1 change necessary in database:
|
1 change necessary in database:
|
||||||
ALTER TABLE social_notes DROP COLUMN DegCod;
|
ALTER TABLE social_notes DROP COLUMN DegCod;
|
||||||
|
|
|
@ -2229,6 +2229,28 @@ static void Brw_GetDataCurrentGrp (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**************** Write hidden parameter with code of file *******************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
|
void Brw_PutHiddenParamFilCod (long FilCod)
|
||||||
|
{
|
||||||
|
Par_PutHiddenParamLong ("FilCod",FilCod);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/********************* Get parameter with code of file ***********************/
|
||||||
|
/*****************************************************************************/
|
||||||
|
/*
|
||||||
|
long Brw_GetParamFilCod (void)
|
||||||
|
{
|
||||||
|
char LongStr[1+10+1];
|
||||||
|
|
||||||
|
***** Get parameter with code of file *****
|
||||||
|
Par_GetParToText ("FilCod",LongStr,1+10);
|
||||||
|
return Str_ConvertStrCodToLongCod (LongStr);
|
||||||
|
}
|
||||||
|
*/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/** Put hidden params. with the path in the tree and the name of file/folder */
|
/** Put hidden params. with the path in the tree and the name of file/folder */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -8868,22 +8890,15 @@ void Brw_ShowFileMetadata (void)
|
||||||
|
|
||||||
/***** Get file metadata *****/
|
/***** Get file metadata *****/
|
||||||
Brw_GetFileMetadataByPath (&FileMetadata);
|
Brw_GetFileMetadataByPath (&FileMetadata);
|
||||||
|
// Brw_GetFileMetadataByCod (&FileMetadata);
|
||||||
Found = Brw_GetFileTypeSizeAndDate (&FileMetadata);
|
Found = Brw_GetFileTypeSizeAndDate (&FileMetadata);
|
||||||
|
|
||||||
sprintf (Gbl.Message,"Found = %s; FileMetadata.FilCod = %ld",
|
|
||||||
Found ? "true" : "false",
|
|
||||||
FileMetadata.FilCod);
|
|
||||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
|
||||||
|
|
||||||
if (Found)
|
if (Found)
|
||||||
{
|
{
|
||||||
if (FileMetadata.FilCod <= 0) // No entry for this file in database table of files
|
if (FileMetadata.FilCod <= 0) // No entry for this file in database table of files
|
||||||
{
|
|
||||||
/* Add entry to the table of files/folders */
|
/* Add entry to the table of files/folders */
|
||||||
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
|
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
|
||||||
Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT);
|
Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT);
|
||||||
// Brw_GetFileMetadataByCod (&FileMetadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Check if I can view this file.
|
/***** Check if I can view this file.
|
||||||
It could be marked as hidden or in a hidden folder *****/
|
It could be marked as hidden or in a hidden folder *****/
|
||||||
|
@ -9273,12 +9288,9 @@ void Brw_DownloadFile (void)
|
||||||
if (Found)
|
if (Found)
|
||||||
{
|
{
|
||||||
if (FileMetadata.FilCod <= 0) // No entry for this file in database table of files
|
if (FileMetadata.FilCod <= 0) // No entry for this file in database table of files
|
||||||
{
|
|
||||||
/* Add entry to the table of files/folders */
|
/* Add entry to the table of files/folders */
|
||||||
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
|
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
|
||||||
Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT);
|
Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT);
|
||||||
// Brw_GetFileMetadataByCod (&FileMetadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** Check if I can view this file.
|
/***** Check if I can view this file.
|
||||||
It could be marked as hidden or in a hidden folder *****/
|
It could be marked as hidden or in a hidden folder *****/
|
||||||
|
@ -9948,10 +9960,6 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
unsigned UnsignedNum;
|
unsigned UnsignedNum;
|
||||||
|
|
||||||
sprintf (Gbl.Message,"FileMetadata->FilCod = %ld",
|
|
||||||
FileMetadata->FilCod);
|
|
||||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
|
||||||
|
|
||||||
/***** Get metadata of a file from database *****/
|
/***** Get metadata of a file from database *****/
|
||||||
sprintf (Query,"SELECT FilCod,FileBrowser,Cod,ZoneUsrCod,"
|
sprintf (Query,"SELECT FilCod,FileBrowser,Cod,ZoneUsrCod,"
|
||||||
"PublisherUsrCod,FileType,Path,Hidden,Public,License"
|
"PublisherUsrCod,FileType,Path,Hidden,Public,License"
|
||||||
|
@ -9959,10 +9967,6 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
|
||||||
" WHERE FilCod='%ld'",
|
" WHERE FilCod='%ld'",
|
||||||
FileMetadata->FilCod);
|
FileMetadata->FilCod);
|
||||||
|
|
||||||
sprintf (Gbl.Message,"Query = %s",
|
|
||||||
Query);
|
|
||||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
|
||||||
|
|
||||||
if (DB_QuerySELECT (Query,&mysql_res,"can not get file metadata"))
|
if (DB_QuerySELECT (Query,&mysql_res,"can not get file metadata"))
|
||||||
{
|
{
|
||||||
/* Get row */
|
/* Get row */
|
||||||
|
@ -9996,10 +10000,6 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
|
||||||
strncpy (FileMetadata->Path,row[6],PATH_MAX);
|
strncpy (FileMetadata->Path,row[6],PATH_MAX);
|
||||||
FileMetadata->Path[PATH_MAX] = '\0';
|
FileMetadata->Path[PATH_MAX] = '\0';
|
||||||
|
|
||||||
sprintf (Gbl.Message,"FileMetadata->Path = %s",
|
|
||||||
FileMetadata->Path);
|
|
||||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
|
||||||
|
|
||||||
/* Is a hidden file? (row[7]) */
|
/* Is a hidden file? (row[7]) */
|
||||||
switch (Gbl.FileBrowser.Type)
|
switch (Gbl.FileBrowser.Type)
|
||||||
{
|
{
|
||||||
|
@ -10063,10 +10063,6 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
|
||||||
/***** Free structure that stores the query result *****/
|
/***** Free structure that stores the query result *****/
|
||||||
DB_FreeMySQLResult (&mysql_res);
|
DB_FreeMySQLResult (&mysql_res);
|
||||||
|
|
||||||
sprintf (Gbl.Message,"FileMetadata->Path = %s",
|
|
||||||
FileMetadata->Path);
|
|
||||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
|
||||||
|
|
||||||
/***** Fill some values with 0 (unused at this moment) *****/
|
/***** Fill some values with 0 (unused at this moment) *****/
|
||||||
FileMetadata->Size = (off_t) 0;
|
FileMetadata->Size = (off_t) 0;
|
||||||
FileMetadata->Time = (time_t) 0;
|
FileMetadata->Time = (time_t) 0;
|
||||||
|
|
|
@ -139,6 +139,8 @@ struct FileMetadata
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void Brw_GetParAndInitFileBrowser (void);
|
void Brw_GetParAndInitFileBrowser (void);
|
||||||
|
// void Brw_PutHiddenParamFilCod (long FilCod);
|
||||||
|
// long Brw_GetParamFilCod (void);
|
||||||
void Brw_PutParamsPathAndFile (Brw_FileType_t FileType,const char *PathInTree,const char *FileFolderName);
|
void Brw_PutParamsPathAndFile (Brw_FileType_t FileType,const char *PathInTree,const char *FileFolderName);
|
||||||
void Brw_InitializeFileBrowser (void);
|
void Brw_InitializeFileBrowser (void);
|
||||||
bool Brw_CheckIfExistsFolderAssigmentForAnyUsr (const char *FolderName);
|
bool Brw_CheckIfExistsFolderAssigmentForAnyUsr (const char *FolderName);
|
||||||
|
|
|
@ -227,7 +227,7 @@ static const char *Ntf_Icons[Ntf_NUM_NOTIFY_EVENTS] =
|
||||||
|
|
||||||
static void Ntf_WriteFormAllNotifications (bool AllNotifications);
|
static void Ntf_WriteFormAllNotifications (bool AllNotifications);
|
||||||
static bool Ntf_GetAllNotificationsFromForm (void);
|
static bool Ntf_GetAllNotificationsFromForm (void);
|
||||||
static void Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
||||||
long CrsCod,long Cod);
|
long CrsCod,long Cod);
|
||||||
static void Ntf_UpdateMyLastAccessToNotifications (void);
|
static void Ntf_UpdateMyLastAccessToNotifications (void);
|
||||||
static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsigned *NumNotif,unsigned *NumMails);
|
static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsigned *NumNotif,unsigned *NumMails);
|
||||||
|
@ -439,9 +439,11 @@ void Ntf_ShowMyNotifications (void)
|
||||||
fprintf (Gbl.F.Out,"<tr>"
|
fprintf (Gbl.F.Out,"<tr>"
|
||||||
"<td class=\"%s LEFT_TOP\" style=\"width:25px;\">",
|
"<td class=\"%s LEFT_TOP\" style=\"width:25px;\">",
|
||||||
ClassBackground);
|
ClassBackground);
|
||||||
|
if (PutLink)
|
||||||
|
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
||||||
|
|
||||||
if (PutLink)
|
if (PutLink)
|
||||||
{
|
{
|
||||||
Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
|
||||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/%s\""
|
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/%s\""
|
||||||
" alt=\"%s\" title=\"%s\""
|
" alt=\"%s\" title=\"%s\""
|
||||||
" class=\"ICON20x20\" />",
|
" class=\"ICON20x20\" />",
|
||||||
|
@ -464,9 +466,11 @@ void Ntf_ShowMyNotifications (void)
|
||||||
/* Write event type */
|
/* Write event type */
|
||||||
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">",
|
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">",
|
||||||
ClassBackground);
|
ClassBackground);
|
||||||
|
if (PutLink)
|
||||||
|
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
||||||
|
|
||||||
if (PutLink)
|
if (PutLink)
|
||||||
{
|
{
|
||||||
Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
|
||||||
Act_LinkFormSubmit (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassAnchor);
|
Act_LinkFormSubmit (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassAnchor);
|
||||||
fprintf (Gbl.F.Out,"%s</a>",
|
fprintf (Gbl.F.Out,"%s</a>",
|
||||||
Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
|
Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
|
||||||
|
@ -487,10 +491,10 @@ void Ntf_ShowMyNotifications (void)
|
||||||
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
|
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
|
||||||
{
|
{
|
||||||
if (PutLink)
|
if (PutLink)
|
||||||
{
|
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
||||||
Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
|
||||||
|
if (PutLink)
|
||||||
Act_LinkFormSubmit (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassAnchor);
|
Act_LinkFormSubmit (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassAnchor);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
fprintf (Gbl.F.Out,"<span class=\"%s\">",ClassAnchor);
|
fprintf (Gbl.F.Out,"<span class=\"%s\">",ClassAnchor);
|
||||||
fprintf (Gbl.F.Out,"%s: %s",Txt_Forum,ForumName);
|
fprintf (Gbl.F.Out,"%s: %s",Txt_Forum,ForumName);
|
||||||
|
@ -505,10 +509,10 @@ void Ntf_ShowMyNotifications (void)
|
||||||
else if (Crs.CrsCod > 0)
|
else if (Crs.CrsCod > 0)
|
||||||
{
|
{
|
||||||
if (PutLink)
|
if (PutLink)
|
||||||
{
|
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
||||||
Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
|
||||||
|
if (PutLink)
|
||||||
Act_LinkFormSubmit (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassAnchor);
|
Act_LinkFormSubmit (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassAnchor);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
fprintf (Gbl.F.Out,"<span class=\"%s\">",ClassAnchor);
|
fprintf (Gbl.F.Out,"<span class=\"%s\">",ClassAnchor);
|
||||||
fprintf (Gbl.F.Out,"%s: %s",Txt_Course,Crs.ShortName);
|
fprintf (Gbl.F.Out,"%s: %s",Txt_Course,Crs.ShortName);
|
||||||
|
@ -632,8 +636,9 @@ static bool Ntf_GetAllNotificationsFromForm (void)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********** Put form to go to an action depending on the event **************/
|
/*********** Put form to go to an action depending on the event **************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
// Return the value of Gbl.InsideForm (true if form is started)
|
||||||
|
|
||||||
static void Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
||||||
long CrsCod,long Cod)
|
long CrsCod,long Cod)
|
||||||
{
|
{
|
||||||
extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM];
|
extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM];
|
||||||
|
@ -652,62 +657,58 @@ static void Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
||||||
case Ntf_EVENT_DOCUMENT_FILE:
|
case Ntf_EVENT_DOCUMENT_FILE:
|
||||||
case Ntf_EVENT_SHARED_FILE:
|
case Ntf_EVENT_SHARED_FILE:
|
||||||
case Ntf_EVENT_MARKS_FILE:
|
case Ntf_EVENT_MARKS_FILE:
|
||||||
if (Cod > 0) // File code
|
|
||||||
{
|
|
||||||
FileMetadata.FilCod = Cod;
|
FileMetadata.FilCod = Cod;
|
||||||
|
PathUntilFileName[0] = '\0';
|
||||||
|
FileName[0] = '\0';
|
||||||
|
if (FileMetadata.FilCod > 0)
|
||||||
|
{
|
||||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||||
|
if (FileMetadata.FilCod > 0)
|
||||||
|
{
|
||||||
Brw_GetCrsGrpFromFileMetadata (FileMetadata.FileBrowser,FileMetadata.Cod,
|
Brw_GetCrsGrpFromFileMetadata (FileMetadata.FileBrowser,FileMetadata.Cod,
|
||||||
&InsCod,&CtrCod,&DegCod,&CrsCod,&GrpCod);
|
&InsCod,&CtrCod,&DegCod,&CrsCod,&GrpCod);
|
||||||
Str_SplitFullPathIntoPathAndFileName (FileMetadata.Path,
|
Str_SplitFullPathIntoPathAndFileName (FileMetadata.Path,
|
||||||
PathUntilFileName,
|
PathUntilFileName,
|
||||||
FileName);
|
FileName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
switch (NotifyEvent)
|
switch (NotifyEvent)
|
||||||
{
|
{
|
||||||
case Ntf_EVENT_DOCUMENT_FILE:
|
case Ntf_EVENT_DOCUMENT_FILE:
|
||||||
Action = (Cod > 0) ? ((GrpCod > 0) ? ActReqDatSeeDocGrp :
|
Action = (FileMetadata.FilCod > 0) ? ((GrpCod > 0) ? ActReqDatSeeDocGrp :
|
||||||
((CrsCod > 0) ? ActReqDatSeeDocCrs :
|
((CrsCod > 0) ? ActReqDatSeeDocCrs :
|
||||||
((DegCod > 0) ? ActReqDatSeeDocDeg :
|
((DegCod > 0) ? ActReqDatSeeDocDeg :
|
||||||
(CtrCod > 0) ? ActReqDatSeeDocCtr :
|
(CtrCod > 0) ? ActReqDatSeeDocCtr :
|
||||||
ActReqDatSeeDocIns))) :
|
ActReqDatSeeDocIns))) :
|
||||||
((GrpCod > 0) ? ActSeeDocGrp :
|
ActUnk;
|
||||||
((CrsCod > 0) ? ActSeeDocCrs :
|
|
||||||
((DegCod > 0) ? ActSeeDocDeg :
|
|
||||||
(CtrCod > 0) ? ActSeeDocCtr :
|
|
||||||
ActSeeDocIns)));
|
|
||||||
break;
|
break;
|
||||||
case Ntf_EVENT_SHARED_FILE:
|
case Ntf_EVENT_SHARED_FILE:
|
||||||
Action = (Cod > 0) ? ((GrpCod > 0) ? ActReqDatShaGrp :
|
Action = (FileMetadata.FilCod > 0) ? ((GrpCod > 0) ? ActReqDatShaGrp :
|
||||||
ActReqDatShaCrs) :
|
|
||||||
((GrpCod > 0) ? ActAdmShaGrp :
|
|
||||||
ActAdmShaCrs);
|
|
||||||
Action = (Cod > 0) ? ((GrpCod > 0) ? ActReqDatShaGrp :
|
|
||||||
((CrsCod > 0) ? ActReqDatShaCrs :
|
((CrsCod > 0) ? ActReqDatShaCrs :
|
||||||
((DegCod > 0) ? ActReqDatShaDeg :
|
((DegCod > 0) ? ActReqDatShaDeg :
|
||||||
(CtrCod > 0) ? ActReqDatShaCtr :
|
(CtrCod > 0) ? ActReqDatShaCtr :
|
||||||
ActReqDatShaIns))) :
|
ActReqDatShaIns))) :
|
||||||
((GrpCod > 0) ? ActAdmShaGrp :
|
ActUnk;
|
||||||
((CrsCod > 0) ? ActAdmShaCrs :
|
|
||||||
((DegCod > 0) ? ActAdmShaDeg :
|
|
||||||
(CtrCod > 0) ? ActAdmShaCtr :
|
|
||||||
ActAdmShaIns)));
|
|
||||||
break;
|
break;
|
||||||
case Ntf_EVENT_MARKS_FILE:
|
case Ntf_EVENT_MARKS_FILE:
|
||||||
Action = (Cod > 0) ? ((GrpCod > 0) ? ActReqDatSeeMrkGrp :
|
Action = (FileMetadata.FilCod > 0) ? ((GrpCod > 0) ? ActReqDatSeeMrkGrp :
|
||||||
ActReqDatSeeMrkCrs) :
|
ActReqDatSeeMrkCrs) :
|
||||||
((GrpCod > 0) ? ActSeeMrkGrp :
|
ActUnk;
|
||||||
ActSeeMrkCrs);
|
|
||||||
break;
|
break;
|
||||||
default: // Not aplicable here
|
default: // Not aplicable here
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (Action != ActUnk)
|
||||||
|
{
|
||||||
Act_FormStart (Action);
|
Act_FormStart (Action);
|
||||||
// Grp_PutParamGrpCod (GrpCod > 0 ? GrpCod :
|
|
||||||
// -1L);
|
|
||||||
if (GrpCod > 0)
|
if (GrpCod > 0)
|
||||||
Grp_PutParamGrpCod (GrpCod);
|
Grp_PutParamGrpCod (GrpCod);
|
||||||
if (Cod > 0) // File code
|
if (FileMetadata.FilCod > 0)
|
||||||
Brw_PutParamsPathAndFile (Brw_IS_UNKNOWN,PathUntilFileName,FileName); // TODO: Brw_IS_UNKNOWN should be changed to Brw_IS_FILE or Brw_IS_LINK
|
{
|
||||||
|
// Brw_PutHiddenParamFilCod (FileMetadata.FilCod);
|
||||||
|
Brw_PutParamsPathAndFile (FileMetadata.FileType,PathUntilFileName,FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Ntf_EVENT_NOTICE:
|
case Ntf_EVENT_NOTICE:
|
||||||
Act_FormStart (Ntf_DefaultActions[NotifyEvent]);
|
Act_FormStart (Ntf_DefaultActions[NotifyEvent]);
|
||||||
|
@ -728,6 +729,8 @@ static void Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Parameter to go to another course/degree/centre/institution *****/
|
/***** Parameter to go to another course/degree/centre/institution *****/
|
||||||
|
if (Gbl.InsideForm)
|
||||||
|
{
|
||||||
if (CrsCod > 0) // Course specified
|
if (CrsCod > 0) // Course specified
|
||||||
{
|
{
|
||||||
if (CrsCod != Gbl.CurrentCrs.Crs.CrsCod) // Not the current course
|
if (CrsCod != Gbl.CurrentCrs.Crs.CrsCod) // Not the current course
|
||||||
|
@ -750,6 +753,9 @@ static void Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Gbl.InsideForm;
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/****************** Set StatusTxt depending on status bits *******************/
|
/****************** Set StatusTxt depending on status bits *******************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
109
swad_social.c
109
swad_social.c
|
@ -58,20 +58,20 @@ static const Act_Action_t Soc_DefaultActions[Soc_NUM_SOCIAL_NOTES] =
|
||||||
ActUnk, // Soc_NOTE_UNKNOWN
|
ActUnk, // Soc_NOTE_UNKNOWN
|
||||||
|
|
||||||
/* Institution tab */
|
/* Institution tab */
|
||||||
ActSeeDocIns, // Soc_NOTE_INS_DOC_PUB_FILE
|
ActReqDatSeeDocIns, // Soc_NOTE_INS_DOC_PUB_FILE
|
||||||
ActAdmShaIns, // Soc_NOTE_INS_SHA_PUB_FILE
|
ActReqDatShaIns, // Soc_NOTE_INS_SHA_PUB_FILE
|
||||||
|
|
||||||
/* Centre tab */
|
/* Centre tab */
|
||||||
ActSeeDocCtr, // Soc_NOTE_CTR_DOC_PUB_FILE
|
ActReqDatSeeDocCtr, // Soc_NOTE_CTR_DOC_PUB_FILE
|
||||||
ActAdmShaCtr, // Soc_NOTE_CTR_SHA_PUB_FILE
|
ActReqDatShaCtr, // Soc_NOTE_CTR_SHA_PUB_FILE
|
||||||
|
|
||||||
/* Degree tab */
|
/* Degree tab */
|
||||||
ActSeeDocDeg, // Soc_NOTE_DEG_DOC_PUB_FILE
|
ActReqDatSeeDocDeg, // Soc_NOTE_DEG_DOC_PUB_FILE
|
||||||
ActAdmShaDeg, // Soc_NOTE_DEG_SHA_PUB_FILE
|
ActReqDatShaDeg, // Soc_NOTE_DEG_SHA_PUB_FILE
|
||||||
|
|
||||||
/* Course tab */
|
/* Course tab */
|
||||||
ActSeeDocCrs, // Soc_NOTE_CRS_DOC_PUB_FILE
|
ActReqDatSeeDocCrs, // Soc_NOTE_CRS_DOC_PUB_FILE
|
||||||
ActAdmShaCrs, // Soc_NOTE_CRS_SHA_PUB_FILE
|
ActReqDatShaCrs, // Soc_NOTE_CRS_SHA_PUB_FILE
|
||||||
|
|
||||||
/* Assessment tab */
|
/* Assessment tab */
|
||||||
ActSeeExaAnn, // Soc_NOTE_EXAM_ANNOUNCEMENT
|
ActSeeExaAnn, // Soc_NOTE_EXAM_ANNOUNCEMENT
|
||||||
|
@ -135,7 +135,7 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
|
||||||
bool WritingTimeline,bool LastInList);
|
bool WritingTimeline,bool LastInList);
|
||||||
static void Soc_WriteNoteDate (time_t TimeUTC);
|
static void Soc_WriteNoteDate (time_t TimeUTC);
|
||||||
static void Soc_GetAndWriteSocialPost (long PstCod);
|
static void Soc_GetAndWriteSocialPost (long PstCod);
|
||||||
static void Soc_StartFormGoToAction (Soc_NoteType_t NoteType,
|
static void Soc_PutFormGoToAction (Soc_NoteType_t NoteType,
|
||||||
long CrsCod,long Cod);
|
long CrsCod,long Cod);
|
||||||
static void Soc_GetNoteSummary (const struct SocialNote *SocNot,
|
static void Soc_GetNoteSummary (const struct SocialNote *SocNot,
|
||||||
char *SummaryStr,unsigned MaxChars);
|
char *SummaryStr,unsigned MaxChars);
|
||||||
|
@ -303,11 +303,6 @@ static void Soc_ShowTimeline (const char *Query,Act_Action_t UpdateAction)
|
||||||
/* Get and write social note */
|
/* Get and write social note */
|
||||||
SocNot.NotCod = SocPub.NotCod;
|
SocNot.NotCod = SocPub.NotCod;
|
||||||
Soc_GetDataOfSocialNoteByCod (&SocNot);
|
Soc_GetDataOfSocialNoteByCod (&SocNot);
|
||||||
|
|
||||||
sprintf (Gbl.Message,"SocNot.Cod = %ld",
|
|
||||||
SocNot.Cod);
|
|
||||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
|
||||||
|
|
||||||
Soc_WriteSocialNote (&SocPub,&SocNot,true,NumPub == NumPublishings - 1);
|
Soc_WriteSocialNote (&SocPub,&SocNot,true,NumPub == NumPublishings - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,8 +349,6 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
|
||||||
const struct SocialNote *SocNot,
|
const struct SocialNote *SocNot,
|
||||||
bool WritingTimeline,bool LastInList)
|
bool WritingTimeline,bool LastInList)
|
||||||
{
|
{
|
||||||
extern const char *The_ClassForm[The_NUM_THEMES];
|
|
||||||
extern const char *Txt_SOCIAL_NOTE[Soc_NUM_SOCIAL_NOTES];
|
|
||||||
extern const char *Txt_Forum;
|
extern const char *Txt_Forum;
|
||||||
extern const char *Txt_Course;
|
extern const char *Txt_Course;
|
||||||
extern const char *Txt_Degree;
|
extern const char *Txt_Degree;
|
||||||
|
@ -428,10 +421,6 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
|
||||||
/* Get institution data */
|
/* Get institution data */
|
||||||
Ins.InsCod = SocNot->HieCod;
|
Ins.InsCod = SocNot->HieCod;
|
||||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||||
|
|
||||||
sprintf (Gbl.Message,"SocNot->Cod = %ld",
|
|
||||||
SocNot->Cod);
|
|
||||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
|
||||||
break;
|
break;
|
||||||
case Soc_NOTE_CTR_DOC_PUB_FILE:
|
case Soc_NOTE_CTR_DOC_PUB_FILE:
|
||||||
case Soc_NOTE_CTR_SHA_PUB_FILE:
|
case Soc_NOTE_CTR_SHA_PUB_FILE:
|
||||||
|
@ -472,13 +461,8 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write note type */
|
/* Write note type */
|
||||||
fprintf (Gbl.F.Out,"<div>");
|
fprintf (Gbl.F.Out,"<div class=\"DAT\">");
|
||||||
Soc_StartFormGoToAction (SocNot->NoteType,Crs.CrsCod,SocNot->Cod);
|
Soc_PutFormGoToAction (SocNot->NoteType,Crs.CrsCod,SocNot->Cod);
|
||||||
Act_LinkFormSubmit (Txt_SOCIAL_NOTE[SocNot->NoteType],
|
|
||||||
The_ClassForm[Gbl.Prefs.Theme]);
|
|
||||||
fprintf (Gbl.F.Out,"%s</a>",
|
|
||||||
Txt_SOCIAL_NOTE[SocNot->NoteType]);
|
|
||||||
Act_FormEnd ();
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
|
||||||
/* Write location in hierarchy */
|
/* Write location in hierarchy */
|
||||||
|
@ -624,9 +608,11 @@ static void Soc_GetAndWriteSocialPost (long PstCod)
|
||||||
/********* Put form to go to an action depending on the social note **********/
|
/********* Put form to go to an action depending on the social note **********/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Soc_StartFormGoToAction (Soc_NoteType_t NoteType,long CrsCod,long Cod)
|
static void Soc_PutFormGoToAction (Soc_NoteType_t NoteType,long CrsCod,long Cod)
|
||||||
{
|
{
|
||||||
extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM];
|
extern const Act_Action_t For_ActionsSeeFor[For_NUM_TYPES_FORUM];
|
||||||
|
extern const char *The_ClassForm[The_NUM_THEMES];
|
||||||
|
extern const char *Txt_SOCIAL_NOTE[Soc_NUM_SOCIAL_NOTES];
|
||||||
struct FileMetadata FileMetadata;
|
struct FileMetadata FileMetadata;
|
||||||
long InsCod = -1L;
|
long InsCod = -1L;
|
||||||
long CtrCod = -1L;
|
long CtrCod = -1L;
|
||||||
|
@ -634,7 +620,6 @@ static void Soc_StartFormGoToAction (Soc_NoteType_t NoteType,long CrsCod,long Co
|
||||||
long GrpCod = -1L;
|
long GrpCod = -1L;
|
||||||
char PathUntilFileName[PATH_MAX+1];
|
char PathUntilFileName[PATH_MAX+1];
|
||||||
char FileName[NAME_MAX+1];
|
char FileName[NAME_MAX+1];
|
||||||
Act_Action_t Action = ActUnk; // Initialized to avoid warning
|
|
||||||
|
|
||||||
/***** Parameters depending on the type of note *****/
|
/***** Parameters depending on the type of note *****/
|
||||||
switch (NoteType)
|
switch (NoteType)
|
||||||
|
@ -647,14 +632,12 @@ static void Soc_StartFormGoToAction (Soc_NoteType_t NoteType,long CrsCod,long Co
|
||||||
case Soc_NOTE_DEG_SHA_PUB_FILE:
|
case Soc_NOTE_DEG_SHA_PUB_FILE:
|
||||||
case Soc_NOTE_CRS_DOC_PUB_FILE:
|
case Soc_NOTE_CRS_DOC_PUB_FILE:
|
||||||
case Soc_NOTE_CRS_SHA_PUB_FILE:
|
case Soc_NOTE_CRS_SHA_PUB_FILE:
|
||||||
if (Cod > 0) // File code
|
|
||||||
{
|
|
||||||
sprintf (Gbl.Message,"Cod = %ld",
|
|
||||||
Cod);
|
|
||||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
|
||||||
|
|
||||||
FileMetadata.FilCod = Cod;
|
FileMetadata.FilCod = Cod;
|
||||||
Brw_GetFileMetadataByCod (&FileMetadata); // TODO: Check all calls to this function!!!!!
|
PathUntilFileName[0] = '\0';
|
||||||
|
FileName[0] = '\0';
|
||||||
|
if (FileMetadata.FilCod > 0)
|
||||||
|
{
|
||||||
|
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||||
if (FileMetadata.FilCod > 0) // Found
|
if (FileMetadata.FilCod > 0) // Found
|
||||||
{
|
{
|
||||||
Brw_GetCrsGrpFromFileMetadata (FileMetadata.FileBrowser,FileMetadata.Cod,
|
Brw_GetCrsGrpFromFileMetadata (FileMetadata.FileBrowser,FileMetadata.Cod,
|
||||||
|
@ -663,46 +646,13 @@ static void Soc_StartFormGoToAction (Soc_NoteType_t NoteType,long CrsCod,long Co
|
||||||
PathUntilFileName,
|
PathUntilFileName,
|
||||||
FileName);
|
FileName);
|
||||||
}
|
}
|
||||||
Cod = FileMetadata.FilCod; // If file not found ==> FileMetadata.FilCod == -1
|
|
||||||
|
|
||||||
sprintf (Gbl.Message,"PathUntilFileName = %s; FileName = %s; FileMetadata.FilCod = %ld",
|
|
||||||
PathUntilFileName,FileName,
|
|
||||||
FileMetadata.FilCod);
|
|
||||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
|
||||||
}
|
}
|
||||||
switch (NoteType)
|
if (FileMetadata.FilCod > 0)
|
||||||
{
|
{
|
||||||
case Soc_NOTE_INS_DOC_PUB_FILE:
|
Act_FormStart (Soc_DefaultActions[NoteType]);
|
||||||
Action = (Cod > 0) ? ActReqDatSeeDocIns : ActSeeDocIns;
|
// Brw_PutHiddenParamFilCod (FileMetadata.FilCod);
|
||||||
break;
|
Brw_PutParamsPathAndFile (FileMetadata.FileType,PathUntilFileName,FileName);
|
||||||
case Soc_NOTE_INS_SHA_PUB_FILE:
|
|
||||||
Action = (Cod > 0) ? ActReqDatShaIns : ActAdmShaIns;
|
|
||||||
break;
|
|
||||||
case Soc_NOTE_CTR_DOC_PUB_FILE:
|
|
||||||
Action = (Cod > 0) ? ActReqDatSeeDocCtr : ActSeeDocCtr;
|
|
||||||
break;
|
|
||||||
case Soc_NOTE_CTR_SHA_PUB_FILE:
|
|
||||||
Action = (Cod > 0) ? ActReqDatShaCtr : ActAdmShaCtr;
|
|
||||||
break;
|
|
||||||
case Soc_NOTE_DEG_DOC_PUB_FILE:
|
|
||||||
Action = (Cod > 0) ? ActReqDatSeeDocDeg : ActSeeDocDeg;
|
|
||||||
break;
|
|
||||||
case Soc_NOTE_DEG_SHA_PUB_FILE:
|
|
||||||
Action = (Cod > 0) ? ActReqDatShaDeg : ActAdmShaDeg;
|
|
||||||
break;
|
|
||||||
case Soc_NOTE_CRS_DOC_PUB_FILE:
|
|
||||||
Action = (Cod > 0) ? ActReqDatSeeDocCrs : ActSeeDocCrs;
|
|
||||||
break;
|
|
||||||
case Soc_NOTE_CRS_SHA_PUB_FILE:
|
|
||||||
Action = (Cod > 0) ? ActReqDatShaCrs : ActAdmShaCrs;
|
|
||||||
break;
|
|
||||||
default: // Not aplicable here
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
Act_FormStart (Action);
|
|
||||||
// Grp_PutParamGrpCod (-1L);
|
|
||||||
if (Cod > 0) // File code
|
|
||||||
Brw_PutParamsPathAndFile (Brw_IS_FILE,PathUntilFileName,FileName);
|
|
||||||
break;
|
break;
|
||||||
case Soc_NOTE_NOTICE:
|
case Soc_NOTE_NOTICE:
|
||||||
Act_FormStart (Soc_DefaultActions[NoteType]);
|
Act_FormStart (Soc_DefaultActions[NoteType]);
|
||||||
|
@ -717,7 +667,9 @@ static void Soc_StartFormGoToAction (Soc_NoteType_t NoteType,long CrsCod,long Co
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***** Parameter to go to another course *****/
|
if (Gbl.InsideForm)
|
||||||
|
{
|
||||||
|
/***** Parameter to go to another place in hierarchy *****/
|
||||||
if (CrsCod > 0) // Course specified
|
if (CrsCod > 0) // Course specified
|
||||||
{
|
{
|
||||||
if (CrsCod != Gbl.CurrentCrs.Crs.CrsCod) // Not the current course
|
if (CrsCod != Gbl.CurrentCrs.Crs.CrsCod) // Not the current course
|
||||||
|
@ -738,6 +690,15 @@ static void Soc_StartFormGoToAction (Soc_NoteType_t NoteType,long CrsCod,long Co
|
||||||
if (InsCod != Gbl.CurrentIns.Ins.InsCod) // Not the current institution
|
if (InsCod != Gbl.CurrentIns.Ins.InsCod) // Not the current institution
|
||||||
Ins_PutParamInsCod (InsCod); // Go to another institution
|
Ins_PutParamInsCod (InsCod); // Go to another institution
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***** Link and end form *****/
|
||||||
|
Act_LinkFormSubmit (Txt_SOCIAL_NOTE[NoteType],
|
||||||
|
The_ClassForm[Gbl.Prefs.Theme]);
|
||||||
|
fprintf (Gbl.F.Out,"%s</a>",Txt_SOCIAL_NOTE[NoteType]);
|
||||||
|
Act_FormEnd ();
|
||||||
|
}
|
||||||
|
else // Not inside a form
|
||||||
|
fprintf (Gbl.F.Out,"%s",Txt_SOCIAL_NOTE[NoteType]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user