mirror of https://github.com/acanas/swad-core.git
Version 15.93
This commit is contained in:
parent
3da5bfb06c
commit
611deb2e7a
|
@ -111,19 +111,21 @@
|
|||
// TODO: Reply to all
|
||||
// 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: 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 *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#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 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: 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)
|
||||
1 change necessary in database:
|
||||
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 */
|
||||
/*****************************************************************************/
|
||||
|
@ -8868,22 +8890,15 @@ void Brw_ShowFileMetadata (void)
|
|||
|
||||
/***** Get file metadata *****/
|
||||
Brw_GetFileMetadataByPath (&FileMetadata);
|
||||
// Brw_GetFileMetadataByCod (&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 (FileMetadata.FilCod <= 0) // No entry for this file in database table of files
|
||||
{
|
||||
/* Add entry to the table of files/folders */
|
||||
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
|
||||
Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT);
|
||||
// Brw_GetFileMetadataByCod (&FileMetadata);
|
||||
}
|
||||
|
||||
/***** Check if I can view this file.
|
||||
It could be marked as hidden or in a hidden folder *****/
|
||||
|
@ -9273,12 +9288,9 @@ void Brw_DownloadFile (void)
|
|||
if (Found)
|
||||
{
|
||||
if (FileMetadata.FilCod <= 0) // No entry for this file in database table of files
|
||||
{
|
||||
/* Add entry to the table of files/folders */
|
||||
FileMetadata.FilCod = Brw_AddPathToDB (-1L,FileMetadata.FileType,
|
||||
Gbl.FileBrowser.Priv.FullPathInTree,false,Brw_LICENSE_DEFAULT);
|
||||
// Brw_GetFileMetadataByCod (&FileMetadata);
|
||||
}
|
||||
|
||||
/***** Check if I can view this file.
|
||||
It could be marked as hidden or in a hidden folder *****/
|
||||
|
@ -9948,10 +9960,6 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
|
|||
MYSQL_ROW row;
|
||||
unsigned UnsignedNum;
|
||||
|
||||
sprintf (Gbl.Message,"FileMetadata->FilCod = %ld",
|
||||
FileMetadata->FilCod);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
|
||||
/***** Get metadata of a file from database *****/
|
||||
sprintf (Query,"SELECT FilCod,FileBrowser,Cod,ZoneUsrCod,"
|
||||
"PublisherUsrCod,FileType,Path,Hidden,Public,License"
|
||||
|
@ -9959,10 +9967,6 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
|
|||
" WHERE FilCod='%ld'",
|
||||
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"))
|
||||
{
|
||||
/* Get row */
|
||||
|
@ -9996,10 +10000,6 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
|
|||
strncpy (FileMetadata->Path,row[6],PATH_MAX);
|
||||
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]) */
|
||||
switch (Gbl.FileBrowser.Type)
|
||||
{
|
||||
|
@ -10063,10 +10063,6 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata)
|
|||
/***** Free structure that stores the query result *****/
|
||||
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) *****/
|
||||
FileMetadata->Size = (off_t) 0;
|
||||
FileMetadata->Time = (time_t) 0;
|
||||
|
|
|
@ -139,6 +139,8 @@ struct FileMetadata
|
|||
/*****************************************************************************/
|
||||
|
||||
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_InitializeFileBrowser (void);
|
||||
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 bool Ntf_GetAllNotificationsFromForm (void);
|
||||
static void Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
||||
static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
||||
long CrsCod,long Cod);
|
||||
static void Ntf_UpdateMyLastAccessToNotifications (void);
|
||||
static void Ntf_SendPendingNotifByEMailToOneUsr (struct UsrData *ToUsrDat,unsigned *NumNotif,unsigned *NumMails);
|
||||
|
@ -439,17 +439,19 @@ void Ntf_ShowMyNotifications (void)
|
|||
fprintf (Gbl.F.Out,"<tr>"
|
||||
"<td class=\"%s LEFT_TOP\" style=\"width:25px;\">",
|
||||
ClassBackground);
|
||||
if (PutLink)
|
||||
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
||||
|
||||
if (PutLink)
|
||||
{
|
||||
Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/%s\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICON20x20\" />",
|
||||
Gbl.Prefs.IconsURL,
|
||||
Ntf_Icons[NotifyEvent],
|
||||
Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],
|
||||
Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
|
||||
Act_FormEnd ();
|
||||
fprintf (Gbl.F.Out,"<input type=\"image\" src=\"%s/%s\""
|
||||
" alt=\"%s\" title=\"%s\""
|
||||
" class=\"ICON20x20\" />",
|
||||
Gbl.Prefs.IconsURL,
|
||||
Ntf_Icons[NotifyEvent],
|
||||
Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],
|
||||
Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
|
||||
Act_FormEnd ();
|
||||
}
|
||||
else
|
||||
fprintf (Gbl.F.Out,"<img src=\"%s/%s\""
|
||||
|
@ -464,9 +466,11 @@ void Ntf_ShowMyNotifications (void)
|
|||
/* Write event type */
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s LEFT_TOP\">",
|
||||
ClassBackground);
|
||||
if (PutLink)
|
||||
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
||||
|
||||
if (PutLink)
|
||||
{
|
||||
Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
||||
Act_LinkFormSubmit (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassAnchor);
|
||||
fprintf (Gbl.F.Out,"%s</a>",
|
||||
Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent]);
|
||||
|
@ -487,10 +491,10 @@ void Ntf_ShowMyNotifications (void)
|
|||
NotifyEvent == Ntf_EVENT_FORUM_REPLY)
|
||||
{
|
||||
if (PutLink)
|
||||
{
|
||||
Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
||||
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
||||
|
||||
if (PutLink)
|
||||
Act_LinkFormSubmit (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassAnchor);
|
||||
}
|
||||
else
|
||||
fprintf (Gbl.F.Out,"<span class=\"%s\">",ClassAnchor);
|
||||
fprintf (Gbl.F.Out,"%s: %s",Txt_Forum,ForumName);
|
||||
|
@ -505,10 +509,10 @@ void Ntf_ShowMyNotifications (void)
|
|||
else if (Crs.CrsCod > 0)
|
||||
{
|
||||
if (PutLink)
|
||||
{
|
||||
Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
||||
PutLink = Ntf_StartFormGoToAction (NotifyEvent,Crs.CrsCod,Cod);
|
||||
|
||||
if (PutLink)
|
||||
Act_LinkFormSubmit (Txt_NOTIFY_EVENTS_SINGULAR[NotifyEvent],ClassAnchor);
|
||||
}
|
||||
else
|
||||
fprintf (Gbl.F.Out,"<span class=\"%s\">",ClassAnchor);
|
||||
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 **************/
|
||||
/*****************************************************************************/
|
||||
// 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)
|
||||
{
|
||||
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_SHARED_FILE:
|
||||
case Ntf_EVENT_MARKS_FILE:
|
||||
if (Cod > 0) // File code
|
||||
FileMetadata.FilCod = Cod;
|
||||
PathUntilFileName[0] = '\0';
|
||||
FileName[0] = '\0';
|
||||
if (FileMetadata.FilCod > 0)
|
||||
{
|
||||
FileMetadata.FilCod = Cod;
|
||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||
Brw_GetCrsGrpFromFileMetadata (FileMetadata.FileBrowser,FileMetadata.Cod,
|
||||
&InsCod,&CtrCod,&DegCod,&CrsCod,&GrpCod);
|
||||
Str_SplitFullPathIntoPathAndFileName (FileMetadata.Path,
|
||||
PathUntilFileName,
|
||||
FileName);
|
||||
if (FileMetadata.FilCod > 0)
|
||||
{
|
||||
Brw_GetCrsGrpFromFileMetadata (FileMetadata.FileBrowser,FileMetadata.Cod,
|
||||
&InsCod,&CtrCod,&DegCod,&CrsCod,&GrpCod);
|
||||
Str_SplitFullPathIntoPathAndFileName (FileMetadata.Path,
|
||||
PathUntilFileName,
|
||||
FileName);
|
||||
}
|
||||
}
|
||||
switch (NotifyEvent)
|
||||
{
|
||||
case Ntf_EVENT_DOCUMENT_FILE:
|
||||
Action = (Cod > 0) ? ((GrpCod > 0) ? ActReqDatSeeDocGrp :
|
||||
((CrsCod > 0) ? ActReqDatSeeDocCrs :
|
||||
((DegCod > 0) ? ActReqDatSeeDocDeg :
|
||||
(CtrCod > 0) ? ActReqDatSeeDocCtr :
|
||||
ActReqDatSeeDocIns))) :
|
||||
((GrpCod > 0) ? ActSeeDocGrp :
|
||||
((CrsCod > 0) ? ActSeeDocCrs :
|
||||
((DegCod > 0) ? ActSeeDocDeg :
|
||||
(CtrCod > 0) ? ActSeeDocCtr :
|
||||
ActSeeDocIns)));
|
||||
Action = (FileMetadata.FilCod > 0) ? ((GrpCod > 0) ? ActReqDatSeeDocGrp :
|
||||
((CrsCod > 0) ? ActReqDatSeeDocCrs :
|
||||
((DegCod > 0) ? ActReqDatSeeDocDeg :
|
||||
(CtrCod > 0) ? ActReqDatSeeDocCtr :
|
||||
ActReqDatSeeDocIns))) :
|
||||
ActUnk;
|
||||
break;
|
||||
case Ntf_EVENT_SHARED_FILE:
|
||||
Action = (Cod > 0) ? ((GrpCod > 0) ? ActReqDatShaGrp :
|
||||
ActReqDatShaCrs) :
|
||||
((GrpCod > 0) ? ActAdmShaGrp :
|
||||
ActAdmShaCrs);
|
||||
Action = (Cod > 0) ? ((GrpCod > 0) ? ActReqDatShaGrp :
|
||||
((CrsCod > 0) ? ActReqDatShaCrs :
|
||||
((DegCod > 0) ? ActReqDatShaDeg :
|
||||
(CtrCod > 0) ? ActReqDatShaCtr :
|
||||
ActReqDatShaIns))) :
|
||||
((GrpCod > 0) ? ActAdmShaGrp :
|
||||
((CrsCod > 0) ? ActAdmShaCrs :
|
||||
((DegCod > 0) ? ActAdmShaDeg :
|
||||
(CtrCod > 0) ? ActAdmShaCtr :
|
||||
ActAdmShaIns)));
|
||||
Action = (FileMetadata.FilCod > 0) ? ((GrpCod > 0) ? ActReqDatShaGrp :
|
||||
((CrsCod > 0) ? ActReqDatShaCrs :
|
||||
((DegCod > 0) ? ActReqDatShaDeg :
|
||||
(CtrCod > 0) ? ActReqDatShaCtr :
|
||||
ActReqDatShaIns))) :
|
||||
ActUnk;
|
||||
break;
|
||||
case Ntf_EVENT_MARKS_FILE:
|
||||
Action = (Cod > 0) ? ((GrpCod > 0) ? ActReqDatSeeMrkGrp :
|
||||
ActReqDatSeeMrkCrs) :
|
||||
((GrpCod > 0) ? ActSeeMrkGrp :
|
||||
ActSeeMrkCrs);
|
||||
Action = (FileMetadata.FilCod > 0) ? ((GrpCod > 0) ? ActReqDatSeeMrkGrp :
|
||||
ActReqDatSeeMrkCrs) :
|
||||
ActUnk;
|
||||
break;
|
||||
default: // Not aplicable here
|
||||
break;
|
||||
}
|
||||
Act_FormStart (Action);
|
||||
// Grp_PutParamGrpCod (GrpCod > 0 ? GrpCod :
|
||||
// -1L);
|
||||
if (GrpCod > 0)
|
||||
Grp_PutParamGrpCod (GrpCod);
|
||||
if (Cod > 0) // File code
|
||||
Brw_PutParamsPathAndFile (Brw_IS_UNKNOWN,PathUntilFileName,FileName); // TODO: Brw_IS_UNKNOWN should be changed to Brw_IS_FILE or Brw_IS_LINK
|
||||
if (Action != ActUnk)
|
||||
{
|
||||
Act_FormStart (Action);
|
||||
if (GrpCod > 0)
|
||||
Grp_PutParamGrpCod (GrpCod);
|
||||
if (FileMetadata.FilCod > 0)
|
||||
{
|
||||
// Brw_PutHiddenParamFilCod (FileMetadata.FilCod);
|
||||
Brw_PutParamsPathAndFile (FileMetadata.FileType,PathUntilFileName,FileName);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Ntf_EVENT_NOTICE:
|
||||
Act_FormStart (Ntf_DefaultActions[NotifyEvent]);
|
||||
|
@ -728,26 +729,31 @@ static void Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
|||
}
|
||||
|
||||
/***** Parameter to go to another course/degree/centre/institution *****/
|
||||
if (CrsCod > 0) // Course specified
|
||||
if (Gbl.InsideForm)
|
||||
{
|
||||
if (CrsCod != Gbl.CurrentCrs.Crs.CrsCod) // Not the current course
|
||||
Crs_PutParamCrsCod (CrsCod); // Go to another course
|
||||
}
|
||||
else if (DegCod > 0) // Degree specified
|
||||
{
|
||||
if (DegCod != Gbl.CurrentDeg.Deg.DegCod) // Not the current degree
|
||||
Deg_PutParamDegCod (DegCod); // Go to another degree
|
||||
}
|
||||
else if (CtrCod > 0) // Centre specified
|
||||
{
|
||||
if (CtrCod != Gbl.CurrentCtr.Ctr.CtrCod) // Not the current centre
|
||||
Ctr_PutParamCtrCod (CtrCod); // Go to another centre
|
||||
}
|
||||
else if (InsCod > 0) // Institution specified
|
||||
{
|
||||
if (InsCod != Gbl.CurrentIns.Ins.InsCod) // Not the current institution
|
||||
Ins_PutParamInsCod (InsCod); // Go to another institution
|
||||
if (CrsCod > 0) // Course specified
|
||||
{
|
||||
if (CrsCod != Gbl.CurrentCrs.Crs.CrsCod) // Not the current course
|
||||
Crs_PutParamCrsCod (CrsCod); // Go to another course
|
||||
}
|
||||
else if (DegCod > 0) // Degree specified
|
||||
{
|
||||
if (DegCod != Gbl.CurrentDeg.Deg.DegCod) // Not the current degree
|
||||
Deg_PutParamDegCod (DegCod); // Go to another degree
|
||||
}
|
||||
else if (CtrCod > 0) // Centre specified
|
||||
{
|
||||
if (CtrCod != Gbl.CurrentCtr.Ctr.CtrCod) // Not the current centre
|
||||
Ctr_PutParamCtrCod (CtrCod); // Go to another centre
|
||||
}
|
||||
else if (InsCod > 0) // Institution specified
|
||||
{
|
||||
if (InsCod != Gbl.CurrentIns.Ins.InsCod) // Not the current institution
|
||||
Ins_PutParamInsCod (InsCod); // Go to another institution
|
||||
}
|
||||
}
|
||||
|
||||
return Gbl.InsideForm;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
147
swad_social.c
147
swad_social.c
|
@ -58,20 +58,20 @@ static const Act_Action_t Soc_DefaultActions[Soc_NUM_SOCIAL_NOTES] =
|
|||
ActUnk, // Soc_NOTE_UNKNOWN
|
||||
|
||||
/* Institution tab */
|
||||
ActSeeDocIns, // Soc_NOTE_INS_DOC_PUB_FILE
|
||||
ActAdmShaIns, // Soc_NOTE_INS_SHA_PUB_FILE
|
||||
ActReqDatSeeDocIns, // Soc_NOTE_INS_DOC_PUB_FILE
|
||||
ActReqDatShaIns, // Soc_NOTE_INS_SHA_PUB_FILE
|
||||
|
||||
/* Centre tab */
|
||||
ActSeeDocCtr, // Soc_NOTE_CTR_DOC_PUB_FILE
|
||||
ActAdmShaCtr, // Soc_NOTE_CTR_SHA_PUB_FILE
|
||||
ActReqDatSeeDocCtr, // Soc_NOTE_CTR_DOC_PUB_FILE
|
||||
ActReqDatShaCtr, // Soc_NOTE_CTR_SHA_PUB_FILE
|
||||
|
||||
/* Degree tab */
|
||||
ActSeeDocDeg, // Soc_NOTE_DEG_DOC_PUB_FILE
|
||||
ActAdmShaDeg, // Soc_NOTE_DEG_SHA_PUB_FILE
|
||||
ActReqDatSeeDocDeg, // Soc_NOTE_DEG_DOC_PUB_FILE
|
||||
ActReqDatShaDeg, // Soc_NOTE_DEG_SHA_PUB_FILE
|
||||
|
||||
/* Course tab */
|
||||
ActSeeDocCrs, // Soc_NOTE_CRS_DOC_PUB_FILE
|
||||
ActAdmShaCrs, // Soc_NOTE_CRS_SHA_PUB_FILE
|
||||
ActReqDatSeeDocCrs, // Soc_NOTE_CRS_DOC_PUB_FILE
|
||||
ActReqDatShaCrs, // Soc_NOTE_CRS_SHA_PUB_FILE
|
||||
|
||||
/* Assessment tab */
|
||||
ActSeeExaAnn, // Soc_NOTE_EXAM_ANNOUNCEMENT
|
||||
|
@ -135,8 +135,8 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
|
|||
bool WritingTimeline,bool LastInList);
|
||||
static void Soc_WriteNoteDate (time_t TimeUTC);
|
||||
static void Soc_GetAndWriteSocialPost (long PstCod);
|
||||
static void Soc_StartFormGoToAction (Soc_NoteType_t NoteType,
|
||||
long CrsCod,long Cod);
|
||||
static void Soc_PutFormGoToAction (Soc_NoteType_t NoteType,
|
||||
long CrsCod,long Cod);
|
||||
static void Soc_GetNoteSummary (const struct SocialNote *SocNot,
|
||||
char *SummaryStr,unsigned MaxChars);
|
||||
static void Soc_PublishSocialNoteInTimeline (struct SocialPublishing *SocPub);
|
||||
|
@ -303,11 +303,6 @@ static void Soc_ShowTimeline (const char *Query,Act_Action_t UpdateAction)
|
|||
/* Get and write social note */
|
||||
SocNot.NotCod = SocPub.NotCod;
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -354,8 +349,6 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
|
|||
const struct SocialNote *SocNot,
|
||||
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_Course;
|
||||
extern const char *Txt_Degree;
|
||||
|
@ -428,10 +421,6 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
|
|||
/* Get institution data */
|
||||
Ins.InsCod = SocNot->HieCod;
|
||||
Ins_GetDataOfInstitutionByCod (&Ins,Ins_GET_BASIC_DATA);
|
||||
|
||||
sprintf (Gbl.Message,"SocNot->Cod = %ld",
|
||||
SocNot->Cod);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
break;
|
||||
case Soc_NOTE_CTR_DOC_PUB_FILE:
|
||||
case Soc_NOTE_CTR_SHA_PUB_FILE:
|
||||
|
@ -472,13 +461,8 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
|
|||
}
|
||||
|
||||
/* Write note type */
|
||||
fprintf (Gbl.F.Out,"<div>");
|
||||
Soc_StartFormGoToAction (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 class=\"DAT\">");
|
||||
Soc_PutFormGoToAction (SocNot->NoteType,Crs.CrsCod,SocNot->Cod);
|
||||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
/* 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 **********/
|
||||
/*****************************************************************************/
|
||||
|
||||
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 char *The_ClassForm[The_NUM_THEMES];
|
||||
extern const char *Txt_SOCIAL_NOTE[Soc_NUM_SOCIAL_NOTES];
|
||||
struct FileMetadata FileMetadata;
|
||||
long InsCod = -1L;
|
||||
long CtrCod = -1L;
|
||||
|
@ -634,7 +620,6 @@ static void Soc_StartFormGoToAction (Soc_NoteType_t NoteType,long CrsCod,long Co
|
|||
long GrpCod = -1L;
|
||||
char PathUntilFileName[PATH_MAX+1];
|
||||
char FileName[NAME_MAX+1];
|
||||
Act_Action_t Action = ActUnk; // Initialized to avoid warning
|
||||
|
||||
/***** Parameters depending on the type of note *****/
|
||||
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_CRS_DOC_PUB_FILE:
|
||||
case Soc_NOTE_CRS_SHA_PUB_FILE:
|
||||
if (Cod > 0) // File code
|
||||
FileMetadata.FilCod = Cod;
|
||||
PathUntilFileName[0] = '\0';
|
||||
FileName[0] = '\0';
|
||||
if (FileMetadata.FilCod > 0)
|
||||
{
|
||||
sprintf (Gbl.Message,"Cod = %ld",
|
||||
Cod);
|
||||
Lay_ShowAlert (Lay_INFO,Gbl.Message);
|
||||
|
||||
FileMetadata.FilCod = Cod;
|
||||
Brw_GetFileMetadataByCod (&FileMetadata); // TODO: Check all calls to this function!!!!!
|
||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||
if (FileMetadata.FilCod > 0) // Found
|
||||
{
|
||||
Brw_GetCrsGrpFromFileMetadata (FileMetadata.FileBrowser,FileMetadata.Cod,
|
||||
|
@ -663,46 +646,13 @@ static void Soc_StartFormGoToAction (Soc_NoteType_t NoteType,long CrsCod,long Co
|
|||
PathUntilFileName,
|
||||
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:
|
||||
Action = (Cod > 0) ? ActReqDatSeeDocIns : ActSeeDocIns;
|
||||
break;
|
||||
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 (Soc_DefaultActions[NoteType]);
|
||||
// Brw_PutHiddenParamFilCod (FileMetadata.FilCod);
|
||||
Brw_PutParamsPathAndFile (FileMetadata.FileType,PathUntilFileName,FileName);
|
||||
}
|
||||
Act_FormStart (Action);
|
||||
// Grp_PutParamGrpCod (-1L);
|
||||
if (Cod > 0) // File code
|
||||
Brw_PutParamsPathAndFile (Brw_IS_FILE,PathUntilFileName,FileName);
|
||||
break;
|
||||
case Soc_NOTE_NOTICE:
|
||||
Act_FormStart (Soc_DefaultActions[NoteType]);
|
||||
|
@ -717,27 +667,38 @@ static void Soc_StartFormGoToAction (Soc_NoteType_t NoteType,long CrsCod,long Co
|
|||
break;
|
||||
}
|
||||
|
||||
/***** Parameter to go to another course *****/
|
||||
if (CrsCod > 0) // Course specified
|
||||
if (Gbl.InsideForm)
|
||||
{
|
||||
if (CrsCod != Gbl.CurrentCrs.Crs.CrsCod) // Not the current course
|
||||
Crs_PutParamCrsCod (CrsCod); // Go to another course
|
||||
}
|
||||
else if (DegCod > 0) // Degree specified
|
||||
{
|
||||
if (DegCod != Gbl.CurrentDeg.Deg.DegCod) // Not the current degree
|
||||
Deg_PutParamDegCod (DegCod); // Go to another degree
|
||||
}
|
||||
else if (CtrCod > 0) // Centre specified
|
||||
{
|
||||
if (CtrCod != Gbl.CurrentCtr.Ctr.CtrCod) // Not the current centre
|
||||
Ctr_PutParamCtrCod (CtrCod); // Go to another centre
|
||||
}
|
||||
else if (InsCod > 0) // Institution specified
|
||||
{
|
||||
if (InsCod != Gbl.CurrentIns.Ins.InsCod) // Not the current institution
|
||||
Ins_PutParamInsCod (InsCod); // Go to another institution
|
||||
/***** Parameter to go to another place in hierarchy *****/
|
||||
if (CrsCod > 0) // Course specified
|
||||
{
|
||||
if (CrsCod != Gbl.CurrentCrs.Crs.CrsCod) // Not the current course
|
||||
Crs_PutParamCrsCod (CrsCod); // Go to another course
|
||||
}
|
||||
else if (DegCod > 0) // Degree specified
|
||||
{
|
||||
if (DegCod != Gbl.CurrentDeg.Deg.DegCod) // Not the current degree
|
||||
Deg_PutParamDegCod (DegCod); // Go to another degree
|
||||
}
|
||||
else if (CtrCod > 0) // Centre specified
|
||||
{
|
||||
if (CtrCod != Gbl.CurrentCtr.Ctr.CtrCod) // Not the current centre
|
||||
Ctr_PutParamCtrCod (CtrCod); // Go to another centre
|
||||
}
|
||||
else if (InsCod > 0) // Institution specified
|
||||
{
|
||||
if (InsCod != Gbl.CurrentIns.Ins.InsCod) // Not the current 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