mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-04 15:55:24 +02:00
Version 15.95
This commit is contained in:
parent
fef9a3679b
commit
69947cbfd9
|
@ -1004,15 +1004,15 @@ Social:
|
|||
|
||||
839. ActReqSocPstGbl Write a public social post to be displayed in the timeline (global)
|
||||
840. ActRcvSocPstGbl Receive a public social post to be displayed in the timeline (global)
|
||||
NEW!!!!!!!!. ActShaSocPubGbl Share a social publishing in the timeline (global)
|
||||
NEW!!!!!!!!. ActShaSocNotGbl Share a social publishing in the timeline (global)
|
||||
NEW!!!!!!!!. ActUnsSocPubGbl Unshare a previously shared social publishing in the timeline (global)
|
||||
841. ActReqRemSocPubGbl Request the removal of a social publishing in the timeline (global)
|
||||
842. ActRemSocPubGbl Remove a social publishing in the timeline (global)
|
||||
|
||||
NEW!!!!!!!!. ActReqSocPstUsr Write a public social post to be displayed in the timeline (user)
|
||||
NEW!!!!!!!!. ActRcvSocPstUsr Receive a public social post to be displayed in the timeline (user)
|
||||
NEW!!!!!!!!. ActShaSocPubUsr Share a social publishing in the timeline (user)
|
||||
NEW!!!!!!!!. ActUnsSocPubUsr Unshare a previously shared social publishing in the timeline (user)
|
||||
NEW!!!!!!!!. ActShaSocNotUsr Share a social note in the timeline (user)
|
||||
NEW!!!!!!!!. ActUnsSocPubUsr Unshare a previously shared social note in the timeline (user)
|
||||
NEW!!!!!!!!. ActReqRemSocPubUsr Request the removal of a social publishing in the timeline (user)
|
||||
NEW!!!!!!!!. ActRemSocPubUsr Remove a social publishing in the timeline (user)
|
||||
|
||||
|
@ -2325,14 +2325,14 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
|
||||
/* ActReqSocPstGbl */{1491,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_FormSocialPostGbl ,NULL},
|
||||
/* ActRcvSocPstGbl */{1492,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_ReceiveSocialPostGbl ,NULL},
|
||||
/* ActShaSocPubGbl */{1495,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_ShareSocialPubGbl ,NULL},
|
||||
/* ActShaSocNotGbl */{1495,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_ShareSocialNoteGbl ,NULL},
|
||||
/* ActUnsSocPubGbl */{1496,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_UnshareSocialPubGbl ,NULL},
|
||||
/* ActReqRemSocPubGbl*/{1494,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RequestRemSocialPubGbl ,NULL},
|
||||
/* ActRemSocPubGbl */{1493,-1,TabSoc,ActSeeSocTmlGbl ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RemoveSocialPubGbl ,NULL},
|
||||
|
||||
/* ActReqSocPstUsr */{1497,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_FormSocialPostUsr ,NULL},
|
||||
/* ActRcvSocPstUsr */{1498,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_ReceiveSocialPostUsr ,NULL},
|
||||
/* ActShaSocPubUsr */{1499,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_ShareSocialPubUsr ,NULL},
|
||||
/* ActShaSocNotUsr */{1499,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_ShareSocialNoteUsr ,NULL},
|
||||
/* ActUnsSocPubUsr */{1500,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_UnshareSocialPubUsr ,NULL},
|
||||
/* ActReqRemSocPubUsr*/{1501,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RequestRemSocialPubUsr ,NULL},
|
||||
/* ActRemSocPubUsr */{1502,-1,TabSoc,ActReqPubPrf ,0x1FE,0x1FE,0x1FE,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Soc_RemoveSocialPubUsr ,NULL},
|
||||
|
@ -4178,11 +4178,11 @@ Act_Action_t Act_FromActCodToAction[1+Act_MAX_ACTION_COD] = // Do not reuse uniq
|
|||
ActRcvSocPstGbl, // #1492
|
||||
ActRemSocPubGbl, // #1493
|
||||
ActReqRemSocPubGbl, // #1494
|
||||
ActShaSocPubGbl, // #1495
|
||||
ActShaSocNotGbl, // #1495
|
||||
ActUnsSocPubGbl, // #1496
|
||||
ActReqSocPstUsr, // #1497
|
||||
ActRcvSocPstUsr, // #1498
|
||||
ActShaSocPubUsr, // #1499
|
||||
ActShaSocNotUsr, // #1499
|
||||
ActUnsSocPubUsr, // #1500
|
||||
ActReqRemSocPubUsr, // #1501
|
||||
ActRemSocPubUsr, // #1502
|
||||
|
|
|
@ -1043,14 +1043,14 @@ typedef int Act_Action_t; // Must be a signed type, because -1 is used to indica
|
|||
// Secondary actions
|
||||
#define ActReqSocPstGbl (ActLstClk+ 5)
|
||||
#define ActRcvSocPstGbl (ActLstClk+ 6)
|
||||
#define ActShaSocPubGbl (ActLstClk+ 7)
|
||||
#define ActShaSocNotGbl (ActLstClk+ 7)
|
||||
#define ActUnsSocPubGbl (ActLstClk+ 8)
|
||||
#define ActReqRemSocPubGbl (ActLstClk+ 9)
|
||||
#define ActRemSocPubGbl (ActLstClk+ 10)
|
||||
|
||||
#define ActReqSocPstUsr (ActLstClk+ 11)
|
||||
#define ActRcvSocPstUsr (ActLstClk+ 12)
|
||||
#define ActShaSocPubUsr (ActLstClk+ 13)
|
||||
#define ActShaSocNotUsr (ActLstClk+ 13)
|
||||
#define ActUnsSocPubUsr (ActLstClk+ 14)
|
||||
#define ActReqRemSocPubUsr (ActLstClk+ 15)
|
||||
#define ActRemSocPubUsr (ActLstClk+ 16)
|
||||
|
|
|
@ -112,18 +112,20 @@
|
|||
// TODO: Hour in exam announcement should start at six a.m.
|
||||
// TODO: Change "Actividad pública" to "Actividad de Antonio" in user's profile
|
||||
// TODO: Forums For_FORUM_GLOBAL_USRS and For_FORUM_SWAD_USRS should be available for guests for coherence with social timeline?
|
||||
// TODO: Unavailable social notes should not be shared
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.94.1 (2016-01-04)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.95 (2016-01-04)"
|
||||
#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.95: Jan 04, 2016 Fixed bug in social timeline: social notes can be shared, not social publishings. (190583 lines)
|
||||
Version 15.94.1: Jan 04, 2016 Changes when writing an unavailable social note. (190557 lines)
|
||||
Version 15.94: Jan 04, 2016 Social notes are marked as unavailable when a folder and its children are removed. (190551 lines)
|
||||
Version 15.93.8: Jan 04, 2016 Social note is marked as unavailable when a public file is removed. (190486 lines)
|
||||
|
|
|
@ -108,7 +108,7 @@ struct SocialNote
|
|||
{
|
||||
long NotCod;
|
||||
Soc_NoteType_t NoteType;
|
||||
long UsrCod;
|
||||
long UsrCod; // TODO: Rename as AuthorCod here and in database?
|
||||
long HieCod; // Hierarchy code (institution/centre/degree/course)
|
||||
long Cod; // Code of file, forum post, notice,...
|
||||
bool Unavailable; // File, forum post, notice,... unavailable (removed)
|
||||
|
@ -145,13 +145,15 @@ static void Soc_PutLinkToWriteANewPost (Act_Action_t Action,void (*FuncParams) (
|
|||
static void Soc_FormSocialPost (void);
|
||||
static void Soc_ReceiveSocialPost (void);
|
||||
|
||||
static void Soc_PutFormToShareSocialPublishing (long PubCod);
|
||||
static void Soc_PutFormToShareSocialNote (long NotCod);
|
||||
static void Soc_PutFormToUnshareSocialPublishing (long PubCod);
|
||||
static void Soc_PutFormToRemoveSocialPublishing (long PubCod);
|
||||
static void Soc_PutHiddenParamPubCod (long NotCod);
|
||||
static void Soc_PutHiddenParamNotCod (long NotCod);
|
||||
static long Soc_GetParamNotCod (void);
|
||||
static void Soc_PutHiddenParamPubCod (long PubCod);
|
||||
static long Soc_GetParamPubCod (void);
|
||||
|
||||
static void Soc_ShareSocialPublishing (void);
|
||||
static void Soc_ShareSocialNote (void);
|
||||
static void Soc_UnshareSocialPublishing (void);
|
||||
static void Soc_UnshareASocialPublishingFromDB (const struct SocialNote *SocNot);
|
||||
|
||||
|
@ -530,7 +532,7 @@ static void Soc_WriteSocialNote (const struct SocialPublishing *SocPub,
|
|||
else
|
||||
// I have not yet published this social note
|
||||
/* Put icon to share this publishing */
|
||||
Soc_PutFormToShareSocialPublishing (SocPub->PubCod);
|
||||
Soc_PutFormToShareSocialNote (SocNot->NotCod);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -961,6 +963,7 @@ void Soc_MarkSocialNotesChildrenOfFolderAsUnavailable (const char *Path)
|
|||
/*****************************************************************************/
|
||||
/***************** Put contextual link to write a new post *******************/
|
||||
/*****************************************************************************/
|
||||
// SocPub->PubCod is set
|
||||
|
||||
static void Soc_PublishSocialNoteInTimeline (struct SocialPublishing *SocPub)
|
||||
{
|
||||
|
@ -972,7 +975,7 @@ static void Soc_PublishSocialNoteInTimeline (struct SocialPublishing *SocPub)
|
|||
" VALUES"
|
||||
" ('%ld','%ld','%ld',NOW())",
|
||||
SocPub->AuthorCod,SocPub->PublisherCod,SocPub->NotCod);
|
||||
DB_QueryINSERT (Query,"can not publish social note");
|
||||
SocPub->PubCod = DB_QueryINSERTandReturnCode (Query,"can not publish social note");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1113,22 +1116,23 @@ static void Soc_ReceiveSocialPost (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Form to share social publishing ***********************/
|
||||
/************************* Form to share social note *************************/
|
||||
/*****************************************************************************/
|
||||
// Social notes can be shared, not social publishing
|
||||
|
||||
static void Soc_PutFormToShareSocialPublishing (long PubCod)
|
||||
static void Soc_PutFormToShareSocialNote (long NotCod)
|
||||
{
|
||||
extern const char *Txt_Share;
|
||||
|
||||
/***** Form to share social publishing *****/
|
||||
/***** Form to share social note *****/
|
||||
if (Gbl.Usrs.Other.UsrDat.UsrCod > 0)
|
||||
{
|
||||
Act_FormStartAnchor (ActShaSocPubUsr,"timeline");
|
||||
Act_FormStartAnchor (ActShaSocNotUsr,"timeline");
|
||||
Usr_PutParamOtherUsrCodEncrypted ();
|
||||
}
|
||||
else
|
||||
Act_FormStart (ActShaSocPubGbl);
|
||||
Soc_PutHiddenParamPubCod (PubCod);
|
||||
Act_FormStart (ActShaSocNotGbl);
|
||||
Soc_PutHiddenParamNotCod (NotCod);
|
||||
fprintf (Gbl.F.Out,"<div class=\"SOCIAL_ICON ICON_HIGHLIGHT\">"
|
||||
"<input type=\"image\""
|
||||
" src=\"%s/share64x64.png\""
|
||||
|
@ -1199,6 +1203,32 @@ static void Soc_PutFormToRemoveSocialPublishing (long PubCod)
|
|||
Act_FormEnd ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** Put parameter with the code of a social note *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Soc_PutHiddenParamNotCod (long NotCod)
|
||||
{
|
||||
Par_PutHiddenParamLong ("NotCod",NotCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** Get parameter with the code of a social note *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static long Soc_GetParamNotCod (void)
|
||||
{
|
||||
char LongStr[1+10+1]; // String that holds the social note code
|
||||
long NotCod;
|
||||
|
||||
/* Get social note code */
|
||||
Par_GetParToText ("NotCod",LongStr,1+10);
|
||||
if (sscanf (LongStr,"%ld",&NotCod) != 1)
|
||||
Lay_ShowErrorAndExit ("Wrong code of social note.");
|
||||
|
||||
return NotCod;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Put parameter with the code of a social publishing **************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1214,7 +1244,7 @@ static void Soc_PutHiddenParamPubCod (long PubCod)
|
|||
|
||||
static long Soc_GetParamPubCod (void)
|
||||
{
|
||||
char LongStr[1+10+1]; // String that holds the social note code
|
||||
char LongStr[1+10+1]; // String that holds the social publishing code
|
||||
long PubCod;
|
||||
|
||||
/* Get social note code */
|
||||
|
@ -1226,31 +1256,32 @@ static long Soc_GetParamPubCod (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Share a social publishing *************************/
|
||||
/**************************** Share a social note ****************************/
|
||||
/*****************************************************************************/
|
||||
// Social notes can be shared, not social publishing
|
||||
|
||||
void Soc_ShareSocialPubGbl (void)
|
||||
void Soc_ShareSocialNoteGbl (void)
|
||||
{
|
||||
/***** Share social publishing *****/
|
||||
Soc_ShareSocialPublishing ();
|
||||
/***** Share social note *****/
|
||||
Soc_ShareSocialNote ();
|
||||
|
||||
/***** Write updated timeline after sharing (global) *****/
|
||||
Soc_ShowTimelineGbl ();
|
||||
}
|
||||
|
||||
void Soc_ShareSocialPubUsr (void)
|
||||
void Soc_ShareSocialNoteUsr (void)
|
||||
{
|
||||
/***** Get user whom profile is displayed *****/
|
||||
Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ();
|
||||
|
||||
/***** Show user's profile *****/
|
||||
/***** Show user's profile *****/
|
||||
Prf_ShowUserProfile ();
|
||||
|
||||
/***** Start section *****/
|
||||
fprintf (Gbl.F.Out,"<section id=\"timeline\">");
|
||||
|
||||
/***** Share social publishing *****/
|
||||
Soc_ShareSocialPublishing ();
|
||||
/***** Share social note *****/
|
||||
Soc_ShareSocialNote ();
|
||||
|
||||
/***** Write updated timeline after sharing (user) *****/
|
||||
Soc_ShowTimelineUsr ();
|
||||
|
@ -1259,35 +1290,33 @@ void Soc_ShareSocialPubUsr (void)
|
|||
fprintf (Gbl.F.Out,"</section>");
|
||||
}
|
||||
|
||||
static void Soc_ShareSocialPublishing (void)
|
||||
static void Soc_ShareSocialNote (void)
|
||||
{
|
||||
extern const char *Txt_SOCIAL_PUBLISHING_Shared;
|
||||
struct SocialPublishing SocPub;
|
||||
struct SocialNote SocNot;
|
||||
struct SocialPublishing SocPub;
|
||||
bool ICanShare;
|
||||
bool IHavePublishedThisNote;
|
||||
|
||||
/***** Get the code of the social publishing to share *****/
|
||||
SocPub.PubCod = Soc_GetParamPubCod ();
|
||||
|
||||
/***** Get data of social publishing *****/
|
||||
Soc_GetDataOfSocialPublishingByCod (&SocPub);
|
||||
/***** Get the code of the social note to share *****/
|
||||
SocNot.NotCod = Soc_GetParamNotCod ();
|
||||
|
||||
/***** Get data of social note *****/
|
||||
SocNot.NotCod = SocPub.NotCod;
|
||||
Soc_GetDataOfSocialNoteByCod (&SocNot);
|
||||
|
||||
ICanShare = (Gbl.Usrs.Me.Logged &&
|
||||
SocPub.AuthorCod != Gbl.Usrs.Me.UsrDat.UsrCod); // I am not the author
|
||||
SocNot.UsrCod != Gbl.Usrs.Me.UsrDat.UsrCod); // I am not the author
|
||||
if (ICanShare)
|
||||
{
|
||||
/***** Check if I have yet shared this social note *****/
|
||||
IHavePublishedThisNote = Soc_CheckIfNoteIsYetPublishedByMe (SocPub.NotCod);
|
||||
IHavePublishedThisNote = Soc_CheckIfNoteIsYetPublishedByMe (SocNot.NotCod);
|
||||
if (!IHavePublishedThisNote)
|
||||
{
|
||||
/***** Share (publish social note in timeline) *****/
|
||||
SocPub.AuthorCod = SocNot.UsrCod;
|
||||
SocPub.PublisherCod = Gbl.Usrs.Me.UsrDat.UsrCod;
|
||||
Soc_PublishSocialNoteInTimeline (&SocPub);
|
||||
SocPub.NotCod = SocNot.NotCod;
|
||||
Soc_PublishSocialNoteInTimeline (&SocPub); // Set SocPub.PubCod
|
||||
|
||||
/***** Message of success *****/
|
||||
Lay_ShowAlert (Lay_SUCCESS,Txt_SOCIAL_PUBLISHING_Shared);
|
||||
|
|
|
@ -95,8 +95,8 @@ void Soc_FormSocialPostUsr (void);
|
|||
void Soc_ReceiveSocialPostGbl (void);
|
||||
void Soc_ReceiveSocialPostUsr (void);
|
||||
|
||||
void Soc_ShareSocialPubGbl (void);
|
||||
void Soc_ShareSocialPubUsr (void);
|
||||
void Soc_ShareSocialNoteGbl (void);
|
||||
void Soc_ShareSocialNoteUsr (void);
|
||||
void Soc_UnshareSocialPubGbl (void);
|
||||
void Soc_UnshareSocialPubUsr (void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user